I have been working with ArgoCD for sometime now and I have an issue I can’t find the answer for:
config.json:
[
{
"carbon-ns": "carbon-genesis-ns",
"carbon-app": "carbon-genesis-app",
"versions": ["v1","v2","v3"]
}
]
And I am using the following Application-Set to create applications in order to deploy my applications to Argocd:
ApplicationSet:
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
annotations:
manager: argocd-applicationset-controller
name: carbon-app-template-appset
namespace: argocd
spec:
generators:
- git:
files:
- path: carbon-applications/genpop/apps/sbx/sadc/application-manifests/config.json
repoURL: ssh://[email protected]
revision: master
- plugin:
configMapRef:
name: version-generator
input:
parameters:
config: '{{ .Values }}' ### <<-- content from config.json file is not getting substituted from git generator
syncPolicy:
preserveResourcesOnDeletion: true
template:
metadata:
name: '{{ carbon-ns }}-{{ carbon-app }}-{{ version }}-sadc-sbx-v1'
spec:
destination:
namespace: '{{ carbon-ns }}'
server: https://test.com/k8s/clusters/xyz
project: sbx-cluster-v1
revisionHistoryLimit: 1
sources:
- ref: values
repoURL: ssh://[email protected]
targetRevision: master
- helm:
parameters:
- name: vaultport
value: "443"
releaseName: carbon-app-helm-test
valueFiles:
- $values/carbon-applications/genpop/apps/sbx/sadc/application-manifests/value-files/{{carbon-ns}}/{{carbon-app}}/{{ carbon-app }}-{{ version }}.yml
path: 20240705-1.3.1/application-templates
repoURL: ssh://[email protected]
targetRevision: master
syncPolicy:
automated:
prune: true
selfHeal: false
syncOptions:
- CreateNamespace=false
- ApplyOutOfSyncOnly=true
- Validate=true
Problem:
The content from config.json file is not getting substituted to input paramaters of input parameters from git file generator.
Output: is flatenned array which is coming properly for me if proper input is passed and applications are getting created in argocd.
{
"output": {
"parameters": [
{
"carbon-app": "carbon-genesis-app",
"carbon-ns": "carbon-genesis-ns",
"version": "v1"
},
{
"carbon-app": "carbon-genesis-app",
"carbon-ns": "carbon-genesis-ns",
"version": "v2"
},
{
"carbon-app": "carbon-genesis-app",
"carbon-ns": "carbon-genesis-ns",
"version": "v3"
}
]
}
}
Custom Plugin API Request logs: (Its going as .Values itself in request body :/ )
POST 400 /api/v1/getparams.execute? 23.313µs {"applicationSetName":"carbon-app-template-appset","input":{"parameters":{"config":"{{ .Values }}"}}}
I referred below links:
https://argo-cd.readthedocs.io/en/stable/operator-manual/applicationset/Generators-Git/
https://argo-cd.readthedocs.io/en/stable/operator-manual/applicationset/Generators-Plugin/