Browse Source

asdsad

pull/139/head
alliot-qima 3 years ago
parent
commit
66fe34991c
  1. 42
      README.md
  2. 46
      apps/Chart.yaml
  3. 32
      apps/templates/helm-guestbook.yaml
  4. 34
      apps/templates/helm-hooks.yaml
  5. 32
      apps/templates/kustomize-guestbook.yaml
  6. 54
      apps/templates/namespaces.yaml
  7. 32
      apps/templates/sync-waves.yaml
  8. 10
      apps/values.yaml
  9. 42
      blue-green/.helmignore
  10. 46
      blue-green/Chart.yaml
  11. 60
      blue-green/README.md
  12. 38
      blue-green/templates/NOTES.txt
  13. 64
      blue-green/templates/_helpers.tpl
  14. 112
      blue-green/templates/rollout.yaml
  15. 80
      blue-green/templates/services.yaml
  16. 90
      blue-green/values.yaml
  17. 0
      branchtest
  18. 40
      guestbook/guestbook-ui-deployment.yaml
  19. 20
      guestbook/guestbook-ui-svc.yaml
  20. 54
      helm-dependency/Chart.yaml
  21. 108
      helm-dependency/README.md
  22. 24
      helm-dependency/values-nomaria.yaml
  23. 14
      helm-dependency/values.yaml
  24. 42
      helm-guestbook/.helmignore
  25. 46
      helm-guestbook/Chart.yaml
  26. 38
      helm-guestbook/templates/NOTES.txt
  27. 64
      helm-guestbook/templates/_helpers.tpl
  28. 104
      helm-guestbook/templates/deployment.yaml
  29. 38
      helm-guestbook/templates/service.yaml
  30. 4
      helm-guestbook/values-production.yaml
  31. 90
      helm-guestbook/values.yaml
  32. 164
      helm-hooks/manifests.yaml
  33. 130
      jsonnet-guestbook-tla/guestbook-ui.jsonnet
  34. 118
      jsonnet-guestbook/guestbook-ui.jsonnet
  35. 16
      jsonnet-guestbook/params.libsonnet
  36. 8
      ksonnet-guestbook/.gitignore
  37. 46
      ksonnet-guestbook/app.yaml
  38. 118
      ksonnet-guestbook/components/guestbook-ui.jsonnet
  39. 36
      ksonnet-guestbook/components/params.libsonnet
  40. 8
      ksonnet-guestbook/environments/base.libsonnet
  41. 2
      ksonnet-guestbook/environments/default/globals.libsonnet
  42. 16
      ksonnet-guestbook/environments/default/main.jsonnet
  43. 34
      ksonnet-guestbook/environments/default/params.libsonnet
  44. 2
      ksonnet-guestbook/environments/dev/globals.libsonnet
  45. 16
      ksonnet-guestbook/environments/dev/main.jsonnet
  46. 34
      ksonnet-guestbook/environments/dev/params.libsonnet
  47. 2
      ksonnet-guestbook/environments/prod/globals.libsonnet
  48. 16
      ksonnet-guestbook/environments/prod/main.jsonnet
  49. 34
      ksonnet-guestbook/environments/prod/params.libsonnet
  50. 40
      kustomize-guestbook/guestbook-ui-deployment.yaml
  51. 20
      kustomize-guestbook/guestbook-ui-svc.yaml
  52. 14
      kustomize-guestbook/kustomization.yaml
  53. 12
      plugins/README.md
  54. 4
      plugins/kasane/.gitignore
  55. 10
      plugins/kasane/Kasanefile
  56. 58
      plugins/kasane/README.md
  57. 18
      plugins/kasane/patch.jsonnet
  58. 6
      plugins/kustomized-helm/.gitignore
  59. 54
      plugins/kustomized-helm/Chart.yaml
  60. 62
      plugins/kustomized-helm/README.md
  61. 14
      plugins/kustomized-helm/kustomization.yaml
  62. 20
      plugins/kustomized-helm/overlays/guestbook-deployment.yaml
  63. 16
      pre-post-sync/kustomization.yaml
  64. 32
      pre-post-sync/post-sync-job.yaml
  65. 32
      pre-post-sync/pre-sync-job.yaml
  66. 82
      sock-shop/base/carts-db-dep.yaml
  67. 28
      sock-shop/base/carts-db-svc.yaml
  68. 128
      sock-shop/base/carts-dep.yaml
  69. 60
      sock-shop/base/catalogue-db-dep.yaml
  70. 28
      sock-shop/base/catalogue-db-svc.yaml
  71. 104
      sock-shop/base/catalogue-dep.yaml
  72. 28
      sock-shop/base/catalogue-svc.yaml
  73. 102
      sock-shop/base/front-end-dep.yaml
  74. 30
      sock-shop/base/front-end-svc.yaml
  75. 82
      sock-shop/base/orders-db-dep.yaml
  76. 28
      sock-shop/base/orders-db-svc.yaml
  77. 128
      sock-shop/base/orders-dep.yaml
  78. 28
      sock-shop/base/orders-svc.yaml
  79. 104
      sock-shop/base/payment-dep.yaml
  80. 28
      sock-shop/base/payment-svc.yaml
  81. 96
      sock-shop/base/queue-master-dep.yaml
  82. 32
      sock-shop/base/queue-master-svc.yaml
  83. 88
      sock-shop/base/rabbitmq-dep.yaml
  84. 38
      sock-shop/base/rabbitmq-svc.yaml
  85. 72
      sock-shop/base/session-db-dep.yaml
  86. 28
      sock-shop/base/session-db-svc.yaml
  87. 128
      sock-shop/base/shipping-dep.yaml
  88. 30
      sock-shop/base/shipping-svc.yaml
  89. 82
      sock-shop/base/user-db-dep.yaml
  90. 30
      sock-shop/base/user-db-svc.yaml
  91. 110
      sock-shop/base/user-dep.yaml
  92. 30
      sock-shop/base/user-svc.yaml
  93. 54
      sock-shop/kustomization.yaml
  94. 228
      sync-waves/manifests.yaml

42
README.md

