Closed jessebot closed 11 months ago
I have tried this as of today, and it unfortunately still doesn't work. I'm using Argo CD v2.8.2+dbdfc71
deployed via the helm chart, and I'm not overriding the image at all. You can see my full values.yaml for the helm chart here as Argo CD manages itself (however the values are in-line yaml because of the valuesObject bug).
Here's an example of a working applicationSet using values: |
instead of valuesObject
:
https://github.com/small-hack/argocd-apps/blob/380610565cb2681c10d56de8e8a0d771f4cf0cd1/nextcloud/nextcloud_argocd_appset.yaml
And here's the same applicationSet using valuesObject
:
https://github.com/small-hack/argocd-apps/blob/9d63a5928a9f0a793b0ebd8b884c146ffc1f1295/nextcloud/nextcloud_argocd_appset.yaml
When using the valuesObject
, I see this ComparisonError
in the ApplicationConditions when I check the Sync Error via the UI:
Failed to load target state: failed to generate manifest for source 1 of 1: rpc error: code = Unknown desc = Manifest generation error (cached): rpc error: code = FailedPrecondition desc = Failed to unmarshal "nextcloud_argocd_appset.yaml":
The same error also appears in the Application controller's pod logs:
{"application":"nextcloud",
"dest-namespace":"nextcloud",
"dest-server":"https://kubernetes.default.svc",
"level":"info",
"msg":"Sync operation to failed: ComparisonError: Failed to load target state: failed to generate manifest for source 1 of 1: rpc error: code = Unknown desc = Manifest generation error (cached): rpc error: code = FailedPrecondition desc = Failed to unmarshal \"nextcloud_argocd_appset.yaml\": \u003cnil\u003e",
"reason":"OperationCompleted",
"time":"2023-09-07T13:21:04Z",
"type":"Warning"}
However, none of the pods crashed this time, so the experience is definitely better than last time I tried it :D
I'm not able to reproduce the panic in either 2.8.2 or 2.9.2 with the given example ApplicationSet (list generator).
The only things I changed in the spec are the project and destination namespace (changed both to default
).
I observed that the appset controller successfully created the app and that the app was populated with the correct valuesObject
.
Let me give this another try later today then! :) :crossed_fingers:
The list generator is working! I have tested it and it is working as per my reproducing instructions above :) That ApplicationSet now lives here for easier reference. Glad to see that's working 👏
By the way, my current argocd version
output is as follows:
# argocd cli is installed via linuxbrew with brew install argocd
argocd: v2.9.3+6eba5be.dirty
BuildDate: 2023-12-02T00:36:55Z
GitCommit: 6eba5be864b7e031871ed7698f5233336dfe75c7
GitTreeState: dirty
GoVersion: go1.21.4
Compiler: gc
Platform: linux/amd64
# server is installed via the helm chart
argocd-server: v2.9.3+6eba5be.dirty
BuildDate: 2023-12-02T00:36:55Z
GitCommit: 6eba5be864b7e031871ed7698f5233336dfe75c7
GitTreeState: dirty
GoVersion: go1.21.4
Compiler: gc
Platform: linux/amd64
Kustomize Version: v5.2.1 2023-10-19T20:11:23Z
Helm Version: v3.13.2+g2a2fb3b
Kubectl Version: v0.24.2
Jsonnet Version: v0.20.0
So, the only thing left to test is the secret plugin generator, which I created from your template.
and it seems to have worked! :tada:
So, now, to make sure this issue is dead forever, hopefully, I went ahead and tried this with mastodon, but fails :( I'm really sick right now, but I've wanted to see this working for months, so here's a video of me trying to get this working (sorry for no subtitles and that I sound stuffy):
https://github.com/argoproj/argo-cd/assets/2389292/845f5033-efde-43c8-ae4b-c53b31dcae34
Here's the web interface:
text of error:
Failed to load target state: failed to generate manifest for source 1 of 1: rpc error: code = Unknown desc = Manifest generation error (cached): rpc error: code = FailedPrecondition desc = Failed to unmarshal "mastodon_argocd_appset.yaml":
If I try to sync the application anyway, I get Sync Error and this text:
ComparisonError: Failed to load target state: failed to generate manifest for source 1 of 1: rpc error: code = Unknown desc = Manifest generation error (cached): rpc error: code = FailedPrecondition desc = Failed to unmarshal "mastodon_argocd_appset.yaml":
Is it something do with cache? I don't think I actually know how to clear Argo CD cache of any kind outside of hitting the refresh/hard refresh buttons in the web interface and those still produce the above errors :(
Here's the appset it says is nil: https://github.com/small-hack/argocd-apps/blob/e2114cad3bc080f6ab437626a9030df104b31a1c/mastodon/small-hack/app_of_apps/mastodon_argocd_appset.yaml
Here's the appset when it was working, just before the commit in the video where I changed values: |
to valuesObject:
:
https://github.com/small-hack/argocd-apps/blob/02d7b9f928ad818ac464455b57e82165dbec46cd/mastodon/small-hack/app_of_apps/mastodon_argocd_appset.yaml
Perhaps this only occurs when you first use values
followed by switching to valuesObject
? I'm not sure, but this happens if I change any of my existing Argo CD ApplicationSets to use spec.valuesObject
.
It's hard to read in the logs above, but I wonder if the issue has to do with this part since it says that Helm is nil? (grasping at straws):
Sync:{Status: ComparedTo:{Source:{RepoURL: Path: TargetRevision: Helm:nil Kustomize:nil Directory:nil Plugin:nil Chart: Ref:} Destination:{Server: Namespace: Name: isServerInferred:false} Sources:[] IgnoreDifferences:[]} Revision: Revisions:[]} Health:{Status: Message:} History:[] Conditions:[] ReconciledAt:\u003cnil\u003e OperationState:nil ObservedAt:\u003cnil\u003e SourceType: Summary:{ExternalURLs:[] Images:[]} ResourceHealthSource: SourceTypes:[] ControllerNamespace:} Operation:nil}]","time":"2023-12-11T14:16:37Z"}
At this point, I'm also happy to give Argo CD maintainers access to my machine to take a look, as I'm not sure what else to check. Again, as always, thanks so much for taking some time to look into my issues. I really appeciate everything the maintainers and community of this project do. 💙 Also sorry this was long winded.
Ah, I think I know what it is.
When you switch to valuesObject
, i.e. change from string to an unstructured object, you need to find every field which currently contains {{ whatever }}
and wrap them in strings.
For example:
- local_domain: {{ .mastodon_hostname }}
+ local_domain: '{{ .mastodon_hostname }}'
You have to do this because the JSON unmarshaller is encountering {
and interpreting it as raw JSON. But you want it to interpret the field as a string containing {
.
@crenshaw-dev you were right!! :D Let me know if you're ever in Amsterdam and I will buy you a sandwich (when I don't have covid)! Thank you so much!!
Checklist:
argocd version
.Describe the bug The ApplicationSet Controller pod seems to get itself into a CrashLoopBackoff state when using a generator (list generator in this case) to populate templated fields in a
spec.template.spec.source.helm.valuesObject
field. The values I have here work via helm directly in a values file and they also work when I use the ApplcationSet with thespec.template.spec.source.helm.values
field instead. They only error when usingvaluesObject
, which I know is still pre-release and not officially supported, but is still good to note. In the meantime, the workaround is to just use thehelm.values
field instead, for anyone else searching.To Reproduce I tested with a list generator to template a nextcloud helm chart iwth overriden values.
This is the ApplicationSet yaml file (Collapsed by default)
```yaml --- apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: nextcloud-web-app-set namespace: argocd annotations: argocd.argoproj.io/sync-wave: "2" spec: generators: - list: elements: - nextcloudHostname: test.coolwebsite.com template: metadata: name: nextcloud-web-app spec: project: nextcloud destination: server: https://kubernetes.default.svc namespace: nextcloud source: repoURL: 'https://nextcloud.github.io/helm' targetRevision: 3.5.20 chart: nextcloud helm: valuesObject: ingress: enabled: true className: nginx annotations: nginx.ingress.kubernetes.io/proxy-body-size: 10G kubernetes.io/tls-acme: "true" cert-manager.io/cluster-issuer: letsencrypt-staging nginx.ingress.kubernetes.io/enable-cors: "false" nginx.ingress.kubernetes.io/cors-allow-headers: "X-Forwarded-For" nginx.ingress.kubernetes.io/server-snippet: |- proxy_hide_header X-Powered-By; rewrite ^/.well-known/webfinger /index.php/.well-known/webfinger last; rewrite ^/.well-known/nodeinfo /index.php/.well-known/nodeinfo last; rewrite ^/.well-known/host-meta /public.php?service=host-meta last; rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json; location = /.well-known/carddav { return 301 $scheme://$host/remote.php/dav/; } location = /.well-known/caldav { return 301 $scheme://$host/remote.php/dav/; } tls: - secretName: nextcloud-tls hosts: - "{{nextcloudHostname}}" nextcloud: host: "{{nextcloudHostname}}" existingSecret: enabled: true secretName: nextcloud-admin-credentials usernameKey: username passwordKey: password tokenKey: serverinfo_token smtpUsernameKey: smtpUsername smtpPasswordKey: smtpPassword update: 1 mail: enabled: false configs: logging.config.php: |- 'file', 'logfile' => 'nextcloud.log', 'loglevel' => 1, 'logdateformat' => 'F d, Y H:i:s' ); video_previews.config.php: |- true, 'enabledPreviewProviders' => array ( 'OC\Preview\Movie', 'OC\Preview\PNG', 'OC\Preview\JPEG', 'OC\Preview\GIF', 'OC\Preview\BMP', 'OC\Preview\XBitmap', 'OC\Preview\MP3', 'OC\Preview\MP4', 'OC\Preview\TXT', 'OC\Preview\MarkDown', 'OC\Preview\PDF' ), ); proxy.config.php: |- array( 0 => '127.0.0.1', 1 => '10.0.0.0/8' ), 'forwarded_for_headers' => array('HTTP_X_FORWARDED_FOR'), ); nginx: enabled: true internalDatabase: enabled: false externalDatabase: enabled: true type: postgresql host: localhost:5432 user: nextcloud database: nextcloud existingSecret: enabled: true secretName: nextcloud-pgsql-credentials usernameKey: username passwordKey: nextcloudPassword postgresql: enabled: true global: postgresql: auth: username: nextcloud database: nextcloud existingSecret: nextcloud-pgsql-credentials secretKeys: userPasswordKey: nextcloudPassword adminPasswordKey: postgresPassword volumePermissions: enabled: true primary: podAnnotations: k8up.io/backupcommand: "sh -c 'PGDATABASE=\"$POSTGRES_DB\" PGUSER=\"$POSTGRES_USER\" PGPASSWORD=\"$POSTGRES_PASSWORD\" pg_dump --clean'" k8up.io/file-extension: .sql pgHbaConfiguration: |- local all all trust host all all 127.0.0.1/32 md5 host all nextcloud 10.0.0.0/8 md5 initdb: scripts: my_init_script.sql: | ALTER DATABASE nextcloud OWNER TO nextcloud; GRANT ALL PRIVILEGES ON DATABASE nextcloud TO nextcloud; GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO nextcloud; persistence: enabled: true existingClaim: "nextcloud-postgresql" redis: enabled: false replica: replicaCount: 1 auth: enabled: true existingSecret: nextcloud-redis-credentials existingSecretPasswordKey: redis_password cronjob: enabled: true service: type: ClusterIP port: 8080 loadBalancerIP: nil nodePort: nil persistence: enabled: true existingClaim: nextcloud-files nextcloudData: enabled: false subPath: livenessProbe: enabled: false initialDelaySeconds: 45 periodSeconds: 15 timeoutSeconds: 5 failureThreshold: 3 successThreshold: 1 readinessProbe: enabled: true initialDelaySeconds: 45 periodSeconds: 15 timeoutSeconds: 5 failureThreshold: 3 successThreshold: 1 startupProbe: enabled: false initialDelaySeconds: 30 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 30 successThreshold: 1 hpa: enabled: false cputhreshold: 60 minPods: 1 maxPods: 10 metrics: enabled: true https: true token: "enabled" timeout: 10s image: tag: 0.6.0 podLabels: jobLabel: nextcloud-metrics service: annotations: prometheus.io/scrape: "true" prometheus.io/port: "9205" labels: jobLabel: nextcloud-metrics serviceMonitor: enabled: true namespace: "nextcloud" rbac: enabled: true syncPolicy: syncOptions: - ApplyOutOfSyncOnly=true automated: prune: true selfHeal: true ``` **Expected behavior** I excepted the applicationSet to produce an application with the templated values rendered. **Version** ```shell argocd: v2.7.10+469f257.dirty BuildDate: 2023-07-31T23:02:18Z GitCommit: 469f25753b2be7ef0905a11632a6382060bcae99 GitTreeState: dirty GoVersion: go1.20.6 Compiler: gc Platform: linux/amd64 WARN[0000] Failed to invoke grpc call. Use flag --grpc-web in grpc calls. To avoid this warning message, use flag --grpc-web. argocd-server: v2.8.0-rc7+1ee5010 BuildDate: 2023-08-03T15:13:16Z GitCommit: 1ee5010d6d55c7a57fd3f3b4f0a8df893d1748bb GitTreeState: clean GoVersion: go1.20.6 Compiler: gc Platform: linux/amd64 Kustomize Version: v5.1.0 2023-06-19T16:58:18Z Helm Version: v3.12.1+gf32a527 Kubectl Version: v0.24.2 Jsonnet Version: v0.20.0 ```If it's helpful, I installed argo-cd via the latest helm chart
argo-cd-5.42.1
with a parameter to override the global.image.tag to bev2.8.0-rv7
and then patched the ApplicationSet CRD to with the latest at time of writing.Logs These are the logs from the ApplicationSet Controller pod:
As always, I know the maintainers of Argoproj are really busy, but thanks for your continued support and helpfulness :)