mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-18 18:39:41 +02:00
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:
co-authored by
Max Begenau
parent
d5a88f571a
commit
a87307e56b
@@ -1363,6 +1363,23 @@ func TestCompareServices(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
serviceWithOwnerReference := newService(
|
||||
map[string]string{
|
||||
constants.ZalandoDNSNameAnnotation: "clstr.acid.zalan.do",
|
||||
constants.ElbTimeoutAnnotationName: constants.ElbTimeoutAnnotationValue,
|
||||
},
|
||||
v1.ServiceTypeClusterIP,
|
||||
[]string{"128.141.0.0/16", "137.138.0.0/16"})
|
||||
|
||||
ownerRef := metav1.OwnerReference{
|
||||
APIVersion: "acid.zalan.do/v1",
|
||||
Controller: boolToPointer(true),
|
||||
Kind: "Postgresql",
|
||||
Name: "clstr",
|
||||
}
|
||||
|
||||
serviceWithOwnerReference.ObjectMeta.OwnerReferences = append(serviceWithOwnerReference.ObjectMeta.OwnerReferences, ownerRef)
|
||||
|
||||
tests := []struct {
|
||||
about string
|
||||
current *v1.Service
|
||||
@@ -1445,6 +1462,18 @@ func TestCompareServices(t *testing.T) {
|
||||
match: false,
|
||||
reason: `new service's LoadBalancerSourceRange does not match the current one`,
|
||||
},
|
||||
{
|
||||
about: "new service doesn't have owner references",
|
||||
current: newService(
|
||||
map[string]string{
|
||||
constants.ZalandoDNSNameAnnotation: "clstr.acid.zalan.do",
|
||||
constants.ElbTimeoutAnnotationName: constants.ElbTimeoutAnnotationValue,
|
||||
},
|
||||
v1.ServiceTypeClusterIP,
|
||||
[]string{"128.141.0.0/16", "137.138.0.0/16"}),
|
||||
new: serviceWithOwnerReference,
|
||||
match: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
||||
Reference in New Issue
Block a user