-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
41c8650
commit a0b9e0c
Showing
8 changed files
with
301 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v2 | ||
name: sophora-ugc-demo | ||
description: A Helm chart for the UGC demo | ||
type: application | ||
|
||
version: 0.1.0 | ||
|
||
appVersion: 'latest' | ||
|
||
maintainers: | ||
- name: Team Koala | ||
email: [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "ugc-demo.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 "ugc-demo.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 "ugc-demo.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "ugc-demo.labels" -}} | ||
helm.sh/chart: {{ include "ugc-demo.chart" . }} | ||
{{ include "ugc-demo.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "ugc-demo.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "ugc-demo.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "ugc-demo.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "ugc-demo.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "ugc-demo.fullname" . }} | ||
labels: | ||
{{- include "ugc-demo.labels" . | nindent 4 }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
{{- include "ugc-demo.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
{{- with .Values.podAnnotations }} | ||
annotations: | ||
checksum/config: {{ include (print $.Template.BasePath "/sophora-properties-configmap.yaml") . | sha256sum }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "ugc-demo.selectorLabels" . | nindent 8 }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
securityContext: | ||
{{- toYaml .Values.podSecurityContext | nindent 8 }} | ||
initContainers: | ||
- name: config-generator | ||
image: alpine:3.19 | ||
imagePullPolicy: IfNotPresent | ||
env: | ||
- name: SOPHORA_DELIVERY_CLIENT_USERNAME | ||
valueFrom: | ||
secretKeyRef: | ||
key: {{ .Values.sophora.authentication.secret.usernameKey }} | ||
name: {{ .Values.sophora.authentication.secret.name }} | ||
optional: false | ||
- name: SOPHORA_DELIVERY_CLIENT_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
key: {{ .Values.sophora.authentication.secret.passwordKey }} | ||
name: {{ .Values.sophora.authentication.secret.name }} | ||
optional: false | ||
command: [ "/bin/sh" ] | ||
args: | ||
- "-c" | ||
- | | ||
apk update && apk add gettext | ||
mkdir /usr/local/ugc-demo/conf/ | ||
echo "Created conf directory" | ||
envsubst < /usr/local/ugc-demo-template/sophora.properties > /usr/local/ugc-demo/conf/sophora.properties | ||
echo "Generated /usr/local/ugc-demo/conf/sophora.properties from ENV and template" | ||
cp /usr/local/ugc-demo-template/submitter.properties /usr/local/ugc-demo/conf/submitter.properties | ||
echo "Generated /usr/local/ugc-demo/conf/submitter.properties from template" | ||
volumeMounts: | ||
- name: submitter-properties-template | ||
mountPath: /usr/local/ugc-demo-template/submitter.properties | ||
subPath: submitter.properties | ||
- name: sophora-properties-template | ||
mountPath: /usr/local/ugc-demo-template/sophora.properties | ||
subPath: sophora.properties | ||
- name: ugc-demo-config | ||
mountPath: /usr/local/ugc-demo/ | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
volumeMounts: | ||
- name: ugc-demo-config | ||
mountPath: /usr/local/ugc-demo/ | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
volumes: | ||
- name: ugc-demo-config | ||
emptyDir: {} | ||
- name: submitter-properties-template | ||
configMap: | ||
name: {{ include "ugc-demo.fullname" . }}-submitter-properties | ||
- name: sophora-properties-template | ||
configMap: | ||
name: {{ include "ugc-demo.fullname" . }}-sophora-properties | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{{- if .Values.ingress.enabled -}} | ||
{{- $fullName := include "ugc-demo.fullname" . -}} | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: {{ $fullName }} | ||
{{- with .Values.ingress.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
{{- if .Values.ingress.ingressClassName }} | ||
ingressClassName: {{ .Values.ingress.ingressClassName }} | ||
{{- end -}} | ||
{{- if .Values.ingress.tls }} | ||
tls: | ||
{{- range .Values.ingress.tls }} | ||
- hosts: | ||
{{- range .hosts }} | ||
- {{ . | quote }} | ||
{{- end }} | ||
secretName: {{ .secretName }} | ||
{{- end }} | ||
{{- end }} | ||
rules: | ||
{{- range .Values.ingress.hosts }} | ||
- host: {{ required "A hostname for the ingress must be provided in .Values.ugc-demo.ingress.host" .host }} | ||
http: | ||
paths: | ||
- path: / | ||
pathType: {{ default "ImplementationSpecific" .pathType }} | ||
backend: | ||
service: | ||
name: {{ $fullName }} | ||
port: | ||
number: 8080 | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: {{ include "ugc-demo.fullname" . }} | ||
labels: | ||
{{- include "ugc-demo.labels" . | nindent 4 }} | ||
{{- with .Values.service.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
selector: {{- include "ugc-demo.selectorLabels" . | nindent 4 }} | ||
type: {{ .Values.service.type }} | ||
ports: | ||
- protocol: TCP | ||
targetPort: 8080 | ||
port: {{ .Values.service.port }} |
10 changes: 10 additions & 0 deletions
10
charts/sophora-ugc-demo/templates/sophora-properties-configmap.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "ugc-demo.fullname" . }}-sophora-properties | ||
labels: | ||
{{- include "ugc-demo.labels" . | nindent 4 }} | ||
data: | ||
sophora.properties: |- | ||
{{ toString (required "A valid sophora.properties configuration needs to be provided." .Values.ugc.demo.sophoraproperties) | nindent 4 }} |
9 changes: 9 additions & 0 deletions
9
charts/sophora-ugc-demo/templates/submitter-properties-configmap.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "ugc-demo.fullname" . }}-submitter-properties | ||
labels: | ||
{{- include "ugc-demo.labels" . | nindent 4 }} | ||
data: | ||
submitter.properties: |- | ||
{{- toString (required "A valid submitter.properties configuration needs to be provided." .Values.ugc.demo.submitterproperties) | nindent 4 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
nameOverride: "" | ||
fullnameOverride: "" | ||
|
||
replicaCount: 1 | ||
|
||
image: | ||
repository: docker.subshell.com/ugc/ugc-demo | ||
pullPolicy: IfNotPresent | ||
# Overrides the image tag whose default is the chart appVersion. | ||
tag: "" | ||
|
||
imagePullSecrets: [] | ||
|
||
podAnnotations: {} | ||
|
||
podSecurityContext: {} | ||
# fsGroup: 2000 | ||
|
||
ingress: | ||
enabled: false | ||
ingressClassName: nginx | ||
tls: | ||
hosts: | ||
annotations: {} | ||
|
||
service: | ||
type: ClusterIP | ||
port: 8080 | ||
annotations: {} | ||
|
||
ugc: | ||
demo: | ||
submitterproperties: | ||
|
||
sophoraproperties: | ||
|
||
sophora: | ||
authentication: | ||
secret: | ||
name: secret-name | ||
usernameKey: username | ||
passwordKey: password | ||
|
||
# Additional environment variables can be defined here | ||
env: | ||
|
||
resources: | ||
requests: | ||
cpu: "200m" | ||
memory: "2.5G" | ||
limits: | ||
memory: "2.5G" | ||
|
||
|
||
nodeSelector: {} | ||
|
||
tolerations: [] | ||
|
||
affinity: {} |