istio: istioctl kube-inject panic: template: inject:12: function "annotationOrDefault" not defined

Describe the bug when i run command like below: istioctl kube-inject -f istio-1.0.0/samples/bookinfo/platform/kube/bookinfo.yaml

i get this error:

panic: template: inject:12: function "annotationOrDefault" not defined

goroutine 1 [running]:
text/template.Must(0x0, 0x1a88640, 0xc4204080d0, 0x0)
	/usr/local/go/src/text/template/helper.go:23 +0x54
istio.io/istio/pilot/pkg/kube/inject.injectionData(0xc42059a000, 0xf05, 0xc42001b100, 0x40, 0xc420075600, 0xc420075518, 0xc4204e63c0, 0xc4204e4000, 0x190e9a0, 0xc420075000, ...)
	/workspace/go/src/istio.io/istio/pilot/pkg/kube/inject/inject.go:385 +0x2f8
istio.io/istio/pilot/pkg/kube/inject.intoObject(0xc42059a000, 0xf05, 0xc4204e4000, 0x1a935e0, 0xc420075000, 0x0, 0x0, 0x0, 0x0)
	/workspace/go/src/istio.io/istio/pilot/pkg/kube/inject/inject.go:539 +0x4df
istio.io/istio/pilot/pkg/kube/inject.IntoResourceFile(0xc42059a000, 0xf05, 0xc4204e4000, 0x1a8ab20, 0xc4200aab38, 0x1a8ab40, 0xc4200aa008, 0xc, 0x1929a85)
	/workspace/go/src/istio.io/istio/pilot/pkg/kube/inject/inject.go:436 +0x279
main.glob..func3(0x25834e0, 0xc420150f80, 0x0, 0x2, 0x0, 0x0)
	/workspace/go/src/istio.io/istio/istioctl/cmd/istioctl/kubeinject.go:317 +0x72b
istio.io/istio/vendor/github.com/spf13/cobra.(*Command).execute(0x25834e0, 0xc420150ee0, 0x2, 0x2, 0x25834e0, 0xc420150ee0)
	/workspace/go/src/istio.io/istio/vendor/github.com/spf13/cobra/command.go:756 +0x468
istio.io/istio/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x2583740, 0xc4204d3f78, 0xc4204d3f78, 0x403dfc)
	/workspace/go/src/istio.io/istio/vendor/github.com/spf13/cobra/command.go:846 +0x30a
istio.io/istio/vendor/github.com/spf13/cobra.(*Command).Execute(0x2583740, 0x1c, 0x0)
	/workspace/go/src/istio.io/istio/vendor/github.com/spf13/cobra/command.go:794 +0x2b
main.main()
	/workspace/go/src/istio.io/istio/istioctl/cmd/istioctl/main.go:651 +0xb6

Steps to reproduce the bug

  1. install istio
helm install install/kubernetes/helm/istio --name istio --namespace istio-system \
>   --set ingress.enabled=false \
>   --set gateways.istio-ingressgateway.enabled=false \
>   --set gateways.istio-egressgateway.enabled=false \
>   --set galley.enabled=false \
>   --set sidecarInjectorWebhook.enabled=true \
>   --set mixer.enabled=false \
>   --set prometheus.enabled=false \
>   --set global.proxy.envoyStatsd.enabled=false
  1. run command
 istioctl kube-inject -f istio-1.0.0/samples/bookinfo/platform/kube/bookinfo.yaml

Version kubernetes 1.10.3 istioctl 1.0.0

Environment centos 7.4 docker 1.13.1

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 33 (17 by maintainers)

Most upvoted comments

Yeah, the root of this problem is an out-of-date istioctl. Best bet is to just make sure you’re using the istioctl from the Istio build you’re using.

@caussourd As works around i pulled nightly istioctl build. I used this one https://gcsweb.istio.io/gcs/istio-prerelease/daily-build/master-20180819-09-15/ and it worked fine

So istioctl kube inject uses this template. The annotationOrDefault function was never added to the release-1.0 branch and was not included in 1.0.0.

It may be possible that you have some left over generated files from a previous build.

Have you tried doing a make clean?