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

Cannot override ConfigMap entries that were defined in a patch #4419

Closed
NickLarsenNZ opened this issue Jan 25, 2022 · 4 comments
Closed

Cannot override ConfigMap entries that were defined in a patch #4419

NickLarsenNZ opened this issue Jan 25, 2022 · 4 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@NickLarsenNZ
Copy link

I'm unable to override ConfigMap entries that were already defined in a patch.

kustomization.yml

# The empty ConfigMap is defined in this manifest
resources:
- https://raw.githubusercontent.com/argoproj/argo-cd/8b57bc990cd72c6475e2ae88126a1ed57e2460a3/manifests/ha/install.yaml

# It is then populated with template.* and trigger.* entries
patches:
- https://raw.githubusercontent.com/argoproj/argo-cd/8b57bc990cd72c6475e2ae88126a1ed57e2460a3/notifications_catalog/install.yaml # replace hash with version once it's included

# And I want to replace a few of the entries
configMapGenerator:
- name: argocd-notifications-cm
  behavior: merge # I have tried replace too, no change
  literals:
  - example.item=searchable_garbage # this loads in fine because it didn't exist before
  - template.app-deployed=searchable_garbage # we only see the orig

Expected output

A config map containing the entries from the patch, a new value, and an updated value.

❯ kustomize build . | grep searchable_garbage
  example.item: searchable_garbage
  template.app-deployed: searchable_garbage

Actual output

The entries from the patch, and new entries.

❯ kustomize build . | grep searchable_garbage
  example.item: searchable_garbage

Kustomize version

❯ kustomize version
{Version:kustomize/v4.4.1 GitCommit:b2d65ddc98e09187a8e38adc27c30bab078c1dbf BuildDate:2021-11-11T23:27:14Z GoOs:darwin GoArch:amd64}

Platform

macos

Additional context

I don't have trouble with this when it's done in an overlay. I suspect it has to do with the resources, patch and configMapGenerator being in the same overlay.

@NickLarsenNZ NickLarsenNZ added the kind/bug Categorizes issue or PR as related to a bug. label Jan 25, 2022
@k8s-ci-robot
Copy link
Contributor

@NickLarsenNZ: This issue is currently awaiting triage.

SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Jan 25, 2022
@KnVerey
Copy link
Contributor

KnVerey commented Jan 26, 2022

I don't have trouble with this when it's done in an overlay. I suspect it has to do with the resources, patch and configMapGenerator being in the same overlay.

You're right that this is the problem. As stated in our docs:

A build stage first processes resources, then it processes generators, adding to the resource list under consideration, then it processes transformers to modify the list, and finally runs validators to check the list for whatever error.

Even when merge mode is enabled, configMapGenerator is still a generator and still runs before the patches (which is a transformer). Transformers can be reordered by using the more advanced full object configuration mode in the transformers field (see built-ins), but unfortunately intermingling generators in that field doesn't currently work due to a technical limitation. If being able to support custom transformer order is important to you, please follow #4403.

/close
/kind duplicate

@k8s-ci-robot
Copy link
Contributor

@KnVerey: The label(s) kind/duplicate cannot be applied, because the repository doesn't have them.

In response to this:

I don't have trouble with this when it's done in an overlay. I suspect it has to do with the resources, patch and configMapGenerator being in the same overlay.

You're right that this is the problem. As stated in our docs:

A build stage first processes resources, then it processes generators, adding to the resource list under consideration, then it processes transformers to modify the list, and finally runs validators to check the list for whatever error.

Even when merge mode is enabled, configMapGenerator is still a generator and still runs before the patches (which is a transformer). Transformers can be reordered by using the more advanced full object configuration mode in the transformers field (see built-ins), but unfortunately intermingling generators in that field doesn't currently work due to a technical limitation. If being able to support custom transformer order is important to you, please follow #4403.

/close
/kind duplicate

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot
Copy link
Contributor

@KnVerey: Closing this issue.

In response to this:

I don't have trouble with this when it's done in an overlay. I suspect it has to do with the resources, patch and configMapGenerator being in the same overlay.

You're right that this is the problem. As stated in our docs:

A build stage first processes resources, then it processes generators, adding to the resource list under consideration, then it processes transformers to modify the list, and finally runs validators to check the list for whatever error.

Even when merge mode is enabled, configMapGenerator is still a generator and still runs before the patches (which is a transformer). Transformers can be reordered by using the more advanced full object configuration mode in the transformers field (see built-ins), but unfortunately intermingling generators in that field doesn't currently work due to a technical limitation. If being able to support custom transformer order is important to you, please follow #4403.

/close
/kind duplicate

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
None yet
Development

No branches or pull requests

3 participants