@ -1,21 +1,21 @@
# ArgoCD Example Apps # ArgoCD Example Apps
This repository contains example applications for demoing ArgoCD functionality. Feel free This repository contains example applications for demoing ArgoCD functionality. Feel free
to register this repository to your ArgoCD instance, or fork this repo and push your own commits to register this repository to your ArgoCD instance, or fork this repo and push your own commits
to explore ArgoCD and GitOps! to explore ArgoCD and GitOps!
| Application | Description | | Application | Description |
|-------------|-------------| |-------------|-------------|
| [guestbook](guestbook/) | A hello word guestbook app as plain YAML | | [guestbook](guestbook/) | A hello word guestbook app as plain YAML |
| [ksonnet-guestbook](ksonnet-guestbook/) | The guestbook app as a ksonnet app | | [ksonnet-guestbook](ksonnet-guestbook/) | The guestbook app as a ksonnet app |
| [helm-guestbook](helm-guestbook/) | The guestbook app as a Helm chart | | [helm-guestbook](helm-guestbook/) | The guestbook app as a Helm chart |
| [jsonnet-guestbook](jsonnet-guestbook/) | The guestbook app as a raw jsonnet | | [jsonnet-guestbook](jsonnet-guestbook/) | The guestbook app as a raw jsonnet |
| [jsonnet-guestbook-tla](jsonnet-guestbook-tla/) | The guestbook app as a raw jsonnet with support for top level arguments | | [jsonnet-guestbook-tla](jsonnet-guestbook-tla/) | The guestbook app as a raw jsonnet with support for top level arguments |
| [kustomize-guestbook](kustomize-guestbook/) | The guestbook app as a Kustomize 2 app | | [kustomize-guestbook](kustomize-guestbook/) | The guestbook app as a Kustomize 2 app |
| [pre-post-sync](pre-post-sync/) | Demonstrates Argo CD PreSync and PostSync hooks | | [pre-post-sync](pre-post-sync/) | Demonstrates Argo CD PreSync and PostSync hooks |
| [sync-waves](sync-waves/) | Demonstrates Argo CD sync waves with hooks | | [sync-waves](sync-waves/) | Demonstrates Argo CD sync waves with hooks |
| [helm-dependency](helm-dependency/) | Demonstrates how to customize an OTS (off-the-shelf) helm chart from an upstream repo | | [helm-dependency](helm-dependency/) | Demonstrates how to customize an OTS (off-the-shelf) helm chart from an upstream repo |
| [sock-shop](sock-shop/) | A microservices demo app (https://microservices-demo.github.io) | | [sock-shop](sock-shop/) | A microservices demo app (https://microservices-demo.github.io) |
| [plugins](plugins/) | Apps which demonstrate config management plugins usage | | [plugins](plugins/) | Apps which demonstrate config management plugins usage |
| [blue-green](blue-green/) | Demonstrates how to implement blue-green deployment using [Argo Rollouts](https://github.com/argoproj/argo-rollouts) | [blue-green](blue-green/) | Demonstrates how to implement blue-green deployment using [Argo Rollouts](https://github.com/argoproj/argo-rollouts)
| [apps](apps/) | An app composed of other apps | | [apps](apps/) | An app composed of other apps |

46
apps/Chart.yaml

@ -1,23 +1,23 @@
apiVersion: v2 apiVersion: v2
name: applications name: applications
description: Applications description: Applications
# A chart can be either an 'application' or a 'library' chart. # A chart can be either an 'application' or a 'library' chart.
# #
# Application charts are a collection of templates that can be packaged into versioned archives # Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed. # to be deployed.
# #
# Library charts provide useful utilities or functions for the chart developer. They're included as # Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering # a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed. # pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application type: application
# This is the chart version. This version number should be incremented each time you make changes # This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version. # to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/) # Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0 version: 0.1.0
# This is the version number of the application being deployed. This version number should be # This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to # incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using. # follow Semantic Versioning. They should reflect the version the application is using.
appVersion: "1.0" appVersion: "1.0"

32
apps/templates/helm-guestbook.yaml

@ -1,16 +1,16 @@
apiVersion: argoproj.io/v1alpha1 apiVersion: argoproj.io/v1alpha1
kind: Application kind: Application
metadata: metadata:
name: helm-guestbook name: helm-guestbook
namespace: argocd namespace: argocd
finalizers: finalizers:
- resources-finalizer.argocd.argoproj.io - resources-finalizer.argocd.argoproj.io
spec: spec:
destination: destination:
namespace: helm-guestbook 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: {{ .Values.spec.source.repoURL }} repoURL: {{ .Values.spec.source.repoURL }}
targetRevision: {{ .Values.spec.source.targetRevision }} targetRevision: {{ .Values.spec.source.targetRevision }}

34
apps/templates/helm-hooks.yaml

@ -1,17 +1,17 @@
apiVersion: argoproj.io/v1alpha1 apiVersion: argoproj.io/v1alpha1
kind: Application kind: Application
metadata: metadata:
name: helm-hooks name: helm-hooks
namespace: argocd namespace: argocd
finalizers: finalizers:
- resources-finalizer.argocd.argoproj.io - resources-finalizer.argocd.argoproj.io
spec: spec:
destination: destination:
namespace: helm-hooks namespace: helm-hooks
server: {{ .Values.spec.destination.server }} server: {{ .Values.spec.destination.server }}
project: default project: default
source: source:
path: helm-hooks path: helm-hooks
repoURL: {{ .Values.spec.source.repoURL }} repoURL: {{ .Values.spec.source.repoURL }}
targetRevision: {{ .Values.spec.source.targetRevision }} targetRevision: {{ .Values.spec.source.targetRevision }}

32
apps/templates/kustomize-guestbook.yaml

@ -1,16 +1,16 @@
apiVersion: argoproj.io/v1alpha1 apiVersion: argoproj.io/v1alpha1
kind: Application kind: Application
metadata: metadata:
name: kustomize-guestbook name: kustomize-guestbook
namespace: argocd namespace: argocd
finalizers: finalizers:
- resources-finalizer.argocd.argoproj.io - resources-finalizer.argocd.argoproj.io
spec: spec:
destination: destination:
namespace: kustomize-guestbook 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: {{ .Values.spec.source.repoURL }} repoURL: {{ .Values.spec.source.repoURL }}
targetRevision: {{ .Values.spec.source.targetRevision }} targetRevision: {{ .Values.spec.source.targetRevision }}

54
apps/templates/namespaces.yaml

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

32
apps/templates/sync-waves.yaml

@ -1,16 +1,16 @@
apiVersion: argoproj.io/v1alpha1 apiVersion: argoproj.io/v1alpha1
kind: Application kind: Application
metadata: metadata:
name: sync-waves name: sync-waves
namespace: argocd namespace: argocd
finalizers: finalizers:
- resources-finalizer.argocd.argoproj.io - resources-finalizer.argocd.argoproj.io
spec: spec:
destination: destination:
namespace: sync-waves namespace: sync-waves
server: {{ .Values.spec.destination.server }} server: {{ .Values.spec.destination.server }}
project: default project: default
source: source:
path: sync-waves path: sync-waves
repoURL: {{ .Values.spec.source.repoURL }} repoURL: {{ .Values.spec.source.repoURL }}
targetRevision: {{ .Values.spec.source.targetRevision }} targetRevision: {{ .Values.spec.source.targetRevision }}

10
apps/values.yaml

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

42
blue-green/.helmignore

@ -1,21 +1,21 @@
# Patterns to ignore when building packages. # Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and # This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line. # negation (prefixed with !). Only one pattern per line.
.DS_Store .DS_Store
# Common VCS dirs # Common VCS dirs
.git/ .git/
.gitignore .gitignore
.bzr/ .bzr/
.bzrignore .bzrignore
.hg/ .hg/
.hgignore .hgignore
.svn/ .svn/
# Common backup files # Common backup files
*.swp *.swp
*.bak *.bak
*.tmp *.tmp
*~ *~
# Various IDEs # Various IDEs
.project .project
.idea/ .idea/
*.tmproj *.tmproj

46
blue-green/Chart.yaml

@ -1,23 +1,23 @@
apiVersion: v2 apiVersion: v2
name: helm-guestbook name: helm-guestbook
description: A Helm chart for Kubernetes description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart. # A chart can be either an 'application' or a 'library' chart.
# #
# Application charts are a collection of templates that can be packaged into versioned archives # Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed. # to be deployed.
# #
# Library charts provide useful utilities or functions for the chart developer. They're included as # Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering # a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed. # pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application type: application
# This is the chart version. This version number should be incremented each time you make changes # This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version. # to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/) # Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0 version: 0.1.0
# This is the version number of the application being deployed. This version number should be # This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to # incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using. # follow Semantic Versioning. They should reflect the version the application is using.
appVersion: "1.0" appVersion: "1.0"

60
blue-green/README.md

@ -1,30 +1,30 @@
# Blue Green # Blue Green
The blue green strategy is not supported by built-in Kubernetes Deployment but available via third-party Kubernetes controller. The blue green strategy is not supported by built-in Kubernetes Deployment but available via third-party Kubernetes controller.
This example demonstrates how to implement blue-green deployment via [Argo Rollouts](https://github.com/argoproj/argo-rollouts): This example demonstrates how to implement blue-green deployment via [Argo Rollouts](https://github.com/argoproj/argo-rollouts):
1. Install Argo Rollouts controller: https://github.com/argoproj/argo-rollouts#installation 1. Install Argo Rollouts controller: https://github.com/argoproj/argo-rollouts#installation
2. Create a sample application and sync it. 2. Create a sample application and sync it.
``` ```
argocd app create --name blue-green --repo https://github.com/argoproj/argocd-example-apps --dest-server https://kubernetes.default.svc --dest-namespace default --path blue-green && argocd app sync blue-green argocd app create --name blue-green --repo https://github.com/argoproj/argocd-example-apps --dest-server https://kubernetes.default.svc --dest-namespace default --path blue-green && argocd app sync blue-green
``` ```
Once the application is synced you can access it using `blue-green-helm-guestbook` service. Once the application is synced you can access it using `blue-green-helm-guestbook` service.
3. Change image version parameter to trigger blue-green deployment process: 3. Change image version parameter to trigger blue-green deployment process:
``` ```
argocd app set blue-green -p image.tag=0.2 && argocd app sync blue-green argocd app set blue-green -p image.tag=0.2 && argocd app sync blue-green
``` ```
Now application runs `ks-guestbook-demo:0.1` and `ks-guestbook-demo:0.2` images simultaneously. Now application runs `ks-guestbook-demo:0.1` and `ks-guestbook-demo:0.2` images simultaneously.
The `ks-guestbook-demo:0.2` is still considered `blue` available only via preview service `blue-green-helm-guestbook-preview`. The `ks-guestbook-demo:0.2` is still considered `blue` available only via preview service `blue-green-helm-guestbook-preview`.
4. Promote `ks-guestbook-demo:0.2` to `green` by patching `Rollout` resource: 4. Promote `ks-guestbook-demo:0.2` to `green` by patching `Rollout` resource:
``` ```
argocd app patch-resource blue-green --kind Rollout --resource-name blue-green-helm-guestbook --patch '{ "status": { "verifyingPreview": false } }' --patch-type 'application/merge-patch+json' argocd app patch-resource blue-green --kind Rollout --resource-name blue-green-helm-guestbook --patch '{ "status": { "verifyingPreview": false } }' --patch-type 'application/merge-patch+json'
``` ```
This promotes `ks-guestbook-demo:0.2` to `green` status and `Rollout` deletes old replica which runs `ks-guestbook-demo:0.1`. This promotes `ks-guestbook-demo:0.2` to `green` status and `Rollout` deletes old replica which runs `ks-guestbook-demo:0.1`.

38
blue-green/templates/NOTES.txt

@ -1,19 +1,19 @@
1. Get the application URL by running these commands: 1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }} {{- if .Values.ingress.enabled }}
{{- range .Values.ingress.hosts }} {{- range .Values.ingress.hosts }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
{{- end }} {{- end }}
{{- else if contains "NodePort" .Values.service.type }} {{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "helm-guestbook.fullname" . }}) export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "helm-guestbook.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }} {{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available. NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ template "helm-guestbook.fullname" . }}' You can watch the status of by running 'kubectl get svc -w {{ template "helm-guestbook.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "helm-guestbook.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "helm-guestbook.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.port }} echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }} {{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "helm-guestbook.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "helm-guestbook.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application" echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:80 kubectl port-forward $POD_NAME 8080:80
{{- end }} {{- end }}

64
blue-green/templates/_helpers.tpl

@ -1,32 +1,32 @@
{{/* vim: set filetype=mustache: */}} {{/* vim: set filetype=mustache: */}}
{{/* {{/*
Expand the name of the chart. Expand the name of the chart.
*/}} */}}
{{- define "helm-guestbook.name" -}} {{- define "helm-guestbook.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}} {{- end -}}
{{/* {{/*
Create a default fully qualified app name. Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name. If release name contains chart name it will be used as a full name.
*/}} */}}
{{- define "helm-guestbook.fullname" -}} {{- define "helm-guestbook.fullname" -}}
{{- if .Values.fullnameOverride -}} {{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}} {{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}} {{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}} {{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} {{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}} {{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{/* {{/*
Create chart name and version as used by the chart label. Create chart name and version as used by the chart label.
*/}} */}}
{{- define "helm-guestbook.chart" -}} {{- define "helm-guestbook.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}} {{- end -}}

112
blue-green/templates/rollout.yaml

@ -1,56 +1,56 @@
apiVersion: argoproj.io/v1alpha1 apiVersion: argoproj.io/v1alpha1
kind: Rollout kind: Rollout
metadata: metadata:
name: {{ template "helm-guestbook.fullname" . }} name: {{ template "helm-guestbook.fullname" . }}
labels: labels:
app: {{ template "helm-guestbook.name" . }} app: {{ template "helm-guestbook.name" . }}
chart: {{ template "helm-guestbook.chart" . }} chart: {{ template "helm-guestbook.chart" . }}
release: {{ .Release.Name }} release: {{ .Release.Name }}
heritage: {{ .Release.Service }} heritage: {{ .Release.Service }}
spec: spec:
replicas: {{ .Values.replicaCount }} replicas: {{ .Values.replicaCount }}
revisionHistoryLimit: 3 revisionHistoryLimit: 3
selector: selector:
matchLabels: matchLabels:
app: {{ template "helm-guestbook.name" . }} app: {{ template "helm-guestbook.name" . }}
release: {{ .Release.Name }} release: {{ .Release.Name }}
strategy: strategy:
blueGreen: blueGreen:
activeService: {{ template "helm-guestbook.fullname" . }} activeService: {{ template "helm-guestbook.fullname" . }}
previewService: {{ template "helm-guestbook.fullname" . }}-preview previewService: {{ template "helm-guestbook.fullname" . }}-preview
template: template:
metadata: metadata:
labels: labels:
app: {{ template "helm-guestbook.name" . }} app: {{ template "helm-guestbook.name" . }}
release: {{ .Release.Name }} release: {{ .Release.Name }}
spec: spec:
containers: containers:
- name: {{ .Chart.Name }} - name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }} imagePullPolicy: {{ .Values.image.pullPolicy }}
ports: ports:
- name: http - name: http
containerPort: 80 containerPort: 80
protocol: TCP protocol: TCP
livenessProbe: livenessProbe:
httpGet: httpGet:
path: / path: /
port: http port: http
readinessProbe: readinessProbe:
httpGet: httpGet:
path: / path: /
port: http port: http
resources: resources:
{{ toYaml .Values.resources | indent 12 }} {{ toYaml .Values.resources | indent 12 }}
{{- with .Values.nodeSelector }} {{- with .Values.nodeSelector }}
nodeSelector: nodeSelector:
{{ toYaml . | indent 8 }} {{ toYaml . | indent 8 }}
{{- end }} {{- end }}
{{- with .Values.affinity }} {{- with .Values.affinity }}
affinity: affinity:
{{ toYaml . | indent 8 }} {{ toYaml . | indent 8 }}
{{- end }} {{- end }}
{{- with .Values.tolerations }} {{- with .Values.tolerations }}
tolerations: tolerations:
{{ toYaml . | indent 8 }} {{ toYaml . | indent 8 }}
{{- end }} {{- end }}

80
blue-green/templates/services.yaml

@ -1,40 +1,40 @@
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: {{ template "helm-guestbook.fullname" . }} name: {{ template "helm-guestbook.fullname" . }}
labels: labels:
app: {{ template "helm-guestbook.name" . }} app: {{ template "helm-guestbook.name" . }}
chart: {{ template "helm-guestbook.chart" . }} chart: {{ template "helm-guestbook.chart" . }}
release: {{ .Release.Name }} release: {{ .Release.Name }}
heritage: {{ .Release.Service }} heritage: {{ .Release.Service }}
spec: spec:
type: {{ .Values.service.type }} type: {{ .Values.service.type }}
ports: ports:
- port: {{ .Values.service.port }} - port: {{ .Values.service.port }}
targetPort: http targetPort: http
protocol: TCP protocol: TCP
name: http name: http
selector: selector:
app: {{ template "helm-guestbook.name" . }} app: {{ template "helm-guestbook.name" . }}
release: {{ .Release.Name }} release: {{ .Release.Name }}
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: {{ template "helm-guestbook.fullname" . }}-preview name: {{ template "helm-guestbook.fullname" . }}-preview
labels: labels:
app: {{ template "helm-guestbook.name" . }} app: {{ template "helm-guestbook.name" . }}
chart: {{ template "helm-guestbook.chart" . }} chart: {{ template "helm-guestbook.chart" . }}
release: {{ .Release.Name }} release: {{ .Release.Name }}
heritage: {{ .Release.Service }} heritage: {{ .Release.Service }}
spec: spec:
type: {{ .Values.service.type }} type: {{ .Values.service.type }}
ports: ports:
- port: {{ .Values.service.port }} - port: {{ .Values.service.port }}
targetPort: http targetPort: http
protocol: TCP protocol: TCP
name: http name: http
selector: selector:
app: {{ template "helm-guestbook.name" . }} app: {{ template "helm-guestbook.name" . }}
release: {{ .Release.Name }} release: {{ .Release.Name }}

