### Install Argo CD with argocd-lovely-plugin Source: https://github.com/crumbhole/argocd-lovely-plugin/blob/main/examples/applicationsets/README.md Follow these steps to install Argo CD and the argocd-lovely-plugin. Port-forwarding the server and retrieving the admin password are optional for UI access. ```bash cd examples/installation/argocd kubectl apply -k . kubectl port-forward svc/argocd-server -n argocd 8080:443 kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo ``` -------------------------------- ### Delete Argo CD ApplicationSet and Example Namespace Source: https://github.com/crumbhole/argocd-lovely-plugin/blob/main/examples/applicationsets/README.md Clean up the deployed Argo CD ApplicationSet and the example namespace after completing the demonstration. ```bash kubectl delete -n argocd -f https://raw.githubusercontent.com/crumbhole/argocd-lovely-plugin/main/examples/applicationsets/applicationset.yaml && kubectl delete namespace example ``` -------------------------------- ### ytt Templated Manifest Example Source: https://github.com/crumbhole/argocd-lovely-plugin/blob/main/doc/ytt.md An example of a Kubernetes Deployment manifest that uses ytt templating. It demonstrates how to load data values and use them within YAML structure, specifically for container names. ```yaml #@ load("@ytt:data", "data") #@yaml/text-templated-strings --- apiVersion: apps/v1 kind: Deployment metadata: name: test-ytt spec: selector: matchLabels: app: test-ytt template: metadata: labels: app: test-ytt spec: containers: - name: test-pod-(@= data.values.your_env_var_name @) image: docker.io/nicolaka/netshoot command: ["sleep"] args: ["infinity"] ``` -------------------------------- ### Verify Service Account Name Source: https://github.com/crumbhole/argocd-lovely-plugin/blob/main/examples/applicationsets/README.md Check the Service Accounts in the 'example' namespace to confirm the name of the ServiceAccount used for the deployment, which should reflect the cluster name. ```bash kubectl -n example get serviceAccounts ``` -------------------------------- ### Apply Multiple Helm Charts Application Source: https://github.com/crumbhole/argocd-lovely-plugin/blob/main/examples/multiple-helm-charts/README.md Applies a Kubernetes manifest that defines an ArgoCD application deploying two Helm charts: nginx and a Hello World example. ```bash kubectl apply -n argocd -f https://raw.githubusercontent.com/crumbhole/argocd-lovely-plugin/main/examples/multiple-helm-charts/argocd-application/hello-nginx-world.yml ``` -------------------------------- ### YAML Preprocessor with Shell Command Source: https://github.com/crumbhole/argocd-lovely-plugin/blob/main/test/preprocessing_bydir_fallback/env.txt Use `LOVELY_PREPROCESSORS_YAML` to define preprocessing steps as a YAML multi-line string. Each string within the YAML list is treated as a shell command. This example uses `sed` to replace text in `.yaml` files. ```yaml LOVELY_PREPROCESSORS_YAML: |- abc: - "sed -i 's/minimal/chicken/g' *.yaml" ``` -------------------------------- ### Configure Generic Plugins with Comma-Delimited List Source: https://github.com/crumbhole/argocd-lovely-plugin/blob/main/doc/plugins.md Set this environment variable with an ordered, comma-delimited list of programs to be used as generic plugins. The order dictates execution. ```bash plugin1, plugin2 ``` -------------------------------- ### Apply Kustomize-Helm Application Source: https://github.com/crumbhole/argocd-lovely-plugin/blob/main/examples/kustomize-helm/README.md Applies the Kustomize-Helm application manifest and waits for the deployment to become available. This step integrates Helm charts with Kustomize overlays using the plugin. ```bash kubectl apply -n argocd -f https://raw.githubusercontent.com/crumbhole/argocd-lovely-plugin/main/examples/kustomize-helm/application/kustomize-helm.yml kubectl -n helm-plus-additions wait deployment helm-plus-additions-hello-world --for condition=Available=True ``` -------------------------------- ### Get Application URL with Ingress Source: https://github.com/crumbhole/argocd-lovely-plugin/blob/main/test/helm_local/charts/hello-world/templates/NOTES.txt Use this when Ingress is enabled to construct the application's URL. ```go-template {{- if .Values.ingress.enabled }} {{- range $host := .Values.ingress.hosts }} {{- range .paths }} http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} {{- end }} {{- end }} {{- end }} ``` -------------------------------- ### Get Application URL with NodePort Source: https://github.com/crumbhole/argocd-lovely-plugin/blob/main/test/helm_local/charts/hello-world/templates/NOTES.txt Use this when the service type is NodePort to retrieve the NodePort and Node IP to form the application URL. ```bash export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "hello-world.fullname" . }}) export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT ``` -------------------------------- ### Configure ytt as a Plugin Source: https://github.com/crumbhole/argocd-lovely-plugin/blob/main/doc/ytt.md Use this configuration to run ytt as a direct plugin instead of a preprocessor. Omit the `--output-files .` argument so that ytt writes the rendered manifest to stdout. ```yaml source: plugin: parameters: - name: lovely_plugins string: ytt --data-values-env=ARGOCD_ENV --file . ``` -------------------------------- ### Shell Command Preprocessor Source: https://github.com/crumbhole/argocd-lovely-plugin/blob/main/test/preprocessing_bydir_fallback/env.txt Use `LOVELY_PREPROCESSORS` to define shell commands for preprocessing files. This example uses `sed` to replace text in all `.yaml` files in the current directory. ```shell LOVELY_PREPROCESSORS: sed -i 's/minimal/foobar/g' *.yaml ``` -------------------------------- ### Modify Chart.yaml with sed and yq Source: https://github.com/crumbhole/argocd-lovely-plugin/blob/main/test/preprocessor/env.txt Use `sed` to perform string replacements and `yq` to modify YAML structures within `Chart.yaml`. Ensure `sed` and `yq` are installed and accessible in your environment. ```bash sed -i 's/replaceme/hello-world/g' Chart.yaml ``` ```bash yq -i '.dependencies[0].version="0.1.0"' Chart.yaml ``` -------------------------------- ### Access Application with ClusterIP and Port Forwarding Source: https://github.com/crumbhole/argocd-lovely-plugin/blob/main/test/helm_local/charts/hello-world/templates/NOTES.txt Use this when the service type is ClusterIP. It retrieves the pod name and container port, then sets up port forwarding to access the application via localhost. ```bash export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "hello-world.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") echo "Visit http://127.0.0.1:8080 to use your application" kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT ```