Skip to content

Commit

Permalink
[stable/insights-agent] FWI-5698 Right-sizer rebrand (#1425)
Browse files Browse the repository at this point in the history
* modify right-sizer to include new right-sizer + oomkill-detection
  • Loading branch information
jslivka authored Mar 14, 2024
1 parent 422e940 commit 3810fc3
Show file tree
Hide file tree
Showing 18 changed files with 629 additions and 298 deletions.
18 changes: 18 additions & 0 deletions stable/insights-agent/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## 4.0.0
* `right-sizer` has been renamed to `oom-detection`, which is a component of the new Insights right-sizer. The `right-sizer` prior to this release will be referred to as `oom-detection` going forward. These binaries may be further consolidated in a future release to avoid confusion. Configuration for `right-sizer` in your `values.yaml` will now be under `right-sizer.oom-detection`. e.g.:

```yaml
# old
right-sizer:
enabled: true
schedule: "rand * * * *"
timeout: 300
# new
right-sizer:
enabled: true
oom-detection:
enabled: true
schedule: "rand * * * *"
timeout: 300
```
## 3.1.7
* Updated changelog
Expand Down
2 changes: 1 addition & 1 deletion stable/insights-agent/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
description: A Helm chart to run the Fairwinds Insights agent
name: insights-agent
version: 3.1.7
version: 4.0.0
appVersion: 9.2.1
kubeVersion: ">= 1.22.0-0"
icon: https://raw.githubusercontent.com/FairwindsOps/charts/master/stable/insights-agent/icon.png
Expand Down
3 changes: 3 additions & 0 deletions stable/insights-agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ Parameter | Description | Default

## Breaking Changes

### Version 4.0
The 4.0 release of insights-agent contains breaking changes to `right-sizer`. This component has been rebranded to refer to Insights automated right sizing. The `right-sizer` prior to this release will be referred to as `oom-detection` going forward. These will be further consolidated in a future release to avoid confusion.

### Version 2.0
The 2.0 release of insights-agent contains several breaking changes to help simplify the installation
and adoption of new tools.
Expand Down
14 changes: 14 additions & 0 deletions stable/insights-agent/ci/test-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,17 @@ installReporter:
additionalAnnotations:
"argocd.argoproj.io/hook": PostSync
"argocd.argoproj.io/hook-delete-policy": HookSucceeded

right-sizer:
enabled: true
oom-detection:
enabled: true
right-sizer-vpa:
admissionController:
enabled: false
metrics-server:
enabled: true
apiService:
insecureSkipTLSVerify: true
args:
- "--kubelet-insecure-tls"
5 changes: 5 additions & 0 deletions stable/insights-agent/requirements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ dependencies:
version: '1.17.0'
condition: falco.installFalco
alias: falcosecurity
- name: vpa
version: '4.4.5'
repository: https://charts.fairwinds.com/stable
condition: right-sizer.enabled
alias: right-sizer-vpa
1 change: 0 additions & 1 deletion stable/insights-agent/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,3 @@ Create chart name and version as used by the chart label.
{{- define "insights-agent.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

9 changes: 0 additions & 9 deletions stable/insights-agent/templates/right-sizer/agent-rbac.yaml

This file was deleted.

26 changes: 26 additions & 0 deletions stable/insights-agent/templates/right-sizer/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{- if (index .Values "right-sizer" "enabled") }}
{{- with (index .Values "right-sizer" "config") }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "insights-agent.fullname" $ }}-right-sizer
labels:
component: right-sizer
app: insights-agent
{{- if (index $.Values "right-sizer" "controller" "deployment" "annotations") }}
annotations:
{{- toYaml (index $.Values "right-sizer" "controller" "deployment" "annotations") | nindent 4 }}
{{- end }}
data:
config.yaml: |
{{- if kindIs "map" . }}
{{- range $key, $value := . }}
{{ $key }}:
{{- toYaml $value | nindent 6 }}
{{- end }}
{{- end }}
{{- if kindIs "string" . }}
{{- . | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{{- if and (index .Values "right-sizer" "controller" "rbac" "create") (index .Values "right-sizer" "enabled") }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "insights-agent.fullname" . }}-right-sizer-controller
{{- if (index .Values "right-sizer" "controller" "deployment" "annotations") }}
annotations:
{{- toYaml (index .Values "right-sizer" "controller" "deployment" "annotations") | nindent 4 }}
{{- end }}
labels:
component: right-sizer
app: insights-agent
rules:
- apiGroups:
- 'apps'
resources:
- '*'
verbs:
- 'get'
- 'list'
- 'watch'
- apiGroups:
- 'batch'
resources:
- 'cronjobs'
- 'jobs'
verbs:
- 'get'
- 'list'
- 'watch'
- apiGroups:
- ''
resources:
- 'namespaces'
- 'pods'
verbs:
- 'get'
- 'list'
- 'watch'
- apiGroups:
- 'autoscaling.k8s.io'
resources:
- 'verticalpodautoscalers'
verbs:
- 'get'
- 'list'
- 'create'
- 'delete'
- 'update'
{{- if (index .Values "right-sizer" "controller" "rbac" "enableArgoproj") }}
- apiGroups:
- 'argoproj.io'
resources:
- rollouts
verbs:
- 'get'
- 'list'
- 'watch'
{{- end }}
{{- if (index .Values "right-sizer" "controller" "rbac" "extraRules") -}}
{{ toYaml (index .Values "right-sizer" "controller" "rbac" "extraRules") | nindent 2 }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{{- if and (index .Values "right-sizer" "controller" "rbac" "create") (index .Values "right-sizer" "enabled") }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "insights-agent.fullname" . }}-right-sizer-controller
{{- if (index .Values "right-sizer" "controller" "deployment" "annotations") }}
annotations:
{{- toYaml (index .Values "right-sizer" "controller" "deployment" "annotations") | nindent 4 }}
{{- end }}
labels:
component: right-sizer
app: insights-agent
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "insights-agent.fullname" . }}-right-sizer-controller
subjects:
- kind: ServiceAccount
name: {{ include "insights-agent.fullname" . }}-right-sizer-controller
namespace: {{ .Release.Namespace }}

