Skip to content

Commit b39f4cf

Browse files
docs: Mention Helm support. Fixes argoproj#1119 (argoproj#1211)
Signed-off-by: Kostis Kapelonis <[email protected]>
1 parent 725cb88 commit b39f4cf

File tree

11 files changed

+356
-1
lines changed

11 files changed

+356
-1
lines changed

docs/features/helm.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Using Argo Rollouts with Helm
2+
3+
Argo Rollouts will always respond to changes in Rollouts resources regardless of how the change was made.
4+
This means that Argo Rollouts is compatible with all templating solutions that you might use to manage
5+
your deployments.
6+
7+
Argo Rollouts manifests can be managed with the [Helm package manager](https://helm.sh/). If your Helm chart contains Rollout Resources,
8+
then as soon as you install/upgrade your chart, Argo Rollouts will take over and initiate the progressive delivery
9+
process.
10+
11+
Here is an example Rollout that is managed with Helm:
12+
13+
```yaml
14+
apiVersion: argoproj.io/v1alpha1
15+
kind: Rollout
16+
metadata:
17+
name: {{ template "helm-guestbook.fullname" . }}
18+
labels:
19+
app: {{ template "helm-guestbook.name" . }}
20+
chart: {{ template "helm-guestbook.chart" . }}
21+
release: {{ .Release.Name }}
22+
heritage: {{ .Release.Service }}
23+
spec:
24+
replicas: {{ .Values.replicaCount }}
25+
revisionHistoryLimit: 3
26+
selector:
27+
matchLabels:
28+
app: {{ template "helm-guestbook.name" . }}
29+
release: {{ .Release.Name }}
30+
strategy:
31+
blueGreen:
32+
activeService: {{ template "helm-guestbook.fullname" . }}
33+
previewService: {{ template "helm-guestbook.fullname" . }}-preview
34+
template:
35+
metadata:
36+
labels:
37+
app: {{ template "helm-guestbook.name" . }}
38+
release: {{ .Release.Name }}
39+
spec:
40+
containers:
41+
- name: {{ .Chart.Name }}
42+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
43+
imagePullPolicy: {{ .Values.image.pullPolicy }}
44+
ports:
45+
- name: http
46+
containerPort: 80
47+
protocol: TCP
48+
livenessProbe:
49+
httpGet:
50+
path: /
51+
port: http
52+
readinessProbe:
53+
httpGet:
54+
path: /
55+
port: http
56+
resources:
57+
{{ toYaml .Values.resources | indent 12 }}
58+
{{- with .Values.nodeSelector }}
59+
nodeSelector:
60+
{{ toYaml . | indent 8 }}
61+
{{- end }}
62+
{{- with .Values.affinity }}
63+
affinity:
64+
{{ toYaml . | indent 8 }}
65+
{{- end }}
66+
{{- with .Values.tolerations }}
67+
tolerations:
68+
{{ toYaml . | indent 8 }}
69+
{{- end }}
70+
71+
```
72+
73+
74+
You can find the full example at [https://github.com/argoproj/argo-rollouts/tree/master/examples/helm-blue-green](https://github.com/argoproj/argo-rollouts/tree/master/examples/helm-blue-green).

docs/migrating.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ to the production environment without any interruption but you are going to run
111111
**Traffic Management During Migration**
112112

113113
The Rollout offers traffic management functionality that manages routing rules and flows the traffic to different
114-
versions of an application. For example [Blue-Green](../docs/features/bluegreen.md) deployment strategy manipulates
114+
versions of an application. For example [Blue-Green](features/bluegreen.md) deployment strategy manipulates
115115
Kubernetes Service selector and direct production traffic to "green" instances only.
116116

117117
If you are using this feature then Rollout switches production traffic to Pods that it manages. The switch happens

examples/helm-blue-green/.helmignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj

examples/helm-blue-green/Chart.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: v2
2+
name: helm-guestbook
3+
description: A Helm chart for Kubernetes
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.1.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
appVersion: "1.0"

examples/helm-blue-green/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Argo Rollouts and Helm
2+
3+
Argo Rollouts will respond to changes in Rollout resources
4+
regardless of the event source. If you package your manifest
5+
with the Helm package manager you can perform Progressive Delivery deployments with Helm
6+
7+
1. Install the Argo Rollouts controller in your cluster: https://github.com/argoproj/argo-rollouts#installation
8+
2. Instal the `helm` executable locally: https://helm.sh/docs/intro/install/
9+
10+
## Deploying the initial version
11+
12+
To deploy the first version of your application:
13+
14+
```
15+
git clone https://github.com/argoproj/argo-rollouts.git
16+
cd argo-rollouts/examples
17+
helm install example ./helm-blue-green/
18+
```
19+
20+
Your application will be deployed and exposed via the `example-helm-guestbook` service
21+
22+
## Perform the second deployment
23+
24+
To deploy the updated version using a Blue/Green strategy:
25+
26+
```
27+
helm upgrade example ./helm-blue-green/ --set image.tag=0.2
28+
```
29+
30+
Now, two versions will exist in your cluster (and each one has an associated service)
31+
32+
```
33+
kubectl-argo-rollouts get rollout example-helm-guestbook
34+
```
35+
36+
## Promoting the rollout
37+
38+
To advance the rollout and make the new version stable
39+
40+
```
41+
kubectl-argo-rollouts promote example-helm-guestbook
42+
```
43+
44+
This promotes container image `ks-guestbook-demo:0.2` to `green` status and `Rollout` deletes old replica which runs `ks-guestbook-demo:0.1`.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
1. Get the application URL by running these commands:
2+
{{- if .Values.ingress.enabled }}
3+
{{- range .Values.ingress.hosts }}
4+
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
5+
{{- end }}
6+
{{- else if contains "NodePort" .Values.service.type }}
7+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "helm-guestbook.fullname" . }})
8+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
9+
echo http://$NODE_IP:$NODE_PORT
10+
{{- else if contains "LoadBalancer" .Values.service.type }}
11+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
12+
You can watch the status of by running 'kubectl get svc -w {{ template "helm-guestbook.fullname" . }}'
13+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "helm-guestbook.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
14+
echo http://$SERVICE_IP:{{ .Values.service.port }}
15+
{{- else if contains "ClusterIP" .Values.service.type }}
16+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "helm-guestbook.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
17+
echo "Visit http://127.0.0.1:8080 to use your application"
18+
kubectl port-forward $POD_NAME 8080:80
19+
{{- end }}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "helm-guestbook.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
If release name contains chart name it will be used as a full name.
13+
*/}}
14+
{{- define "helm-guestbook.fullname" -}}
15+
{{- if .Values.fullnameOverride -}}
16+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
17+
{{- else -}}
18+
{{- $name := default .Chart.Name .Values.nameOverride -}}
19+
{{- if contains $name .Release.Name -}}
20+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
21+
{{- else -}}
22+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
23+
{{- end -}}
24+
{{- end -}}
25+
{{- end -}}
26+
27+
{{/*
28+
Create chart name and version as used by the chart label.
29+
*/}}
30+
{{- define "helm-guestbook.chart" -}}
31+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32+
{{- end -}}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: Rollout
3+
metadata:
4+
name: {{ template "helm-guestbook.fullname" . }}
5+
labels:
6+
app: {{ template "helm-guestbook.name" . }}
7+
chart: {{ template "helm-guestbook.chart" . }}
8+
release: {{ .Release.Name }}
9+
heritage: {{ .Release.Service }}
10+
spec:
11+
replicas: {{ .Values.replicaCount }}
12+
revisionHistoryLimit: 3
13+
selector:
14+
matchLabels:
15+
app: {{ template "helm-guestbook.name" . }}
16+
release: {{ .Release.Name }}
17+
strategy:
18+
blueGreen:
19+
activeService: {{ template "helm-guestbook.fullname" . }}
20+
previewService: {{ template "helm-guestbook.fullname" . }}-preview
21+
template:
22+
metadata:
23+
labels:
24+
app: {{ template "helm-guestbook.name" . }}
25+
release: {{ .Release.Name }}
26+
spec:
27+
containers:
28+
- name: {{ .Chart.Name }}
29+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
30+
imagePullPolicy: {{ .Values.image.pullPolicy }}
31+
ports:
32+
- name: http
33+
containerPort: 80
34+
protocol: TCP
35+
livenessProbe:
36+
httpGet:
37+
path: /
38+
port: http
39+
readinessProbe:
40+
httpGet:
41+
path: /
42+
port: http
43+
resources:
44+
{{ toYaml .Values.resources | indent 12 }}
45+
{{- with .Values.nodeSelector }}
46+
nodeSelector:
47+
{{ toYaml . | indent 8 }}
48+
{{- end }}
49+
{{- with .Values.affinity }}
50+
affinity:
51+
{{ toYaml . | indent 8 }}
52+
{{- end }}
53+
{{- with .Values.tolerations }}
54+
tolerations:
55+
{{ toYaml . | indent 8 }}
56+
{{- end }}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: {{ template "helm-guestbook.fullname" . }}
6+
labels:
7+
app: {{ template "helm-guestbook.name" . }}
8+
chart: {{ template "helm-guestbook.chart" . }}
9+
release: {{ .Release.Name }}
10+
heritage: {{ .Release.Service }}
11+
spec:
12+
type: {{ .Values.service.type }}
13+
ports:
14+
- port: {{ .Values.service.port }}
15+
targetPort: http
16+
protocol: TCP
17+
name: http
18+
selector:
19+
app: {{ template "helm-guestbook.name" . }}
20+
release: {{ .Release.Name }}
21+
---
22+
apiVersion: v1
23+
kind: Service
24+
metadata:
25+
name: {{ template "helm-guestbook.fullname" . }}-preview
26+
labels:
27+
app: {{ template "helm-guestbook.name" . }}
28+
chart: {{ template "helm-guestbook.chart" . }}
29+
release: {{ .Release.Name }}
30+
heritage: {{ .Release.Service }}
31+
spec:
32+
type: {{ .Values.service.type }}
33+
ports:
34+
- port: {{ .Values.service.port }}
35+
targetPort: http
36+
protocol: TCP
37+
name: http
38+
selector:
39+
app: {{ template "helm-guestbook.name" . }}
40+
release: {{ .Release.Name }}

