Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting error "multiple application sources defined: Helm,Plugin" while using Kustomize plugin with Argo-CD #11700

Closed
2 tasks done
prasoon-pxc opened this issue Dec 14, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@prasoon-pxc
Copy link

Checklist:

  • I've included steps to reproduce the bug.
  • I've pasted the output of argocd version.

Describe the bug
I want to use kustomize with helm chart for some additional patching in chart, one way I found is to config- management plugin ,which need to be defined in Argo-CD cm.

ArgoCD-CM

configManagementPlugins: |
    - name: kustomized-helm
      init:
        command: ["/bin/sh", "-c"]
        args: ["helm dependency build || true"]
      generate:
        command: ["/bin/sh", "-c"]
        args: ["echo \"$HELM_VALUES\" | helm template . --name-template $ARGOCD_APP_NAME --namespace $ARGOCD_APP_NAMESPACE $ARGOCD_ENV_HELM_ARGS -f - --include-crds > all.yaml && kustomize build"]

-- Here is my appset file where I am using the kustomized-helm plugin

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: loki-rule-stack
spec:
  generators:
  # only remote clusters
  - clusters:
      selector:
        matchExpressions:
        - key: environment
          operator: In
          values:
            - "infrastructure"
  template:
    metadata:
      name: '{{"{{"}}name{{"}}"}}-loki-rule'
      namespace: argocd
      finalizers:
      - resources-finalizer.argocd.argoproj.io
    spec:
      destination:
        name: '{{"{{"}}name{{"}}"}}'
        namespace: monitoring
      project: default
      source:
        path: apps/lokiruleset
        repoURL: https://github.com/myorf.demo.git
        targetRevision: HEAD
        plugin:
          name: kustomized-helm
          # env:
          #   - name: HELM_VALUES
          #     value:  |
          #       skipCrds: true
          #       values: values-new.yaml
          #       release-name: cortex-loki
         helm:
           releaseName: cortex-loki
           skipCrds: true
           valueFiles:
             - 'values-{{"{{"}}name{{"}}"}}.yaml'
      syncPolicy:
        automated:
          prune: true
          selfHeal: false

  • I wanted to use custom values file for different env, but I am not able to defined it with environment variable for the customized plugin option , so I tried to use default helm section to define valuesfiles, but getting error:

  • It seems that it is not allowing to use helm section if you are using configuration plugin

rpc error: code = Unknown desc = Manifest generation error (cached): multiple application sources defined: Helm,Plugin

To Reproduce

  • First configure config plugin in argo-cd configmap

argocd-cm.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    app.kubernetes.io/name: argocd-cm
    app.kubernetes.io/part-of: argocd
  name: argocd-cm
  namespace: argocd
data:
  configManagementPlugins: |
    - name: kustomized-helm
      init:
        command: ["/bin/sh", "-c"]
        args: ["helm dependency build || true"]
      generate:
        command: ["/bin/sh", "-c"]
        args: ["echo \"$HELM_VALUES\" | helm template . --name-template $ARGOCD_APP_NAME --namespace $ARGOCD_APP_NAMESPACE $ARGOCD_ENV_HELM_ARGS -f - --include-crds > all.yaml && kustomize build"]

  • Then Create application or appset on Argo-CD and used plugin name :
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: loki-rule-stack
spec:
  generators:
  # only remote clusters
  - clusters:
      selector:
        matchExpressions:
        - key: environment
          operator: In
          values:
            - "infrastructure"
  template:
    metadata:
      name: '{{"{{"}}name{{"}}"}}-loki-rule'
      namespace: argocd
      finalizers:
      - resources-finalizer.argocd.argoproj.io
    spec:
      destination:
        name: '{{"{{"}}name{{"}}"}}'
        namespace: monitoring
      project: default
      source:
        path: apps/lokiruleset
        repoURL: https://github.com/my-org/test.git
        targetRevision: HEAD
        plugin:
          name: kustomized-helm
          helm:
           releaseName: cortex-loki
           skipCrds: true
           valueFiles:
             - 'values-{{"{{"}}name{{"}}"}}.yaml'
      syncPolicy:
        automated:
          prune: true
          selfHeal: false

Expected behavior

It should allow to use helm section also in appset for passing custom values file
Screenshots

Version

{
    "Version": "v2.5.1+504da42",
    "BuildDate": "2022-11-01T21:14:30Z",
    "GitCommit": "504da424c2c9bb91d7fb2ebf3ae72162e7a5a5be",
    "GitTreeState": "clean",
    "GoVersion": "go1.18.8",
    "Compiler": "gc",
    "Platform": "linux/amd64",
    "KustomizeVersion": "v4.5.7 2022-08-02T16:35:54Z",
    "HelmVersion": "v3.10.1+g9f88ccb",
    "KubectlVersion": "v0.24.2",
    "JsonnetVersion": "v0.18.0"
}

Argo-CD Version -->

Paste the output from `argocd version` here.
v2.5.1+504da42
@prasoon-pxc prasoon-pxc added the bug Something isn't working label Dec 14, 2022
@crenshaw-dev
Copy link
Member

@prasoon-pxc I think this is a duplicate of #9177

Please let me know if that's not the case!

@crenshaw-dev crenshaw-dev closed this as not planned Won't fix, can't repro, duplicate, stale Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants