[bitnami/deepspeed] fix: 🐛 Add context to init container (#18360)

* [bitnami/deepspeed] fix: 🐛 Add context to init container

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* Update README.md with readme-generator-for-helm

Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>

* fix: 🐛 Make /etc/ssh folder writable in git container

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

---------

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>
Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>
Co-authored-by: Bitnami Containers <bitnami-bot@vmware.com>
This commit is contained in:
Javier J. Salmerón-García
2023-08-11 10:57:27 +02:00
committed by GitHub
parent 729161a98c
commit 24d9de2ba2
7 changed files with 47 additions and 13 deletions

View File

@@ -35,4 +35,4 @@ name: deepspeed
sources:
- https://github.com/bitnami/charts/tree/main/bitnami/deepspeed
- https://github.com/bitnami/charts/tree/main/bitnami/pytorch
version: 1.1.0
version: 1.1.1

View File

@@ -83,7 +83,7 @@ The command removes all the Kubernetes components associated with the chart and
| ----------------------------------- | --------------------------------------------------------------------------------------------------------- | ---------------------- |
| `image.registry` | Deepspeed image registry | `docker.io` |
| `image.repository` | Deepspeed image repository | `bitnami/deepspeed` |
| `image.tag` | Deepspeed image tag (immutable tags are recommended) | `0.10.0-debian-11-r19` |
| `image.tag` | Deepspeed image tag (immutable tags are recommended) | `0.10.0-debian-11-r25` |
| `image.digest` | Deepspeed image digest in the way sha256:aa.... Please note this parameter, if set, will override the tag | `""` |
| `image.pullPolicy` | Deepspeed image pull policy | `IfNotPresent` |
| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` |
@@ -321,7 +321,7 @@ The command removes all the Kubernetes components associated with the chart and
| `worker.persistence.annotations` | Persistent Volume annotations | `{}` |
| `gitImage.registry` | Git image registry | `docker.io` |
| `gitImage.repository` | Git image repository | `bitnami/git` |
| `gitImage.tag` | Git image tag (immutable tags are recommended) | `2.41.0-debian-11-r64` |
| `gitImage.tag` | Git image tag (immutable tags are recommended) | `2.41.0-debian-11-r69` |
| `gitImage.digest` | Git image digest in the way sha256:aa.... Please note this parameter, if set, will override the tag | `""` |
| `gitImage.pullPolicy` | Git image pull policy | `IfNotPresent` |
| `gitImage.pullSecrets` | Specify docker-registry secret names as an array | `[]` |

View File

@@ -177,7 +177,9 @@ Return the definition of wait for workers init container
echo "Connection success"
exit 0
{{- if .Values.client.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.client.containerSecurityContext "enabled" | toYaml | nindent 4 }}
{{- end }}
volumeMounts:
- name: ssh-client-config
mountPath: /etc/ssh/ssh_config.d/deepspeed_ssh_client.conf
@@ -189,6 +191,8 @@ Return the definition of wait for workers init container
mountPath: /bitnami/ssh/client-private-key
- name: ssh-local-folder
mountPath: /home/deepspeed/.ssh
- name: tmp
mountPath: /tmp
{{- end -}}
{{/*
@@ -208,15 +212,21 @@ Return the definition of the ssh client configuration init container
# /etc/ssh/ssh_config.d. Therefore, we need to copy the ssh_config
# to a volume and perform modifications to include the configuration
# from the ConfigMap, as it will not be read
[[ -f "/opt/bitnami/scripts/deepspeed/entrypoint.sh" ]] && source "/opt/bitnami/scripts/deepspeed/entrypoint.sh"
cp /etc/ssh/ssh_config /bitnami/ssh/ssh-config
if [[ ! -d /etc/ssh/ssh_config.d ]]; then
# Older version of ssh, add the include directive
echo "Modifying ssh_config with include directive"
echo "Include /etc/ssh/ssh_config.d/*.conf" >> /bitnami/ssh/ssh-config/ssh_config
fi
{{- if .Values.client.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.client.containerSecurityContext "enabled" | toYaml | nindent 4 }}
{{- end }}
volumeMounts:
- name: ssh-config
mountPath: /bitnami/ssh/ssh-config/
- name: tmp
mountPath: /tmp
{{- end -}}
{{/*
@@ -232,6 +242,7 @@ Return the definition of the ssh server configuration init container
- -ec
- |
#!/bin/bash
[[ -f "/opt/bitnami/scripts/deepspeed/entrypoint.sh" ]] && source "/opt/bitnami/scripts/deepspeed/entrypoint.sh"
echo "Obtaining public key and generating authorized_keys file"
mkdir -p /home/deepspeed/.ssh
ssh-keygen -y -f /bitnami/ssh/client-private-key/id_rsa > /home/deepspeed/.ssh/authorized_keys
@@ -284,6 +295,9 @@ Return the definition of the ssh server configuration init container
fi
done < /bitnami/ssh/server-configmap/*.conf
fi
{{- if .Values.worker.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.worker.containerSecurityContext "enabled" | toYaml | nindent 4 }}
{{- end }}
volumeMounts:
- name: ssh-client-private-key
mountPath: /bitnami/ssh/client-private-key
@@ -296,6 +310,8 @@ Return the definition of the ssh server configuration init container
mountPath: /bitnami/ssh/sshd-config/
- name: worker-home
mountPath: /home/
- name: tmp
mountPath: /tmp
{{- end -}}
@@ -303,9 +319,10 @@ Return the definition of the ssh server configuration init container
Return the definition of the git clone init container
*/}}
{{- define "deespeed.git.cloneInitContainer" -}}
{{- $block := index .context.Values .component }}
- name: git-clone-repository
image: {{ include "deepspeed.v0.git.image" . }}
imagePullPolicy: {{ .Values.gitImage.pullPolicy | quote }}
image: {{ include "deepspeed.v0.git.image" .context }}
imagePullPolicy: {{ .context.Values.gitImage.pullPolicy | quote }}
command:
- /bin/bash
args:
@@ -314,12 +331,20 @@ Return the definition of the git clone init container
#!/bin/bash
rm -rf /app/*
[[ -f "/opt/bitnami/scripts/git/entrypoint.sh" ]] && source "/opt/bitnami/scripts/git/entrypoint.sh"
git clone {{ .Values.source.git.repository }} {{ if .Values.source.git.revision }}--branch {{ .Values.source.git.revision }}{{ end }} /app
git clone {{ .context.Values.source.git.repository }} {{ if .context.Values.source.git.revision }}--branch {{ .context.Values.source.git.revision }}{{ end }} /app
{{- if $block.containerSecurityContext.enabled }}
securityContext: {{- omit $block.containerSecurityContext "enabled" | toYaml | nindent 4 }}
{{- end }}
volumeMounts:
- name: source
mountPath: /app
{{- if .Values.source.git.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.source.git.extraVolumeMounts "context" $) | nindent 12 }}
- name: tmp
mountPath: /tmp
# It creates at startup ssh in case it performs ssh-based git clone
- name: tmp
mountPath: /etc/ssh
{{- if .context.Values.source.git.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .context.Values.source.git.extraVolumeMounts "context" .context) | nindent 12 }}
{{- end }}
{{- end -}}
@@ -348,6 +373,8 @@ Return the volume-permissions init container
volumeMounts:
- name: data
mountPath: {{ $block.persistence.mountPath }}
- name: tmp
mountPath: /tmp
{{- end -}}
{{/*

View File

@@ -101,7 +101,7 @@ spec:
{{- include "deepspeed.v0.ssh.clientInitContainer" . | nindent 8 }}
{{- include "deepspeed.v0.client.waitForWorkers" . | nindent 8 }}
{{- if eq .Values.source.type "git" }}
{{- include "deespeed.git.cloneInitContainer" . | nindent 8 }}
{{- include "deespeed.git.cloneInitContainer" (dict "component" "client" "context" $) | nindent 8 }}
{{- end }}
{{- if and .Values.volumePermissions.enabled .Values.client.persistence.enabled }}
{{- include "deepspeed.v0.volumePermissionsInitContainer" (dict "component" "client" "context" $) | nindent 8 }}

View File

@@ -104,7 +104,7 @@ spec:
{{- include "deepspeed.v0.ssh.serverInitContainer" . | nindent 8 }}
{{- end }}
{{- if eq .Values.source.type "git" }}
{{- include "deespeed.git.cloneInitContainer" . | nindent 8 }}
{{- include "deespeed.git.cloneInitContainer" (dict "component" "worker" "context" $) | nindent 8 }}
{{- end }}
{{- if and .Values.volumePermissions.enabled .Values.client.persistence.enabled }}
{{- include "deepspeed.v0.volumePermissionsInitContainer" (dict "component" "worker" "context" $) | nindent 8 }}

View File

@@ -74,7 +74,7 @@ diagnosticMode:
image:
registry: docker.io
repository: bitnami/deepspeed
tag: 0.10.0-debian-11-r19
tag: 0.10.0-debian-11-r25
digest: ""
## Specify a imagePullPolicy
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
@@ -977,7 +977,7 @@ worker:
gitImage:
registry: docker.io
repository: bitnami/git
tag: 2.41.0-debian-11-r64
tag: 2.41.0-debian-11-r69
digest: ""
pullPolicy: IfNotPresent
## Optionally specify an array of imagePullSecrets.