github.com/argoproj/argo-cd/v3@v3.2.1/docs/operator-manual/config-management-plugins.md (about)

     1  
     2  # Config Management Plugins
     3  
     4  Argo CD's "native" config management tools are Helm, Jsonnet, and Kustomize. If you want to use a different config
     5  management tool, or if Argo CD's native tool support does not include a feature you need, you might need to turn to
     6  a Config Management Plugin (CMP).
     7  
     8  The Argo CD "repo server" component is in charge of building Kubernetes manifests based on some source files from a
     9  Helm, OCI, or Git repository. When a config management plugin is correctly configured, the repo server may delegate the
    10  task of building manifests to the plugin.
    11  
    12  The following sections will describe how to create, install, and use plugins. Check out the
    13  [example plugins](https://github.com/argoproj/argo-cd/tree/master/examples/plugins) for additional guidance.
    14  
    15  !!! warning
    16      Plugins are granted a level of trust in the Argo CD system, so it is important to implement plugins securely. Argo
    17      CD administrators should only install plugins from trusted sources, and they should audit plugins to weigh their
    18      particular risks and benefits.
    19  
    20  ## Installing a config management plugin
    21  
    22  ### Sidecar plugin
    23  
    24  An operator can configure a plugin tool via a sidecar to repo-server. The following changes are required to configure a new plugin:
    25  
    26  #### Write the plugin configuration file
    27  
    28  Plugins will be configured via a ConfigManagementPlugin manifest located inside the plugin container.
    29  
    30  ```yaml
    31  apiVersion: argoproj.io/v1alpha1
    32  kind: ConfigManagementPlugin
    33  metadata:
    34    # The name of the plugin must be unique within a given Argo CD instance.
    35    name: my-plugin
    36  spec:
    37    # The version of your plugin. Optional. If specified, the Application's spec.source.plugin.name field
    38    # must be <plugin name>-<plugin version>.
    39    version: v1.0
    40    # The init command runs in the Application source directory at the beginning of each manifest generation. The init
    41    # command can output anything. A non-zero status code will fail manifest generation.
    42    init:
    43      # Init always happens immediately before generate, but its output is not treated as manifests.
    44      # This is a good place to, for example, download chart dependencies.
    45      command: [sh]
    46      args: [-c, 'echo "Initializing..."']
    47    # The generate command runs in the Application source directory each time manifests are generated. Standard output
    48    # must be ONLY valid Kubernetes Objects in either YAML or JSON. A non-zero exit code will fail manifest generation.
    49    # To write log messages from the command, write them to stderr, it will always be displayed.
    50    # Error output will be sent to the UI, so avoid printing sensitive information (such as secrets).
    51    generate:
    52      command: [sh, -c]
    53      args:
    54        - |
    55          echo "{\"kind\": \"ConfigMap\", \"apiVersion\": \"v1\", \"metadata\": { \"name\": \"$ARGOCD_APP_NAME\", \"namespace\": \"$ARGOCD_APP_NAMESPACE\", \"annotations\": {\"Foo\": \"$ARGOCD_ENV_FOO\", \"KubeVersion\": \"$KUBE_VERSION\", \"KubeApiVersion\": \"$KUBE_API_VERSIONS\",\"Bar\": \"baz\"}}}"
    56    # The discovery config is applied to a repository. If every configured discovery tool matches, then the plugin may be
    57    # used to generate manifests for Applications using the repository. If the discovery config is omitted then the plugin 
    58    # will not match any application but can still be invoked explicitly by specifying the plugin name in the app spec. 
    59    # Only one of fileName, find.glob, or find.command should be specified. If multiple are specified then only the 
    60    # first (in that order) is evaluated.
    61    discover:
    62      # fileName is a glob pattern (https://pkg.go.dev/path/filepath#Glob) that is applied to the Application's source 
    63      # directory. If there is a match, this plugin may be used for the Application.
    64      fileName: "./subdir/s*.yaml"
    65      find:
    66        # This does the same thing as fileName, but it supports double-star (nested directory) glob patterns.
    67        glob: "**/Chart.yaml"
    68        # The find command runs in the repository's root directory. To match, it must exit with status code 0 _and_ 
    69        # produce non-empty output to standard out.
    70        command: [sh, -c, find . -name env.yaml]
    71    # The parameters config describes what parameters the UI should display for an Application. It is up to the user to
    72    # actually set parameters in the Application manifest (in spec.source.plugin.parameters). The announcements _only_
    73    # inform the "Parameters" tab in the App Details page of the UI.
    74    parameters:
    75      # Static parameter announcements are sent to the UI for _all_ Applications handled by this plugin.
    76      # Think of the `string`, `array`, and `map` values set here as "defaults". It is up to the plugin author to make 
    77      # sure that these default values actually reflect the plugin's behavior if the user doesn't explicitly set different
    78      # values for those parameters.
    79      static:
    80        - name: string-param
    81          title: Description of the string param
    82          tooltip: Tooltip shown when the user hovers the
    83          # If this field is set, the UI will indicate to the user that they must set the value.
    84          required: false
    85          # itemType tells the UI how to present the parameter's value (or, for arrays and maps, values). Default is
    86          # "string". Examples of other types which may be supported in the future are "boolean" or "number".
    87          # Even if the itemType is not "string", the parameter value from the Application spec will be sent to the plugin
    88          # as a string. It's up to the plugin to do the appropriate conversion.
    89          itemType: ""
    90          # collectionType describes what type of value this parameter accepts (string, array, or map) and allows the UI
    91          # to present a form to match that type. Default is "string". This field must be present for non-string types.
    92          # It will not be inferred from the presence of an `array` or `map` field.
    93          collectionType: ""
    94          # This field communicates the parameter's default value to the UI. Setting this field is optional.
    95          string: default-string-value
    96        # All the fields above besides "string" apply to both the array and map type parameter announcements.
    97        - name: array-param
    98          # This field communicates the parameter's default value to the UI. Setting this field is optional.
    99          array: [default, items]
   100          collectionType: array
   101        - name: map-param
   102          # This field communicates the parameter's default value to the UI. Setting this field is optional.
   103          map:
   104            some: value
   105          collectionType: map
   106      # Dynamic parameter announcements are announcements specific to an Application handled by this plugin. For example,
   107      # the values for a Helm chart's values.yaml file could be sent as parameter announcements.
   108      dynamic:
   109        # The command is run in an Application's source directory. Standard output must be JSON matching the schema of the
   110        # static parameter announcements list.
   111        command: [echo, '[{"name": "example-param", "string": "default-string-value"}]']
   112  
   113    # If set to `true` then the plugin receives repository files with original file mode. Dangerous since the repository
   114    # might have executable files. Set to true only if you trust the CMP plugin authors.
   115    preserveFileMode: false
   116  
   117    # If set to `true` then the plugin can retrieve git credentials from the reposerver during generate. Plugin authors 
   118    # should ensure these credentials are appropriately protected during execution
   119    provideGitCreds: false
   120  ```
   121  
   122  !!! note
   123      While the ConfigManagementPlugin _looks like_ a Kubernetes object, it is not actually a custom resource. 
   124      It only follows kubernetes-style spec conventions.
   125  
   126  The `generate` command must print a valid Kubernetes YAML or JSON object stream to stdout. Both `init` and `generate` commands are executed inside the application source directory.
   127  
   128  The `discover.fileName` is used as [glob](https://pkg.go.dev/path/filepath#Glob) pattern to determine whether an
   129  application repository is supported by the plugin or not. 
   130  
   131  ```yaml
   132    discover:
   133      find:
   134        command: [sh, -c, find . -name env.yaml]
   135  ```
   136  
   137  If `discover.fileName` is not provided, the `discover.find.command` is executed in order to determine whether an
   138  application repository is supported by the plugin or not. The `find` command should return a non-error exit code
   139  and produce output to stdout when the application source type is supported.
   140  
   141  #### Place the plugin configuration file in the sidecar
   142  
   143  Argo CD expects the plugin configuration file to be located at `/home/argocd/cmp-server/config/plugin.yaml` in the sidecar.
   144  
   145  If you use a custom image for the sidecar, you can add the file directly to that image.
   146  
   147  ```dockerfile
   148  WORKDIR /home/argocd/cmp-server/config/
   149  COPY plugin.yaml ./
   150  ```
   151  
   152  If you use a stock image for the sidecar or would rather maintain the plugin configuration in a ConfigMap, just nest the
   153  plugin config file in a ConfigMap under the `plugin.yaml` key and mount the ConfigMap in the sidecar (see next section).
   154  
   155  ```yaml
   156  apiVersion: v1
   157  kind: ConfigMap
   158  metadata:
   159    name: my-plugin-config
   160  data:
   161    plugin.yaml: |
   162      apiVersion: argoproj.io/v1alpha1
   163      kind: ConfigManagementPlugin
   164      metadata:
   165        name: my-plugin
   166      spec:
   167        version: v1.0
   168        init:
   169          command: [sh, -c, 'echo "Initializing..."']
   170        generate:
   171          command: [sh, -c, 'echo "{\"kind\": \"ConfigMap\", \"apiVersion\": \"v1\", \"metadata\": { \"name\": \"$ARGOCD_APP_NAME\", \"namespace\": \"$ARGOCD_APP_NAMESPACE\", \"annotations\": {\"Foo\": \"$ARGOCD_ENV_FOO\", \"KubeVersion\": \"$KUBE_VERSION\", \"KubeApiVersion\": \"$KUBE_API_VERSIONS\",\"Bar\": \"baz\"}}}"']
   172        discover:
   173          fileName: "./subdir/s*.yaml"
   174  ```
   175  
   176  #### Register the plugin sidecar
   177  
   178  To install a plugin, patch argocd-repo-server to run the plugin container as a sidecar, with argocd-cmp-server as its 
   179  entrypoint. You can use either off-the-shelf or custom-built plugin image as sidecar image. For example:
   180  
   181  ```yaml
   182  containers:
   183  - name: my-plugin
   184    command: [/var/run/argocd/argocd-cmp-server] # Entrypoint should be Argo CD lightweight CMP server i.e. argocd-cmp-server
   185    image: ubuntu # This can be off-the-shelf or custom-built image
   186    securityContext:
   187      runAsNonRoot: true
   188      runAsUser: 999
   189    volumeMounts:
   190      - mountPath: /var/run/argocd
   191        name: var-files
   192      - mountPath: /home/argocd/cmp-server/plugins
   193        name: plugins
   194      # Remove this volumeMount if you've chosen to bake the config file into the sidecar image.
   195      - mountPath: /home/argocd/cmp-server/config/plugin.yaml
   196        subPath: plugin.yaml
   197        name: my-plugin-config
   198      # Starting with v2.4, do NOT mount the same tmp volume as the repo-server container. The filesystem separation helps 
   199      # mitigate path traversal attacks.
   200      - mountPath: /tmp
   201        name: cmp-tmp
   202  volumes:
   203  - configMap:
   204      name: my-plugin-config
   205    name: my-plugin-config
   206  - emptyDir: {}
   207    name: cmp-tmp
   208  ``` 
   209  
   210  !!! important "Double-check these items"
   211      1. Make sure to use `/var/run/argocd/argocd-cmp-server` as an entrypoint. The `argocd-cmp-server` is a lightweight GRPC service that allows Argo CD to interact with the plugin.
   212      2. Make sure that sidecar container is running as user 999.
   213      3. Make sure that plugin configuration file is present at `/home/argocd/cmp-server/config/plugin.yaml`. It can either be volume mapped via configmap or baked into image.
   214  
   215  ### Using environment variables in your plugin
   216  
   217  Plugin commands have access to
   218  
   219  1. The system environment variables of the sidecar
   220  2. [Standard build environment variables](../user-guide/build-environment.md)
   221  3. Variables in the Application spec (References to system and build variables will get interpolated in the variables' values):
   222  
   223          apiVersion: argoproj.io/v1alpha1
   224          kind: Application
   225          spec:
   226            source:
   227              plugin:
   228                env:
   229                  - name: FOO
   230                    value: bar
   231                  - name: REV
   232                    value: test-$ARGOCD_APP_REVISION
   233      
   234      Before reaching the `init.command`, `generate.command`, and `discover.find.command` commands, Argo CD prefixes all 
   235      user-supplied environment variables (#3 above) with `ARGOCD_ENV_`. This prevents users from directly setting 
   236      potentially-sensitive environment variables.
   237  
   238  4. Parameters in the Application spec:
   239  
   240          apiVersion: argoproj.io/v1alpha1
   241          kind: Application
   242          spec:
   243           source:
   244             plugin:
   245               parameters:
   246                 - name: values-files
   247                   array: [values-dev.yaml]
   248                 - name: helm-parameters
   249                   map:
   250                     image.tag: v1.2.3
   251     
   252      The parameters are available as JSON in the `ARGOCD_APP_PARAMETERS` environment variable. The example above would
   253      produce this JSON:
   254     
   255          [{"name": "values-files", "array": ["values-dev.yaml"]}, {"name": "helm-parameters", "map": {"image.tag": "v1.2.3"}}]
   256     
   257      !!! note
   258          Parameter announcements, even if they specify defaults, are _not_ sent to the plugin in `ARGOCD_APP_PARAMETERS`.
   259          Only parameters explicitly set in the Application spec are sent to the plugin. It is up to the plugin to apply
   260          the same defaults as the ones announced to the UI.
   261     
   262      The same parameters are also available as individual environment variables. The names of the environment variables
   263      follows this convention:
   264     
   265             - name: some-string-param
   266               string: some-string-value
   267             # PARAM_SOME_STRING_PARAM=some-string-value
   268             
   269             - name: some-array-param
   270               value: [item1, item2]
   271             # PARAM_SOME_ARRAY_PARAM_0=item1
   272             # PARAM_SOME_ARRAY_PARAM_1=item2
   273             
   274             - name: some-map-param
   275               map:
   276                 image.tag: v1.2.3
   277             # PARAM_SOME_MAP_PARAM_IMAGE_TAG=v1.2.3
   278     
   279  !!! warning "Sanitize/escape user input" 
   280      As part of Argo CD's manifest generation system, config management plugins are treated with a level of trust. Be
   281      sure to escape user input in your plugin to prevent malicious input from causing unwanted behavior.
   282  
   283  ## Using a config management plugin with an Application
   284  
   285  You may leave the `name` field
   286  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 
   287  it is either `<metadata.name>-<spec.version>` if version is mentioned in the `ConfigManagementPlugin` spec or else just `<metadata.name>`. When name is explicitly 
   288  specified only that particular plugin will be used iff its discovery pattern/command matches the provided application repo.
   289  
   290  ```yaml
   291  apiVersion: argoproj.io/v1alpha1
   292  kind: Application
   293  metadata:
   294    name: guestbook
   295    namespace: argocd
   296  spec:
   297    project: default
   298    source:
   299      repoURL: https://github.com/argoproj/argocd-example-apps.git
   300      targetRevision: HEAD
   301      path: guestbook
   302      plugin:
   303        env:
   304          - name: FOO
   305            value: bar
   306  ```
   307  
   308  If you don't need to set any environment variables, you can set an empty plugin section.
   309  
   310  ```yaml
   311      plugin: {}
   312  ```
   313  
   314  !!! important
   315      If your CMP command runs too long, the command will be killed, and the UI will show an error. The CMP server
   316      respects the timeouts set by the `server.repo.server.timeout.seconds` and `controller.repo.server.timeout.seconds` 
   317      items in `argocd-cm`. Increase their values from the default of 60s.
   318  
   319      Each CMP command will also independently timeout on the `ARGOCD_EXEC_TIMEOUT` set for the CMP sidecar. The default
   320      is 90s. So if you increase the repo server timeout greater than 90s, be sure to set `ARGOCD_EXEC_TIMEOUT` on the
   321      sidecar.
   322      
   323  !!! note
   324      Each Application can only have one config management plugin configured at a time. If you're converting an existing
   325      plugin configured through the `argocd-cm` ConfigMap to a sidecar, make sure to update the plugin name to either `<metadata.name>-<spec.version>` 
   326      if version was mentioned in the `ConfigManagementPlugin` spec or else just use `<metadata.name>`. You can also remove the name altogether 
   327      and let the automatic discovery to identify the plugin.
   328  !!! note
   329      If a CMP renders blank manfiests, and `prune` is set to `true`, Argo CD will automatically remove resources. CMP plugin authors should ensure errors are part of the exit code. Commonly something like `kustomize build . | cat` won't pass errors because of the pipe. Consider setting `set -o pipefail` so anything piped will pass errors on failure.
   330  !!! note
   331      If a CMP command fails to gracefully exit on `ARGOCD_EXEC_TIMEOUT`, it will be forcefully killed after an additional timeout of `ARGOCD_EXEC_FATAL_TIMEOUT`.
   332  
   333  ## Debugging a CMP
   334  
   335  If you are actively developing a sidecar-installed CMP, keep a few things in mind:
   336  
   337  1. If you are mounting plugin.yaml from a ConfigMap, you will have to restart the repo-server Pod so the plugin will
   338     pick up the changes.
   339  2. If you have baked plugin.yaml into your image, you will have to build, push, and force a re-pull of that image on the
   340     repo-server Pod so the plugin will pick up the changes. If you are using `:latest`, the Pod will always pull the new
   341     image. If you're using a different, static tag, set `imagePullPolicy: Always` on the CMP's sidecar container.
   342  3. CMP errors are cached by the repo-server in Redis. Restarting the repo-server Pod will not clear the cache. Always
   343     do a "Hard Refresh" when actively developing a CMP so you have the latest output.
   344  4. Verify your sidecar has started properly by viewing the Pod and seeing that two containers are running `kubectl get pod -l app.kubernetes.io/component=repo-server -n argocd`
   345  5. Write log message to stderr and set the `--loglevel=info` flag in the sidecar. This will print everything written to stderr, even on successful command execution.
   346  
   347  
   348  ### Other Common Errors
   349  | Error Message | Cause |
   350  | -- | -- |
   351  | `no matches for kind "ConfigManagementPlugin" in version "argoproj.io/v1alpha1"` | The `ConfigManagementPlugin` CRD was deprecated in Argo CD 2.4 and removed in 2.8. This error means you've tried to put the configuration for your plugin directly into Kubernetes as a CRD. Refer to this [section of documentation](#write-the-plugin-configuration-file) for how to write the plugin configuration file and place it properly in the sidecar. |
   352  
   353  ## Plugin tar stream exclusions
   354  
   355  In order to increase the speed of manifest generation, certain files and folders can be excluded from being sent to your
   356  plugin. We recommend excluding your `.git` folder if it isn't necessary. Use Go's
   357  [filepatch.Match](https://pkg.go.dev/path/filepath#Match) syntax. For example, `.git/*` to exclude `.git` folder.
   358  
   359  You can set it one of three ways:
   360  
   361  1. The `--plugin-tar-exclude` argument on the repo server.
   362  2. The `reposerver.plugin.tar.exclusions` key if you are using `argocd-cmd-params-cm`
   363  3. Directly setting `ARGOCD_REPO_SERVER_PLUGIN_TAR_EXCLUSIONS` environment variable on the repo server.
   364  
   365  For option 1, the flag can be repeated multiple times. For option 2 and 3, you can specify multiple globs by separating
   366  them with semicolons.
   367  
   368  ## Application manifests generation using argocd.argoproj.io/manifest-generate-paths
   369  
   370  To enhance the application manifests generation process, you can enable the use of the `argocd.argoproj.io/manifest-generate-paths` annotation. When this flag is enabled, the resources specified by this annotation will be passed to the CMP server for generating application manifests, rather than sending the entire repository. This can be particularly useful for monorepos.
   371  
   372  You can set it one of three ways:
   373  
   374  1. The `--plugin-use-manifest-generate-paths` argument on the repo server.
   375  2. The `reposerver.plugin.use.manifest.generate.paths` key if you are using `argocd-cmd-params-cm`
   376  3. Directly setting `ARGOCD_REPO_SERVER_PLUGIN_USE_MANIFEST_GENERATE_PATHS` environment variable on the repo server to `true`.
   377  
   378  ## Migrating from argocd-cm plugins
   379  
   380  Installing plugins by modifying the argocd-cm ConfigMap is deprecated as of v2.4 and has been completely removed starting in v2.8.
   381  
   382  CMP plugins work by adding a sidecar to `argocd-repo-server` along with a configuration in that sidecar located at `/home/argocd/cmp-server/config/plugin.yaml`. A argocd-cm plugin can be easily converted with the following steps.
   383  
   384  ### Convert the ConfigMap entry into a config file
   385  
   386  First, copy the plugin's configuration into its own YAML file. Take for example the following ConfigMap entry:
   387  
   388  ```yaml
   389  data:
   390    configManagementPlugins: |
   391      - name: pluginName
   392        init:                          # Optional command to initialize application source directory
   393          command: ["sample command"]
   394          args: ["sample args"]
   395        generate:                      # Command to generate Kubernetes Objects in either YAML or JSON
   396          command: ["sample command"]
   397          args: ["sample args"]
   398        lockRepo: true                 # Defaults to false. See below.
   399  ```
   400  
   401  The `pluginName` item would be converted to a config file like this:
   402  
   403  ```yaml
   404  apiVersion: argoproj.io/v1alpha1
   405  kind: ConfigManagementPlugin
   406  metadata:
   407    name: pluginName
   408  spec:
   409    init:                          # Optional command to initialize application source directory
   410      command: ["sample command"]
   411      args: ["sample args"]
   412    generate:                      # Command to generate Kubernetes Objects in either YAML or JSON
   413      command: ["sample command"]
   414      args: ["sample args"]
   415  ```
   416  
   417  !!! note
   418      The `lockRepo` key is not relevant for sidecar plugins, because sidecar plugins do not share a single source repo
   419      directory when generating manifests.
   420  
   421  Next, we need to decide how this yaml is going to be added to the sidecar. We can either bake the yaml directly into the image, or we can mount it from a ConfigMap. 
   422  
   423  If using a ConfigMap, our example would look like this:
   424  
   425  ```yaml
   426  apiVersion: v1
   427  kind: ConfigMap
   428  metadata:
   429    name: pluginName
   430    namespace: argocd
   431  data:
   432    pluginName.yaml: |
   433      apiVersion: argoproj.io/v1alpha1
   434      kind: ConfigManagementPlugin
   435      metadata:
   436        name: pluginName
   437      spec:
   438        init:                          # Optional command to initialize application source directory
   439          command: ["sample command"]
   440          args: ["sample args"]
   441        generate:                      # Command to generate Kubernetes Objects in either YAML or JSON
   442          command: ["sample command"]
   443          args: ["sample args"]
   444  ```
   445  
   446  Then this would be mounted in our plugin sidecar.
   447  
   448  ### Write discovery rules for your plugin
   449  
   450  Sidecar plugins can use either discovery rules or a plugin name to match Applications to plugins. If the discovery rule is omitted 
   451  then you have to explicitly specify the plugin by name in the app spec or else that particular plugin will not match any app.
   452  
   453  If you want to use discovery instead of the plugin name to match applications to your plugin, write rules applicable to 
   454  your plugin [using the instructions above](#1-write-the-plugin-configuration-file) and add them to your configuration 
   455  file.
   456  
   457  To use the name instead of discovery, update the name in your application manifest to `<metadata.name>-<spec.version>` 
   458  if version was mentioned in the `ConfigManagementPlugin` spec or else just use `<metadata.name>`. For example:
   459  
   460  ```yaml
   461  apiVersion: argoproj.io/v1alpha1
   462  kind: Application
   463  metadata:
   464    name: guestbook
   465  spec:
   466    source:
   467      plugin:
   468        name: pluginName  # Delete this for auto-discovery (and set `plugin: {}` if `name` was the only value) or use proper sidecar plugin name
   469  ```
   470  
   471  ### Make sure the plugin has access to the tools it needs
   472  
   473  Plugins configured with argocd-cm ran on the Argo CD image. This gave it access to all the tools installed on that
   474  image by default (see the [Dockerfile](https://github.com/argoproj/argo-cd/blob/master/Dockerfile) for base image and
   475  installed tools).
   476  
   477  You can either use a stock image (like ubuntu, busybox, or alpine/k8s) or design your own base image with the tools your plugin needs. For
   478  security, avoid using images with more binaries installed than what your plugin actually needs.
   479  
   480  ### Test the plugin
   481  
   482  After installing the plugin as a sidecar [according to the directions above](#installing-a-config-management-plugin),
   483  test it out on a few Applications before migrating all of them to the sidecar plugin.
   484  
   485  Once tests have checked out, remove the plugin entry from your argocd-cm ConfigMap.
   486  
   487  ### Additional Settings
   488  
   489  #### Preserve repository files mode
   490  
   491  By default, config management plugin receives source repository files with reset file mode. This is done for security
   492  reasons. If you want to preserve original file mode, you can set `preserveFileMode` to `true` in the plugin spec:
   493  
   494  !!! warning
   495      Make sure you trust the plugin you are using. If you set `preserveFileMode` to `true` then the plugin might receive
   496      files with executable permissions which can be a security risk.
   497  
   498  ```yaml
   499  apiVersion: argoproj.io/v1alpha1
   500  kind: ConfigManagementPlugin
   501  metadata:
   502    name: pluginName
   503  spec:
   504    init:
   505      command: ["sample command"]
   506      args: ["sample args"]
   507    generate:
   508      command: ["sample command"]
   509      args: ["sample args"]
   510    preserveFileMode: true
   511  ```
   512  
   513  ##### Provide Git Credentials
   514  
   515  By default, the config management plugin is responsible for providing its own credentials to additional Git repositories
   516  that may need to be accessed during manifest generation. The reposerver has these credentials available in its git creds
   517  store. When credential sharing is allowed, the git credentials used by the reposerver to clone the repository contents
   518  are shared for the lifetime of the execution of the config management plugin, utilizing git's `ASKPASS` method to make a
   519  call from the config management sidecar container to the reposerver to retrieve the initialized git credentials.
   520  
   521  Utilizing `ASKPASS` means that credentials are not proactively shared, but rather only provided when an operation requires
   522  them.
   523  
   524  `ASKPASS` requires a socket to be shared between the config management plugin and the reposerver. To mitigate path traversal
   525  attacks, it's recommended to use a dedicated volume to share the socket, and mount it in the reposerver and sidecar.
   526  To change the socket path, you must set the `ARGOCD_ASK_PASS_SOCK` environment variable for both containers.
   527  
   528  To allow the plugin to access the reposerver git credentials, you can set `provideGitCreds` to `true` in the plugin spec:
   529  
   530  !!! warning
   531      Make sure you trust the plugin you are using. If you set `provideGitCreds` to `true` then the plugin will receive
   532      credentials used to clone the source Git repository.
   533  
   534  ```yaml
   535  apiVersion: argoproj.io/v1alpha1
   536  kind: ConfigManagementPlugin
   537  metadata:
   538    name: pluginName
   539  spec:
   540    init:
   541      command: ["sample command"]
   542      args: ["sample args"]
   543    generate:
   544      command: ["sample command"]
   545      args: ["sample args"]
   546    provideGitCreds: true
   547  ```
   548