Skip to content
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

Unwanted custom resource object merging on redeploy occurs #110

Open
ghost opened this issue Jan 9, 2020 · 2 comments
Open

Unwanted custom resource object merging on redeploy occurs #110

ghost opened this issue Jan 9, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Jan 9, 2020

Bug exercise:

  1. Deploy some CRD into cluster: kubectl -f https://github.com/zalando/postgres-operator/blob/master/manifests/operatorconfiguration.crd.yaml.
  2. Deploy some CRD defined object with k8s-handle: operatorconfigurations.acid.zalan.do where .configuration.kubernetes.custom_pod_annotations: { "keya": "valuea" } has defined.
  3. Redeploy current object with fixed section .configuration.kubernetes.custom_pod_annotations: { "keyb": "valueb" }.

The old and new custom_pod_annotations will be merged at result, but 2020-01-09 06:15:39 INFO:k8s_handle.k8s.provisioner:OperatorConfiguration "zalando-postgres-operator" already exists, replace it be logged. (replace != merge)

kubectl -n kube-system get operatorconfigurations.acid.zalan.do zalando-postgres-operator -o jsonpath={.configuration.kubernetes.custom_pod_annotations}
map[keya:valuea keyb:valueb]
@ghost ghost changed the title Unwanted custom resource object merging on redeploy Unwanted custom resource object merging on redeploy occurs Jan 9, 2020
@rvadim rvadim added the bug Something isn't working label Jan 9, 2020
@rvadim
Copy link
Collaborator

rvadim commented Feb 5, 2020

Hi, thank you for report.
@furiousassault I think we should add warning about labels and/or annotations like have with Service ports. Do you have another suggestions? Can we process labels/annotations and similar lists with replace strategy instead of merge?

@furiousassault
Copy link
Collaborator

Good day. The problem is k8s-handle has predefined, generalized behavior with the resources of different kinds: like, "if it's not present, create it, else replace (or merge)".
For the resources of specific kinds, it performs additional implicit spec mutations, like "ports" in implementation of replacing services, and others.

I don't know at this moment, whether we can (and should) analyze CRD object and replace its parts while merging in general, as we do with services: POC needed, not to say it's not quite clean.

As a more clean solution, we could try to see if we can develop an user-defined "strategies" of some sort, to let user choose, what to do with a resource if it possible, patch or replace. In a config.yaml / CLI / Env parameter.
That seems it would be good solution, but requires a bigger effort and discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants