Feat: enable owner references (#2688)

* feat(498): Add ownerReferences to managed entities
* empty owner reference for cross namespace secret and more tests
* update ownerReferences of existing resources
* removing ownerReference requires Update API call
* CR ownerReference on PVC blocks pvc retention policy of statefulset
* make ownerreferences optional and disabled by default
* update unit test to check len ownerReferences
* update codegen
* add owner references e2e test
* update unit test
* add block_owner_deletion field to test owner reference
* fix typos and update docs once more
* reflect code feedback

---------

Co-authored-by: Max Begenau <max@begenau.com>
This commit is contained in:
Felix Kunde
2024-08-09 17:58:25 +02:00
committed by GitHub
co-authored by Max Begenau
parent d5a88f571a
commit a87307e56b
28 changed files with 535 additions and 206 deletions
+4 -1
View File
@@ -1326,7 +1326,7 @@ var OperatorConfigCRDResourceValidation = apiextv1.CustomResourceValidation{
"enable_init_containers": {
Type: "boolean",
},
"enable_secrets_deletion": {
"enable_owner_references": {
Type: "boolean",
},
"enable_persistent_volume_claim_deletion": {
@@ -1341,6 +1341,9 @@ var OperatorConfigCRDResourceValidation = apiextv1.CustomResourceValidation{
"enable_readiness_probe": {
Type: "boolean",
},
"enable_secrets_deletion": {
Type: "boolean",
},
"enable_sidecars": {
Type: "boolean",
},
@@ -55,6 +55,7 @@ type MajorVersionUpgradeConfiguration struct {
// KubernetesMetaConfiguration defines k8s conf required for all Postgres clusters and the operator itself
type KubernetesMetaConfiguration struct {
EnableOwnerReferences *bool `json:"enable_owner_references,omitempty"`
PodServiceAccountName string `json:"pod_service_account_name,omitempty"`
// TODO: change it to the proper json
PodServiceAccountDefinition string `json:"pod_service_account_definition,omitempty"`
@@ -158,6 +158,11 @@ func (in *ConnectionPoolerConfiguration) DeepCopy() *ConnectionPoolerConfigurati
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *KubernetesMetaConfiguration) DeepCopyInto(out *KubernetesMetaConfiguration) {
*out = *in
if in.EnableOwnerReferences != nil {
in, out := &in.EnableOwnerReferences, &out.EnableOwnerReferences
*out = new(bool)
**out = **in
}
if in.SpiloAllowPrivilegeEscalation != nil {
in, out := &in.SpiloAllowPrivilegeEscalation, &out.SpiloAllowPrivilegeEscalation
*out = new(bool)