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

add vertical pod autoscaler #44

Merged
merged 3 commits into from
Sep 2, 2024
Merged
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Add VPA and default resource requests and limits (https://github.com/giantswarm/roadmap/issues/358)

### Fixed

- Ensure alloy can access root filesystem in read mode only.
Expand Down
2 changes: 1 addition & 1 deletion helm/alloy/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
annotations:
application.giantswarm.io/team: atlas
apiVersion: v2
appVersion: v1.3.0
appVersion: v1.3.1
dependencies:
- name: alloy
version: 0.7.0
Expand Down
42 changes: 42 additions & 0 deletions helm/alloy/templates/vertical-pod-autoscaler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
### Upstream work being tracked at https://github.com/grafana/alloy/pull/1305
{{ if .Capabilities.APIVersions.Has "autoscaling.k8s.io/v1" -}}
QuantumEnigmaa marked this conversation as resolved.
Show resolved Hide resolved
{{- if and .Values.verticalPodAutoscaler.enabled -}}
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: {{ include "alloy.fullname" . }}
labels:
{{- include "alloy.labels" . | nindent 4 }}
app.kubernetes.io/component: availability
spec:
{{- with .Values.verticalPodAutoscaler.vertical }}
{{- with .recommenders }}
recommenders:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .resourcePolicy }}
resourcePolicy:
{{- with .containerPolicies }}
containerPolicies:
{{- range . }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
{{- with .updatePolicy }}
updatePolicy:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
targetRef:
apiVersion: apps/v1
{{- if eq .Values.alloy.controller.type "deployment" }}
kind: Deployment
{{- else if eq .Values.alloy.controller.type "statefulset" }}
kind: StatefulSet
{{- else }}
kind: DaemonSet
{{- end }}
name: {{ include "alloy.fullname" . }}
{{- end }}
{{- end }}
52 changes: 50 additions & 2 deletions helm/alloy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,24 @@ alloy:
# Disable reporting to GrafanaLabs
- --disable-reporting

extraSecretEnv: []

mounts:
# -- Extra volume mounts to add into the Grafana Alloy container.
extra:
# This is needed to allow alloy to create files when using readOnlyRootFilesystem
- name: alloy-tmp
mountPath: /tmp/alloy

# -- Resource requests and limits to apply to the Grafana Alloy container.
resources:
limits:
cpu: "1"
memory: 256Mi
requests:
cpu: 25m
memory: 128Mi

securityContext:
allowPrivilegeEscalation: false
capabilities:
Expand All @@ -42,8 +54,6 @@ alloy:
seccompProfile:
type: RuntimeDefault

extraSecretEnv: []

image:
repository: giantswarm/alloy

Expand Down Expand Up @@ -71,3 +81,41 @@ alloy:

serviceMonitor:
enabled: true

verticalPodAutoscaler:
# -- Creates a VerticalPodAutoscaler for the daemonset
enabled: false

# -- List of recommenders to use for the Vertical Pod Autoscaler.
# Recommenders are responsible for generating recommendation for the object.
# List should be empty (then the default recommender will generate the recommendation)
# or contain exactly one recommender.
recommenders: []
# - name: custom-recommender-performance

# -- Configures the resource policy for the Vertical Pod Autoscaler.
resourcePolicy:
# -- Configures the container policies for the Vertical Pod Autoscaler.
containerPolicies:
- containerName: alloy
# -- The controlled resources for the Vertical Pod Autoscaler.
controlledResources:
- memory
# -- The controlled values for the Vertical Pod Autoscaler. Needs to be either RequestsOnly or RequestsAndLimits.
controlledValues: "RequestsAndLimits"
# -- The maximum allowed values for the pods.
maxAllowed: {}
# cpu: 200m
# memory: 100Mi
# -- Defines the min allowed resources for the pod
minAllowed: {}
# cpu: 200m
# memory: 100Mi

# -- Configures the update policy for the Vertical Pod Autoscaler.
updatePolicy:
# -- Specifies minimal number of replicas which need to be alive for VPA Updater to attempt pod eviction
# minReplicas: 1
# -- Specifies whether recommended updates are applied when a Pod is started and whether recommended updates
# are applied during the life of a Pod. Possible values are "Off", "Initial", "Recreate", and "Auto".
# updateMode: Auto