istio: Sidecar injection customization fails - memory and cpu annotations ignored
Is this the right place to submit this?
- This is not a security vulnerability or a crashing bug
- This is not a question about how to use Istio
Bug Description
- As you know there are annotations to control the pods memory and cpu requests and limits. We use them
- For the specific purpose of optionally setting up a prestop hook for the proxy, we also embed using the methodology discussed in https://istio.io/latest/docs/setup/additional-setup/sidecar-injection/#customizing-injection
{{- define "mesh-container" }}
{{- if .Values.mesh.enabled -}}
{{- if .Values.mesh.prestop.enabled -}}
- name: istio-proxy
image: auto
lifecycle:
preStop:
exec:
command: [ "{{ join "\",\"" .Values.mesh.prestop.commands }}" ]
{{- end }}
{{- end }}
{{- end }}
- That works great
- Except then we found effectively that memory and cpu annotations are ignored. My guess is the template takes precedence and sees no clause so just uses default values?
Version
istio 1.20.2
Additional Information
i have two concerns
- This isn’t very clear in the docs. There’s comments on the same page like: "Additionally, certain fields are configurable by annotations on the pod, although it is recommended to use the above approach to customizing settings. Additional care must be taken for certain annotations:
If sidecar.istio.io/proxyCPU is set, make sure to explicitly set sidecar.istio.io/proxyCPULimit. Otherwise the sidecar’s cpu limit will be set as unlimited. If sidecar.istio.io/proxyMemory is set, make sure to explicitly set sidecar.istio.io/proxyMemoryLimit. Otherwise the sidecar’s memory limit will be set as unlimited."
but it doesn’t mention they won’t even WORK in this case.
- creating a complete alternative template would be pretty hard to do and preserve function. In fact arguably it would be a deployment nightmare.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (6 by maintainers)
Commits related to this issue
- Add warning for injection customization See https://github.com/istio/istio/issues/51187#issuecomment-2515485416 — committed to howardjohn/istio.io by howardjohn 2 years ago
- Add warning for injection customization See https://github.com/istio/istio/issues/51187#issuecomment-2515485416 — committed to howardjohn/istio.io by howardjohn 2 years ago
- Add warning for injection customization (#16039) See https://github.com/istio/istio/issues/51187#issuecomment-2515485416 — committed to istio/istio.io by howardjohn 2 years ago
No, your template would look like
then when you want to use it, annotate on your pod
inject.istio.io/templates: "custom,sidecar"andsome-annotation/sleep-duration: 12s