Giter VIP home page Giter VIP logo

argocd-executor-plugin's Introduction

Argo CD Executor Plugin

codecov

An Executor Plugin for Argo Workflows that lets you interact with Argo CD servers. All you need is an Argo CD API token.

Example

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: argocd-example-
spec:
  entrypoint: main
  templates:
  - name: main
    steps:
    - - name: sync
        template: sync
        arguments:
          parameters:
            - name: apps
              value: |
                - name: guestbook-frontend
                - name: guestbook-backend
    - - name: diff
        template: diff
  - name: sync
    inputs:
      parameters:
        - name: apps
    plugin:
      argocd:
        app:
          sync:
            apps: "{{inputs.parameters.apps}}"
  - name: diff
    plugin:
      argocd:
        app:
          diff:
            app:
              name: guestbook-frontend

Getting Started

Step 1: Get an Argo CD token

The plugin requires a secret named argocd-token with a key called token containing the Argo CD token. See the Argo CD documentation for information about generating tokens.

apiVersion: v1
kind: Secret
metadata:
  name: argocd-token
stringData:
  token: <token>

After defining the secret, apply it to your cluster:

kubectl apply -f argocd-token.yaml

Step 2: Install the plugin

kubectl apply -n argo -f https://raw.githubusercontent.com/crenshaw-dev/argocd-executor-plugin/main/manifests/argocd-executor-plugin-configmap.yaml

Note: You will have to run the workflow using a service account with appropriate permissions. See examples/rbac.yaml for an example.

Step 3: Set your ARGOCD_SERVER environment variable

By default, the plugin uses argocd-server.argocd.svc.cluster.local for ARGOCD_SERVER. If you're using a different server, you can set the ARGOCD_SERVER environment variable in the plugin's configmap.

Step 4: Run a workflow

argo submit examples/argocd.yaml --serviceaccount my-service-account --watch

Examples

The actions field of the plugin config accepts a nested list of actions. Parent lists are executed sequentially, and child lists are executed in parallel. This allows you to run multiple actions in parallel, and multiple groups of actions in sequence.

Setting sync options

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: argocd-options-example-
spec:
  entrypoint: main
  templates:
  - name: main
    plugin:
      argocd:
        app:
          sync:
            apps: |
              - name: guestbook-backend
            options: |
              - ServerSideApply=true
              - Validate=true

Setting a timeout

Each sync action may be configured with a timeout. The default is no timeout.

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: argocd-timeout-example-
spec:
  entrypoint: main
  templates:
  - name: main
    plugin:
      argocd:
        app:
          sync:
            apps: |
              - name: guestbook-backend
            options: |
              - ServerSideApply=true
              - Validate=true
        timeout: 30s

Specifying the Application's namespace

Starting in Argo CD v2.5, Applications may be installed outside the argocd namespace (or whichever namespace Argo CD installed in). To specify the namespace, use the namespace field.

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: argocd-namespace-example-
spec:
  entrypoint: main
  templates:
  - name: main
    plugin:
      argocd:
        app:
          sync:
            apps: |
              - name: guestbook-backend
                namespace: my-apps-namespace

Contributing

Head to the scripts directory to find out how to get the project up and running on your local machine for development and testing purposes.

argocd-executor-plugin's People

Contributors

crenshaw-dev avatar dependabot[bot] avatar urielcohen456 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

jygastaud

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.