90
blue-green/values.yaml

@ -1,45 +1,45 @@
# Default values for helm-guestbook. # Default values for helm-guestbook.
# This is a YAML-formatted file. # This is a YAML-formatted file.
# Declare variables to be passed into your templates. # Declare variables to be passed into your templates.
replicaCount: 1 replicaCount: 1
image: image:
repository: gcr.io/heptio-images/ks-guestbook-demo repository: gcr.io/heptio-images/ks-guestbook-demo
tag: 0.1 tag: 0.1
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
service: service:
type: ClusterIP type: ClusterIP
port: 80 port: 80
ingress: ingress:
enabled: false enabled: false
annotations: {} annotations: {}
# kubernetes.io/ingress.class: nginx # kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true" # kubernetes.io/tls-acme: "true"
path: / path: /
hosts: hosts:
- chart-example.local - chart-example.local
tls: [] tls: []
# - secretName: chart-example-tls # - secretName: chart-example-tls
# hosts: # hosts:
# - chart-example.local # - chart-example.local
resources: {} resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious # We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little # choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following # resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'. # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits: # limits:
# cpu: 100m # cpu: 100m
# memory: 128Mi # memory: 128Mi
# requests: # requests:
# cpu: 100m # cpu: 100m
# memory: 128Mi # memory: 128Mi
nodeSelector: {} nodeSelector: {}
tolerations: [] tolerations: []
affinity: {} affinity: {}

0
branchtest

40
guestbook/guestbook-ui-deployment.yaml

@ -1,20 +1,20 @@
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: nginx name: nginx
spec: spec:
replicas: 1 replicas: 1
revisionHistoryLimit: 3 revisionHistoryLimit: 3
selector: selector:
matchLabels: matchLabels:
app: nginx app: nginx
template: template:
metadata: metadata:
labels: labels:
app: nginx app: nginx
spec: spec:
containers: containers:
- image: nginx:latest - image: nginx:latest
name: nginx name: nginx
ports: ports:
- containerPort: 80 - containerPort: 80

20
guestbook/guestbook-ui-svc.yaml

@ -1,10 +1,10 @@
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: nginx name: nginx
spec: spec:
ports: ports:
- port: 8888 - port: 8888
targetPort: 80 targetPort: 80
selector: selector:
app: nginx app: nginx

54
helm-dependency/Chart.yaml

@ -1,28 +1,28 @@
apiVersion: v2 apiVersion: v2
name: wordpress name: wordpress
description: A Helm chart for Kubernetes description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart. # A chart can be either an 'application' or a 'library' chart.
# #
# Application charts are a collection of templates that can be packaged into versioned archives # Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed. # to be deployed.
# #
# Library charts provide useful utilities or functions for the chart developer. They're included as # Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering # a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed. # pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application type: application
# This is the chart version. This version number should be incremented each time you make changes # This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version. # to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/) # Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0 version: 0.1.0
# This is the version number of the application being deployed. This version number should be # This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to # incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using. # follow Semantic Versioning. They should reflect the version the application is using.
appVersion: "1.0" appVersion: "1.0"
dependencies: dependencies:
- name: wordpress - name: wordpress
version: 9.0.3 version: 9.0.3
repository: https://charts.helm.sh/stable repository: https://charts.helm.sh/stable

108
helm-dependency/README.md

@ -1,55 +1,55 @@
# Helm Dependencies # Helm Dependencies
This example application demonstrates how an OTS (off-the-shelf) helm chart can be retrieved and This example application demonstrates how an OTS (off-the-shelf) helm chart can be retrieved and
pinned to a specific helm sem version from an upstream helm repository, and customized using a custom pinned to a specific helm sem version from an upstream helm repository, and customized using a custom
values.yaml in the private git repository. values.yaml in the private git repository.
In this example, the wordpress application is pulled from the stable helm repo, and pinned to v5.0.2: In this example, the wordpress application is pulled from the stable helm repo, and pinned to v5.0.2:
```yaml ```yaml
dependencies: dependencies:
- name: wordpress - name: wordpress
version: 5.0.2 version: 5.0.2
repository: https://charts.helm.sh/stable repository: https://charts.helm.sh/stable
``` ```
A custom values.yaml is used to customize the parameters of the wordpress helm chart: A custom values.yaml is used to customize the parameters of the wordpress helm chart:
```yaml ```yaml
wordpress: wordpress:
wordpressPassword: foo wordpressPassword: foo
mariadb: mariadb:
db: db:
password: bar password: bar
rootUser: rootUser:
password: baz password: baz
``` ```
### Subchart Note ### Subchart Note
The wordpress chart referenced in this example contains a subchart for mariadb as specified in the requirements.yaml file of the wordpress chart: The wordpress chart referenced in this example contains a subchart for mariadb as specified in the requirements.yaml file of the wordpress chart:
```yaml ```yaml
- name: mariadb - name: mariadb
version: 5.x.x version: 5.x.x
repository: https://charts.helm.sh/stable repository: https://charts.helm.sh/stable
condition: mariadb.enabled condition: mariadb.enabled
tags: tags:
- wordpress-database - wordpress-database
``` ```
In order to disable this chart, you must set the value to false for both `mariadb.enabled` and `wordpress.mariadb.enabled`. The first is used by the mariadb subchart condition field, the second is used by the wordpress chart deployment template. An example demonstration is available in the values-nomaria.yaml file: In order to disable this chart, you must set the value to false for both `mariadb.enabled` and `wordpress.mariadb.enabled`. The first is used by the mariadb subchart condition field, the second is used by the wordpress chart deployment template. An example demonstration is available in the values-nomaria.yaml file:
```yaml ```yaml
mariadb: mariadb:
enabled: false enabled: false
wordpress: wordpress:
wordpressPassword: foo wordpressPassword: foo
mariadb: mariadb:
enabled: false enabled: false
externalDatabase: externalDatabase:
host: localhost host: localhost
user: bn_wordpress user: bn_wordpress
password: "" password: ""
database: bitnami_wordpress database: bitnami_wordpress
port: 3306 port: 3306
``` ```

24
helm-dependency/values-nomaria.yaml

@ -1,13 +1,13 @@
mariadb: mariadb:
enabled: false enabled: false
wordpress: wordpress:
wordpressPassword: foo wordpressPassword: foo
mariadb: mariadb:
enabled: false enabled: false
externalDatabase: externalDatabase:
host: localhost host: localhost
user: bn_wordpress user: bn_wordpress
password: "" password: ""
database: bitnami_wordpress database: bitnami_wordpress
port: 3306 port: 3306

14
helm-dependency/values.yaml

@ -1,7 +1,7 @@
wordpress: wordpress:
wordpressPassword: foo wordpressPassword: foo
mariadb: mariadb:
db: db:
password: bar password: bar
rootUser: rootUser:
password: baz password: baz

42
helm-guestbook/.helmignore

@ -1,21 +1,21 @@
# Patterns to ignore when building packages. # Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and # This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line. # negation (prefixed with !). Only one pattern per line.
.DS_Store .DS_Store
# Common VCS dirs # Common VCS dirs
.git/ .git/
.gitignore .gitignore
.bzr/ .bzr/
.bzrignore .bzrignore
.hg/ .hg/
.hgignore .hgignore
.svn/ .svn/
# Common backup files # Common backup files
*.swp *.swp
*.bak *.bak
*.tmp *.tmp
*~ *~
# Various IDEs # Various IDEs
.project .project
.idea/ .idea/
*.tmproj *.tmproj

46
helm-guestbook/Chart.yaml

@ -1,23 +1,23 @@
apiVersion: v2 apiVersion: v2
name: helm-guestbook name: helm-guestbook
description: A Helm chart for Kubernetes description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart. # A chart can be either an 'application' or a 'library' chart.
# #
# Application charts are a collection of templates that can be packaged into versioned archives # Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed. # to be deployed.
# #
# Library charts provide useful utilities or functions for the chart developer. They're included as # Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering # a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed. # pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application type: application
# This is the chart version. This version number should be incremented each time you make changes # This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version. # to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/) # Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0 version: 0.1.0
# This is the version number of the application being deployed. This version number should be # This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to # incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using. # follow Semantic Versioning. They should reflect the version the application is using.
appVersion: "1.0" appVersion: "1.0"

38
helm-guestbook/templates/NOTES.txt

@ -1,19 +1,19 @@
1. Get the application URL by running these commands: 1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }} {{- if .Values.ingress.enabled }}
{{- range .Values.ingress.hosts }} {{- range .Values.ingress.hosts }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
{{- end }} {{- end }}
{{- else if contains "NodePort" .Values.service.type }} {{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "helm-guestbook.fullname" . }}) export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "helm-guestbook.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }} {{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available. NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ template "helm-guestbook.fullname" . }}' You can watch the status of by running 'kubectl get svc -w {{ template "helm-guestbook.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "helm-guestbook.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "helm-guestbook.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.port }} echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }} {{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "helm-guestbook.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "helm-guestbook.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application" echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:80 kubectl port-forward $POD_NAME 8080:80
{{- end }} {{- end }}

64
helm-guestbook/templates/_helpers.tpl

@ -1,32 +1,32 @@
{{/* vim: set filetype=mustache: */}} {{/* vim: set filetype=mustache: */}}
{{/* {{/*
Expand the name of the chart. Expand the name of the chart.
*/}} */}}
{{- define "helm-guestbook.name" -}} {{- define "helm-guestbook.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}} {{- end -}}
{{/* {{/*
Create a default fully qualified app name. Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name. If release name contains chart name it will be used as a full name.
*/}} */}}
{{- define "helm-guestbook.fullname" -}} {{- define "helm-guestbook.fullname" -}}
{{- if .Values.fullnameOverride -}} {{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}} {{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}} {{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}} {{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} {{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}} {{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{/* {{/*
Create chart name and version as used by the chart label. Create chart name and version as used by the chart label.
*/}} */}}
{{- define "helm-guestbook.chart" -}} {{- define "helm-guestbook.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}} {{- end -}}

104
helm-guestbook/templates/deployment.yaml

@ -1,52 +1,52 @@
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: {{ template "helm-guestbook.fullname" . }} name: {{ template "helm-guestbook.fullname" . }}
labels: labels:
app: {{ template "helm-guestbook.name" . }} app: {{ template "helm-guestbook.name" . }}
chart: {{ template "helm-guestbook.chart" . }} chart: {{ template "helm-guestbook.chart" . }}
release: {{ .Release.Name }} release: {{ .Release.Name }}
heritage: {{ .Release.Service }} heritage: {{ .Release.Service }}
spec: spec:
replicas: {{ .Values.replicaCount }} replicas: {{ .Values.replicaCount }}
revisionHistoryLimit: 3 revisionHistoryLimit: 3
selector: selector:
matchLabels: matchLabels:
app: {{ template "helm-guestbook.name" . }} app: {{ template "helm-guestbook.name" . }}
release: {{ .Release.Name }} release: {{ .Release.Name }}
template: template:
metadata: metadata:
labels: labels:
app: {{ template "helm-guestbook.name" . }} app: {{ template "helm-guestbook.name" . }}
release: {{ .Release.Name }} release: {{ .Release.Name }}
spec: spec:
containers: containers:
- name: {{ .Chart.Name }} - name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }} imagePullPolicy: {{ .Values.image.pullPolicy }}
ports: ports:
- name: http - name: http
containerPort: 80 containerPort: 80
protocol: TCP protocol: TCP
livenessProbe: livenessProbe:
httpGet: httpGet:
path: / path: /
port: http port: http
readinessProbe: readinessProbe:
httpGet: httpGet:
path: / path: /
port: http port: http
resources: resources:
{{ toYaml .Values.resources | indent 12 }} {{ toYaml .Values.resources | indent 12 }}
{{- with .Values.nodeSelector }} {{- with .Values.nodeSelector }}
nodeSelector: nodeSelector:
{{ toYaml . | indent 8 }} {{ toYaml . | indent 8 }}
{{- end }} {{- end }}
{{- with .Values.affinity }} {{- with .Values.affinity }}
affinity: affinity:
{{ toYaml . | indent 8 }} {{ toYaml . | indent 8 }}
{{- end }} {{- end }}
{{- with .Values.tolerations }} {{- with .Values.tolerations }}
tolerations: tolerations:
{{ toYaml . | indent 8 }} {{ toYaml . | indent 8 }}
{{- end }} {{- end }}

