postgres-operator/pkg/apis/acid.zalan.do/v1
Benjamin Stein 76462ae265 Fix operatorconfigurations CRD: NamespacedName must render as type string
Upgrading to v2.0.0 fails at the CRD apply step. The apiserver rejects the
OperatorConfiguration CRD:

  CustomResourceDefinition "operatorconfigurations.acid.zalan.do" is invalid:
  ...oauth_token_secret_name.default: Invalid value: "string": in body must
  be of type object

Root cause: these CRDs are generated by controller-gen from the Go types.
spec.NamespacedName is a struct {Namespace, Name}, so controller-gen emits an
object schema for every NamespacedName field. But NamespacedName has custom
MarshalJSON/UnmarshalJSON that (de)serialize it as a plain JSON string
("namespace/name"). The generated object schema therefore never matched how
the operator actually reads and writes these fields (it did in 1.15.x, where
they were type: string).

For oauth_token_secret_name this is a hard failure: it also carries
`// +kubebuilder:default=postgres-operator`, and a scalar string default on an
object-typed property is rejected by the apiserver, blocking the whole
1.15.x -> 2.0.0 upgrade before the operator Deployment is touched.

Fix at the source by annotating the NamespacedName type with
`// +kubebuilder:validation:Type=string` and regenerating the CRDs. This makes
controller-gen emit `type: string` for all NamespacedName fields
(oauth_token_secret_name, infrastructure_roles_secret_name,
pod_environment_configmap, and the nested infrastructure role secretname),
matching their runtime serialization and restoring 1.15.x behaviour. A
field-level Type override cannot be used here: it conflicts with the
struct-derived schema ("object vs string in allOf") and fails generation.

Regenerated manifests/operatorconfiguration.crd.yaml and its two synced
copies (pkg/apis/... embed source and charts/.../crds). Verified with a
server-side dry-run apply: the unpatched CRD is rejected, the regenerated CRD
is accepted.

Fixes #3143
2026-07-28 09:53:33 +02:00
..
const.go add unit test and documentation for finalizers (#2509) 2024-01-22 12:13:40 +01:00
crds.go auto-generate configuration CRD (#3102) 2026-06-22 10:44:46 +02:00
doc.go Fix golint failures 2019-01-08 13:04:48 +01:00
marshal.go switch to metav1.Duration for timeout options (#3121) 2026-06-29 10:32:24 +02:00
operator_configuration_type.go bump to v2.0 (#3134) 2026-07-27 23:50:17 +02:00
operatorconfiguration.crd.yaml Fix operatorconfigurations CRD: NamespacedName must render as type string 2026-07-28 09:53:33 +02:00
postgres_team_type.go update docs about CRD generation and copy paste to chart dir, too (#3117) 2026-06-26 10:43:57 +02:00
postgresql.crd.yaml change volume specs to int32 and define max iops and throughput values (#3139) 2026-07-27 16:32:22 +02:00
postgresql_type.go change volume specs to int32 and define max iops and throughput values (#3139) 2026-07-27 16:32:22 +02:00
register.go PostgresTeam CRD for advanced team management (#1165) 2020-10-28 10:40:10 +01:00
util.go Make teamId in cluster name optional (#2001) 2022-08-24 10:12:50 +02:00
util_test.go drop deprecated fields from Postgresql CRD (#3106) 2026-07-02 16:53:03 +02:00
zz_generated.deepcopy.go change volume specs to int32 and define max iops and throughput values (#3139) 2026-07-27 16:32:22 +02:00