diff --git a/charts/steerer/.helmignore b/charts/steerer/.helmignore new file mode 100644 index 000000000..f0c131944 --- /dev/null +++ b/charts/steerer/.helmignore @@ -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 diff --git a/charts/steerer/Chart.yaml b/charts/steerer/Chart.yaml new file mode 100644 index 000000000..cd00ea52c --- /dev/null +++ b/charts/steerer/Chart.yaml @@ -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 diff --git a/charts/steerer/README.md b/charts/steerer/README.md new file mode 100644 index 000000000..90e0599ce --- /dev/null +++ b/charts/steerer/README.md @@ -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 | `` +`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) +``` + diff --git a/charts/steerer/templates/NOTES.txt b/charts/steerer/templates/NOTES.txt new file mode 100644 index 000000000..52bc8a931 --- /dev/null +++ b/charts/steerer/templates/NOTES.txt @@ -0,0 +1 @@ +Steerer installed diff --git a/charts/steerer/templates/_helpers.tpl b/charts/steerer/templates/_helpers.tpl new file mode 100644 index 000000000..028e523f3 --- /dev/null +++ b/charts/steerer/templates/_helpers.tpl @@ -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 -}} diff --git a/charts/steerer/templates/account.yaml b/charts/steerer/templates/account.yaml new file mode 100644 index 000000000..576b53bb4 --- /dev/null +++ b/charts/steerer/templates/account.yaml @@ -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 }} diff --git a/charts/steerer/templates/crd.yaml b/charts/steerer/templates/crd.yaml new file mode 100644 index 000000000..38f5edb5c --- /dev/null +++ b/charts/steerer/templates/crd.yaml @@ -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 }} diff --git a/charts/steerer/templates/deployment.yaml b/charts/steerer/templates/deployment.yaml new file mode 100644 index 000000000..23768e2cd --- /dev/null +++ b/charts/steerer/templates/deployment.yaml @@ -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 }} diff --git a/charts/steerer/templates/rbac.yaml b/charts/steerer/templates/rbac.yaml new file mode 100644 index 000000000..3dc285990 --- /dev/null +++ b/charts/steerer/templates/rbac.yaml @@ -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 }} diff --git a/charts/steerer/values.yaml b/charts/steerer/values.yaml new file mode 100644 index 000000000..6b05ccdd3 --- /dev/null +++ b/charts/steerer/values.yaml @@ -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: {}