Browse Source

Tidy up the examples repo + add a Helm hooks examples (#40)

pull/44/head
Alex Collins 5 years ago
committed by GitHub
parent
commit
94ad32f4ea
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      apps/templates/helm-guestbook.yaml
  2. 8
      apps/templates/helm-hooks.yaml
  3. 4
      apps/templates/kustomize-guestbook.yaml
  4. 27
      apps/templates/namespaces.yaml
  5. 8
      apps/templates/sync-waves.yaml
  6. 1
      apps/values.yaml
  7. 82
      helm-hooks/manifests.yaml
  8. 8
      sync-waves/manifests.yaml

4
apps/templates/helm-guestbook.yaml

@ -7,12 +7,12 @@ metadata:
- resources-finalizer.argocd.argoproj.io - resources-finalizer.argocd.argoproj.io
spec: spec:
destination: destination:
namespace: argocd namespace: helm-guestbook
server: {{ .Values.spec.destination.server }} server: {{ .Values.spec.destination.server }}
project: default project: default
source: source:
path: helm-guestbook path: helm-guestbook
repoURL: https://github.com/argoproj/argocd-example-apps repoURL: {{ .Values.spec.source.repoURL }}
targetRevision: {{ .Values.spec.source.targetRevision }} targetRevision: {{ .Values.spec.source.targetRevision }}
syncPolicy: syncPolicy:
automated: automated:

8
apps/templates/guestbook.yaml → apps/templates/helm-hooks.yaml

@ -1,18 +1,18 @@
apiVersion: argoproj.io/v1alpha1 apiVersion: argoproj.io/v1alpha1
kind: Application kind: Application
metadata: metadata:
name: guestbook name: helm-hooks
namespace: argocd namespace: argocd
finalizers: finalizers:
- resources-finalizer.argocd.argoproj.io - resources-finalizer.argocd.argoproj.io
spec: spec:
destination: destination:
namespace: argocd namespace: helm-hooks
server: {{ .Values.spec.destination.server }} server: {{ .Values.spec.destination.server }}
project: default project: default
source: source:
path: guestbook path: helm-hooks
repoURL: https://github.com/argoproj/argocd-example-apps repoURL: {{ .Values.spec.source.repoURL }}
targetRevision: {{ .Values.spec.source.targetRevision }} targetRevision: {{ .Values.spec.source.targetRevision }}
syncPolicy: syncPolicy:
automated: automated:

4
apps/templates/kustomize-guestbook.yaml

@ -7,12 +7,12 @@ metadata:
- resources-finalizer.argocd.argoproj.io - resources-finalizer.argocd.argoproj.io
spec: spec:
destination: destination:
namespace: argocd namespace: kustomize-guestbook
server: {{ .Values.spec.destination.server }} server: {{ .Values.spec.destination.server }}
project: default project: default
source: source:
path: kustomize-guestbook path: kustomize-guestbook
repoURL: https://github.com/argoproj/argocd-example-apps repoURL: {{ .Values.spec.source.repoURL }}
targetRevision: {{ .Values.spec.source.targetRevision }} targetRevision: {{ .Values.spec.source.targetRevision }}
syncPolicy: syncPolicy:
automated: automated:

27
apps/templates/namespaces.yaml

@ -0,0 +1,27 @@
apiVersion: v1
kind: Namespace
metadata:
name: helm-guestbook
annotations:
argocd.argoproj.io/sync-wave: "-1"
---
apiVersion: v1
kind: Namespace
metadata:
name: helm-hooks
annotations:
argocd.argoproj.io/sync-wave: "-1"
---
apiVersion: v1
kind: Namespace
metadata:
name: kustomize-guestbook
annotations:
argocd.argoproj.io/sync-wave: "-1"
---
apiVersion: v1
kind: Namespace
metadata:
name: sync-waves
annotations:
argocd.argoproj.io/sync-wave: "-1"

8
apps/templates/helm-dependency.yaml → apps/templates/sync-waves.yaml

@ -1,18 +1,18 @@
apiVersion: argoproj.io/v1alpha1 apiVersion: argoproj.io/v1alpha1
kind: Application kind: Application
metadata: metadata:
name: helm-dependency name: sync-waves
namespace: argocd namespace: argocd
finalizers: finalizers:
- resources-finalizer.argocd.argoproj.io - resources-finalizer.argocd.argoproj.io
spec: spec:
destination: destination:
namespace: argocd namespace: sync-waves
server: {{ .Values.spec.destination.server }} server: {{ .Values.spec.destination.server }}
project: default project: default
source: source:
path: helm-dependency path: sync-waves
repoURL: https://github.com/argoproj/argocd-example-apps repoURL: {{ .Values.spec.source.repoURL }}
targetRevision: {{ .Values.spec.source.targetRevision }} targetRevision: {{ .Values.spec.source.targetRevision }}
syncPolicy: syncPolicy:
automated: automated:

1
apps/values.yaml

@ -2,4 +2,5 @@ spec:
destination: destination:
server: https://kubernetes.default.svc server: https://kubernetes.default.svc
source: source:
repoURL: https://github.com/argoproj/argocd-example-apps
targetRevision: HEAD targetRevision: HEAD

82
helm-hooks/manifests.yaml

@ -0,0 +1,82 @@
---
apiVersion: batch/v1
kind: Job
metadata:
generateName: upgrade-sql-schema
annotations:
helm.sh/hook: pre-install
helm.sh/hook-weight: "-2"
spec:
template:
spec:
containers:
- name: upgrade-sql-schema
image: alpine:latest
command: ["sleep", "5"]
restartPolicy: Never
---
apiVersion: batch/v1
kind: Job
metadata:
name: maint-page-up
annotations:
helm.sh/hook: pre-install
helm.sh/hook-delete-policy: before-hook-creation
helm.sh/hook-weight: "-1"
spec:
template:
spec:
containers:
- name: page-up
image: alpine:latest
command: ["sleep", "2"]
restartPolicy: Never
backoffLimit: 0
---
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: frontend
spec:
replicas: 1
selector:
matchLabels:
tier: frontend
template:
metadata:
labels:
tier: frontend
spec:
containers:
- name: main
image: nginx:latest
---
apiVersion: v1
kind: Service
metadata:
name: frontend
annotations:
helm.sh/hook-weight: "2"
spec:
selector:
tier: frontend
ports:
- protocol: TCP
port: 80
targetPort: 80
---
apiVersion: batch/v1
kind: Job
metadata:
name: maint-page-down
annotations:
helm.sh/hook: post-install
helm.sh/hook-delete-policy: before-hook-creation
spec:
template:
spec:
containers:
- name: page-down
image: alpine:latest
command: ["sleep", "2"]
restartPolicy: Never

8
sync-waves/manifests.yaml

@ -47,10 +47,10 @@ spec:
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
generateName: maint-page-up- name: maint-page-up
annotations: annotations:
argocd.argoproj.io/hook: Sync argocd.argoproj.io/hook: Sync
argocd.argoproj.io/hook-delete-policy: HookSucceeded argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
argocd.argoproj.io/sync-wave: "1" argocd.argoproj.io/sync-wave: "1"
spec: spec:
template: template:
@ -99,10 +99,10 @@ spec:
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
generateName: maint-page-down- name: maint-page-down
annotations: annotations:
argocd.argoproj.io/hook: Sync argocd.argoproj.io/hook: Sync
argocd.argoproj.io/hook-delete-policy: HookSucceeded argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
argocd.argoproj.io/sync-wave: "3" argocd.argoproj.io/sync-wave: "3"
spec: spec:
template: template:

Loading…
Cancel
Save