Add back support for proxy resource settings (#5517)

The last viz refactoring removed support for modifying the k8s resources
used by the proxies injected into the control plane components (values
like `tapProxyResources`, `prometheus.proxy.resources`, etc).

This adds them back, using a consistent naming: `tap.proxy.resources`,
`dashboard.proxy.resources`, etc.

Also fixes the tap helm template that was making reference to
`.Values.tapResources` instead of `.Values.tap.resources`.

Co-authored-by: Kevin Leimkuhler <kevin@kleimkuhler.com>
This commit is contained in:
Alejandro Pedraza 2021-01-12 10:56:43 -05:00 committed by GitHub
parent 836c077898
commit a9317af3d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 59 additions and 2 deletions

View File

@ -0,0 +1,18 @@
{{- define "partials.proxy.config.annotations" -}}
{{- with .cpu }}
{{- with .request -}}
config.linkerd.io/proxy-cpu-request: {{. | quote}}
{{end}}
{{- with .limit -}}
config.linkerd.io/proxy-cpu-limit: {{. | quote}}
{{- end}}
{{- end}}
{{- with .memory }}
{{- with .request }}
config.linkerd.io/proxy-memory-request: {{. | quote}}
{{end}}
{{- with .limit -}}
config.linkerd.io/proxy-memory-limit: {{. | quote}}
{{- end}}
{{- end }}
{{- end }}

View File

@ -22,6 +22,7 @@ var (
L5dPartials = []string{
"charts/partials/" + chartutil.ChartfileName,
"charts/partials/templates/_proxy.tpl",
"charts/partials/templates/_proxy-config-ann.tpl",
"charts/partials/templates/_proxy-init.tpl",
"charts/partials/templates/_volumes.tpl",
"charts/partials/templates/_resources.tpl",

View File

@ -79,6 +79,7 @@ Kubernetes: `>=1.13.0-0`
| dashboard.image.registry | string | `"ghcr.io/linkerd"` | Docker registry for the web instance |
| dashboard.image.tag | string | `"linkerdVersionValue"` | Docker image tag for the web instance |
| dashboard.logLevel | string | `"info"` | log level of the dashboard component |
| dashboard.proxy | string | `nil` | |
| dashboard.replicas | int | `1` | Number of replicas of dashboard |
| dashboard.resources.cpu.limit | string | `nil` | Maximum amount of CPU units that the web container can use |
| dashboard.resources.cpu.request | string | `nil` | Amount of CPU units that the web container requests |
@ -93,6 +94,7 @@ Kubernetes: `>=1.13.0-0`
| grafana.image.name | string | `"grafana"` | Docker image name for the grafana instance |
| grafana.image.registry | string | `"ghcr.io/linkerd"` | Docker registry for the grafana instance |
| grafana.image.tag | string | `"linkerdVersionValue"` | Docker image tag for the grafana instance |
| grafana.proxy | string | `nil` | |
| grafana.resources.cpu.limit | string | `nil` | Maximum amount of CPU units that the grafana container can use |
| grafana.resources.cpu.request | string | `nil` | Amount of CPU units that the grafana container requests |
| grafana.resources.memory.limit | string | `nil` | Maximum amount of memory that grafana container can use |
@ -113,6 +115,7 @@ Kubernetes: `>=1.13.0-0`
| prometheus.image.pullPolicy | string | `"Always"` | |
| prometheus.image.registry | string | `"prom"` | Docker registry for the prometheus instance |
| prometheus.image.tag | string | `"v2.19.3"` | Docker image tag for the prometheus instance |
| prometheus.proxy | string | `nil` | |
| prometheus.remoteWrite | string | `nil` | Allows transparently sending samples to an endpoint. Mostly used for long term storage. |
| prometheus.resources.cpu.limit | string | `nil` | Maximum amount of CPU units that the prometheus container can use |
| prometheus.resources.cpu.request | string | `nil` | Amount of CPU units that the prometheus container requests |
@ -131,6 +134,7 @@ Kubernetes: `>=1.13.0-0`
| tap.image.tag | string | `"linkerdVersionValue"` | Docker image tag for the tap instance |
| tap.keyPEM | string | `""` | Certificate key for Tap component. If not provided then Helm will generate one. |
| tap.logLevel | string | `"info"` | log level of the tap component |
| tap.proxy | string | `nil` | |
| tap.replicas | int | `1` | |
| tap.resources.cpu.limit | string | `nil` | Maximum amount of CPU units that the tap container can use |
| tap.resources.cpu.request | string | `nil` | Amount of CPU units that the tap container requests |

View File

@ -108,6 +108,9 @@ spec:
metadata:
annotations:
{{.Values.createdByAnnotation}}: {{default (printf "linkerd/helm %s" .Values.linkerdVersion) .Values.cliVersion}}
{{- with .Values.grafana.proxy }}
{{- include "partials.proxy.config.annotations" .resources | nindent 8 }}
{{- end }}
{{- with .Values.podAnnotations }}{{ toYaml . | trim | nindent 8 }}{{- end }}
labels:
{{.Values.extensionAnnotation}}: linkerd-viz

View File

@ -221,6 +221,9 @@ spec:
metadata:
annotations:
{{.Values.createdByAnnotation}}: {{default (printf "linkerd/helm %s" .Values.linkerdVersion) .Values.cliVersion}}
{{- with .Values.prometheus.proxy }}
{{- include "partials.proxy.config.annotations" .resources | nindent 8 }}
{{- end }}
{{- with .Values.podAnnotations }}{{ . | trim | nindent 8 }}{{- end }}
labels:
{{.Values.extensionAnnotation}}: linkerd-viz

View File

@ -60,6 +60,9 @@ spec:
checksum/config: {{ include (print $.Template.BasePath "/tap-rbac.yaml") . | sha256sum }}
{{- end }}
{{.Values.createdByAnnotation}}: {{default (printf "linkerd/helm %s" .Values.linkerdVersion) .Values.cliVersion}}
{{- with .Values.tap.proxy }}
{{- include "partials.proxy.config.annotations" .resources | nindent 8 }}
{{- end }}
{{- with .Values.podAnnotations }}{{ toYaml . | trim | nindent 8 }}{{- end }}
labels:
{{.Values.extensionAnnotation}}: linkerd-viz
@ -101,8 +104,8 @@ spec:
httpGet:
path: /ready
port: 9998
{{- if .Values.tapResources -}}
{{- include "partials.resources" .Values.tapResources | nindent 8 }}
{{- if .Values.tap.resources -}}
{{- include "partials.resources" .Values.tap.resources | nindent 8 }}
{{- end }}
securityContext:
runAsUser: {{.Values.tap.UID}}

View File

@ -52,6 +52,9 @@ spec:
metadata:
annotations:
{{.Values.createdByAnnotation}}: {{default (printf "linkerd/helm %s" .Values.linkerdVersion) .Values.cliVersion}}
{{- with .Values.dashboard.proxy }}
{{- include "partials.proxy.config.annotations" .resources | nindent 8 }}
{{- end }}
{{- with .Values.podAnnotations }}{{ toYaml . | trim | nindent 8 }}{{- end }}
labels:
{{.Values.extensionAnnotation}}: linkerd-viz

View File

@ -99,6 +99,11 @@ tap:
# -- Amount of memory that the tap container requests
request:
proxy:
# -- If set, overrides default proxy resources for the proxy injected
# into the tap component
# resources:
UID: *uid
# web dashboard configuration
@ -137,6 +142,11 @@ dashboard:
# -- Amount of memory that the web container requests
request:
proxy:
# -- If set, overrides default proxy resources for the proxy injected
# into the dashboard component
# resources:
grafana:
# -- toggle field to enable or disable grafana
enabled: true
@ -160,6 +170,11 @@ grafana:
# -- Amount of memory that the grafana container requests
request:
proxy:
# -- If set, overrides default proxy resources for the proxy injected
# into the grafana component
# resources:
prometheus:
# -- toggle field to enable or disable prometheus
enabled: true
@ -279,3 +294,8 @@ prometheus:
limit:
# -- Amount of memory that the prometheus container requests
request:
proxy:
# -- If set, overrides default proxy resources for the proxy injected
# into the prometheus component
# resources:

View File

@ -828,6 +828,7 @@ spec:
httpGet:
path: /ready
port: 9998
resources:
securityContext:
runAsUser: 2103
volumeMounts:

View File

@ -536,6 +536,7 @@ spec:
httpGet:
path: /ready
port: 9998
resources:
securityContext:
runAsUser: 2103
volumeMounts: