diff --git a/README.md b/README.md index 9b0ec34..09edf3e 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,21 @@ -# ArgoCD Example Apps - -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 explore ArgoCD and GitOps! - -| Application | Description | -|-------------|-------------| -| [guestbook](guestbook/) | A hello word guestbook app as plain YAML | -| [ksonnet-guestbook](ksonnet-guestbook/) | The guestbook app as a ksonnet app | -| [helm-guestbook](helm-guestbook/) | The guestbook app as a Helm chart | -| [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 | -| [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 | -| [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 | -| [sock-shop](sock-shop/) | A microservices demo app (https://microservices-demo.github.io) | -| [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) -| [apps](apps/) | An app composed of other apps | +# ArgoCD Example Apps + +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 explore ArgoCD and GitOps! + +| Application | Description | +|-------------|-------------| +| [guestbook](guestbook/) | A hello word guestbook app as plain YAML | +| [ksonnet-guestbook](ksonnet-guestbook/) | The guestbook app as a ksonnet app | +| [helm-guestbook](helm-guestbook/) | The guestbook app as a Helm chart | +| [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 | +| [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 | +| [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 | +| [sock-shop](sock-shop/) | A microservices demo app (https://microservices-demo.github.io) | +| [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) +| [apps](apps/) | An app composed of other apps | diff --git a/apps/Chart.yaml b/apps/Chart.yaml index a59772c..1c8c0d0 100644 --- a/apps/Chart.yaml +++ b/apps/Chart.yaml @@ -1,23 +1,23 @@ -apiVersion: v2 -name: applications -description: Applications - -# 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 -# to be deployed. -# -# 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 -# pipeline. Library charts do not define any templates and therefore cannot be deployed. -type: application - -# 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. -# Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.0 - -# 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 -# follow Semantic Versioning. They should reflect the version the application is using. -appVersion: "1.0" +apiVersion: v2 +name: applications +description: Applications + +# 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 +# to be deployed. +# +# 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 +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# 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. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# 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 +# follow Semantic Versioning. They should reflect the version the application is using. +appVersion: "1.0" diff --git a/apps/templates/helm-guestbook.yaml b/apps/templates/helm-guestbook.yaml index e1e5a8b..891338a 100644 --- a/apps/templates/helm-guestbook.yaml +++ b/apps/templates/helm-guestbook.yaml @@ -1,16 +1,16 @@ -apiVersion: argoproj.io/v1alpha1 -kind: Application -metadata: - name: helm-guestbook - namespace: argocd - finalizers: - - resources-finalizer.argocd.argoproj.io -spec: - destination: - namespace: helm-guestbook - server: {{ .Values.spec.destination.server }} - project: default - source: - path: helm-guestbook - repoURL: {{ .Values.spec.source.repoURL }} - targetRevision: {{ .Values.spec.source.targetRevision }} +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: helm-guestbook + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + destination: + namespace: helm-guestbook + server: {{ .Values.spec.destination.server }} + project: default + source: + path: helm-guestbook + repoURL: {{ .Values.spec.source.repoURL }} + targetRevision: {{ .Values.spec.source.targetRevision }} diff --git a/apps/templates/helm-hooks.yaml b/apps/templates/helm-hooks.yaml index 5f65a8d..6dbd0cf 100644 --- a/apps/templates/helm-hooks.yaml +++ b/apps/templates/helm-hooks.yaml @@ -1,17 +1,17 @@ -apiVersion: argoproj.io/v1alpha1 -kind: Application -metadata: - name: helm-hooks - namespace: argocd - finalizers: - - resources-finalizer.argocd.argoproj.io -spec: - destination: - namespace: helm-hooks - server: {{ .Values.spec.destination.server }} - project: default - source: - path: helm-hooks - repoURL: {{ .Values.spec.source.repoURL }} - targetRevision: {{ .Values.spec.source.targetRevision }} - +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: helm-hooks + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + destination: + namespace: helm-hooks + server: {{ .Values.spec.destination.server }} + project: default + source: + path: helm-hooks + repoURL: {{ .Values.spec.source.repoURL }} + targetRevision: {{ .Values.spec.source.targetRevision }} + diff --git a/apps/templates/kustomize-guestbook.yaml b/apps/templates/kustomize-guestbook.yaml index 7a36476..c6cf4b0 100644 --- a/apps/templates/kustomize-guestbook.yaml +++ b/apps/templates/kustomize-guestbook.yaml @@ -1,16 +1,16 @@ -apiVersion: argoproj.io/v1alpha1 -kind: Application -metadata: - name: kustomize-guestbook - namespace: argocd - finalizers: - - resources-finalizer.argocd.argoproj.io -spec: - destination: - namespace: kustomize-guestbook - server: {{ .Values.spec.destination.server }} - project: default - source: - path: kustomize-guestbook - repoURL: {{ .Values.spec.source.repoURL }} - targetRevision: {{ .Values.spec.source.targetRevision }} +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: kustomize-guestbook + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + destination: + namespace: kustomize-guestbook + server: {{ .Values.spec.destination.server }} + project: default + source: + path: kustomize-guestbook + repoURL: {{ .Values.spec.source.repoURL }} + targetRevision: {{ .Values.spec.source.targetRevision }} diff --git a/apps/templates/namespaces.yaml b/apps/templates/namespaces.yaml index 435e4ba..b7be07f 100644 --- a/apps/templates/namespaces.yaml +++ b/apps/templates/namespaces.yaml @@ -1,27 +1,27 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: helm-guestbook - annotations: - argocd.argoproj.io/sync-wave: "-1" ---- -apiVersion: v1 -kind: Namespace -metadata: - name: helm-hooks - annotations: - argocd.argoproj.io/sync-wave: "-1" ---- -apiVersion: v1 -kind: Namespace -metadata: - name: kustomize-guestbook - annotations: - argocd.argoproj.io/sync-wave: "-1" ---- -apiVersion: v1 -kind: Namespace -metadata: - name: sync-waves - annotations: - argocd.argoproj.io/sync-wave: "-1" +apiVersion: v1 +kind: Namespace +metadata: + name: helm-guestbook + annotations: + argocd.argoproj.io/sync-wave: "-1" +--- +apiVersion: v1 +kind: Namespace +metadata: + name: helm-hooks + annotations: + argocd.argoproj.io/sync-wave: "-1" +--- +apiVersion: v1 +kind: Namespace +metadata: + name: kustomize-guestbook + annotations: + argocd.argoproj.io/sync-wave: "-1" +--- +apiVersion: v1 +kind: Namespace +metadata: + name: sync-waves + annotations: + argocd.argoproj.io/sync-wave: "-1" diff --git a/apps/templates/sync-waves.yaml b/apps/templates/sync-waves.yaml index 24dbc9b..7c535d6 100644 --- a/apps/templates/sync-waves.yaml +++ b/apps/templates/sync-waves.yaml @@ -1,16 +1,16 @@ -apiVersion: argoproj.io/v1alpha1 -kind: Application -metadata: - name: sync-waves - namespace: argocd - finalizers: - - resources-finalizer.argocd.argoproj.io -spec: - destination: - namespace: sync-waves - server: {{ .Values.spec.destination.server }} - project: default - source: - path: sync-waves - repoURL: {{ .Values.spec.source.repoURL }} - targetRevision: {{ .Values.spec.source.targetRevision }} +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: sync-waves + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + destination: + namespace: sync-waves + server: {{ .Values.spec.destination.server }} + project: default + source: + path: sync-waves + repoURL: {{ .Values.spec.source.repoURL }} + targetRevision: {{ .Values.spec.source.targetRevision }} diff --git a/apps/values.yaml b/apps/values.yaml index cd66cc0..61bdc2a 100644 --- a/apps/values.yaml +++ b/apps/values.yaml @@ -1,6 +1,6 @@ -spec: - destination: - server: https://kubernetes.default.svc - source: - repoURL: https://github.com/argoproj/argocd-example-apps +spec: + destination: + server: https://kubernetes.default.svc + source: + repoURL: https://github.com/argoproj/argocd-example-apps targetRevision: HEAD \ No newline at end of file diff --git a/blue-green/.helmignore b/blue-green/.helmignore index f0c1319..daebc7d 100644 --- a/blue-green/.helmignore +++ b/blue-green/.helmignore @@ -1,21 +1,21 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*~ -# Various IDEs -.project -.idea/ -*.tmproj +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/blue-green/Chart.yaml b/blue-green/Chart.yaml index 6fac831..3df082c 100644 --- a/blue-green/Chart.yaml +++ b/blue-green/Chart.yaml @@ -1,23 +1,23 @@ -apiVersion: v2 -name: helm-guestbook -description: A Helm chart for Kubernetes - -# 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 -# to be deployed. -# -# 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 -# pipeline. Library charts do not define any templates and therefore cannot be deployed. -type: application - -# 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. -# Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.0 - -# 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 -# follow Semantic Versioning. They should reflect the version the application is using. -appVersion: "1.0" +apiVersion: v2 +name: helm-guestbook +description: A Helm chart for Kubernetes + +# 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 +# to be deployed. +# +# 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 +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# 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. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# 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 +# follow Semantic Versioning. They should reflect the version the application is using. +appVersion: "1.0" diff --git a/blue-green/README.md b/blue-green/README.md index b1ad020..ab3092a 100644 --- a/blue-green/README.md +++ b/blue-green/README.md @@ -1,30 +1,30 @@ -# Blue Green - -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): - -1. Install Argo Rollouts controller: https://github.com/argoproj/argo-rollouts#installation -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 -``` - -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: - -``` -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. -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: - -``` -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`. +# Blue Green + +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): + +1. Install Argo Rollouts controller: https://github.com/argoproj/argo-rollouts#installation +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 +``` + +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: + +``` +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. +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: + +``` +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`. diff --git a/blue-green/templates/NOTES.txt b/blue-green/templates/NOTES.txt index 37a1485..2eba1d3 100644 --- a/blue-green/templates/NOTES.txt +++ b/blue-green/templates/NOTES.txt @@ -1,19 +1,19 @@ -1. Get the application URL by running these commands: -{{- if .Values.ingress.enabled }} -{{- range .Values.ingress.hosts }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} -{{- end }} -{{- 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_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - echo http://$NODE_IP:$NODE_PORT -{{- else if contains "LoadBalancer" .Values.service.type }} - 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" . }}' - 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 }} -{{- 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}") - echo "Visit http://127.0.0.1:8080 to use your application" - kubectl port-forward $POD_NAME 8080:80 -{{- end }} +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.hosts }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} +{{- end }} +{{- 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_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + 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" . }}' + 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 }} +{{- 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}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:80 +{{- end }} diff --git a/blue-green/templates/_helpers.tpl b/blue-green/templates/_helpers.tpl index 20f5d8e..07ef93e 100644 --- a/blue-green/templates/_helpers.tpl +++ b/blue-green/templates/_helpers.tpl @@ -1,32 +1,32 @@ -{{/* vim: set filetype=mustache: */}} -{{/* -Expand the name of the chart. -*/}} -{{- define "helm-guestbook.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -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). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "helm-guestbook.fullname" -}} -{{- if .Values.fullnameOverride -}} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- $name := default .Chart.Name .Values.nameOverride -}} -{{- if contains $name .Release.Name -}} -{{- .Release.Name | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} -{{- end -}} -{{- end -}} -{{- end -}} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "helm-guestbook.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "helm-guestbook.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +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). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "helm-guestbook.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "helm-guestbook.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/blue-green/templates/rollout.yaml b/blue-green/templates/rollout.yaml index aa0b534..c31c5fb 100644 --- a/blue-green/templates/rollout.yaml +++ b/blue-green/templates/rollout.yaml @@ -1,56 +1,56 @@ -apiVersion: argoproj.io/v1alpha1 -kind: Rollout -metadata: - name: {{ template "helm-guestbook.fullname" . }} - labels: - app: {{ template "helm-guestbook.name" . }} - chart: {{ template "helm-guestbook.chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -spec: - replicas: {{ .Values.replicaCount }} - revisionHistoryLimit: 3 - selector: - matchLabels: - app: {{ template "helm-guestbook.name" . }} - release: {{ .Release.Name }} - strategy: - blueGreen: - activeService: {{ template "helm-guestbook.fullname" . }} - previewService: {{ template "helm-guestbook.fullname" . }}-preview - template: - metadata: - labels: - app: {{ template "helm-guestbook.name" . }} - release: {{ .Release.Name }} - spec: - containers: - - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - ports: - - name: http - containerPort: 80 - protocol: TCP - livenessProbe: - httpGet: - path: / - port: http - readinessProbe: - httpGet: - path: / - port: http - resources: -{{ toYaml .Values.resources | indent 12 }} - {{- with .Values.nodeSelector }} - nodeSelector: -{{ toYaml . | indent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: -{{ toYaml . | indent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: -{{ toYaml . | indent 8 }} - {{- end }} +apiVersion: argoproj.io/v1alpha1 +kind: Rollout +metadata: + name: {{ template "helm-guestbook.fullname" . }} + labels: + app: {{ template "helm-guestbook.name" . }} + chart: {{ template "helm-guestbook.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + revisionHistoryLimit: 3 + selector: + matchLabels: + app: {{ template "helm-guestbook.name" . }} + release: {{ .Release.Name }} + strategy: + blueGreen: + activeService: {{ template "helm-guestbook.fullname" . }} + previewService: {{ template "helm-guestbook.fullname" . }}-preview + template: + metadata: + labels: + app: {{ template "helm-guestbook.name" . }} + release: {{ .Release.Name }} + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 80 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + resources: +{{ toYaml .Values.resources | indent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} + {{- end }} diff --git a/blue-green/templates/services.yaml b/blue-green/templates/services.yaml index 0f4d0e0..096ec2c 100644 --- a/blue-green/templates/services.yaml +++ b/blue-green/templates/services.yaml @@ -1,40 +1,40 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: {{ template "helm-guestbook.fullname" . }} - labels: - app: {{ template "helm-guestbook.name" . }} - chart: {{ template "helm-guestbook.chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - app: {{ template "helm-guestbook.name" . }} - release: {{ .Release.Name }} ---- -apiVersion: v1 -kind: Service -metadata: - name: {{ template "helm-guestbook.fullname" . }}-preview - labels: - app: {{ template "helm-guestbook.name" . }} - chart: {{ template "helm-guestbook.chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - app: {{ template "helm-guestbook.name" . }} - release: {{ .Release.Name }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ template "helm-guestbook.fullname" . }} + labels: + app: {{ template "helm-guestbook.name" . }} + chart: {{ template "helm-guestbook.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + app: {{ template "helm-guestbook.name" . }} + release: {{ .Release.Name }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ template "helm-guestbook.fullname" . }}-preview + labels: + app: {{ template "helm-guestbook.name" . }} + chart: {{ template "helm-guestbook.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + app: {{ template "helm-guestbook.name" . }} + release: {{ .Release.Name }} diff --git a/blue-green/values.yaml b/blue-green/values.yaml index 3666712..7afca1d 100644 --- a/blue-green/values.yaml +++ b/blue-green/values.yaml @@ -1,45 +1,45 @@ -# Default values for helm-guestbook. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -replicaCount: 1 - -image: - repository: gcr.io/heptio-images/ks-guestbook-demo - tag: 0.1 - pullPolicy: IfNotPresent - -service: - type: ClusterIP - port: 80 - -ingress: - enabled: false - annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - path: / - hosts: - - chart-example.local - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local - -resources: {} - # 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 - # 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:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi - -nodeSelector: {} - -tolerations: [] - -affinity: {} +# Default values for helm-guestbook. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: gcr.io/heptio-images/ks-guestbook-demo + tag: 0.1 + pullPolicy: IfNotPresent + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + path: / + hosts: + - chart-example.local + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # 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 + # 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:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/branchtest b/branchtest new file mode 100644 index 0000000..e69de29 diff --git a/guestbook/guestbook-ui-deployment.yaml b/guestbook/guestbook-ui-deployment.yaml index f4f07a4..c13dfe3 100644 --- a/guestbook/guestbook-ui-deployment.yaml +++ b/guestbook/guestbook-ui-deployment.yaml @@ -1,20 +1,20 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: nginx -spec: - replicas: 1 - revisionHistoryLimit: 3 - selector: - matchLabels: - app: nginx - template: - metadata: - labels: - app: nginx - spec: - containers: - - image: nginx:latest - name: nginx - ports: - - containerPort: 80 +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx +spec: + replicas: 1 + revisionHistoryLimit: 3 + selector: + matchLabels: + app: nginx + template: + metadata: + labels: + app: nginx + spec: + containers: + - image: nginx:latest + name: nginx + ports: + - containerPort: 80 diff --git a/guestbook/guestbook-ui-svc.yaml b/guestbook/guestbook-ui-svc.yaml index 70482b8..2811b32 100644 --- a/guestbook/guestbook-ui-svc.yaml +++ b/guestbook/guestbook-ui-svc.yaml @@ -1,10 +1,10 @@ -apiVersion: v1 -kind: Service -metadata: - name: nginx -spec: - ports: - - port: 8888 - targetPort: 80 - selector: - app: nginx +apiVersion: v1 +kind: Service +metadata: + name: nginx +spec: + ports: + - port: 8888 + targetPort: 80 + selector: + app: nginx diff --git a/helm-dependency/Chart.yaml b/helm-dependency/Chart.yaml index 6e3c2bb..7be667d 100644 --- a/helm-dependency/Chart.yaml +++ b/helm-dependency/Chart.yaml @@ -1,28 +1,28 @@ -apiVersion: v2 -name: wordpress -description: A Helm chart for Kubernetes - -# 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 -# to be deployed. -# -# 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 -# pipeline. Library charts do not define any templates and therefore cannot be deployed. -type: application - -# 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. -# Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.0 - -# 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 -# follow Semantic Versioning. They should reflect the version the application is using. -appVersion: "1.0" - -dependencies: -- name: wordpress - version: 9.0.3 +apiVersion: v2 +name: wordpress +description: A Helm chart for Kubernetes + +# 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 +# to be deployed. +# +# 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 +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# 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. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# 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 +# follow Semantic Versioning. They should reflect the version the application is using. +appVersion: "1.0" + +dependencies: +- name: wordpress + version: 9.0.3 repository: https://charts.helm.sh/stable \ No newline at end of file diff --git a/helm-dependency/README.md b/helm-dependency/README.md index 7353e26..ef9bce0 100644 --- a/helm-dependency/README.md +++ b/helm-dependency/README.md @@ -1,55 +1,55 @@ -# Helm Dependencies - -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 -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: - -```yaml -dependencies: -- name: wordpress - version: 5.0.2 - repository: https://charts.helm.sh/stable -``` - -A custom values.yaml is used to customize the parameters of the wordpress helm chart: - -```yaml -wordpress: - wordpressPassword: foo - mariadb: - db: - password: bar - rootUser: - password: baz -``` - -### 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: -```yaml -- name: mariadb - version: 5.x.x - repository: https://charts.helm.sh/stable - condition: mariadb.enabled - tags: - - 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: -```yaml -mariadb: - enabled: false - -wordpress: - wordpressPassword: foo - mariadb: - enabled: false - externalDatabase: - host: localhost - user: bn_wordpress - password: "" - database: bitnami_wordpress - port: 3306 +# Helm Dependencies + +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 +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: + +```yaml +dependencies: +- name: wordpress + version: 5.0.2 + repository: https://charts.helm.sh/stable +``` + +A custom values.yaml is used to customize the parameters of the wordpress helm chart: + +```yaml +wordpress: + wordpressPassword: foo + mariadb: + db: + password: bar + rootUser: + password: baz +``` + +### 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: +```yaml +- name: mariadb + version: 5.x.x + repository: https://charts.helm.sh/stable + condition: mariadb.enabled + tags: + - 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: +```yaml +mariadb: + enabled: false + +wordpress: + wordpressPassword: foo + mariadb: + enabled: false + externalDatabase: + host: localhost + user: bn_wordpress + password: "" + database: bitnami_wordpress + port: 3306 ``` \ No newline at end of file diff --git a/helm-dependency/values-nomaria.yaml b/helm-dependency/values-nomaria.yaml index 98f17bc..a19942b 100644 --- a/helm-dependency/values-nomaria.yaml +++ b/helm-dependency/values-nomaria.yaml @@ -1,13 +1,13 @@ -mariadb: - enabled: false - -wordpress: - wordpressPassword: foo - mariadb: - enabled: false - externalDatabase: - host: localhost - user: bn_wordpress - password: "" - database: bitnami_wordpress +mariadb: + enabled: false + +wordpress: + wordpressPassword: foo + mariadb: + enabled: false + externalDatabase: + host: localhost + user: bn_wordpress + password: "" + database: bitnami_wordpress port: 3306 \ No newline at end of file diff --git a/helm-dependency/values.yaml b/helm-dependency/values.yaml index a954a18..9928982 100644 --- a/helm-dependency/values.yaml +++ b/helm-dependency/values.yaml @@ -1,7 +1,7 @@ -wordpress: - wordpressPassword: foo - mariadb: - db: - password: bar - rootUser: - password: baz +wordpress: + wordpressPassword: foo + mariadb: + db: + password: bar + rootUser: + password: baz diff --git a/helm-guestbook/.helmignore b/helm-guestbook/.helmignore index f0c1319..daebc7d 100644 --- a/helm-guestbook/.helmignore +++ b/helm-guestbook/.helmignore @@ -1,21 +1,21 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*~ -# Various IDEs -.project -.idea/ -*.tmproj +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/helm-guestbook/Chart.yaml b/helm-guestbook/Chart.yaml index 6fac831..3df082c 100644 --- a/helm-guestbook/Chart.yaml +++ b/helm-guestbook/Chart.yaml @@ -1,23 +1,23 @@ -apiVersion: v2 -name: helm-guestbook -description: A Helm chart for Kubernetes - -# 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 -# to be deployed. -# -# 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 -# pipeline. Library charts do not define any templates and therefore cannot be deployed. -type: application - -# 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. -# Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.0 - -# 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 -# follow Semantic Versioning. They should reflect the version the application is using. -appVersion: "1.0" +apiVersion: v2 +name: helm-guestbook +description: A Helm chart for Kubernetes + +# 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 +# to be deployed. +# +# 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 +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# 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. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# 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 +# follow Semantic Versioning. They should reflect the version the application is using. +appVersion: "1.0" diff --git a/helm-guestbook/templates/NOTES.txt b/helm-guestbook/templates/NOTES.txt index 37a1485..2eba1d3 100644 --- a/helm-guestbook/templates/NOTES.txt +++ b/helm-guestbook/templates/NOTES.txt @@ -1,19 +1,19 @@ -1. Get the application URL by running these commands: -{{- if .Values.ingress.enabled }} -{{- range .Values.ingress.hosts }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} -{{- end }} -{{- 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_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - echo http://$NODE_IP:$NODE_PORT -{{- else if contains "LoadBalancer" .Values.service.type }} - 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" . }}' - 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 }} -{{- 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}") - echo "Visit http://127.0.0.1:8080 to use your application" - kubectl port-forward $POD_NAME 8080:80 -{{- end }} +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.hosts }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} +{{- end }} +{{- 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_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + 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" . }}' + 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 }} +{{- 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}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:80 +{{- end }} diff --git a/helm-guestbook/templates/_helpers.tpl b/helm-guestbook/templates/_helpers.tpl index 20f5d8e..07ef93e 100644 --- a/helm-guestbook/templates/_helpers.tpl +++ b/helm-guestbook/templates/_helpers.tpl @@ -1,32 +1,32 @@ -{{/* vim: set filetype=mustache: */}} -{{/* -Expand the name of the chart. -*/}} -{{- define "helm-guestbook.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -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). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "helm-guestbook.fullname" -}} -{{- if .Values.fullnameOverride -}} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- $name := default .Chart.Name .Values.nameOverride -}} -{{- if contains $name .Release.Name -}} -{{- .Release.Name | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} -{{- end -}} -{{- end -}} -{{- end -}} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "helm-guestbook.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "helm-guestbook.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +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). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "helm-guestbook.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "helm-guestbook.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/helm-guestbook/templates/deployment.yaml b/helm-guestbook/templates/deployment.yaml index 980df25..9e74a3e 100644 --- a/helm-guestbook/templates/deployment.yaml +++ b/helm-guestbook/templates/deployment.yaml @@ -1,52 +1,52 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ template "helm-guestbook.fullname" . }} - labels: - app: {{ template "helm-guestbook.name" . }} - chart: {{ template "helm-guestbook.chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -spec: - replicas: {{ .Values.replicaCount }} - revisionHistoryLimit: 3 - selector: - matchLabels: - app: {{ template "helm-guestbook.name" . }} - release: {{ .Release.Name }} - template: - metadata: - labels: - app: {{ template "helm-guestbook.name" . }} - release: {{ .Release.Name }} - spec: - containers: - - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - ports: - - name: http - containerPort: 80 - protocol: TCP - livenessProbe: - httpGet: - path: / - port: http - readinessProbe: - httpGet: - path: / - port: http - resources: -{{ toYaml .Values.resources | indent 12 }} - {{- with .Values.nodeSelector }} - nodeSelector: -{{ toYaml . | indent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: -{{ toYaml . | indent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: -{{ toYaml . | indent 8 }} - {{- end }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ template "helm-guestbook.fullname" . }} + labels: + app: {{ template "helm-guestbook.name" . }} + chart: {{ template "helm-guestbook.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + revisionHistoryLimit: 3 + selector: + matchLabels: + app: {{ template "helm-guestbook.name" . }} + release: {{ .Release.Name }} + template: + metadata: + labels: + app: {{ template "helm-guestbook.name" . }} + release: {{ .Release.Name }} + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 80 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + resources: +{{ toYaml .Values.resources | indent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} + {{- end }} diff --git a/helm-guestbook/templates/service.yaml b/helm-guestbook/templates/service.yaml index b7aab0b..9db24d9 100644 --- a/helm-guestbook/templates/service.yaml +++ b/helm-guestbook/templates/service.yaml @@ -1,19 +1,19 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ template "helm-guestbook.fullname" . }} - labels: - app: {{ template "helm-guestbook.name" . }} - chart: {{ template "helm-guestbook.chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - app: {{ template "helm-guestbook.name" . }} - release: {{ .Release.Name }} +apiVersion: v1 +kind: Service +metadata: + name: {{ template "helm-guestbook.fullname" . }} + labels: + app: {{ template "helm-guestbook.name" . }} + chart: {{ template "helm-guestbook.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + app: {{ template "helm-guestbook.name" . }} + release: {{ .Release.Name }} diff --git a/helm-guestbook/values-production.yaml b/helm-guestbook/values-production.yaml index 42838b7..85ff6db 100644 --- a/helm-guestbook/values-production.yaml +++ b/helm-guestbook/values-production.yaml @@ -1,2 +1,2 @@ -service: - type: LoadBalancer +service: + type: LoadBalancer diff --git a/helm-guestbook/values.yaml b/helm-guestbook/values.yaml index 3666712..7afca1d 100644 --- a/helm-guestbook/values.yaml +++ b/helm-guestbook/values.yaml @@ -1,45 +1,45 @@ -# Default values for helm-guestbook. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -replicaCount: 1 - -image: - repository: gcr.io/heptio-images/ks-guestbook-demo - tag: 0.1 - pullPolicy: IfNotPresent - -service: - type: ClusterIP - port: 80 - -ingress: - enabled: false - annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - path: / - hosts: - - chart-example.local - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local - -resources: {} - # 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 - # 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:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi - -nodeSelector: {} - -tolerations: [] - -affinity: {} +# Default values for helm-guestbook. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: gcr.io/heptio-images/ks-guestbook-demo + tag: 0.1 + pullPolicy: IfNotPresent + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + path: / + hosts: + - chart-example.local + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # 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 + # 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:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/helm-hooks/manifests.yaml b/helm-hooks/manifests.yaml index dcd852d..880416c 100644 --- a/helm-hooks/manifests.yaml +++ b/helm-hooks/manifests.yaml @@ -1,82 +1,82 @@ ---- -apiVersion: batch/v1 -kind: Job -metadata: - generateName: upgrade-sql-schema - annotations: - helm.sh/hook: pre-install - helm.sh/hook-weight: "-2" -spec: - template: - spec: - containers: - - name: upgrade-sql-schema - image: alpine:latest - command: ["sleep", "5"] - restartPolicy: Never ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: maint-page-up - annotations: - helm.sh/hook: pre-install - helm.sh/hook-delete-policy: before-hook-creation - helm.sh/hook-weight: "-1" -spec: - template: - spec: - containers: - - name: page-up - image: alpine:latest - command: ["sleep", "2"] - restartPolicy: Never - backoffLimit: 0 ---- -apiVersion: apps/v1 -kind: ReplicaSet -metadata: - name: frontend -spec: - replicas: 1 - selector: - matchLabels: - tier: frontend - template: - metadata: - labels: - tier: frontend - spec: - containers: - - name: main - image: nginx:latest ---- -apiVersion: v1 -kind: Service -metadata: - name: frontend - annotations: - helm.sh/hook-weight: "2" -spec: - selector: - tier: frontend - ports: - - protocol: TCP - port: 80 - targetPort: 80 ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: maint-page-down - annotations: - helm.sh/hook: post-install - helm.sh/hook-delete-policy: before-hook-creation -spec: - template: - spec: - containers: - - name: page-down - image: alpine:latest - command: ["sleep", "2"] - restartPolicy: Never +--- +apiVersion: batch/v1 +kind: Job +metadata: + generateName: upgrade-sql-schema + annotations: + helm.sh/hook: pre-install + helm.sh/hook-weight: "-2" +spec: + template: + spec: + containers: + - name: upgrade-sql-schema + image: alpine:latest + command: ["sleep", "5"] + restartPolicy: Never +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: maint-page-up + annotations: + helm.sh/hook: pre-install + helm.sh/hook-delete-policy: before-hook-creation + helm.sh/hook-weight: "-1" +spec: + template: + spec: + containers: + - name: page-up + image: alpine:latest + command: ["sleep", "2"] + restartPolicy: Never + backoffLimit: 0 +--- +apiVersion: apps/v1 +kind: ReplicaSet +metadata: + name: frontend +spec: + replicas: 1 + selector: + matchLabels: + tier: frontend + template: + metadata: + labels: + tier: frontend + spec: + containers: + - name: main + image: nginx:latest +--- +apiVersion: v1 +kind: Service +metadata: + name: frontend + annotations: + helm.sh/hook-weight: "2" +spec: + selector: + tier: frontend + ports: + - protocol: TCP + port: 80 + targetPort: 80 +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: maint-page-down + annotations: + helm.sh/hook: post-install + helm.sh/hook-delete-policy: before-hook-creation +spec: + template: + spec: + containers: + - name: page-down + image: alpine:latest + command: ["sleep", "2"] + restartPolicy: Never diff --git a/jsonnet-guestbook-tla/guestbook-ui.jsonnet b/jsonnet-guestbook-tla/guestbook-ui.jsonnet index 7ecdfb2..da12790 100644 --- a/jsonnet-guestbook-tla/guestbook-ui.jsonnet +++ b/jsonnet-guestbook-tla/guestbook-ui.jsonnet @@ -1,65 +1,65 @@ -function ( - containerPort=80, - image="gcr.io/heptio-images/ks-guestbook-demo:0.2", - name="jsonnet-guestbook-ui", - replicas=1, - servicePort=80, - type="LoadBalancer" -) - [ - { - "apiVersion": "v1", - "kind": "Service", - "metadata": { - "name": name - }, - "spec": { - "ports": [ - { - "port": servicePort, - "targetPort": containerPort - } - ], - "selector": { - "app": name - }, - "type": type - } - }, - { - "apiVersion": "apps/v1", - "kind": "Deployment", - "metadata": { - "name": name - }, - "spec": { - "replicas": replicas, - "revisionHistoryLimit": 3, - "selector": { - "matchLabels": { - "app": name - }, - }, - "template": { - "metadata": { - "labels": { - "app": name - } - }, - "spec": { - "containers": [ - { - "image": image, - "name": name, - "ports": [ - { - "containerPort": containerPort - } - ] - } - ] - } - } - } - } - ] +function ( + containerPort=80, + image="gcr.io/heptio-images/ks-guestbook-demo:0.2", + name="jsonnet-guestbook-ui", + replicas=1, + servicePort=80, + type="LoadBalancer" +) + [ + { + "apiVersion": "v1", + "kind": "Service", + "metadata": { + "name": name + }, + "spec": { + "ports": [ + { + "port": servicePort, + "targetPort": containerPort + } + ], + "selector": { + "app": name + }, + "type": type + } + }, + { + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "name": name + }, + "spec": { + "replicas": replicas, + "revisionHistoryLimit": 3, + "selector": { + "matchLabels": { + "app": name + }, + }, + "template": { + "metadata": { + "labels": { + "app": name + } + }, + "spec": { + "containers": [ + { + "image": image, + "name": name, + "ports": [ + { + "containerPort": containerPort + } + ] + } + ] + } + } + } + } + ] diff --git a/jsonnet-guestbook/guestbook-ui.jsonnet b/jsonnet-guestbook/guestbook-ui.jsonnet index a4b1aa7..c75c35a 100644 --- a/jsonnet-guestbook/guestbook-ui.jsonnet +++ b/jsonnet-guestbook/guestbook-ui.jsonnet @@ -1,59 +1,59 @@ -local params = import 'params.libsonnet'; - -[ - { - "apiVersion": "v1", - "kind": "Service", - "metadata": { - "name": params.name - }, - "spec": { - "ports": [ - { - "port": params.servicePort, - "targetPort": params.containerPort - } - ], - "selector": { - "app": params.name - }, - "type": params.type - } - }, - { - "apiVersion": "apps/v1", - "kind": "Deployment", - "metadata": { - "name": params.name - }, - "spec": { - "replicas": params.replicas, - "revisionHistoryLimit": 3, - "selector": { - "matchLabels": { - "app": params.name - }, - }, - "template": { - "metadata": { - "labels": { - "app": params.name - } - }, - "spec": { - "containers": [ - { - "image": params.image, - "name": params.name, - "ports": [ - { - "containerPort": params.containerPort - } - ] - } - ] - } - } - } - } -] +local params = import 'params.libsonnet'; + +[ + { + "apiVersion": "v1", + "kind": "Service", + "metadata": { + "name": params.name + }, + "spec": { + "ports": [ + { + "port": params.servicePort, + "targetPort": params.containerPort + } + ], + "selector": { + "app": params.name + }, + "type": params.type + } + }, + { + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "name": params.name + }, + "spec": { + "replicas": params.replicas, + "revisionHistoryLimit": 3, + "selector": { + "matchLabels": { + "app": params.name + }, + }, + "template": { + "metadata": { + "labels": { + "app": params.name + } + }, + "spec": { + "containers": [ + { + "image": params.image, + "name": params.name, + "ports": [ + { + "containerPort": params.containerPort + } + ] + } + ] + } + } + } + } +] diff --git a/jsonnet-guestbook/params.libsonnet b/jsonnet-guestbook/params.libsonnet index 3120aad..29783ad 100644 --- a/jsonnet-guestbook/params.libsonnet +++ b/jsonnet-guestbook/params.libsonnet @@ -1,8 +1,8 @@ -{ - containerPort: 80, - image: "gcr.io/heptio-images/ks-guestbook-demo:0.2", - name: "jsonnet-guestbook-ui", - replicas: 1, - servicePort: 80, - type: "LoadBalancer", -} +{ + containerPort: 80, + image: "gcr.io/heptio-images/ks-guestbook-demo:0.2", + name: "jsonnet-guestbook-ui", + replicas: 1, + servicePort: 80, + type: "LoadBalancer", +} diff --git a/ksonnet-guestbook/.gitignore b/ksonnet-guestbook/.gitignore index f8714d3..862ddcc 100644 --- a/ksonnet-guestbook/.gitignore +++ b/ksonnet-guestbook/.gitignore @@ -1,4 +1,4 @@ -/lib -/.ksonnet/registries -/app.override.yaml -/.ks_environment +/lib +/.ksonnet/registries +/app.override.yaml +/.ks_environment diff --git a/ksonnet-guestbook/app.yaml b/ksonnet-guestbook/app.yaml index 6fc0b6a..b1d6b2d 100644 --- a/ksonnet-guestbook/app.yaml +++ b/ksonnet-guestbook/app.yaml @@ -1,23 +1,23 @@ -apiVersion: 0.1.0 -environments: - default: - destination: - namespace: default - server: https://kubernetes.default.svc - k8sVersion: v1.10.0 - path: default - dev: - destination: - namespace: dev - server: https://kubernetes.default.svc - k8sVersion: v1.10.0 - path: dev - prod: - destination: - namespace: prod - server: https://kubernetes.default.svc - k8sVersion: v1.10.0 - path: prod -kind: ksonnet.io/app -name: guestbook -version: 0.0.1 +apiVersion: 0.1.0 +environments: + default: + destination: + namespace: default + server: https://kubernetes.default.svc + k8sVersion: v1.10.0 + path: default + dev: + destination: + namespace: dev + server: https://kubernetes.default.svc + k8sVersion: v1.10.0 + path: dev + prod: + destination: + namespace: prod + server: https://kubernetes.default.svc + k8sVersion: v1.10.0 + path: prod +kind: ksonnet.io/app +name: guestbook +version: 0.0.1 diff --git a/ksonnet-guestbook/components/guestbook-ui.jsonnet b/ksonnet-guestbook/components/guestbook-ui.jsonnet index b615bdb..90d3a52 100644 --- a/ksonnet-guestbook/components/guestbook-ui.jsonnet +++ b/ksonnet-guestbook/components/guestbook-ui.jsonnet @@ -1,59 +1,59 @@ -local env = std.extVar("__ksonnet/environments"); -local params = std.extVar("__ksonnet/params").components["guestbook-ui"]; -[ - { - "apiVersion": "v1", - "kind": "Service", - "metadata": { - "name": params.name - }, - "spec": { - "ports": [ - { - "port": params.servicePort, - "targetPort": params.containerPort - } - ], - "selector": { - "app": params.name - }, - "type": params.type - } - }, - { - "apiVersion": "apps/v1", - "kind": "Deployment", - "metadata": { - "name": params.name - }, - "spec": { - "replicas": params.replicas, - "revisionHistoryLimit": 3, - "selector": { - "matchLabels": { - "app": params.name - }, - }, - "template": { - "metadata": { - "labels": { - "app": params.name - } - }, - "spec": { - "containers": [ - { - "image": params.image, - "name": params.name, - "ports": [ - { - "containerPort": params.containerPort - } - ] - } - ] - } - } - } - } -] +local env = std.extVar("__ksonnet/environments"); +local params = std.extVar("__ksonnet/params").components["guestbook-ui"]; +[ + { + "apiVersion": "v1", + "kind": "Service", + "metadata": { + "name": params.name + }, + "spec": { + "ports": [ + { + "port": params.servicePort, + "targetPort": params.containerPort + } + ], + "selector": { + "app": params.name + }, + "type": params.type + } + }, + { + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "name": params.name + }, + "spec": { + "replicas": params.replicas, + "revisionHistoryLimit": 3, + "selector": { + "matchLabels": { + "app": params.name + }, + }, + "template": { + "metadata": { + "labels": { + "app": params.name + } + }, + "spec": { + "containers": [ + { + "image": params.image, + "name": params.name, + "ports": [ + { + "containerPort": params.containerPort + } + ] + } + ] + } + } + } + } +] diff --git a/ksonnet-guestbook/components/params.libsonnet b/ksonnet-guestbook/components/params.libsonnet index 162ad1f..1e097c0 100644 --- a/ksonnet-guestbook/components/params.libsonnet +++ b/ksonnet-guestbook/components/params.libsonnet @@ -1,18 +1,18 @@ -{ - global: { - // User-defined global parameters; accessible to all component and environments, Ex: - // replicas: 4, - }, - components: { - // Component-level parameters, defined initially from 'ks prototype use ...' - // Each object below should correspond to a component in the components/ directory - "guestbook-ui": { - containerPort: 80, - image: "gcr.io/heptio-images/ks-guestbook-demo:0.2", - name: "ks-guestbook-ui", - replicas: 1, - servicePort: 80, - type: "LoadBalancer", - }, - }, -} +{ + global: { + // User-defined global parameters; accessible to all component and environments, Ex: + // replicas: 4, + }, + components: { + // Component-level parameters, defined initially from 'ks prototype use ...' + // Each object below should correspond to a component in the components/ directory + "guestbook-ui": { + containerPort: 80, + image: "gcr.io/heptio-images/ks-guestbook-demo:0.2", + name: "ks-guestbook-ui", + replicas: 1, + servicePort: 80, + type: "LoadBalancer", + }, + }, +} diff --git a/ksonnet-guestbook/environments/base.libsonnet b/ksonnet-guestbook/environments/base.libsonnet index a129aff..c37015e 100644 --- a/ksonnet-guestbook/environments/base.libsonnet +++ b/ksonnet-guestbook/environments/base.libsonnet @@ -1,4 +1,4 @@ -local components = std.extVar("__ksonnet/components"); -components + { - // Insert user-specified overrides here. -} +local components = std.extVar("__ksonnet/components"); +components + { + // Insert user-specified overrides here. +} diff --git a/ksonnet-guestbook/environments/default/globals.libsonnet b/ksonnet-guestbook/environments/default/globals.libsonnet index 7a73a41..e02aef2 100644 --- a/ksonnet-guestbook/environments/default/globals.libsonnet +++ b/ksonnet-guestbook/environments/default/globals.libsonnet @@ -1,2 +1,2 @@ -{ +{ } \ No newline at end of file diff --git a/ksonnet-guestbook/environments/default/main.jsonnet b/ksonnet-guestbook/environments/default/main.jsonnet index 58695a8..7b11b44 100644 --- a/ksonnet-guestbook/environments/default/main.jsonnet +++ b/ksonnet-guestbook/environments/default/main.jsonnet @@ -1,8 +1,8 @@ -local base = import "base.libsonnet"; -// uncomment if you reference ksonnet-lib -// local k = import "k.libsonnet"; - -base + { - // 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"}) -} +local base = import "base.libsonnet"; +// uncomment if you reference ksonnet-lib +// local k = import "k.libsonnet"; + +base + { + // 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"}) +} diff --git a/ksonnet-guestbook/environments/default/params.libsonnet b/ksonnet-guestbook/environments/default/params.libsonnet index b6eb32d..1ba9c2b 100644 --- a/ksonnet-guestbook/environments/default/params.libsonnet +++ b/ksonnet-guestbook/environments/default/params.libsonnet @@ -1,17 +1,17 @@ -local params = std.extVar("__ksonnet/params"); -local globals = import "globals.libsonnet"; -local envParams = params + { - components +: { - // Insert component parameter overrides here. Ex: - // guestbook +: { - // name: "guestbook-dev", - // replicas: params.global.replicas, - // }, - }, -}; - -{ - components: { - [x]: envParams.components[x] + globals, for x in std.objectFields(envParams.components) - }, -} +local params = std.extVar("__ksonnet/params"); +local globals = import "globals.libsonnet"; +local envParams = params + { + components +: { + // Insert component parameter overrides here. Ex: + // guestbook +: { + // name: "guestbook-dev", + // replicas: params.global.replicas, + // }, + }, +}; + +{ + components: { + [x]: envParams.components[x] + globals, for x in std.objectFields(envParams.components) + }, +} diff --git a/ksonnet-guestbook/environments/dev/globals.libsonnet b/ksonnet-guestbook/environments/dev/globals.libsonnet index 7a73a41..e02aef2 100644 --- a/ksonnet-guestbook/environments/dev/globals.libsonnet +++ b/ksonnet-guestbook/environments/dev/globals.libsonnet @@ -1,2 +1,2 @@ -{ +{ } \ No newline at end of file diff --git a/ksonnet-guestbook/environments/dev/main.jsonnet b/ksonnet-guestbook/environments/dev/main.jsonnet index 58695a8..7b11b44 100644 --- a/ksonnet-guestbook/environments/dev/main.jsonnet +++ b/ksonnet-guestbook/environments/dev/main.jsonnet @@ -1,8 +1,8 @@ -local base = import "base.libsonnet"; -// uncomment if you reference ksonnet-lib -// local k = import "k.libsonnet"; - -base + { - // 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"}) -} +local base = import "base.libsonnet"; +// uncomment if you reference ksonnet-lib +// local k = import "k.libsonnet"; + +base + { + // 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"}) +} diff --git a/ksonnet-guestbook/environments/dev/params.libsonnet b/ksonnet-guestbook/environments/dev/params.libsonnet index b6eb32d..1ba9c2b 100644 --- a/ksonnet-guestbook/environments/dev/params.libsonnet +++ b/ksonnet-guestbook/environments/dev/params.libsonnet @@ -1,17 +1,17 @@ -local params = std.extVar("__ksonnet/params"); -local globals = import "globals.libsonnet"; -local envParams = params + { - components +: { - // Insert component parameter overrides here. Ex: - // guestbook +: { - // name: "guestbook-dev", - // replicas: params.global.replicas, - // }, - }, -}; - -{ - components: { - [x]: envParams.components[x] + globals, for x in std.objectFields(envParams.components) - }, -} +local params = std.extVar("__ksonnet/params"); +local globals = import "globals.libsonnet"; +local envParams = params + { + components +: { + // Insert component parameter overrides here. Ex: + // guestbook +: { + // name: "guestbook-dev", + // replicas: params.global.replicas, + // }, + }, +}; + +{ + components: { + [x]: envParams.components[x] + globals, for x in std.objectFields(envParams.components) + }, +} diff --git a/ksonnet-guestbook/environments/prod/globals.libsonnet b/ksonnet-guestbook/environments/prod/globals.libsonnet index 7a73a41..e02aef2 100644 --- a/ksonnet-guestbook/environments/prod/globals.libsonnet +++ b/ksonnet-guestbook/environments/prod/globals.libsonnet @@ -1,2 +1,2 @@ -{ +{ } \ No newline at end of file diff --git a/ksonnet-guestbook/environments/prod/main.jsonnet b/ksonnet-guestbook/environments/prod/main.jsonnet index 58695a8..7b11b44 100644 --- a/ksonnet-guestbook/environments/prod/main.jsonnet +++ b/ksonnet-guestbook/environments/prod/main.jsonnet @@ -1,8 +1,8 @@ -local base = import "base.libsonnet"; -// uncomment if you reference ksonnet-lib -// local k = import "k.libsonnet"; - -base + { - // 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"}) -} +local base = import "base.libsonnet"; +// uncomment if you reference ksonnet-lib +// local k = import "k.libsonnet"; + +base + { + // 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"}) +} diff --git a/ksonnet-guestbook/environments/prod/params.libsonnet b/ksonnet-guestbook/environments/prod/params.libsonnet index b6eb32d..1ba9c2b 100644 --- a/ksonnet-guestbook/environments/prod/params.libsonnet +++ b/ksonnet-guestbook/environments/prod/params.libsonnet @@ -1,17 +1,17 @@ -local params = std.extVar("__ksonnet/params"); -local globals = import "globals.libsonnet"; -local envParams = params + { - components +: { - // Insert component parameter overrides here. Ex: - // guestbook +: { - // name: "guestbook-dev", - // replicas: params.global.replicas, - // }, - }, -}; - -{ - components: { - [x]: envParams.components[x] + globals, for x in std.objectFields(envParams.components) - }, -} +local params = std.extVar("__ksonnet/params"); +local globals = import "globals.libsonnet"; +local envParams = params + { + components +: { + // Insert component parameter overrides here. Ex: + // guestbook +: { + // name: "guestbook-dev", + // replicas: params.global.replicas, + // }, + }, +}; + +{ + components: { + [x]: envParams.components[x] + globals, for x in std.objectFields(envParams.components) + }, +} diff --git a/kustomize-guestbook/guestbook-ui-deployment.yaml b/kustomize-guestbook/guestbook-ui-deployment.yaml index 5688dcf..28d9eac 100644 --- a/kustomize-guestbook/guestbook-ui-deployment.yaml +++ b/kustomize-guestbook/guestbook-ui-deployment.yaml @@ -1,20 +1,20 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: guestbook-ui -spec: - replicas: 1 - revisionHistoryLimit: 3 - selector: - matchLabels: - app: guestbook-ui - template: - metadata: - labels: - app: guestbook-ui - spec: - containers: - - image: gcr.io/heptio-images/ks-guestbook-demo:0.1 - name: guestbook-ui - ports: - - containerPort: 80 +apiVersion: apps/v1 +kind: Deployment +metadata: + name: guestbook-ui +spec: + replicas: 1 + revisionHistoryLimit: 3 + selector: + matchLabels: + app: guestbook-ui + template: + metadata: + labels: + app: guestbook-ui + spec: + containers: + - image: gcr.io/heptio-images/ks-guestbook-demo:0.1 + name: guestbook-ui + ports: + - containerPort: 80 diff --git a/kustomize-guestbook/guestbook-ui-svc.yaml b/kustomize-guestbook/guestbook-ui-svc.yaml index e619b5c..7660d9f 100644 --- a/kustomize-guestbook/guestbook-ui-svc.yaml +++ b/kustomize-guestbook/guestbook-ui-svc.yaml @@ -1,10 +1,10 @@ -apiVersion: v1 -kind: Service -metadata: - name: guestbook-ui -spec: - ports: - - port: 80 - targetPort: 80 - selector: - app: guestbook-ui +apiVersion: v1 +kind: Service +metadata: + name: guestbook-ui +spec: + ports: + - port: 80 + targetPort: 80 + selector: + app: guestbook-ui diff --git a/kustomize-guestbook/kustomization.yaml b/kustomize-guestbook/kustomization.yaml index cbaba90..6267f0b 100644 --- a/kustomize-guestbook/kustomization.yaml +++ b/kustomize-guestbook/kustomization.yaml @@ -1,7 +1,7 @@ -namePrefix: kustomize- - -resources: -- guestbook-ui-deployment.yaml -- guestbook-ui-svc.yaml -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization +namePrefix: kustomize- + +resources: +- guestbook-ui-deployment.yaml +- guestbook-ui-svc.yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization diff --git a/plugins/README.md b/plugins/README.md index ea8645b..2467cfb 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -1,6 +1,6 @@ -# Config Management Plugins Examples - -| Application | Description | -|-------------|-------------| -| [kasane](kasane/) | The guestbook application as a `kasane` package. | -| [kustomized-helm](kustomized-helm/) | Application comprised of a `helm` chart and customized using `kustomize` | +# Config Management Plugins Examples + +| Application | Description | +|-------------|-------------| +| [kasane](kasane/) | The guestbook application as a `kasane` package. | +| [kustomized-helm](kustomized-helm/) | Application comprised of a `helm` chart and customized using `kustomize` | diff --git a/plugins/kasane/.gitignore b/plugins/kasane/.gitignore index db3a6fe..979bc08 100644 --- a/plugins/kasane/.gitignore +++ b/plugins/kasane/.gitignore @@ -1,2 +1,2 @@ -vendor -Kasanefile.lock +vendor +Kasanefile.lock diff --git a/plugins/kasane/Kasanefile b/plugins/kasane/Kasanefile index 173412e..1641eae 100644 --- a/plugins/kasane/Kasanefile +++ b/plugins/kasane/Kasanefile @@ -1,5 +1,5 @@ -layers: -- ../../guestbook/guestbook-ui-deployment.yaml -- patch.jsonnet -- ../../guestbook/guestbook-ui-svc.yaml - +layers: +- ../../guestbook/guestbook-ui-deployment.yaml +- patch.jsonnet +- ../../guestbook/guestbook-ui-svc.yaml + diff --git a/plugins/kasane/README.md b/plugins/kasane/README.md index bfed877..8faf14d 100644 --- a/plugins/kasane/README.md +++ b/plugins/kasane/README.md @@ -1,29 +1,29 @@ -# Kasane - -[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: - -* 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: - -```yaml -apiVersion: v1 -data: - configManagementPlugins: | - - name: kasane - init: - command: [kasane, update] - generate: - command: [kasane, show] -``` -* Create application using `kasane` as a config management plugin name. - -``` -argocd app create kasane \ - --config-management-plugin kasane \ - --repo https://github.com/argoproj/argocd-example-apps \ - --path plugins/kasane \ - --dest-server https://kubernetes.default.svc \ - --dest-namespace default -``` +# Kasane + +[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: + +* 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: + +```yaml +apiVersion: v1 +data: + configManagementPlugins: | + - name: kasane + init: + command: [kasane, update] + generate: + command: [kasane, show] +``` +* Create application using `kasane` as a config management plugin name. + +``` +argocd app create kasane \ + --config-management-plugin kasane \ + --repo https://github.com/argoproj/argocd-example-apps \ + --path plugins/kasane \ + --dest-server https://kubernetes.default.svc \ + --dest-namespace default +``` diff --git a/plugins/kasane/patch.jsonnet b/plugins/kasane/patch.jsonnet index f5190fb..d0fedc5 100644 --- a/plugins/kasane/patch.jsonnet +++ b/plugins/kasane/patch.jsonnet @@ -1,9 +1,9 @@ -function (layers) - -[ - layers[0] { - spec+: { - replicas: 2, - }, - } -] +function (layers) + +[ + layers[0] { + spec+: { + replicas: 2, + }, + } +] diff --git a/plugins/kustomized-helm/.gitignore b/plugins/kustomized-helm/.gitignore index 2582de3..e587ea5 100644 --- a/plugins/kustomized-helm/.gitignore +++ b/plugins/kustomized-helm/.gitignore @@ -1,3 +1,3 @@ -all.yaml -charts -requirements.lock +all.yaml +charts +requirements.lock diff --git a/plugins/kustomized-helm/Chart.yaml b/plugins/kustomized-helm/Chart.yaml index 946f402..ec0b82d 100644 --- a/plugins/kustomized-helm/Chart.yaml +++ b/plugins/kustomized-helm/Chart.yaml @@ -1,28 +1,28 @@ -apiVersion: v2 -name: guestbook -description: A Helm chart for Kubernetes - -# 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 -# to be deployed. -# -# 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 -# pipeline. Library charts do not define any templates and therefore cannot be deployed. -type: application - -# 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. -# Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.0 - -# 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 -# follow Semantic Versioning. They should reflect the version the application is using. -appVersion: "1.0" - -dependencies: -- name: helm-guestbook - version: 0.1.0 +apiVersion: v2 +name: guestbook +description: A Helm chart for Kubernetes + +# 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 +# to be deployed. +# +# 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 +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# 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. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# 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 +# follow Semantic Versioning. They should reflect the version the application is using. +appVersion: "1.0" + +dependencies: +- name: helm-guestbook + version: 0.1.0 repository: file://../../helm-guestbook \ No newline at end of file diff --git a/plugins/kustomized-helm/README.md b/plugins/kustomized-helm/README.md index e93b202..3418f86 100644 --- a/plugins/kustomized-helm/README.md +++ b/plugins/kustomized-helm/README.md @@ -1,31 +1,31 @@ -# 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 -as a config management plugin in Argo CD. - -Use following steps to try the application: - -* configure `kustomized-helm` tool in `argocd-cm` ConfigMap: - -```yaml - configManagementPlugins: | - - name: kustomized-helm - init: - command: ["/bin/sh", "-c"] - args: ["helm dependency build"] - generate: - command: [sh, -c] - args: ["helm template --release-name release-name . > all.yaml && kustomize build"] -``` - -* create application using `kustomized-helm` as a config management plugin name: - - -``` -argocd app create kustomized-helm \ - --config-management-plugin kustomized-helm \ - --repo https://github.com/argoproj/argocd-example-apps \ - --path plugins/kustomized-helm \ - --dest-server https://kubernetes.default.svc \ - --dest-namespace default -``` +# 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 +as a config management plugin in Argo CD. + +Use following steps to try the application: + +* configure `kustomized-helm` tool in `argocd-cm` ConfigMap: + +```yaml + configManagementPlugins: | + - name: kustomized-helm + init: + command: ["/bin/sh", "-c"] + args: ["helm dependency build"] + generate: + command: [sh, -c] + args: ["helm template --release-name release-name . > all.yaml && kustomize build"] +``` + +* create application using `kustomized-helm` as a config management plugin name: + + +``` +argocd app create kustomized-helm \ + --config-management-plugin kustomized-helm \ + --repo https://github.com/argoproj/argocd-example-apps \ + --path plugins/kustomized-helm \ + --dest-server https://kubernetes.default.svc \ + --dest-namespace default +``` diff --git a/plugins/kustomized-helm/kustomization.yaml b/plugins/kustomized-helm/kustomization.yaml index 23018b7..15fa23d 100644 --- a/plugins/kustomized-helm/kustomization.yaml +++ b/plugins/kustomized-helm/kustomization.yaml @@ -1,7 +1,7 @@ -namePrefix: kustomize- - -resources: -- ./all.yaml - -patches: -- overlays/guestbook-deployment.yaml +namePrefix: kustomize- + +resources: +- ./all.yaml + +patches: +- overlays/guestbook-deployment.yaml diff --git a/plugins/kustomized-helm/overlays/guestbook-deployment.yaml b/plugins/kustomized-helm/overlays/guestbook-deployment.yaml index fd424c4..2056939 100644 --- a/plugins/kustomized-helm/overlays/guestbook-deployment.yaml +++ b/plugins/kustomized-helm/overlays/guestbook-deployment.yaml @@ -1,10 +1,10 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: release-name-helm-guestbook -spec: - template: - spec: - containers: - - name: helm-guestbook - image: "gcr.io/heptio-images/ks-guestbook-demo:0.2" +apiVersion: apps/v1 +kind: Deployment +metadata: + name: release-name-helm-guestbook +spec: + template: + spec: + containers: + - name: helm-guestbook + image: "gcr.io/heptio-images/ks-guestbook-demo:0.2" diff --git a/pre-post-sync/kustomization.yaml b/pre-post-sync/kustomization.yaml index 6797052..da49292 100644 --- a/pre-post-sync/kustomization.yaml +++ b/pre-post-sync/kustomization.yaml @@ -1,8 +1,8 @@ -namePrefix: pre-post-sync- - -bases: -- ../kustomize-guestbook - -resources: -- pre-sync-job.yaml -- post-sync-job.yaml +namePrefix: pre-post-sync- + +bases: +- ../kustomize-guestbook + +resources: +- pre-sync-job.yaml +- post-sync-job.yaml diff --git a/pre-post-sync/post-sync-job.yaml b/pre-post-sync/post-sync-job.yaml index cef38f0..b36c00e 100644 --- a/pre-post-sync/post-sync-job.yaml +++ b/pre-post-sync/post-sync-job.yaml @@ -1,16 +1,16 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: after - annotations: - argocd.argoproj.io/hook: PostSync - argocd.argoproj.io/hook-delete-policy: HookSucceeded -spec: - template: - spec: - containers: - - name: sleep - image: alpine:latest - command: ["sleep", "10"] - restartPolicy: Never - backoffLimit: 0 +apiVersion: batch/v1 +kind: Job +metadata: + name: after + annotations: + argocd.argoproj.io/hook: PostSync + argocd.argoproj.io/hook-delete-policy: HookSucceeded +spec: + template: + spec: + containers: + - name: sleep + image: alpine:latest + command: ["sleep", "10"] + restartPolicy: Never + backoffLimit: 0 diff --git a/pre-post-sync/pre-sync-job.yaml b/pre-post-sync/pre-sync-job.yaml index 110ddeb..800bc7a 100644 --- a/pre-post-sync/pre-sync-job.yaml +++ b/pre-post-sync/pre-sync-job.yaml @@ -1,16 +1,16 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: before - annotations: - argocd.argoproj.io/hook: PreSync - argocd.argoproj.io/hook-delete-policy: HookSucceeded -spec: - template: - spec: - containers: - - name: sleep - image: alpine:latest - command: ["sleep", "10"] - restartPolicy: Never - backoffLimit: 0 +apiVersion: batch/v1 +kind: Job +metadata: + name: before + annotations: + argocd.argoproj.io/hook: PreSync + argocd.argoproj.io/hook-delete-policy: HookSucceeded +spec: + template: + spec: + containers: + - name: sleep + image: alpine:latest + command: ["sleep", "10"] + restartPolicy: Never + backoffLimit: 0 diff --git a/sock-shop/base/carts-db-dep.yaml b/sock-shop/base/carts-db-dep.yaml index 5452b6f..7c3b643 100644 --- a/sock-shop/base/carts-db-dep.yaml +++ b/sock-shop/base/carts-db-dep.yaml @@ -1,41 +1,41 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: carts-db - labels: - name: carts-db -spec: - replicas: 1 - selector: - matchLabels: - name: carts-db - template: - metadata: - labels: - name: carts-db - spec: - containers: - - name: carts-db - image: mongo - ports: - - name: mongo - containerPort: 27017 - securityContext: - capabilities: - drop: - - all - add: - - CHOWN - - SETGID - - SETUID - readOnlyRootFilesystem: true - volumeMounts: - - mountPath: /tmp - name: tmp-volume - volumes: - - name: tmp-volume - emptyDir: - medium: Memory - nodeSelector: - beta.kubernetes.io/os: linux +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: carts-db + labels: + name: carts-db +spec: + replicas: 1 + selector: + matchLabels: + name: carts-db + template: + metadata: + labels: + name: carts-db + spec: + containers: + - name: carts-db + image: mongo + ports: + - name: mongo + containerPort: 27017 + securityContext: + capabilities: + drop: + - all + add: + - CHOWN + - SETGID + - SETUID + readOnlyRootFilesystem: true + volumeMounts: + - mountPath: /tmp + name: tmp-volume + volumes: + - name: tmp-volume + emptyDir: + medium: Memory + nodeSelector: + beta.kubernetes.io/os: linux diff --git a/sock-shop/base/carts-db-svc.yaml b/sock-shop/base/carts-db-svc.yaml index df88dd9..eff85a8 100644 --- a/sock-shop/base/carts-db-svc.yaml +++ b/sock-shop/base/carts-db-svc.yaml @@ -1,14 +1,14 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: carts-db - labels: - name: carts-db -spec: - ports: - # the port that this service should serve on - - port: 27017 - targetPort: 27017 - selector: - name: carts-db +--- +apiVersion: v1 +kind: Service +metadata: + name: carts-db + labels: + name: carts-db +spec: + ports: + # the port that this service should serve on + - port: 27017 + targetPort: 27017 + selector: + name: carts-db diff --git a/sock-shop/base/carts-dep.yaml b/sock-shop/base/carts-dep.yaml index 7c44ff0..fba2af0 100644 --- a/sock-shop/base/carts-dep.yaml +++ b/sock-shop/base/carts-dep.yaml @@ -1,64 +1,64 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: carts - labels: - name: carts -spec: - replicas: 1 - selector: - matchLabels: - name: carts - template: - metadata: - labels: - name: carts - spec: - containers: - - name: carts - image: weaveworksdemos/carts:0.4.8 - env: - - name: ZIPKIN - value: zipkin.jaeger.svc.cluster.local - - name: JAVA_OPTS - value: -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC -Djava.security.egd=file:/dev/urandom - resources: - limits: - cpu: 300m - memory: 500Mi - requests: - cpu: 300m - memory: 500Mi - ports: - - containerPort: 80 - securityContext: - runAsNonRoot: true - runAsUser: 10001 - capabilities: - drop: - - all - add: - - NET_BIND_SERVICE - readOnlyRootFilesystem: true - volumeMounts: - - mountPath: /tmp - name: tmp-volume - livenessProbe: - httpGet: - path: /health - port: 80 - initialDelaySeconds: 300 - periodSeconds: 3 - readinessProbe: - httpGet: - path: /health - port: 80 - initialDelaySeconds: 180 - periodSeconds: 3 - volumes: - - name: tmp-volume - emptyDir: - medium: Memory - nodeSelector: - beta.kubernetes.io/os: linux +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: carts + labels: + name: carts +spec: + replicas: 1 + selector: + matchLabels: + name: carts + template: + metadata: + labels: + name: carts + spec: + containers: + - name: carts + image: weaveworksdemos/carts:0.4.8 + env: + - name: ZIPKIN + value: zipkin.jaeger.svc.cluster.local + - name: JAVA_OPTS + value: -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC -Djava.security.egd=file:/dev/urandom + resources: + limits: + cpu: 300m + memory: 500Mi + requests: + cpu: 300m + memory: 500Mi + ports: + - containerPort: 80 + securityContext: + runAsNonRoot: true + runAsUser: 10001 + capabilities: + drop: + - all + add: + - NET_BIND_SERVICE + readOnlyRootFilesystem: true + volumeMounts: + - mountPath: /tmp + name: tmp-volume + livenessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 300 + periodSeconds: 3 + readinessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 180 + periodSeconds: 3 + volumes: + - name: tmp-volume + emptyDir: + medium: Memory + nodeSelector: + beta.kubernetes.io/os: linux diff --git a/sock-shop/base/catalogue-db-dep.yaml b/sock-shop/base/catalogue-db-dep.yaml index 23890fa..581ea50 100644 --- a/sock-shop/base/catalogue-db-dep.yaml +++ b/sock-shop/base/catalogue-db-dep.yaml @@ -1,30 +1,30 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: catalogue-db - labels: - name: catalogue-db -spec: - replicas: 1 - selector: - matchLabels: - name: catalogue-db - template: - metadata: - labels: - name: catalogue-db - spec: - containers: - - name: catalogue-db - image: weaveworksdemos/catalogue-db:0.3.0 - env: - - name: MYSQL_ROOT_PASSWORD - value: fake_password - - name: MYSQL_DATABASE - value: socksdb - ports: - - name: mysql - containerPort: 3306 - nodeSelector: - beta.kubernetes.io/os: linux +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: catalogue-db + labels: + name: catalogue-db +spec: + replicas: 1 + selector: + matchLabels: + name: catalogue-db + template: + metadata: + labels: + name: catalogue-db + spec: + containers: + - name: catalogue-db + image: weaveworksdemos/catalogue-db:0.3.0 + env: + - name: MYSQL_ROOT_PASSWORD + value: fake_password + - name: MYSQL_DATABASE + value: socksdb + ports: + - name: mysql + containerPort: 3306 + nodeSelector: + beta.kubernetes.io/os: linux diff --git a/sock-shop/base/catalogue-db-svc.yaml b/sock-shop/base/catalogue-db-svc.yaml index 683b9ce..8119034 100644 --- a/sock-shop/base/catalogue-db-svc.yaml +++ b/sock-shop/base/catalogue-db-svc.yaml @@ -1,14 +1,14 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: catalogue-db - labels: - name: catalogue-db -spec: - ports: - # the port that this service should serve on - - port: 3306 - targetPort: 3306 - selector: - name: catalogue-db +--- +apiVersion: v1 +kind: Service +metadata: + name: catalogue-db + labels: + name: catalogue-db +spec: + ports: + # the port that this service should serve on + - port: 3306 + targetPort: 3306 + selector: + name: catalogue-db diff --git a/sock-shop/base/catalogue-dep.yaml b/sock-shop/base/catalogue-dep.yaml index cfa66dc..f10be36 100644 --- a/sock-shop/base/catalogue-dep.yaml +++ b/sock-shop/base/catalogue-dep.yaml @@ -1,52 +1,52 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: catalogue - labels: - name: catalogue -spec: - replicas: 1 - selector: - matchLabels: - name: catalogue - template: - metadata: - labels: - name: catalogue - spec: - containers: - - name: catalogue - image: weaveworksdemos/catalogue:0.3.5 - resources: - limits: - cpu: 100m - memory: 100Mi - requests: - cpu: 100m - memory: 100Mi - ports: - - containerPort: 80 - securityContext: - runAsNonRoot: true - runAsUser: 10001 - capabilities: - drop: - - all - add: - - NET_BIND_SERVICE - readOnlyRootFilesystem: true - livenessProbe: - httpGet: - path: /health - port: 80 - initialDelaySeconds: 300 - periodSeconds: 3 - readinessProbe: - httpGet: - path: /health - port: 80 - initialDelaySeconds: 180 - periodSeconds: 3 - nodeSelector: - beta.kubernetes.io/os: linux +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: catalogue + labels: + name: catalogue +spec: + replicas: 1 + selector: + matchLabels: + name: catalogue + template: + metadata: + labels: + name: catalogue + spec: + containers: + - name: catalogue + image: weaveworksdemos/catalogue:0.3.5 + resources: + limits: + cpu: 100m + memory: 100Mi + requests: + cpu: 100m + memory: 100Mi + ports: + - containerPort: 80 + securityContext: + runAsNonRoot: true + runAsUser: 10001 + capabilities: + drop: + - all + add: + - NET_BIND_SERVICE + readOnlyRootFilesystem: true + livenessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 300 + periodSeconds: 3 + readinessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 180 + periodSeconds: 3 + nodeSelector: + beta.kubernetes.io/os: linux diff --git a/sock-shop/base/catalogue-svc.yaml b/sock-shop/base/catalogue-svc.yaml index ed948f5..3f3ec11 100644 --- a/sock-shop/base/catalogue-svc.yaml +++ b/sock-shop/base/catalogue-svc.yaml @@ -1,14 +1,14 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: catalogue - labels: - name: catalogue -spec: - ports: - # the port that this service should serve on - - port: 80 - targetPort: 80 - selector: - name: catalogue +--- +apiVersion: v1 +kind: Service +metadata: + name: catalogue + labels: + name: catalogue +spec: + ports: + # the port that this service should serve on + - port: 80 + targetPort: 80 + selector: + name: catalogue diff --git a/sock-shop/base/front-end-dep.yaml b/sock-shop/base/front-end-dep.yaml index 069c5ef..d6ba54f 100644 --- a/sock-shop/base/front-end-dep.yaml +++ b/sock-shop/base/front-end-dep.yaml @@ -1,51 +1,51 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: front-end -spec: - replicas: 1 - selector: - matchLabels: - name: front-end - template: - metadata: - labels: - name: front-end - spec: - containers: - - name: front-end - image: weaveworksdemos/front-end:0.3.12 - resources: - limits: - cpu: 300m - memory: 1000Mi - requests: - cpu: 100m - memory: 300Mi - ports: - - containerPort: 8079 - env: - - name: SESSION_REDIS - value: "true" - securityContext: - runAsNonRoot: true - runAsUser: 10001 - capabilities: - drop: - - all - readOnlyRootFilesystem: true - livenessProbe: - httpGet: - path: / - port: 8079 - initialDelaySeconds: 300 - periodSeconds: 3 - readinessProbe: - httpGet: - path: / - port: 8079 - initialDelaySeconds: 30 - periodSeconds: 3 - nodeSelector: - beta.kubernetes.io/os: linux +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: front-end +spec: + replicas: 1 + selector: + matchLabels: + name: front-end + template: + metadata: + labels: + name: front-end + spec: + containers: + - name: front-end + image: weaveworksdemos/front-end:0.3.12 + resources: + limits: + cpu: 300m + memory: 1000Mi + requests: + cpu: 100m + memory: 300Mi + ports: + - containerPort: 8079 + env: + - name: SESSION_REDIS + value: "true" + securityContext: + runAsNonRoot: true + runAsUser: 10001 + capabilities: + drop: + - all + readOnlyRootFilesystem: true + livenessProbe: + httpGet: + path: / + port: 8079 + initialDelaySeconds: 300 + periodSeconds: 3 + readinessProbe: + httpGet: + path: / + port: 8079 + initialDelaySeconds: 30 + periodSeconds: 3 + nodeSelector: + beta.kubernetes.io/os: linux diff --git a/sock-shop/base/front-end-svc.yaml b/sock-shop/base/front-end-svc.yaml index 5249bb4..fae81c5 100644 --- a/sock-shop/base/front-end-svc.yaml +++ b/sock-shop/base/front-end-svc.yaml @@ -1,15 +1,15 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: front-end - labels: - name: front-end -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: 8079 - nodePort: 30001 - selector: - name: front-end +--- +apiVersion: v1 +kind: Service +metadata: + name: front-end + labels: + name: front-end +spec: + type: LoadBalancer + ports: + - port: 80 + targetPort: 8079 + nodePort: 30001 + selector: + name: front-end diff --git a/sock-shop/base/orders-db-dep.yaml b/sock-shop/base/orders-db-dep.yaml index 30b7181..aa61f45 100644 --- a/sock-shop/base/orders-db-dep.yaml +++ b/sock-shop/base/orders-db-dep.yaml @@ -1,41 +1,41 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: orders-db - labels: - name: orders-db -spec: - replicas: 1 - selector: - matchLabels: - name: orders-db - template: - metadata: - labels: - name: orders-db - spec: - containers: - - name: orders-db - image: mongo - ports: - - name: mongo - containerPort: 27017 - securityContext: - capabilities: - drop: - - all - add: - - CHOWN - - SETGID - - SETUID - readOnlyRootFilesystem: true - volumeMounts: - - mountPath: /tmp - name: tmp-volume - volumes: - - name: tmp-volume - emptyDir: - medium: Memory - nodeSelector: - beta.kubernetes.io/os: linux +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: orders-db + labels: + name: orders-db +spec: + replicas: 1 + selector: + matchLabels: + name: orders-db + template: + metadata: + labels: + name: orders-db + spec: + containers: + - name: orders-db + image: mongo + ports: + - name: mongo + containerPort: 27017 + securityContext: + capabilities: + drop: + - all + add: + - CHOWN + - SETGID + - SETUID + readOnlyRootFilesystem: true + volumeMounts: + - mountPath: /tmp + name: tmp-volume + volumes: + - name: tmp-volume + emptyDir: + medium: Memory + nodeSelector: + beta.kubernetes.io/os: linux diff --git a/sock-shop/base/orders-db-svc.yaml b/sock-shop/base/orders-db-svc.yaml index 7ddd3bb..81e0274 100644 --- a/sock-shop/base/orders-db-svc.yaml +++ b/sock-shop/base/orders-db-svc.yaml @@ -1,14 +1,14 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: orders-db - labels: - name: orders-db -spec: - ports: - # the port that this service should serve on - - port: 27017 - targetPort: 27017 - selector: - name: orders-db +--- +apiVersion: v1 +kind: Service +metadata: + name: orders-db + labels: + name: orders-db +spec: + ports: + # the port that this service should serve on + - port: 27017 + targetPort: 27017 + selector: + name: orders-db diff --git a/sock-shop/base/orders-dep.yaml b/sock-shop/base/orders-dep.yaml index b31d9ad..5b67ad6 100644 --- a/sock-shop/base/orders-dep.yaml +++ b/sock-shop/base/orders-dep.yaml @@ -1,64 +1,64 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: orders - labels: - name: orders -spec: - replicas: 1 - selector: - matchLabels: - name: orders - template: - metadata: - labels: - name: orders - spec: - containers: - - name: orders - image: weaveworksdemos/orders:0.4.7 - env: - - name: ZIPKIN - value: zipkin.jaeger.svc.cluster.local - - name: JAVA_OPTS - value: -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC -Djava.security.egd=file:/dev/urandom - resources: - limits: - cpu: 500m - memory: 500Mi - requests: - cpu: 200m - memory: 500Mi - ports: - - containerPort: 80 - securityContext: - runAsNonRoot: true - runAsUser: 10001 - capabilities: - drop: - - all - add: - - NET_BIND_SERVICE - readOnlyRootFilesystem: true - volumeMounts: - - mountPath: /tmp - name: tmp-volume - livenessProbe: - httpGet: - path: /health - port: 80 - initialDelaySeconds: 300 - periodSeconds: 3 - readinessProbe: - httpGet: - path: /health - port: 80 - initialDelaySeconds: 180 - periodSeconds: 3 - volumes: - - name: tmp-volume - emptyDir: - medium: Memory - nodeSelector: - beta.kubernetes.io/os: linux +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: orders + labels: + name: orders +spec: + replicas: 1 + selector: + matchLabels: + name: orders + template: + metadata: + labels: + name: orders + spec: + containers: + - name: orders + image: weaveworksdemos/orders:0.4.7 + env: + - name: ZIPKIN + value: zipkin.jaeger.svc.cluster.local + - name: JAVA_OPTS + value: -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC -Djava.security.egd=file:/dev/urandom + resources: + limits: + cpu: 500m + memory: 500Mi + requests: + cpu: 200m + memory: 500Mi + ports: + - containerPort: 80 + securityContext: + runAsNonRoot: true + runAsUser: 10001 + capabilities: + drop: + - all + add: + - NET_BIND_SERVICE + readOnlyRootFilesystem: true + volumeMounts: + - mountPath: /tmp + name: tmp-volume + livenessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 300 + periodSeconds: 3 + readinessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 180 + periodSeconds: 3 + volumes: + - name: tmp-volume + emptyDir: + medium: Memory + nodeSelector: + beta.kubernetes.io/os: linux diff --git a/sock-shop/base/orders-svc.yaml b/sock-shop/base/orders-svc.yaml index 6be52c4..ae82ca6 100644 --- a/sock-shop/base/orders-svc.yaml +++ b/sock-shop/base/orders-svc.yaml @@ -1,14 +1,14 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: orders - labels: - name: orders -spec: - ports: - # the port that this service should serve on - - port: 80 - targetPort: 80 - selector: - name: orders +--- +apiVersion: v1 +kind: Service +metadata: + name: orders + labels: + name: orders +spec: + ports: + # the port that this service should serve on + - port: 80 + targetPort: 80 + selector: + name: orders diff --git a/sock-shop/base/payment-dep.yaml b/sock-shop/base/payment-dep.yaml index 4477eea..6b34e31 100644 --- a/sock-shop/base/payment-dep.yaml +++ b/sock-shop/base/payment-dep.yaml @@ -1,52 +1,52 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: payment - labels: - name: payment -spec: - replicas: 1 - selector: - matchLabels: - name: payment - template: - metadata: - labels: - name: payment - spec: - containers: - - name: payment - image: weaveworksdemos/payment:0.4.3 - resources: - limits: - cpu: 100m - memory: 100Mi - requests: - cpu: 99m - memory: 100Mi - ports: - - containerPort: 80 - securityContext: - runAsNonRoot: true - runAsUser: 10001 - capabilities: - drop: - - all - add: - - NET_BIND_SERVICE - readOnlyRootFilesystem: true - livenessProbe: - httpGet: - path: /health - port: 80 - initialDelaySeconds: 300 - periodSeconds: 3 - readinessProbe: - httpGet: - path: /health - port: 80 - initialDelaySeconds: 180 - periodSeconds: 3 - nodeSelector: - beta.kubernetes.io/os: linux +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: payment + labels: + name: payment +spec: + replicas: 1 + selector: + matchLabels: + name: payment + template: + metadata: + labels: + name: payment + spec: + containers: + - name: payment + image: weaveworksdemos/payment:0.4.3 + resources: + limits: + cpu: 100m + memory: 100Mi + requests: + cpu: 99m + memory: 100Mi + ports: + - containerPort: 80 + securityContext: + runAsNonRoot: true + runAsUser: 10001 + capabilities: + drop: + - all + add: + - NET_BIND_SERVICE + readOnlyRootFilesystem: true + livenessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 300 + periodSeconds: 3 + readinessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 180 + periodSeconds: 3 + nodeSelector: + beta.kubernetes.io/os: linux diff --git a/sock-shop/base/payment-svc.yaml b/sock-shop/base/payment-svc.yaml index dbe8fcc..76544f9 100644 --- a/sock-shop/base/payment-svc.yaml +++ b/sock-shop/base/payment-svc.yaml @@ -1,14 +1,14 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: payment - labels: - name: payment -spec: - ports: - # the port that this service should serve on - - port: 80 - targetPort: 80 - selector: - name: payment +--- +apiVersion: v1 +kind: Service +metadata: + name: payment + labels: + name: payment +spec: + ports: + # the port that this service should serve on + - port: 80 + targetPort: 80 + selector: + name: payment diff --git a/sock-shop/base/queue-master-dep.yaml b/sock-shop/base/queue-master-dep.yaml index 626e69f..f31fab6 100644 --- a/sock-shop/base/queue-master-dep.yaml +++ b/sock-shop/base/queue-master-dep.yaml @@ -1,48 +1,48 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: queue-master - labels: - name: queue-master -spec: - replicas: 1 - selector: - matchLabels: - name: queue-master - template: - metadata: - labels: - name: queue-master - spec: - containers: - - name: queue-master - image: weaveworksdemos/queue-master:0.3.1 - env: - - name: ZIPKIN - value: zipkin.jaeger.svc.cluster.local - - name: JAVA_OPTS - value: -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC -Djava.security.egd=file:/dev/urandom - resources: - limits: - cpu: 300m - memory: 500Mi - requests: - cpu: 300m - memory: 500Mi - ports: - - containerPort: 80 - livenessProbe: - httpGet: - path: /health - port: 80 - initialDelaySeconds: 300 - periodSeconds: 3 - readinessProbe: - httpGet: - path: /health - port: 80 - initialDelaySeconds: 180 - periodSeconds: 3 - nodeSelector: - beta.kubernetes.io/os: linux +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: queue-master + labels: + name: queue-master +spec: + replicas: 1 + selector: + matchLabels: + name: queue-master + template: + metadata: + labels: + name: queue-master + spec: + containers: + - name: queue-master + image: weaveworksdemos/queue-master:0.3.1 + env: + - name: ZIPKIN + value: zipkin.jaeger.svc.cluster.local + - name: JAVA_OPTS + value: -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC -Djava.security.egd=file:/dev/urandom + resources: + limits: + cpu: 300m + memory: 500Mi + requests: + cpu: 300m + memory: 500Mi + ports: + - containerPort: 80 + livenessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 300 + periodSeconds: 3 + readinessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 180 + periodSeconds: 3 + nodeSelector: + beta.kubernetes.io/os: linux diff --git a/sock-shop/base/queue-master-svc.yaml b/sock-shop/base/queue-master-svc.yaml index fa7a6ae..3c9d045 100644 --- a/sock-shop/base/queue-master-svc.yaml +++ b/sock-shop/base/queue-master-svc.yaml @@ -1,16 +1,16 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: queue-master - labels: - name: queue-master - annotations: - prometheus.io/path: "/prometheus" -spec: - ports: - # the port that this service should serve on - - port: 80 - targetPort: 80 - selector: - name: queue-master +--- +apiVersion: v1 +kind: Service +metadata: + name: queue-master + labels: + name: queue-master + annotations: + prometheus.io/path: "/prometheus" +spec: + ports: + # the port that this service should serve on + - port: 80 + targetPort: 80 + selector: + name: queue-master diff --git a/sock-shop/base/rabbitmq-dep.yaml b/sock-shop/base/rabbitmq-dep.yaml index 064c6f6..394f803 100644 --- a/sock-shop/base/rabbitmq-dep.yaml +++ b/sock-shop/base/rabbitmq-dep.yaml @@ -1,44 +1,44 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: rabbitmq - labels: - name: rabbitmq -spec: - replicas: 1 - selector: - matchLabels: - name: rabbitmq - template: - metadata: - labels: - name: rabbitmq - annotations: - prometheus.io/scrape: "false" - spec: - containers: - - name: rabbitmq - image: rabbitmq:3.6.8-management - ports: - - containerPort: 15672 - name: management - - containerPort: 5672 - name: rabbitmq - securityContext: - capabilities: - drop: - - all - add: - - CHOWN - - SETGID - - SETUID - - DAC_OVERRIDE - readOnlyRootFilesystem: true - - name: rabbitmq-exporter - image: kbudde/rabbitmq-exporter - ports: - - containerPort: 9090 - name: exporter - nodeSelector: - beta.kubernetes.io/os: linux +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: rabbitmq + labels: + name: rabbitmq +spec: + replicas: 1 + selector: + matchLabels: + name: rabbitmq + template: + metadata: + labels: + name: rabbitmq + annotations: + prometheus.io/scrape: "false" + spec: + containers: + - name: rabbitmq + image: rabbitmq:3.6.8-management + ports: + - containerPort: 15672 + name: management + - containerPort: 5672 + name: rabbitmq + securityContext: + capabilities: + drop: + - all + add: + - CHOWN + - SETGID + - SETUID + - DAC_OVERRIDE + readOnlyRootFilesystem: true + - name: rabbitmq-exporter + image: kbudde/rabbitmq-exporter + ports: + - containerPort: 9090 + name: exporter + nodeSelector: + beta.kubernetes.io/os: linux diff --git a/sock-shop/base/rabbitmq-svc.yaml b/sock-shop/base/rabbitmq-svc.yaml index 322513c..0c24843 100644 --- a/sock-shop/base/rabbitmq-svc.yaml +++ b/sock-shop/base/rabbitmq-svc.yaml @@ -1,19 +1,19 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: rabbitmq - labels: - name: rabbitmq -spec: - ports: - # the port that this service should serve on - - port: 5672 - name: rabbitmq - targetPort: 5672 - - port: 9090 - name: exporter - targetPort: exporter - protocol: TCP - selector: - name: rabbitmq +--- +apiVersion: v1 +kind: Service +metadata: + name: rabbitmq + labels: + name: rabbitmq +spec: + ports: + # the port that this service should serve on + - port: 5672 + name: rabbitmq + targetPort: 5672 + - port: 9090 + name: exporter + targetPort: exporter + protocol: TCP + selector: + name: rabbitmq diff --git a/sock-shop/base/session-db-dep.yaml b/sock-shop/base/session-db-dep.yaml index 85cfed9..6ec570e 100644 --- a/sock-shop/base/session-db-dep.yaml +++ b/sock-shop/base/session-db-dep.yaml @@ -1,36 +1,36 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: session-db - labels: - name: session-db -spec: - replicas: 1 - selector: - matchLabels: - name: session-db - template: - metadata: - labels: - name: session-db - annotations: - prometheus.io.scrape: "false" - spec: - containers: - - name: session-db - image: redis:alpine - ports: - - name: redis - containerPort: 6379 - securityContext: - capabilities: - drop: - - all - add: - - CHOWN - - SETGID - - SETUID - readOnlyRootFilesystem: true - nodeSelector: - beta.kubernetes.io/os: linux +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: session-db + labels: + name: session-db +spec: + replicas: 1 + selector: + matchLabels: + name: session-db + template: + metadata: + labels: + name: session-db + annotations: + prometheus.io.scrape: "false" + spec: + containers: + - name: session-db + image: redis:alpine + ports: + - name: redis + containerPort: 6379 + securityContext: + capabilities: + drop: + - all + add: + - CHOWN + - SETGID + - SETUID + readOnlyRootFilesystem: true + nodeSelector: + beta.kubernetes.io/os: linux diff --git a/sock-shop/base/session-db-svc.yaml b/sock-shop/base/session-db-svc.yaml index a792ea4..45c03f2 100644 --- a/sock-shop/base/session-db-svc.yaml +++ b/sock-shop/base/session-db-svc.yaml @@ -1,14 +1,14 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: session-db - labels: - name: session-db -spec: - ports: - # the port that this service should serve on - - port: 6379 - targetPort: 6379 - selector: - name: session-db +--- +apiVersion: v1 +kind: Service +metadata: + name: session-db + labels: + name: session-db +spec: + ports: + # the port that this service should serve on + - port: 6379 + targetPort: 6379 + selector: + name: session-db diff --git a/sock-shop/base/shipping-dep.yaml b/sock-shop/base/shipping-dep.yaml index af8d90b..bbac646 100644 --- a/sock-shop/base/shipping-dep.yaml +++ b/sock-shop/base/shipping-dep.yaml @@ -1,64 +1,64 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: shipping - labels: - name: shipping -spec: - replicas: 1 - selector: - matchLabels: - name: shipping - template: - metadata: - labels: - name: shipping - spec: - containers: - - name: shipping - image: weaveworksdemos/shipping:0.4.8 - env: - - name: ZIPKIN - value: zipkin.jaeger.svc.cluster.local - - name: JAVA_OPTS - value: -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC -Djava.security.egd=file:/dev/urandom - resources: - limits: - cpu: 300m - memory: 500Mi - requests: - cpu: 300m - memory: 500Mi - ports: - - containerPort: 80 - securityContext: - runAsNonRoot: true - runAsUser: 10001 - capabilities: - drop: - - all - add: - - NET_BIND_SERVICE - readOnlyRootFilesystem: true - volumeMounts: - - mountPath: /tmp - name: tmp-volume - livenessProbe: - httpGet: - path: /health - port: 80 - initialDelaySeconds: 300 - periodSeconds: 3 - readinessProbe: - httpGet: - path: /health - port: 80 - initialDelaySeconds: 180 - periodSeconds: 3 - volumes: - - name: tmp-volume - emptyDir: - medium: Memory - nodeSelector: - beta.kubernetes.io/os: linux +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: shipping + labels: + name: shipping +spec: + replicas: 1 + selector: + matchLabels: + name: shipping + template: + metadata: + labels: + name: shipping + spec: + containers: + - name: shipping + image: weaveworksdemos/shipping:0.4.8 + env: + - name: ZIPKIN + value: zipkin.jaeger.svc.cluster.local + - name: JAVA_OPTS + value: -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC -Djava.security.egd=file:/dev/urandom + resources: + limits: + cpu: 300m + memory: 500Mi + requests: + cpu: 300m + memory: 500Mi + ports: + - containerPort: 80 + securityContext: + runAsNonRoot: true + runAsUser: 10001 + capabilities: + drop: + - all + add: + - NET_BIND_SERVICE + readOnlyRootFilesystem: true + volumeMounts: + - mountPath: /tmp + name: tmp-volume + livenessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 300 + periodSeconds: 3 + readinessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 180 + periodSeconds: 3 + volumes: + - name: tmp-volume + emptyDir: + medium: Memory + nodeSelector: + beta.kubernetes.io/os: linux diff --git a/sock-shop/base/shipping-svc.yaml b/sock-shop/base/shipping-svc.yaml index aac156c..140d744 100644 --- a/sock-shop/base/shipping-svc.yaml +++ b/sock-shop/base/shipping-svc.yaml @@ -1,15 +1,15 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: shipping - labels: - name: shipping -spec: - ports: - # the port that this service should serve on - - port: 80 - targetPort: 80 - selector: - name: shipping - +--- +apiVersion: v1 +kind: Service +metadata: + name: shipping + labels: + name: shipping +spec: + ports: + # the port that this service should serve on + - port: 80 + targetPort: 80 + selector: + name: shipping + diff --git a/sock-shop/base/user-db-dep.yaml b/sock-shop/base/user-db-dep.yaml index 41ec058..620f84f 100644 --- a/sock-shop/base/user-db-dep.yaml +++ b/sock-shop/base/user-db-dep.yaml @@ -1,42 +1,42 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: user-db - labels: - name: user-db -spec: - replicas: 1 - selector: - matchLabels: - name: user-db - template: - metadata: - labels: - name: user-db - spec: - containers: - - name: user-db - image: weaveworksdemos/user-db:0.3.0 - - ports: - - name: mongo - containerPort: 27017 - securityContext: - capabilities: - drop: - - all - add: - - CHOWN - - SETGID - - SETUID - readOnlyRootFilesystem: true - volumeMounts: - - mountPath: /tmp - name: tmp-volume - volumes: - - name: tmp-volume - emptyDir: - medium: Memory - nodeSelector: +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: user-db + labels: + name: user-db +spec: + replicas: 1 + selector: + matchLabels: + name: user-db + template: + metadata: + labels: + name: user-db + spec: + containers: + - name: user-db + image: weaveworksdemos/user-db:0.3.0 + + ports: + - name: mongo + containerPort: 27017 + securityContext: + capabilities: + drop: + - all + add: + - CHOWN + - SETGID + - SETUID + readOnlyRootFilesystem: true + volumeMounts: + - mountPath: /tmp + name: tmp-volume + volumes: + - name: tmp-volume + emptyDir: + medium: Memory + nodeSelector: beta.kubernetes.io/os: linux \ No newline at end of file diff --git a/sock-shop/base/user-db-svc.yaml b/sock-shop/base/user-db-svc.yaml index ace9d1a..fde0f42 100644 --- a/sock-shop/base/user-db-svc.yaml +++ b/sock-shop/base/user-db-svc.yaml @@ -1,15 +1,15 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: user-db - labels: - name: user-db -spec: - ports: - # the port that this service should serve on - - port: 27017 - targetPort: 27017 - selector: - name: user-db - +--- +apiVersion: v1 +kind: Service +metadata: + name: user-db + labels: + name: user-db +spec: + ports: + # the port that this service should serve on + - port: 27017 + targetPort: 27017 + selector: + name: user-db + diff --git a/sock-shop/base/user-dep.yaml b/sock-shop/base/user-dep.yaml index 228ad3e..f4f77e4 100644 --- a/sock-shop/base/user-dep.yaml +++ b/sock-shop/base/user-dep.yaml @@ -1,55 +1,55 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: user - labels: - name: user -spec: - replicas: 1 - selector: - matchLabels: - name: user - template: - metadata: - labels: - name: user - spec: - containers: - - name: user - image: weaveworksdemos/user:0.4.7 - resources: - limits: - cpu: 300m - memory: 100Mi - requests: - cpu: 100m - memory: 100Mi - ports: - - containerPort: 80 - env: - - name: MONGO_HOST - value: user-db:27017 - securityContext: - runAsNonRoot: true - runAsUser: 10001 - capabilities: - drop: - - all - add: - - NET_BIND_SERVICE - readOnlyRootFilesystem: true - livenessProbe: - httpGet: - path: /health - port: 80 - initialDelaySeconds: 300 - periodSeconds: 3 - readinessProbe: - httpGet: - path: /health - port: 80 - initialDelaySeconds: 180 - periodSeconds: 3 - nodeSelector: - beta.kubernetes.io/os: linux +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: user + labels: + name: user +spec: + replicas: 1 + selector: + matchLabels: + name: user + template: + metadata: + labels: + name: user + spec: + containers: + - name: user + image: weaveworksdemos/user:0.4.7 + resources: + limits: + cpu: 300m + memory: 100Mi + requests: + cpu: 100m + memory: 100Mi + ports: + - containerPort: 80 + env: + - name: MONGO_HOST + value: user-db:27017 + securityContext: + runAsNonRoot: true + runAsUser: 10001 + capabilities: + drop: + - all + add: + - NET_BIND_SERVICE + readOnlyRootFilesystem: true + livenessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 300 + periodSeconds: 3 + readinessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 180 + periodSeconds: 3 + nodeSelector: + beta.kubernetes.io/os: linux diff --git a/sock-shop/base/user-svc.yaml b/sock-shop/base/user-svc.yaml index f01c118..d8fc562 100644 --- a/sock-shop/base/user-svc.yaml +++ b/sock-shop/base/user-svc.yaml @@ -1,15 +1,15 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: user - labels: - name: user -spec: - ports: - # the port that this service should serve on - - port: 80 - targetPort: 80 - selector: - name: user - +--- +apiVersion: v1 +kind: Service +metadata: + name: user + labels: + name: user +spec: + ports: + # the port that this service should serve on + - port: 80 + targetPort: 80 + selector: + name: user + diff --git a/sock-shop/kustomization.yaml b/sock-shop/kustomization.yaml index bcc3578..f458a19 100644 --- a/sock-shop/kustomization.yaml +++ b/sock-shop/kustomization.yaml @@ -1,28 +1,28 @@ -resources: -- base/carts-db-dep.yaml -- base/carts-db-svc.yaml -- base/carts-dep.yaml -- base/catalogue-db-dep.yaml -- base/catalogue-db-svc.yaml -- base/catalogue-dep.yaml -- base/catalogue-svc.yaml -- base/front-end-dep.yaml -- base/front-end-svc.yaml -- base/orders-db-dep.yaml -- base/orders-db-svc.yaml -- base/orders-dep.yaml -- base/orders-svc.yaml -- base/payment-dep.yaml -- base/payment-svc.yaml -- base/queue-master-dep.yaml -- base/queue-master-svc.yaml -- base/rabbitmq-dep.yaml -- base/rabbitmq-svc.yaml -- base/session-db-dep.yaml -- base/session-db-svc.yaml -- base/shipping-dep.yaml -- base/shipping-svc.yaml -- base/user-db-dep.yaml -- base/user-db-svc.yaml -- base/user-dep.yaml +resources: +- base/carts-db-dep.yaml +- base/carts-db-svc.yaml +- base/carts-dep.yaml +- base/catalogue-db-dep.yaml +- base/catalogue-db-svc.yaml +- base/catalogue-dep.yaml +- base/catalogue-svc.yaml +- base/front-end-dep.yaml +- base/front-end-svc.yaml +- base/orders-db-dep.yaml +- base/orders-db-svc.yaml +- base/orders-dep.yaml +- base/orders-svc.yaml +- base/payment-dep.yaml +- base/payment-svc.yaml +- base/queue-master-dep.yaml +- base/queue-master-svc.yaml +- base/rabbitmq-dep.yaml +- base/rabbitmq-svc.yaml +- base/session-db-dep.yaml +- base/session-db-svc.yaml +- base/shipping-dep.yaml +- base/shipping-svc.yaml +- base/user-db-dep.yaml +- base/user-db-svc.yaml +- base/user-dep.yaml - base/user-svc.yaml \ No newline at end of file diff --git a/sync-waves/manifests.yaml b/sync-waves/manifests.yaml index 8f39133..9177fd6 100644 --- a/sync-waves/manifests.yaml +++ b/sync-waves/manifests.yaml @@ -1,114 +1,114 @@ ---- -apiVersion: batch/v1 -kind: Job -metadata: - generateName: upgrade-sql-schema - annotations: - argocd.argoproj.io/hook: PreSync -spec: - template: - spec: - containers: - - name: upgrade-sql-schema - image: alpine:latest - command: ["sleep", "5"] - restartPolicy: Never ---- -apiVersion: apps/v1 -kind: ReplicaSet -metadata: - name: backend -spec: - replicas: 1 - selector: - matchLabels: - tier: backend - template: - metadata: - labels: - tier: backend - spec: - containers: - - name: main - image: nginx:latest ---- -apiVersion: v1 -kind: Service -metadata: - name: backend -spec: - selector: - tier: backend - ports: - - protocol: TCP - port: 8080 - targetPort: 8080 ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: maint-page-up - annotations: - argocd.argoproj.io/hook: Sync - argocd.argoproj.io/hook-delete-policy: BeforeHookCreation - argocd.argoproj.io/sync-wave: "1" -spec: - template: - spec: - containers: - - name: page-up - image: alpine:latest - command: ["sleep", "2"] - restartPolicy: Never - backoffLimit: 0 ---- -apiVersion: apps/v1 -kind: ReplicaSet -metadata: - name: frontend - annotations: - argocd.argoproj.io/sync-wave: "2" -spec: - replicas: 1 - selector: - matchLabels: - tier: frontend - template: - metadata: - labels: - tier: frontend - spec: - containers: - - name: main - image: nginx:latest ---- -apiVersion: v1 -kind: Service -metadata: - name: frontend - annotations: - argocd.argoproj.io/sync-wave: "2" -spec: - selector: - tier: frontend - ports: - - protocol: TCP - port: 80 - targetPort: 80 ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: maint-page-down - annotations: - argocd.argoproj.io/hook: Sync - argocd.argoproj.io/hook-delete-policy: BeforeHookCreation - argocd.argoproj.io/sync-wave: "3" -spec: - template: - spec: - containers: - - name: page-down - image: alpine:latest - command: ["sleep", "2"] - restartPolicy: Never +--- +apiVersion: batch/v1 +kind: Job +metadata: + generateName: upgrade-sql-schema + annotations: + argocd.argoproj.io/hook: PreSync +spec: + template: + spec: + containers: + - name: upgrade-sql-schema + image: alpine:latest + command: ["sleep", "5"] + restartPolicy: Never +--- +apiVersion: apps/v1 +kind: ReplicaSet +metadata: + name: backend +spec: + replicas: 1 + selector: + matchLabels: + tier: backend + template: + metadata: + labels: + tier: backend + spec: + containers: + - name: main + image: nginx:latest +--- +apiVersion: v1 +kind: Service +metadata: + name: backend +spec: + selector: + tier: backend + ports: + - protocol: TCP + port: 8080 + targetPort: 8080 +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: maint-page-up + annotations: + argocd.argoproj.io/hook: Sync + argocd.argoproj.io/hook-delete-policy: BeforeHookCreation + argocd.argoproj.io/sync-wave: "1" +spec: + template: + spec: + containers: + - name: page-up + image: alpine:latest + command: ["sleep", "2"] + restartPolicy: Never + backoffLimit: 0 +--- +apiVersion: apps/v1 +kind: ReplicaSet +metadata: + name: frontend + annotations: + argocd.argoproj.io/sync-wave: "2" +spec: + replicas: 1 + selector: + matchLabels: + tier: frontend + template: + metadata: + labels: + tier: frontend + spec: + containers: + - name: main + image: nginx:latest +--- +apiVersion: v1 +kind: Service +metadata: + name: frontend + annotations: + argocd.argoproj.io/sync-wave: "2" +spec: + selector: + tier: frontend + ports: + - protocol: TCP + port: 80 + targetPort: 80 +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: maint-page-down + annotations: + argocd.argoproj.io/hook: Sync + argocd.argoproj.io/hook-delete-policy: BeforeHookCreation + argocd.argoproj.io/sync-wave: "3" +spec: + template: + spec: + containers: + - name: page-down + image: alpine:latest + command: ["sleep", "2"] + restartPolicy: Never