38
helm-guestbook/templates/service.yaml

@ -1,19 +1,19 @@
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: {{ template "helm-guestbook.fullname" . }} name: {{ template "helm-guestbook.fullname" . }}
labels: labels:
app: {{ template "helm-guestbook.name" . }} app: {{ template "helm-guestbook.name" . }}
chart: {{ template "helm-guestbook.chart" . }} chart: {{ template "helm-guestbook.chart" . }}
release: {{ .Release.Name }} release: {{ .Release.Name }}
heritage: {{ .Release.Service }} heritage: {{ .Release.Service }}
spec: spec:
type: {{ .Values.service.type }} type: {{ .Values.service.type }}
ports: ports:
- port: {{ .Values.service.port }} - port: {{ .Values.service.port }}
targetPort: http targetPort: http
protocol: TCP protocol: TCP
name: http name: http
selector: selector:
app: {{ template "helm-guestbook.name" . }} app: {{ template "helm-guestbook.name" . }}
release: {{ .Release.Name }} release: {{ .Release.Name }}

4
helm-guestbook/values-production.yaml

@ -1,2 +1,2 @@
service: service:
type: LoadBalancer type: LoadBalancer

90
helm-guestbook/values.yaml

@ -1,45 +1,45 @@
# Default values for helm-guestbook. # Default values for helm-guestbook.
# This is a YAML-formatted file. # This is a YAML-formatted file.
# Declare variables to be passed into your templates. # Declare variables to be passed into your templates.
replicaCount: 1 replicaCount: 1
image: image:
repository: gcr.io/heptio-images/ks-guestbook-demo repository: gcr.io/heptio-images/ks-guestbook-demo
tag: 0.1 tag: 0.1
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
service: service:
type: ClusterIP type: ClusterIP
port: 80 port: 80
ingress: ingress:
enabled: false enabled: false
annotations: {} annotations: {}
# kubernetes.io/ingress.class: nginx # kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true" # kubernetes.io/tls-acme: "true"
path: / path: /
hosts: hosts:
- chart-example.local - chart-example.local
tls: [] tls: []
# - secretName: chart-example-tls # - secretName: chart-example-tls
# hosts: # hosts:
# - chart-example.local # - chart-example.local
resources: {} resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious # We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little # choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following # resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'. # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits: # limits:
# cpu: 100m # cpu: 100m
# memory: 128Mi # memory: 128Mi
# requests: # requests:
# cpu: 100m # cpu: 100m
# memory: 128Mi # memory: 128Mi
nodeSelector: {} nodeSelector: {}
tolerations: [] tolerations: []
affinity: {} affinity: {}

164
helm-hooks/manifests.yaml

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

130
jsonnet-guestbook-tla/guestbook-ui.jsonnet

@ -1,65 +1,65 @@
function ( function (
containerPort=80, containerPort=80,
image="gcr.io/heptio-images/ks-guestbook-demo:0.2", image="gcr.io/heptio-images/ks-guestbook-demo:0.2",
name="jsonnet-guestbook-ui", name="jsonnet-guestbook-ui",
replicas=1, replicas=1,
servicePort=80, servicePort=80,
type="LoadBalancer" type="LoadBalancer"
) )
[ [
{ {
"apiVersion": "v1", "apiVersion": "v1",
"kind": "Service", "kind": "Service",
"metadata": { "metadata": {
"name": name "name": name
}, },
"spec": { "spec": {
"ports": [ "ports": [
{ {
"port": servicePort, "port": servicePort,
"targetPort": containerPort "targetPort": containerPort
} }
], ],
"selector": { "selector": {
"app": name "app": name
}, },
"type": type "type": type
} }
}, },
{ {
"apiVersion": "apps/v1", "apiVersion": "apps/v1",
"kind": "Deployment", "kind": "Deployment",
"metadata": { "metadata": {
"name": name "name": name
}, },
"spec": { "spec": {
"replicas": replicas, "replicas": replicas,
"revisionHistoryLimit": 3, "revisionHistoryLimit": 3,
"selector": { "selector": {
"matchLabels": { "matchLabels": {
"app": name "app": name
}, },
}, },
"template": { "template": {
"metadata": { "metadata": {
"labels": { "labels": {
"app": name "app": name
} }
}, },
"spec": { "spec": {
"containers": [ "containers": [
{ {
"image": image, "image": image,
"name": name, "name": name,
"ports": [ "ports": [
{ {
"containerPort": containerPort "containerPort": containerPort
} }
] ]
} }
] ]
} }
} }
} }
} }
] ]

118
jsonnet-guestbook/guestbook-ui.jsonnet

@ -1,59 +1,59 @@
local params = import 'params.libsonnet'; local params = import 'params.libsonnet';
[ [
{ {
"apiVersion": "v1", "apiVersion": "v1",
"kind": "Service", "kind": "Service",
"metadata": { "metadata": {
"name": params.name "name": params.name
}, },
"spec": { "spec": {
"ports": [ "ports": [
{ {
"port": params.servicePort, "port": params.servicePort,
"targetPort": params.containerPort "targetPort": params.containerPort
} }
], ],
"selector": { "selector": {
"app": params.name "app": params.name
}, },
"type": params.type "type": params.type
} }
}, },
{ {
"apiVersion": "apps/v1", "apiVersion": "apps/v1",
"kind": "Deployment", "kind": "Deployment",
"metadata": { "metadata": {
"name": params.name "name": params.name
}, },
"spec": { "spec": {
"replicas": params.replicas, "replicas": params.replicas,
"revisionHistoryLimit": 3, "revisionHistoryLimit": 3,
"selector": { "selector": {
"matchLabels": { "matchLabels": {
"app": params.name "app": params.name
}, },
}, },
"template": { "template": {
"metadata": { "metadata": {
"labels": { "labels": {
"app": params.name "app": params.name
} }
}, },
"spec": { "spec": {
"containers": [ "containers": [
{ {
"image": params.image, "image": params.image,
"name": params.name, "name": params.name,
"ports": [ "ports": [
{ {
"containerPort": params.containerPort "containerPort": params.containerPort
} }
] ]
} }
] ]
} }
} }
} }
} }
] ]

16
jsonnet-guestbook/params.libsonnet

@ -1,8 +1,8 @@
{ {
containerPort: 80, containerPort: 80,
image: "gcr.io/heptio-images/ks-guestbook-demo:0.2", image: "gcr.io/heptio-images/ks-guestbook-demo:0.2",
name: "jsonnet-guestbook-ui", name: "jsonnet-guestbook-ui",
replicas: 1, replicas: 1,
servicePort: 80, servicePort: 80,
type: "LoadBalancer", type: "LoadBalancer",
} }

8
ksonnet-guestbook/.gitignore

@ -1,4 +1,4 @@
/lib /lib
/.ksonnet/registries /.ksonnet/registries
/app.override.yaml /app.override.yaml
/.ks_environment /.ks_environment

46
ksonnet-guestbook/app.yaml

@ -1,23 +1,23 @@
apiVersion: 0.1.0 apiVersion: 0.1.0
environments: environments:
default: default:
destination: destination:
namespace: default namespace: default
server: https://kubernetes.default.svc server: https://kubernetes.default.svc
k8sVersion: v1.10.0 k8sVersion: v1.10.0
path: default path: default
dev: dev:
destination: destination:
namespace: dev namespace: dev
server: https://kubernetes.default.svc server: https://kubernetes.default.svc
k8sVersion: v1.10.0 k8sVersion: v1.10.0
path: dev path: dev
prod: prod:
destination: destination:
namespace: prod namespace: prod
server: https://kubernetes.default.svc server: https://kubernetes.default.svc
k8sVersion: v1.10.0 k8sVersion: v1.10.0
path: prod path: prod
kind: ksonnet.io/app kind: ksonnet.io/app
name: guestbook name: guestbook
version: 0.0.1 version: 0.0.1

118
ksonnet-guestbook/components/guestbook-ui.jsonnet

@ -1,59 +1,59 @@
local env = std.extVar("__ksonnet/environments"); local env = std.extVar("__ksonnet/environments");
local params = std.extVar("__ksonnet/params").components["guestbook-ui"]; local params = std.extVar("__ksonnet/params").components["guestbook-ui"];
[ [
{ {
"apiVersion": "v1", "apiVersion": "v1",
"kind": "Service", "kind": "Service",
"metadata": { "metadata": {
"name": params.name "name": params.name
}, },
"spec": { "spec": {
"ports": [ "ports": [
{ {
"port": params.servicePort, "port": params.servicePort,
"targetPort": params.containerPort "targetPort": params.containerPort
} }
], ],
"selector": { "selector": {
"app": params.name "app": params.name
}, },
"type": params.type "type": params.type
} }
}, },
{ {
"apiVersion": "apps/v1", "apiVersion": "apps/v1",
"kind": "Deployment", "kind": "Deployment",
"metadata": { "metadata": {
"name": params.name "name": params.name
}, },
"spec": { "spec": {
"replicas": params.replicas, "replicas": params.replicas,
"revisionHistoryLimit": 3, "revisionHistoryLimit": 3,
"selector": { "selector": {
"matchLabels": { "matchLabels": {
"app": params.name "app": params.name
}, },
}, },
"template": { "template": {
"metadata": { "metadata": {
"labels": { "labels": {
"app": params.name "app": params.name
} }
}, },
"spec": { "spec": {
"containers": [ "containers": [
{ {
"image": params.image, "image": params.image,
"name": params.name, "name": params.name,
"ports": [ "ports": [
{ {
"containerPort": params.containerPort "containerPort": params.containerPort
} }
] ]
} }
] ]
} }
} }
} }
} }
] ]

36
ksonnet-guestbook/components/params.libsonnet

