Skip to content

Commit ecdf4b5

Browse files
committed
fixes
1 parent b6f7f2f commit ecdf4b5

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/lib/api/types/shared/keyNames.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export const CHARGING_TARGET_LABEL: string = 'openmcp.cloud.sap/charging-target'
33
export const CHARGING_TARGET_TYPE_LABEL: string = 'openmcp.cloud.sap/charging-target-type';
44
export const PROJECT_NAME_LABEL: string = 'openmcp.cloud/mcp-project';
55
export const WORKSPACE_LABEL: string = 'openmcp.cloud/mcp-workspace';
6+
export const LAST_APPLIED_CONFIGURATION_ANNOTATION = 'kubectl.kubernetes.io/last-applied-configuration';

src/utils/removeManagedFieldsProperty.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { LAST_APPLIED_CONFIGURATION_ANNOTATION } from '../lib/api/types/shared/keyNames';
2+
13
export type Resource = {
24
apiVersion: string;
35
kind: string;
@@ -7,7 +9,7 @@ export type Resource = {
79
namespace?: string;
810
labels?: Record<string, string>;
911
annotations?: {
10-
'kubectl.kubernetes.io/last-applied-configuration'?: string;
12+
[LAST_APPLIED_CONFIGURATION_ANNOTATION]?: string;
1113
[key: string]: string | undefined;
1214
};
1315
managedFields?: unknown;
@@ -31,9 +33,9 @@ export const removeManagedFieldsProperty = (resourceObject: Resource, showOnlyIm
3133
managedFields: undefined,
3234
annotations: {
3335
...resourceObject.metadata.annotations,
34-
'kubectl.kubernetes.io/last-applied-configuration': showOnlyImportantData
36+
[LAST_APPLIED_CONFIGURATION_ANNOTATION]: showOnlyImportantData
3537
? undefined
36-
: resourceObject?.metadata?.annotations?.['kubectl.kubernetes.io/last-applied-configuration'],
38+
: resourceObject?.metadata?.annotations?.[LAST_APPLIED_CONFIGURATION_ANNOTATION],
3739
},
3840
generation: showOnlyImportantData ? undefined : resourceObject?.metadata?.generation,
3941
uid: showOnlyImportantData ? undefined : resourceObject?.metadata?.uid,
@@ -50,9 +52,9 @@ export const removeManagedFieldsProperty = (resourceObject: Resource, showOnlyIm
5052
managedFields: undefined,
5153
annotations: {
5254
...resourceObject.metadata.annotations,
53-
'kubectl.kubernetes.io/last-applied-configuration': showOnlyImportantData
55+
[LAST_APPLIED_CONFIGURATION_ANNOTATION]: showOnlyImportantData
5456
? undefined
55-
: resourceObject?.metadata?.annotations?.['kubectl.kubernetes.io/last-applied-configuration'],
57+
: resourceObject?.metadata?.annotations?.[LAST_APPLIED_CONFIGURATION_ANNOTATION],
5658
},
5759
generation: showOnlyImportantData ? undefined : resourceObject?.metadata?.generation,
5860
uid: showOnlyImportantData ? undefined : resourceObject?.metadata?.uid,

0 commit comments

Comments
 (0)