Add Helm Chart - Pinpoint Web

This commit is contained in:
Seongpyo Hong
2020-08-04 00:21:44 +09:00
parent fb54e8e5cb
commit 1432b00df5
9 changed files with 309 additions and 0 deletions

View File

@@ -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 }}

View File

@@ -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 -}}

View File

@@ -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 }}"

View File

@@ -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 }}

View File

@@ -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 }}

View File

@@ -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 -}}