zalando / postgres-operator

Postgres operator creates and manages PostgreSQL clusters running in Kubernetes
https://postgres-operator.readthedocs.io/
MIT License
4.33k stars 980 forks source link

operator installation thruoght helm does not work #1597

Open houshym opened 3 years ago

houshym commented 3 years ago

Hi I did: 1- git clone https://github.com/zalando/postgres-operator.git 2- helm install postgres-operator ./charts/postgres-operator

I got following error

helm install postgres-operator ./charts/postgres-operator
manifest_sorter.go:192: info: skipping unknown hook: "crd-install"
manifest_sorter.go:192: info: skipping unknown hook: "crd-install"
manifest_sorter.go:192: info: skipping unknown hook: "crd-install"
Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: ValidationError(OperatorConfiguration.configuration.kubernetes): unknown field "enable_cross_namespace_secret" in do.zalan.acid.v1.OperatorConfiguration.configuration.kubernete
FxKu commented 3 years ago

See ##1346 and #1440. It's a new field (for v1.7.0, which isn't released yet) which does not exist in your CRD.

thedv91 commented 3 years ago

Hi @houshym You should delete the old CustomResourceDefinitions

houshym commented 3 years ago

it is brand new cluster

taxilian commented 3 years ago

helm upgrade should update any custom CRDs, but:

manifest_sorter.go:192: info: skipping unknown hook: "crd-install"
manifest_sorter.go:192: info: skipping unknown hook: "crd-install"
manifest_sorter.go:192: info: skipping unknown hook: "crd-install"
Error: UPGRADE FAILED: error validating "": error validating data: [ValidationError(OperatorConfiguration.configuration.kubernetes): unknown field "enable_cross_namespace_secret" in do.zalan.acid.v1.OperatorConfiguration.configuration.kubernetes, ValidationError(OperatorConfiguration.configuration.teams_api): unknown field "enable_team_member_deprecation" in do.zalan.acid.v1.OperatorConfiguration.configuration.teams_api, ValidationError(OperatorConfiguration.configuration.teams_api): unknown field "role_deletion_suffix" in do.zalan.acid.v1.OperatorConfiguration.configuration.teams_api]
yfoelling commented 3 years ago

Im running into the same issue after upgrading from 1.6.2 to 1.7.0.

How am i supposed to update in an environment where there is existing Postgres "Clusters"? If i delete the crd, i need to basicly reinstall the operator via Helm. But that should AFAIK also delete the existing Postgres "clusters".

What is the right way to do this upgrade in a live environment?

wlritchi commented 3 years ago

In general Helm does not yet have a recommended way to upgrade CRDs. In my case, after verifying that the new CRDs were compatible with my existing resources (no fields renamed, for example), I was able to simply kubectl apply -f path/to/new/crd.yaml each of the CRDs to update them. Requiring manual intervention via kubectl isn't ideal, especially if you're using some kind of GitOps-based workflow, but since Helm doesn't yet have a solution this may be your best option.

yfoelling commented 3 years ago

Thanks for the input, i will try that

manuel-koch commented 2 years ago

I have the same issue, trying to install helm chart for the first time into k8s cluster, i.e. there are no CRDs yet:

Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: [ValidationError(OperatorConfiguration.configuration.load_balancer): unknown field "enable_master_pooler_load_balancer" in do.zalan.acid.v1.OperatorConfiguration.configuration.load_balancer, ValidationError(OperatorConfiguration.configuration.load_balancer): unknown field "enable_replica_pooler_load_balancer" in do.zalan.acid.v1.OperatorConfiguration.configuration.load_balancer]

Using latest helm repo

$ helm repo add postgres-operator https://opensource.zalando.com/postgres-operator/charts/postgres-operator/
$ helm repo update postgres-operator

$ helm show chart postgres-operator/postgres-operator
apiVersion: v1
appVersion: 1.7.1
version: 1.7.1
.....

Using custom helm values ( postgres-operator-helm-values.yaml, adopted from latest values.yaml ):

configLoadBalancer:
  # DNS zone for cluster DNS name when load balancer is configured for cluster
  #db_hosted_zone: db.example.com
  # toggles service type load balancer pointing to the master pod of the cluster
  enable_master_load_balancer: true
  # toggles service type load balancer pointing to the master pooler pod of the cluster
  enable_master_pooler_load_balancer: true
  # toggles service type load balancer pointing to the replica pod of the cluster
  enable_replica_load_balancer: true
  # toggles service type load balancer pointing to the replica pooler pod of the cluster
  enable_replica_pooler_load_balancer: true

Installing with

helm upgrade --wait --install --namespace postgres-operator \
             --values postgres-operator-helm-values.yaml \
             postgres-operator postgres-operator/postgres-operator

After the helm install failed, I see the following CRDs in my k8s cluster:

manuel-koch commented 2 years ago

Looks like the latest values.yaml doesn't match the latest Chart.yaml. I.e. although the values.yaml has breaking changes, the Chart.yaml still claims to be version 1.7.1.

yevon commented 2 years ago

I'm having this issue also, the chart version hasn't been upgraded but the chart has been modified

yevon commented 2 years ago

Fixed by deleting uninstalling the operator, deleting the zalando operator CRD and installing again

Tim-herbie commented 3 days ago

Like @yevon said, after uninstalling the operator and running these commands, it worked:

kubectl delete crd operatorconfigurations.acid.zalan.do
kubectl delete crd postgresqls.acid.zalan.do
kubectl delete crd postgresteams.acid.zalan.do