You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
---
# third sync wave because it has to be up after postgresapiVersion: argoproj.io/v1alpha1kind: ApplicationSetmetadata:
name: mastodon-app-setnamespace: argocdspec:
# enable go templatinggoTemplate: true# this generator allows us to values from an external k8s secretgenerators:
- plugin:
configMapRef:
name: secret-var-plugin-generatorinput:
parameters:
secret_vars:
- mastodon_hostname
- mastodon_s3_endpoint
- global_cluster_issuertemplate:
metadata:
name: mastodon-web-appannotations:
argocd.argoproj.io/sync-wave: "3"argocd.argoproj.io/sync-options: ApplyOnly=truespec:
project: mastodondestination:
server: https://kubernetes.default.svcnamespace: mastodonsyncPolicy:
syncOptions:
- ApplyOutOfSyncOnly=truesources:
# forked from: https://github.com/mastodon/chart/tree/main
- repoURL: 'https://small-hack.github.io/mastodon-helm-chart'targetRevision: 5.0.0chart: mastodonhelm:
valueFiles:
- $values/mastodon/small-hack/values/values-override.yaml
- repoURL: 'https://github.com/small-hack/argocd-apps.git'targetRevision: eso-helm-chart-testref: values
Above I'm using a generator that just pulls from a secret, but I'm happy to put together an example with a list generator to be more clear too. The reason the generator is important is because I have values I want to override based on an existing Kubernetes secret. The values override file contains this a few parts where mastodon_hostname is supposed to be rendered:
click me for the full values-override.yaml example
image:
repository: ghcr.io/mastodon/mastodonpullPolicy: IfNotPresentmastodon:
createAdmin:
enabled: falseexistingSecret: mastodon-admin-credentialssecretKeys:
usernameKey: usernamepasswordKey: passwordemailKey: emailcron:
# -- run `tootctl media remove` every weekremoveMedia:
enabled: trueschedule: "0 0 * * 0"# -- available locales: https://github.com/mastodon/mastodon/blob/main/config/application.rb#L71locale: enlocal_domain: {{ .mastodon_hostname }}# -- Use of WEB_DOMAIN requires careful consideration: https://docs.joinmastodon.org/admin/config/#federation# You must redirect the path LOCAL_DOMAIN/.well-known/ to WEB_DOMAIN/.well-known/ as described# Example: mastodon.example.comweb_domain: null# -- If set to true, the frontpage of your Mastodon server will always redirect to the first profile in the database and registrations will be disabled.singleUserMode: false# -- Enables "Secure Mode" for more details see: https://docs.joinmastodon.org/admin/config/#authorized_fetchauthorizedFetch: false# -- Enables "Limited Federation Mode" for more detauls see: https://docs.joinmastodon.org/admin/config/#limited_federation_modelimitedFederationMode: falseextraVolumes:
- name: postgres-casecret:
secretName: mastodon-postgres-server-ca-key-pairdefaultMode: 0440
- name: postgres-client-certssecret:
secretName: mastodon-postgres-mastodon-certdefaultMode: 0440extraVolumeMounts:
- name: postgres-camountPath: /etc/secrets/ca
- name: postgres-client-certsmountPath: /etc/secrets/mastodons3:
enabled: trueexistingSecret: "mastodon-s3-credentials"hostname: {{ .mastodon_s3_endpoint }}secretKeys:
s3AccessKeyID: S3_USERs3AccessKey: S3_PASSWORDs3Bucket: BUCKETs3Endpoint: ENDPOINTs3Hostname: HOSTNAMEsecrets:
# these must be set manually; autogenerated keys are rotated on each upgradeexistingSecret: "mastodon-server-secrets"sidekiq:
workers:
- name: all-queues# -- Number of threads / parallel sidekiq jobs that are executed per Podconcurrency: 25# -- Sidekiq queues for Mastodon that are handled by this worker. See https://docs.joinmastodon.org/admin/scaling/#concurrency# See https://github.com/mperham/sidekiq/wiki/Advanced-Options#queues for how to weight queues as argumentqueues:
- default,8
- push,6
- ingress,4
- mailers,2
- pull# Make sure the scheduler queue only exists once and with a worker that has 1 replica.
- schedulersmtp:
auth_method: loginca_file: /etc/ssl/certs/ca-certificates.crtdelivery_method: smtpdomain: {{ .mastodon_hostname }}enable_starttls: 'auto'from_address: toots@{{ .mastodon_hostname }}openssl_verify_mode: peerport: 587reply_to: no-reply@{{ .mastodon_hostname }}tls: true# keys must be named `server`, `login`, `password`existingSecret: mastodon-smtp-credentialsstreaming:
port: 4000# -- this should be set manually since os.cpus() returns the number of CPUs on# the node running the pod, which is unrelated to the resources allocated to# the pod by k8sworkers: 1# -- The base url for streaming can be set if the streaming API is deployed to# a different domain/subdomain.base_url: null# -- Number of Streaming Pods runningreplicas: 1web:
port: 3000# -- Number of Web Pods runningreplicas: 1minThreads: "5"maxThreads: "5"workers: "2"persistentTimeout: "20"metrics:
statsd:
# -- Enable statsd publishing via STATSD_ADDR environment variableaddress: ""# Sets the PREPARED_STATEMENTS environment variable: https://docs.joinmastodon.org/admin/config/#prepared_statementspreparedStatements: trueingress:
enabled: trueannotations:
kubernetes.io/tls-acme: "true"cert-manager.io/cluster-issuer: {{ .global_cluster_issuer }}# ensure that NGINX's upload size matches Mastodon'snginx.ingress.kubernetes.io/proxy-body-size: 40mingressClassName: nginxhosts:
- host: {{ .mastodon_hostname }}paths:
- path: '/'tls:
- secretName: mastodon-tlshosts:
- {{ .mastodon_hostname }}# https://github.com/bitnami/charts/tree/main/bitnami/elasticsearch#parameterselasticsearch:
# `false` will disable full-text search# if you enable ES after the initial install, you will need to manually run# RAILS_ENV=production bundle exec rake chewy:sync# (https://docs.joinmastodon.org/admin/optional/elasticsearch/)enabled: truemaster:
replicaCount: 1autoscaling:
minReplicas: 1data:
replicaCount: 1coordinating:
replicaCount: 1ingest:
replicaCount: 1externalDatabase:
enabled: truehostname: mastodon-postgres-rw.mastodon.svcport: "5432"database: mastodonuser: mastodonexistingSecret: "mastodon-pgsql-credentials"sslmode: "verify-full"sslcert: "/etc/secrets/mastodon/tls.crt"sslkey: "/etc/secrets/mastodon/tls.key"sslrootcert: "/etc/secrets/ca/ca.crt"# https://github.com/bitnami/charts/tree/main/bitnami/postgresql#parameterspostgresql:
enabled: false# https://github.com/bitnami/charts/tree/main/bitnami/redis#parametersredis:
enabled: falsehostname: "mastodon-redis-master"port: 6379auth:
# with a key of redis-password set to the password you wantexistingSecret: "mastodon-redis-credentials"service:
type: ClusterIPport: 80externalAuth:
oidc:
enabled: falseoauth_global:
# -- Automatically redirect to OIDC, CAS or SAML, and don't use local account authentication when clicking on Sign-Inomniauth_only: false# -- https://github.com/mastodon/mastodon/blob/main/Dockerfile#L75# if you manually change the UID/GID environment variables, ensure these values match:podSecurityContext:
runAsUser: 991runAsGroup: 991fsGroup: 991securityContext: {}serviceAccount:
# -- Specifies whether a service account should be createdcreate: true# -- Annotations to add to the service accountannotations: {}
This is the error I get when using the above combination of an ApplicationSet referencing a remote published helm chart and then a values.yaml living in the same directory as the ApplicationSet:
Failed to load target state: failed to generate manifest for source 1 of 2: rpc error: code = Unknown desc = Manifest generation error (cached): helm template . --name-template mastodon-web-app --namespace mastodon --kube-version 1.27 --values <path to cached source>/mastodon/small-hack/values/values-override.yaml <api versions removed> --include-crds failed exit status 1: Error: failed to parse /mastodon/small-hack/values/values-override.yaml: error converting YAML to JSON: yaml: invalid map key: map[interface {}]interface {}{".mastodon_hostname":interface {}(nil)}
To be clear, ApplicationSet generators of any kind work with inline yaml via helm.values. Here's an example working ApplicationSet:
Click me for ApplicationSet using inline yaml in helm.values
---
# third sync wave because it has to be up after postgresapiVersion: argoproj.io/v1alpha1kind: ApplicationSetmetadata:
name: mastodon-app-setnamespace: argocdspec:
# enable go templatinggoTemplate: true# this generator allows us to values from an external k8s secretgenerators:
- plugin:
configMapRef:
name: secret-var-plugin-generatorinput:
parameters:
secret_vars:
- mastodon_hostname
- mastodon_s3_endpoint
- global_cluster_issuertemplate:
metadata:
name: mastodon-web-appannotations:
argocd.argoproj.io/sync-wave: "3"argocd.argoproj.io/sync-options: ApplyOnly=truespec:
project: mastodondestination:
server: https://kubernetes.default.svcnamespace: mastodonsyncPolicy:
syncOptions:
- ApplyOutOfSyncOnly=truesource:
# forked from: https://github.com/mastodon/chart/tree/mainrepoURL: 'https://small-hack.github.io/mastodon-helm-chart'targetRevision: 5.0.0chart: mastodonhelm:
values: | image: repository: ghcr.io/mastodon/mastodon pullPolicy: IfNotPresent mastodon: createAdmin: enabled: false existingSecret: mastodon-admin-credentials secretKeys: usernameKey: username passwordKey: password emailKey: email cron: # -- run `tootctl media remove` every week removeMedia: enabled: true schedule: "0 0 * * 0" # -- available locales: https://github.com/mastodon/mastodon/blob/main/config/application.rb#L71 locale: en local_domain: {{ .mastodon_hostname }} # -- Use of WEB_DOMAIN requires careful consideration: https://docs.joinmastodon.org/admin/config/#federation # You must redirect the path LOCAL_DOMAIN/.well-known/ to WEB_DOMAIN/.well-known/ as described # Example: mastodon.example.com web_domain: null # -- If set to true, the frontpage of your Mastodon server will always redirect to the first profile in the database and registrations will be disabled. singleUserMode: false # -- Enables "Secure Mode" for more details see: https://docs.joinmastodon.org/admin/config/#authorized_fetch authorizedFetch: false # -- Enables "Limited Federation Mode" for more detauls see: https://docs.joinmastodon.org/admin/config/#limited_federation_mode limitedFederationMode: false extraVolumes: - name: postgres-ca secret: secretName: mastodon-postgres-server-ca-key-pair defaultMode: 0440 - name: postgres-client-certs secret: secretName: mastodon-postgres-mastodon-cert defaultMode: 0440 extraVolumeMounts: - name: postgres-ca mountPath: /etc/secrets/ca - name: postgres-client-certs mountPath: /etc/secrets/mastodon s3: enabled: true existingSecret: "mastodon-s3-credentials" hostname: {{ .mastodon_s3_endpoint }} secretKeys: s3AccessKeyID: S3_USER s3AccessKey: S3_PASSWORD s3Bucket: BUCKET s3Endpoint: ENDPOINT s3Hostname: HOSTNAME secrets: # these must be set manually; autogenerated keys are rotated on each upgrade existingSecret: "mastodon-server-secrets" sidekiq: workers: - name: all-queues # -- Number of threads / parallel sidekiq jobs that are executed per Pod concurrency: 25 # -- Sidekiq queues for Mastodon that are handled by this worker. See https://docs.joinmastodon.org/admin/scaling/#concurrency # See https://github.com/mperham/sidekiq/wiki/Advanced-Options#queues for how to weight queues as argument queues: - default,8 - push,6 - ingress,4 - mailers,2 - pull # Make sure the scheduler queue only exists once and with a worker that has 1 replica. - scheduler smtp: auth_method: login ca_file: /etc/ssl/certs/ca-certificates.crt delivery_method: smtp domain: {{ .mastodon_hostname }} enable_starttls: 'auto' from_address: toots@{{ .mastodon_hostname }} openssl_verify_mode: peer port: 587 reply_to: no-reply@{{ .mastodon_hostname }} tls: true # keys must be named `server`, `login`, `password` existingSecret: mastodon-smtp-credentials streaming: port: 4000 # -- this should be set manually since os.cpus() returns the number of CPUs on # the node running the pod, which is unrelated to the resources allocated to # the pod by k8s workers: 1 # -- The base url for streaming can be set if the streaming API is deployed to # a different domain/subdomain. base_url: null # -- Number of Streaming Pods running replicas: 1 web: port: 3000 # -- Number of Web Pods running replicas: 1 minThreads: "5" maxThreads: "5" workers: "2" persistentTimeout: "20" metrics: statsd: # -- Enable statsd publishing via STATSD_ADDR environment variable address: "" # Sets the PREPARED_STATEMENTS environment variable: https://docs.joinmastodon.org/admin/config/#prepared_statements preparedStatements: true ingress: enabled: true annotations: kubernetes.io/tls-acme: "true" cert-manager.io/cluster-issuer: {{ .global_cluster_issuer }} # ensure that NGINX's upload size matches Mastodon's nginx.ingress.kubernetes.io/proxy-body-size: 40m ingressClassName: nginx hosts: - host: {{ .mastodon_hostname }} paths: - path: '/' tls: - secretName: mastodon-tls hosts: - {{ .mastodon_hostname }} # https://github.com/bitnami/charts/tree/main/bitnami/elasticsearch#parameters elasticsearch: # `false` will disable full-text search # if you enable ES after the initial install, you will need to manually run # RAILS_ENV=production bundle exec rake chewy:sync # (https://docs.joinmastodon.org/admin/optional/elasticsearch/) enabled: true master: replicaCount: 1 autoscaling: minReplicas: 1 data: replicaCount: 1 coordinating: replicaCount: 1 ingest: replicaCount: 1 externalDatabase: enabled: true hostname: mastodon-postgres-rw.mastodon.svc port: "5432" database: mastodon user: mastodon existingSecret: "mastodon-pgsql-credentials" sslmode: "verify-full" sslcert: "/etc/secrets/mastodon/tls.crt" sslkey: "/etc/secrets/mastodon/tls.key" sslrootcert: "/etc/secrets/ca/ca.crt" # https://github.com/bitnami/charts/tree/main/bitnami/postgresql#parameters postgresql: enabled: false # https://github.com/bitnami/charts/tree/main/bitnami/redis#parameters redis: enabled: false hostname: "mastodon-redis-master" port: 6379 auth: # with a key of redis-password set to the password you want existingSecret: "mastodon-redis-credentials" service: type: ClusterIP port: 80 externalAuth: oidc: enabled: false oauth_global: # -- Automatically redirect to OIDC, CAS or SAML, and don't use local account authentication when clicking on Sign-In omniauth_only: false # -- https://github.com/mastodon/mastodon/blob/main/Dockerfile#L75 # if you manually change the UID/GID environment variables, ensure these values match: podSecurityContext: runAsUser: 991 runAsGroup: 991 fsGroup: 991 securityContext: {} serviceAccount: # -- Specifies whether a service account should be created create: true # -- Annotations to add to the service account annotations: {}
The only issue with that is that in most IDEs, it will show up as a string, and not yaml, and so the syntax highlighting is off. See Screenshots for example.
I just can't use helm.valuesObject or helm.valuesFiles (with an override values.yaml in a different repo from the helm chart), and wasn't sure how to move forward.
Expected behavior
I'd expect the templated values from the generator to be rendered in the values-override.yaml and for it to work the same as in-line yaml overriding.
Screenshots
Example of the error when using multiple sources:
Example of the in-line yaml not rendering properly (this also breaks the LSP's ability to follow where you are, so if your cursor is anywhere under values, it just shows at the top as being one giant values string type, so if you need to get really nested, this can make troubleshooting hard):
The reason I keep pressing this is because I'm dyslexic and syntax highlighting really helps me read.
Version
Local CLI version installed via linuxbrew.
I'm not sure which logs to check, but I am happy to provide them if you let me know. It's not failing in a massive way like the other issue, but again, very happy to assist in any way.
The text was updated successfully, but these errors were encountered:
jessebot
changed the title
ApplicationSets cannot template within remote repo values.yaml override when using multiple sources
ApplicationSets cannot template generator values within remote repo values.yaml override when using multiple sources
Nov 27, 2023
Checklist:
argocd version
.Describe the bug
Before we get started, I should mention my main goal is to have proper syntax highlighting on the values override values.
I can't use a
valuesObject
due to #14912, and in #9583 (comment) it was kindly suggested to try out the multiple sources route.I cannot template use a generator to template anything inside a values.yaml file override done via the multiple sources method.
To Reproduce
Here's my ApplicationSet for mastodon:
Above I'm using a generator that just pulls from a secret, but I'm happy to put together an example with a list generator to be more clear too. The reason the generator is important is because I have values I want to override based on an existing Kubernetes secret. The values override file contains this a few parts where
mastodon_hostname
is supposed to be rendered:click me for the full
values-override.yaml
exampleThis is the error I get when using the above combination of an ApplicationSet referencing a remote published helm chart and then a values.yaml living in the same directory as the ApplicationSet:
To be clear, ApplicationSet generators of any kind work with inline yaml via
helm.values
. Here's an example working ApplicationSet:Click me for ApplicationSet using inline yaml in helm.values
The only issue with that is that in most IDEs, it will show up as a string, and not yaml, and so the syntax highlighting is off. See Screenshots for example.
I just can't use
helm.valuesObject
orhelm.valuesFiles
(with an override values.yaml in a different repo from the helm chart), and wasn't sure how to move forward.Expected behavior
I'd expect the templated values from the generator to be rendered in the values-override.yaml and for it to work the same as in-line yaml overriding.
Screenshots
Example of the error when using multiple sources:
Example of the in-line yaml not rendering properly (this also breaks the LSP's ability to follow where you are, so if your cursor is anywhere under values, it just shows at the top as being one giant values string type, so if you need to get really nested, this can make troubleshooting hard):
The reason I keep pressing this is because I'm dyslexic and syntax highlighting really helps me read.
Version
Local CLI version installed via linuxbrew.
If it is helpful, Argo CD is installed via k3s on metal via an Argo CD ApplicationSet:
https://github.com/small-hack/argocd-apps/blob/eso-helm-chart-test/argocd/argocd_appset.yaml
Logs
I'm not sure which logs to check, but I am happy to provide them if you let me know. It's not failing in a massive way like the other issue, but again, very happy to assist in any way.
The text was updated successfully, but these errors were encountered: