Starsand’s Knowledge

IT技術の検証、トラブル対応、作成したものを公開します。自分のペースで好きなことを

Helm json: cannot unmarshal string into Go struct field ConfigMapVolumeSource.spec.template.spec.volumes.configMap.defaultMode of type int32

概要

helmで (少なくとも)volumes.configMap.defaultMode を指定する際、ファイルパーミッションの指定は8進数ではなく10進数に直して指定する必要がありそうです。

対応方法

--set your.field=493

発生したエラーとコマンドライン

helm install redis-session-store --create-namespace --namespace prod \
::
    --set master.extraVolumes[0].configMap.defaultMode=0755 \


Error: INSTALLATION FAILED: 2 errors occurred:
        * StatefulSet in version "v1" cannot be handled as a StatefulSet: json: cannot unmarshal string into Go struct field ConfigMapVolumeSource.spec.template.spec.volumes.configMap.defaultMode of type int32
        * StatefulSet in version "v1" cannot be handled as a StatefulSet: json: cannot unmarshal string into Go struct field ConfigMapVolumeSource.spec.template.spec.volumes.configMap.defaultMode of type int32

また、755とした場合でも、Pod自体はRunningとならず、describeからは権限について言及されます。

kubectl describe

  Warning  FailedCreate      78s (x16 over 4m2s)  statefulset-controller  create Pod redis-session-store-master-0 in StatefulSet redis-session-store-master failed error: Pod "redis-session-store-master-0" is invalid: [spec.volumes[5].configMap.defaultMode: Invalid value: 755: must be a number between 0 and 0777 (octal), both inclusive, spec.containers[0].volumeMounts[6].name: Not found: "conf"]

参考・他

ドキュメントを読み込んだわけではないので自分の見落としなだけな可能性はありますが、検索時に日本語の情報がうまくヒットしなかったので記載。

参考

github.com