argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
16.91k stars 5.13k forks source link

CMP version field affects file unix socket path and prevents successful registration #12083

Open jsoref opened 1 year ago

jsoref commented 1 year ago

Checklist:

Describe the bug

The including a value for the version field of the plugin.yaml for argocd-cmp-server results in a socket path including the version. This doesn't match the expectations of the argocd-server container side of the pod.

To Reproduce

Define a plugin.yaml for use w/ the cmp-sidecar form:

apiVersion: v1
kind: ConfigMap
metadata:
  name: cmp-plugin-conf
  labels:
  annotations:
data:
  plugin.yaml: |
    apiVersion: argoproj.io/v1alpha1
    kind: ConfigManagementPlugin
    metadata:
      name: conf
    spec:
      version: v1.0
      init:
        command: [sh, -c, 'echo "Initializing conf..."']
      generate:
        command:
        - "/usr/local/bin/conf-wrapper"
      discover:
        fileName: "./*.conf"

Use helm to define a sidecar for the repo-server with a conf-cmp and pull in the plugin definition:

  repoServer:
    # ...
    extraContainers:
    - name: conf-cmp
      image: my-image:with-conf
      securityContext:
        runAsNonRoot: true
        runAsUser: 999
      volumeMounts:
      - mountPath: "/var/run/argocd"
        name: "var-files-conf"
      - mountPath: "/home/argocd/cmp-server/plugins"
        name: "plugins"
      - mountPath: "/home/argocd/cmp-server/config/plugin.yaml"
        subPath: "plugin.yaml"
        name: "cmp-plugin-conf"
      - mountPath: "/tmp"
        name: "cmp-tmp-conf"
      - mountPath: /usr/local/bin/conf-wrapper
        name: tools
        subPath: conf-wrapper

Expected behavior

Screenshots

Version

{
    "Version": "v2.6.0+584428e",
    "BuildDate": "2023-01-19T17:14:49Z",
    "GitCommit": "584428edaf535258924912a191a97dde8a5c5d3d",
    "GitTreeState": "clean",
    "GoVersion": "go1.18.10",
    "Compiler": "gc",
    "Platform": "linux/amd64",
    "KustomizeVersion": "v4.5.7 2022-08-02T16:35:54Z",
    "HelmVersion": "v3.10.3+g835b733",
    "KubectlVersion": "v0.24.2",
    "JsonnetVersion": "v0.19.1"
}

Logs

time="2023-01-20T19:19:12Z" level=error msg="Unable to connect to config management plugin service with address /home/argocd/cmp-server/plugins/conf.sock"
time="2023-01-20T19:19:12Z" level=error msg="error dialing to cmp-server for plugin conf.sock, dial unix /home/argocd/cmp-server/plugins/conf.sock: connect: no such file or directory" CWE=775 security=2
time="2023-01-20T19:19:12Z" level=error msg="finished unary call with code Unknown" error="plugin sidecar failed. couldn't find cmp-server plugin with name conf supporting the given repository" grpc.code=Unknown grpc.method=GenerateManifest grpc.service=repository.RepoServerService grpc.start_time="2023-01-20T19:19:11Z" grpc.time_ms=1246.037 span.kind=server system=grpc

Note, I have: /home/argocd/cmp-server/plugins/conf-v1.0.sock but it's looking for /home/argocd/cmp-server/plugins/conf.sock


Some more notes:

The limited documentation for this is: https://argo-cd.readthedocs.io/en/latest/operator-manual/config-management-plugins/#using-a-config-management-plugin-with-an-application

You may leave the name field empty in the plugin section for the plugin to be automatically matched with the Application based on its discovery rules. If you do mention the name make sure it is either <metadata.name>-<spec.version> if version is mentioned in the ConfigManagementPlugin spec or else just <metadata.name>. When name is explicitly specified only that particular plugin will be used iff it’s discovery pattern/command matches the provided application repo.

https://argo-cd.readthedocs.io/en/latest/operator-manual/config-management-plugins/#1-write-the-plugin-configuration-file

pre commented 10 months ago

Trying to migrate to the sidecar cmp world, and I'm struggling with the exact same issues as described here: