charts icon indicating copy to clipboard operation
charts copied to clipboard

Using an umbrella chart with an alias or setting nameOverride to anything except cloudnative-pg results in a broken deploy

Open brinnjoyce opened this issue 1 year ago • 0 comments

As per title, because of this issue https://github.com/cloudnative-pg/cloudnative-pg/issues/2466 if you try to deploy cloudnative-pg with an umbrella chart like this:

apiVersion: v2
name: cnpg-operator
description: Install cloudnative-pg-operator
type: application
version: 0.1.0
appVersion: "HEAD"
dependencies:
  - name: cloudnative-pg
    alias: cnpg-operator
    repository: https://cloudnative-pg.io/charts/
    version: 0.21.6

Or otherwise change the value of nameOverride to be anything other than cloudnative-pg the deployment will fail with errors like this:

{
  "level": "error",
  "ts": "2024-08-20T21:00:06Z",
  "msg": "no operator deployment found with the filter",
  "filter": "app.kubernetes.io/name=cloudnative-pg",
  "error": "no operator deployment found",
  "stacktrace": "github.com/cloudnative-pg/cloudnative-pg/pkg/management/log.(*logger).Error\n\tpkg/management/log/log.go:125\ngithub.com/cloudnative-pg/cloudnative-pg/pkg/certs.findOperatorDeploymentByFilter\n\tpkg/certs/operator_deployment.go:122\ngithub.com/cloudnative-pg/cloudnative-pg/pkg/certs.GetOperatorDeployment\n\tpkg/certs/operator_deployment.go:68\ngithub.com/cloudnative-pg/cloudnative-pg/pkg/certs.SetAsOwnedByOperatorDeployment\n\tpkg/certs/operator_deployment.go:41\ngithub.com/cloudnative-pg/cloudnative-pg/pkg/certs.(*PublicKeyInfrastructure).ensureRootCACertificate\n\tpkg/certs/k8s.go:184\ngithub.com/cloudnative-pg/cloudnative-pg/pkg/certs.PublicKeyInfrastructure.ensureCertificatesAreUpToDate\n\tpkg/certs/k8s.go:238\ngithub.com/cloudnative-pg/cloudnative-pg/pkg/certs.(*PublicKeyInfrastructure).Setup.func2\n\tpkg/certs/k8s.go:143\nk8s.io/client-go/util/retry.OnError.func1\n\tpkg/mod/k8s.io/[email protected]/util/retry/util.go:51\nk8s.io/apimachinery/pkg/util/wait.runConditionWithCrashProtection\n\tpkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:145\nk8s.io/apimachinery/pkg/util/wait.ExponentialBackoff\n\tpkg/mod/k8s.io/[email protected]/pkg/util/wait/backoff.go:461\nk8s.io/client-go/util/retry.OnError\n\tpkg/mod/k8s.io/[email protected]/util/retry/util.go:50\ngithub.com/cloudnative-pg/cloudnative-pg/pkg/certs.(*PublicKeyInfrastructure).Setup\n\tpkg/certs/k8s.go:140\ngithub.com/cloudnative-pg/cloudnative-pg/internal/cmd/manager/controller.ensurePKI\n\tinternal/cmd/manager/controller/controller.go:378\ngithub.com/cloudnative-pg/cloudnative-pg/internal/cmd/manager/controller.RunController\n\tinternal/cmd/manager/controller/controller.go:222\ngithub.com/cloudnative-pg/cloudnative-pg/internal/cmd/manager/controller.NewCmd.func1\n\tinternal/cmd/manager/controller/cmd.go:40\ngithub.com/spf13/cobra.(*Command).execute\n\tpkg/mod/github.com/spf13/[email protected]/command.go:985\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\tpkg/mod/github.com/spf13/[email protected]/command.go:1117\ngithub.com/spf13/cobra.(*Command).Execute\n\tpkg/mod/github.com/spf13/[email protected]/command.go:1041\nmain.main\n\tcmd/manager/main.go:66\nruntime.main\n\t/opt/hostedtoolcache/go/1.22.5/x64/src/runtime/proc.go:271"
}
{
  "level": "error",
  "ts": "2024-08-20T21:00:06Z",
  "logger": "setup",
  "msg": "unable to setup PKI infrastructure",
  "error": "no operator deployment found",
  "stacktrace": "github.com/cloudnative-pg/cloudnative-pg/pkg/management/log.(*logger).Error\n\tpkg/management/log/log.go:125\ngithub.com/cloudnative-pg/cloudnative-pg/internal/cmd/manager/controller.ensurePKI\n\tinternal/cmd/manager/controller/controller.go:380\ngithub.com/cloudnative-pg/cloudnative-pg/internal/cmd/manager/controller.RunController\n\tinternal/cmd/manager/controller/controller.go:222\ngithub.com/cloudnative-pg/cloudnative-pg/internal/cmd/manager/controller.NewCmd.func1\n\tinternal/cmd/manager/controller/cmd.go:40\ngithub.com/spf13/cobra.(*Command).execute\n\tpkg/mod/github.com/spf13/[email protected]/command.go:985\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\tpkg/mod/github.com/spf13/[email protected]/command.go:1117\ngithub.com/spf13/cobra.(*Command).Execute\n\tpkg/mod/github.com/spf13/[email protected]/command.go:1041\nmain.main\n\tcmd/manager/main.go:66\nruntime.main\n\t/opt/hostedtoolcache/go/1.22.5/x64/src/runtime/proc.go:271"
}

Short of the issue in the operator being fixed it should be documented that changing the name will not work and/or remove the ability to change it until the labelSelector is configurable and uses the value set by the helm chart.

This is the same issue as https://github.com/cloudnative-pg/charts/issues/256 hit.

brinnjoyce avatar Aug 20 '24 21:08 brinnjoyce