Skip to content

Commit

Permalink
Add steerer Helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanprodan committed Sep 26, 2018
1 parent 8115757 commit d562361
Show file tree
Hide file tree
Showing 10 changed files with 326 additions and 0 deletions.
21 changes: 21 additions & 0 deletions charts/steerer/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +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
5 changes: 5 additions & 0 deletions charts/steerer/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "0.0.1"
description: Steerer is a Kubernetes operator that automates the promotion of canary deployments using Istio routing for traffic shifting and Prometheus metrics for canary analysis.
name: steerer
version: 0.0.1
62 changes: 62 additions & 0 deletions charts/steerer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Steerer

Steerer is a Kubernetes operator that automates the promotion of canary deployments
using Istio routing for traffic shifting and Prometheus metrics for canary analysis.

## Installing the Chart

To install the chart with the release name `steerer`:

```console
$ helm upgrade --install steerer ./charts/steerer --namespace=istio-system
```

The command deploys Steerer on the Kubernetes cluster in the istio-system namespace.
The [configuration](#configuration) section lists the parameters that can be configured during installation.

## Uninstalling the Chart

To uninstall/delete the `steerer` deployment:

```console
$ helm delete --purge steerer
```

The command removes all the Kubernetes components associated with the chart and deletes the release.

## Configuration

The following tables lists the configurable parameters of the Steerer chart and their default values.

Parameter | Description | Default
--- | --- | ---
`image.repository` | image repository | `stefanprodan/steerer`
`image.tag` | image tag | `<VERSION>`
`image.pullPolicy` | image pull policy | `IfNotPresent`
`resources.requests/cpu` | pod CPU request | `10m`
`resources.requests/memory` | pod memory request | `32Mi`
`resources.limits/cpu` | pod CPU limit | `1000m`
`resources.limits/memory` | pod memory limit | `512Mi`
`affinity` | node/pod affinities | None
`nodeSelector` | node labels for pod assignment | `{}`
`tolerations` | list of node taints to tolerate | `[]`

Specify each parameter using the `--set key=value[,key=value]` argument to `helm upgrade`. For example,

```console
$ helm upgrade --install steerer ./charts/steerer \
--namespace=istio-system \
--set=image.tag=0.0.2
```

Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example,

```console
$ helm upgrade --install steerer ./charts/steerer \
--namespace=istio-system \
-f values.yaml
```

> **Tip**: You can use the default [values.yaml](values.yaml)
```
1 change: 1 addition & 0 deletions charts/steerer/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Steerer installed
32 changes: 32 additions & 0 deletions charts/steerer/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "steerer.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 "steerer.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 "steerer.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
9 changes: 9 additions & 0 deletions charts/steerer/templates/account.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "steerer.name" . }}
labels:
app: {{ template "steerer.name" . }}
chart: {{ template "steerer.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
58 changes: 58 additions & 0 deletions charts/steerer/templates/crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{{- if .Values.crd.create }}
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: rollouts.apps.weave.works
spec:
group: apps.weave.works
version: v1beta1
versions:
- name: v1beta1
served: true
storage: true
names:
plural: rollouts
singular: rollout
kind: Rollout
shortNames:
- roll
scope: Namespaced
validation:
openAPIV3Schema:
properties:
spec:
required:
- primary
- canary
- virtualService
properties:
primary:
properties:
name:
type: string
host:
type: string
canary:
properties:
name:
type: string
host:
type: string
virtualService:
properties:
name:
type: string
weight:
type: number
metric:
properties:
type:
type: string
name:
type: string
interval:
type: string
pattern: "^[0-9]+(m)"
threshold:
type: number
{{- end }}
71 changes: 71 additions & 0 deletions charts/steerer/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "steerer.fullname" . }}
labels:
app: {{ include "steerer.name" . }}
chart: {{ include "steerer.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: {{ include "steerer.name" . }}
release: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ include "steerer.name" . }}
release: {{ .Release.Name }}
spec:
serviceAccountName: steerer
containers:
- name: steerer
securityContext:
readOnlyRootFilesystem: true
runAsUser: 10001
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 8080
command:
- ./steerer
- -log-level=info
- -control-loop-interval={{ .Values.controlLoopInterval }}
- -metrics-server={{ .Values.metricsServer }}
livenessProbe:
exec:
command:
- wget
- --quiet
- --tries=1
- --timeout=2
- --spider
- http://localhost:8080/healthz
readinessProbe:
exec:
command:
- wget
- --quiet
- --tries=1
- --timeout=2
- --spider
- http://localhost:8080/healthz
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 }}
35 changes: 35 additions & 0 deletions charts/steerer/templates/rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{{- if .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: {{ template "steerer.fullname" . }}
labels:
app: {{ template "steerer.name" . }}
chart: {{ template "steerer.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
rules:
- apiGroups: ['*']
resources: ['*']
verbs: ['*']
- nonResourceURLs: ['*']
verbs: ['*']
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: {{ template "steerer.fullname" . }}
labels:
app: {{ template "steerer.name" . }}
chart: {{ template "steerer.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "steerer.fullname" . }}
subjects:
- name: {{ template "steerer.name" . }}
namespace: {{ .Release.Namespace | quote }}
kind: ServiceAccount
{{- end }}
32 changes: 32 additions & 0 deletions charts/steerer/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Default values for steerer.

image:
repository: stefanprodan/steerer
tag: 0.0.1
pullPolicy: IfNotPresent

controlLoopInterval: "10s"
metricsServer: "http://prometheus.istio-system.svc.cluster.local:9090"

crd:
create: true

rbac:
create: true

nameOverride: ""
fullnameOverride: ""

resources:
limits:
memory: "512Mi"
cpu: "1000m"
requests:
memory: "32Mi"
cpu: "10m"

nodeSelector: {}

tolerations: []

affinity: {}

0 comments on commit d562361

Please sign in to comment.