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

Error merging common config with multiple microservice's configMap #1733

Closed
xmlking opened this issue Nov 5, 2019 · 17 comments
Closed

Error merging common config with multiple microservice's configMap #1733

xmlking opened this issue Nov 5, 2019 · 17 comments
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@xmlking
Copy link

xmlking commented Nov 5, 2019

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

Are there any alternative way to accomplish this?

Structure

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
@jbrette
Copy link
Contributor

jbrette commented Nov 5, 2019

When using you example with the latest version of kustomize, it seems to work ok. check here. Must be missing a piece of information.

@xmlking
Copy link
Author

xmlking commented Nov 8, 2019

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.

@fejta-bot
Copy link

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

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 6, 2020
@xmlking
Copy link
Author

xmlking commented Feb 7, 2020

this is not stale. It is really useful feature request

@fejta-bot
Copy link

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

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Mar 8, 2020
@fejta-bot
Copy link

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

@k8s-ci-robot
Copy link
Contributor

@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.

@xmlking
Copy link
Author

xmlking commented Apr 7, 2020

Good Job

@josephfinlayson
Copy link

/remove-lifecycle rotten

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label May 20, 2020
@josephfinlayson
Copy link

/reopen

@k8s-ci-robot
Copy link
Contributor

@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.

@xmlking
Copy link
Author

xmlking commented May 21, 2020

/reopen

@k8s-ci-robot k8s-ci-robot reopened this May 21, 2020
@k8s-ci-robot
Copy link
Contributor

@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.

@fejta-bot
Copy link

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

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 19, 2020
@fejta-bot
Copy link

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

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Sep 18, 2020
@fejta-bot
Copy link

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

@k8s-ci-robot
Copy link
Contributor

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

5 participants