@ -1,18 +1,18 @@
{ {
global: { global: {
// User-defined global parameters; accessible to all component and environments, Ex: // User-defined global parameters; accessible to all component and environments, Ex:
// replicas: 4, // replicas: 4,
}, },
components: { components: {
// Component-level parameters, defined initially from 'ks prototype use ...' // Component-level parameters, defined initially from 'ks prototype use ...'
// Each object below should correspond to a component in the components/ directory // Each object below should correspond to a component in the components/ directory
"guestbook-ui": { "guestbook-ui": {
containerPort: 80, containerPort: 80,
image: "gcr.io/heptio-images/ks-guestbook-demo:0.2", image: "gcr.io/heptio-images/ks-guestbook-demo:0.2",
name: "ks-guestbook-ui", name: "ks-guestbook-ui",
replicas: 1, replicas: 1,
servicePort: 80, servicePort: 80,
type: "LoadBalancer", type: "LoadBalancer",
}, },
}, },
} }

8
ksonnet-guestbook/environments/base.libsonnet

@ -1,4 +1,4 @@
local components = std.extVar("__ksonnet/components"); local components = std.extVar("__ksonnet/components");
components + { components + {
// Insert user-specified overrides here. // Insert user-specified overrides here.
} }

2
ksonnet-guestbook/environments/default/globals.libsonnet

@ -1,2 +1,2 @@
{ {
} }

16
ksonnet-guestbook/environments/default/main.jsonnet

@ -1,8 +1,8 @@
local base = import "base.libsonnet"; local base = import "base.libsonnet";
// uncomment if you reference ksonnet-lib // uncomment if you reference ksonnet-lib
// local k = import "k.libsonnet"; // local k = import "k.libsonnet";
base + { base + {
// Insert user-specified overrides here. For example if a component is named \"nginx-deployment\", you might have something like:\n") // Insert user-specified overrides here. For example if a component is named \"nginx-deployment\", you might have something like:\n")
// "nginx-deployment"+: k.deployment.mixin.metadata.labels({foo: "bar"}) // "nginx-deployment"+: k.deployment.mixin.metadata.labels({foo: "bar"})
} }

34
ksonnet-guestbook/environments/default/params.libsonnet

@ -1,17 +1,17 @@
local params = std.extVar("__ksonnet/params"); local params = std.extVar("__ksonnet/params");
local globals = import "globals.libsonnet"; local globals = import "globals.libsonnet";
local envParams = params + { local envParams = params + {
components +: { components +: {
// Insert component parameter overrides here. Ex: // Insert component parameter overrides here. Ex:
// guestbook +: { // guestbook +: {
// name: "guestbook-dev", // name: "guestbook-dev",
// replicas: params.global.replicas, // replicas: params.global.replicas,
// }, // },
}, },
}; };
{ {
components: { components: {
[x]: envParams.components[x] + globals, for x in std.objectFields(envParams.components) [x]: envParams.components[x] + globals, for x in std.objectFields(envParams.components)
}, },
} }

2
ksonnet-guestbook/environments/dev/globals.libsonnet

@ -1,2 +1,2 @@
{ {
} }

16
ksonnet-guestbook/environments/dev/main.jsonnet

@ -1,8 +1,8 @@
local base = import "base.libsonnet"; local base = import "base.libsonnet";
// uncomment if you reference ksonnet-lib // uncomment if you reference ksonnet-lib
// local k = import "k.libsonnet"; // local k = import "k.libsonnet";
base + { base + {
// Insert user-specified overrides here. For example if a component is named \"nginx-deployment\", you might have something like:\n") // Insert user-specified overrides here. For example if a component is named \"nginx-deployment\", you might have something like:\n")
// "nginx-deployment"+: k.deployment.mixin.metadata.labels({foo: "bar"}) // "nginx-deployment"+: k.deployment.mixin.metadata.labels({foo: "bar"})
} }

34
ksonnet-guestbook/environments/dev/params.libsonnet

@ -1,17 +1,17 @@
local params = std.extVar("__ksonnet/params"); local params = std.extVar("__ksonnet/params");
local globals = import "globals.libsonnet"; local globals = import "globals.libsonnet";
local envParams = params + { local envParams = params + {
components +: { components +: {
// Insert component parameter overrides here. Ex: // Insert component parameter overrides here. Ex:
// guestbook +: { // guestbook +: {
// name: "guestbook-dev", // name: "guestbook-dev",
// replicas: params.global.replicas, // replicas: params.global.replicas,
// }, // },
}, },
}; };
{ {
components: { components: {
[x]: envParams.components[x] + globals, for x in std.objectFields(envParams.components) [x]: envParams.components[x] + globals, for x in std.objectFields(envParams.components)
}, },
} }

2
ksonnet-guestbook/environments/prod/globals.libsonnet

@ -1,2 +1,2 @@
{ {
} }

16
ksonnet-guestbook/environments/prod/main.jsonnet

@ -1,8 +1,8 @@
local base = import "base.libsonnet"; local base = import "base.libsonnet";
// uncomment if you reference ksonnet-lib // uncomment if you reference ksonnet-lib
// local k = import "k.libsonnet"; // local k = import "k.libsonnet";
base + { base + {
// Insert user-specified overrides here. For example if a component is named \"nginx-deployment\", you might have something like:\n") // Insert user-specified overrides here. For example if a component is named \"nginx-deployment\", you might have something like:\n")
// "nginx-deployment"+: k.deployment.mixin.metadata.labels({foo: "bar"}) // "nginx-deployment"+: k.deployment.mixin.metadata.labels({foo: "bar"})
} }

34
ksonnet-guestbook/environments/prod/params.libsonnet

@ -1,17 +1,17 @@
local params = std.extVar("__ksonnet/params"); local params = std.extVar("__ksonnet/params");
local globals = import "globals.libsonnet"; local globals = import "globals.libsonnet";
local envParams = params + { local envParams = params + {
components +: { components +: {
// Insert component parameter overrides here. Ex: // Insert component parameter overrides here. Ex:
// guestbook +: { // guestbook +: {
// name: "guestbook-dev", // name: "guestbook-dev",
// replicas: params.global.replicas, // replicas: params.global.replicas,
// }, // },
}, },
}; };
{ {
components: { components: {
[x]: envParams.components[x] + globals, for x in std.objectFields(envParams.components) [x]: envParams.components[x] + globals, for x in std.objectFields(envParams.components)
}, },
} }

40
kustomize-guestbook/guestbook-ui-deployment.yaml

@ -1,20 +1,20 @@
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: guestbook-ui name: guestbook-ui
spec: spec:
replicas: 1 replicas: 1
revisionHistoryLimit: 3 revisionHistoryLimit: 3
selector: selector:
matchLabels: matchLabels:
app: guestbook-ui app: guestbook-ui
template: template:
metadata: metadata:
labels: labels:
app: guestbook-ui app: guestbook-ui
spec: spec:
containers: containers:
- image: gcr.io/heptio-images/ks-guestbook-demo:0.1 - image: gcr.io/heptio-images/ks-guestbook-demo:0.1
name: guestbook-ui name: guestbook-ui
ports: ports:
- containerPort: 80 - containerPort: 80

20
kustomize-guestbook/guestbook-ui-svc.yaml

@ -1,10 +1,10 @@
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: guestbook-ui name: guestbook-ui
spec: spec:
ports: ports:
- port: 80 - port: 80
targetPort: 80 targetPort: 80
selector: selector:
app: guestbook-ui app: guestbook-ui

14
kustomize-guestbook/kustomization.yaml

@ -1,7 +1,7 @@
namePrefix: kustomize- namePrefix: kustomize-
resources: resources:
- guestbook-ui-deployment.yaml - guestbook-ui-deployment.yaml
- guestbook-ui-svc.yaml - guestbook-ui-svc.yaml
apiVersion: kustomize.config.k8s.io/v1beta1 apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization

12
plugins/README.md

@ -1,6 +1,6 @@
# Config Management Plugins Examples # Config Management Plugins Examples
| Application | Description | | Application | Description |
|-------------|-------------| |-------------|-------------|
| [kasane](kasane/) | The guestbook application as a `kasane` package. | | [kasane](kasane/) | The guestbook application as a `kasane` package. |
| [kustomized-helm](kustomized-helm/) | Application comprised of a `helm` chart and customized using `kustomize` | | [kustomized-helm](kustomized-helm/) | Application comprised of a `helm` chart and customized using `kustomize` |

4
plugins/kasane/.gitignore

@ -1,2 +1,2 @@
vendor vendor
Kasanefile.lock Kasanefile.lock

10
plugins/kasane/Kasanefile

@ -1,5 +1,5 @@
layers: layers:
- ../../guestbook/guestbook-ui-deployment.yaml - ../../guestbook/guestbook-ui-deployment.yaml
- patch.jsonnet - patch.jsonnet
- ../../guestbook/guestbook-ui-svc.yaml - ../../guestbook/guestbook-ui-svc.yaml

58
plugins/kasane/README.md

