I have configMap for each microservice like this:
configMapGenerator:
- name: env-vars
literals:
- MICRO_SERVER_NAME=accountsrv
I want to merge bellow common config with each microservice's configMap
configMapGenerator:
- name: env-vars
behavior: merge
literals:
- MICRO_SERVER_ADDRESS=0.0.0.0:8080
- MICRO_BROKER_ADDRESS=0.0.0.0:10001
- APP_ENV=development
- CONFIG_DIR=/config
- CONFIG_FILE=config.yaml
- MICRO_LOG_LEVEL=debug
- MICRO_CLIENT_RETRIES=3
- MICRO_CLIENT_REQUEST_TIMEOUT=5s
I am getting Error: accumulating resources: recursed accumulation of... found multiple objects
# @kustomize build deploy/overlays/e2e/ | sed -e "s|\$(NS)|default|g" -e "s|\$(IMAGE_VERSION)|v0.2.5|g" | kubectl apply -f -
Error: accumulating resources: recursed accumulation of path '../../bases/micros': merging from generator &{0xc0004aa2a0 0xc00034e580 { } {map[] map[] false} {{ env-vars merge {[MICRO_SERVER_ADDRESS=0.0.0.0:8080 MICRO_BROKER_ADDRESS=0.0.0.0:10001 APP_ENV=development CONFIG_DIR=/config CONFIG_FILE=config.yaml MICRO_LOG_LEVEL=debug MICRO_CLIENT_RETRIES=3 MICRO_CLIENT_REQUEST_TIMEOUT=5s] [] [] }}}}: found multiple objects [{"apiVersion":"v1","data":{"CORS_ALLOWED_HEADERS":"Authorization,Content-Type","CORS_ALLOWED_METHODS":"POST,GET","CORS_ALLOWED_ORIGINS":"*","MICRO_API_ENABLE_RPC":"true","MICRO_API_HANDLER":"rpc","MICRO_API_NAMESPACE":"","MICRO_LOG_LEVEL":"debug","MICRO_SERVER_NAME":"gatewaysrv"},"kind":"ConfigMap","metadata":{"annotations":{"org":"acmeCorporation"},"labels":{"app.kubernetes.io/component":"microservice","app.kubernetes.io/instance":"gateway-abcxzy","app.kubernetes.io/managed-by":"kustomize","app.kubernetes.io/name":"gateway","app.kubernetes.io/part-of":"micro-starter-kit"},"name":"gatewayenv-vars"}}{nsfx:true,beh:unspecified} {"apiVersion":"v1","data":{"MICRO_PROXY_PROTOCOL":"grpc","MICRO_SERVER_NAME":"proxysrv"},"kind":"ConfigMap","metadata":{"annotations":{"org":"acmeCorporation"},"labels":{"app.kubernetes.io/component":"microservice","app.kubernetes.io/instance":"proxy-abcxzy","app.kubernetes.io/managed-by":"kustomize","app.kubernetes.io/name":"proxy","app.kubernetes.io/part-of":"micro-starter-kit"},"name":"proxyenv-vars"}}{nsfx:true,beh:unspecified} {"apiVersion":"v1","data":{"DATABASE_HOST":"$(DATABASE_ENDPOINT)","MICRO_SERVER_NAME":"accountsrv"},"kind":"ConfigMap","metadata":{"labels":{"app.kubernetes.io/component":"microservice","app.kubernetes.io/instance":"account-srv-abcxzy","app.kubernetes.io/name":"account-srv"},"name":"accountenv-vars"}}{nsfx:true,beh:unspecified} {"apiVersion":"v1","data":{"MICRO_SERVER_NAME":"emailersrv"},"kind":"ConfigMap","metadata":{"labels":{"app.kubernetes.io/component":"microservice","app.kubernetes.io/instance":"emailer-srv-abcxzy","app.kubernetes.io/name":"emailer-srv"},"name":"emailerenv-vars"}}{nsfx:true,beh:unspecified} {"apiVersion":"v1","data":{"MICRO_SERVER_NAME":"greetersrv"},"kind":"ConfigMap","metadata":{"labels":{"app.kubernetes.io/component":"microservice","app.kubernetes.io/instance":"greeter-srv-abcxzy","app.kubernetes.io/name":"greeter-srv"},"name":"greeterenv-vars"}}{nsfx:true,beh:unspecified}] that could accept merge of ~G_v1_ConfigMap|~X|env-vars
Source https://github.com/xmlking/micro-starter-kit/tree/develop/deploy/bases/micros
βββ account-srv
βΒ Β βββ config
βΒ Β βΒ Β βββ config.yaml
βΒ Β βββ deployment.yaml
βΒ Β βββ kustomization.yaml
βΒ Β βββ service.yaml
βββ emailer-srv
βΒ Β βββ config
βΒ Β βΒ Β βββ config.yaml
βΒ Β βββ deployment.yaml
βΒ Β βββ kustomization.yaml
βΒ Β βββ service.yaml
βββ gateway
βΒ Β βββ deployment.yaml
βΒ Β βββ kustomization.yaml
βΒ Β βββ service.yaml
βββ greeter-srv
βΒ Β βββ config
βΒ Β βΒ Β βββ config.yaml
βΒ Β βββ deployment.yaml
βΒ Β βββ kustomization.yaml
βΒ Β βββ service.yaml
βββ kconfig.yaml
βββ kustomization.yaml
βββ proxy
βββ deployment.yaml
βββ kustomization.yaml
βββ service.yaml
When using you example with the latest version of kustomize, it seems to work ok. check here. Must be missing a piece of information.
Please uncommit two comments here , to reproduce the issue. https://github.com/keleustes/kustomize/blob/allinone/examples/issues/issue_1733/bases/micros/kustomization.yaml#L19
Change this section similar to the example I provided above.
Then try kustomize build deploy/bases/micro
As a workaround, I made it temporarily work by using extra Common configmap
My goal is to merge same per micro βenv-varsβ configmap with β env-varsβ defined at the root.
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale
this is not stale. It is really useful feature request
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close
@fejta-bot: Closing this issue.
In response to this:
Rotten issues close after 30d of inactivity.
Reopen the issue with/reopen.
Mark the issue as fresh with/remove-lifecycle rotten.Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close
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.
Good Job
/remove-lifecycle rotten
/reopen
@josephfinlayson: You can't reopen an issue/PR unless you authored it or you are a collaborator.
In response to this:
/reopen
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.
/reopen
@xmlking: Reopened this issue.
In response to this:
/reopen
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.
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close
@fejta-bot: Closing this issue.
In response to this:
Rotten issues close after 30d of inactivity.
Reopen the issue with/reopen.
Mark the issue as fresh with/remove-lifecycle rotten.Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close
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.
Most helpful comment
this is not stale. It is really useful feature request