├── helm ├── templates │ └── namespace.yaml └── Chart.yaml ├── README.md ├── apps-manual.yaml ├── apps.yaml ├── project.yaml └── preview.yaml /helm/templates/namespace.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: previews 5 | 6 | -------------------------------------------------------------------------------- /helm/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | description: Previews environment 3 | name: previews 4 | version: "0.1.0" 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Sample Code For Preview Environments With Argo CD 2 | 3 | * [Environments Based On Pull Requests (PRs): Using Argo CD To Apply GitOps Principles On Previews](https://youtu.be/cpAaI8p4R60) 4 | 5 | 6 | -------------------------------------------------------------------------------- /apps-manual.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: argoproj.io/v1alpha1 2 | kind: Application 3 | metadata: 4 | name: previews 5 | namespace: argocd 6 | finalizers: 7 | - resources-finalizer.argocd.argoproj.io 8 | spec: 9 | project: previews 10 | source: 11 | repoURL: https://github.com/vfarcic/argocd-previews.git 12 | targetRevision: HEAD 13 | path: helm 14 | destination: 15 | server: https://kubernetes.default.svc 16 | namespace: previews 17 | -------------------------------------------------------------------------------- /apps.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: argoproj.io/v1alpha1 2 | kind: Application 3 | metadata: 4 | name: previews 5 | namespace: argocd 6 | finalizers: 7 | - resources-finalizer.argocd.argoproj.io 8 | spec: 9 | project: previews 10 | source: 11 | repoURL: https://github.com/puppetlabs/argocd-previews.git 12 | targetRevision: HEAD 13 | path: helm 14 | destination: 15 | server: https://kubernetes.default.svc 16 | namespace: previews 17 | syncPolicy: 18 | automated: 19 | selfHeal: true 20 | prune: true 21 | -------------------------------------------------------------------------------- /project.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: argoproj.io/v1alpha1 2 | kind: AppProject 3 | metadata: 4 | name: previews 5 | namespace: argocd 6 | finalizers: 7 | - resources-finalizer.argocd.argoproj.io 8 | spec: 9 | description: Previews 10 | sourceRepos: 11 | - '*' 12 | destinations: 13 | - namespace: previews 14 | server: https://kubernetes.default.svc 15 | - namespace: "pr-*" 16 | server: https://kubernetes.default.svc 17 | - namespace: argocd 18 | server: https://kubernetes.default.svc 19 | clusterResourceWhitelist: 20 | - group: '' 21 | kind: Namespace 22 | namespaceResourceWhitelist: 23 | - group: "*" 24 | kind: "*" 25 | 26 | -------------------------------------------------------------------------------- /preview.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: argoproj.io/v1alpha1 2 | kind: Application 3 | metadata: 4 | name: "{{.APP_ID}}" 5 | namespace: argocd 6 | finalizers: 7 | - resources-finalizer.argocd.argoproj.io 8 | spec: 9 | project: previews 10 | source: 11 | path: helm 12 | repoURL: https://github.com/vfarcic/{{.REPO}}.git 13 | targetRevision: HEAD 14 | helm: 15 | values: | 16 | image: 17 | tag: "{{.IMAGE_TAG}}" 18 | ingress: 19 | host: "{{.HOSTNAME}}" 20 | version: v3 21 | destination: 22 | namespace: "{{.APP_ID}}" 23 | server: https://kubernetes.default.svc 24 | syncPolicy: 25 | automated: 26 | selfHeal: true 27 | prune: true 28 | syncOptions: 29 | - CreateNamespace=true 30 | --------------------------------------------------------------------------------