Skip to content
This repository was archived by the owner on Jul 15, 2024. It is now read-only.
This repository was archived by the owner on Jul 15, 2024. It is now read-only.

Cannot template syncPolicy parameters because of applicationset validation #424

@jemag

Description

@jemag

In the optics of self-serve, I would like to let each team specify their "prune" and "selfHeal" parameters from syncPolicy. To do so, I am using the following applicationset:

apiVersion: argoproj.io/v1alpha1
  kind: ApplicationSet
  metadata:
    name: XX-bootstrap
    namespace: argocd
    annotations:
      argocd.argoproj.io/sync-options: Validate=false
  spec:
    generators:
    - git:
        repoURL: "somegitrepo"
        revision: HEAD
        files:
        - path: apps/dev/**/config.yaml
    template:
      metadata:
        name: "XX-{{app.name}}"
      spec:
        project: XX
        source:
          repoURL: "somegitrepo"
          targetRevision: HEAD
          path: "{{app.path}}"
        destination:
          server: https://kubernetes.default.svc
          namespace: XX
        syncPolicy:
          automated:
              allowEmpty: true
              prune: "{{app.sync.prune}}"
              selfHeal: "{{app.sync.selfHeal}}"

The problem arises because "{{app.sync.prune}}" is not a boolean but rather a string:
image

I also cannot remove the double quotes, since my applicationset passes through kustomize. Therefore using the form {{app.sync.prune}} would result in
Error: map[string]interface {}(nil): yaml: invalid map key: map[string]interface {}{"app.sync.prune":""}

As you can see in the yaml above, I also tried to disable the validation using

annotations:
      argocd.argoproj.io/sync-options: Validate=false

however that did not seem to help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions