diff --git a/.github/workflows/helm-argocd.yaml b/.github/workflows/helm-argocd.yaml new file mode 100644 index 000000000..fed2a840e --- /dev/null +++ b/.github/workflows/helm-argocd.yaml @@ -0,0 +1,45 @@ +name: Helm GitHub Actions for argocd + +on: + pull_request: + paths: + - base-kustomize/argocd/** + - base-helm-configs/argocd/** + - .github/workflows/helm-argocd.yaml +jobs: + helm: + strategy: + matrix: + overlays: + - base + name: Helm + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: azure/setup-helm@v3 + with: + version: latest + token: "${{ secrets.GITHUB_TOKEN }}" + id: helm + - name: Kubectl Install + working-directory: /usr/local/bin/ + run: | + if [ ! -f /usr/local/bin/kubectl ]; then + curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + chmod +x ./kubectl + fi + - name: Run Helm Template + run: | + ${{ steps.helm.outputs.helm-path }} template argocd oci://registry-1.docker.io/bitnamicharts/argo-cd \ + --namespace=argocd \ + --wait \ + --timeout 120m \ + -f ${{ github.workspace }}/base-helm-configs/argocd/helm-argocd-overrides.yaml \ + --post-renderer ${{ github.workspace }}/base-kustomize/kustomize.sh \ + --post-renderer-args argocd/${{ matrix.overlays }} > /tmp/rendered.yaml + - name: Return helm Build + uses: actions/upload-artifact@v4 + with: + name: helm-argocd-artifact-${{ matrix.overlays }} + path: /tmp/rendered.yaml diff --git a/.github/workflows/kustomize-argocd.yaml b/.github/workflows/kustomize-argocd.yaml deleted file mode 100644 index 087b1c773..000000000 --- a/.github/workflows/kustomize-argocd.yaml +++ /dev/null @@ -1,37 +0,0 @@ -name: Kustomize GitHub Actions for argocd - -on: - pull_request: - paths: - - base-kustomize/argocd/** - - .github/workflows/kustomize-argocd.yaml -jobs: - kustomize: - strategy: - matrix: - overlays: - - base - name: Kustomize - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - uses: azure/setup-helm@v3 - with: - version: latest - token: "${{ secrets.GITHUB_TOKEN }}" - id: helm - - name: Kustomize Install - working-directory: /usr/local/bin/ - run: | - if [ ! -f /usr/local/bin/kustomize ]; then - curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | sudo bash - fi - - name: Run Kustomize Build - run: | - kustomize build base-kustomize/argocd/${{ matrix.overlays }} --enable-helm --helm-command ${{ steps.helm.outputs.helm-path }} > /tmp/rendered.yaml - - name: Return Kustomize Build - uses: actions/upload-artifact@v4 - with: - name: kustomize-argocd-artifact-${{ matrix.overlays }} - path: /tmp/rendered.yaml diff --git a/base-helm-configs/argocd/helm-argocd-overrides.yaml b/base-helm-configs/argocd/helm-argocd-overrides.yaml new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/base-helm-configs/argocd/helm-argocd-overrides.yaml @@ -0,0 +1 @@ +--- diff --git a/base-kustomize/argocd/base/kustomization.yaml b/base-kustomize/argocd/base/kustomization.yaml index 38a691025..5e77734ae 100644 --- a/base-kustomize/argocd/base/kustomization.yaml +++ b/base-kustomize/argocd/base/kustomization.yaml @@ -3,22 +3,4 @@ sortOptions: resources: - namespace.yaml -namespace: argocd1 -helmGlobals: - chartHome: ../charts/ -helmCharts: -- name: argo-cd - includeCRDs: true - valuesFile: values.yaml - releaseName: argocd - version: 5.51.5 - repo: https://argoproj.github.io/argo-helm -patches: -- target: - kind: Pod - patch: |- - $patch: delete - apiVersion: v1 - kind: Pod - metadata: - name: argocd-redis-ha-service-test +namespace: argocd diff --git a/base-kustomize/argocd/base/values.yaml b/base-kustomize/argocd/base/values.yaml deleted file mode 100644 index 6f11c07d9..000000000 --- a/base-kustomize/argocd/base/values.yaml +++ /dev/null @@ -1,39 +0,0 @@ -global: - nodeSelector: - openstack-control-plane: enabled - -redis-ha: - enabled: true - nodeSelector: - openstack-control-plane: enabled - -controller: - replicas: 1 - -configs: - cm: - kustomize.buildOptions: --enable-helm - -server: - autoscaling: - enabled: true - minReplicas: 2 - ingress: - annotations: - nginx.ingress.kubernetes.io/backend-protocol: HTTPS - enabled: false - ingressClassName: "nginx-cluster" - hosts: ["argocd.your.domain.tld"] - tls: - - hosts: - - argocd.your.domain.tld - secretName: argocd-tls-public - https: true - -repoServer: - autoscaling: - enabled: true - minReplicas: 2 - -applicationSet: - replicas: 2 diff --git a/bin/install-argocd.sh b/bin/install-argocd.sh new file mode 100644 index 000000000..e2da12ff7 --- /dev/null +++ b/bin/install-argocd.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# Default parameter value +TARGET=${1:-base} + +# Directory to check for YAML files +CONFIG_DIR="/etc/genestack/helm-configs/argocd" + +# Helm command setup +HELM_CMD="helm upgrade --install argocd oci://registry-1.docker.io/bitnamicharts/argo-cd \ + --namespace=argocd \ + --timeout 120m \ + --post-renderer /etc/genestack/kustomize/kustomize.sh \ + --post-renderer-args argocd/${TARGET} \ + -f /opt/genestack/base-helm-configs/argocd/argocd-helm-overrides.yaml" + +# Check if YAML files exist in the specified directory +if compgen -G "${CONFIG_DIR}/*.yaml" > /dev/null; then + # Add all YAML files from the directory to the helm command + for yaml_file in "${CONFIG_DIR}"/*.yaml; do + HELM_CMD+=" -f ${yaml_file}" + done +fi + +# Run the helm command +echo "Executing Helm command:" +echo "${HELM_CMD}" +eval "${HELM_CMD}" diff --git a/docs/infrastructure-argocd.md b/docs/infrastructure-argocd.md new file mode 100644 index 000000000..e46e7255a --- /dev/null +++ b/docs/infrastructure-argocd.md @@ -0,0 +1,16 @@ +# Deploy a argocd + +## Install Argocd + +!!! example "Run the argocd deployment Script `bin/install-argocd.sh`" + + ``` shell + --8<-- "bin/install-argocd.sh" + ``` + + +## Verify readiness with the following command. + +``` shell +kubectl --namespace argocd get horizontalpodautoscaler.autoscaling argocd -w +```