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

Detect ConfigMap change from kustomize smartly #81

Open
yujunz opened this issue Mar 9, 2020 · 4 comments · May be fixed by #517
Open

Detect ConfigMap change from kustomize smartly #81

yujunz opened this issue Mar 9, 2020 · 4 comments · May be fixed by #517
Labels
discussion This issue is not a bug or feature and a conversation is needed to find an appropriate resolution

Comments

@yujunz
Copy link
Contributor

yujunz commented Mar 9, 2020

Kustomize will generate a ConfigMap suffix automatically, which makes the change like delete and create.

Namespace        Name               Kind        Conds.  Age  Op      Wait to    Rs  Ri
something-test   conf-d-7g4t7m57mg  ConfigMap   -       9m   delete  delete     ok  -
^                conf-d-dc5dg9m84f  ConfigMap   -       -    create  reconcile  -   -

Is it possible to smartly detect it as a resource change to highlight the diff?

@cppforlife cppforlife added the discussion This issue is not a bug or feature and a conversation is needed to find an appropriate resolution label Mar 9, 2020
@cppforlife
Copy link
Contributor

that's an interesting idea. we do something similar for kapp's versioned resources in terms of diff presentation. let me think a bit more about how does one best detect/indicate this relationship.

do you think it would be reasonable to require an annotation on a configmap for this behaviour (and to better detect which resources are "related")?

@yujunz
Copy link
Contributor Author

yujunz commented Mar 10, 2020

I was expecting similar behavior to git which is content based, no need for extra annotation. But that might be hard to implement as we don't have an underlying content based storage.

So yes, implement it with annotations sounds good to me, although I don't have any idea about how to do it yet.

@ciis0
Copy link

ciis0 commented Apr 6, 2022

Hi,

kustomize by default applies a "name suffix hash" to all ConfigMaps and Secrets it generates via configMapGenerator/secretGenerator, so maybe a "use at your own risk"-flag like diffStripKustomizeNameSuffixHash: yes, simply stripping the -suffix from all CMs and Secrets, might already be quite useful?

Unfortunately custom-written-YAML CMs/Secrets will not get a name-suffix-hash (and i found no way to add it), but that should be a very edge-y use-case.

@rochacon
Copy link
Contributor

rochacon commented Apr 7, 2022

I stumbled upon this recently and the way I "fixed" it was by delegating the ConfigMap/Secret versioning to kapp instead of kustomize, like this:

# kustomization.yaml

secretGenerator:
- name: a-secret
  options:
    annotations:
      kapp.k14s.io/num-versions: "3"
      kapp.k14s.io/versioned: ""
    disableNameSuffixHash: true
  literals:
  - dont=tell-anyone

Example output:

% kustomize build | kapp deploy --app rochacon-test -n rochacon -f-
Target cluster 'https://...' (nodes: ...)

Changes

Namespace  Name            Kind    Conds.  Age  Op      Op st.  Wait to    Rs  Ri
rochacon   a-secret-ver-1  Secret  -       -    create  -       reconcile  -   -

Op:      1 create, 0 delete, 0 update, 0 noop, 0 exists
Wait to: 1 reconcile, 0 delete, 0 noop

Continue? [yN]:

@criztovyl criztovyl linked a pull request May 29, 2022 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion This issue is not a bug or feature and a conversation is needed to find an appropriate resolution
Projects
Status: To Triage
Development

Successfully merging a pull request may close this issue.

4 participants