Skip to content

Commit 0703a04

Browse files
alongkorn23Alongkorn Kiatmontri
and
Alongkorn Kiatmontri
authored
[tablestar-controller] STSI-470: add helm chart for TableStar controller (#154)
Co-authored-by: Alongkorn Kiatmontri <[email protected]>
1 parent f8e8f6a commit 0703a04

File tree

10 files changed

+316
-0
lines changed

10 files changed

+316
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: v2
2+
name: sophora-tablestar-controller
3+
description: A Helm chart for the Sophora TableStar Controller
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 1.0.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
appVersion: 5.5.3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Sophora TableStar Controller
2+
3+
This Helm Chart provides a general setup for Sophora **TableStar** Controller.
4+
5+
## Architecture
6+
7+
### TableStar Controller
8+
9+
* [deployment.yaml](templates/deployment.yaml) provides the actual spring application
10+
container
11+
* [config.yaml](templates/config.yaml) helps mounting the spring application config files
12+
into to container
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "tablestar-controller.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "tablestar-controller.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "tablestar-controller.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "tablestar-controller.labels" -}}
37+
helm.sh/chart: {{ include "tablestar-controller.chart" . }}
38+
{{ include "tablestar-controller.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "tablestar-controller.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "tablestar-controller.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ include "tablestar-controller.fullname" . }}
5+
labels:
6+
{{- include "tablestar-controller.labels" . | nindent 4 }}
7+
data:
8+
application.yaml: |- {{ toYaml (required "A valid application.yml config is required for controller" .Values.sophora.configuration) | nindent 4 }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "tablestar-controller.fullname" . }}
5+
labels:
6+
{{- include "tablestar-controller.labels" . | nindent 4 }}
7+
spec:
8+
replicas: 1
9+
selector:
10+
matchLabels:
11+
{{- include "tablestar-controller.selectorLabels" . | nindent 6 }}
12+
template:
13+
metadata:
14+
annotations:
15+
checksum/config: {{ include (print $.Template.BasePath "/config.yaml") . | sha256sum }}
16+
{{- with .Values.podAnnotations }}
17+
{{- toYaml . | nindent 8 }}
18+
{{- end }}
19+
labels:
20+
{{- include "tablestar-controller.labels" . | nindent 8 }}
21+
spec:
22+
{{- with .Values.imagePullSecrets }}
23+
imagePullSecrets:
24+
{{- toYaml . | nindent 8 }}
25+
{{- end }}
26+
containers:
27+
- name: tablestar-controller
28+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
29+
imagePullPolicy: {{ .Values.image.pullPolicy }}
30+
volumeMounts:
31+
- mountPath: /workspace/config
32+
name: config
33+
ports:
34+
- name: http
35+
containerPort: {{ .Values.service.httpPort }}
36+
protocol: TCP
37+
env:
38+
- name: JDK_JAVA_OPTIONS
39+
value: {{ .Values.javaOptions }}
40+
- name: SOPHORA_CLIENT_SERVERCONNECTION_USERNAME
41+
valueFrom:
42+
secretKeyRef:
43+
key: {{ .Values.sophora.authentication.secret.usernameKey | quote }}
44+
name: {{ required "A valid secret name must be provided in .Values.sophora.authentication.secret.name" .Values.sophora.authentication.secret.name | quote }}
45+
- name: SOPHORA_CLIENT_SERVERCONNECTION_PASSWORD
46+
valueFrom:
47+
secretKeyRef:
48+
key: {{ .Values.sophora.authentication.secret.passwordKey | quote }}
49+
name: {{ required "A valid secret name must be provided in .Values.sophora.authentication.secret.name" .Values.sophora.authentication.secret.name | quote }}
50+
- name: TZ
51+
value: {{ .Values.timeZone | quote }}
52+
{{- with .Values.livenessProbe }}
53+
livenessProbe:
54+
httpGet:
55+
path: /actuator/health
56+
port: http
57+
failureThreshold: {{ .failureThreshold }}
58+
initialDelaySeconds: {{ .initialDelaySeconds }}
59+
periodSeconds: {{ .periodSeconds }}
60+
timeoutSeconds: {{ .timeoutSeconds }}
61+
{{- end }}
62+
{{- with .Values.readinessProbe }}
63+
readinessProbe:
64+
httpGet:
65+
path: /actuator/health
66+
port: http
67+
failureThreshold: {{ .failureThreshold }}
68+
initialDelaySeconds: {{ .initialDelaySeconds }}
69+
periodSeconds: {{ .periodSeconds }}
70+
timeoutSeconds: {{ .timeoutSeconds }}
71+
{{- end }}
72+
{{- with .Values.startupProbe }}
73+
startupProbe:
74+
httpGet:
75+
path: /actuator/health
76+
port: http
77+
failureThreshold: {{ .failureThreshold }}
78+
initialDelaySeconds: {{ .initialDelaySeconds }}
79+
periodSeconds: {{ .periodSeconds }}
80+
timeoutSeconds: {{ .timeoutSeconds }}
81+
{{- end }}
82+
resources:
83+
{{- toYaml .Values.resources | nindent 12 }}
84+
volumes:
85+
- name: config
86+
configMap:
87+
name: {{ include "tablestar-controller.fullname" . }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
kind: Service
2+
apiVersion: v1
3+
metadata:
4+
name: {{ include "tablestar-controller.fullname" . }}
5+
labels:
6+
{{- include "tablestar-controller.labels" . | nindent 4 }}
7+
annotations: {{- toYaml .Values.service.annotations | nindent 4 }}
8+
spec:
9+
type: {{ .Values.service.type | quote }}
10+
{{ if .Values.service.clusterIP -}}
11+
clusterIP: {{ .Values.service.clusterIP }}
12+
{{- end }}
13+
selector: {{- include "tablestar-controller.selectorLabels" . | nindent 4 }}
14+
ports:
15+
- protocol: TCP
16+
port: {{ .Values.service.httpPort }}
17+
targetPort: http
18+
name: http
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{{- if .Values.serviceMonitor.enabled -}}
2+
{{- $fullName := include "tablestar-controller.fullname" . -}}
3+
apiVersion: monitoring.coreos.com/v1
4+
kind: ServiceMonitor
5+
metadata:
6+
name: {{ $fullName }}
7+
labels: {{- include "tablestar-controller.labels" . | nindent 8 }}
8+
spec:
9+
selector:
10+
matchLabels: {{- include "tablestar-controller.selectorLabels" . | nindent 12 }}
11+
endpoints:
12+
- interval: {{ .Values.serviceMonitor.interval }}
13+
port: http
14+
path: {{ .Values.serviceMonitor.path }}
15+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
image:
2+
tag: "5.0.0"
3+
pullPolicy: Always
4+
5+
imagePullSecrets:
6+
- name: docker-subshell
7+
8+
sophora:
9+
serverUrl: http://sophora-server:1196
10+
authentication:
11+
secret:
12+
name: "sophora-user-admin-credentials"
13+
14+
configuration:
15+
sophora:
16+
client:
17+
server-connection:
18+
urls: "https://cms.dev.sophora.code-nnw.cloud"
19+
username: # in secret
20+
password: # in secret
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
image:
2+
repository: docker.subshell.com/sophora/tablestar/controller
3+
tag: "latest"
4+
pullPolicy: IfNotPresent
5+
6+
imagePullSecrets: []
7+
nameOverride: ""
8+
fullnameOverride: sophora-tablestar-controller
9+
10+
javaOptions:
11+
12+
timeZone: "Europe/Berlin"
13+
14+
sophora:
15+
authentication:
16+
secret:
17+
name: ""
18+
passwordKey: "password"
19+
usernameKey: "username"
20+
21+
# Represents the application.yml of controller:
22+
configuration:
23+
sophora:
24+
client:
25+
server-connection:
26+
urls: "https://cms.stable.test.subshell.io"
27+
username: # in secret
28+
password: # in secret
29+
30+
service:
31+
annotations: {}
32+
type: ClusterIP
33+
clusterIP:
34+
httpPort: 8080
35+
36+
serviceMonitor:
37+
enabled: false
38+
interval: 10s
39+
path: /actuator/prometheus
40+
41+
resources:
42+
requests:
43+
memory: 1G
44+
cpu: 200m
45+
limits:
46+
memory: 1.5G
47+
podAnnotations: {}
48+
49+
startupProbe: # allow at most 27 seconds to start
50+
failureThreshold: 5
51+
initialDelaySeconds: 2
52+
timeoutSeconds: 3
53+
periodSeconds: 2
54+
55+
livenessProbe:
56+
failureThreshold: 1
57+
initialDelaySeconds: 1
58+
timeoutSeconds: 3
59+
periodSeconds: 60

0 commit comments

Comments
 (0)