diff --git a/src/common/k8s-api/__tests__/helm-charts.api.test.ts b/src/common/k8s-api/__tests__/helm-charts.api.test.ts index dbe477d333..283c5168f5 100644 --- a/src/common/k8s-api/__tests__/helm-charts.api.test.ts +++ b/src/common/k8s-api/__tests__/helm-charts.api.test.ts @@ -36,13 +36,6 @@ describe("HelmChart tests", () => { version: "!", repo: "!", } as any)).toThrowError('"created" is required'); - expect(() => HelmChart.create({ - apiVersion: "!", - name: "!", - version: "!", - repo: "!", - created: "!", - } as any)).toThrowError('"digest" is required'); }); it("should throw on fields being wrong type", () => { @@ -62,6 +55,14 @@ describe("HelmChart tests", () => { created: "!", digest: "!", } as any)).toThrowError('"name" must be a string'); + expect(() => HelmChart.create({ + apiVersion: "!", + name: "!", + version: "!", + repo: "!", + created: "!", + digest: 1, + } as any)).toThrowError('"digest" must be a string'); expect(() => HelmChart.create({ apiVersion: "1", name: "", diff --git a/src/common/k8s-api/endpoints/helm-charts.api.ts b/src/common/k8s-api/endpoints/helm-charts.api.ts index b73bcfdaf2..163f90ef36 100644 --- a/src/common/k8s-api/endpoints/helm-charts.api.ts +++ b/src/common/k8s-api/endpoints/helm-charts.api.ts @@ -75,7 +75,7 @@ export interface RawHelmChart { version: string; repo: string; created: string; - digest: string; + digest?: string; kubeVersion?: string; description?: string; home?: string; @@ -142,7 +142,7 @@ const helmChartValidator = Joi.object({ .required(), digest: Joi .string() - .required(), + .optional(), kubeVersion: Joi .string() .optional(), @@ -247,22 +247,22 @@ export interface HelmChart { name: string; version: string; repo: string; - kubeVersion?: string; created: string; description: string; - digest: string; keywords: string[]; - home?: string; sources: string[]; urls: string[]; annotations: Record; dependencies: HelmChartDependency[]; maintainers: HelmChartMaintainer[]; + deprecated: boolean; + kubeVersion?: string; + digest?: string; + home?: string; engine?: string; icon?: string; appVersion?: string; type?: string; - deprecated: boolean; tillerVersion?: string; } @@ -324,7 +324,11 @@ export class HelmChart { } getId(): string { - return `${this.repo}:${this.apiVersion}/${this.name}@${this.getAppVersion()}+${this.digest}`; + const digestPart = this.digest + ? `+${this.digest}` + : ""; + + return `${this.repo}:${this.apiVersion}/${this.name}@${this.getAppVersion()}${digestPart}`; } getName(): string {