From 1432b00df5fe2fdf2dbeed98ca85739f4c026425 Mon Sep 17 00:00:00 2001 From: Seongpyo Hong Date: Tue, 4 Aug 2020 00:21:44 +0900 Subject: [PATCH] Add Helm Chart - Pinpoint Web --- .../pinpoint/charts/pinpoint-web/Chart.yaml | 7 ++ .../pinpoint/charts/pinpoint-web/README.md | 3 + .../pinpoint-web/templates/_helpers.tpl | 51 ++++++++++++++ .../templates/cluster-service.yaml | 41 ++++++++++++ .../pinpoint-web/templates/configmap.yaml | 30 +++++++++ .../pinpoint-web/templates/deployment.yaml | 56 ++++++++++++++++ .../charts/pinpoint-web/templates/secret.yaml | 13 ++++ .../pinpoint-web/templates/ui-service.yaml | 41 ++++++++++++ .../pinpoint/charts/pinpoint-web/values.yaml | 67 +++++++++++++++++++ 9 files changed, 309 insertions(+) create mode 100644 install/kubernetes/helm/pinpoint/charts/pinpoint-web/Chart.yaml create mode 100644 install/kubernetes/helm/pinpoint/charts/pinpoint-web/README.md create mode 100644 install/kubernetes/helm/pinpoint/charts/pinpoint-web/templates/_helpers.tpl create mode 100644 install/kubernetes/helm/pinpoint/charts/pinpoint-web/templates/cluster-service.yaml create mode 100644 install/kubernetes/helm/pinpoint/charts/pinpoint-web/templates/configmap.yaml create mode 100644 install/kubernetes/helm/pinpoint/charts/pinpoint-web/templates/deployment.yaml create mode 100644 install/kubernetes/helm/pinpoint/charts/pinpoint-web/templates/secret.yaml create mode 100644 install/kubernetes/helm/pinpoint/charts/pinpoint-web/templates/ui-service.yaml diff --git a/install/kubernetes/helm/pinpoint/charts/pinpoint-web/Chart.yaml b/install/kubernetes/helm/pinpoint/charts/pinpoint-web/Chart.yaml new file mode 100644 index 0000000..55629ef --- /dev/null +++ b/install/kubernetes/helm/pinpoint/charts/pinpoint-web/Chart.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +version: 2.0.4 +name: pinpoint-web +description: Helm chart for deploying Pinpoint web +keywords: + - pinpoint + - web \ No newline at end of file diff --git a/install/kubernetes/helm/pinpoint/charts/pinpoint-web/README.md b/install/kubernetes/helm/pinpoint/charts/pinpoint-web/README.md new file mode 100644 index 0000000..25e5d33 --- /dev/null +++ b/install/kubernetes/helm/pinpoint/charts/pinpoint-web/README.md @@ -0,0 +1,3 @@ +## Pinpoint-Web + +This chart provide the Pinpoint Web Deployments. \ No newline at end of file diff --git a/install/kubernetes/helm/pinpoint/charts/pinpoint-web/templates/_helpers.tpl b/install/kubernetes/helm/pinpoint/charts/pinpoint-web/templates/_helpers.tpl new file mode 100644 index 0000000..d2bb780 --- /dev/null +++ b/install/kubernetes/helm/pinpoint/charts/pinpoint-web/templates/_helpers.tpl @@ -0,0 +1,51 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "pinpoint-web.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 "pinpoint-web.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 "pinpoint-web.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "pinpoint-web.labels" -}} +helm.sh/chart: {{ include "pinpoint-web.chart" . }} +{{ include "pinpoint-web.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "pinpoint-web.selectorLabels" -}} +app.kubernetes.io/name: {{ include "pinpoint-web.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/component: "pinpoint-web" +{{- end }} \ No newline at end of file diff --git a/install/kubernetes/helm/pinpoint/charts/pinpoint-web/templates/cluster-service.yaml b/install/kubernetes/helm/pinpoint/charts/pinpoint-web/templates/cluster-service.yaml new file mode 100644 index 0000000..f6acae9 --- /dev/null +++ b/install/kubernetes/helm/pinpoint/charts/pinpoint-web/templates/cluster-service.yaml @@ -0,0 +1,41 @@ +apiVersion: v1 +kind: Service +metadata: + {{- if .Values.podAnnotations }} + {{- range $key, $value := .Values.podAnnotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- end }} + name: {{ include "pinpoint-web.fullname" . }} + labels: +{{ include "pinpoint-web.labels" . | indent 4 }} +spec: + ports: + - name: cluster + port: {{ default 9997 .Values.service.cluster.port }} + protocol: TCP + targetPort: 9997 + {{- if eq "NodePort" .Values.service.cluster.type }} + {{- if .Values.service.cluster.nodePort }} + nodePort: {{ .Values.service.cluster.nodePort }} + {{- end }} + {{- end }} + {{- if eq "ClusterIP" .Values.service.cluster.type }} + {{- if .Values.service.cluster.clusterIP }} + clusterIP: {{ .Values.service.cluster.clusterIP }} + {{- end }} + {{- end }} + selector: +{{ include "pinpoint-web.selectorLabels" . | indent 6 }} + type: "{{ .Values.service.cluster.type }}" + {{- if eq "LoadBalancer" .Values.service.cluster.type }} + {{- if .Values.service.cluster.loadBalancerIP }} + loadBalancerIP: {{ .Values.service.cluster.loadBalancerIP }} + {{- end -}} + {{- if .Values.service.cluster.loadBalancerSourceRanges }} + loadBalancerSourceRanges: + {{- range .Values.service.cluster.loadBalancerSourceRanges }} + - {{ . }} + {{- end }} + {{- end -}} + {{- end -}} \ No newline at end of file diff --git a/install/kubernetes/helm/pinpoint/charts/pinpoint-web/templates/configmap.yaml b/install/kubernetes/helm/pinpoint/charts/pinpoint-web/templates/configmap.yaml new file mode 100644 index 0000000..e25b5e2 --- /dev/null +++ b/install/kubernetes/helm/pinpoint/charts/pinpoint-web/templates/configmap.yaml @@ -0,0 +1,30 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "pinpoint-web.fullname" . }} + labels: +{{ include "pinpoint-web.labels" . | indent 4 }} +data: + SPRING_PROFILES: "{{ .Values.profiles }}" + JAVA_OPTS: "-Dspring.profiles.active=${SPRING_PROFILES},batch" + CLUSTER_ENABLE: "{{ .Values.cluster.enable }}" + CLUSTER_ZOOKEEPER_ADDRESS: "{{ .Values.cluster.zookeeper }}" + ANALYTICS: "{{ .Values.analytics }}" + HBASE_HOST: "{{ .Values.hbase.host }}" + HBASE_PORT: "{{ .Values.hbase.port }}" + DEBUG_LEVEL: "{{ .Values.debugLevel }}" + CONFIG_SHOW_APPLICATIONSTAT: "{{ .Values.showApplicationStat }}" + BATCH_ENABLE: "{{ .Values.batch.enable }}" + BATCH_SERVER_IP: "{{ .Values.batch.server }}" + BATCH_FILNK_SERVER: "{{ .Values.batch.flink }}" + JDBC_DRIVER: "{{ .Values.jdbc.driver }}" + JDBC_URL: "{{ .Values.jdbc.url }}" + MAIL_SERVER_URL: "{{ .Values.mail.server.url }}" + MAIL_SERVER_PORT: "{{ .Values.mail.server.port }}" + MAIL_SENDER_ADDRESS: "{{ .Values.mail.sender }}" + MAIL_TRANSPORT_PROTOCOL: "{{ .Values.mail.transportProtocol }}" + MAIL_SMTP_PORT: "{{ .Values.mail.smtp.port }}" + MAIL_SMTP_AUTH: "{{ .Values.mail.smtp.auth }}" + MAIL_SMTP_STARTTLS_ENABLE: "{{ .Values.mail.smtp.startTls.enable }}" + MAIL_SMTP_STARTTLS_REQUIRED: "{{ .Values.mail.smtp.startTls.required }}" + MAIL_DEBUG: "{{ .Values.mail.debug }}" \ No newline at end of file diff --git a/install/kubernetes/helm/pinpoint/charts/pinpoint-web/templates/deployment.yaml b/install/kubernetes/helm/pinpoint/charts/pinpoint-web/templates/deployment.yaml new file mode 100644 index 0000000..8bb8332 --- /dev/null +++ b/install/kubernetes/helm/pinpoint/charts/pinpoint-web/templates/deployment.yaml @@ -0,0 +1,56 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ template "pinpoint-web.fullname" . }} + labels: +{{ include "pinpoint-web.labels" . | indent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: +{{ include "pinpoint-web.selectorLabels" . | indent 6 }} + template: + metadata: + labels: +{{ include "pinpoint-web.labels" . | indent 8 }} + annotations: + {{- if .Values.podAnnotations }} + {{- range $key, $value := .Values.podAnnotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- end }} + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.imagePullPolicy }} + ports: + - name: ui + containerPort: 8080 + protocol: TCP + - name: cluster + containerPort: 9997 + protocol: TCP + envFrom: + - configMapRef: + name: {{ template "pinpoint-web.fullname" . }} + - secretRef: + name: {{ template "pinpoint-web.fullname" . }} + readinessProbe: + failureThreshold: 3 + tcpSocket: + port: 8080 + initialDelaySeconds: 5 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 2 + resources: +{{- toYaml .Values.resources | nindent 12 }} +{{- with .Values.affinity }} + affinity: +{{- toYaml . | nindent 8 }} +{{- end }} +{{- with .Values.tolerations }} + tolerations: +{{- toYaml . | nindent 8 }} +{{- end }} diff --git a/install/kubernetes/helm/pinpoint/charts/pinpoint-web/templates/secret.yaml b/install/kubernetes/helm/pinpoint/charts/pinpoint-web/templates/secret.yaml new file mode 100644 index 0000000..896f020 --- /dev/null +++ b/install/kubernetes/helm/pinpoint/charts/pinpoint-web/templates/secret.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "pinpoint-web.fullname" . }} + labels: +{{ include "pinpoint-web.labels" . | indent 4 }} +type: Opaque +data: + ADMIN_PASSWORD: {{ .Values.adminPassword | b64enc | quote }} + JDBC_USERNAME: {{ .Values.jdbc.username | b64enc | quote }} + JDBC_PASSWORD: {{ .Values.jdbc.password | b64enc | quote }} + MAIL_SERVER_USERNAME: {{ .Values.mail.server.username | b64enc | quote }} + MAIL_SERVER_PASSWORD: {{ .Values.mail.server.password | b64enc | quote }} \ No newline at end of file diff --git a/install/kubernetes/helm/pinpoint/charts/pinpoint-web/templates/ui-service.yaml b/install/kubernetes/helm/pinpoint/charts/pinpoint-web/templates/ui-service.yaml new file mode 100644 index 0000000..887b1b5 --- /dev/null +++ b/install/kubernetes/helm/pinpoint/charts/pinpoint-web/templates/ui-service.yaml @@ -0,0 +1,41 @@ +apiVersion: v1 +kind: Service +metadata: + {{- if .Values.podAnnotations }} + {{- range $key, $value := .Values.podAnnotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- end }} + name: {{ include "pinpoint-web.fullname" . }}-ui + labels: +{{ include "pinpoint-web.labels" . | indent 4 }} +spec: + ports: + - name: ui + port: {{ default 8080 .Values.service.ui.port }} + protocol: TCP + targetPort: 8080 +{{- if eq "NodePort" .Values.service.ui.type }} +{{- if .Values.service.ui.nodePort }} + nodePort: {{ .Values.service.ui.nodePort }} +{{- end }} +{{- end }} + {{- if eq "ClusterIP" .Values.service.ui.type }} + {{- if .Values.service.ui.clusterIP }} + clusterIP: {{ .Values.service.ui.clusterIP }} + {{- end }} + {{- end }} + selector: +{{ include "pinpoint-web.selectorLabels" . | indent 6 }} + type: "{{ .Values.service.ui.type }}" + {{- if eq "LoadBalancer" .Values.service.ui.type }} + {{- if .Values.service.ui.loadBalancerIP }} + loadBalancerIP: {{ .Values.service.ui.loadBalancerIP }} + {{- end -}} + {{- if .Values.service.ui.loadBalancerSourceRanges }} + loadBalancerSourceRanges: + {{- range .Values.service.ui.loadBalancerSourceRanges }} + - {{ . }} + {{- end }} + {{- end -}} +{{- end -}} \ No newline at end of file diff --git a/install/kubernetes/helm/pinpoint/charts/pinpoint-web/values.yaml b/install/kubernetes/helm/pinpoint/charts/pinpoint-web/values.yaml index e69de29..32cfa09 100644 --- a/install/kubernetes/helm/pinpoint/charts/pinpoint-web/values.yaml +++ b/install/kubernetes/helm/pinpoint/charts/pinpoint-web/values.yaml @@ -0,0 +1,67 @@ +replicaCount: 1 +imagePullPolicy: Always +## Annotations to be added to Pinpoint Web pods +## +podAnnotations: {} +## Pod affinity +## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} + +## Node tolerations for node-exporter scheduling to nodes with taints +## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ +## +tolerations: [] + # - key: "key" + # operator: "Equal|Exists" + # value: "value" + # effect: "NoSchedule|PreferNoSchedule|NoExecute(1.6 only)" +service: + ui: + type: "LoadBalancer" + nodePort: + clusterIp: + port: 8080 + cluster: + type: "ClusterIP" + nodePort: + clusterIp: + port: 9997 +image: + repository: pinpointdocker/pinpoint-web + tag: 2.0.4 +profiles: release +cluster: + enable: true + zookeeper: pinpoint-zookeeper +adminPassword: admin +analytics: false +debugLevel: INFO +showApplicationStat: true +hbase: + host: pinpoint-zookeeper + port: 2181 +batch: + enable: false + server: 127.0.0.1 + flink: 127.0.0.1 +jdbc: + driver: com.mysql.jdbc.Driver + url: jdbc:mysql://pinpoint-mysql:3306/pinpoint?characterEncoding=UTF-8 + username: admin + password: admin +mail: + server: + url: smtp.gmail.com + port: 587 + username: username + password: password + sender: pinpoint_operator@pinpoint.com + transportProtocol: smtp + debug: false + smtp: + port: 25 + auth: false + startTls: + enable: false + required: false \ No newline at end of file