Skip to content

Commit

Permalink
chore(4176): remove development console.log statements
Browse files Browse the repository at this point in the history
  • Loading branch information
Kolezhanchik committed Nov 13, 2024
1 parent 58a8bc9 commit 6814ec5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 67 deletions.
4 changes: 0 additions & 4 deletions app/helpers/auto-approval-check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ export interface Quotas {
}

function checkAutoApprovalEligibility({ allocation, deployment, resourceType }: QuotaUpgradeResourceDetail): boolean {
console.log('allocation', allocation);
console.log('deployment', deployment);
console.log('resourceType', resourceType);

if (deployment.usage === -1) return false;

// Calculate usage-to-limit and utilization ratios
Expand Down
63 changes: 0 additions & 63 deletions app/services/k8s/usage-metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,66 +161,3 @@ export async function getPodMetrics(
}
return usageData;
}

// export async function getPodMetrics(
// licencePlate: string,
// environment: string,
// cluster: Cluster,
// ): Promise<resourceMetrics> {
// const { apiClient, metricsClient } = getK8sClients(cluster);
// const usageData: resourceMetrics = { podMetrics: [], pvcMetrics: [] };

// const namespace = `${licencePlate}-${environment}`;
// let metricItems: PodMetric[] = [];

// try {
// const pvc = await collectPVCMetrics(namespace, cluster);
// const metrics = await metricsClient.getPodMetrics(namespace);
// if ((!metrics.items || metrics.items.length === 0) && (!pvc || pvc.length === 0)) {
// return { podMetrics: [], pvcMetrics: [] };
// }
// usageData.pvcMetrics = pvc || [];
// metricItems = metrics.items;
// } catch (error: any) {
// logger.error(error.body);
// return { podMetrics: [], pvcMetrics: [] };
// }

// // Iterate through each pod and its containers to extract usage metrics
// for (const item of metricItems) {
// const name = item.metadata.name;
// const podStatus = await apiClient.readNamespacedPodStatus(name, namespace);

// // Map over containers to collect their usage, limits, and requests
// const containers = item.containers
// .filter((container) => {
// if (container.name === 'POD' && container.usage.cpu === '0' && container.usage.memory === '0') return false;
// return true;
// })
// .map((container, index) => {
// const resourceDef = podStatus.body.spec?.containers[index]?.resources ?? {};

// return {
// name: container.name,
// usage: {
// cpu: normalizeCpu(container.usage.cpu) || 0,
// memory: normalizeMemory(container.usage.memory) || 0,
// },
// limits: {
// cpu: normalizeCpu(resourceDef.limits?.cpu || '0'),
// memory: normalizeMemory(resourceDef.limits?.memory || '0'),
// },
// requests: {
// cpu: normalizeCpu(resourceDef.requests?.cpu || '0'),
// memory: normalizeMemory(resourceDef.requests?.memory || '0'),
// },
// };
// });
// const podResources = {
// name,
// containers,
// };
// usageData.podMetrics.push(podResources);
// }
// return usageData;
// }

0 comments on commit 6814ec5

Please sign in to comment.