Helm: パッチの作成に失敗しました:versionedObjectの取得に失敗しました

作成日 2018年06月27日  ·  3コメント  ·  ソース: helm/helm

helm version出力:

Client: &version.Version{SemVer:"v2.9.1", GitCommit:"20adb27c7c5868466912eebdf6664e7390ebe710", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.9.1", GitCommit:"20adb27c7c5868466912eebdf6664e7390ebe710", GitTreeState:"clean"}

kubectl version出力:

Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.5", GitCommit:"32ac1c9073b132b8ba18aa830f46b77dcceb0723", GitTreeState:"clean", BuildDate:"2018-06-21T11:46:00Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.5", GitCommit:"f01a2bf98249a4db383560443a59bed0c13575df", GitTreeState:"clean", BuildDate:"2018-03-19T15:50:45Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}

クラウドプロバイダー/プラットフォーム:AWS

アップグレード時に断続的なエラーが発生します。 この場合、 spec.template.spec.resourcesを変更したapiVersion: apps/v1 DaemonSet:
兜:

Error: UPGRADE FAILED: failed to create patch: failed to get versionedObject: Object 'apiVersion' is missing in 'unstructured object has no version' && failed to create patch: unable to find api field in struct PodSpec for the json field "resources"

耕うん機:

[tiller] 2018/06/27 13:29:42 creating updated release for k8s-efk-filebeat-fix
[storage] 2018/06/27 13:29:42 creating release "k8s-efk-filebeat-fix.v2"
[tiller] 2018/06/27 13:29:42 performing update for k8s-efk-filebeat-fix
[tiller] 2018/06/27 13:29:42 executing 1 pre-upgrade hooks for k8s-efk-filebeat-fix
[tiller] 2018/06/27 13:29:42 hooks complete for pre-upgrade k8s-efk-filebeat-fix
[kube] 2018/06/27 13:29:42 building resources from updated manifest
[kube] 2018/06/27 13:29:42 checking 23 resources for changes
[kube] 2018/06/27 13:29:42 error updating the resource "k8s-efk-filebeat-fix-ci-filebeat":
     failed to create patch: failed to get versionedObject: Object 'apiVersion' is missing in 'unstructured object has no version'
[kube] 2018/06/27 13:29:42 error updating the resource "k8s-efk-filebeat-fix-ci-filebeat":
     failed to create patch: unable to find api field in struct PodSpec for the json field "resources"
[tiller] 2018/06/27 13:29:43 warning: Upgrade "k8s-efk-filebeat-fix" failed: failed to create patch: failed to get versionedObject: Object 'apiVersion' is missing in 'unstructured object has no version' && failed to create patch: unable to find api field in struct PodSpec for the json field "resources"
[storage] 2018/06/27 13:29:43 updating release "k8s-efk-filebeat-fix.v1"
[storage] 2018/06/27 13:29:43 updating release "k8s-efk-filebeat-fix.v2"

これは#3382に似ているようですが、これはCRDではありません。

questiosupport

最も参考になるコメント

これの根本的な原因は、テンプレートを作成することです。

# some comment
{{- if .Values.global.rbacEnable -}}
apiVersion: v1
kind: ServiceAccount
...

何が起こると思いますか?

# some comment apiVersion: v1
kind: ServiceAccount
...

Helmは無効なオブジェクトを喜んで使用しようとし、失敗します。
Error: failed to create patch: failed to get versionedObject: Object 'apiVersion' is missing in 'unstructured object has no version'

オブジェクトを検証する1つの方法は、kubectlを使用することです。 別の方法があれば嬉しいです:

TMP_DIR=/tmp/manifests
mkdir -p $TMP_DIR
helm template $HELM_OPTS $HELM_CHART_PATH \
      | csplit -f $TMP_DIR/ --suppress-matched -q -z - '/^---$/' '{*}'
for f in $TMP_DIR/*;  do
  kubectl apply --dry-run -f $f || exit 1
done

全てのコメント3件

これは不正な形式のデーモンセットのようです(リソースが適切にインデントされていませんでした)。 これをキャッチするKubernetes検証を公開する方法はありますか?

error: error validating "/tmp/test.yaml": error validating data: ValidationError(DaemonSet.spec.template.spec): unknown field "resources" in io.k8s.api.core.v1.PodSpec; if you choose to ignore these errors, turn validation off with --validate=false

こんにちは@ hobti01

この問題を閉じて、k8s検証を公開するための機能リクエストを開くことはできますか?

これの根本的な原因は、テンプレートを作成することです。

# some comment
{{- if .Values.global.rbacEnable -}}
apiVersion: v1
kind: ServiceAccount
...

何が起こると思いますか?

# some comment apiVersion: v1
kind: ServiceAccount
...

Helmは無効なオブジェクトを喜んで使用しようとし、失敗します。
Error: failed to create patch: failed to get versionedObject: Object 'apiVersion' is missing in 'unstructured object has no version'

オブジェクトを検証する1つの方法は、kubectlを使用することです。 別の方法があれば嬉しいです:

TMP_DIR=/tmp/manifests
mkdir -p $TMP_DIR
helm template $HELM_OPTS $HELM_CHART_PATH \
      | csplit -f $TMP_DIR/ --suppress-matched -q -z - '/^---$/' '{*}'
for f in $TMP_DIR/*;  do
  kubectl apply --dry-run -f $f || exit 1
done
このページは役に立ちましたか?
0 / 5 - 0 評価