@ -1,29 +1,29 @@
# Kasane # Kasane
[Kasane](https://github.com/google/kasane) is a layering tool for Kubernetes which utilises Jsonnet for deep object modification and patching. [Kasane](https://github.com/google/kasane) is a layering tool for Kubernetes which utilises Jsonnet for deep object modification and patching.
Use following steps to try the application: Use following steps to try the application:
* Follow instructions from [custom_tools.md](https://github.com/argoproj/argo-cd/blob/master/docs/operator-manual/custom_tools.md) to make sure `kasane` binary is available in `argocd-repo-server` pod. * Follow instructions from [custom_tools.md](https://github.com/argoproj/argo-cd/blob/master/docs/operator-manual/custom_tools.md) to make sure `kasane` binary is available in `argocd-repo-server` pod.
* Register `kasane` plugin `argocd-cm` ConfigMap: * Register `kasane` plugin `argocd-cm` ConfigMap:
```yaml ```yaml
apiVersion: v1 apiVersion: v1
data: data:
configManagementPlugins: | configManagementPlugins: |
- name: kasane - name: kasane
init: init:
command: [kasane, update] command: [kasane, update]
generate: generate:
command: [kasane, show] command: [kasane, show]
``` ```
* Create application using `kasane` as a config management plugin name. * Create application using `kasane` as a config management plugin name.
``` ```
argocd app create kasane \ argocd app create kasane \
--config-management-plugin kasane \ --config-management-plugin kasane \
--repo https://github.com/argoproj/argocd-example-apps \ --repo https://github.com/argoproj/argocd-example-apps \
--path plugins/kasane \ --path plugins/kasane \
--dest-server https://kubernetes.default.svc \ --dest-server https://kubernetes.default.svc \
--dest-namespace default --dest-namespace default
``` ```

18
plugins/kasane/patch.jsonnet

@ -1,9 +1,9 @@
function (layers) function (layers)
[ [
layers[0] { layers[0] {
spec+: { spec+: {
replicas: 2, replicas: 2,
}, },
} }
] ]

6
plugins/kustomized-helm/.gitignore

@ -1,3 +1,3 @@
all.yaml all.yaml
charts charts
requirements.lock requirements.lock

54
plugins/kustomized-helm/Chart.yaml

@ -1,28 +1,28 @@
apiVersion: v2 apiVersion: v2
name: guestbook name: guestbook
description: A Helm chart for Kubernetes description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart. # A chart can be either an 'application' or a 'library' chart.
# #
# Application charts are a collection of templates that can be packaged into versioned archives # Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed. # to be deployed.
# #
# Library charts provide useful utilities or functions for the chart developer. They're included as # Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering # a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed. # pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application type: application
# This is the chart version. This version number should be incremented each time you make changes # This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version. # to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/) # Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0 version: 0.1.0
# This is the version number of the application being deployed. This version number should be # This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to # incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using. # follow Semantic Versioning. They should reflect the version the application is using.
appVersion: "1.0" appVersion: "1.0"
dependencies: dependencies:
- name: helm-guestbook - name: helm-guestbook
version: 0.1.0 version: 0.1.0
repository: file://../../helm-guestbook repository: file://../../helm-guestbook

62
plugins/kustomized-helm/README.md

@ -1,31 +1,31 @@
# Helm + Kustomize # Helm + Kustomize
Sometimes Helm chart don't have all required parameters and additional customization is required. This example application demonstrates how to combine Helm and Kustomize and use it Sometimes Helm chart don't have all required parameters and additional customization is required. This example application demonstrates how to combine Helm and Kustomize and use it
as a config management plugin in Argo CD. as a config management plugin in Argo CD.
Use following steps to try the application: Use following steps to try the application:
* configure `kustomized-helm` tool in `argocd-cm` ConfigMap: * configure `kustomized-helm` tool in `argocd-cm` ConfigMap:
```yaml ```yaml
configManagementPlugins: | configManagementPlugins: |
- name: kustomized-helm - name: kustomized-helm
init: init:
command: ["/bin/sh", "-c"] command: ["/bin/sh", "-c"]
args: ["helm dependency build"] args: ["helm dependency build"]
generate: generate:
command: [sh, -c] command: [sh, -c]
args: ["helm template --release-name release-name . > all.yaml && kustomize build"] args: ["helm template --release-name release-name . > all.yaml && kustomize build"]
``` ```
* create application using `kustomized-helm` as a config management plugin name: * create application using `kustomized-helm` as a config management plugin name:
``` ```
argocd app create kustomized-helm \ argocd app create kustomized-helm \
--config-management-plugin kustomized-helm \ --config-management-plugin kustomized-helm \
--repo https://github.com/argoproj/argocd-example-apps \ --repo https://github.com/argoproj/argocd-example-apps \
--path plugins/kustomized-helm \ --path plugins/kustomized-helm \
--dest-server https://kubernetes.default.svc \ --dest-server https://kubernetes.default.svc \
--dest-namespace default --dest-namespace default
``` ```

14
plugins/kustomized-helm/kustomization.yaml

@ -1,7 +1,7 @@
namePrefix: kustomize- namePrefix: kustomize-
resources: resources:
- ./all.yaml - ./all.yaml
patches: patches:
- overlays/guestbook-deployment.yaml - overlays/guestbook-deployment.yaml

20
plugins/kustomized-helm/overlays/guestbook-deployment.yaml

@ -1,10 +1,10 @@
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: release-name-helm-guestbook name: release-name-helm-guestbook
spec: spec:
template: template:
spec: spec:
containers: containers:
- name: helm-guestbook - name: helm-guestbook
image: "gcr.io/heptio-images/ks-guestbook-demo:0.2" image: "gcr.io/heptio-images/ks-guestbook-demo:0.2"

16
pre-post-sync/kustomization.yaml

@ -1,8 +1,8 @@
namePrefix: pre-post-sync- namePrefix: pre-post-sync-
bases: bases:
- ../kustomize-guestbook - ../kustomize-guestbook
resources: resources:
- pre-sync-job.yaml - pre-sync-job.yaml
- post-sync-job.yaml - post-sync-job.yaml

32
pre-post-sync/post-sync-job.yaml

@ -1,16 +1,16 @@
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
name: after name: after
annotations: annotations:
argocd.argoproj.io/hook: PostSync argocd.argoproj.io/hook: PostSync
argocd.argoproj.io/hook-delete-policy: HookSucceeded argocd.argoproj.io/hook-delete-policy: HookSucceeded
spec: spec:
template: template:
spec: spec:
containers: containers:
- name: sleep - name: sleep
image: alpine:latest image: alpine:latest
command: ["sleep", "10"] command: ["sleep", "10"]
restartPolicy: Never restartPolicy: Never
backoffLimit: 0 backoffLimit: 0

32
pre-post-sync/pre-sync-job.yaml

@ -1,16 +1,16 @@
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
name: before name: before
annotations: annotations:
argocd.argoproj.io/hook: PreSync argocd.argoproj.io/hook: PreSync
argocd.argoproj.io/hook-delete-policy: HookSucceeded argocd.argoproj.io/hook-delete-policy: HookSucceeded
spec: spec:
template: template:
spec: spec:
containers: containers:
- name: sleep - name: sleep
image: alpine:latest image: alpine:latest
command: ["sleep", "10"] command: ["sleep", "10"]
restartPolicy: Never restartPolicy: Never
backoffLimit: 0 backoffLimit: 0

82
sock-shop/base/carts-db-dep.yaml

@ -1,41 +1,41 @@
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: carts-db name: carts-db
labels: labels:
name: carts-db name: carts-db
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
name: carts-db name: carts-db
template: template:
metadata: metadata:
labels: labels:
name: carts-db name: carts-db
spec: spec:
containers: containers:
- name: carts-db - name: carts-db
image: mongo image: mongo
ports: ports:
- name: mongo - name: mongo
containerPort: 27017 containerPort: 27017
securityContext: securityContext:
capabilities: capabilities:
drop: drop:
- all - all
add: add:
- CHOWN - CHOWN
- SETGID - SETGID
- SETUID - SETUID
readOnlyRootFilesystem: true readOnlyRootFilesystem: true
volumeMounts: volumeMounts:
- mountPath: /tmp - mountPath: /tmp
name: tmp-volume name: tmp-volume
volumes: volumes:
- name: tmp-volume - name: tmp-volume
emptyDir: emptyDir:
medium: Memory medium: Memory
nodeSelector: nodeSelector:
beta.kubernetes.io/os: linux beta.kubernetes.io/os: linux

28
sock-shop/base/carts-db-svc.yaml

@ -1,14 +1,14 @@
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: carts-db name: carts-db
labels: labels:
name: carts-db name: carts-db
spec: spec:
ports: ports:
# the port that this service should serve on # the port that this service should serve on
- port: 27017 - port: 27017
targetPort: 27017 targetPort: 27017
selector: selector:
name: carts-db name: carts-db

128
sock-shop/base/carts-dep.yaml

@ -1,64 +1,64 @@
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: carts name: carts
labels: labels:
name: carts name: carts
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
name: carts name: carts
template: template:
metadata: metadata:
labels: labels:
name: carts name: carts
spec: spec:
containers: containers:
- name: carts - name: carts
image: weaveworksdemos/carts:0.4.8 image: weaveworksdemos/carts:0.4.8
env: env:
- name: ZIPKIN - name: ZIPKIN
value: zipkin.jaeger.svc.cluster.local value: zipkin.jaeger.svc.cluster.local
- name: JAVA_OPTS - name: JAVA_OPTS
value: -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC -Djava.security.egd=file:/dev/urandom value: -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC -Djava.security.egd=file:/dev/urandom
resources: resources:
limits: limits:
cpu: 300m cpu: 300m
memory: 500Mi memory: 500Mi
requests: requests:
cpu: 300m cpu: 300m
memory: 500Mi memory: 500Mi
ports: ports:
- containerPort: 80 - containerPort: 80
securityContext: securityContext:
runAsNonRoot: true runAsNonRoot: true
runAsUser: 10001 runAsUser: 10001
capabilities: capabilities:
drop: drop:
- all - all
add: add:
- NET_BIND_SERVICE - NET_BIND_SERVICE
readOnlyRootFilesystem: true readOnlyRootFilesystem: true
volumeMounts: volumeMounts:
- mountPath: /tmp - mountPath: /tmp
name: tmp-volume name: tmp-volume
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /health path: /health
port: 80 port: 80
initialDelaySeconds: 300 initialDelaySeconds: 300
periodSeconds: 3 periodSeconds: 3
readinessProbe: readinessProbe:
httpGet: httpGet:
path: /health path: /health
port: 80 port: 80
initialDelaySeconds: 180 initialDelaySeconds: 180
periodSeconds: 3 periodSeconds: 3
volumes: volumes:
- name: tmp-volume - name: tmp-volume
emptyDir: emptyDir:
medium: Memory medium: Memory
nodeSelector: nodeSelector:
beta.kubernetes.io/os: linux beta.kubernetes.io/os: linux

60
sock-shop/base/catalogue-db-dep.yaml

@ -1,30 +1,30 @@
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: catalogue-db name: catalogue-db
labels: labels:
name: catalogue-db name: catalogue-db
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
name: catalogue-db name: catalogue-db
template: template:
metadata: metadata:
labels: labels:
name: catalogue-db name: catalogue-db
spec: spec:
containers: containers:
- name: catalogue-db - name: catalogue-db
image: weaveworksdemos/catalogue-db:0.3.0 image: weaveworksdemos/catalogue-db:0.3.0
env: env:
- name: MYSQL_ROOT_PASSWORD - name: MYSQL_ROOT_PASSWORD
value: fake_password value: fake_password
- name: MYSQL_DATABASE - name: MYSQL_DATABASE
value: socksdb value: socksdb
ports: ports:
- name: mysql - name: mysql
containerPort: 3306 containerPort: 3306
nodeSelector: nodeSelector:
beta.kubernetes.io/os: linux beta.kubernetes.io/os: linux

28
sock-shop/base/catalogue-db-svc.yaml

@ -1,14 +1,14 @@
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: catalogue-db name: catalogue-db
labels: labels:
name: catalogue-db name: catalogue-db
spec: spec:
ports: ports:
# the port that this service should serve on # the port that this service should serve on
- port: 3306 - port: 3306
targetPort: 3306 targetPort: 3306
selector: selector:
name: catalogue-db name: catalogue-db

104
sock-shop/base/catalogue-dep.yaml

@ -1,52 +1,52 @@
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: catalogue name: catalogue
labels: labels:
name: catalogue name: catalogue
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
name: catalogue name: catalogue
template: template:
metadata: metadata:
labels: labels:
name: catalogue name: catalogue
spec: spec:
containers: containers:
- name: catalogue - name: catalogue
image: weaveworksdemos/catalogue:0.3.5 image: weaveworksdemos/catalogue:0.3.5
resources: resources:
limits: limits:
cpu: 100m cpu: 100m
memory: 100Mi memory: 100Mi
requests: requests:
cpu: 100m cpu: 100m
memory: 100Mi memory: 100Mi
ports: ports:
- containerPort: 80 - containerPort: 80
securityContext: securityContext:
runAsNonRoot: true runAsNonRoot: true
runAsUser: 10001 runAsUser: 10001
capabilities: capabilities:
drop: drop:
- all - all
add: add:
- NET_BIND_SERVICE - NET_BIND_SERVICE
readOnlyRootFilesystem: true readOnlyRootFilesystem: true
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /health path: /health
port: 80 port: 80
initialDelaySeconds: 300 initialDelaySeconds: 300
periodSeconds: 3 periodSeconds: 3
readinessProbe: readinessProbe:
httpGet: httpGet:
path: /health path: /health
port: 80 port: 80
initialDelaySeconds: 180 initialDelaySeconds: 180
periodSeconds: 3 periodSeconds: 3
nodeSelector: nodeSelector:
beta.kubernetes.io/os: linux beta.kubernetes.io/os: linux

28
sock-shop/base/catalogue-svc.yaml

@ -1,14 +1,14 @@
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: catalogue name: catalogue
labels: labels:
name: catalogue name: catalogue
spec: spec:
ports: ports:
# the port that this service should serve on # the port that this service should serve on
- port: 80 - port: 80
targetPort: 80 targetPort: 80
selector: selector:
name: catalogue name: catalogue

102
sock-shop/base/front-end-dep.yaml

@ -1,51 +1,51 @@
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: front-end name: front-end
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
name: front-end name: front-end
template: template:
metadata: metadata:
labels: labels:
name: front-end name: front-end
spec: spec:
containers: containers:
- name: front-end - name: front-end
image: weaveworksdemos/front-end:0.3.12 image: weaveworksdemos/front-end:0.3.12
resources: resources:
limits: limits:
cpu: 300m cpu: 300m
memory: 1000Mi memory: 1000Mi
requests: requests:
cpu: 100m cpu: 100m
memory: 300Mi memory: 300Mi
ports: ports:
- containerPort: 8079 - containerPort: 8079
env: env:
- name: SESSION_REDIS - name: SESSION_REDIS
value: "true" value: "true"
securityContext: securityContext:
runAsNonRoot: true runAsNonRoot: true
runAsUser: 10001 runAsUser: 10001
capabilities: capabilities:
drop: drop:
- all - all
readOnlyRootFilesystem: true readOnlyRootFilesystem: true
livenessProbe: livenessProbe:
httpGet: httpGet:
path: / path: /
port: 8079 port: 8079
initialDelaySeconds: 300 initialDelaySeconds: 300
periodSeconds: 3 periodSeconds: 3
readinessProbe: readinessProbe:
httpGet: httpGet:
path: / path: /
port: 8079 port: 8079
initialDelaySeconds: 30 initialDelaySeconds: 30
periodSeconds: 3 periodSeconds: 3
nodeSelector: nodeSelector:
beta.kubernetes.io/os: linux beta.kubernetes.io/os: linux

30
sock-shop/base/front-end-svc.yaml

@ -1,15 +1,15 @@
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: front-end name: front-end
labels: labels:
name: front-end name: front-end
spec: spec:
type: LoadBalancer type: LoadBalancer
ports: ports:
- port: 80 - port: 80
targetPort: 8079 targetPort: 8079
nodePort: 30001 nodePort: 30001
selector: selector:
name: front-end name: front-end

82
sock-shop/base/orders-db-dep.yaml

@ -1,41 +1,41 @@
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: orders-db name: orders-db
labels: labels:
name: orders-db name: orders-db
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
name: orders-db name: orders-db
template: template:
metadata: metadata:
labels: labels:
name: orders-db name: orders-db
spec: spec:
containers: containers:
- name: orders-db - name: orders-db
image: mongo image: mongo
ports: ports:
- name: mongo - name: mongo
containerPort: 27017 containerPort: 27017
securityContext: securityContext:
capabilities: capabilities:
drop: drop:
- all - all
add: add:
- CHOWN - CHOWN
- SETGID - SETGID
- SETUID - SETUID
readOnlyRootFilesystem: true readOnlyRootFilesystem: true
volumeMounts: volumeMounts:
- mountPath: /tmp - mountPath: /tmp
name: tmp-volume name: tmp-volume
volumes: volumes:
- name: tmp-volume - name: tmp-volume
emptyDir: emptyDir:
medium: Memory medium: Memory
nodeSelector: nodeSelector:
beta.kubernetes.io/os: linux beta.kubernetes.io/os: linux

28
sock-shop/base/orders-db-svc.yaml

@ -1,14 +1,14 @@
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: orders-db name: orders-db
labels: labels:
name: orders-db name: orders-db
spec: spec:
ports: ports:
# the port that this service should serve on # the port that this service should serve on
- port: 27017 - port: 27017
targetPort: 27017 targetPort: 27017
selector: selector:
name: orders-db name: orders-db

128
sock-shop/base/orders-dep.yaml

@ -1,64 +1,64 @@
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: orders name: orders
labels: labels:
name: orders name: orders
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
name: orders name: orders
template: template:
metadata: metadata:
labels: labels:
name: orders name: orders
spec: spec:
containers: containers:
- name: orders - name: orders
image: weaveworksdemos/orders:0.4.7 image: weaveworksdemos/orders:0.4.7
env: env:
- name: ZIPKIN - name: ZIPKIN
value: zipkin.jaeger.svc.cluster.local value: zipkin.jaeger.svc.cluster.local
- name: JAVA_OPTS - name: JAVA_OPTS
value: -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC -Djava.security.egd=file:/dev/urandom value: -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC -Djava.security.egd=file:/dev/urandom
resources: resources:
limits: limits:
cpu: 500m cpu: 500m
memory: 500Mi memory: 500Mi
requests: requests:
cpu: 200m cpu: 200m
memory: 500Mi memory: 500Mi
ports: ports:
- containerPort: 80 - containerPort: 80
securityContext: securityContext:
runAsNonRoot: true runAsNonRoot: true
runAsUser: 10001 runAsUser: 10001
capabilities: capabilities:
drop: drop:
- all - all
add: add:
- NET_BIND_SERVICE - NET_BIND_SERVICE
readOnlyRootFilesystem: true readOnlyRootFilesystem: true
volumeMounts: volumeMounts:
- mountPath: /tmp - mountPath: /tmp
name: tmp-volume name: tmp-volume
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /health path: /health
port: 80 port: 80
initialDelaySeconds: 300 initialDelaySeconds: 300
periodSeconds: 3 periodSeconds: 3
readinessProbe: readinessProbe:
httpGet: httpGet:
path: /health path: /health
port: 80 port: 80
initialDelaySeconds: 180 initialDelaySeconds: 180
periodSeconds: 3 periodSeconds: 3
volumes: volumes:
- name: tmp-volume - name: tmp-volume
emptyDir: emptyDir:
medium: Memory medium: Memory
nodeSelector: nodeSelector:
beta.kubernetes.io/os: linux beta.kubernetes.io/os: linux

28
sock-shop/base/orders-svc.yaml

@ -1,14 +1,14 @@
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: orders name: orders
labels: labels:
name: orders name: orders
spec: spec:
ports: ports:
# the port that this service should serve on # the port that this service should serve on
- port: 80 - port: 80
targetPort: 80 targetPort: 80
selector: selector:
name: orders name: orders

104
sock-shop/base/payment-dep.yaml

@ -1,52 +1,52 @@
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: payment name: payment
labels: labels:
name: payment name: payment
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
name: payment name: payment
template: template:
metadata: metadata:
labels: labels:
name: payment name: payment
spec: spec:
containers: containers:
- name: payment - name: payment
image: weaveworksdemos/payment:0.4.3 image: weaveworksdemos/payment:0.4.3
resources: resources:
limits: limits:
cpu: 100m cpu: 100m
memory: 100Mi memory: 100Mi
requests: requests:
cpu: 99m cpu: 99m
memory: 100Mi memory: 100Mi
ports: ports:
- containerPort: 80 - containerPort: 80
securityContext: securityContext:
runAsNonRoot: true runAsNonRoot: true
runAsUser: 10001 runAsUser: 10001
capabilities: capabilities:
drop: drop:
- all - all
add: add:
- NET_BIND_SERVICE - NET_BIND_SERVICE
readOnlyRootFilesystem: true readOnlyRootFilesystem: true
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /health path: /health
port: 80 port: 80
initialDelaySeconds: 300 initialDelaySeconds: 300
periodSeconds: 3 periodSeconds: 3
readinessProbe: readinessProbe:
httpGet: httpGet:
path: /health path: /health
port: 80 port: 80
initialDelaySeconds: 180 initialDelaySeconds: 180
periodSeconds: 3 periodSeconds: 3
nodeSelector: nodeSelector:
beta.kubernetes.io/os: linux beta.kubernetes.io/os: linux

28
sock-shop/base/payment-svc.yaml

@ -1,14 +1,14 @@
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: payment name: payment
labels: labels:
name: payment name: payment
spec: spec:
ports: ports:
# the port that this service should serve on # the port that this service should serve on
- port: 80 - port: 80
targetPort: 80 targetPort: 80
selector: selector:
name: payment name: payment

96
sock-shop/base/queue-master-dep.yaml

@ -1,48 +1,48 @@
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: queue-master name: queue-master
labels: labels:
name: queue-master name: queue-master
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
name: queue-master name: queue-master
template: template:
metadata: metadata:
labels: labels:
name: queue-master name: queue-master
spec: spec:
containers: containers:
- name: queue-master - name: queue-master
image: weaveworksdemos/queue-master:0.3.1 image: weaveworksdemos/queue-master:0.3.1
env: env:
- name: ZIPKIN - name: ZIPKIN
value: zipkin.jaeger.svc.cluster.local value: zipkin.jaeger.svc.cluster.local
- name: JAVA_OPTS - name: JAVA_OPTS
value: -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC -Djava.security.egd=file:/dev/urandom value: -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC -Djava.security.egd=file:/dev/urandom
resources: resources:
limits: limits:
cpu: 300m cpu: 300m
memory: 500Mi memory: 500Mi
requests: requests:
cpu: 300m cpu: 300m
memory: 500Mi memory: 500Mi
ports: ports:
- containerPort: 80 - containerPort: 80
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /health path: /health
port: 80 port: 80
initialDelaySeconds: 300 initialDelaySeconds: 300
periodSeconds: 3 periodSeconds: 3
readinessProbe: readinessProbe:
httpGet: httpGet:
path: /health path: /health
port: 80 port: 80
initialDelaySeconds: 180 initialDelaySeconds: 180
periodSeconds: 3 periodSeconds: 3
nodeSelector: nodeSelector:
beta.kubernetes.io/os: linux beta.kubernetes.io/os: linux

32
sock-shop/base/queue-master-svc.yaml

@ -1,16 +1,16 @@
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: queue-master name: queue-master
labels: labels:
name: queue-master name: queue-master
annotations: annotations:
prometheus.io/path: "/prometheus" prometheus.io/path: "/prometheus"
spec: spec:
ports: ports:
# the port that this service should serve on # the port that this service should serve on
- port: 80 - port: 80
targetPort: 80 targetPort: 80
selector: selector:
name: queue-master name: queue-master

88
sock-shop/base/rabbitmq-dep.yaml

@ -1,44 +1,44 @@
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: rabbitmq name: rabbitmq
labels: labels:
name: rabbitmq name: rabbitmq
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
name: rabbitmq name: rabbitmq
template: template:
metadata: metadata:
labels: labels:
name: rabbitmq name: rabbitmq
annotations: annotations:
prometheus.io/scrape: "false" prometheus.io/scrape: "false"
spec: spec:
containers: containers:
- name: rabbitmq - name: rabbitmq
image: rabbitmq:3.6.8-management image: rabbitmq:3.6.8-management
ports: ports:
- containerPort: 15672 - containerPort: 15672
name: management name: management
- containerPort: 5672 - containerPort: 5672
name: rabbitmq name: rabbitmq
securityContext: securityContext:
capabilities: capabilities:
drop: drop:
- all - all
add: add:
- CHOWN - CHOWN
- SETGID - SETGID
- SETUID - SETUID
- DAC_OVERRIDE - DAC_OVERRIDE
readOnlyRootFilesystem: true readOnlyRootFilesystem: true
- name: rabbitmq-exporter - name: rabbitmq-exporter
image: kbudde/rabbitmq-exporter image: kbudde/rabbitmq-exporter
ports: ports:
- containerPort: 9090 - containerPort: 9090
name: exporter name: exporter
nodeSelector: nodeSelector:
beta.kubernetes.io/os: linux beta.kubernetes.io/os: linux

38
sock-shop/base/rabbitmq-svc.yaml

@ -1,19 +1,19 @@
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: rabbitmq name: rabbitmq
labels: labels:
name: rabbitmq name: rabbitmq
spec: spec:
ports: ports:
# the port that this service should serve on # the port that this service should serve on
- port: 5672 - port: 5672
name: rabbitmq name: rabbitmq
targetPort: 5672 targetPort: 5672
- port: 9090 - port: 9090
name: exporter name: exporter
targetPort: exporter targetPort: exporter
protocol: TCP protocol: TCP
selector: selector:
name: rabbitmq name: rabbitmq

72
sock-shop/base/session-db-dep.yaml

@ -1,36 +1,36 @@
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: session-db name: session-db
labels: labels:
name: session-db name: session-db
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
name: session-db name: session-db
template: template:
metadata: metadata:
labels: labels:
name: session-db name: session-db
annotations: annotations:
prometheus.io.scrape: "false" prometheus.io.scrape: "false"
spec: spec:
containers: containers:
- name: session-db - name: session-db
image: redis:alpine image: redis:alpine
ports: ports:
- name: redis - name: redis
containerPort: 6379 containerPort: 6379
securityContext: securityContext:
capabilities: capabilities:
drop: drop:
- all - all
add: add:
- CHOWN - CHOWN
- SETGID - SETGID
- SETUID - SETUID
readOnlyRootFilesystem: true readOnlyRootFilesystem: true
nodeSelector: nodeSelector:
beta.kubernetes.io/os: linux beta.kubernetes.io/os: linux

28
sock-shop/base/session-db-svc.yaml

@ -1,14 +1,14 @@
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: session-db name: session-db
labels: labels:
name: session-db name: session-db
spec: spec:
ports: ports:
# the port that this service should serve on # the port that this service should serve on
- port: 6379 - port: 6379
targetPort: 6379 targetPort: 6379
selector: selector:
name: session-db name: session-db

128
sock-shop/base/shipping-dep.yaml

@ -1,64 +1,64 @@
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: shipping name: shipping
labels: labels:
name: shipping name: shipping
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
name: shipping name: shipping
template: template:
metadata: metadata:
labels: labels:
name: shipping name: shipping
spec: spec:
containers: containers:
- name: shipping - name: shipping
image: weaveworksdemos/shipping:0.4.8 image: weaveworksdemos/shipping:0.4.8
env: env:
- name: ZIPKIN - name: ZIPKIN
value: zipkin.jaeger.svc.cluster.local value: zipkin.jaeger.svc.cluster.local
- name: JAVA_OPTS - name: JAVA_OPTS
value: -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC -Djava.security.egd=file:/dev/urandom value: -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC -Djava.security.egd=file:/dev/urandom
resources: resources:
limits: limits:
cpu: 300m cpu: 300m
memory: 500Mi memory: 500Mi
requests: requests:
cpu: 300m cpu: 300m
memory: 500Mi memory: 500Mi
ports: ports:
- containerPort: 80 - containerPort: 80
securityContext: securityContext:
runAsNonRoot: true runAsNonRoot: true
runAsUser: 10001 runAsUser: 10001
capabilities: capabilities:
drop: drop:
- all - all
add: add:
- NET_BIND_SERVICE - NET_BIND_SERVICE
readOnlyRootFilesystem: true readOnlyRootFilesystem: true
volumeMounts: volumeMounts:
- mountPath: /tmp - mountPath: /tmp
name: tmp-volume name: tmp-volume
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /health path: /health
port: 80 port: 80
initialDelaySeconds: 300 initialDelaySeconds: 300
periodSeconds: 3 periodSeconds: 3
readinessProbe: readinessProbe:
httpGet: httpGet:
path: /health path: /health
port: 80 port: 80
initialDelaySeconds: 180 initialDelaySeconds: 180
periodSeconds: 3 periodSeconds: 3
volumes: volumes:
- name: tmp-volume - name: tmp-volume
emptyDir: emptyDir:
medium: Memory medium: Memory
nodeSelector: nodeSelector:
beta.kubernetes.io/os: linux beta.kubernetes.io/os: linux

30
sock-shop/base/shipping-svc.yaml

@ -1,15 +1,15 @@
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: shipping name: shipping
labels: labels:
name: shipping name: shipping
spec: spec:
ports: ports:
# the port that this service should serve on # the port that this service should serve on
- port: 80 - port: 80
targetPort: 80 targetPort: 80
selector: selector:
name: shipping name: shipping

82
sock-shop/base/user-db-dep.yaml

@ -1,42 +1,42 @@
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: user-db name: user-db
labels: labels:
name: user-db name: user-db
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
name: user-db name: user-db
template: template:
metadata: metadata:
labels: labels:
name: user-db name: user-db
spec: spec:
containers: containers:
- name: user-db - name: user-db
image: weaveworksdemos/user-db:0.3.0 image: weaveworksdemos/user-db:0.3.0
ports: ports:
- name: mongo - name: mongo
containerPort: 27017 containerPort: 27017
securityContext: securityContext:
capabilities: capabilities:
drop: drop:
- all - all
add: add:
- CHOWN - CHOWN
- SETGID - SETGID
- SETUID - SETUID
readOnlyRootFilesystem: true readOnlyRootFilesystem: true
volumeMounts: volumeMounts:
- mountPath: /tmp - mountPath: /tmp
name: tmp-volume name: tmp-volume
volumes: volumes:
- name: tmp-volume - name: tmp-volume
emptyDir: emptyDir:
medium: Memory medium: Memory
nodeSelector: nodeSelector:
beta.kubernetes.io/os: linux beta.kubernetes.io/os: linux

30
sock-shop/base/user-db-svc.yaml

@ -1,15 +1,15 @@
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: user-db name: user-db
labels: labels:
name: user-db name: user-db
spec: spec:
ports: ports:
# the port that this service should serve on # the port that this service should serve on
- port: 27017 - port: 27017
targetPort: 27017 targetPort: 27017
selector: selector:
name: user-db name: user-db

110
sock-shop/base/user-dep.yaml

@ -1,55 +1,55 @@
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: user name: user
labels: labels:
name: user name: user
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
name: user name: user
template: template:
metadata: metadata:
labels: labels:
name: user name: user
spec: spec:
containers: containers:
- name: user - name: user
image: weaveworksdemos/user:0.4.7 image: weaveworksdemos/user:0.4.7
resources: resources:
limits: limits:
cpu: 300m cpu: 300m
memory: 100Mi memory: 100Mi
requests: requests:
cpu: 100m cpu: 100m
memory: 100Mi memory: 100Mi
ports: ports:
- containerPort: 80 - containerPort: 80
env: env:
- name: MONGO_HOST - name: MONGO_HOST
value: user-db:27017 value: user-db:27017
securityContext: securityContext:
runAsNonRoot: true runAsNonRoot: true
runAsUser: 10001 runAsUser: 10001
capabilities: capabilities:
drop: drop:
- all - all
add: add:
- NET_BIND_SERVICE - NET_BIND_SERVICE
readOnlyRootFilesystem: true readOnlyRootFilesystem: true
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /health path: /health
port: 80 port: 80
initialDelaySeconds: 300 initialDelaySeconds: 300
periodSeconds: 3 periodSeconds: 3
readinessProbe: readinessProbe:
httpGet: httpGet:
path: /health path: /health
port: 80 port: 80
initialDelaySeconds: 180 initialDelaySeconds: 180
periodSeconds: 3 periodSeconds: 3
nodeSelector: nodeSelector:
beta.kubernetes.io/os: linux beta.kubernetes.io/os: linux

30
sock-shop/base/user-svc.yaml

@ -1,15 +1,15 @@
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: user name: user
labels: labels:
name: user name: user
spec: spec:
ports: ports:
# the port that this service should serve on # the port that this service should serve on
- port: 80 - port: 80
targetPort: 80 targetPort: 80
selector: selector:
name: user name: user

54
sock-shop/kustomization.yaml

@ -1,28 +1,28 @@
resources: resources:
- base/carts-db-dep.yaml - base/carts-db-dep.yaml
- base/carts-db-svc.yaml - base/carts-db-svc.yaml
- base/carts-dep.yaml - base/carts-dep.yaml
- base/catalogue-db-dep.yaml - base/catalogue-db-dep.yaml
- base/catalogue-db-svc.yaml - base/catalogue-db-svc.yaml
- base/catalogue-dep.yaml - base/catalogue-dep.yaml
- base/catalogue-svc.yaml - base/catalogue-svc.yaml
- base/front-end-dep.yaml - base/front-end-dep.yaml
- base/front-end-svc.yaml - base/front-end-svc.yaml
- base/orders-db-dep.yaml - base/orders-db-dep.yaml
- base/orders-db-svc.yaml - base/orders-db-svc.yaml
- base/orders-dep.yaml - base/orders-dep.yaml
- base/orders-svc.yaml - base/orders-svc.yaml
- base/payment-dep.yaml - base/payment-dep.yaml
- base/payment-svc.yaml - base/payment-svc.yaml
- base/queue-master-dep.yaml - base/queue-master-dep.yaml
- base/queue-master-svc.yaml - base/queue-master-svc.yaml
- base/rabbitmq-dep.yaml - base/rabbitmq-dep.yaml
- base/rabbitmq-svc.yaml - base/rabbitmq-svc.yaml
- base/session-db-dep.yaml - base/session-db-dep.yaml
- base/session-db-svc.yaml - base/session-db-svc.yaml
- base/shipping-dep.yaml - base/shipping-dep.yaml
- base/shipping-svc.yaml - base/shipping-svc.yaml
- base/user-db-dep.yaml - base/user-db-dep.yaml
- base/user-db-svc.yaml - base/user-db-svc.yaml
- base/user-dep.yaml - base/user-dep.yaml
- base/user-svc.yaml - base/user-svc.yaml

228
sync-waves/manifests.yaml

@ -1,114 +1,114 @@
--- ---
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
generateName: upgrade-sql-schema generateName: upgrade-sql-schema
annotations: annotations:
argocd.argoproj.io/hook: PreSync argocd.argoproj.io/hook: PreSync
spec: spec:
template: template:
spec: spec:
containers: containers:
- name: upgrade-sql-schema - name: upgrade-sql-schema
image: alpine:latest image: alpine:latest
command: ["sleep", "5"] command: ["sleep", "5"]
restartPolicy: Never restartPolicy: Never
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: ReplicaSet kind: ReplicaSet
metadata: metadata:
name: backend name: backend
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
tier: backend tier: backend
template: template:
metadata: metadata:
labels: labels:
tier: backend tier: backend
spec: spec:
containers: containers:
- name: main - name: main
image: nginx:latest image: nginx:latest
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: backend name: backend
spec: spec:
selector: selector:
tier: backend tier: backend
ports: ports:
- protocol: TCP - protocol: TCP
port: 8080 port: 8080
targetPort: 8080 targetPort: 8080
--- ---
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
name: 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: BeforeHookCreation argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
argocd.argoproj.io/sync-wave: "1" argocd.argoproj.io/sync-wave: "1"
spec: spec:
template: template:
spec: spec:
containers: containers:
- name: page-up - name: page-up
image: alpine:latest image: alpine:latest
command: ["sleep", "2"] command: ["sleep", "2"]
restartPolicy: Never restartPolicy: Never
backoffLimit: 0 backoffLimit: 0
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: ReplicaSet kind: ReplicaSet
metadata: metadata:
name: frontend name: frontend
annotations: annotations:
argocd.argoproj.io/sync-wave: "2" argocd.argoproj.io/sync-wave: "2"
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
tier: frontend tier: frontend
template: template:
metadata: metadata:
labels: labels:
tier: frontend tier: frontend
spec: spec:
containers: containers:
- name: main - name: main
image: nginx:latest image: nginx:latest
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: frontend name: frontend
annotations: annotations:
argocd.argoproj.io/sync-wave: "2" argocd.argoproj.io/sync-wave: "2"
spec: spec:
selector: selector:
tier: frontend tier: frontend
ports: ports:
- protocol: TCP - protocol: TCP
port: 80 port: 80
targetPort: 80 targetPort: 80
--- ---
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
name: 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: BeforeHookCreation argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
argocd.argoproj.io/sync-wave: "3" argocd.argoproj.io/sync-wave: "3"
spec: spec:
template: template:
spec: spec:
containers: containers:
- name: page-down - name: page-down
image: alpine:latest image: alpine:latest
command: ["sleep", "2"] command: ["sleep", "2"]
restartPolicy: Never restartPolicy: Never

Loading…
Cancel
Save