From 95607f27192ec5ecf362ba0619cec195f1bc0208 Mon Sep 17 00:00:00 2001 From: Max Goltzsche Date: Thu, 11 Apr 2024 02:16:36 +0200 Subject: [PATCH] fix: allow specifying OCI registry as repository Support specifying an OCI repository URI within the `repository` field of the kustomize plugin or kpt function config. Relates to #46 and #72 --- example/oci-image/generator.yaml | 3 ++- pkg/helm/load.go | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/example/oci-image/generator.yaml b/example/oci-image/generator.yaml index 9c0abe9..4fb69f6 100644 --- a/example/oci-image/generator.yaml +++ b/example/oci-image/generator.yaml @@ -3,5 +3,6 @@ kind: ChartRenderer metadata: name: karpenter namespace: kube-system -chart: "oci://public.ecr.aws/karpenter/karpenter" +chart: karpenter version: 0.35.0 +repository: "oci://public.ecr.aws/karpenter" diff --git a/pkg/helm/load.go b/pkg/helm/load.go index d997850..2de637b 100644 --- a/pkg/helm/load.go +++ b/pkg/helm/load.go @@ -38,6 +38,10 @@ func (h *Helm) loadChart(ctx context.Context, cfg *config.ChartConfig) (*chart.C } else { return nil, errors.Errorf("chart directory %q not found and no repository specified", cfg.Chart) } + } else if registry.IsOCI(cfg.Repository) { + cfg.Chart = fmt.Sprintf("%s/%s", cfg.Repository, cfg.Chart) + cfg.Repository = "" + return h.loadOCIChart(ctx, cfg) } return h.loadRemoteChart(ctx, cfg) }