diff --git a/src/kube-api.ts b/src/kube-api.ts index c537732..832e77b 100644 --- a/src/kube-api.ts +++ b/src/kube-api.ts @@ -626,7 +626,7 @@ export class KubeSdk { public async applyYaml( specs: Unstructured[], - strategy?: string, + strategy: string = 'application/apply-patch+yaml', replacePaths?: string[][] ) { const validSpecs = specs @@ -663,7 +663,7 @@ export class KubeSdk { const response = exist ? await this.patch( spec, - strategy || 'application/apply-patch+yaml', + strategy, replacePaths?.[index] ) : await this.create(spec); diff --git a/src/plugins/relation.ts b/src/plugins/relation.ts index 9a49524..4a5b8cb 100644 --- a/src/plugins/relation.ts +++ b/src/plugins/relation.ts @@ -8,6 +8,7 @@ import { import { Job } from 'kubernetes-types/batch/v1'; import { Unstructured, UnstructuredList } from '../kube-api'; import { Service } from 'kubernetes-types/core/v1'; +import { omit } from 'lodash'; export type Relation = { kind: string; @@ -49,8 +50,10 @@ class RelationPlugin { } restoreItem(item: Unstructured): Unstructured { - delete (item.metadata as ExtendObjectMeta).relations; - return item; + return { + ...item, + metadata: omit(item.metadata, 'relations') + }; } processPodSelector(item: Unstructured): Unstructured {