diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 456117f..76e965a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -64,6 +64,17 @@ jobs: push: true tags: | quay.io/acend/argocd-basics-training:pr-${{ github.event.pull_request.number }}-puzzle + - + name: Build Centris Version + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + build-args: | + TRAINING_HUGO_ENV=centris + push: true + tags: | + quay.io/acend/argocd-basics-training:pr-${{ github.event.pull_request.number }}-centris - name: 'Install Helm' uses: azure/setup-helm@v4 @@ -99,6 +110,7 @@ jobs: kubectl rollout restart deployment/${TRAINING_HELM_RELEASE}-${TRAINING_HELM_NAME}-acend --kubeconfig $HOME/.kube/config --namespace $TRAINING_NAMESPACE kubectl rollout restart deployment/${TRAINING_HELM_RELEASE}-${TRAINING_HELM_NAME}-techlab --kubeconfig $HOME/.kube/config --namespace $TRAINING_NAMESPACE kubectl rollout restart deployment/${TRAINING_HELM_RELEASE}-${TRAINING_HELM_NAME}-puzzle --kubeconfig $HOME/.kube/config --namespace $TRAINING_NAMESPACE + kubectl rollout restart deployment/${TRAINING_HELM_RELEASE}-${TRAINING_HELM_NAME}-centris --kubeconfig $HOME/.kube/config --namespace $TRAINING_NAMESPACE - name: Comment PR Environments in PR uses: marocchino/sticky-pull-request-comment@v2 @@ -109,3 +121,4 @@ jobs: * acend version * techlab version * puzzle version + * centris version diff --git a/.github/workflows/pr-cleanup.yaml b/.github/workflows/pr-cleanup.yaml index 098406a..3a1fbb3 100644 --- a/.github/workflows/pr-cleanup.yaml +++ b/.github/workflows/pr-cleanup.yaml @@ -45,4 +45,4 @@ jobs: QUAYIO_API_TOKEN: '${{ secrets.QUAYIO_API_TOKEN }}' REPOSITORY: '${{ github.repository }}' run: | - curl -X DELETE -H "Authorization: Bearer ${QUAYIO_API_TOKEN}" https://quay.io/api/v1/repository/${REPOSITORY}/tag/pr-${PR_NUMBER}{,-techlab,-puzzle} + curl -X DELETE -H "Authorization: Bearer ${QUAYIO_API_TOKEN}" https://quay.io/api/v1/repository/${REPOSITORY}/tag/pr-${PR_NUMBER}{,-techlab,-puzzle,-centris} diff --git a/.github/workflows/push-main.yaml b/.github/workflows/push-main.yaml index 70d96b5..a355404 100644 --- a/.github/workflows/push-main.yaml +++ b/.github/workflows/push-main.yaml @@ -66,6 +66,17 @@ jobs: push: true tags: | quay.io/acend/argocd-basics-training:latest-puzzle + - + name: Build Centris Version + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + build-args: | + TRAINING_HUGO_ENV=centris + push: true + tags: | + quay.io/acend/argocd-basics-training:latest-centris - name: 'Install Helm' uses: azure/setup-helm@v4 @@ -101,3 +112,4 @@ jobs: kubectl rollout restart deployment/${TRAINING_HELM_RELEASE}-${TRAINING_HELM_NAME}-acend --kubeconfig $HOME/.kube/config --namespace $TRAINING_NAMESPACE kubectl rollout restart deployment/${TRAINING_HELM_RELEASE}-${TRAINING_HELM_NAME}-techlab --kubeconfig $HOME/.kube/config --namespace $TRAINING_NAMESPACE kubectl rollout restart deployment/${TRAINING_HELM_RELEASE}-${TRAINING_HELM_NAME}-puzzle --kubeconfig $HOME/.kube/config --namespace $TRAINING_NAMESPACE + kubectl rollout restart deployment/${TRAINING_HELM_RELEASE}-${TRAINING_HELM_NAME}-centris --kubeconfig $HOME/.kube/config --namespace $TRAINING_NAMESPACE diff --git a/.husky/pre-commit b/.husky/pre-commit index 373d4e4..fb1c98e 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - npm run mdlint diff --git a/Dockerfile b/Dockerfile index 9ae1743..c61ecc9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM docker.io/floryn90/hugo:0.143.1-ext-ubuntu AS builder +FROM docker.io/floryn90/hugo:0.159.1-ext-ubuntu AS builder ARG TRAINING_HUGO_ENV=default USER root diff --git a/config/_default/config.toml b/config/_default/config.toml index 6ea4bdc..8f15db2 100644 --- a/config/_default/config.toml +++ b/config/_default/config.toml @@ -67,12 +67,13 @@ url = "https://www.acend.ch" guessSyntax = "true" [params] +automaticSectionNumbers = true copyright = "acend gmbh" github_repo = "https://github.com/acend/argocd-basics-training" github_branch = "main" -enabledModule = "base" +enabledModule = "base getting-started simple-example resource-hooks sync-phases-and-waves tools helm kustomize jsonnet multiple-applications app-of-apps application-sets projects controlling-deployment-workflows sync-windows tracking-and-deployment-strategies additional-concepts backup-and-restore orphaned-resources" argoCdUrl = "argocd.training.cluster.acend.ch" giteaUrl = "gitea.training.cluster.acend.ch" appDomain= "training.cluster.acend.ch" diff --git a/config/centris/config.toml b/config/centris/config.toml new file mode 100644 index 0000000..44d7ca9 --- /dev/null +++ b/config/centris/config.toml @@ -0,0 +1,21 @@ + +[Languages] +[Languages.en] +title = "ArgoCD Training" +languageName = "English" +weight = 1 + + +[params] +enabledModule = "base centris manual-fork no-argocd-cli openshift getting-started simple-example resource-hooks sync-phases-and-waves tools helm kustomize multiple-applications app-of-apps application-sets projects controlling-deployment-workflows sync-windows tracking-and-deployment-strategies additional-concepts backup-and-restore orphaned-resources" + +cliToolName = "oc" +distroName = "OpenShift" +argoInfraNamespace = "openshift-gitops" + +github_repo = "https://github.com/acend/argocd-basics-training" +github_branch = "main" + +argoCdUrl = "argocd.training.cluster.acend.ch" +giteaUrl = "gitea.training.cluster.acend.ch" +appDomain= "training.cluster.acend.ch" diff --git a/config/puzzle/config.toml b/config/puzzle/config.toml index be3c24e..0353f26 100644 --- a/config/puzzle/config.toml +++ b/config/puzzle/config.toml @@ -21,7 +21,7 @@ imagePrefix = "puzzle_" distroName = "Rancher" cliToolName = "kubectl" -enabledModule = "base rancher" +enabledModule = "base rancher getting-started simple-example resource-hooks sync-phases-and-waves tools helm kustomize jsonnet multiple-applications app-of-apps application-sets projects controlling-deployment-workflows sync-windows tracking-and-deployment-strategies additional-concepts backup-and-restore orphaned-resources" [[Languages.en.menu.main]] copyright = "Puzzle ITC GmbH" diff --git a/config/techlab/config.toml b/config/techlab/config.toml index 491116c..815b2d6 100644 --- a/config/techlab/config.toml +++ b/config/techlab/config.toml @@ -7,6 +7,6 @@ weight = 1 [params] -enabledModule = "base techlab" +enabledModule = "base techlab getting-started simple-example resource-hooks sync-phases-and-waves tools helm kustomize jsonnet" github_repo = "" github_branch = "" diff --git a/content/en/docs/01/_index.md b/content/en/docs/01/_index.md index 678ecf7..42ba4e1 100644 --- a/content/en/docs/01/_index.md +++ b/content/en/docs/01/_index.md @@ -1,15 +1,15 @@ --- -title: "1. Getting started" +title: "Getting started" weight: 1 -sectionnumber: 1 +onlyWhen: getting-started --- -## Task {{% param sectionnumber %}}.1: Web IDE +## {{% task %}} Web IDE The first thing we're going to do is to explore our lab environment and get in touch with the different components. -The namespace with the name corresponding to your username is going to be used for all the hands-on labs. And you will be using the `argocd tool` or the ArgoCD webconsole, to verify what resources and objects Argo CD created for you. +The namespace with the name corresponding to your username is going to be used for all the hands-on labs. And you will be using {{% onlyWhenNot no-argocd-cli %}} the `argocd tool` or {{% /onlyWhenNot %}} the ArgoCD webconsole, to verify what resources and objects Argo CD created for you. {{% alert title="Note" color="info" %}}You can also use your local installation of the cli tools. Make sure you completed [the setup](../../setup/) before you continue with this lab.{{% /alert %}} @@ -37,28 +37,34 @@ The Web IDE Pod consists of the following tools: The files in the home directory under `/home/project` are stored in a persistence volume, so please make sure to store all your persistence data in this directory. -### Task {{% param sectionnumber %}}.1.1: Local Workspace Directory +### Task 1.1.1: Local Workspace Directory During the lab, you’ll be using local files (eg. YAML resources) which will be applied in your lab project. -Create a new folder for your `` in your Web IDE (for example `argocd-training` under `/home/project/argocd-training`). Either you can create it with `right-mouse-click -> New Folder` or in the Web IDE terminal +Create a new folder for your `` in your Web IDE (for example `argocd-training` under `/home/project/argocd-training`). Either you can create it with `right-mouse-click -> New Folder` or in the Web IDE terminal. ```bash mkdir argocd-training && cd argocd-training ``` -### Task {{% param sectionnumber %}}.1.2: Login on ArgoCD using argocd CLI +### Task 1.1.2: Login to ArgoCD +{{% onlyWhenNot no-argocd-cli %}} You can access Argo CD via Web UI (Credentials are provided by your teacher) or using the CLI. The Argo CD CLI Tool is already installed on the web IDE. ```bash argocd login {{% param argoCdUrl %}} --grpc-web --username $USER ``` +{{% /onlyWhenNot %}} + +{{% onlyWhen no-argocd-cli %}} +You can access Argo CD via the Web UI. Open your browser and navigate to [https://{{% param argoCdUrl %}}](https://{{% param argoCdUrl %}}) and login with the credentials provided by your trainer. +{{% /onlyWhen %}} {{% onlyWhen openshift %}} -### Task {{% param sectionnumber %}}.1.3: Lab Setup +### Task 1.1.3: Lab Setup Most of the labs will be done inside the {{% param distroName %}} project with your username. Verify that your oc tool is configured to point to the right project: @@ -77,12 +83,15 @@ The returned project name should correspond to your username. {{% /onlyWhen %}} -## Task {{% param sectionnumber %}}.2: Argo CD CLI +{{% onlyWhenNot no-argocd-cli %}} + + +## {{% task %}} Argo CD CLI The [Argo CD CLI](https://argoproj.github.io/argo-cd/cli_installation/) is a powerful tool to manage Argo CD and different applications. It's a self contained binary written in Go and available for Linux, Mac OS and Windows. Thanks to the fact that the CLI is implemented in Go, it can be easily integrated into scripts and build servers for automation purposes. -### Task {{% param sectionnumber %}}.2: Getting familiar with the CLI +### Task 1.2.1: Getting familiar with the CLI Print out the help of the CLI by typing @@ -147,7 +156,7 @@ argocd app create --help ``` -### Task {{% param sectionnumber %}}.2: Autocompletion +### Task 1.2.2: Autocompletion {{% alert title="Note" color="info" %}}This step is only needed, when you're not working with the Web IDE we've provided. The autocompletion is already installed in the Web IDE{{% /alert %}} @@ -167,3 +176,5 @@ source ~/.bashrc ``` Find further information in the [official documentation](https://argoproj.github.io/argo-cd/user-guide/commands/argocd_completion/) + +{{% /onlyWhenNot %}} diff --git a/content/en/docs/02/_index.md b/content/en/docs/02/_index.md index 312b8be..501c7c4 100644 --- a/content/en/docs/02/_index.md +++ b/content/en/docs/02/_index.md @@ -1,7 +1,7 @@ --- -title: "2. Simple Example" +title: "Simple Example" weight: 2 -sectionnumber: 2 +onlyWhen: simple-example --- In this lab you will learn how to deploy a simple application using Argo CD. @@ -10,17 +10,16 @@ Our lab setup consists of the following components: * Git Server ([Gitea](https://gitea.io)): [https://{{% param giteaUrl %}}](https://{{% param giteaUrl %}}/) * Argo CD Server: [https://{{% param argoCdUrl %}}](https://{{% param argoCdUrl %}}) -* Kubernetes Cluster +* {{% onlyWhenNot openshift %}}Kubernetes Cluster{{% /onlyWhenNot %}}{{% onlyWhen openshift %}}OpenShift Cluster{{% /onlyWhen %}} -{{% onlyWhenNot manualFork %}} +## {{% task %}} {{% onlyWhenNot manual-fork %}}Login to the Gitea and Clone the Repo{{% /onlyWhenNot %}}{{% onlyWhen manual-fork %}}Fork the Git repository{{% /onlyWhen %}} +{{% onlyWhenNot manual-fork %}} -## Task {{% param sectionnumber %}}.1: Login to the Gitea and Clone the Repo +For this training we're using a Git Server deployed under [https://{{% param giteaUrl %}}](https://{{% param giteaUrl %}}/). We also forked the Argo CD Example Repo for your ``. -For this Training we've installed a Git Server under [https://{{% param giteaUrl %}}](https://{{% param giteaUrl %}}/). We also forked the Argo CD Example Repo for your ``. - -Open your Webbrowser and navigate to [https://{{% param giteaUrl %}}](https://{{% param giteaUrl %}}/). +Open your webbrowser and navigate to [https://{{% param giteaUrl %}}](https://{{% param giteaUrl %}}/). Login with the training credentials provided by the trainer (Login Button is in the upper right corner). {{% alert title="Note" color="info" %}}Users which have a personal Github account can just fork the Repository [argocd-training-examples](https://github.com/acend/argocd-training-examples) to their personal account. To fork the repository click on the top right of the Github on _Fork_.{{% /alert %}} @@ -28,10 +27,7 @@ Login with the training credentials provided by the trainer (Login Button is in {{% /onlyWhenNot %}} -{{% onlyWhen manualFork %}} - - -## Task {{% param sectionnumber %}}.1: Fork the Git repository +{{% onlyWhen manual-fork %}} As we are proceeding according to the GitOps principle we need some example resource manifests in a Git repository which we can edit. @@ -63,6 +59,9 @@ By clicking on the repository link in the repository list you get to the detail The **URL** of the Git repository, we'll be working with, will look like `https://{{% param giteaUrl %}}//argocd-training-examples.git`. Within the Web IDE we set the `USER` environment variable to your personal ``. +```bash +export USER= +``` Verify that with the following command: ```bash @@ -108,10 +107,11 @@ git config --local --list ``` -## Task {{% param sectionnumber %}}.2: Deploying the resources with Argo CD +## {{% task %}} Deploying the resources with Argo CD Now we want to deploy the resource manifests contained in the cloned repository with Argo CD to demonstrate the basic features of Argo CD. +{{% onlyWhenNot no-argocd-cli %}} To deploy the resources using the Argo CD CLI use the following command: ```bash @@ -191,7 +191,50 @@ GROUP KIND NAMESPACE NAME STATUS HEALTH HOOK MESSAG apps Deployment simple-example Synced Progressing deployment.apps/simple-example created ``` -Check the [Argo CD UI](https://{{% param argoCdUrl %}}) to browse the application and their components. The URL of the Argo CD webinterface will be provided by the teacher. +Check the [Argo CD UI](https://{{% param argoCdUrl %}}) to browse the application and their components. +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Create a file `example-application.yaml` with the following content: + +```yaml +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: argo-$USER + namespace: {{% param argoInfraNamespace %}} +spec: + project: default + source: + repoURL: https://{{% param giteaUrl %}}/$USER/argocd-training-examples.git + targetRevision: HEAD + path: example-app + destination: + server: https://kubernetes.default.svc + namespace: $USER +``` + +Apply it to the cluster: + +```bash +{{% param cliToolName %}} apply -f example-application.yaml +``` + +Expected output: `application 'example-application-' created` + +Argo CD will now detect the application. Once the application is created, you can view its status: + +```bash +{{% param cliToolName %}} describe application example-application-$USER -n {{% param argoInfraNamespace %}} +``` + +Open the [Argo CD UI](https://{{% param argoCdUrl %}}) and click **Sync** to deploy the resources. This command retrieves the manifests from the git repository and performs a {{% param cliToolName %}} apply on them. From now on, all resources are managed by Argo CD. Congrats, the first step in direction GitOps! :) + +Once synced the application status will show as **Healthy**. + +```bash +{{% param cliToolName %}} get application example-application-$USER -n {{% param argoInfraNamespace %}} +``` +{{% /onlyWhen %}} Application overview in unsynced and synced state @@ -205,14 +248,13 @@ Detailed view of a application in unsynced and synced state ![Application Tree (synced state)](app-tree-sycned.png) -## Task {{% param sectionnumber %}}.3: Automated Sync Policy and Diff +## {{% task %}} Automated Sync Policy and Diff When there is a new commit in your Git repository, the Argo CD application becomes OutOfSync. Let's assume we want to scale up our `Deployment` of the example application from 1 to 2 replicas. We will change this in the Deployment manifest. Increase the number of replicas in your file `/example-app/deployment.yaml` to 2. ``` -{{< highlight YAML "hl_lines=6" >}} apiVersion: apps/v1 kind: Deployment metadata: @@ -233,7 +275,6 @@ spec: name: simple-example ports: - containerPort: 5000 -{{< / highlight >}} ``` @@ -258,6 +299,7 @@ remote: Resolving deltas: 100% (3/3), completed with 3 local objects. To https://{{% param giteaUrl %}}//argocd-training-examples.git 5a6f365..e2d4bbf master -> master ``` +{{% onlyWhenNot no-argocd-cli %}} Check the state of the resources by cli: @@ -303,18 +345,25 @@ which should give you an output similar to: --- > replicas: 2 ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Out of the box Git will be polled by Argo CD in a predefined interval (defaults to 3 minutes). To use a synchronous workflow you can use webhooks in Git. These will trigger a synchronization in Argo CD on every push to the repository. + +Open the [Argo CD UI](https://{{% param argoCdUrl %}}) and click **Refresh** on the `argo-$USER` application to trigger an immediate update. +{{% /onlyWhen %}} Now open the web console of Argo CD and go to your application. The deployment `simple-example` is marked as 'OutOfSync': ![Application Out-of-Sync](app-replicas-diff-overview.png) -With a click on Deployment > Diff you will see the differences: +When an application is OutOfSync then your deployed 'live state' is no longer the same as the 'target state' which is represented by the resource manifests in the Git repository. You can inspect the differences between live and target state with a click on Deployment > Diff: ![Application Differences](app-replicas-diff-detail.png) -Now click `Sync` on the top left and let the magic happens ;) The application will be scaled up to 2 replicas and the resources are in Sync again. +Now click `Sync` on the top left and let the magic happen ;) The application will be scaled up to 2 replicas and the resources are in Sync again. +{{% onlyWhenNot no-argocd-cli %}} Double-check the status by cli ```bash @@ -339,33 +388,79 @@ GROUP KIND NAMESPACE NAME STATUS HEALTH HOOK MESSAGE Service simple-example Synced Healthy service/simple-example unchanged apps Deployment simple-example Synced Healthy deployment.apps/simple-example configured ``` +{{% /onlyWhenNot %}} Argo CD can automatically sync an application when it detects differences between the desired manifests in Git, and the live state in the cluster. A benefit of automatic sync is that CI/CD pipelines no longer need direct access to the Argo CD API server to perform the deployment. Instead, the pipeline makes a commit and push to the Git repository with the changes to the manifests in the tracking Git repo. +{{% onlyWhenNot no-argocd-cli %}} To configure automatic sync run (or use the UI): ```bash argocd app set argo-$USER --sync-policy automated ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +To configure automatic sync, edit the example-application.yaml (or use the UI): + +```yaml +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: argo-$USER + namespace: {{% param argoInfraNamespace %}} +spec: + project: default + source: + repoURL: https://{{% param giteaUrl %}}/$USER/argocd-training-examples.git + targetRevision: HEAD + path: example-app + destination: + server: https://kubernetes.default.svc + namespace: $USER + syncPolicy: + automated: {} +``` +and re-apply the manifest: + +```bash +{{% param cliToolName %}} apply -f example-application.yaml +``` +{{% /onlyWhen %}} From now on Argo CD will automatically apply all resources to Kubernetes every time you commit to the Git repository. -Decrease the replicas count to 1 and push the updated manifest to remote. Wait for a few moments and see check that ArgoCD will scale the deployment of the example app down to 1 replica. The default polling interval is 3 minutes. If you don't want to wait you can force a refresh by clicking `Refresh` in the UI or by cli: +Decrease the replicas count to 1 and push the updated manifest to remote. Wait for a few moments and see check that ArgoCD will scale the deployment of the example app down to 1 replica. The default polling interval is 3 minutes. If you don't want to wait you can force a refresh by clicking `Refresh` in the UI{{% onlyWhenNot no-argocd-cli %}} or by cli: ```bash argocd app get argo-$USER --refresh ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}}. +{{% /onlyWhen %}} -## Task {{% param sectionnumber %}}.4: Automatic Self-Healing +## {{% task %}} Automatic Self-Healing -By default, changes made to the live cluster will not trigger automatic sync. To enable automatic sync when the live cluster's state deviates from the state defined in Git, run: +By default, changes made to the live cluster will not trigger automatic sync. To enable automatic sync when the live cluster's state deviates from the state defined in Git, {{% onlyWhenNot no-argocd-cli %}}run: ```bash argocd app set argo-$USER --self-heal ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}}edit `example-application.yaml` to set `selfHeal: true` and re-apply: -Watch the deployment `simple-example` in a separate terminal +```yaml + syncPolicy: + automated: + selfHeal: true +``` + +```bash +{{% param cliToolName %}} apply -f example-application.yaml +``` +{{% /onlyWhen %}} + +Watch the deployment `simple-example` in a separate terminal: ```bash {{% param cliToolName %}} get deployment simple-example --watch --namespace=$USER @@ -395,7 +490,7 @@ simple-example 1/1 2 2 114m This is a great way to enforce a strict GitOps principle. Changes which are manually made on deployed resource manifests are reverted immediately back to the desired state by the ArgoCD controller. -## Task {{% param sectionnumber %}}.5: Expose Application +## {{% task %}} Expose Application This is an optional task. @@ -427,7 +522,7 @@ spec: {{% /onlyWhenNot %}} {{% onlyWhen openshift %}} -To expose an application we need to specify a so called `route` resource. Create an `route.yaml` file next to the `deployment.yaml` in the example-app directory. +To expose an application we need to specify a so called `route` resource. Create a `route.yaml` file next to the `deployment.yaml` in the example-app directory. ```yaml --- @@ -471,18 +566,18 @@ The result should look similar to this: ``` -## Task {{% param sectionnumber %}}.6: Pruning +## {{% task %}} Pruning -You probably asked yourself how can I delete deployed resources on the container platform? Argo CD can be configured to delete resources that no longer exist in the Git repository. +You probably asked yourself: how can I delete deployed resources on the container platform? Argo CD can be configured to delete resources that no longer exist in the Git repository. -First delete the files `service.yaml` and `ingress.yaml` from Git repository and push the changes +First delete the files `service.yaml` and {{% onlyWhenNot openshift %}}`ingress.yaml`{{% /onlyWhenNot %}}{{% onlyWhen openshift %}}`route.yaml`{{% /onlyWhen %}} from Git repository and push the changes: ```bash git add . git add --all && git commit -m 'Removes service and ingress' && git push ``` - +{{% onlyWhenNot no-argocd-cli %}} Check the status of the application with ```bash @@ -516,15 +611,34 @@ extensions Ingress simple-example Succeeded Pruned pru Service simple-example Succeeded Pruned pruned apps Deployment simple-example Synced Healthy deployment.apps/simple-example unchanged ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Open the [Argo CD UI](https://{{% param argoCdUrl %}}) and click **Refresh** on the application. You will see that even with auto-sync enabled the resources are still OutOfSync. + +To enable pruning, edit `example-application.yaml` and re-apply: + +```yaml + syncPolicy: + automated: + selfHeal: true + prune: true +``` + +```bash +{{% param cliToolName %}} apply -f example-application.yaml +``` + +Click **Refresh** again in the UI. The Service and Ingress/Route will now be pruned (deleted) by Argo CD. +{{% /onlyWhen %}} The Service was successfully deleted by Argo CD because the manifest was removed from git. See the HEALTH and MESSAGE of the previous console output. -## Task {{% param sectionnumber %}}.7: State of ArgoCD +## {{% task %}} State of ArgoCD Argo CD is largely built stateless. The configuration is persisted as native Kubernetes objects. And those are stored in Kubernetes _etcd_. There is no additional storage layer needed to run ArgoCD. The Redis storage under the hood acts just as a throw-away cache and can be evicted anytime without any data loss. -The configuration changes made on ArgoCD objects through the UI or by cli tool `argocd` are reflected in updates of the ArgoCD Kubernetes objects `Application` and `AppProject` in the `{{% param argoInfraNamespace %}}` namespace. +The configuration changes made on ArgoCD objects through the UI or by CLI are reflected in updates of the ArgoCD Kubernetes objects `Application` and `AppProject` in the `{{% param argoInfraNamespace %}}` namespace. Let's list all Kubernetes objects of type `Application` (short form: `app`) @@ -537,7 +651,7 @@ NAME SYNC STATUS HEALTH STATUS argo- Synced Healthy ``` -You will see the application which we created some chapters ago by cli command `argocd app create...`. To see the complete configuration of the `Application` as _yaml_ use: +You will see the application which we created{{% onlyWhenNot no-argocd-cli %}} some chapters ago by cli command `argocd app create...`{{% /onlyWhenNot %}}. To see the complete configuration of the `Application` as _yaml_ use: ```bash {{% param cliToolName %}} get applications argo-$USER -oyaml --namespace={{% param argoInfraNamespace %}} @@ -552,8 +666,9 @@ You even can edit the `Application` resource by using: This allows us to manage the ArgoCD application definitions in a declarative way as well. It is a common pattern to have one ArgoCD application which references n child Applications which allows us a fast bootstrapping of a whole environment or a new cluster. This pattern is well known as the [App of apps]({{< ref "06" >}}) pattern. -## Task {{% param sectionnumber %}}.8: Accessing a private Git repository +## {{% task %}} Accessing a private Git repository +{{% onlyWhenNot no-argocd-cli %}} The Git repository we have imported to Gitea is public available for the whole world. When accessing a private repository we have to provide credentials in form of a username/password pair or a ssh private key. In this task you will learn how to access a protected repo from Argo CD. First make the Git repository in Gitea private by checking the option `Visibility: Make Repository Private` under `Settings -> Repository`. Now sync the app again. @@ -581,12 +696,38 @@ Now the sync should work. Argo CD use the configured credentials to authenticate ```bash argocd app sync argo-$USER ``` - -You can define [credential templates](https://argoproj.github.io/argo-cd/user-guide/private-repositories/#credential-templates) when using the same credential for multiple Git repositories. The configured credentials are used for each Git repository beginning with the configured URL. The following command will create a credential which matches all git repositories for your username (e.g. https://\@{{% param giteaUrl %}}/\) +{{% /onlyWhenNot %}} +You can define [credential templates](https://argoproj.github.io/argo-cd/user-guide/private-repositories/#credential-templates) when using the same credential for multiple Git repositories. The configured credentials are used for each Git repository beginning with the configured URL. +{{% onlyWhenNot no-argocd-cli %}} +The following command will create a credential which matches all git repositories for your username (e.g. https://\@{{% param giteaUrl %}}/\) ```bash argocd repocreds add https://{{% param giteaUrl %}}/$USER --username $USER ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +A credential template is a `Secret` with the label `argocd.argoproj.io/secret-type: repo-creds` and a URL prefix instead of a full repository URL. Argo CD will use its credentials for every repository whose URL starts with that prefix. + +```yaml +apiVersion: v1 +kind: Secret +metadata: + name: my-group-creds + namespace: {{% param argoInfraNamespace %}} + labels: + argocd.argoproj.io/secret-type: repo-creds +stringData: + type: git + url: https://{{% param giteaUrl %}}/my-group + username: my-user + password: my-token +``` + +```bash +{{% param cliToolName %}} apply -f repo-creds-secret.yaml +``` +For example, a template for `https://{{% param giteaUrl %}}/my-group` would cover all repositories within that group without needing a separate secret per repository. +{{% /onlyWhen %}} Finally make your personal Git repository public again for the following labs. Uncheck the option `Visibility: Make Repository Private` under `Settings -> Repository` in the Gitea UI. {{% alert title="Note" color="info" %}} @@ -594,14 +735,26 @@ TLS certificates and SSH private keys are supported alternative authentication m {{% /alert %}} Have a look in the [documentation](https://argoproj.github.io/argo-cd/user-guide/private-repositories/) for detailed information about accessing private repositories. +{{% onlyWhen no-argocd-cli %}} +Since the forked repository is public, no additional credential configuration is needed. Private repository access is managed via the Argo CD UI under **Settings → Repositories** if required. +{{% /onlyWhen %}} -## Task {{% param sectionnumber %}}.9: Delete the Application +## {{% task %}} Delete the Application You can cascading delete the ArgoCD Application with the following command: +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app delete argo-$USER ``` Hit `y` to confirm the deletion and this will delete the `Application` manifests of ArgoCD and all created resources by this application. In our case the `Application`, `Deployment` and `Service` will be deleted. With the flag `--cascade=false` only the ArgoCD `Application` will be deleted and the created resources `Deployment` and `Service` remain untouched. +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +```bash +{{% param cliToolName %}} delete application argo-$USER -n {{% param argoInfraNamespace %}} +``` + +This will delete the `Application` resource. Since automated pruning is enabled, Argo CD will also delete the managed `Deployment` and `Service` from the namespace. +{{% /onlyWhen %}} diff --git a/content/en/docs/03/_index.md b/content/en/docs/03/_index.md index 968c87c..eec19aa 100644 --- a/content/en/docs/03/_index.md +++ b/content/en/docs/03/_index.md @@ -1,7 +1,7 @@ --- -title: "3. Resource Hooks" +title: "Resource Hooks" weight: 3 -sectionnumber: 3 +onlyWhen: resource-hooks --- In this Lab you are going to learn about [Resource Hooks](https://argoproj.github.io/argo-cd/user-guide/resource_hooks/). @@ -63,7 +63,7 @@ metadata: * `BeforeHookCreation`: Any hook resource will be deleted before the new one is created. -## Task {{% param sectionnumber %}}.1: Hook Example +## {{% task %}} Hook Example In this task we're going to deploy an [example](https://github.com/acend/argocd-training-examples/tree/master/pre-post-sync-hook) which has `pre` and `post` hooks. @@ -73,17 +73,47 @@ Create the new application `argo-hook-$USER` with the following command. It will * Sync: Deployment with name `pre-post-sync-hook` * PostSync: after Job - +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app create argo-hook-$USER --repo https://{{% param giteaUrl %}}/$USER/argocd-training-examples.git --path 'pre-post-sync-hook' --dest-server https://kubernetes.default.svc --dest-namespace $USER ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Create a file `argocd-hook-application.yaml` with the following content and apply it: + +```yaml +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: argo-hook-$USER + namespace: {{% param argoInfraNamespace %}} +spec: + project: default + source: + repoURL: https://{{% param giteaUrl %}}/$USER/argocd-training-examples.git + targetRevision: HEAD + path: pre-post-sync-hook + destination: + server: https://kubernetes.default.svc + namespace: $USER +``` + +```bash +{{% param cliToolName %}} apply -f argocd-hook-application.yaml +``` +{{% /onlyWhen %}} Sync the application {{% details title="Hint" %}} +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app sync argo-hook-$USER ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Open the [Argo CD UI](https://{{% param argoCdUrl %}}) and click **Sync** on the `argo-hook-$USER` application. +{{% /onlyWhen %}} {{% /details %}} And verify the deployment: @@ -95,7 +125,7 @@ And verify the deployment: Or in the web UI. -## Task {{% param sectionnumber %}}.2: Post-hook Curl (Optional) +## {{% task %}} Post-hook Curl (Optional) Alter the post sync hook command from `sleep` to `curl https://acend.ch` (Could be used to send a notification to a Chat channel) The curl command is not available in the minimal `quay.io/acend/example-web-go` image. You can use `quay.io/acend/example-web-python` or different image. @@ -122,12 +152,19 @@ spec: ``` -## Task {{% param sectionnumber %}}.3: Delete the Application +## {{% task %}} Delete the Application Delete the application after you've explored the Argo CD Resources and the managed Kubernetes resources. {{% details title="Hint" %}} +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app delete argo-hook-$USER ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +```bash +{{% param cliToolName %}} delete application argo-hook-$USER -n {{% param argoInfraNamespace %}} +``` +{{% /onlyWhen %}} {{% /details %}} diff --git a/content/en/docs/04/_index.md b/content/en/docs/04/_index.md index a0058a0..065c15a 100644 --- a/content/en/docs/04/_index.md +++ b/content/en/docs/04/_index.md @@ -1,7 +1,7 @@ --- -title: "4. Sync Phases and Waves" +title: "Sync Phases and Waves" weight: 4 -sectionnumber: 4 +onlyWhen: sync-phases-and-waves --- In this Lab you are going to learn about [Sync Phases and Waves](https://argoproj.github.io/argo-cd/user-guide/sync-waves/). @@ -34,7 +34,7 @@ Pre-sync and post-sync can only contain hooks defined on annotations `argocd.arg You can specify the wave in the sync phase by setting an annotation `argocd.argoproj.io/sync-wave`. Hooks and resources are assigned to wave zero by default. The wave can be negative, so you can create a wave that runs before all other resources. -## Task {{% param sectionnumber %}}.1: Sync Wave Example +## {{% task %}} Sync Wave Example Let's now get our hands on a sync wave example. @@ -53,17 +53,47 @@ Create the new application `argo-wave-$USER` with the following command. The App * Sync Wave 3 * Job: maintenance-page-down - +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app create argo-wave-$USER --repo https://{{% param giteaUrl %}}/$USER/argocd-training-examples.git --path 'sync-wave' --dest-server https://kubernetes.default.svc --dest-namespace $USER ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Create a file `argocd-wave-application.yaml` with the following content and apply it: + +```yaml +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: argo-wave-$USER + namespace: {{% param argoInfraNamespace %}} +spec: + project: default + source: + repoURL: https://{{% param giteaUrl %}}/$USER/argocd-training-examples.git + targetRevision: HEAD + path: sync-wave + destination: + server: https://kubernetes.default.svc + namespace: $USER +``` + +```bash +{{% param cliToolName %}} apply -f argocd-wave-application.yaml +``` +{{% /onlyWhen %}} Sync the application: {{% details title="Hint" %}} +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app sync argo-wave-$USER ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Open the [Argo CD UI](https://{{% param argoCdUrl %}}) and click **Sync** on the `argo-wave-$USER` application. +{{% /onlyWhen %}} {{% /details %}} And verify the deployment: @@ -73,12 +103,19 @@ And verify the deployment: ``` -## Task {{% param sectionnumber %}}.2: Delete the Application +## {{% task %}} Delete the Application Delete the application after you've explored the Argo CD Resources and the managed Kubernetes resources. {{% details title="Hint" %}} +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app delete argo-wave-$USER ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +```bash +{{% param cliToolName %}} delete application argo-wave-$USER -n {{% param argoInfraNamespace %}} +``` +{{% /onlyWhen %}} {{% /details %}} diff --git a/content/en/docs/05/_index.md b/content/en/docs/05/_index.md index df1118e..6f4a390 100644 --- a/content/en/docs/05/_index.md +++ b/content/en/docs/05/_index.md @@ -1,7 +1,7 @@ --- -title: "5. Tools" +title: "Tools" weight: 5 -sectionnumber: 5 +onlyWhen: tools --- In this Lab you are going to learn about different [application source tools](https://argoproj.github.io/argo-cd/user-guide/application_sources/). @@ -13,7 +13,6 @@ As mentioned in the [introduction](../) Argo CD supports many different formats * [kustomize](https://kustomize.io/) applications * [helm](https://helm.sh/) charts -* [ksonnet](https://github.com/ksonnet/ksonnet) applications (deprecated) * [jsonnet](https://jsonnet.org/) files * Plain directory of YAML/json manifests * Any custom config management tool configured as a config management plugin diff --git a/content/en/docs/05/helm.md b/content/en/docs/05/helm.md index 3e7d7ca..68c5fdc 100644 --- a/content/en/docs/05/helm.md +++ b/content/en/docs/05/helm.md @@ -1,7 +1,7 @@ --- -title: "5.1 Helm" +title: "Helm" weight: 51 -sectionnumber: 5.1 +onlyWhen: helm --- This lab explains how to use [Helm](https://helm.sh/) as manifest format together with Argo CD. @@ -17,13 +17,22 @@ Helm Charts are configured using `values.yaml` files. (e.g. images, image tags, When using `helm` charts together with Argo CD we can specify the `values.yaml` like this: +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app set argo-helm-$USER --values values-production.yaml ``` -The `--values` flag can be repeated to support multiple values files. +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +```yaml +# In the Application spec.source.helm section: +valueFiles: + - values-base.yaml # shared values across envs + - values-production.yaml # higher precedence - env specific +``` +{{% /onlyWhen %}} {{% alert title="Info" color="info" %}} -Values files must be in the same git repository as the Helm chart. The files can be in a different location in which case it can be accessed using a relative path relative to the root directory of the Helm chart. +Values files do not necessarily have to be in the same git repository as the Helm chart. For that use case, or if you want to use a public helm chart with values from your own git repository, the [Multiple Sources](https://argo-cd.readthedocs.io/en/latest/user-guide/multiple_sources) feature can be used. Check the [docs](https://argo-cd.readthedocs.io/en/latest/user-guide/multiple_sources/#helm-value-files-from-external-git-repository) if you are interested in that. {{% /alert %}} @@ -31,12 +40,22 @@ Values files must be in the same git repository as the Helm chart. The files can Similar to when using `helm` directly (`helm install --set replicaCount=2 ./mychart --namespace `), you are able to overwrite values from the values.yaml, by setting parameters. +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app set argo-helm-$USER --parameter replicaCount=2 ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +```yaml +# In the Application spec.source.helm section: +parameters: + - name: replicaCount + value: "2" +``` +{{% /onlyWhen %}} {{% alert title="Warning" color="warning" %}} -Argo CD provides a mechanism to override the parameters of Argo CD applications. [The Argo CD parameter overrides](https://argoproj.github.io/argo-cd/user-guide/parameters/) feature is provided mainly as a convenience to developers and is intended to be used in dev/test environments, vs. production environments. +[The Argo CD parameter overrides](https://argoproj.github.io/argo-cd/user-guide/parameters/) feature is provided mainly as a convenience to developers and is intended to be used in dev/test environments, vs. production environments. Many consider this feature as anti-pattern to GitOps. So only use this feature when no other option is available! {{% /alert %}} @@ -44,15 +63,20 @@ Many consider this feature as anti-pattern to GitOps. So only use this feature w ### Helm Release Name -By default, the Helm release name is equal to the Application name to which it belongs. Sometimes, especially on a centralised ArgoCD, you may want to override that name, and it is possible with the `release-name` flag on the cli: +By default, the Helm release name is equal to the Application name to which it belongs. Sometimes, especially on a centralised ArgoCD, you may want to override that name. +{{% onlyWhenNot no-argocd-cli %}} +For this purpose, the cli provides the `release-name` flag: ```bash argocd app set argo-helm-$USER --release-name ``` - -{{% alert title="Warning" color="warning" %}} -Please note that overriding the Helm release name might cause problems when the chart you are deploying is using the app.kubernetes.io/instance label. ArgoCD injects this label with the value of the Application name for tracking purposes. -{{% /alert %}} +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +```yaml +# In the Application spec.source.helm section: +releaseName: +``` +{{% /onlyWhen %}} ### Helm Hooks @@ -65,25 +89,55 @@ Please note that overriding the Helm release name might cause problems when the Read more about the helm integration in the [official documentation](https://argoproj.github.io/argo-cd/user-guide/helm/) -## Task {{% param sectionnumber %}}.1: Deploy the simple-example as Helm Chart +## {{% task %}} Deploy the simple-example as Helm Chart Let's deploy the simple-example from lab 1 using a [helm chart](https://github.com/acend/argocd-training-examples/tree/master/helm/simple-example). First you'll have to create a new Argo CD application. +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app create argo-helm-$USER --repo https://{{% param giteaUrl %}}/$USER/argocd-training-examples.git --path 'helm/simple-example' --dest-server https://kubernetes.default.svc --dest-namespace $USER --values values.yaml ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Create a file `argocd-helm-application.yaml` with the following content and apply it: + +```yaml +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: argo-helm-$USER + namespace: {{% param argoInfraNamespace %}} +spec: + project: default + source: + repoURL: https://{{% param giteaUrl %}}/$USER/argocd-training-examples.git + targetRevision: HEAD + path: helm/simple-example + helm: + valueFiles: + - values.yaml + destination: + server: https://kubernetes.default.svc + namespace: $USER +``` + +```bash +{{% param cliToolName %}} apply -f argocd-helm-application.yaml +``` +{{% /onlyWhen %}} Sync the application {{% details title="Hint" %}} -To sync (deploy) the resources you can simply click sync in the web UI or execute the following command: +To sync (deploy) the resources you can simply click sync in the web UI{{% onlyWhen no-argocd-cli %}}.{{% /onlyWhen %}}{{% onlyWhenNot no-argocd-cli %}} or execute the following command: ```bash argocd app sync argo-helm-$USER ``` +{{% /onlyWhenNot %}} {{% /details %}} And verify the deployment: @@ -95,30 +149,66 @@ And verify the deployment: Tell the application to sync automatically, to enable self-healing and auto-prune {{% details title="Hint" %}} +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app set argo-helm-$USER --sync-policy automated argocd app set argo-helm-$USER --self-heal argocd app set argo-helm-$USER --auto-prune ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Edit `argocd-helm-application.yaml` to add automated sync policy, then re-apply: + +```yaml + syncPolicy: + automated: + selfHeal: true + prune: true +``` + +```bash +{{% param cliToolName %}} apply -f argocd-helm-application.yaml +``` +{{% /onlyWhen %}} {{% /details %}} -## Task {{% param sectionnumber %}}.2: Scale the deployment to 2 replicas +## {{% task %}} Scale the deployment to 2 replicas -We can set the `helm` parameter with the following command: +We can set the `helm` parameter as follows: +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app set argo-helm-$USER --parameter replicaCount=2 ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Edit `argocd-helm-application.yaml` to add the parameter override in `spec.source.helm`, then re-apply: + +```yaml + helm: + valueFiles: + - values.yaml + parameters: + - name: replicaCount + value: "2" +``` + +```bash +{{% param cliToolName %}} apply -f argocd-helm-application.yaml +``` +{{% /onlyWhen %}} {{% alert title="Warning" color="warning" %}} Only use this way of setting params in dev and test stages. Not for Production! {{% /alert %}} -Since the `sync-policy` is set to `automated` the second pod will be deployed immediately. +Since the `sync-policy` is set to `automated` the second pod will be deployed immediately after the next refresh. -## Task {{% param sectionnumber %}}.3: Ingress +## {{% task %}} Ingress + + The proper and production ready way of overwriting values is by doing it in git. @@ -152,7 +242,7 @@ git push Open your Browser and verify whether you can access the application. -## Task {{% param sectionnumber %}}.4: Create a second application representing the production stage +## {{% task %}} Create a second application representing the production stage Let's now also deploy an application for the production stage. @@ -191,12 +281,45 @@ Let's create the production stage Argo CD application with the name `argo-helm-p {{% details title="Hint" %}} +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app create argo-helm-prod-$USER --repo https://{{% param giteaUrl %}}/$USER/argocd-training-examples.git --path 'helm/simple-example' --dest-server https://kubernetes.default.svc --dest-namespace $USER argocd app set argo-helm-prod-$USER --sync-policy automated argocd app set argo-helm-prod-$USER --self-heal argocd app set argo-helm-prod-$USER --auto-prune ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Create a file `argocd-helm-application-prod.yaml` with the following content and apply it: + +```yaml +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: argo-helm-prod-$USER + namespace: {{% param argoInfraNamespace %}} +spec: + project: default + source: + repoURL: https://{{% param giteaUrl %}}/$USER/argocd-training-examples.git + targetRevision: HEAD + path: helm/simple-example + helm: + valueFiles: + - values-production.yaml + destination: + server: https://kubernetes.default.svc + namespace: $USER + syncPolicy: + automated: + selfHeal: true + prune: true +``` + +```bash +{{% param cliToolName %}} apply -f argocd-helm-application-prod.yaml +``` +{{% /onlyWhen %}} {{% /details %}} @@ -206,6 +329,7 @@ And verify the deployment: {{% param cliToolName %}} get pod --namespace $USER --watch ``` +{{% onlyWhenNot no-argocd-cli %}} Tell the Argo CD app to use the `values-production.yaml` values file {{% details title="Hint" %}} @@ -213,17 +337,25 @@ Tell the Argo CD app to use the `values-production.yaml` values file argocd app set argo-helm-prod-$USER --values values-production.yaml ``` {{% /details %}} +{{% /onlyWhenNot %}} Change for example the ingress hostname to something different in the `values-production.yaml` and verify whether you can access the new hostname. -## Task {{% param sectionnumber %}}.4: Delete the Applications +## {{% task %}} Delete the Applications Delete the applications after you've explored the Argo CD Resources and the managed Kubernetes resources. {{% details title="Hint" %}} +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app delete argo-helm-$USER argocd app delete argo-helm-prod-$USER ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +```bash +{{% param cliToolName %}} delete application argo-helm-$USER argo-helm-prod-$USER -n {{% param argoInfraNamespace %}} +``` +{{% /onlyWhen %}} {{% /details %}} diff --git a/content/en/docs/05/jsonnet.md b/content/en/docs/05/jsonnet.md index 824e78f..ee79797 100644 --- a/content/en/docs/05/jsonnet.md +++ b/content/en/docs/05/jsonnet.md @@ -1,7 +1,7 @@ --- -title: "5.3 Jsonnet (Optional)" +title: "Jsonnet (Optional)" weight: 53 -sectionnumber: 5.3 +onlyWhen: jsonnet --- This lab explains how to use [jsonnet](https://jsonnet.org/) as manifest format together with Argo CD. @@ -49,7 +49,7 @@ Among many other features, Jsonnet can help to reduce duplications. Read more about the jsonnet integration in the [official documentation](https://argoproj.github.io/argo-cd/user-guide/jsonnet/) -## Task {{% param sectionnumber %}}.1: Deploy the simple-example with jsonnet +## {{% task %}} Deploy the simple-example with jsonnet Let's first explore the files in your local repository under `jsonnet`. @@ -148,34 +148,79 @@ git push Create the new Argo CD application. +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app create argo-jsonnet-$USER --repo https://{{% param giteaUrl %}}/$USER/argocd-training-examples.git --path 'jsonnet' --dest-server https://kubernetes.default.svc --dest-namespace $USER ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Create a file `argocd-jsonnet-application.yaml` with the following content and apply it: + +```yaml +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: argo-jsonnet-$USER + namespace: {{% param argoInfraNamespace %}} +spec: + project: default + source: + repoURL: https://{{% param giteaUrl %}}/$USER/argocd-training-examples.git + targetRevision: HEAD + path: jsonnet + destination: + server: https://kubernetes.default.svc + namespace: $USER +``` + +```bash +{{% param cliToolName %}} apply -f argocd-jsonnet-application.yaml +``` +{{% /onlyWhen %}} Sync the application {{% details title="Hint" %}} -To sync (deploy) the resources you can simply click sync in the web UI or execute the following command: +To sync (deploy) the resources you can simply click sync in the web UI{{% onlyWhenNot no-argocd-cli %}} or execute the following command: ```bash argocd app sync argo-jsonnet-$USER ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}}. +{{% /onlyWhen %}} {{% /details %}} And verify whether your jsonnet Application definition has be successfully synced. -## Task {{% param sectionnumber %}}.2: Autosync and scale up +## {{% task %}} Autosync and scale up Tell the application to sync automatically, to enable self-healing and auto-prune {{% details title="Hint" %}} +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app set argo-jsonnet-$USER --sync-policy automated argocd app set argo-jsonnet-$USER --self-heal argocd app set argo-jsonnet-$USER --auto-prune ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Edit `argocd-jsonnet-application.yaml` to add automated sync policy, then re-apply: + +```yaml + syncPolicy: + automated: + selfHeal: true + prune: true +``` + +```bash +{{% param cliToolName %}} apply -f argocd-jsonnet-application.yaml +``` +{{% /onlyWhen %}} {{% /details %}} Now let's change the replicacount of the deployment and scale to `2` pods. @@ -210,12 +255,19 @@ And verify the result in the ArgoCD Ui or by using the following command, this m ``` -## Task {{% param sectionnumber %}}.4: Delete the Applications +## {{% task %}} Delete the Applications Delete the applications after you've explored the Argo CD Resources and the managed Kubernetes resources. {{% details title="Hint" %}} +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app delete argo-jsonnet-$USER ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +```bash +{{% param cliToolName %}} delete application argo-jsonnet-$USER -n {{% param argoInfraNamespace %}} +``` +{{% /onlyWhen %}} {{% /details %}} diff --git a/content/en/docs/05/kustomize.md b/content/en/docs/05/kustomize.md index 301436d..dd22c3c 100644 --- a/content/en/docs/05/kustomize.md +++ b/content/en/docs/05/kustomize.md @@ -1,7 +1,7 @@ --- -title: "5.2 Kustomize" +title: "Kustomize" weight: 52 -sectionnumber: 5.2 +onlyWhen: kustomize --- This lab explains how to use [kustomize](https://kustomize.io/) as manifest format together with Argo CD. @@ -31,11 +31,25 @@ The following configuration options are available for Kustomize: * `commonLabels` is a string map of an additional labels * `commonAnnotations` is a string map of an additional annotations -Use the following command to set those parameters: +The parameters can be set as follows: +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app set argo-kustomize-$USER --nameprefix= ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +```yaml +# In the Application spec.source.kustomize section: +namePrefix: +``` +{{% /onlyWhen %}} + +{{% alert title="Warning" color="warning" %}} +Again, the [The Argo CD parameter overrides](https://argoproj.github.io/argo-cd/user-guide/parameters/) feature is provided mainly as a convenience to developers and is intended to be used in dev/test environments, vs. production environments. + +Many consider this feature as anti-pattern to GitOps. So only use this feature when no other option is available! +{{% /alert %}} ### Further Docs @@ -43,25 +57,52 @@ argocd app set argo-kustomize-$USER --nameprefix= Read more about the kustomize integration in the [official documentation](https://argo-cd.readthedocs.io/en/stable/user-guide/kustomize/) -## Task {{% param sectionnumber %}}.1: Deploy the simple-example with kustomize +## {{% task %}} Deploy the simple-example with kustomize Let's deploy the simple-example from lab 1 using [kustomize](https://github.com/acend/argocd-training-examples/tree/master/kustomize/simple-example). First you'll have to create a new Argo CD application. +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app create argo-kustomize-$USER --repo https://{{% param giteaUrl %}}/$USER/argocd-training-examples.git --path 'kustomize/simple-example' --dest-server https://kubernetes.default.svc --dest-namespace $USER ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Create a file `argocd-kustomize-application.yaml` with the following content and apply it: + +```yaml +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: argo-kustomize-$USER + namespace: {{% param argoInfraNamespace %}} +spec: + project: default + source: + repoURL: https://{{% param giteaUrl %}}/$USER/argocd-training-examples.git + targetRevision: HEAD + path: kustomize/simple-example + destination: + server: https://kubernetes.default.svc + namespace: $USER +``` + +```bash +{{% param cliToolName %}} apply -f argocd-kustomize-application.yaml +``` +{{% /onlyWhen %}} Sync the application {{% details title="Hint" %}} -To sync (deploy) the resources you can simply click sync in the web UI or execute the following command: +To sync (deploy) the resources you can simply click sync in the web UI{{% onlyWhen no-argocd-cli %}}.{{% /onlyWhen %}}{{% onlyWhenNot no-argocd-cli %}} or execute the following command: ```bash argocd app sync argo-kustomize-$USER ``` +{{% /onlyWhenNot %}} {{% /details %}} And verify the deployment: @@ -73,23 +114,53 @@ And verify the deployment: Tell the application to sync automatically, to enable self-healing and auto-prune {{% details title="Hint" %}} +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app set argo-kustomize-$USER --sync-policy automated argocd app set argo-kustomize-$USER --self-heal argocd app set argo-kustomize-$USER --auto-prune ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Edit `argocd-kustomize-application.yaml` to add automated sync policy, then re-apply: + +```yaml + syncPolicy: + automated: + selfHeal: true + prune: true +``` + +```bash +{{% param cliToolName %}} apply -f argocd-kustomize-application.yaml +``` +{{% /onlyWhen %}} {{% /details %}} -## Task {{% param sectionnumber %}}.2: Set a configuration parameter +## {{% task %}} Set a configuration parameter -We can set the `kustomize` configuration parameter with the following command: +We can set the `kustomize` configuration parameter as follows: +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app set argo-kustomize-$USER --nameprefix=acend ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Edit `argocd-kustomize-application.yaml` to add the nameprefix in `spec.source.kustomize`, then re-apply: + +```yaml + kustomize: + namePrefix: acend +``` + +```bash +{{% param cliToolName %}} apply -f argocd-kustomize-application.yaml +``` +{{% /onlyWhen %}} -And take a look at the application in the web UI or using the command line tool +And take a look at the application in the web UI{{% onlyWhen no-argocd-cli %}}.{{% /onlyWhen %}}{{% onlyWhenNot no-argocd-cli %}} or using the command line tool {{% details title="Hint" %}} @@ -97,13 +168,14 @@ And take a look at the application in the web UI or using the command line tool argocd app get argo-kustomize-$USER ``` {{% /details %}} +{{% /onlyWhenNot %}} {{% alert title="Warning" color="warning" %}} Only use this way of setting params in dev and test stages. Not for Production! {{% /alert %}} -## Task {{% param sectionnumber %}}.3: Create a second application representing the production stage +## {{% task %}} Create a second application representing the production stage Let's now also deploy an application for the production stage. @@ -114,12 +186,42 @@ Let's create the production stage Argo CD application (path: `kustomize/overlays {{% details title="Hint" %}} +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app create argo-kustomize-prod-$USER --repo https://{{% param giteaUrl %}}/$USER/argocd-training-examples.git --path 'kustomize/overlays-example/overlays/production' --dest-server https://kubernetes.default.svc --dest-namespace $USER argocd app set argo-kustomize-prod-$USER --sync-policy automated argocd app set argo-kustomize-prod-$USER --self-heal argocd app set argo-kustomize-prod-$USER --auto-prune ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Create a file `argocd-kustomize-application-prod.yaml` with the following content and apply it: + +```yaml +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: argo-kustomize-prod-$USER + namespace: {{% param argoInfraNamespace %}} +spec: + project: default + source: + repoURL: https://{{% param giteaUrl %}}/$USER/argocd-training-examples.git + targetRevision: HEAD + path: kustomize/overlays-example/overlays/production + destination: + server: https://kubernetes.default.svc + namespace: $USER + syncPolicy: + automated: + selfHeal: true + prune: true +``` + +```bash +{{% param cliToolName %}} apply -f argocd-kustomize-application-prod.yaml +``` +{{% /onlyWhen %}} {{% /details %}} @@ -130,13 +232,20 @@ And verify the deployment: ``` -## Task {{% param sectionnumber %}}.4: Delete the Applications +## {{% task %}} Delete the Applications Delete the applications after you've explored the Argo CD Resources and the managed Kubernetes resources. {{% details title="Hint" %}} +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app delete argo-kustomize-$USER argocd app delete argo-kustomize-prod-$USER ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +```bash +{{% param cliToolName %}} delete application argo-kustomize-$USER argo-kustomize-prod-$USER -n {{% param argoInfraNamespace %}} +``` +{{% /onlyWhen %}} {{% /details %}} diff --git a/content/en/docs/06/_index.md b/content/en/docs/06/_index.md index 719f7b0..eb5d7f5 100644 --- a/content/en/docs/06/_index.md +++ b/content/en/docs/06/_index.md @@ -1,10 +1,9 @@ --- -title: "6. Multiple Applications" +title: "Multiple Applications" weight: 6 -sectionnumber: 6 -onlyWhenNot: techlab +onlyWhen: multiple-applications --- -When it comes to managing a larger amount of application or bootstrapping whole environments, it's not very practical to manage the ArgoCD application manually using the CLI Tool `argocd app create`. +When it comes to managing a larger amount of application or bootstrapping whole environments, it's not very practical to manage each ArgoCD application manually. In ArgoCD there are two approaches which allow us to manage a set of applications. In the following two sub chapters you'll learn how the App of Apps and ApplicationSet pattern work. diff --git a/content/en/docs/06/app_of_apps.md b/content/en/docs/06/app_of_apps.md index de36808..22f99d5 100644 --- a/content/en/docs/06/app_of_apps.md +++ b/content/en/docs/06/app_of_apps.md @@ -1,8 +1,7 @@ --- -title: "6.1 App of Apps" -weight: 601 -sectionnumber: 6.1 -onlyWhenNot: techlab +title: "App of Apps" +weight: 61 +onlyWhen: app-of-apps --- The [App of apps](https://argoproj.github.io/argo-cd/operator-manual/cluster-bootstrapping/#app-of-apps-pattern) pattern is a declarative specification of one ArgoCD app that consists only of **other ArgoCD applications**. This way we have the possibility to deploy multiple apps within just one single App definition. @@ -22,7 +21,7 @@ First let us examine our ArgoCD example repository with the child applications. As we can see the directory consists of three ArgoCD applications. Each of them has its own source repository pointing to the corresponding repository containing a kubernetes deployment yaml file. -## Task {{% param sectionnumber %}}.1: Specify the Application Resources +## {{% task %}} Specify the Application Resources To deploy the app of apps into our namespace we need to edit the three application custom Resources (`app-of-apps/apps/*`): @@ -64,20 +63,50 @@ git push {{% /details %}} -## Task {{% param sectionnumber %}}.2: Create Argo CD Application +## {{% task %}} Create Argo CD Application Now let us create the parent Application which deploys our child applications as Custom Resources. Note the three paramters -* `--sync-policy automated` Set the sync policy to automated. This ensures that our child applications will be created and synced per default -* `--self-heal` Enable self heal and ensure that the parent application reconcile the child application -* `--auto-prune` Ensure that if the parent application gets deleted, it also delete the their child applications +* {{% onlyWhenNot no-argocd-cli %}}`--sync-policy automated`{{% /onlyWhenNot %}}{{% onlyWhen no-argocd-cli %}}`syncPolicy.automated`{{% /onlyWhen %}} Set the sync policy to automated. This ensures that our child applications will be created and synced per default +* {{% onlyWhenNot no-argocd-cli %}}`--self-heal`{{% /onlyWhenNot %}}{{% onlyWhen no-argocd-cli %}}`syncPolicy.automated.selfHeal`{{% /onlyWhen %}} Enable self heal and ensure that the parent application reconcile the child application +* {{% onlyWhenNot no-argocd-cli %}}`--auto-prune`{{% /onlyWhenNot %}}{{% onlyWhen no-argocd-cli %}}`syncPolicy.automated.prunte`{{% /onlyWhen %}} Ensure that if the parent application gets deleted, it also delete the their child applications +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app create argo-aoa-$USER --repo https://{{% param giteaUrl %}}/$USER/argocd-training-examples.git --path 'app-of-apps' --dest-server https://kubernetes.default.svc --dest-namespace $USER --sync-policy automated --self-heal --auto-prune ``` Expected output: `application 'argo-aoa-' created` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Create a file `application.yaml` with the following content and apply it: + +```yaml +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: argo-aoa-$USER + namespace: {{% param argoInfraNamespace %}} +spec: + project: default + source: + repoURL: https://{{% param giteaUrl %}}/$USER/argocd-training-examples.git + targetRevision: HEAD + path: app-of-apps + destination: + server: https://kubernetes.default.svc + namespace: $USER + syncPolicy: + automated: + selfHeal: true + prune: true +``` + +```bash +{{% param cliToolName %}} apply -f application.yaml +``` +{{% /onlyWhen %}} Explore the Argo parent application in the web UI. @@ -86,13 +115,20 @@ As you can see our newly created parent app consits of another three apps. Note that the child applications resources are not synced automatically. This is because an ArgoCD application only synces their direct child resources. To sync the child apps, either click on sync in the ArgoCD UI or set the sync policy to automed. -## Task {{% param sectionnumber %}}.3: Delete the Application +## {{% task %}} Delete the Application Delete the application after you've explored the Argo CD Resources and the managed Kubernetes resources. {{% details title="Hint" %}} +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app delete argo-aoa-$USER ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +```bash +{{% param cliToolName %}} delete application argo-aoa-$USER -n {{% param argoInfraNamespace %}} +``` +{{% /onlyWhen %}} {{% /details %}} diff --git a/content/en/docs/06/application_sets.md b/content/en/docs/06/application_sets.md index c3b6111..f123a88 100644 --- a/content/en/docs/06/application_sets.md +++ b/content/en/docs/06/application_sets.md @@ -1,8 +1,7 @@ --- -title: "6.2 Application Sets" -weight: 602 -sectionnumber: 6.2 -onlyWhenNot: techlab +title: "Application Sets" +weight: 62 +onlyWhen: application-sets --- With the ApplicationSet ArgoCD adds support for managing ArgoCD Application across a large number of clusters and environments. Plus it adds the capability of managing multitenant Kubernetes clusters. @@ -21,7 +20,7 @@ A list of parameters, which come from so called [generators](https://argocd-appl The ApplicationSet resources work in a similar way as Helm templates do. You can define a set of placeholders `{{placeholder}}` which then are replaced with the actual value during the processing of the ApplicationSet. -## Task {{% param sectionnumber %}}.1: Create an ApplicationSet +## {{% task %}} Create an ApplicationSet First delete the Ingress resource under `~/argocd-training-examples/example-app/ingress.yaml` @@ -75,9 +74,39 @@ git push origin main And now create the ArgoCD Application, which references the ApplicationSet definition: +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app create argo-appset-$USER --repo https://{{% param giteaUrl %}}/$USER/argocd-training-examples.git --path 'application-set/simple-example' --dest-server https://kubernetes.default.svc --sync-policy auto --dest-namespace argocd ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Create the following `application.yaml` and apply it: + +```yaml +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: argo-appset-$USER + namespace: {{% param argoInfraNamespace %}} +spec: + project: default + source: + repoURL: https://{{% param giteaUrl %}}/$USER/argocd-training-examples.git + targetRevision: HEAD + path: application-set/simple-example + destination: + server: https://kubernetes.default.svc + namespace: {{% param argoInfraNamespace %}} + syncPolicy: + automated: + prune: true + selfHeal: true +``` + +```bash +{{% param cliToolName %}} apply -f application.yaml +``` +{{% /onlyWhen %}} {{% alert title="Note" color="info" %}}Please notice the `dest-namespace`, ApplicationSets needs to be deployed within the `argocd` namespace{{% /alert %}} @@ -106,7 +135,7 @@ The Matrix generator combines the parameters generated by two child generators, * And so on... -## Task {{% param sectionnumber %}}.2: Matrix Example ApplicationSet +## {{% task %}} Matrix Example ApplicationSet In this lab section we're going to create an ApplicationSet for an multi-environment. @@ -193,20 +222,58 @@ git push origin main And let's create an ArgoCD Application containing the Matrix ApplicationSet with the following command: +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app create argo-appset-matrix-$USER --repo https://{{% param giteaUrl %}}/$USER/argocd-training-examples.git --path 'application-set/matrix-example' --dest-server https://kubernetes.default.svc --sync-policy auto --dest-namespace argocd ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Create the following `application-matrix.yaml` and apply it: + +```yaml +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: argo-appset-matrix-$USER + namespace: {{% param argoInfraNamespace %}} +spec: + project: default + source: + repoURL: https://{{% param giteaUrl %}}/$USER/argocd-training-examples.git + targetRevision: HEAD + path: application-set/matrix-example + destination: + server: https://kubernetes.default.svc + namespace: {{% param argoInfraNamespace %}} + syncPolicy: + automated: + prune: true + selfHeal: true +``` + +```bash +{{% param cliToolName %}} apply -f application-matrix.yaml +``` +{{% /onlyWhen %}} Next check the ArgoCD web ui, you should see the 4 generated ArgoCD applications together with the ArgoCD Application, which contains the ApplicationSet itself. -## Task {{% param sectionnumber %}}.3: Delete the Application +## {{% task %}} Delete the Application Delete the two applications (`argo-appset-$USER` and `argo-appset-matrix-$USER`) after you've explored the Argo CD Resources and the managed Kubernetes resources. {{% details title="Hint" %}} +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app delete argo-appset-$USER argocd app delete argo-appset-matrix-$USER ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +```bash +{{% param cliToolName %}} delete application argo-appset-$USER -n {{% param argoInfraNamespace %}} +{{% param cliToolName %}} delete application argo-appset-matrix-$USER -n {{% param argoInfraNamespace %}} +``` +{{% /onlyWhen %}} {{% /details %}} diff --git a/content/en/docs/07/_index.md b/content/en/docs/07/_index.md index 0360808..217ad63 100644 --- a/content/en/docs/07/_index.md +++ b/content/en/docs/07/_index.md @@ -1,8 +1,7 @@ --- -title: "7. Projects" +title: "Projects" weight: 7 -sectionnumber: 7 -onlyWhenNot: techlab +onlyWhen: projects --- Argo CD applications can be linked to a project which provides a logical grouping of applications. The following configurations can be made on a project: @@ -19,10 +18,11 @@ Argo CD applications can be linked to a project which provides a logical groupin In summary, a project defines who can deploy what to which destination. This is very useful to keep the isolation between different user groups working on the same Argo CD instance and enables the capability of multi tenancy. -## Task {{% param sectionnumber %}}.1: Create a new empty project +## {{% task %}} Create a new empty project Now we want to create a new empty Argo CD project. +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd proj create project-$USER argocd proj list @@ -37,12 +37,33 @@ default *,* * */* project- disabled ... ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Create a file `appproject.yaml` with the following content and apply it: +```yaml +apiVersion: argoproj.io/v1alpha1 +kind: AppProject +metadata: + name: project-$USER + namespace: {{% param argoInfraNamespace %}} +spec: + sourceRepos: [] + destinations: [] +``` + +```bash +{{% param cliToolName %}} apply -f appproject.yaml +{{% param cliToolName %}} get appproject -n {{% param argoInfraNamespace %}} +``` +{{% /onlyWhen %}} -## Task {{% param sectionnumber %}}.2: Define permitted sources and destinations + +## {{% task %}} Define permitted sources and destinations The next step is to deploy a new application and assign it to the created project `project-` by using the flag `--project` +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app create project-app-$USER --repo https://github.com/acend/argocd-training-examples.git --path 'example-app' --dest-server https://kubernetes.default.svc --dest-namespace $USER --project project-$USER ``` @@ -90,18 +111,66 @@ Now sync the application manifest ```bash argocd app sync project-app-$USER ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Update `appproject.yaml` to add the permitted sources and destinations, then re-apply: + +```yaml +apiVersion: argoproj.io/v1alpha1 +kind: AppProject +metadata: + name: project-$USER + namespace: {{% param argoInfraNamespace %}} +spec: + sourceRepos: + - '*' + destinations: + - server: https://kubernetes.default.svc + namespace: 'user*' +``` + +```bash +{{% param cliToolName %}} apply -f appproject.yaml +``` + +Now create a file `application.yaml` with the following content and apply it: + +```yaml +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: project-app-$USER + namespace: {{% param argoInfraNamespace %}} +spec: + project: project-$USER + source: + repoURL: https://github.com/acend/argocd-training-examples.git + targetRevision: HEAD + path: example-app + destination: + server: https://kubernetes.default.svc + namespace: $USER +``` + +```bash +{{% param cliToolName %}} apply -f application.yaml +``` + +Open the [Argo CD UI](https://{{% param argoCdUrl %}}) and click **Sync** on the `project-app-$USER` application. +{{% /onlyWhen %}} {{% alert title="Note" color="info" %}} The feature of limiting source repositories and destination clusters/namespaces is a powerful construct of Argo CD as roles and policies can be assigned to projects. With this tool you can enforce a fine grained permission model to control the access of the users to the different clusters and namespaces. {{% /alert %}} -## Task {{% param sectionnumber %}}.3: Deny resources by kind +## {{% task %}} Deny resources by kind On a project there is the possibility to restrict the kind of resources that can be synchronized. The restrictions are defined by whitelisting for cluster scoped resources and blacklisted for namespace scoped resources. Let's extend our existing project and deny the synchronization of `Services`. +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd proj deny-namespace-resource project-$USER "" Service ``` @@ -131,13 +200,47 @@ argocd proj allow-namespace-resource project-$USER "" Service ```bash argocd app sync project-app-$USER ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Update `appproject.yaml` to add a namespace resource blacklist, then re-apply: + +```yaml +spec: + # ... existing fields ... + namespaceResourceBlacklist: + - group: '' + kind: Service +``` +```bash +{{% param cliToolName %}} apply -f appproject.yaml +``` -## Task {{% param sectionnumber %}}.4: Cleanup +Open the [Argo CD UI](https://{{% param argoCdUrl %}}) and click **Sync** on `project-app-$USER`. The sync will fail because `Service` is now blocked. + +To allow `Service` again, remove the `namespaceResourceBlacklist` entry from `appproject.yaml` and re-apply: + +```bash +{{% param cliToolName %}} apply -f appproject.yaml +``` + +Sync the application again in the UI. +{{% /onlyWhen %}} + + +## {{% task %}} Cleanup Delete the resources created in this chapter by running the following commands: +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app delete project-app-$USER argocd proj delete project-$USER ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +```bash +{{% param cliToolName %}} delete application project-app-$USER -n {{% param argoInfraNamespace %}} +{{% param cliToolName %}} delete appproject project-$USER -n {{% param argoInfraNamespace %}} +``` +{{% /onlyWhen %}} diff --git a/content/en/docs/08/_index.md b/content/en/docs/08/_index.md index d44172b..2a85f23 100644 --- a/content/en/docs/08/_index.md +++ b/content/en/docs/08/_index.md @@ -1,8 +1,7 @@ --- -title: "8. Controlling Deployment Workflows" +title: "Controlling Deployment Workflows" weight: 8 -sectionnumber: 8 -onlyWhenNot: techlab +onlyWhen: controlling-deployment-workflows --- In this chapter you'll learn how to control the Deployment Workflow even more. diff --git a/content/en/docs/08/sync_windows.md b/content/en/docs/08/sync_windows.md index 9a6fef9..6e4c070 100644 --- a/content/en/docs/08/sync_windows.md +++ b/content/en/docs/08/sync_windows.md @@ -1,22 +1,66 @@ --- -title: "8.2 Sync Windows" +title: "Sync Windows" weight: 82 -sectionnumber: 8.2 -onlyWhenNot: techlab +onlyWhen: sync-windows --- With Sync windows the user can define at which time applications can be synchronized automatically and manually by Argo CD. Allowed and forbidden time windows can be defined. Sync windows can be restricted to a subset of applications, clusters and namespaces and thus offer great flexibility. -## Task {{% param sectionnumber %}}.1: Create application and project +## {{% task %}} Create application and project Now we want to create a new empty Argo CD project. +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd proj create -s "*" -d "*,*" project-sync-windows-$USER argocd app create sync-windows-$USER --repo https://github.com/acend/argocd-training-examples.git --path 'example-app' --dest-server https://kubernetes.default.svc --dest-namespace $USER --project project-sync-windows-$USER argocd app sync sync-windows-$USER ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Create `appproject.yaml`: + +```yaml +apiVersion: argoproj.io/v1alpha1 +kind: AppProject +metadata: + name: project-sync-windows-$USER + namespace: {{% param argoInfraNamespace %}} +spec: + sourceRepos: + - '*' + destinations: + - server: '*' + namespace: '*' +``` + +Create `application.yaml`: + +```yaml +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: sync-windows-$USER + namespace: {{% param argoInfraNamespace %}} +spec: + project: project-sync-windows-$USER + source: + repoURL: https://github.com/acend/argocd-training-examples.git + targetRevision: HEAD + path: example-app + destination: + server: https://kubernetes.default.svc + namespace: $USER +``` + +```bash +{{% param cliToolName %}} apply -f appproject.yaml +{{% param cliToolName %}} apply -f application.yaml +``` + +Open the [Argo CD UI](https://{{% param argoCdUrl %}}) and click **Sync** on `sync-windows-$USER`. +{{% /onlyWhen %}} You should see the following message after a successful sync @@ -27,11 +71,11 @@ Message: successfully synced (all tasks run) ``` -## Task {{% param sectionnumber %}}.2: Create sync windows +## {{% task %}} Create sync windows Per default no sync windows are pre-configured in Argo CD. That means manual and automatic sync operations are allowed all the time. Now we want to create a sync window which denies syncs during the day between 08:00 and 20:00. - +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd proj windows add project-sync-windows-$USER \ --kind deny \ @@ -54,6 +98,31 @@ argocd proj windows list project-sync-windows-$USER ID STATUS KIND SCHEDULE DURATION APPLICATIONS NAMESPACES CLUSTERS MANUALSYNC 0 Active deny 0 8 * * * 12h * * * Disabled ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Update `appproject.yaml` to add a deny sync window, then re-apply: + +```yaml +spec: + # ... existing fields ... + syncWindows: + - kind: deny + schedule: '0 8 * * *' + duration: 12h + applications: + - '*' + namespaces: + - '*' + clusters: + - '*' + manualSync: false +``` + +```bash +{{% param cliToolName %}} apply -f appproject.yaml +``` +{{% /onlyWhen %}} + The window starts at 08:00 in the morning an lasts for 12 hours and denies all sync operation for all applications. {{% alert title="Note" color="info" %}} @@ -62,6 +131,7 @@ Paste the cron expression on [Crontab Guru](https://crontab.guru/#0_8_*_*_*) to Now try to sync the previously created application +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app sync sync-windows-$USER ``` @@ -70,16 +140,21 @@ This manual sync request will be blocked due to the active sync window with the ```bash FATA[0000] rpc error: code = PermissionDenied desc = Cannot sync: Blocked by sync window ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Open the [Argo CD UI](https://{{% param argoCdUrl %}}) and try to click **Sync** on `sync-windows-$USER`. The sync will be blocked with a "Blocked by sync window" error. +{{% /onlyWhen %}} {{% alert title="Note" color="info" %}} If there is an active matching allow window and an active matching deny window then syncs will be denied as deny windows override allow windows. {{% /alert %}} -## Task {{% param sectionnumber %}}.3: Updating the sync window +## {{% task %}} Updating the sync window Now we want to restrict the defined sync windows just for the application with name `sketchy-app`. We update the existing sync window with the new application name. +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd proj windows update project-sync-windows-$USER 0 --applications "sketchy-app" ``` @@ -96,28 +171,72 @@ Revert the changes and use wildcard `*` again to match all applications ```bash argocd proj windows update project-sync-windows-$USER 0 --applications "*" ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Update `appproject.yaml` to restrict the sync window to `sketchy-app`, then re-apply: +```yaml + applications: + - 'sketchy-app' +``` -## Task {{% param sectionnumber %}}.4: Enabling manual syncs +```bash +{{% param cliToolName %}} apply -f appproject.yaml +``` + +Open the [Argo CD UI](https://{{% param argoCdUrl %}}) and click **Sync** on `sync-windows-$USER` — it works now because the window no longer applies to it. + +Revert `applications` back to `['*']` in `appproject.yaml` and re-apply: + +```bash +{{% param cliToolName %}} apply -f appproject.yaml +``` +{{% /onlyWhen %}} + + +## {{% task %}} Enabling manual syncs Now enable the manual sync for the window and try again to sync manually +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd proj windows enable-manual-sync project-sync-windows-$USER 0 argocd app sync sync-windows-$USER ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Update `appproject.yaml` to set `manualSync: true` on the sync window, then re-apply: + +```yaml + manualSync: true +``` + +```bash +{{% param cliToolName %}} apply -f appproject.yaml +``` + +Open the [Argo CD UI](https://{{% param argoCdUrl %}}) and click **Sync** on `sync-windows-$USER` — it now works for manual syncs. +{{% /onlyWhen %}} Which now work flawless. Automatic syncs are still forbidden and will not occur between 08:00 and 20:00. -## Task {{% param sectionnumber %}}.5: Housekeeping +## {{% task %}} Housekeeping Clean up the resources created in this lab +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd proj windows delete project-sync-windows-$USER 0 argocd app delete sync-windows-$USER -y argocd proj delete project-sync-windows-$USER ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +```bash +{{% param cliToolName %}} delete application sync-windows-$USER -n {{% param argoInfraNamespace %}} +{{% param cliToolName %}} delete appproject project-sync-windows-$USER -n {{% param argoInfraNamespace %}} +``` +{{% /onlyWhen %}} Find more detailed information about [Sync Windows in the docs](https://argoproj.github.io/argo-cd/user-guide/sync_windows/#sync-windows). diff --git a/content/en/docs/08/tracking_deployment_strategies.md b/content/en/docs/08/tracking_deployment_strategies.md index 931c1af..4e02392 100644 --- a/content/en/docs/08/tracking_deployment_strategies.md +++ b/content/en/docs/08/tracking_deployment_strategies.md @@ -1,8 +1,7 @@ --- -title: "8.1 Tracking and Deployment Strategies" +title: "Tracking and Deployment Strategies" weight: 81 -sectionnumber: 8.1 -onlyWhenNot: techlab +onlyWhen: tracking-and-deployment-strategies --- If you are using ArgoCD with Git or Helm tools, ArgoCD gives you the availability to configure different tracking and deployment strategies. @@ -40,7 +39,7 @@ This method is often used in development environment where you want to apply the The state at the specified Git tag or commit will be applied to the cluster. Pinning can achieved in two ways. Eiteher you can specifiy the full semver Git tag (v1.2.0) or a commit SHA. Usually the Git tag offers more flexibility while the commit SHA offers more immutuability. Commit pinning is generally the first choice for production environments. -## Task {{% param sectionnumber %}}.1: Git version pinning +## {{% task %}} Git version pinning In this task we're going to configure a version pinning with a Git tag. The goal of this task to show you how to pin a version from a Git tag and therefore freeze the deployment to specific commits. @@ -56,6 +55,7 @@ git push origin --tags Re-create the simple application example: +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app create argo-example-$USER --repo https://{{% param giteaUrl %}}/$USER/argocd-training-examples.git --path 'example-app' --dest-server https://kubernetes.default.svc --dest-namespace $USER ``` @@ -65,6 +65,31 @@ To pin the v1.0.0 version tag on our application execute the following command: ```bash argocd app set argo-example-$USER --revision v1.0.0 ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Create a file `application.yaml` with the following content and apply it: + +```yaml +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: argo-example-$USER + namespace: {{% param argoInfraNamespace %}} +spec: + project: default + source: + repoURL: https://{{% param giteaUrl %}}/$USER/argocd-training-examples.git + targetRevision: v1.0.0 + path: example-app + destination: + server: https://kubernetes.default.svc + namespace: $USER +``` + +```bash +{{% param cliToolName %}} apply -f application.yaml +``` +{{% /onlyWhen %}} {{% /details %}} @@ -89,9 +114,14 @@ git add . && git commit -m "scale deployment replicas to 2" && git push origin Now you can try to sync your applicaion with following command: +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app sync argo-example-$USER ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Open the [Argo CD UI](https://{{% param argoCdUrl %}}) and click **Sync** on the `argo-example-$USER` application. +{{% /onlyWhen %}} Check the number of configured replicas on the app deployment. @@ -122,17 +152,27 @@ Execute the following command to create and push a new Git tag git tag v1.0.1 && git push origin --tags ``` +{{% onlyWhenNot no-argocd-cli %}} Execute the following command to set the revision to our new Git tag `v.1.0.1`. ```bash argocd app set argo-example-$USER --revision v1.0.1 ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Edit `application.yaml`, change `targetRevision` to `v1.0.1`, then re-apply: + +```bash +{{% param cliToolName %}} apply -f application.yaml +``` +{{% /onlyWhen %}} {{% /details %}} With the new created tag, ArgoCD is goingt to pick up and apply the latest changes and scales up the replica count to 2. First let us sync the changes and check if the ArgoCD App is in Sync. +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app sync argo-example-$USER ``` @@ -142,6 +182,10 @@ Then diplay the status with following command: ```bash argocd app get argo-example-$USER ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Open the [Argo CD UI](https://{{% param argoCdUrl %}}) and click **Sync** on the `argo-example-$USER` application, then verify the status in the UI. +{{% /onlyWhen %}} If the app is in sync, you can check the number of replicas of the deployment. @@ -158,11 +202,18 @@ simple-example 2/2 2 2 7m43s ``` -## Task {{% param sectionnumber %}}.2: Delete the Application +## {{% task %}} Delete the Application You can cascading delete the ArgoCD Application with the following command: +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app delete argo-example-$USER ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +```bash +{{% param cliToolName %}} delete application argo-example-$USER -n {{% param argoInfraNamespace %}} +``` +{{% /onlyWhen %}} diff --git a/content/en/docs/_index.md b/content/en/docs/_index.md index 789af58..24bb38b 100644 --- a/content/en/docs/_index.md +++ b/content/en/docs/_index.md @@ -6,7 +6,7 @@ menu: weight: 2 --- - +{{% onlyWhenNot centris %}} [Argo CD](https://argoproj.github.io/argo-cd/) is a part of the [Argo Project](https://argoproj.github.io/) and affiliated under the [Cloud Native Computing Foundation (CNCF)](https://www.cncf.io/). The project is just under three years old, completely open source, and primarily implemented in Go. As the name suggests, Argo CD takes care of the continuous delivery aspect of CI/CD. Continuous integration is handled by a CI tool such as GitLab CI/CD, Jenkins, Tekton or GitHub Actions. The core of Argo CD consists of a Kubernetes controller, which continuously compares the live-state with the desired-state. The live-state is tapped from the Kubernetes API, and the desired-state is persisted in the form of manifests in YAML or JSON in a Git repository. Argo CD helps to point out deviations of the states, to display the deviations or to autonomously restore the desired state. @@ -39,7 +39,6 @@ Kubernetes manifests can be specified in several ways: * [kustomize](https://kustomize.io/) applications * [helm](https://helm.sh/) charts -* [ksonnet](https://github.com/ksonnet/ksonnet) applications (deprecated) * [jsonnet](https://jsonnet.org/) files * Plain directory of YAML/json manifests * Any custom config management tool configured as a config management plugin @@ -49,6 +48,7 @@ Argo CD automates the deployment of the desired application states in the specif For a quick 10 minute overview of Argo CD, check out the demo presented to the Sig Apps community meeting: {{< youtube aWDIQMbp1cc >}} +{{% /onlyWhenNot %}} ## Argo CD Architecture @@ -79,7 +79,7 @@ The repository server is an internal service which maintains a local cache of th * repository URL * revision (commit, tag, branch) * application path -* template specific settings: parameters, ksonnet environments, helm values.yaml +* template specific settings: parameters, helm values.yaml ### Application Controller diff --git a/content/en/docs/additional/_index.md b/content/en/docs/additional/_index.md index 5370c43..97d0ab7 100644 --- a/content/en/docs/additional/_index.md +++ b/content/en/docs/additional/_index.md @@ -1,8 +1,7 @@ --- -title: "9. Additional Concepts" -weight: 90 -sectionnumber: 9 -onlyWhenNot: techlab +title: "Additional Concepts" +weight: 9 +onlyWhen: additional-concepts --- In this chapter you'll learn additional concepts of ArgoCD diff --git a/content/en/docs/additional/backup_restore.md b/content/en/docs/additional/backup_restore.md index 809f01b..ae04346 100644 --- a/content/en/docs/additional/backup_restore.md +++ b/content/en/docs/additional/backup_restore.md @@ -1,8 +1,7 @@ --- -title: "9.2 Backup and Restore" -weight: 902 -sectionnumber: 9.2 -onlyWhenNot: techlab +title: "Backup and Restore" +weight: 92 +onlyWhen: backup-and-restore --- {{% alert title="Warning" color="warning" %}} diff --git a/content/en/docs/additional/orphaned_resources.md b/content/en/docs/additional/orphaned_resources.md index 71b03c8..eb0afbe 100644 --- a/content/en/docs/additional/orphaned_resources.md +++ b/content/en/docs/additional/orphaned_resources.md @@ -1,15 +1,15 @@ --- -title: "9.1 Orphaned Resources" -weight: 901 -sectionnumber: 9.1 -onlyWhenNot: techlab +title: "Orphaned Resources" +weight: 91 +onlyWhen: orphaned-resources --- This lab contains demonstrates how to find orphaned top-level resources with Argo CD. Orphaned resources are not managed by Argo CD and could be potentially removed from cluster. -## Task {{% param sectionnumber %}}.1: Create application and project +## {{% task %}} Create application and project +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app create argo-$USER --repo https://github.com/acend/argocd-training-examples.git --path 'example-app' --dest-server https://kubernetes.default.svc --dest-namespace $USER argocd app sync argo-$USER @@ -24,6 +24,52 @@ Enable visualization and monitoring of Orphaned Resources for the newly created ```bash argocd proj set apps-$USER --orphaned-resources --orphaned-resources-warn ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Create a file `application.yaml` with the following content and apply it: + +```yaml +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: argo-$USER + namespace: {{% param argoInfraNamespace %}} +spec: + project: apps-$USER + source: + repoURL: https://github.com/acend/argocd-training-examples.git + targetRevision: HEAD + path: example-app + destination: + server: https://kubernetes.default.svc + namespace: $USER +``` + +Create a file `appproject.yaml` with the following content and apply it: + +```yaml +apiVersion: argoproj.io/v1alpha1 +kind: AppProject +metadata: + name: apps-$USER + namespace: {{% param argoInfraNamespace %}} +spec: + sourceRepos: + - '*' + destinations: + - server: '*' + namespace: '*' + orphanedResources: + warn: true +``` + +```bash +{{% param cliToolName %}} apply -f appproject.yaml +{{% param cliToolName %}} apply -f application.yaml +``` + +Open the [Argo CD UI](https://{{% param argoCdUrl %}}) and click **Sync** on the `argo-$USER` application. +{{% /onlyWhen %}} {{% alert title="Note" color="info" %}} The flag `--orphaned-resources` enables the determinability of orphaned resources in Argo CD. After a refresh you will see them in the user interface on the project when selecting the checkbox _Orphaned Resources_. @@ -31,9 +77,10 @@ With the flag `--orphaned-resources-warn` enabled, for each Argo CD application {{% /alert %}} -## Task {{% param sectionnumber %}}.2: Assign application to project +## {{% task %}} Assign application to project Assign application to newly created project +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app set argo-$USER --project apps-$USER ``` @@ -47,9 +94,13 @@ Refresh the application ```bash argocd app get --refresh argo-$USER ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +The application is already assigned to the project in the `application.yaml` from the previous task (`project: apps-$USER`). Open the [Argo CD UI](https://{{% param argoCdUrl %}}) and click **Refresh** on the `argo-$USER` application to verify the project assignment. +{{% /onlyWhen %}} -## Task {{% param sectionnumber %}}.3: Create orphaned resource +## {{% task %}} Create orphaned resource Now create the orphan service `black-hole` in the same target namespace the Argo CD application has: @@ -72,6 +123,7 @@ This service will be detected as orphaned resource because it is not managed by Print all resources +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app resources argo-$USER ``` @@ -95,15 +147,27 @@ CONDITION MESSAGE LAST TRANSITION OrphanedResourceWarning Application has 1 orphaned resources 2021-09-02 16:20:36 +0200 CEST ... ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +Open the [Argo CD UI](https://{{% param argoCdUrl %}}) and click **Refresh** on the `argo-$USER` application. Navigate to the application details — you will see the `black-hole` service listed as an orphaned resource with an `OrphanedResourceWarning`. +{{% /onlyWhen %}} -## Task {{% param sectionnumber %}}.4: Housekeeping +## {{% task %}} Housekeeping Clean up the resources created in this lab +{{% onlyWhenNot no-argocd-cli %}} ```bash argocd app delete argo-$USER -y argocd proj delete apps-$USER ``` +{{% /onlyWhenNot %}} +{{% onlyWhen no-argocd-cli %}} +```bash +{{% param cliToolName %}} delete application argo-$USER -n {{% param argoInfraNamespace %}} +{{% param cliToolName %}} delete appproject apps-$USER -n {{% param argoInfraNamespace %}} +``` +{{% /onlyWhen %}} Find more detailed information about [Orphaned Resources in the docs](https://argoproj.github.io/argo-cd/user-guide/orphaned-resources/). diff --git a/content/en/setup/_index.md b/content/en/setup/_index.md index 6f99a8a..2359adf 100644 --- a/content/en/setup/_index.md +++ b/content/en/setup/_index.md @@ -16,19 +16,29 @@ In this Training its required to have the following tools locally installed on y * git * git bash on Windows +{{% onlyWhenNot no-argocd-cli %}} * Argo CD CLI +{{% /onlyWhenNot %}} +{{% onlyWhen openshift %}} * oc Tool (OpenShift Client) *Only when on OpenShift* +{{% /onlyWhen %}} * kubectl +{{% onlyWhenNot no-argocd-cli %}} + ## Argo CD Command line tool Follow the instructions on [this](https://argoproj.github.io/argo-cd/cli_installation/) page to install the ArgoCD tool on your local computer. +{{% /onlyWhenNot %}} + +{{% onlyWhen openshift %}} ## oc tool Follow the instructions on [this](https://openshift-basics.training.acend.ch/setup/) page to install the oc tool on your local computer. +{{% /onlyWhen %}} ## kubectl diff --git a/go.mod b/go.mod index bc14378..6f0a31a 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( github.com/FortAwesome/Font-Awesome v0.0.0-20240716171331-37eff7fa00de // indirect - github.com/acend/docsy-acend v1.0.0 // indirect + github.com/acend/docsy-acend v1.2.0 // indirect github.com/acend/docsy-plus v1.2.0 // indirect github.com/google/docsy v0.11.0 // indirect github.com/google/docsy/dependencies v0.7.2 // indirect diff --git a/go.sum b/go.sum index 73a8d52..c92bf0f 100644 --- a/go.sum +++ b/go.sum @@ -4,6 +4,7 @@ github.com/FortAwesome/Font-Awesome v0.0.0-20230327165841-0698449d50f2/go.mod h1 github.com/FortAwesome/Font-Awesome v0.0.0-20240108205627-a1232e345536 h1:LFS9LpoSZYhxQ6clU0NIVbaGR08BlxAs4b+9W+7IGVQ= github.com/FortAwesome/Font-Awesome v0.0.0-20240108205627-a1232e345536/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo= github.com/FortAwesome/Font-Awesome v0.0.0-20240402185447-c0f460dca7f7/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo= +github.com/FortAwesome/Font-Awesome v0.0.0-20240716171331-37eff7fa00de h1:JvHOfdSqvArF+7cffH9oWU8oLhn6YFYI60Pms8M/6tI= github.com/FortAwesome/Font-Awesome v0.0.0-20240716171331-37eff7fa00de/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo= github.com/acend/docsy-acend v0.0.0-20220406070448-8027986336dc h1:kNDPVcZCXsbJxqDstPoesa9YqWx84BVowj9cgxG6dnE= github.com/acend/docsy-acend v0.0.0-20220406070448-8027986336dc/go.mod h1:92hTJB3aPssEooTK+gv0i84vwTjah30HKaLGdupJaPA= @@ -11,6 +12,8 @@ github.com/acend/docsy-acend v0.0.0-20230301101952-9253f0a31c68 h1:trqoLzVYYvjHq github.com/acend/docsy-acend v0.0.0-20230301101952-9253f0a31c68/go.mod h1:h8XZkPe1VufdOQfFXcLVQ7FvOJyIMKr8rJcSvWStG2g= github.com/acend/docsy-acend v1.0.0 h1:TwmHoH3z6lh5zcNj6zUpMP4lYOhQ+OOgcbBwr7AqVoo= github.com/acend/docsy-acend v1.0.0/go.mod h1:h8XZkPe1VufdOQfFXcLVQ7FvOJyIMKr8rJcSvWStG2g= +github.com/acend/docsy-acend v1.2.0 h1:bF9sc93VlAde9QFv+ieCAbZFGeNVj+YgEaBq8v7wsSU= +github.com/acend/docsy-acend v1.2.0/go.mod h1:h8XZkPe1VufdOQfFXcLVQ7FvOJyIMKr8rJcSvWStG2g= github.com/acend/docsy-plus v0.0.0-20221209092845-53bb58a32d13 h1:F/3yfoHP+4ljnpRnVZN1bBzgizvhCbj5WDtcj75RAFE= github.com/acend/docsy-plus v0.0.0-20221209092845-53bb58a32d13/go.mod h1:YDHqf+DCZcx5HvKGzaBluPmLfgHQ2GKkYjggvF98jR4= github.com/acend/docsy-plus v0.0.0-20230301142542-2164d6c7e428 h1:5GlTHYZ3W7/LWRD9G5aZHXdRnwb7zkgjR6gqCopLGMk= @@ -20,6 +23,7 @@ github.com/acend/docsy-plus v1.0.0 h1:Ag2xQv15gwqPnsvWSBP8GKAnRrctVkADwaG3Qymt5w github.com/acend/docsy-plus v1.0.0/go.mod h1:YDHqf+DCZcx5HvKGzaBluPmLfgHQ2GKkYjggvF98jR4= github.com/acend/docsy-plus v1.1.0 h1:MgHPR3YRPrJSWtMS3eQKJivdCEwFHCIKD0jChsZS3SM= github.com/acend/docsy-plus v1.1.0/go.mod h1:LPbI0Ljrhzt0YHUg8qozWVUXjrMVI1cFVPn3TyQxbcY= +github.com/acend/docsy-plus v1.2.0 h1:MJaMdkqXU6ws7A+6Lzhx4qGvncifund3NF44Tzs7iVM= github.com/acend/docsy-plus v1.2.0/go.mod h1:LPbI0Ljrhzt0YHUg8qozWVUXjrMVI1cFVPn3TyQxbcY= github.com/google/docsy v0.4.0 h1:Eyt2aiDC1fnw/Qq/9xnIqUU5n5Yyk4c8gX3nBDdTv/4= github.com/google/docsy v0.4.0/go.mod h1:vJjGkHNaw9bO42gpFTWwAUzHZWZEVlK46Kx7ikY5c7Y= @@ -28,6 +32,7 @@ github.com/google/docsy v0.6.0/go.mod h1:VKKLqD8PQ7AglJc98yBorATfW7GrNVsn0kGXVYF github.com/google/docsy v0.9.1 h1:+jqges1YCd+yHeuZ1BUvD8V8mEGVtPxULg5j/vaJ984= github.com/google/docsy v0.9.1/go.mod h1:saOqKEUOn07Bc0orM/JdIF3VkOanHta9LU5Y53bwN2U= github.com/google/docsy v0.10.0/go.mod h1:c0nIAqmRTOuJ01F85U/wJPQtc3Zj9N58Kea9bOT2AJc= +github.com/google/docsy v0.11.0 h1:QnV40cc28QwS++kP9qINtrIv4hlASruhC/K3FqkHAmM= github.com/google/docsy v0.11.0/go.mod h1:hGGW0OjNuG5ZbH5JRtALY3yvN8ybbEP/v2iaK4bwOUI= github.com/google/docsy/dependencies v0.4.0 h1:FXwyjtuFfPIPBauU2t7uIAgS6VYfJf+OD5pzxGvkQsQ= github.com/google/docsy/dependencies v0.4.0/go.mod h1:2zZxHF+2qvkyXhLZtsbnqMotxMukJXLaf8fAZER48oo= @@ -45,4 +50,5 @@ github.com/twbs/bootstrap v5.2.3+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspT github.com/twbs/bootstrap v5.3.3+incompatible h1:goFoqinzdHfkeegpFP7pvhbd0g+A3O2hbU3XCjuNrEQ= github.com/twbs/bootstrap v5.3.3+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0= github.com/twbs/bootstrap v5.3.6+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0= +github.com/twbs/bootstrap v5.3.7+incompatible h1:ea1W8TOWZFkqSK2M0McpgzLiUQVru3bz8aHb0j/XtuM= github.com/twbs/bootstrap v5.3.7+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0= diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index d54f8aa..4989028 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -38,6 +38,18 @@ acendTraining: secretOverride: acend-wildcard appname: argocd-basics domain: training.puzzle.ch + - + name: centris + replicaCount: 2 + image: + repository: quay.io/acend/argocd-basics-training + pullPolicy: Always + tag: "" + tagsuffix: "-centris" + ingress: + secretOverride: acend-wildcard + appname: argocd-centris + domain: training.acend.ch nameOverride: "acend-argocd-basics"