From 59e264f369ec65832c396f2bb393a169fd05f5a6 Mon Sep 17 00:00:00 2001 From: ilia-medvedev-codefresh Date: Wed, 11 Jan 2023 15:18:45 +0200 Subject: [PATCH] Init argo workflows (#3) * codefresh initial * add gh * add docs * enable crds on install test * enable crds on install test * enable crds on install test --- .github/workflows/lint-and-test.yml | 90 +++++++++++++------ charts/argo-workflows/Chart.yaml | 4 +- charts/argo-workflows/README.md | 12 +-- charts/argo-workflows/ci/default-values.yaml | 1 + .../ci/enable-ingress-values.yaml | 1 + .../ci/enable-metrics-values.yaml | 1 + .../argo-workflows/ci/enable-rbac-values.yaml | 1 + charts/argo-workflows/values.yaml | 25 ++++-- 8 files changed, 89 insertions(+), 46 deletions(-) diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index b8aa138e..19f80aa1 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -1,16 +1,12 @@ -name: Chart Publish -on: - push: - branches: - - argo-workflows +name: Linting and Testing + +on: pull_request permissions: contents: read jobs: - publish: - permissions: - contents: write # for helm/chart-releaser-action to push chart release and create a release + chart-test: runs-on: ubuntu-latest steps: - name: Checkout @@ -18,28 +14,64 @@ jobs: with: fetch-depth: 0 - - name: Install Helm + - name: Set up Helm uses: azure/setup-helm@v3 with: - version: v3.10.1 # Also update in lint-and-test.yaml + version: v3.10.1 # Also update in publish.yaml - - name: Add dependency chart repos - run: | - helm repo add dandydeveloper https://dandydeveloper.github.io/charts/ - - name: Configure Git - run: | - git config user.name "$GITHUB_ACTOR" - git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - - name: Package chart - run: | - rm -rf .cr-release-packages - mkdir .cr-release-packages - helm package charts/argo-workflows -u -d .cr-release-packages/ - - - name: Run chart-releaser - uses: helm/chart-releaser-action@main + - name: Set up python + uses: actions/setup-python@v4 with: - config: "./.github/configs/cr.yaml" - skip_packaging: true - env: - CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file + python-version: 3.9 + + - name: Setup Chart Linting + id: lint + uses: helm/chart-testing-action@v2.3.0 + with: + # Note: Also update in scripts/lint.sh + version: v3.7.0 + + - name: List changed charts + id: list-changed + run: | + ## If executed with debug this won't work anymore. + changed=$(ct --config ./.github/configs/ct-lint.yaml --target-branch ${{ github.base_ref }} list-changed) + charts=$(echo "$changed" | tr '\n' ' ' | xargs) + if [[ -n "$changed" ]]; then + echo "::set-output name=changed::true" + echo "::set-output name=changed_charts::$charts" + fi + - name: Run chart-testing (lint) + run: ct lint --debug --config ./.github/configs/ct-lint.yaml --target-branch ${{ github.base_ref }} --lint-conf ./.github/configs/lintconf.yaml + + - name: Run docs-testing (helm-docs) + id: helm-docs + run: | + ./scripts/helm-docs.sh + if [[ $(git diff --stat) != '' ]]; then + echo -e '\033[0;31mDocumentation outdated!\033[0m ❌' + git diff --color + exit 1 + else + echo -e '\033[0;32mDocumentation up to date\033[0m ✔' + fi + - name: Create kind cluster + uses: helm/kind-action@v1.4.0 + if: steps.list-changed.outputs.changed == 'true' + with: + config: .github/configs/kind-config.yaml + + - name: Skip HPA tests of ArgoCD + if: contains(steps.list-changed.outputs.changed_charts, 'argo-cd') + run: | + ## Metrics API not available in kind cluster + rm charts/argo-cd/ci/ha-autoscaling-values.yaml + - name: Create an external redis for ArgoCD externalRedis feature + if: contains(steps.list-changed.outputs.changed_charts, 'argo-cd') + run: | + kubectl create namespace redis + helm repo add bitnami https://charts.bitnami.com/bitnami + helm install redis bitnami/redis --wait --namespace redis --set auth.password=argocd --set architecture=standalone + - name: Run chart-testing (install) + run: ct install --config ./.github/configs/ct-install.yaml --target-branch ${{ github.base_ref }} + if: steps.list-changed.outputs.changed == 'true' \ No newline at end of file diff --git a/charts/argo-workflows/Chart.yaml b/charts/argo-workflows/Chart.yaml index ad878b85..1fa4b672 100644 --- a/charts/argo-workflows/Chart.yaml +++ b/charts/argo-workflows/Chart.yaml @@ -1,9 +1,9 @@ apiVersion: v2 -appVersion: v3.4.4 +appVersion: v3.4-cap-CR-15902 name: argo-workflows description: A Helm chart for Argo Workflows type: application -version: 0.22.8-0-cf-init +version: 0.22.8-1-cf-init icon: https://raw.githubusercontent.com/argoproj/argo-workflows/master/docs/assets/argo.png home: https://github.com/argoproj/argo-helm sources: diff --git a/charts/argo-workflows/README.md b/charts/argo-workflows/README.md index 19bc0ee2..6c775f23 100644 --- a/charts/argo-workflows/README.md +++ b/charts/argo-workflows/README.md @@ -46,7 +46,7 @@ Fields to note: | Key | Type | Default | Description | |-----|------|---------|-------------| | crds.annotations | object | `{}` | Annotations to be added to all CRDs | -| crds.install | bool | `true` | Install and upgrade CRDs | +| crds.install | bool | `false` | Install and upgrade CRDs | | crds.keep | bool | `true` | Keep CRDs on chart uninstall | | createAggregateRoles | bool | `true` | Create clusterroles that extend existing clusterroles to interact with argo-cd crds | | emissary.images | list | `[]` | The command/args for each image on workflow, needed when the command is not specified and the emissary executor is used. | @@ -81,7 +81,7 @@ Fields to note: | controller.extraContainers | list | `[]` | Extra containers to be added to the controller deployment | | controller.extraEnv | list | `[]` | Extra environment variables to provide to the controller container | | controller.image.registry | string | `"quay.io"` | Registry to use for the controller | -| controller.image.repository | string | `"argoproj/workflow-controller"` | Registry to use for the controller | +| controller.image.repository | string | `"codefresh/workflow-controller"` | Registry to use for the controller | | controller.image.tag | string | `""` | Image tag for the workflow controller. Defaults to `.Values.images.tag`. | | controller.initialDelay | string | `nil` | Resolves ongoing, uncommon AWS EKS bug: https://github.com/argoproj/argo-workflows/pull/4224 | | controller.instanceID.enabled | bool | `false` | Configures the controller to filter workflow submissions to only those which have a matching instanceID attribute. | @@ -145,7 +145,7 @@ Fields to note: | controller.topologySpreadConstraints | list | `[]` | Assign custom [TopologySpreadConstraints] rules to the workflow controller | | controller.volumeMounts | list | `[]` | Additional volume mounts to the controller main container | | controller.volumes | list | `[]` | Additional volumes to the controller pod | -| controller.workflowDefaults | object | `{}` | Default values that will apply to all Workflows from this controller, unless overridden on the Workflow-level. Only valid for 2.7+ | +| controller.workflowDefaults | object | `{"spec":{"podGC":{"labelSelector":{"matchLabels":{"should-be-deleted":"true"}},"strategy":"OnWorkflowCompletion"},"ttlStrategy":{"secondsAfterCompletion":86400,"secondsAfterFailure":86400,"secondsAfterSuccess":86400}}}` | Default values that will apply to all Workflows from this controller, unless overridden on the Workflow-level. Only valid for 2.7+ | | controller.workflowNamespaces | list | `["default"]` | Specify all namespaces where this workflow controller instance will manage workflows. This controls where the service account and RBAC resources will be created. Only valid when singleNamespace is false. | | controller.workflowRestrictions | object | `{}` | Restricts the Workflows that the controller will process. Only valid for 2.9+ | | controller.workflowWorkers | string | `nil` | Number of workflow workers | @@ -167,7 +167,7 @@ Fields to note: | executor.env | list | `[]` | Adds environment variables for the executor. | | executor.image.pullPolicy | string | `""` | Image PullPolicy to use for the Workflow Executors. Defaults to `.Values.images.pullPolicy`. | | executor.image.registry | string | `"quay.io"` | Registry to use for the Workflow Executors | -| executor.image.repository | string | `"argoproj/argoexec"` | Repository to use for the Workflow Executors | +| executor.image.repository | string | `"codefresh/argoexec"` | Repository to use for the Workflow Executors | | executor.image.tag | string | `""` | Image tag for the workflow executor. Defaults to `.Values.images.tag`. | | executor.resources | object | `{}` | Resource limits and requests for the Workflow Executors | | executor.securityContext | object | `{}` | sets security context for the executor container | @@ -182,11 +182,11 @@ Fields to note: | server.clusterWorkflowTemplates.enabled | bool | `true` | Create a ClusterRole and CRB for the server to access ClusterWorkflowTemplates. | | server.deploymentAnnotations | object | `{}` | optional map of annotations to be applied to the ui Deployment | | server.enabled | bool | `true` | Deploy the Argo Server | -| server.extraArgs | list | `[]` | Extra arguments to provide to the Argo server binary, such as for disabling authentication. | +| server.extraArgs | list | `["--auth-mode=server"]` | Extra arguments to provide to the Argo server binary, such as for disabling authentication. | | server.extraContainers | list | `[]` | Extra containers to be added to the server deployment | | server.extraEnv | list | `[]` | Extra environment variables to provide to the argo-server container | | server.image.registry | string | `"quay.io"` | Registry to use for the server | -| server.image.repository | string | `"argoproj/argocli"` | Repository to use for the server | +| server.image.repository | string | `"codefresh/argocli"` | Repository to use for the server | | server.image.tag | string | `""` | Image tag for the Argo Workflows server. Defaults to `.Values.images.tag`. | | server.ingress.annotations | object | `{}` | Additional ingress annotations | | server.ingress.enabled | bool | `false` | Enable an ingress resource | diff --git a/charts/argo-workflows/ci/default-values.yaml b/charts/argo-workflows/ci/default-values.yaml index ffc41c8a..481dcf4e 100644 --- a/charts/argo-workflows/ci/default-values.yaml +++ b/charts/argo-workflows/ci/default-values.yaml @@ -1,3 +1,4 @@ # Test with default values crds: + install: true keep: false diff --git a/charts/argo-workflows/ci/enable-ingress-values.yaml b/charts/argo-workflows/ci/enable-ingress-values.yaml index 05dae886..61dc936f 100644 --- a/charts/argo-workflows/ci/enable-ingress-values.yaml +++ b/charts/argo-workflows/ci/enable-ingress-values.yaml @@ -1,4 +1,5 @@ crds: + install: true keep: false server: diff --git a/charts/argo-workflows/ci/enable-metrics-values.yaml b/charts/argo-workflows/ci/enable-metrics-values.yaml index 32c007be..d3f82575 100644 --- a/charts/argo-workflows/ci/enable-metrics-values.yaml +++ b/charts/argo-workflows/ci/enable-metrics-values.yaml @@ -1,4 +1,5 @@ crds: + install: true keep: false controller: diff --git a/charts/argo-workflows/ci/enable-rbac-values.yaml b/charts/argo-workflows/ci/enable-rbac-values.yaml index 70924084..61b5754a 100644 --- a/charts/argo-workflows/ci/enable-rbac-values.yaml +++ b/charts/argo-workflows/ci/enable-rbac-values.yaml @@ -1,4 +1,5 @@ crds: + install: true keep: false workflow: diff --git a/charts/argo-workflows/values.yaml b/charts/argo-workflows/values.yaml index bb102c8b..e72e0873 100644 --- a/charts/argo-workflows/values.yaml +++ b/charts/argo-workflows/values.yaml @@ -10,7 +10,7 @@ images: ## Custom resource configuration crds: # -- Install and upgrade CRDs - install: true + install: false # -- Keep CRDs on chart uninstall keep: true # -- Annotations to be added to all CRDs @@ -57,7 +57,7 @@ controller: # -- Registry to use for the controller registry: quay.io # -- Registry to use for the controller - repository: argoproj/workflow-controller + repository: codefresh/workflow-controller # -- Image tag for the workflow controller. Defaults to `.Values.images.tag`. tag: "" # -- parallelism dictates how many workflows can be running at the same time @@ -140,10 +140,17 @@ controller: # -- Default values that will apply to all Workflows from this controller, unless overridden on the Workflow-level. # Only valid for 2.7+ ## See more: https://argoproj.github.io/argo-workflows/default-workflow-specs/ - workflowDefaults: {} - # spec: - # ttlStrategy: - # secondsAfterCompletion: 84600 + workflowDefaults: + spec: + ttlStrategy: + secondsAfterCompletion: 86400 + secondsAfterSuccess: 86400 + secondsAfterFailure: 86400 + podGC: + strategy: OnWorkflowCompletion + labelSelector: + matchLabels: + should-be-deleted: "true" # -- Number of workflow workers workflowWorkers: # 32 @@ -343,7 +350,7 @@ executor: # -- Registry to use for the Workflow Executors registry: quay.io # -- Repository to use for the Workflow Executors - repository: argoproj/argoexec + repository: codefresh/argoexec # -- Image tag for the workflow executor. Defaults to `.Values.images.tag`. tag: "" # -- Image PullPolicy to use for the Workflow Executors. Defaults to `.Values.images.pullPolicy`. @@ -367,7 +374,7 @@ server: # -- Registry to use for the server registry: quay.io # -- Repository to use for the server - repository: argoproj/argocli + repository: codefresh/argocli # -- Image tag for the Argo Workflows server. Defaults to `.Values.images.tag`. tag: "" # -- optional map of annotations to be applied to the ui Deployment @@ -461,7 +468,7 @@ server: # value: "bar" # -- Extra arguments to provide to the Argo server binary, such as for disabling authentication. - extraArgs: [] + extraArgs: ['--auth-mode=server'] # If you want to disable authentication for purposes such as: # - local dev-mode without authentication # - gateway authentication through some other service such as KeyCloak