Comments (4)
I had similar issue and found a workaround by adding an additional layer of Helm templating:
- clusters:
selector:
matchLabels:
rarexixi/group: dip
values:
basename: '{{- `{{ index .metadata.labels "rarexixi/env" }}` -}}'
It seems the matrix generator do another round of Helm templating when adding values on the second generator, welcome Helmception... 😵
from argo-cd.
This example will also report an error:failed to get params for second generator in the matrix generator: child generator returned an error on parameter generation: failed to replace parameters in generator: failed to execute go template {{index .metadata.labels "rarexixi/env"}}
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: appset-cm-test-matrix
spec:
goTemplate: true
goTemplateOptions: ["missingkey=error"]
generators:
- matrix:
generators:
- git:
repoURL: https://gitee.com/rarexixi/argocd-appset-generator.git
revision: HEAD
directories:
- path: config-map/*
- path: "config-map/logs"
exclude: true
values:
basename: '{{.path.basename}}'
- clusters:
selector:
matchLabels:
rarexixi/group: dip
values:
env: '{{index .metadata.labels "rarexixi/env"}}' # report an error
template:
metadata:
name: 'cm-test-matrix-{{.values.basename}}-{{index .metadata.labels "rarexixi/env"}}' # work well
labels:
appset-name: appset-cm-test-matrix
spec:
project: default
source:
repoURL: https://gitee.com/rarexixi/argocd-appset-generator.git
targetRevision: HEAD
path: "{{.path.path}}"
destination:
server: "{{.server}}"
namespace: dip-system
from argo-cd.
@llavaud Thanks,It works like this:
- clusters:
selector:
matchLabels:
rarexixi/group: dip
values:
env: '{{- printf `{{ index .metadata.labels "rarexixi/env" }}` -}}'
from argo-cd.
@llavaud Thanks,It works like this:
- clusters: selector: matchLabels: chj.cloud/group: dip values: env: '{{- printf `{{ index .metadata.labels "chj.cloud/env" }}` -}}'
yes I just updated, I pasted my code that live in an Helm Chart, so I have another Helm level ;)
from argo-cd.
Related Issues (20)
- SharedResourceWarning PersistentVolumeClaim/lsp-temp-pvc-dev is part of applications argocd/dev-unit-test-service and dev-conversion-service
- add possibility to pin subchart version or/and app version HOT 4
- "Refresh apps" option only works in increments of 20 even when more workers are available
- FailOnSharedResource is not honored when automated syncing, another App takes ownership of a resource HOT 1
- argocd events don't show app sync revision for multi-source apps HOT 2
- Unable to load data: Request has been terminated Possible causes: the network is offline Origin is not allowed by Access-Control-Allow-Origin the page is being unloaded, etc. HOT 2
- Repos Inaccessible from within cluster
- BUG: UI Error - Helm Chart with values.yaml from private Repo HOT 1
- sync is broken with v6.8.0 HOT 3
- Improve cluster api resource customizations
- ApplicationSet (CRD) is not optional
- ignoreDifferences fields not being ignored HOT 1
- Server command line option --request-timeout exists only in documentation in recent ArgoCD version and is not be used in the code
- Enabling preserveResourcesOnDeletion
- argocd-notifications-controller on-delete trigger result is always empty and doesn't send notification
- Option to disable writing k8s events HOT 1
- Is there an issue with the description in the document regarding the solution to the "continue parameter is too old to display a consistent list result" problem?
- Problemes with Sync tasks in multi application environment still fails in 2.11.0 version - Chart 6.8.x and 6.9.x affected HOT 5
- Invalidated cache for resource in namespace: argocd with the name: argocd-notifications-cm HOT 1
- Persistent YAML to JSON Conversion Error with KCL Plugin
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from argo-cd.