add shuffle helm chart

remove gitlab ci file
This commit is contained in:
Pascal Sthamer
2024-12-31 02:42:51 +01:00
parent ceb724cfc6
commit 8a523adaba
53 changed files with 6938 additions and 0 deletions
@@ -0,0 +1,19 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "shuffle.orborus.name" . }}-env
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "shuffle.orborus.labels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
data:
ENVIRONMENT_NAME: "{{ .Values.shuffle.org }}"
ORG_ID: "{{ .Values.shuffle.org }}"
TZ: "{{ .Values.shuffle.timezone }}"
BASE_URL: "http://{{ include "shuffle.backend.name" . }}.{{ .Release.Namespace }}.svc.cluster.local:5001"
KUBERNETES_NAMESPACE: "{{ .Release.Namespace }}"
KUBERNETES_SERVICE_ACCOUNT: {{ include "shuffle.orborus.serviceAccountName" . }}
SHUFFLE_WORKER_IMAGE: "{{ include "shuffle.worker.image" . }}"
REGISTRY_URL: "{{ .Values.shuffle.appRegistry }}"
SHUFFLE_SWARM_CONFIG: run
@@ -0,0 +1,155 @@
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ template "shuffle.orborus.name" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "shuffle.orborus.labels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- if or .Values.orborus.deploymentAnnotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" (dict "values" (list .Values.orborus.deploymentAnnotations .Values.commonAnnotations) "context" .) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if not .Values.orborus.autoscaling.hpa.enabled }}
replicas: {{ .Values.orborus.replicaCount }}
{{- end }}
{{- if .Values.orborus.updateStrategy }}
strategy: {{- toYaml .Values.orborus.updateStrategy | nindent 4 }}
{{- end }}
{{- $podLabels := include "common.tplvalues.merge" (dict "values" (list .Values.orborus.podLabels .Values.commonLabels) "context" .) }}
selector:
matchLabels: {{- include "shuffle.orborus.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
template:
metadata:
{{- if .Values.orborus.podAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.orborus.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "shuffle.orborus.labels" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }}
spec:
{{- include "shuffle.imagePullSecrets" . | nindent 6 }}
serviceAccountName: {{ template "shuffle.orborus.serviceAccountName" . }}
automountServiceAccountToken: {{ .Values.orborus.automountServiceAccountToken }}
{{- if .Values.orborus.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.orborus.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.orborus.affinity }}
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.orborus.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.orborus.podAffinityPreset "component" "orborus" "customLabels" $podLabels "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.orborus.podAntiAffinityPreset "component" "orborus" "customLabels" $podLabels "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.orborus.nodeAffinityPreset.type "key" .Values.orborus.nodeAffinityPreset.key "values" .Values.orborus.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.orborus.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.orborus.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.orborus.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.orborus.tolerations "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.orborus.priorityClassName }}
priorityClassName: {{ .Values.orborus.priorityClassName | quote }}
{{- end }}
{{- if .Values.orborus.schedulerName }}
schedulerName: {{ .Values.orborus.schedulerName | quote }}
{{- end }}
{{- if .Values.orborus.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.orborus.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.orborus.podSecurityContext.enabled }}
securityContext: {{- omit .Values.orborus.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
{{- if .Values.orborus.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.orborus.terminationGracePeriodSeconds }}
{{- end }}
initContainers:
{{- if .Values.orborus.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.orborus.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
- name: orborus
image: {{ template "shuffle.orborus.image" . }}
imagePullPolicy: {{ .Values.orborus.image.pullPolicy }}
{{- if .Values.orborus.containerSecurityContext.enabled }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.orborus.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
{{- else if .Values.orborus.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.orborus.command "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
{{- else if .Values.orborus.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.orborus.args "context" $) | nindent 12 }}
{{- end }}
env:
- name: RUNNING_MODE
value: kubernetes
- name: IS_KUBERNETES
value: "true"
{{- if .Values.orborus.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.orborus.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
envFrom:
- configMapRef:
name: {{ include "shuffle.orborus.name" . }}-env
{{- if .Values.orborus.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.orborus.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.orborus.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.orborus.extraEnvVarsSecret "context" $) }}
{{- end }}
{{- if .Values.orborus.resources }}
resources: {{- toYaml .Values.orborus.resources | nindent 12 }}
{{- else if ne .Values.orborus.resourcesPreset "none" }}
resources: {{- include "common.resources.preset" (dict "type" .Values.orborus.resourcesPreset) | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: 8080
{{- if not .Values.diagnosticMode.enabled }}
{{- if .Values.orborus.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.orborus.customLivenessProbe "context" $) | nindent 12 }}
{{- else if .Values.orborus.livenessProbe.enabled }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.orborus.livenessProbe "enabled") "context" $) | nindent 12 }}
httpGet:
path: /
port: 8080
{{- end }}
{{- if .Values.orborus.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.orborus.customReadinessProbe "context" $) | nindent 12 }}
{{- else if .Values.orborus.readinessProbe.enabled }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.orborus.readinessProbe "enabled") "context" $) | nindent 12 }}
httpGet:
path: /
port: 8080
{{- end }}
{{- if .Values.orborus.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.orborus.customStartupProbe "context" $) | nindent 12 }}
{{- else if .Values.orborus.startupProbe.enabled }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.orborus.startupProbe "enabled") "context" $) | nindent 12 }}
httpGet:
path: /
port: 8080
{{- end }}
{{- end }}
{{- if .Values.orborus.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.orborus.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
volumeMounts:
- name: empty-dir
mountPath: /tmp
subPath: tmp-dir
{{- if .Values.orborus.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.orborus.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.orborus.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.orborus.sidecars "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: empty-dir
emptyDir: {}
{{- if .Values.orborus.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.orborus.extraVolumes "context" $) | nindent 8 }}
{{- end }}
@@ -0,0 +1,43 @@
{{- if .Values.orborus.autoscaling.hpa.enabled }}
apiVersion: {{ include "common.capabilities.hpa.apiVersion" . }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "shuffle.orborus.name" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "shuffle.orborus.labels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
scaleTargetRef:
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
name: {{ include "shuffle.orborus.name" . }}
minReplicas: {{ .Values.orborus.autoscaling.hpa.minReplicas }}
maxReplicas: {{ .Values.orborus.autoscaling.hpa.maxReplicas }}
metrics:
{{- if .Values.orborus.autoscaling.hpa.targetMemory }}
- type: Resource
resource:
name: memory
{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
targetAverageUtilization: {{ .Values.orborus.autoscaling.hpa.targetMemory }}
{{- else }}
target:
type: Utilization
averageUtilization: {{ .Values.worker.autoscaling.hpa.targetMemory }}
{{- end }}
{{- end }}
{{- if .Values.orborus.autoscaling.hpa.targetCPU }}
- type: Resource
resource:
name: cpu
{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
targetAverageUtilization: {{ .Values.orborus.autoscaling.hpa.targetCPU }}
{{- else }}
target:
type: Utilization
averageUtilization: {{ .Values.worker.autoscaling.hpa.targetCPU }}
{{- end }}
{{- end }}
{{- end }}
@@ -0,0 +1,72 @@
{{- if .Values.orborus.networkPolicy.enabled }}
kind: NetworkPolicy
apiVersion: {{ include "common.capabilities.networkPolicy.apiVersion" . }}
metadata:
name: {{ template "shuffle.orborus.name" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "shuffle.orborus.labels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.orborus.podLabels .Values.commonLabels ) "context" . ) }}
podSelector:
matchLabels: {{- include "shuffle.orborus.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
policyTypes:
- Ingress
- Egress
egress:
{{- if .Values.orborus.networkPolicy.allowExternalEgress }}
- {}
{{- else }}
# Allow DNS resolution with an in-cluster DNS server
- ports:
- port: 53
protocol: UDP
- port: 53
protocol: TCP
to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
# Allow access to backend
- ports:
- port: 5001
protocol: TCP
to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: {{ .Release.Namespace }}
podSelector:
matchLabels: {{ include "shuffle.backend.matchLabels" . | nindent 14 }}
# Allow access to workers
- ports:
- port: 33333
protocol: TCP
to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: {{ .Release.Namespace }}
podSelector:
matchLabels: {{ include "shuffle.worker.matchLabels" . | nindent 14 }}
{{- if .Values.orborus.networkPolicy.extraEgress }}
{{- include "common.tplvalues.render" ( dict "value" .Values.orborus.networkPolicy.extraEgress "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
ingress:
- ports:
- port: 8080
protocol: TCP
{{- if not .Values.orborus.networkPolicy.allowExternal }}
from:
# Allow traffic from workers
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: {{ .Release.Namespace }}
podSelector:
matchLabels: {{ include "shuffle.worker.matchLabels" . | nindent 14 }}
{{- end }}
{{- if .Values.orborus.networkPolicy.extraIngress }}
{{- include "common.tplvalues.render" ( dict "value" .Values.orborus.networkPolicy.extraIngress "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
@@ -0,0 +1,21 @@
{{- if .Values.orborus.pdb.create }}
apiVersion: {{ include "common.capabilities.policy.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
name: {{ include "shuffle.orborus.name" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "shuffle.orborus.labels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if .Values.orborus.pdb.minAvailable }}
minAvailable: {{ .Values.orborus.pdb.minAvailable }}
{{- end }}
{{- if or .Values.orborus.pdb.maxUnavailable ( not .Values.orborus.pdb.minAvailable ) }}
maxUnavailable: {{ .Values.orborus.pdb.maxUnavailable | default 1 }}
{{- end }}
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.orborus.podLabels .Values.commonLabels ) "context" . ) }}
selector:
matchLabels: {{- include "shuffle.orborus.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
{{- end }}
@@ -0,0 +1,18 @@
{{ if .Values.orborus.rbac.create }}
kind: RoleBinding
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
metadata:
name: {{ include "shuffle.orborus.name" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "shuffle.orborus.labels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
subjects:
- kind: ServiceAccount
name: {{ include "shuffle.orborus.serviceAccountName" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ include "shuffle.orborus.name" . }}
{{- end }}
@@ -0,0 +1,29 @@
{{ if .Values.orborus.rbac.create }}
kind: Role
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
metadata:
name: {{ include "shuffle.orborus.name" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "shuffle.orborus.labels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
rules:
- verbs:
- list
- create
- delete
apiGroups:
- ''
resources:
- pods
- services
- verbs:
- list
- create
- delete
apiGroups:
- apps
resources:
- deployments
{{- end }}
@@ -0,0 +1,13 @@
{{- if .Values.orborus.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "shuffle.orborus.serviceAccountName" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "shuffle.orborus.labels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- if or .Values.orborus.serviceAccount.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" (dict "values" (list .Values.orborus.serviceAccount.annotations .Values.commonAnnotations) "context" .) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.orborus.serviceAccount.automountServiceAccountToken }}
{{- end }}
@@ -0,0 +1,38 @@
{{- if and (.Capabilities.APIVersions.Has "autoscaling.k8s.io/v1/VerticalPodAutoscaler") .Values.orborus.autoscaling.vpa.enabled }}
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: {{ include "shuffle.orborus.name" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "shuffle.orborus.labels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- if or .Values.orborus.autoscaling.vpa.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.orborus.autoscaling.vpa.annotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
{{- end }}
spec:
resourcePolicy:
containerPolicies:
- containerName: orborus
{{- with .Values.orborus.autoscaling.vpa.controlledResources }}
controlledResources:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.orborus.autoscaling.vpa.maxAllowed }}
maxAllowed:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.orborus.autoscaling.vpa.minAllowed }}
minAllowed:
{{- toYaml . | nindent 8 }}
{{- end }}
targetRef:
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
name: {{ include "orborus.names.name" . }}
{{- if .Values.orborus.autoscaling.vpa.updatePolicy }}
updatePolicy:
{{- with .Values.orborus.autoscaling.vpa.updatePolicy.updateMode }}
updateMode: {{ . }}
{{- end }}
{{- end }}
{{- end }}