2022-06-08 08:01:33 +00:00
apiVersion : apps/v1
kind : Deployment
metadata :
2023-03-20 08:19:43 +00:00
name : {{ include "clearmlAgent.fullname" . }}
2022-06-08 08:01:33 +00:00
labels :
2023-03-20 14:16:23 +00:00
{{- include "agentk8sglue.labels" . | nindent 4 }}
2023-01-04 11:01:24 +00:00
annotations :
2023-02-13 07:17:53 +00:00
{{- include "clearmlAgent.annotations" . | nindent 4 }}
2022-06-08 08:01:33 +00:00
spec :
replicas : {{ .Values.agentk8sglue.replicaCount }}
selector :
matchLabels :
{{- include "agentk8sglue.selectorLabels" . | nindent 6 }}
template :
metadata :
annotations :
2023-02-15 14:27:59 +00:00
checksum/config : {{ printf "%s" .Values | sha256sum }}
2023-02-13 07:17:53 +00:00
{{- include "clearmlAgent.annotations" . | nindent 8 }}
2022-06-08 08:01:33 +00:00
labels :
2023-03-20 14:16:23 +00:00
{{- include "agentk8sglue.labels" . | nindent 8 }}
2022-06-08 08:01:33 +00:00
spec :
{{- if .Values.imageCredentials.enabled }}
imagePullSecrets :
{{- if .Values.imageCredentials.existingSecret }}
2023-02-09 09:11:03 +00:00
- name : {{ .Values.imageCredentials.existingSecret }}
2022-06-08 08:01:33 +00:00
{{- else }}
2023-03-20 08:19:43 +00:00
- name : {{ include "clearmlAgent.fullname" . }}-ark
2022-06-08 08:01:33 +00:00
{{- end }}
{{- end }}
2023-02-13 07:17:53 +00:00
serviceAccountName : {{ include "clearmlAgent.serviceAccountName" . }}
2023-03-16 07:42:27 +00:00
securityContext :
{{ toYaml .Values.agentk8sglue.podSecurityContext | nindent 8 }}
2023-01-04 08:45:23 +00:00
initContainers :
2023-03-16 07:42:27 +00:00
- name : init-k8s-glue
image : "{{ include " registryNamePrefix" (dict "globalValues" .Values.global "imageRegistryValue" .Values.agentk8sglue.image.registry) }}{{ .Values.agentk8sglue.image.repository }}:{{ .Values.agentk8sglue.image.tag }}"
command :
- /bin/sh
- -c
- >
set -x;
while [ $(curl {{ if not .Values.agentk8sglue.clearmlcheckCertificate }}--insecure{{ end }} -sw '%{http_code}' "{{.Values.agentk8sglue.apiServerUrlReference}}/debug.ping" -o /dev/null) -ne 200 ] ; do
echo "waiting for apiserver" ;
sleep 5 ;
done;
while [[ $(curl {{ if not .Values.agentk8sglue.clearmlcheckCertificate }}--insecure{{ end }} -sw '%{http_code}' "{{.Values.agentk8sglue.fileServerUrlReference}}/" -o /dev/null) =~ 403|405 ]] ; do
echo "waiting for fileserver" ;
sleep 5 ;
done;
while [ $(curl {{ if not .Values.agentk8sglue.clearmlcheckCertificate }}--insecure{{ end }} -sw '%{http_code}' "{{.Values.agentk8sglue.webServerUrlReference}}/" -o /dev/null) -ne 200 ] ; do
echo "waiting for webserver" ;
sleep 5 ;
done
securityContext :
{{ toYaml .Values.agentk8sglue.containerSecurityContext | nindent 12 }}
2023-06-15 07:05:38 +00:00
resources :
{{- toYaml .Values.agentk8sglue.initContainers.resources | nindent 12 }}
2023-03-16 07:42:27 +00:00
containers :
- name : k8s-glue
image : "{{ include " registryNamePrefix" (dict "globalValues" .Values.global "imageRegistryValue" .Values.agentk8sglue.image.registry) }}{{ .Values.agentk8sglue.image.repository }}:{{ .Values.agentk8sglue.image.tag }}"
imagePullPolicy : IfNotPresent
command :
- /bin/bash
- -c
- >
export PATH=$PATH:$HOME/bin;
source /root/.bashrc && /root/entrypoint.sh
volumeMounts :
2023-03-20 08:19:43 +00:00
- name : {{ include "clearmlAgent.fullname" . }}-pt
2023-03-16 07:42:27 +00:00
mountPath : /root/template
2024-05-14 09:05:03 +00:00
{{ if or (.Values.clearml.clearmlConfig) (.Values.clearml.existingClearmlConfigSecret) }}
2023-03-16 07:42:27 +00:00
- name : k8sagent-clearml-conf-volume
mountPath : /root/clearml.conf
subPath : clearml.conf
readOnly : true
{{- end }}
{{- if .Values.agentk8sglue.volumeMounts }}
2024-01-10 08:23:52 +00:00
{{- toYaml .Values.agentk8sglue.volumeMounts | nindent 12 }}
2023-03-16 07:42:27 +00:00
{{- end }}
{{- range .Values.agentk8sglue.fileMounts }}
- name : filemounts
mountPath : "{{ .folderPath }}/{{ .name }}"
subPath : "{{ .name }}"
readOnly : true
{{- end }}
env :
- name : CLEARML_API_HOST
value : "{{.Values.agentk8sglue.apiServerUrlReference}}"
- name : CLEARML_WEB_HOST
value : "{{.Values.agentk8sglue.webServerUrlReference}}"
- name : CLEARML_FILES_HOST
value : "{{.Values.agentk8sglue.fileServerUrlReference}}"
{{- if not .Values.agentk8sglue.clearmlcheckCertificate }}
- name : CLEARML_API_HOST_VERIFY_CERT
value : "false"
{{- end }}
{{- if .Values.sessions.portModeEnabled }}
- name : K8S_GLUE_EXTRA_ARGS
value : "--namespace {{ .Release.Namespace }} --template-yaml /root/template/template.yaml \
--ports-mode --num-of-services {{ .Values.sessions.maxServices }} \
--base-port {{ .Values.sessions.startingPort }} \
2024-05-15 14:19:40 +00:00
--gateway-address {{ .Values.sessions.externalIP }} \
2024-06-06 07:51:21 +00:00
{{- if .Values.agentk8sglue.createQueueIfNotExists }} --create-queue{{- end }}
"
2023-03-16 07:42:27 +00:00
{{- else}}
- name : K8S_GLUE_EXTRA_ARGS
2024-05-15 14:19:40 +00:00
value : "--namespace {{ .Release.Namespace }} --template-yaml /root/template/template.yaml \
2024-06-06 07:51:21 +00:00
{{- if .Values.agentk8sglue.createQueueIfNotExists }} --create-queue{{- end }}
"
2023-03-16 07:42:27 +00:00
{{- end }}
2024-05-14 09:05:03 +00:00
{{ if or (.Values.clearml.clearmlConfig) (.Values.clearml.existingClearmlConfigSecret) }}
2023-03-16 07:42:27 +00:00
- name : CLEARML_CONFIG_FILE
value : /root/clearml.conf
{{- end }}
- name : K8S_DEFAULT_NAMESPACE
value : "{{ .Release.Namespace }}"
- name : CLEARML_API_ACCESS_KEY
valueFrom :
secretKeyRef :
2024-04-02 06:47:14 +00:00
{{- if .Values.clearml.existingAgentk8sglueSecret }}
name : {{ .Values.clearml.existingAgentk8sglueSecret }}
{{- else }}
2023-03-20 08:19:43 +00:00
name : {{ include "clearmlAgent.fullname" . }}-ac
2024-04-02 06:47:14 +00:00
{{- end }}
2023-03-16 07:42:27 +00:00
key : agentk8sglue_key
- name : CLEARML_API_SECRET_KEY
valueFrom :
secretKeyRef :
2024-04-02 06:47:14 +00:00
{{- if .Values.clearml.existingAgentk8sglueSecret }}
name : {{ .Values.clearml.existingAgentk8sglueSecret }}
{{- else }}
2023-03-20 08:19:43 +00:00
name : {{ include "clearmlAgent.fullname" . }}-ac
2024-04-02 06:47:14 +00:00
{{- end }}
2023-03-16 07:42:27 +00:00
key : agentk8sglue_secret
- name : CLEARML_WORKER_ID
2023-03-20 08:19:43 +00:00
value : {{ include "clearmlAgent.fullname" . }}
2023-03-16 07:42:27 +00:00
- name : CLEARML_AGENT_UPDATE_REPO
value : ""
- name : FORCE_CLEARML_AGENT_REPO
value : ""
- name : CLEARML_DOCKER_IMAGE
value : "{{.Values.agentk8sglue.defaultContainerImage}}"
- name : K8S_GLUE_QUEUE
value : {{ .Values.agentk8sglue.queue }}
{{- if .Values.agentk8sglue.extraEnvs }}
{{ toYaml .Values.agentk8sglue.extraEnvs | nindent 12 }}
{{- end }}
securityContext :
{{ toYaml .Values.agentk8sglue.containerSecurityContext | nindent 12 }}
2023-06-15 07:05:38 +00:00
resources :
{{- toYaml .Values.agentk8sglue.resources | nindent 12 }}
2023-03-30 20:45:21 +00:00
{{- with .Values.agentk8sglue.nodeSelector}}
nodeSelector :
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.agentk8sglue.affinity }}
affinity :
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.agentk8sglue.tolerations }}
tolerations :
{{- toYaml . | nindent 8 }}
{{- end }}
2022-06-08 08:01:33 +00:00
volumes :
2023-03-20 08:19:43 +00:00
- name : {{ include "clearmlAgent.fullname" . }}-pt
2023-01-04 08:45:23 +00:00
configMap :
2023-03-20 08:19:43 +00:00
name : {{ include "clearmlAgent.fullname" . }}-pt
2024-05-14 09:05:03 +00:00
{{ if .Values.clearml.existingClearmlConfigSecret }}
- name : k8sagent-clearml-conf-volume
secret :
secretName : {{ .Values.clearml.existingClearmlConfigSecret }}
items :
- key : clearml.conf
path : clearml.conf
{{ else if .Values.clearml.clearmlConfig }}
2022-06-23 07:52:19 +00:00
- name : k8sagent-clearml-conf-volume
secret :
2023-03-20 08:19:43 +00:00
secretName : {{ include "clearmlAgent.fullname" . }}-ac
2022-06-23 07:52:19 +00:00
items :
- key : clearml.conf
path : clearml.conf
{{ end }}
2023-01-04 08:45:23 +00:00
{{ if .Values.agentk8sglue.fileMounts }}
- name : filemounts
secret :
2023-03-20 08:19:43 +00:00
secretName : {{ include "clearmlAgent.fullname" . }}-afm
2023-03-16 07:42:27 +00:00
{{ end }}
{{- if .Values.agentk8sglue.volumes }}
{{- toYaml .Values.agentk8sglue.volumes | nindent 8 }}
2023-01-04 08:45:23 +00:00
{{- end }}