{{- range (index .Values "right-sizer" "controller" "rbac" "extraClusterRoleBindings" )}}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "insights-agent.fullname" $ }}-right-sizer-controller-{{ . }}
{{- if (index $.Values "right-sizer" "controller" "deployment" "annotations") }}
annotations:
{{- toYaml (index $.Values "right-sizer" "controller" "deployment" "annotations") | nindent 4 }}
{{- end }}
labels:
component: right-sizer
app: insights-agent
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ . }}
subjects:
- kind: ServiceAccount
name: {{ include "insights-agent.fullname" $ }}-right-sizer-controller
namespace: {{ $.Release.Namespace }}
{{- end }}
{{- end }}
124 changes: 74 additions & 50 deletions stable/insights-agent/templates/right-sizer/controller-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if (index .Values "right-sizer" "enabled") -}}
{{- if (index .Values "right-sizer" "enabled") }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -11,71 +11,95 @@ metadata:
component: right-sizer
app: insights-agent
spec:
replicas: 1
revisionHistoryLimit: {{ (index .Values "right-sizer" "controller" "revisionHistoryLimit") }}
selector:
matchLabels:
component: right-sizer
app: insights-agent
app.kubernetes.io/name: {{ include "insights-agent.fullname" . }}-right-sizer-controller
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: right-sizer
template:
metadata:
labels:
component: right-sizer
app: insights-agent
{{- if (index .Values "right-sizer" "workloadAnnotations") }}
app.kubernetes.io/name: {{ include "insights-agent.fullname" . }}-right-sizer-controller
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: right-sizer
{{- if (index .Values "right-sizer" "controller" "deployment" "additionalLabels") }}
{{ toYaml (index .Values "right-sizer" "controller" "deployment" "additionalLabels") | nindent 8 }}
{{- end }}
{{- with (index .Values "right-sizer" "controller" "deployment" "podAnnotations") }}
annotations:
{{- toYaml (index .Values "right-sizer" "workloadAnnotations") | nindent 8 }}
{{- toYaml . | nindent 8 }}
{{- with (index .Values "right-sizer" "config") }}
checksum/config: '{{ include (print $.Template.BasePath "/configmap.yaml") $ | sha256sum }}'
{{- end }}
{{- end }}
spec:
{{- with (index .Values "right-sizer" "imagePullSecrets") }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "insights-agent.fullname" . }}-right-sizer-controller
securityContext:
{{- toYaml (index .Values "right-sizer" "controller" "podSecurityContext") | nindent 8 }}
containers:
- name: {{ .Chart.Name }}-right-sizer-controller
ports:
- containerPort: 8080
env:
{{ include "proxy-env-spec" . | indent 12 | trim }}
securityContext:
{{- toYaml (index .Values "right-sizer" "containerSecurityContext") | nindent 12 }}
- name: {{ .Chart.Name }}
image: "{{ (index .Values "right-sizer" "image" "repository") }}:{{ (index .Values "right-sizer" "image" "tag") }}"
imagePullPolicy: {{ (index .Values "right-sizer" "image" "pullPolicy") }}
command:
- "right-sizer"
- "--state-configmap-namespace"
- "{{ .Release.Namespace }}"
- "--state-configmap-name"
- "{{ (index .Values "right-sizer" "stateconfigmapname") }}"
{{- range (index .Values "right-sizer" "namespaces") }}
- "--namespace"
- "{{ . }}"
- /insights-right-sizer
- controller
- -v{{ (index .Values "right-sizer" "controller" "logVerbosity") }}
{{- range $name, $value := (index .Values "right-sizer" "controller" "flags") }}
- --{{ $name }}={{ $value }}
{{- end }}
{{- with (index .Values "right-sizer" "config") }}
- --config
- /opt/app/config.yaml
{{- end }}
{{- if (index .Values "right-sizer" "controller" "securityContext") }}
securityContext:
{{- toYaml (index .Values "right-sizer" "controller" "securityContext") | nindent 12 }}
{{- end }}
resources:
{{- toYaml (index .Values "right-sizer" "controller" "resources") | nindent 12 }}
{{- if or (index .Values "right-sizer" "config") (index .Values "right-sizer" "controller" "deployment" "extraVolumeMounts") }}
volumeMounts:
{{- end }}
{{- if (index .Values "right-sizer" "updateMemoryLimits" "enabled") }}
- "--update-memory-limits"
- "--update-memory-limits-increment"
- "{{ (index .Values "right-sizer" "updateMemoryLimits" "increment") }}"
- "--update-memory-limits-max"
- "{{ (index .Values "right-sizer" "updateMemoryLimits" "max") }}"
- "--update-memory-limits-min-ooms"
- "{{ (index .Values "right-sizer" "updateMemoryLimits" "minOOMs") }}"
{{- range (index .Values "right-sizer" "updateMemoryLimits" "namespaces") }}
- "--update-memory-limits-namespace"
- "{{ . }}"
{{- with (index .Values "right-sizer" "config") }}
- name: config
mountPath: /opt/app/config.yaml
subPath: config.yaml
readOnly: true
{{- end }}
{{- end }}
- "--reset-ooms-window"
- "{{ (index .Values "right-sizer" "resetOOMsWindow") }}"
{{- range (index .Values "right-sizer" "extraArgs") }}
- "{{ . }}"
{{- if (index .Values "right-sizer" "controller" "deployment" "extraVolumeMounts") }}
{{ toYaml (index .Values "right-sizer" "controller" "deployment" "extraVolumeMounts") | nindent 12 }}
{{- end }}
readinessProbe:
httpGet:
path: /healthz
port: 8080
livenessProbe:
httpGet:
path: /healthz
port: 8080
resources:
{{- toYaml (index .Values "right-sizer" "resources") | nindent 12 }}
serviceAccountName: {{ (index .Values "right-sizer" "serviceAccountName") }}
{{- end -}}
{{- if or (index .Values "right-sizer" "config") (index .Values "right-sizer" "controller" "deployment" "extraVolumes") }}
volumes:
{{- if (index .Values "right-sizer" "controller" "deployment" "extraVolumes") }}
{{ toYaml (index .Values "right-sizer" "controller" "deployment" "extraVolumes") | indent 8}}
{{- end }}
{{- with (index .Values "right-sizer" "config") }}
- name: config
configMap:
name: {{ include "insights-agent.fullname" $ }}-right-sizer
{{- end }}
{{- end }}
{{- with (index .Values "right-sizer" "controller" "nodeSelector") }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with (index .Values "right-sizer" "controller" "affinity") }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with (index .Values "right-sizer" "controller" "tolerations") }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with (index .Values "right-sizer" "controller" "topologySpreadConstraints") }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
Loading

0 comments on commit 3810fc3

Please sign in to comment.