diff --git a/charts/pyxis/templates/driver-deployment.yaml b/charts/pyxis/templates/driver-deployment.yaml index a1620cd..e28f20a 100644 --- a/charts/pyxis/templates/driver-deployment.yaml +++ b/charts/pyxis/templates/driver-deployment.yaml @@ -19,7 +19,7 @@ spec: labels: {{- include "pyxis.selectorLabels" (dict "root" . "part" "driver") | nindent 8 }} annotations: - checksum/config: {{ include (print $.Template.BasePath "/driver-configmap.yaml") . | sha256sum }} + checksum/config: {{ merge (dict "socketGroupId" (int .Values.carina.gid)) .Values.driver.config | toJson | sha256sum }} spec: {{- with include "pyxis.imagePullSecrets" . }}{{ . | trim | nindent 6 }}{{- end }} {{- with include "pyxis.nodeSelector" (dict "root" . "own" $driver.nodeSelector) }}{{ . | trim | nindent 6 }}{{- end }} diff --git a/scripts/check-rendering.sh b/scripts/check-rendering.sh index 7dffb40..2831855 100755 --- a/scripts/check-rendering.sh +++ b/scripts/check-rendering.sh @@ -29,6 +29,25 @@ if [ "$checksum_owners" != 'carina-driver' ]; then status=1 fi +# チャートの版だけが変わっても driver の checksum は変わらない (変わると版を上げるたびに driver が作り直され、録画が切れる) +checksum_of() { + printf '%s\n' "$1" | sed -n 's/^ *checksum\/config: *//p' | head -n 1 +} +bumped=$(mktemp -d) +cp -r charts/pyxis "$bumped/pyxis" +sed -i 's/^version: .*/version: 99.99.99/; s/^appVersion: .*/appVersion: 99.99.99/' "$bumped/pyxis/Chart.yaml" +rebumped=$(helm template carina "$bumped/pyxis" -f charts/pyxis/ci/default-values.yaml) +rm -rf "$bumped" +if [ "$(checksum_of "$rendered")" != "$(checksum_of "$rebumped")" ]; then + echo 'チャートの版を変えただけで driver の checksum が変わる' >&2 + status=1 +fi +reconfigured=$(helm template carina charts/pyxis -f charts/pyxis/ci/default-values.yaml --set driver.config.shutdownGraceHours=7) +if [ "$(checksum_of "$rendered")" = "$(checksum_of "$reconfigured")" ]; then + echo 'driver.json を変えても driver の checksum が変わらない' >&2 + status=1 +fi + services=$(printf '%s\n' "$rendered" | awk ' /^---/ { kind = ""; name = "" } /^kind: / { kind = $2 }