From 6ae37ee184e3ff685fe163adf3ee1dd613e392f2 Mon Sep 17 00:00:00 2001 From: Ilya Kislenko Date: Sat, 24 Feb 2018 02:57:45 -0800 Subject: [PATCH] New helm chart for kanister-operator (#3406) * New helm chart for kanister-operator * Trailing whitespaces fix * making rbac.service_account consistent across all files * miving to stable per suggecstion in PR's comments * updating README incubator->stable * Updating kanister-operator release version * fixing incorrect value name. * Adding appVersion, source and github usernames for maintainers * updating _helpers.tpl to use namespace functions updating all function calls * bring rbac configuration to the latest best practices * fixing typos * adding missing new line * tables->table there is only one table * default image tag 0.2.0 -> v0.2.0 * addressing requested review changes serviceAccount is getting it's own file minimal version 1.8+ chart template into chart label apps/v1beta2 for Deployment --- stable/kanister-operator/.helmignore | 21 +++++++ stable/kanister-operator/Chart.yaml | 13 ++++ stable/kanister-operator/README.md | 63 +++++++++++++++++++ stable/kanister-operator/templates/NOTES.txt | 9 +++ .../kanister-operator/templates/_helpers.tpl | 51 +++++++++++++++ .../templates/deployment.yaml | 22 +++++++ stable/kanister-operator/templates/rbac.yaml | 45 +++++++++++++ .../templates/serviceaccount.yaml | 8 +++ stable/kanister-operator/values.yaml | 24 +++++++ 9 files changed, 256 insertions(+) create mode 100644 stable/kanister-operator/.helmignore create mode 100644 stable/kanister-operator/Chart.yaml create mode 100644 stable/kanister-operator/README.md create mode 100644 stable/kanister-operator/templates/NOTES.txt create mode 100644 stable/kanister-operator/templates/_helpers.tpl create mode 100644 stable/kanister-operator/templates/deployment.yaml create mode 100644 stable/kanister-operator/templates/rbac.yaml create mode 100644 stable/kanister-operator/templates/serviceaccount.yaml create mode 100644 stable/kanister-operator/values.yaml diff --git a/stable/kanister-operator/.helmignore b/stable/kanister-operator/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/stable/kanister-operator/.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/stable/kanister-operator/Chart.yaml b/stable/kanister-operator/Chart.yaml new file mode 100644 index 0000000000..dd54189e1f --- /dev/null +++ b/stable/kanister-operator/Chart.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +description: Kanister-operator Helm chart for Kubernetes +name: kanister-operator +version: 0.2.0 +home: https://kanister.io/ +maintainers: + - email: ilya@kasten.io + name: depohmel + - email: tom@kasten.io + name: tdmanv +icon: https://avatars3.githubusercontent.com/u/30535216?s=200&v=4 +appVersion: 0.2.0 +source: https://github.com/kanisterio/kanister diff --git a/stable/kanister-operator/README.md b/stable/kanister-operator/README.md new file mode 100644 index 0000000000..c999e8fee7 --- /dev/null +++ b/stable/kanister-operator/README.md @@ -0,0 +1,63 @@ +# kanister-operator + +[kanister-operator](https://github.com/kanisterio/kanister) is a Kubernetes operator for Kanister framework. + +Kanister is a framework that enables application-level data management on Kubernetes. It allows domain experts to capture application specific data management tasks via blueprints, which can be easily shared and extended. The framework takes care of the tedious details surrounding execution on Kubernetes and presents a homogeneous operational experience across applications at scale. + +## TL;DR; + +```console +$ helm install stable/kanister-operator +``` + +## Introduction + +This chart bootstraps a kanister-operator deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +## Prerequisites + - Kubernetes 1.8+ with Beta APIs enabled + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```console +$ helm install --name my-release stable/kanister-operator +``` + +The command deploys kanister-operator on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. + +> **Tip**: List all releases using `helm list` + +## Uninstalling the Chart + +To uninstall/delete the `my-release` deployment: + +```console +$ helm delete my-release +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. + +## Configuration + +The following table lists the configurable parameters of the nginx-ingress chart and their default values. + +Parameter | Description | Default +--- | --- | --- +`rbac.create` | all required roles and SA will be created | `true` +`serviceAccount.create`| specify if SA will be created | `true` +`serviceAccount.name`| porvided service account name will be used | `None` +`image.repository` | controller container image repository | `kanisterio/controller` +`image.tag` | controller container image tag | `v0.2.0` +`image.pullPolicy` | controller container image pull policy | `IfNotPresent` +`resources` | k8s pod resorces | `None` + +Specify each parameter you'd like to override using a YAML file as described above in the [installation](#Installing the Chart) section. + +You can also specify any non-array parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```console +$ helm install stable/kanister-operator --name my-release \ + --set rbac.create=false +``` diff --git a/stable/kanister-operator/templates/NOTES.txt b/stable/kanister-operator/templates/NOTES.txt new file mode 100644 index 0000000000..2e532e72ae --- /dev/null +++ b/stable/kanister-operator/templates/NOTES.txt @@ -0,0 +1,9 @@ +Kanister-operator is installed. + +Getting Started is available: https://github.com/kanisterio/kanister + +Documentation is available: https://docs.kanister.io/ + +Please report any issues: https://github.com/kanisterio/kanister/issues + +Thank you for trying Kanister. diff --git a/stable/kanister-operator/templates/_helpers.tpl b/stable/kanister-operator/templates/_helpers.tpl new file mode 100644 index 0000000000..7f7eb8bb9c --- /dev/null +++ b/stable/kanister-operator/templates/_helpers.tpl @@ -0,0 +1,51 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "kanister-operator.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 "kanister-operator.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 "kanister-operator.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* Helm required labels */}} +{{- define "kanister-operator.helmLabels" -}} +heritage: {{ .Release.Service }} +release: {{ .Release.Name }} +chart: {{ template "kanister-operator.chart" . }} +app: {{ template "kanister-operator.name" . }} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "kanister-operator.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "kanister-operator.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/stable/kanister-operator/templates/deployment.yaml b/stable/kanister-operator/templates/deployment.yaml new file mode 100644 index 0000000000..e393e6b9df --- /dev/null +++ b/stable/kanister-operator/templates/deployment.yaml @@ -0,0 +1,22 @@ +apiVersion: apps/v1beta1 +kind: Deployment +metadata: + name: {{ template "kanister-operator.fullname" . }} + labels: +{{ include "kanister-operator.helmLabels" . | indent 4 }} +spec: + replicas: 1 + template: + metadata: + labels: +{{ include "kanister-operator.helmLabels" . | indent 8}} + spec: + serviceAccountName: {{ template "kanister-operator.serviceAccountName" . }} + containers: + - name: {{ template "kanister-operator.fullname" . }} + image: {{ .Values.image.repository }}:{{ .Values.image.tag }} + imagePullPolicy: {{ .Values.image.pullPolicy }} +{{- if .Values.resources }} + resources: +{{ toYaml .Values.resources | indent 12 }} +{{- end }} diff --git a/stable/kanister-operator/templates/rbac.yaml b/stable/kanister-operator/templates/rbac.yaml new file mode 100644 index 0000000000..dc949cfb1b --- /dev/null +++ b/stable/kanister-operator/templates/rbac.yaml @@ -0,0 +1,45 @@ +{{- if .Values.rbac.create }} +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1beta1 +metadata: + labels: +{{ include "kanister-operator.helmLabels" . | indent 4 }} + name: {{ template "kanister-operator.fullname" . }}-cluster-role +rules: +- apiGroups: + - cr.kanister.io + resources: + - "*" + verbs: + - "*" +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1beta1 +metadata: + labels: +{{ include "kanister-operator.helmLabels" . | indent 4 }} + name: {{ template "kanister-operator.fullname" . }}-edit-role +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: edit +subjects: +- kind: ServiceAccount + name: {{ template "kanister-operator.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1beta1 +metadata: + labels: +{{ include "kanister-operator.helmLabels" . | indent 4 }} + name: {{ template "kanister-operator.fullname" . }}-cr-role +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ template "kanister-operator.fullname" . }}-cluster-role +subjects: +- kind: ServiceAccount + name: {{ template "kanister-operator.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} +{{- end }} diff --git a/stable/kanister-operator/templates/serviceaccount.yaml b/stable/kanister-operator/templates/serviceaccount.yaml new file mode 100644 index 0000000000..a94e7f9ae2 --- /dev/null +++ b/stable/kanister-operator/templates/serviceaccount.yaml @@ -0,0 +1,8 @@ +{{- if .Values.serviceAccount.create }} +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: +{{ include "kanister-operator.helmLabels" . | indent 4 }} + name: {{ template "kanister-operator.serviceAccountName" . }} +{{- end }} diff --git a/stable/kanister-operator/values.yaml b/stable/kanister-operator/values.yaml new file mode 100644 index 0000000000..917ac1cf96 --- /dev/null +++ b/stable/kanister-operator/values.yaml @@ -0,0 +1,24 @@ +# Default values for kanister-operator. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +image: + repository: kanisterio/controller + tag: v0.2.0 + pullPolicy: IfNotPresent +rbac: + create: true +serviceAccount: + create: true + name: + +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