Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(helm chart): Make env vars configurable and auto configure go runtime #1412

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions charts/metrics-server/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@

## [UNRELEASED]

### Added

- Extra environment variables configuration support.
- Automatic container Go runtime (GOMAXPROCS, GOMEMLIMIT) configuration based on assigned resources, with opt-out support. ([#1412](https://github.com/kubernetes-sigs/metrics-server/pull/1412)) [@sslavic](https://github.com/sslavic)

## [3.12.0] - TBC

### Changed
Expand Down
3 changes: 3 additions & 0 deletions charts/metrics-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ The following table lists the configurable parameters of the _Metrics Server_ ch
| `podDisruptionBudget.maxUnavailable` | Set the `PodDisruptionBudget` maximum unavailable pods. | `nil` |
| `defaultArgs` | Default arguments to pass to the _metrics-server_ command. | See _values.yaml_ |
| `args` | Additional arguments to pass to the _metrics-server_ command. | `[]` |
| `setAutoGoEnvVars` | Whether to automatically set GOMAXPROCS and GOMEMLIMIT env vars for all the containers. | `true` |
| `extraEnvVars` | Additional environment variables to pass to the _metrics-server_ container. | `[]` |
| `livenessProbe` | Liveness probe. | See _values.yaml_ |
| `readinessProbe` | Readiness probe. | See _values.yaml_ |
| `service.type` | Service type. | `ClusterIP` |
Expand All @@ -64,6 +66,7 @@ The following table lists the configurable parameters of the _Metrics Server_ ch
| `addonResizer.securityContext` | Security context for the _metrics_server_container. | _See values.yaml |
| `addonResizer.image.repository` | addon-resizer image repository | `registry.k8s.io/autoscaling/addon-resizer` |
| `addonResizer.image.tag` | addon-resizer image tag | `1.8.19` |
| `addonResizer.extraEnvVars` | Additional environment variables to pass to the _addon-resizer_ container. | `[]` |
| `addonResizer.resources` | Resource requests and limits for the _nanny_ container. | `{ requests: { cpu: 40m, memory: 25Mi }, limits: { cpu: 40m, memory: 25Mi } }` |
| `addonResizer.nanny.cpu` | The base CPU requirement. | `0m` |
| `addonResizer.nanny.extraCPU` | The amount of CPU to add per node. | `1m` |
Expand Down
27 changes: 27 additions & 0 deletions charts/metrics-server/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@ spec:
{{- range .Values.args }}
- {{ . }}
{{- end }}
env:
{{- if .Values.setAutoGoEnvVars }}
- name: GOMAXPROCS
valueFrom:
resourceFieldRef:
resource: requests.cpu
- name: GOMEMLIMIT
valueFrom:
resourceFieldRef:
resource: limits.memory
{{- end }}
{{- with .Values.extraEnvVars }}
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- name: https
protocol: TCP
Expand Down Expand Up @@ -110,6 +124,19 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- if .Values.setAutoGoEnvVars }}
- name: GOMAXPROCS
valueFrom:
resourceFieldRef:
resource: requests.cpu
- name: GOMEMLIMIT
valueFrom:
resourceFieldRef:
resource: limits.memory
{{- end }}
{{- with .Values.addonResizer.extraEnvVars }}
{{- toYaml . | nindent 12 }}
{{- end }}
command:
- /pod_nanny
- --config-dir=/etc/config
Expand Down
7 changes: 7 additions & 0 deletions charts/metrics-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ defaultArgs:

args: []

# Specifies whether to automatically set GOMAXPROCS and GOMEMLIMIT environment
# variables for all containers relative to the assigned resources.
setAutoGoEnvVars: true

extraEnvVars: []

livenessProbe:
httpGet:
path: /livez
Expand Down Expand Up @@ -130,6 +136,7 @@ addonResizer:
image:
repository: registry.k8s.io/autoscaling/addon-resizer
tag: 1.8.20
extraEnvVars: []
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
Expand Down
Loading