fix(kubernetes): Typos in exported attributes (#19276)

* chore: Fix minor test description typo

Signed-off-by: Adam Harvey <aharvey00@gmail.com>

* fix(kubernetes): Typo attributes

Signed-off-by: Adam Harvey <aharvey00@gmail.com>

* fix(kubernetes): Fix typo in error detection attribute

Signed-off-by: Adam Harvey <aharvey00@gmail.com>

* fix(kubernetes): Update report with fixed attribute typos

Signed-off-by: Adam Harvey <aharvey00@gmail.com>

* chore(kubernetes): Add changeset

Signed-off-by: Adam Harvey <aharvey00@gmail.com>

---------

Signed-off-by: Adam Harvey <aharvey00@gmail.com>
This commit is contained in:
Adam Harvey
2023-08-13 08:28:41 -04:00
committed by GitHub
parent ba780dbefa
commit 4b6d41737a
18 changed files with 50 additions and 42 deletions
+8
View File
@@ -0,0 +1,8 @@
---
'@backstage/plugin-kubernetes': minor
---
**BREAKING**: Fixed typos in exported module attributes. Many users may see no changes, but if you have customized the plugin output, you may have to rename the following:
- Component attribute: `<ResourceUtilization totalFormated={} />` to `<ResourceUtilization totalFormatted={} />`
- Interface attribute: `DetectedError.occuranceCount` to `DetectedError.occurrenceCount`.
+2 -2
View File
@@ -137,7 +137,7 @@ export interface DetectedError {
// (undocumented)
message: string;
// (undocumented)
occuranceCount: number;
occurrenceCount: number;
// Warning: (ae-forgotten-export) The symbol "ProposedFix" needs to be exported by the entry point index.d.ts
//
// (undocumented)
@@ -714,7 +714,7 @@ export const ResourceUtilization: ({
title,
usage,
total,
totalFormated,
totalFormatted,
}: ResourceUtilizationProps) => JSX.Element;
// Warning: (ae-missing-release-tag) "Router" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
@@ -38,7 +38,7 @@ describe('ErrorList', () => {
type: 'some-error',
severity: 10,
message: 'some error message',
occuranceCount: 1,
occurrenceCount: 1,
sourceRef: {
name: 'some-pod',
namespace: 'some-namespace',
@@ -50,7 +50,7 @@ describe('FixDialog', () => {
type: 'some error type',
severity: 10,
message: 'some error message',
occuranceCount: 1,
occurrenceCount: 1,
sourceRef: {
name: 'some-pod',
namespace: 'some-namespace',
@@ -91,7 +91,7 @@ describe('FixDialog', () => {
type: 'some error type',
severity: 10,
message: 'some error message',
occuranceCount: 1,
occurrenceCount: 1,
sourceRef: {
name: 'some-pod',
namespace: 'some-namespace',
@@ -132,7 +132,7 @@ describe('FixDialog', () => {
type: 'some error type',
severity: 10,
message: 'some error message',
occuranceCount: 1,
occurrenceCount: 1,
sourceRef: {
name: 'some-pod',
namespace: 'some-namespace',
@@ -31,7 +31,7 @@ import { PodScope, PodLogsDialog } from '../PodLogs';
import { StructuredMetadataTable } from '@backstage/core-components';
import { ClientContainerStatus } from '@backstage/plugin-kubernetes-common';
import { ResourceUtilization } from '../../ResourceUtilization';
import { bytesToMiB, formatMilicores } from '../../../utils/resources';
import { bytesToMiB, formatMillicores } from '../../../utils/resources';
const getContainerHealthChecks = (
containerSpec: IContainer,
@@ -186,7 +186,7 @@ export const ContainerCard: React.FC<ContainerCardProps> = ({
title="CPU requests"
usage={containerMetrics.cpuUsage.currentUsage}
total={containerMetrics.cpuUsage.requestTotal}
totalFormated={formatMilicores(
totalFormatted={formatMillicores(
containerMetrics.cpuUsage.requestTotal,
)}
/>
@@ -195,7 +195,7 @@ export const ContainerCard: React.FC<ContainerCardProps> = ({
title="CPU limits"
usage={containerMetrics.cpuUsage.currentUsage}
total={containerMetrics.cpuUsage.limitTotal}
totalFormated={formatMilicores(
totalFormatted={formatMillicores(
containerMetrics.cpuUsage.limitTotal,
)}
/>
@@ -204,7 +204,7 @@ export const ContainerCard: React.FC<ContainerCardProps> = ({
title="Memory requests"
usage={containerMetrics.memoryUsage.currentUsage}
total={containerMetrics.memoryUsage.requestTotal}
totalFormated={bytesToMiB(
totalFormatted={bytesToMiB(
containerMetrics.memoryUsage.requestTotal,
)}
/>
@@ -213,7 +213,7 @@ export const ContainerCard: React.FC<ContainerCardProps> = ({
title="Memory limits"
usage={containerMetrics.memoryUsage.currentUsage}
total={containerMetrics.memoryUsage.limitTotal}
totalFormated={bytesToMiB(
totalFormatted={bytesToMiB(
containerMetrics.memoryUsage.limitTotal,
)}
/>
@@ -56,7 +56,7 @@ describe('PodDrawer', () => {
type: 'some-error',
severity: 10,
message: 'some error message',
occuranceCount: 1,
occurrenceCount: 1,
sourceRef: {
name: 'some-pod',
namespace: 'some-namespace',
@@ -35,7 +35,7 @@ import { PendingPodContent } from './PendingPodContent';
import { ErrorList } from '../ErrorList';
import { usePodMetrics } from '../../../hooks/usePodMetrics';
import { ResourceUtilization } from '../../ResourceUtilization';
import { bytesToMiB, formatMilicores } from '../../../utils/resources';
import { bytesToMiB, formatMillicores } from '../../../utils/resources';
const useDrawerContentStyles = makeStyles((_theme: Theme) =>
createStyles({
@@ -109,13 +109,13 @@ export const PodDrawer = ({ podAndErrors, open }: PodDrawerProps) => {
title="CPU requests"
usage={podMetrics.cpu.currentUsage}
total={podMetrics.cpu.requestTotal}
totalFormated={formatMilicores(podMetrics.cpu.requestTotal)}
totalFormatted={formatMillicores(podMetrics.cpu.requestTotal)}
/>
<ResourceUtilization
title="CPU limits"
usage={podMetrics.cpu.currentUsage}
total={podMetrics.cpu.limitTotal}
totalFormated={formatMilicores(podMetrics.cpu.limitTotal)}
totalFormatted={formatMillicores(podMetrics.cpu.limitTotal)}
/>
</Grid>
<Grid item xs={6}>
@@ -123,13 +123,13 @@ export const PodDrawer = ({ podAndErrors, open }: PodDrawerProps) => {
title="Memory requests"
usage={podMetrics.memory.currentUsage}
total={podMetrics.memory.requestTotal}
totalFormated={bytesToMiB(podMetrics.memory.requestTotal)}
totalFormatted={bytesToMiB(podMetrics.memory.requestTotal)}
/>
<ResourceUtilization
title="Memory limits"
usage={podMetrics.memory.currentUsage}
total={podMetrics.memory.limitTotal}
totalFormated={bytesToMiB(podMetrics.memory.requestTotal)}
totalFormatted={bytesToMiB(podMetrics.memory.requestTotal)}
/>
</Grid>
</Grid>
+1 -1
View File
@@ -124,7 +124,7 @@ describe('PodsTable', () => {
expect(getByText('requests: 1% of 64MiB')).toBeInTheDocument();
expect(getByText('limits: 0% of 128MiB')).toBeInTheDocument();
});
it('should render placehoplder when empty metrics context', async () => {
it('should render placeholder when empty metrics context', async () => {
const podNameToClientPodStatus = new Map<string, ClientPodStatus[]>();
const wrapper = kubernetesProviders(
@@ -27,7 +27,7 @@ describe('ResourceUtilization', () => {
title="some-title"
usage="1000"
total="10000"
totalFormated="15%"
totalFormatted="15%"
/>,
),
);
@@ -43,7 +43,7 @@ describe('ResourceUtilization', () => {
title="some-title"
usage="1000"
total="10000"
totalFormated="15%"
totalFormatted="15%"
/>,
),
);
@@ -29,7 +29,7 @@ export interface ResourceUtilizationProps {
title: string;
usage: number | string;
total: number | string;
totalFormated: string;
totalFormatted: string;
}
// Visible for testing
@@ -64,7 +64,7 @@ export const ResourceUtilization = ({
title,
usage,
total,
totalFormated,
totalFormatted,
}: ResourceUtilizationProps) => {
const utilization = currentToDeclaredResourceToPerc(usage, total);
return (
@@ -72,7 +72,7 @@ export const ResourceUtilization = ({
<Grid item xs={12}>
<Typography
variant={compressed ? 'caption' : 'subtitle2'}
>{`${title}: ${totalFormated}`}</Typography>
>{`${title}: ${totalFormatted}`}</Typography>
</Grid>
<Grid item xs={12}>
<LinearGauge
@@ -34,7 +34,7 @@ const deploymentErrorMappers: ErrorMapper<Deployment>[] = [
kind: 'Deployment',
apiGroup: 'apps/v1',
},
occuranceCount: 1,
occurrenceCount: 1,
}));
},
},
@@ -164,7 +164,7 @@ describe('detectErrors', () => {
'The container other-side-car has crashed many times, it will be exponentially restarted until it stops crashing',
type: 'logs',
},
occuranceCount: 1,
occurrenceCount: 1,
type: 'container-waiting',
});
@@ -186,7 +186,7 @@ describe('detectErrors', () => {
message:
'back-off 5m0s restarting failed container=side-car pod=dice-roller-canary-7d64cd756c-55rfq_default(65ad28e3-5d51-4b4b-9bf8-4cb069803034)',
severity: 4,
occuranceCount: 1,
occurrenceCount: 1,
type: 'container-waiting',
});
@@ -199,7 +199,7 @@ describe('detectErrors', () => {
},
message: 'container=other-side-car restarted 123 times',
severity: 4,
occuranceCount: 123,
occurrenceCount: 123,
proposedFix: {
container: 'other-side-car',
errorType: 'Error',
@@ -228,7 +228,7 @@ describe('detectErrors', () => {
},
message: 'container=side-car restarted 38 times',
severity: 4,
occuranceCount: 38,
occurrenceCount: 38,
type: 'containers-restarting',
});
});
@@ -246,7 +246,7 @@ describe('detectErrors', () => {
expect(err1).toStrictEqual({
message: 'configmap "some-cm" not found',
occuranceCount: 1,
occurrenceCount: 1,
proposedFix: {
docsLink:
'https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/',
@@ -300,7 +300,7 @@ describe('detectErrors', () => {
},
message: 'Deployment does not have minimum availability.',
severity: 6,
occuranceCount: 1,
occurrenceCount: 1,
type: 'condition-message-present',
});
});
@@ -336,7 +336,7 @@ describe('detectErrors', () => {
message:
'Current number of replicas (10) is equal to the configured max number of replicas (10)',
severity: 8,
occuranceCount: 1,
occurrenceCount: 1,
type: 'hpa-max-current-replicas',
});
});
@@ -469,7 +469,7 @@ describe('detectErrors', () => {
expect(err1).toStrictEqual({
message:
'The container some-container failed to start properly, but is not crashing',
occuranceCount: 1,
occurrenceCount: 1,
proposedFix: {
errorType: 'ReadinessProbeFailed',
podName: '',
@@ -37,7 +37,7 @@ const hpaErrorMappers: ErrorMapper<HorizontalPodAutoscaler>[] = [
kind: 'HorizontalPodAutoscaler',
apiGroup: 'autoscaling/v1',
},
occuranceCount: 1,
occurrenceCount: 1,
},
];
}
@@ -209,7 +209,7 @@ const podErrorMappers: ErrorMapper<Pod>[] = [
kind: 'Pod',
apiGroup: 'v1',
},
occuranceCount: 1,
occurrenceCount: 1,
}));
},
},
@@ -228,7 +228,7 @@ const podErrorMappers: ErrorMapper<Pod>[] = [
kind: 'Pod',
apiGroup: 'v1',
},
occuranceCount: 1,
occurrenceCount: 1,
}));
},
},
@@ -247,7 +247,7 @@ const podErrorMappers: ErrorMapper<Pod>[] = [
kind: 'Pod',
apiGroup: 'v1',
},
occuranceCount: cs.restartCount,
occurrenceCount: cs.restartCount,
}));
},
},
@@ -51,7 +51,7 @@ export interface DetectedError {
message: string;
proposedFix?: ProposedFix;
sourceRef: ResourceRef;
occuranceCount: number;
occurrenceCount: number;
}
export type ProposedFix = LogSolution | DocsSolution | EventsSolution;
@@ -24,7 +24,7 @@ const genericErrorWithRef = (resourceRef: ResourceRef): DetectedError => {
type: 'some-error',
severity: 10,
message: 'some error message',
occuranceCount: 1,
occurrenceCount: 1,
sourceRef: resourceRef,
proposedFix: {
type: 'logs',
+3 -3
View File
@@ -29,7 +29,7 @@ import {
} from '@backstage/core-components';
import { ClientPodStatus } from '@backstage/plugin-kubernetes-common';
import { Pod } from 'kubernetes-models/v1/Pod';
import { bytesToMiB, formatMilicores } from './resources';
import { bytesToMiB, formatMillicores } from './resources';
export const imageChips = (pod: V1Pod): ReactNode => {
const containerStatuses = pod.status?.containerStatuses ?? [];
@@ -148,11 +148,11 @@ export const podStatusToCpuUtil = (podStatus: ClientPodStatus): ReactNode => {
value={`requests: ${currentToDeclaredResourceToPerc(
currentUsage,
cpuUtil.requestTotal,
)} of ${formatMilicores(cpuUtil.requestTotal)}`}
)} of ${formatMillicores(cpuUtil.requestTotal)}`}
subvalue={`limits: ${currentToDeclaredResourceToPerc(
currentUsage,
cpuUtil.limitTotal,
)} of ${formatMilicores(cpuUtil.limitTotal)}`}
)} of ${formatMillicores(cpuUtil.limitTotal)}`}
/>
);
};
+1 -1
View File
@@ -33,6 +33,6 @@ export const bytesToMiB = (value: string | number): string => {
return `${(parseFloat(value.toString()) / 1024 / 1024).toFixed(0)}MiB`;
};
export const formatMilicores = (value: string | number): string => {
export const formatMillicores = (value: string | number): string => {
return `${(parseFloat(value.toString()) * 1000).toFixed(0)}m`;
};