mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-06-26 06:39:27 +08:00
Introduce annotations relevant to resource view during deploy
This commit is contained in:
@@ -90,6 +90,34 @@ export function updateObjectLabels(inputObject: any, newLabels: Map<string, stri
|
||||
}
|
||||
}
|
||||
|
||||
export function updateObjectAnnotations(inputObject: any, newAnnotations: Map<string, string>, override: boolean) {
|
||||
if (!inputObject) {
|
||||
throw ('NullInputObject');
|
||||
}
|
||||
|
||||
if (!inputObject.metadata) {
|
||||
throw ('NullInputObjectMetadata');
|
||||
}
|
||||
|
||||
if (!newAnnotations) {
|
||||
return;
|
||||
}
|
||||
if (override) {
|
||||
inputObject.metadata.annotations = newAnnotations;
|
||||
} else {
|
||||
let existingAnnotations = inputObject.metadata.annotations;
|
||||
if (!existingAnnotations) {
|
||||
existingAnnotations = new Map<string, string>();
|
||||
}
|
||||
|
||||
Object.keys(newAnnotations).forEach(function (key) {
|
||||
existingAnnotations[key] = newAnnotations[key];
|
||||
});
|
||||
|
||||
inputObject.metadata.annotations = existingAnnotations;
|
||||
}
|
||||
}
|
||||
|
||||
export function updateImagePullSecrets(inputObject: any, newImagePullSecrets: string[], override: boolean) {
|
||||
if (!inputObject || !inputObject.spec || !newImagePullSecrets) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user