examples/helm-blue-green/values.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Default values for helm-guestbook.
2+
# This is a YAML-formatted file.
3+
# Declare variables to be passed into your templates.
4+
5+
replicaCount: 1
6+
7+
image:
8+
repository: gcr.io/heptio-images/ks-guestbook-demo
9+
tag: 0.1
10+
pullPolicy: IfNotPresent
11+
12+
service:
13+
type: ClusterIP
14+
port: 80
15+
16+
ingress:
17+
enabled: false
18+
annotations: {}
19+
# kubernetes.io/ingress.class: nginx
20+
# kubernetes.io/tls-acme: "true"
21+
path: /
22+
hosts:
23+
- chart-example.local
24+
tls: []
25+
# - secretName: chart-example-tls
26+
# hosts:
27+
# - chart-example.local
28+
29+
resources: {}
30+
# We usually recommend not to specify default resources and to leave this as a conscious
31+
# choice for the user. This also increases chances charts run on environments with little
32+
# resources, such as Minikube. If you do want to specify resources, uncomment the following
33+
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
34+
# limits:
35+
# cpu: 100m
36+
# memory: 128Mi
37+
# requests:
38+
# cpu: 100m
39+
# memory: 128Mi
40+
41+
nodeSelector: {}
42+
43+
tolerations: []
44+
45+
affinity: {}

0 commit comments

Comments
 (0)