-
Notifications
You must be signed in to change notification settings - Fork 1k
Introduce masterServiceAnnotations
& replicaServiceAnnotations
#2161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
09b2b36
to
3725471
Compare
Could you add the new field also to the CRD schema (please, follow alphabetical sorting) |
First, global config, then ServiceAnnotations overriding, then MasterServiceAnnotations and ReplicaServiceAnnotations. This addresses zalando#2161 (comment).
First, global config, then ServiceAnnotations overriding, then MasterServiceAnnotations and ReplicaServiceAnnotations. This addresses zalando#2161 (comment).
fc96e71
to
1a5a7a2
Compare
// import ( | ||
// "k8s.io/client-go/kubernetes" | ||
// clientsetscheme "k8s.io/client-go/kubernetes/scheme" | ||
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" | ||
// ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@owenthereal what is your golang version installed. For 1.17 and 1.18 generated files should not be changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using 1.19 locally. I regenerated the code with 1.18 in 3fb0b42.
It would be nice to introduce https://asdf-vm.com or the like to this project to auto-switch or prompt to install the right Go version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure we need an additional tools for that, as golang supports multiple versions management by itself
https://go.dev/doc/manage-install
As an option, some validation steps with autogeneration/formatting/linting can be added as part of the #2135
pkg/cluster/k8sres.go
Outdated
@@ -2380,3 +2384,18 @@ func ensurePath(file string, defaultDir string, defaultFile string) string { | |||
} | |||
return file | |||
} | |||
|
|||
// mergeAnnotations merged annotations that entries in b override the ones in a. | |||
func mergeAnnotations(a, b map[string]string) map[string]string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read about maps.Copy
yesterday. We would not need this function then and could do it in the code. Sounds good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call! Switched to use maps.Copy
in 3fb0b42
Introduce `masterServiceAnnotations` & `replicaServiceAnnotations` to the `Postgresql` CRD. `masterServiceAnnotations` overrides `serviceAnnotations` for master role if not empty. `replicaServiceAnnotations` overrides `serviceAnnotations` for replica role if not empty. Existing definition of `serviceAnnotations` continue to work for backward compatibitlity when neither `masterServiceAnnotations` nor `replicaServiceAnnotations` is defined. This closes zalando#1927
First, global config, then ServiceAnnotations overriding, then MasterServiceAnnotations and ReplicaServiceAnnotations. This addresses zalando#2161 (comment).
Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
👍 |
1 similar comment
👍 |
Introduce
masterServiceAnnotations
&replicaServiceAnnotations
to thePostgresql
CRD. The following behavior is implementedmasterServiceAnnotations
takes precedence overserviceAnnotations
for master service if not empty.replicaServiceAnnotations
takes precedence overserviceAnnotations
for replica service if not empty.serviceAnnotations
continue to work for backward compatibility when neithermasterServiceAnnotations
norreplicaServiceAnnotations
are defined.This closes #1927