Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SMFI-15: helm chart for sophora-media-finder #120

Merged
merged 3 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions charts/sophora-media-finder/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions charts/sophora-media-finder/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: sophora-media-finder
description: A Helm chart for Sophora Media Finder
type: application
version: 0.1.0
appVersion: "5.x"
1 change: 1 addition & 0 deletions charts/sophora-media-finder/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Sophora Media Finder
51 changes: 51 additions & 0 deletions charts/sophora-media-finder/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "sophora-media-finder.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 "sophora-media-finder.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 "sophora-media-finder.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "sophora-media-finder.labels" -}}
helm.sh/chart: {{ include "sophora-media-finder.chart" . }}
{{ include "sophora-media-finder.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "sophora-media-finder.selectorLabels" -}}
app.kubernetes.io/name: {{ include "sophora-media-finder.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
8 changes: 8 additions & 0 deletions charts/sophora-media-finder/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "sophora-media-finder.fullname" . }}
labels:
{{- include "sophora-media-finder.labels" . | nindent 4 }}
data:
application.yaml: |- {{ toYaml (required "A valid application.yaml config is required" .Values.configuration) | nindent 4 }}
73 changes: 73 additions & 0 deletions charts/sophora-media-finder/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "sophora-media-finder.fullname" . }}
labels:
{{- include "sophora-media-finder.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "sophora-media-finder.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "sophora-media-finder.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: API_KEY
valueFrom:
secretKeyRef:
name: {{ .Values.apiKey.secretName }}
key: {{ .Values.apiKey.secretFieldName }}
optional: false
volumeMounts:
- name: config
mountPath: /config
readOnly: true
ports:
- name: http
containerPort: 8080
protocol: TCP
{{- with .Values.livenessProbe }}
livenessProbe:
httpGet:
path: /health
port: 8080
failureThreshold: {{ .failureThreshold }}
initialDelaySeconds: {{ .initialDelaySeconds }}
periodSeconds: {{ .periodSeconds }}
timeoutSeconds: {{ .timeoutSeconds }}
{{- end }}
{{- with .Values.readinessProbe }}
readinessProbe:
httpGet:
path: /health
port: 8080
failureThreshold: {{ .failureThreshold }}
initialDelaySeconds: {{ .initialDelaySeconds }}
periodSeconds: {{ .periodSeconds }}
timeoutSeconds: {{ .timeoutSeconds }}
{{- end }}
{{- with .Values.startupProbe }}
startupProbe:
httpGet:
path: /health
port: 8080
failureThreshold: {{ .failureThreshold }}
initialDelaySeconds: {{ .initialDelaySeconds }}
periodSeconds: {{ .periodSeconds }}
timeoutSeconds: {{ .timeoutSeconds }}
{{- end }}
volumes:
- name: config
configMap:
name: {{ include "sophora-media-finder.fullname" . }}
41 changes: 41 additions & 0 deletions charts/sophora-media-finder/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "sophora-media-finder.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "sophora-media-finder.labels" . | nindent 4 }}
{{- 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: {{ .host | quote }}
http:
paths:
- path: {{ .path }}
pathType: {{ default "ImplementationSpecific" .pathType }}
backend:
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- end }}
{{- end }}
15 changes: 15 additions & 0 deletions charts/sophora-media-finder/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "sophora-media-finder.fullname" . }}
labels:
{{- include "sophora-media-finder.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "sophora-media-finder.selectorLabels" . | nindent 4 }}
52 changes: 52 additions & 0 deletions charts/sophora-media-finder/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
replicaCount: 1

image:
repository: docker.subshell.com/sophora/media-finder
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "5.x"

imagePullSecrets: []

nameOverride: ""
fullnameOverride: ""

service:
type: ClusterIP
port: 8080

ingress:
enabled: false
ingressClassName: nginx
annotations: {}
hosts:
tls: []

startupProbe:
failureThreshold: 15
initialDelaySeconds: 10
timeoutSeconds: 5
periodSeconds: 5

readinessProbe:
failureThreshold: 5
initialDelaySeconds: 5
timeoutSeconds: 5
periodSeconds: 5

livenessProbe:
failureThreshold: 3
initialDelaySeconds: 15
timeoutSeconds: 10
periodSeconds: 60

apiKey:
secretName: ""
secretFieldName: api-key

configuration:
proxy:
api.base.url: ""
image.service.url: ""
auth.basic.token: ${API_KEY}
maxInMemorySizeInMB: 10
Loading