diff --git a/package/package.mk b/package/package.mk index a893c4124d..a1faa9b4e7 100644 --- a/package/package.mk +++ b/package/package.mk @@ -3,6 +3,7 @@ package-function: docker-build yq e '.spec.image="${GHCR_IMG}"' package/crossplane.yaml.template > package/crossplane.yaml rm -f package/*.xpkg go run github.com/crossplane/crossplane/cmd/crank xpkg build -f package --verbose --embed-runtime-image=${GHCR_IMG} -o package/package-function-appcat.xpkg + git checkout package/crossplane.yaml .PHONY: install-proxy install-proxy: diff --git a/pkg/comp-functions/functions/common/namespace-quotas.go b/pkg/comp-functions/functions/common/namespace-quotas.go index 4ff2f775de..acaf96163e 100644 --- a/pkg/comp-functions/functions/common/namespace-quotas.go +++ b/pkg/comp-functions/functions/common/namespace-quotas.go @@ -26,10 +26,14 @@ func AddInitialNamespaceQuotas(namespaceKon string) func(context.Context, *runti err := svc.GetObservedKubeObject(ns, namespaceKon) if err != nil { if err == runtime.ErrNotFound { - err = svc.GetObservedKubeObject(ns, namespaceKon) + err = svc.GetDesiredKubeObject(ns, namespaceKon) if err != nil { return runtime.NewFatalResult(fmt.Errorf("cannot get namespace: %w", err)) } + // Make sure we don't touch this, if there's no name in the namespace. + if ns.GetName() == "" { + return runtime.NewWarningResult("namespace doesn't yet have a name") + } } else { return runtime.NewFatalResult(fmt.Errorf("cannot get namespace: %w", err)) } @@ -67,7 +71,7 @@ func AddInitialNamespaceQuotas(namespaceKon string) func(context.Context, *runti // We only act if either the quotas were missing or the organization label is not on the // namespace. Otherwise we ignore updates. This is to prevent any unwanted overwriting. if quotas.AddInitalNamespaceQuotas(ctx, ns, s, objectMeta.TypeMeta.Kind) || orgAdded { - err = svc.SetDesiredKubeObject(ns, namespaceKon) + err = svc.SetDesiredKubeObjectWithName(ns, ns.GetName(), namespaceKon) if err != nil { return runtime.NewFatalResult(fmt.Errorf("cannot save namespace quotas: %w", err)) }