From 0a86b97db28ba8056fc4128ec98cc00c9e28421a Mon Sep 17 00:00:00 2001 From: Haitao Yue Date: Tue, 3 Jul 2018 16:16:21 +0800 Subject: [PATCH] [CE-403] Add helm charts for deploy cello master User can deploy cello master service through helm charts. Change-Id: If24460e1563256115e6a1366f4fe02a907a2c72c Signed-off-by: Haitao Yue --- thirdparty/helm/cello-master/Chart.yaml | 19 +++ .../helm/cello-master/requirements.lock | 6 + .../helm/cello-master/requirements.yaml | 4 + .../helm/cello-master/templates/NOTES.txt | 15 +++ .../helm/cello-master/templates/_helpers.tpl | 27 ++++ .../cello-master/templates/deployment.yaml | 125 ++++++++++++++++++ .../helm/cello-master/templates/ingress.yaml | 32 +++++ .../helm/cello-master/templates/minio-pv.yaml | 18 +++ .../helm/cello-master/templates/mongo-pv.yaml | 22 +++ .../cello-master/templates/mongo-pvc.yaml | 19 +++ .../helm/cello-master/templates/nfs-pv.yaml | 22 +++ .../helm/cello-master/templates/nfs-pvc.yaml | 19 +++ .../helm/cello-master/templates/service.yaml | 55 ++++++++ .../templates/user-dashboard-pv.yaml | 22 +++ .../templates/user-dashboard-pvc.yaml | 19 +++ thirdparty/helm/cello-master/values.yaml | 94 +++++++++++++ 16 files changed, 518 insertions(+) create mode 100644 thirdparty/helm/cello-master/Chart.yaml create mode 100644 thirdparty/helm/cello-master/requirements.lock create mode 100644 thirdparty/helm/cello-master/requirements.yaml create mode 100644 thirdparty/helm/cello-master/templates/NOTES.txt create mode 100644 thirdparty/helm/cello-master/templates/_helpers.tpl create mode 100644 thirdparty/helm/cello-master/templates/deployment.yaml create mode 100644 thirdparty/helm/cello-master/templates/ingress.yaml create mode 100644 thirdparty/helm/cello-master/templates/minio-pv.yaml create mode 100644 thirdparty/helm/cello-master/templates/mongo-pv.yaml create mode 100644 thirdparty/helm/cello-master/templates/mongo-pvc.yaml create mode 100644 thirdparty/helm/cello-master/templates/nfs-pv.yaml create mode 100644 thirdparty/helm/cello-master/templates/nfs-pvc.yaml create mode 100644 thirdparty/helm/cello-master/templates/service.yaml create mode 100644 thirdparty/helm/cello-master/templates/user-dashboard-pv.yaml create mode 100644 thirdparty/helm/cello-master/templates/user-dashboard-pvc.yaml create mode 100644 thirdparty/helm/cello-master/values.yaml diff --git a/thirdparty/helm/cello-master/Chart.yaml b/thirdparty/helm/cello-master/Chart.yaml new file mode 100644 index 00000000..5e90208c --- /dev/null +++ b/thirdparty/helm/cello-master/Chart.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +description: Cello is a Block As a service in hyperledger. +name: cello-master +version: 0.1.0 +keywords: +- Hyperledger +- BAAS +- Cello +home: https://www.hyperledger.org/projects/cello +icon: https://wiki.hyperledger.org/_media/projects/hyperledger_cello_logo_color.png +sources: +- https://github.com/hyperledger/cello +maintainers: +- name: Haitao Yue + email: hightall@me.com +- name: Baohua Yang + email: yangbaohua@gmail.com +- name: Tong Li + email: litong01@us.ibm.com diff --git a/thirdparty/helm/cello-master/requirements.lock b/thirdparty/helm/cello-master/requirements.lock new file mode 100644 index 00000000..5769fde3 --- /dev/null +++ b/thirdparty/helm/cello-master/requirements.lock @@ -0,0 +1,6 @@ +dependencies: +- name: minio + repository: https://kubernetes-charts.storage.googleapis.com + version: 1.3.4 +digest: sha256:ab84dd6eeb6fe4e4984aa3f2a1f3add97e18127d1b3948caa4ea538ab7751f4b +generated: 2018-07-03T10:25:26.957459+08:00 diff --git a/thirdparty/helm/cello-master/requirements.yaml b/thirdparty/helm/cello-master/requirements.yaml new file mode 100644 index 00000000..e06927fc --- /dev/null +++ b/thirdparty/helm/cello-master/requirements.yaml @@ -0,0 +1,4 @@ +dependencies: + - name: minio + repository: "https://kubernetes-charts.storage.googleapis.com" + version: 1.3.4 \ No newline at end of file diff --git a/thirdparty/helm/cello-master/templates/NOTES.txt b/thirdparty/helm/cello-master/templates/NOTES.txt new file mode 100644 index 00000000..92fecdd5 --- /dev/null +++ b/thirdparty/helm/cello-master/templates/NOTES.txt @@ -0,0 +1,15 @@ +1. Get the application URL by running these commands: +{{- if contains "NodePort" .Values.service.type }} +export OPERATOR_PORT=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "cello-master.fullname" . }} -o jsonpath="{.spec.ports[1].nodePort}") +export USER_DASHBOARD_PORT=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "cello-master.fullname" . }} -o jsonpath="{.spec.ports[2].nodePort}") +{{- end }} + +2. Local storage paths: +mongo: {{ .Values.mongo.storePath }} +nfs: {{ .Values.nfs.storePath }} +minio: {{ .Values.minio.persistence.storePath }} + +3. Ingress Path: +{{- if .Values.minio.ingress.enabled }} +path: {{ .Values.minio.ingress.path }} +{{- end }} diff --git a/thirdparty/helm/cello-master/templates/_helpers.tpl b/thirdparty/helm/cello-master/templates/_helpers.tpl new file mode 100644 index 00000000..5dc20785 --- /dev/null +++ b/thirdparty/helm/cello-master/templates/_helpers.tpl @@ -0,0 +1,27 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "cello-master.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). +*/}} +{{- define "cello-master.fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "nfs-provisioner.provisionerName" -}} +{{- if .Values.nfs.storageClass -}} +{{- printf .Values.nfs.storageClass -}} +{{- else -}} +cluster.local/{{ template "nfs-provisioner.fullname" . -}} +{{- end -}} +{{- end -}} diff --git a/thirdparty/helm/cello-master/templates/deployment.yaml b/thirdparty/helm/cello-master/templates/deployment.yaml new file mode 100644 index 00000000..2e389a9e --- /dev/null +++ b/thirdparty/helm/cello-master/templates/deployment.yaml @@ -0,0 +1,125 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "cello-master.fullname" . }} + labels: + app: {{ template "cello-master.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + template: + metadata: + labels: + app: {{ template "cello-master.name" . }} + release: {{ .Release.Name }} + spec: + initContainers: + - name: init-nfs-files + image: "{{ .Values.operatorDashboardImage.repository }}:{{ .Values.operatorDashboardImage.tag }}" + volumeMounts: + - name: operator-nfs + mountPath: "/opt/data" + command: ["rsync"] + args: ["-av", "--delete", "/app/agent/docker/_compose_files/", "/opt/data/"] + containers: +# - name: "{{ .Chart.Name }}-nfs" +# image: "{{ .Values.nfsImage.repository }}:{{ .Values.nfsImage.tag }}" +# imagePullPolicy: {{ .Values.image.pullPolicy }} +# ports: +# - name: nfs +# containerPort: 2049 +# protocol: TCP +# - name: mountd +# containerPort: 20048 +# protocol: TCP +# - name: rpcbind-tcp +# containerPort: 111 +# protocol: TCP +# - name: rpcbind-udp +# containerPort: 111 +# protocol: UDP +# args: +# - "-provisioner={{ template "nfs-provisioner.provisionerName" . }}" +# volumeMounts: +# - name: operator-nfs +# mountPath: "/export" + - name: "{{ .Chart.Name }}-mongo" + image: "{{ .Values.mongoImage.repository }}:{{ .Values.mongoImage.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + volumeMounts: + - name: operator-mongo + mountPath: "/data/db" + - name: "{{ .Chart.Name }}-engine" + image: "{{ .Values.engineImage.repository }}:{{ .Values.engineImage.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: MONGO_URL + value: "mongodb://127.0.0.1:27017" + - name: MONGO_HOST + value: "127.0.0.1" + - name: MONGO_DB + value: "dev" + - name: MONGODB_PORT + value: "27017" + - name: DEBUG + value: "False" + - name: "{{ .Chart.Name }}-operator" + image: "{{ .Values.operatorDashboardImage.repository }}:{{ .Values.operatorDashboardImage.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: MONGO_URL + value: "mongodb://127.0.0.1:27017" + - name: MONGODB_HOST + value: "127.0.0.1" + - name: MONGODB_DB + value: "dashboard" + - name: MONGODB_PORT + value: "27017" + - name: DEBUG + value: "{{ .Values.operator.debug }}" + - name: STATIC_FOLDER + value: "static" + - name: TEMPLATE_FOLDER + value: "templates" + - name: ENABLE_EMAIL_ACTIVE + value: "True" + - name: "{{ .Chart.Name }}-user-dashboard" + image: "{{ .Values.userDashboardImage.repository }}:{{ .Values.userDashboardImage.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: NODE_ENV + value: "production" + - name: RESTFUL_SERVER + value: "127.0.0.1:8080" + - name: ENABLE_EMAIL_ACTIVE + value: "{{ .Values.userDashboard.enableEmailActive }}" + - name: MONGO_HOST + value: "{{ .Values.userDashboard.mongo.host }}" + - name: MONGO_PORT + value: "{{ .Values.userDashboard.mongo.port }}" + - name: MONGO_DB + value: "{{ .Values.userDashboard.mongo.database }}" + - name: WEBROOT + value: "{{ .Values.userDashboard.webRoot }}" + - name: FABRIC_CFG_PATH + value: "/etc/hyperledger/fabric" + volumeMounts: + - name: user-dashboard + mountPath: "/opt/data" + - name: minio + mountPath: "/opt/minio" + volumes: + - name: operator-nfs + persistentVolumeClaim: + claimName: "{{ template "cello-master.fullname" . }}-nfs" + - name: operator-mongo + persistentVolumeClaim: + claimName: "{{ template "cello-master.fullname" . }}-mongo" + - name: user-dashboard + persistentVolumeClaim: + claimName: "{{ template "cello-master.fullname" . }}-user-dashboard" + - name: minio + persistentVolumeClaim: + claimName: "{{ .Release.Name }}-minio" diff --git a/thirdparty/helm/cello-master/templates/ingress.yaml b/thirdparty/helm/cello-master/templates/ingress.yaml new file mode 100644 index 00000000..90e872c7 --- /dev/null +++ b/thirdparty/helm/cello-master/templates/ingress.yaml @@ -0,0 +1,32 @@ +{{- if .Values.ingress.enabled -}} +{{- $serviceName := include "cello-master.fullname" . -}} +{{- $servicePort := .Values.service.externalPort -}} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ template "cello-master.fullname" . }} + labels: + app: {{ template "cello-master.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + annotations: + {{- range $key, $value := .Values.ingress.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} +spec: + rules: + {{- range $host := .Values.ingress.hosts }} + - host: {{ $host }} + http: + paths: + - path: / + backend: + serviceName: {{ $serviceName }} + servicePort: {{ $servicePort }} + {{- end -}} + {{- if .Values.ingress.tls }} + tls: +{{ toYaml .Values.ingress.tls | indent 4 }} + {{- end -}} +{{- end -}} diff --git a/thirdparty/helm/cello-master/templates/minio-pv.yaml b/thirdparty/helm/cello-master/templates/minio-pv.yaml new file mode 100644 index 00000000..5c93dbae --- /dev/null +++ b/thirdparty/helm/cello-master/templates/minio-pv.yaml @@ -0,0 +1,18 @@ +kind: PersistentVolume +apiVersion: v1 +metadata: + name: "{{ template "cello-master.fullname" . }}-minio" + labels: + type: local +spec: + {{- if (eq "-" .Values.minio.persistence.storageClass) }} + storageClassName: "" + {{- else }} + storageClassName: "{{ .Values.minio.persistence.storageClass }}" + {{- end }} + capacity: + storage: {{ .Values.minio.persistence.size }} + accessModes: + - ReadWriteOnce + hostPath: + path: {{ .Values.minio.persistence.storePath }} diff --git a/thirdparty/helm/cello-master/templates/mongo-pv.yaml b/thirdparty/helm/cello-master/templates/mongo-pv.yaml new file mode 100644 index 00000000..df6e8921 --- /dev/null +++ b/thirdparty/helm/cello-master/templates/mongo-pv.yaml @@ -0,0 +1,22 @@ +kind: PersistentVolume +apiVersion: v1 +metadata: + name: "{{ template "cello-master.fullname" . }}-mongo" + labels: + type: local +spec: + {{- if .Values.autoStorageClass }} + storageClassName: "{{ template "cello-master.fullname" . }}-mongo" + {{- else }} + {{- if (eq "-" .Values.mongo.storageClass) }} + storageClassName: "" + {{- else }} + storageClassName: "{{ .Values.mongo.storageClass }}" + {{- end }} + {{- end }} + capacity: + storage: {{ .Values.mongo.size }} + accessModes: + - ReadWriteOnce + hostPath: + path: {{ .Values.mongo.storePath }} diff --git a/thirdparty/helm/cello-master/templates/mongo-pvc.yaml b/thirdparty/helm/cello-master/templates/mongo-pvc.yaml new file mode 100644 index 00000000..4d3cab37 --- /dev/null +++ b/thirdparty/helm/cello-master/templates/mongo-pvc.yaml @@ -0,0 +1,19 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: "{{ template "cello-master.fullname" . }}-mongo" +spec: + accessModes: + - ReadWriteOnce + {{- if .Values.autoStorageClass }} + storageClassName: "{{ template "cello-master.fullname" . }}-mongo" + {{- else }} + {{- if (eq "-" .Values.mongo.storageClass) }} + storageClassName: "" + {{- else }} + storageClassName: "{{ .Values.mongo.storageClass }}" + {{- end }} + {{- end }} + resources: + requests: + storage: {{ .Values.mongo.size }} diff --git a/thirdparty/helm/cello-master/templates/nfs-pv.yaml b/thirdparty/helm/cello-master/templates/nfs-pv.yaml new file mode 100644 index 00000000..a037229f --- /dev/null +++ b/thirdparty/helm/cello-master/templates/nfs-pv.yaml @@ -0,0 +1,22 @@ +kind: PersistentVolume +apiVersion: v1 +metadata: + name: "{{ template "cello-master.fullname" . }}-nfs" + labels: + type: local +spec: + {{- if .Values.autoStorageClass }} + storageClassName: "{{ template "cello-master.fullname" . }}-nfs" + {{- else }} + {{- if (eq "-" .Values.nfs.storageClass) }} + storageClassName: "" + {{- else }} + storageClassName: "{{ .Values.nfs.storageClass }}" + {{- end }} + {{- end }} + capacity: + storage: {{ .Values.nfs.size }} + accessModes: + - ReadWriteOnce + hostPath: + path: {{ .Values.nfs.storePath }} \ No newline at end of file diff --git a/thirdparty/helm/cello-master/templates/nfs-pvc.yaml b/thirdparty/helm/cello-master/templates/nfs-pvc.yaml new file mode 100644 index 00000000..0ea05e54 --- /dev/null +++ b/thirdparty/helm/cello-master/templates/nfs-pvc.yaml @@ -0,0 +1,19 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: "{{ template "cello-master.fullname" . }}-nfs" +spec: + {{- if .Values.autoStorageClass }} + storageClassName: "{{ template "cello-master.fullname" . }}-nfs" + {{- else }} + {{- if (eq "-" .Values.nfs.storageClass) }} + storageClassName: "" + {{- else }} + storageClassName: "{{ .Values.nfs.storageClass }}" + {{- end }} + {{- end }} + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ .Values.nfs.size }} diff --git a/thirdparty/helm/cello-master/templates/service.yaml b/thirdparty/helm/cello-master/templates/service.yaml new file mode 100644 index 00000000..be1b65c3 --- /dev/null +++ b/thirdparty/helm/cello-master/templates/service.yaml @@ -0,0 +1,55 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "cello-master.fullname" . }} + labels: + app: {{ template "cello-master.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - port: 80 + targetPort: 80 + protocol: TCP + name: engine + - port: 8080 + targetPort: 8080 + protocol: TCP + name: operator + - port: 8081 + targetPort: 8081 + protocol: TCP + name: user +# - port: {{ .Values.nfs.nfsPort }} +# targetPort: nfs +# protocol: TCP +# name: nfs +#{{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.nfs.nfsNodePort))) }} +# nodePort: {{ .Values.nfs.nfsNodePort }} +#{{- end }} +# - port: {{ .Values.nfs.mountdPort }} +# targetPort: mountd +# protocol: TCP +# name: mountd +#{{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.nfs.mountdNodePort))) }} +# nodePort: {{ .Values.nfs.mountdNodePort }} +#{{- end }} +# - port: {{ .Values.nfs.rpcbindPort }} +# targetPort: rpcbind-tcp +# protocol: TCP +# name: rpcbind-tcp +#{{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.nfs.rpcbindNodePort))) }} +# nodePort: {{ .Values.nfs.rpcbindNodePort }} +#{{- end }} +# - port: {{ .Values.nfs.rpcbindPort }} +# targetPort: rpcbind-udp +# protocol: UDP +# name: rpcbind-udp +#{{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.nfs.rpcbindNodePort))) }} +# nodePort: {{ .Values.nfs.rpcbindNodePort }} +#{{- end }} + selector: + app: {{ template "cello-master.name" . }} + release: {{ .Release.Name }} diff --git a/thirdparty/helm/cello-master/templates/user-dashboard-pv.yaml b/thirdparty/helm/cello-master/templates/user-dashboard-pv.yaml new file mode 100644 index 00000000..363eb7ed --- /dev/null +++ b/thirdparty/helm/cello-master/templates/user-dashboard-pv.yaml @@ -0,0 +1,22 @@ +kind: PersistentVolume +apiVersion: v1 +metadata: + name: "{{ template "cello-master.fullname" . }}-user-dashboard" + labels: + type: local +spec: + {{- if .Values.autoStorageClass }} + storageClassName: "{{ template "cello-master.fullname" . }}-user-dashboard" + {{- else }} + {{- if (eq "-" .Values.userDashboard.storageClass) }} + storageClassName: "" + {{- else }} + storageClassName: "{{ .Values.userDashboard.storageClass }}" + {{- end }} + {{- end }} + capacity: + storage: {{ .Values.userDashboard.size }} + accessModes: + - ReadWriteOnce + hostPath: + path: {{ .Values.userDashboard.storePath }} diff --git a/thirdparty/helm/cello-master/templates/user-dashboard-pvc.yaml b/thirdparty/helm/cello-master/templates/user-dashboard-pvc.yaml new file mode 100644 index 00000000..28c2978e --- /dev/null +++ b/thirdparty/helm/cello-master/templates/user-dashboard-pvc.yaml @@ -0,0 +1,19 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: "{{ template "cello-master.fullname" . }}-user-dashboard" +spec: + accessModes: + - ReadWriteOnce + {{- if .Values.autoStorageClass }} + storageClassName: "{{ template "cello-master.fullname" . }}-user-dashboard" + {{- else }} + {{- if (eq "-" .Values.userDashboard.storageClass) }} + storageClassName: "" + {{- else }} + storageClassName: "{{ .Values.userDashboard.storageClass }}" + {{- end }} + {{- end }} + resources: + requests: + storage: {{ .Values.userDashboard.size }} diff --git a/thirdparty/helm/cello-master/values.yaml b/thirdparty/helm/cello-master/values.yaml new file mode 100644 index 00000000..ba2e2e47 --- /dev/null +++ b/thirdparty/helm/cello-master/values.yaml @@ -0,0 +1,94 @@ +# Default values for cello-master. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +replicaCount: 1 +operatorDashboardImage: + repository: hyperledger/cello-operator-dashboard + tag: latest +userDashboardImage: + repository: hyperledger/cello-user-dashboard + tag: latest +engineImage: + repository: hyperledger/cello-engine + tag: latest +watchDogImage: + repository: hyperledger/cello-watchdog + tag: latest +mongoImage: + repository: mongo + tag: 3.4.10 +nfsImage: + repository: quay.io/kubernetes_incubator/nfs-provisioner + tag: v1.0.9 + +image: + pullPolicy: IfNotPresent + +nfs: + storePath: "/opt/cello/config" + size: 10Gi + nfsPort: 2049 + mountdPort: 20048 + rpcbindPort: 51413 + # nfsNodePort: + # mountdNodePort: + # rpcbindNodePort: + mountdPort: 20048 + rpcbindPort: 51413 + storageClass: "-" + +service: + type: NodePort + +ingress: + enabled: false + # Used to create an Ingress record. + hosts: + - chart-example.local + annotations: + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + tls: + # Secrets must be manually created in the namespace. + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +mongo: + storeEnabled: false + size: 10Gi + storePath: "/opt/cello/mongo" + storageClass: "-" + +operator: + debug: "False" + +userDashboard: + enableEmailActive: "False" + webRoot: "/" + storePath: "/opt/cello/baas" + storageClass: "-" + size: 10Gi + mongo: + host: 127.0.0.1 + port: 27017 + database: user_dashboard + +autoStorageClass: true + +minio: + persistence: + storePath: "/opt/cello/minio" + storageClass: "cello-minio" + +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