From 7882bf04a804b48e99a79af2ad6dd8bd3dc561c8 Mon Sep 17 00:00:00 2001 From: Kiran Mova Date: Thu, 19 Apr 2018 02:07:00 +0530 Subject: [PATCH] Add initial checkin for openebs chart (#3879) * Add initial checkin for openebs chart Signed-off-by: kmova * Use the template to define chart name Signed-off-by: kmova * update labels to follow helm best practicies Signed-off-by: kmova * update values to use camelCase Signed-off-by: kmova * follow chart conventions for rbac Signed-off-by: kmova * Update kubectl command to fetch pod status Signed-off-by: kmova * Update configuration, fix namespace condition Signed-off-by: kmova * remove blank line Signed-off-by: kmova * includes fixes for namespace and serviceaccount Signed-off-by: kmova * refactor affinity and update readme Signed-off-by: kmova * remove if blocks around serviceAccount Signed-off-by: kmova * use fullname in rbac and remove empty lines Signed-off-by: kmova * update maintainers section Signed-off-by: kmova * Remove storageclasses and set default sa to empty Signed-off-by: kmova * move the charts to stable Signed-off-by: kmova --- stable/openebs/.helmignore | 21 ++++++ stable/openebs/Chart.yaml | 17 +++++ stable/openebs/README.md | 62 +++++++++++++++++ stable/openebs/templates/NOTES.txt | 39 +++++++++++ stable/openebs/templates/_helpers.tpl | 43 ++++++++++++ stable/openebs/templates/clusterrole.yaml | 29 ++++++++ .../openebs/templates/clusterrolebinding.yaml | 19 +++++ stable/openebs/templates/crd-sp.yaml | 27 ++++++++ stable/openebs/templates/crd-spc.yaml | 27 ++++++++ .../templates/deployment-maya-apiserver.yaml | 57 +++++++++++++++ .../deployment-maya-provisioner.yaml | 69 +++++++++++++++++++ .../templates/service-maya-apiserver.yaml | 20 ++++++ stable/openebs/templates/serviceaccount.yaml | 11 +++ stable/openebs/values.yaml | 44 ++++++++++++ 14 files changed, 485 insertions(+) create mode 100644 stable/openebs/.helmignore create mode 100644 stable/openebs/Chart.yaml create mode 100644 stable/openebs/README.md create mode 100644 stable/openebs/templates/NOTES.txt create mode 100644 stable/openebs/templates/_helpers.tpl create mode 100644 stable/openebs/templates/clusterrole.yaml create mode 100644 stable/openebs/templates/clusterrolebinding.yaml create mode 100644 stable/openebs/templates/crd-sp.yaml create mode 100644 stable/openebs/templates/crd-spc.yaml create mode 100644 stable/openebs/templates/deployment-maya-apiserver.yaml create mode 100644 stable/openebs/templates/deployment-maya-provisioner.yaml create mode 100644 stable/openebs/templates/service-maya-apiserver.yaml create mode 100644 stable/openebs/templates/serviceaccount.yaml create mode 100644 stable/openebs/values.yaml diff --git a/stable/openebs/.helmignore b/stable/openebs/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/stable/openebs/.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/openebs/Chart.yaml b/stable/openebs/Chart.yaml new file mode 100644 index 0000000000..e483ef8830 --- /dev/null +++ b/stable/openebs/Chart.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +version: 0.5.3 +name: openebs +appVersion: "0.5.3" +description: Containerized Storage for Containers +icon: https://raw.githubusercontent.com/openebs/chitrakala/master/OpenEBS%20logo/openebs%20logos-03.png +home: http://www.openebs.io/ +keywords: + - cloud-native-storage + - block-storage + - iSCSI + - storage +sources: + - https://github.com/openebs/openebs +maintainers: + - name: kmova + email: kiran.mova@openebs.io diff --git a/stable/openebs/README.md b/stable/openebs/README.md new file mode 100644 index 0000000000..ded1be440e --- /dev/null +++ b/stable/openebs/README.md @@ -0,0 +1,62 @@ +OpenEBS +======= + +[OpenEBS](https://github.com/openebs/openebs) is an open source storage platform that provides persistent and containerized block storage for DevOps and container environments. + +OpenEBS can be deployed on any Kubernetes cluster - either in cloud, on-premise or developer laptop (minikube). OpenEBS itself is deployed as just another container on your cluster, and enables storage services that can be designated on a per pod, application, cluster or container level. + +Introduction +------------ + +This chart bootstraps OpenEBS deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +## Prerequisites +- Kubernetes 1.7.5+ with RBAC enabled +- iSCSI PV support in the underlying infrastructure + +## Installing OpenEBS +``` +helm install incubator/openebs +``` + +## Installing OpenEBS with the release name `my-release`: +``` +helm install --name `my-release` incubator/openebs +``` + +## To uninstall/delete the `my-release` deployment: +``` +helm ls --all +helm delete `my-release` +``` + + +## Configuration + +The following tables lists the configurable parameters of the OpenEBS chart and their default values. + +| Parameter | Description | Default | +| ------------------------------------ | --------------------------------------------- | --------------------------------- | +| `rbac.create` | Enable RBAC Resources | `true` | +| `serviceAccount.create` | Specify if Service Account should be created | `true` | +| `serviceAccount.name` | Specify the name of service account | `openebs-maya-operator` | +| `image.pullPolicy` | Container pull policy | `IfNotPresent` | +| `apiserver.image` | Docker Image for API Server | `openebs/m-apiserver` | +| `apiserver.imageTag` | Docker Image Tag for API Server | `0.5.3` | +| `apiserver.replicas` | Number of API Server Replicas | `1` | +| `provisioner.image` | Docker Image for Provisioner | `openebs/openebs-k8s-provisioner` | +| `provisioner.imageTag` | Docker Image Tag for Provisioner | `0.5.3` | +| `provisioner.replicas` | Number of Provisioner Replicas | `1` | +| `jiva.image` | Docker Image for Jiva | `openebs/jiva` | +| `jiva.imageTag` | Docker Image Tag for Jiva | `0.5.3` | +| `jiva.replicas` | Number of Jiva Replicas | `3` | + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. + +Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example, + +```shell +helm install --name `my-release` -f values.yaml incubator/openebs +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) diff --git a/stable/openebs/templates/NOTES.txt b/stable/openebs/templates/NOTES.txt new file mode 100644 index 0000000000..edeea6d06d --- /dev/null +++ b/stable/openebs/templates/NOTES.txt @@ -0,0 +1,39 @@ +The OpenEBS has been installed. Check its status by running: + kubectl get pods -n {{ .Release.Namespace }} + +For dynamically creating OpenEBS Volumes, you will need to create StorageClass. + +OpenEBS Storage class can be created using the following spec: +--- +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: openebs-standard +provisioner: openebs.io/provisioner-iscsi +parameters: + openebs.io/storage-pool: "default" + openebs.io/jiva-replica-count: "3" + openebs.io/volume-monitor: "true" + openebs.io/capacity: 5G +--- + +And use this storage class "openebs-standard" in your PVC as shown below: +--- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: demo-vol-claim +spec: + storageClassName: openebs-standard + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 4G +--- + +For more information, please visit http://docs.openebs.io/. + +Please note that, OpenEBS uses iSCSI for connecting applications with the +OpenEBS Volumes and your nodes should have the iSCSI initiator installed. + diff --git a/stable/openebs/templates/_helpers.tpl b/stable/openebs/templates/_helpers.tpl new file mode 100644 index 0000000000..09c63c5a4a --- /dev/null +++ b/stable/openebs/templates/_helpers.tpl @@ -0,0 +1,43 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "openebs.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 "openebs.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 "openebs.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "openebs.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "openebs.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/stable/openebs/templates/clusterrole.yaml b/stable/openebs/templates/clusterrole.yaml new file mode 100644 index 0000000000..9752693092 --- /dev/null +++ b/stable/openebs/templates/clusterrole.yaml @@ -0,0 +1,29 @@ +{{- if .Values.rbac.create }} +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: + name: {{ template "openebs.fullname". }} + labels: + app: {{ template "openebs.name" . }} + chart: {{ template "openebs.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +rules: +- apiGroups: ["*"] + resources: ["nodes","nodes/proxy"] + verbs: ["get", "list", "watch"] +- apiGroups: ["*"] + resources: ["namespaces", "services", "pods", "deployments", "events", "endpoints"] + verbs: ["*"] +- apiGroups: ["*"] + resources: ["persistentvolumes","persistentvolumeclaims"] + verbs: ["*"] +- apiGroups: ["storage.k8s.io"] + resources: ["storageclasses"] + verbs: ["*"] +- apiGroups: ["*"] + resources: ["storagepools"] + verbs: ["get", "list"] +- nonResourceURLs: ["/metrics"] + verbs: ["get"] +{{- end }} diff --git a/stable/openebs/templates/clusterrolebinding.yaml b/stable/openebs/templates/clusterrolebinding.yaml new file mode 100644 index 0000000000..f7c16bc82a --- /dev/null +++ b/stable/openebs/templates/clusterrolebinding.yaml @@ -0,0 +1,19 @@ +{{- if .Values.rbac.create }} +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRoleBinding +metadata: + name: {{ template "openebs.fullname". }} + labels: + app: {{ template "openebs.name" . }} + chart: {{ template "openebs.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ template "openebs.fullname". }} +subjects: +- kind: ServiceAccount + name: {{ template "openebs.serviceAccountName". }} + namespace: {{ .Release.Namespace }} +{{- end }} diff --git a/stable/openebs/templates/crd-sp.yaml b/stable/openebs/templates/crd-sp.yaml new file mode 100644 index 0000000000..fc61b9e6a8 --- /dev/null +++ b/stable/openebs/templates/crd-sp.yaml @@ -0,0 +1,27 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + # name must match the spec fields below, and be in the form: . + name: storagepools.openebs.io + labels: + app: {{ template "openebs.name" . }} + chart: {{ template "openebs.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + # group name to use for REST API: /apis// + group: openebs.io + # version name to use for REST API: /apis// + version: v1alpha1 + # either Namespaced or Cluster + scope: Cluster + names: + # plural name to be used in the URL: /apis/// + plural: storagepools + # singular name to be used as an alias on the CLI and for display + singular: storagepool + # kind is normally the CamelCased singular type. Your resource manifests use this. + kind: StoragePool + # shortNames allow shorter string to match your resource on the CLI + shortNames: + - sp diff --git a/stable/openebs/templates/crd-spc.yaml b/stable/openebs/templates/crd-spc.yaml new file mode 100644 index 0000000000..85e12f44f7 --- /dev/null +++ b/stable/openebs/templates/crd-spc.yaml @@ -0,0 +1,27 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + # name must match the spec fields below, and be in the form: . + name: storagepoolclaims.openebs.io + labels: + app: {{ template "openebs.name" . }} + chart: {{ template "openebs.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + # group name to use for REST API: /apis// + group: openebs.io + # version name to use for REST API: /apis// + version: v1alpha1 + # either Namespaced or Cluster + scope: Cluster + names: + # plural name to be used in the URL: /apis/// + plural: storagepoolclaims + # singular name to be used as an alias on the CLI and for display + singular: storagepoolclaim + # kind is normally the CamelCased singular type. Your resource manifests use this. + kind: StoragePoolClaim + # shortNames allow shorter string to match your resource on the CLI + shortNames: + - spc diff --git a/stable/openebs/templates/deployment-maya-apiserver.yaml b/stable/openebs/templates/deployment-maya-apiserver.yaml new file mode 100644 index 0000000000..2325a8dcdf --- /dev/null +++ b/stable/openebs/templates/deployment-maya-apiserver.yaml @@ -0,0 +1,57 @@ +apiVersion: apps/v1beta1 +kind: Deployment +metadata: + name: {{ template "openebs.fullname" . }}-apiserver + labels: + app: {{ template "openebs.name" . }} + chart: {{ template "openebs.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + component: apiserver +spec: + replicas: {{ .Values.apiserver.replicas }} + template: + metadata: + labels: + app: {{ template "openebs.name" . }} + release: {{ .Release.Name }} + component: apiserver + spec: + serviceAccountName: {{ template "openebs.serviceAccountName". }} + containers: + - name: {{ template "openebs.name" . }}-apiserver + image: "{{ .Values.apiserver.image }}:{{ .Values.apiserver.imageTag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - containerPort: {{ .Values.apiserver.ports.internalPort }} + env: + # OPENEBS_IO_KUBE_CONFIG enables maya api service to connect to K8s + # based on this config. This is ignored if empty. + # This is supported for maya api server version 0.5.2 onwards + #- name: OPENEBS_IO_KUBE_CONFIG + # value: "/home/ubuntu/.kube/config" + # OPENEBS_IO_K8S_MASTER enables maya api service to connect to K8s + # based on this address. This is ignored if empty. + # This is supported for maya api server version 0.5.2 onwards + #- name: OPENEBS_IO_K8S_MASTER + # value: "http://172.28.128.3:8080" + - name: OPENEBS_IO_JIVA_CONTROLLER_IMAGE + value: "{{ .Values.jiva.image }}:{{ .Values.jiva.imageTag }}" + - name: OPENEBS_IO_JIVA_REPLICA_IMAGE + value: "{{ .Values.jiva.image }}:{{ .Values.jiva.imageTag }}" + - name: OPENEBS_IO_VOLUME_MONITOR_IMAGE + value: "{{ .Values.policies.monitoring.image }}:{{ .Values.policies.monitoring.imageTag }}" + - name: OPENEBS_IO_JIVA_REPLICA_COUNT + value: "{{ .Values.jiva.replicas }}" +{{- if .Values.apiserver.nodeSelector }} + nodeSelector: +{{ toYaml .Values.apiserver.nodeSelector | indent 8 }} +{{- end }} +{{- if .Values.apiserver.tolerations }} + tolerations: +{{ toYaml .Values.apiserver.tolerations | indent 8 }} +{{- end }} +{{- if .Values.apiserver.affinity }} + affinity: +{{ toYaml .Values.apiserver.affinity | indent 8 }} +{{- end }} diff --git a/stable/openebs/templates/deployment-maya-provisioner.yaml b/stable/openebs/templates/deployment-maya-provisioner.yaml new file mode 100644 index 0000000000..e8296276a5 --- /dev/null +++ b/stable/openebs/templates/deployment-maya-provisioner.yaml @@ -0,0 +1,69 @@ +apiVersion: apps/v1beta1 +kind: Deployment +metadata: + name: {{ template "openebs.fullname" . }}-provisioner + labels: + app: {{ template "openebs.name" . }} + chart: {{ template "openebs.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + component: provisioner +spec: + replicas: {{ .Values.provisioner.replicas }} + template: + metadata: + labels: + app: {{ template "openebs.name" . }} + release: {{ .Release.Name }} + component: provisioner + spec: + serviceAccountName: {{ template "openebs.serviceAccountName". }} + containers: + - name: {{ template "openebs.name" . }}-provisioner + image: "{{ .Values.provisioner.image }}:{{ .Values.provisioner.imageTag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + # OPENEBS_IO_K8S_MASTER enables openebs provisioner to connect to K8s + # based on this address. This is ignored if empty. + # This is supported for openebs provisioner version 0.5.2 onwards + #- name: OPENEBS_IO_K8S_MASTER + # value: "http://10.128.0.12:8080" + # OPENEBS_IO_KUBE_CONFIG enables openebs provisioner to connect to K8s + # based on this config. This is ignored if empty. + # This is supported for openebs provisioner version 0.5.2 onwards + #- name: OPENEBS_IO_KUBE_CONFIG + # value: "/home/ubuntu/.kube/config" + # OPENEBS_NAMESPACE is the namespace that this provisioner will + # lookup to find maya api service + - name: OPENEBS_NAMESPACE + value: "{{ .Release.Namespace }}" + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + # OPENEBS_MAYA_SERVICE_NAME provides the maya-apiserver K8s service name, + # that provisioner should forward the volume creaet/delete requests. + # If not present, "maya-apiserver-service" will be used for lookup. + # This is supported for openebs provisioner version 0.5.3-RC1 onwards + - name: OPENEBS_MAYA_SERVICE_NAME + value: "{{ template "openebs.fullname" . }}-apiservice" + # The following values will be set as annotations to the PV object. + # Refer : https://github.com/openebs/external-storage/pull/15 + #- name: OPENEBS_MONITOR_URL + # value: "{{ .Values.provisioner.monitorUrl }}" + #- name: OPENEBS_MONITOR_VOLKEY + # value: "{{ .Values.provisioner.monitorVolumeKey }}" + #- name: MAYA_PORTAL_URL + # value: "{{ .Values.provisioner.mayaPortalUrl }}" +{{- if .Values.provisioner.nodeSelector }} + nodeSelector: +{{ toYaml .Values.provisioner.nodeSelector | indent 8 }} +{{- end }} +{{- if .Values.provisioner.tolerations }} + tolerations: +{{ toYaml .Values.provisioner.tolerations | indent 8 }} +{{- end }} +{{- if .Values.provisioner.affinity }} + tolerations: +{{ toYaml .Values.provisioner.affinity | indent 8 }} +{{- end }} diff --git a/stable/openebs/templates/service-maya-apiserver.yaml b/stable/openebs/templates/service-maya-apiserver.yaml new file mode 100644 index 0000000000..324047afd0 --- /dev/null +++ b/stable/openebs/templates/service-maya-apiserver.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "openebs.fullname" . }}-apiservice + labels: + app: {{ template "openebs.name" . }} + chart: {{ template "openebs.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + ports: + - name: api + port: {{ .Values.apiserver.ports.externalPort }} + targetPort: {{ .Values.apiserver.ports.internalPort }} + protocol: TCP + selector: + app: {{ template "openebs.name" . }} + release: {{ .Release.Name }} + component: apiserver + sessionAffinity: None diff --git a/stable/openebs/templates/serviceaccount.yaml b/stable/openebs/templates/serviceaccount.yaml new file mode 100644 index 0000000000..e2feaa1926 --- /dev/null +++ b/stable/openebs/templates/serviceaccount.yaml @@ -0,0 +1,11 @@ +{{- if .Values.serviceAccount.create }} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ template "openebs.serviceAccountName". }} + labels: + app: {{ template "openebs.name" . }} + chart: {{ template "openebs.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +{{- end }} diff --git a/stable/openebs/values.yaml b/stable/openebs/values.yaml new file mode 100644 index 0000000000..ed20f54e60 --- /dev/null +++ b/stable/openebs/values.yaml @@ -0,0 +1,44 @@ +# Default values for openebs. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +rbac: + # Specifies whether RBAC resources should be created + create: true + +serviceAccount: + create: true + name: + +image: + pullPolicy: IfNotPresent + +apiserver: + image: "openebs/m-apiserver" + imageTag: "0.5.3" + replicas: 1 + ports: + externalPort: 5656 + internalPort: 5656 + nodeSelector: {} + tolerations: {} + affinity: {} + +provisioner: + image: "openebs/openebs-k8s-provisioner" + imageTag: "0.5.3" + replicas: 1 + nodeSelector: {} + tolerations: {} + affinity: {} + +jiva: + image: "openebs/jiva" + imageTag: "0.5.3" + replicas: 3 + +policies: + monitoring: + enabled: true + image: "openebs/m-exporter" + imageTag: "0.5.3"