From ca10c3f031eabada2e5bd44c052ddc9b519a63c6 Mon Sep 17 00:00:00 2001 From: Nicolas Lamirault Date: Thu, 5 Sep 2024 18:11:29 +0200 Subject: [PATCH] feat(vpa): init component (#5678) Signed-off-by: Nicolas Lamirault --- .../apps/system/values-k3s-homelab.yaml | 3 + .../.argocd-allow-concurrency | 0 .../vertical-pod-autoscaler/Chart.yaml | 26 ++++ .../vertical-pod-autoscaler/README.md | 23 ++++ .../values-k3s-homelab.yaml | 50 +++++++ .../vertical-pod-autoscaler/values.yaml | 43 ++++++ .../kube-prometheus-stack/values.yaml | 128 ++++++++++++++++++ 7 files changed, 273 insertions(+) create mode 100644 gitops/argocd/charts/kube-system/vertical-pod-autoscaler/.argocd-allow-concurrency create mode 100644 gitops/argocd/charts/kube-system/vertical-pod-autoscaler/Chart.yaml create mode 100644 gitops/argocd/charts/kube-system/vertical-pod-autoscaler/README.md create mode 100644 gitops/argocd/charts/kube-system/vertical-pod-autoscaler/values-k3s-homelab.yaml create mode 100644 gitops/argocd/charts/kube-system/vertical-pod-autoscaler/values.yaml diff --git a/gitops/argocd/apps/system/values-k3s-homelab.yaml b/gitops/argocd/apps/system/values-k3s-homelab.yaml index 284cc652c8..f47372a826 100644 --- a/gitops/argocd/apps/system/values-k3s-homelab.yaml +++ b/gitops/argocd/apps/system/values-k3s-homelab.yaml @@ -48,6 +48,9 @@ argocd-apps: - appName: node-problem-detector namespace: kube-system targetRevision: HEAD + - appName: vertical-pod-autoscaler + namespace: kube-system + targetRevision: HEAD - appName: meilisearch namespace: search targetRevision: HEAD diff --git a/gitops/argocd/charts/kube-system/vertical-pod-autoscaler/.argocd-allow-concurrency b/gitops/argocd/charts/kube-system/vertical-pod-autoscaler/.argocd-allow-concurrency new file mode 100644 index 0000000000..e69de29bb2 diff --git a/gitops/argocd/charts/kube-system/vertical-pod-autoscaler/Chart.yaml b/gitops/argocd/charts/kube-system/vertical-pod-autoscaler/Chart.yaml new file mode 100644 index 0000000000..653dae6af7 --- /dev/null +++ b/gitops/argocd/charts/kube-system/vertical-pod-autoscaler/Chart.yaml @@ -0,0 +1,26 @@ +--- +# Copyright (C) Nicolas Lamirault +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: v2 +type: application +name: vertical-pod-autoscaler +version: 1.0.0 +appVersion: 1.0.0 +dependencies: +- name: vertical-pod-autoscaler + repository: https://cowboysysop.github.io/charts + version: 9.9.0 diff --git a/gitops/argocd/charts/kube-system/vertical-pod-autoscaler/README.md b/gitops/argocd/charts/kube-system/vertical-pod-autoscaler/README.md new file mode 100644 index 0000000000..00deba3b3f --- /dev/null +++ b/gitops/argocd/charts/kube-system/vertical-pod-autoscaler/README.md @@ -0,0 +1,23 @@ +# cluster-autoscaler + +![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 9.10.8](https://img.shields.io/badge/AppVersion-9.10.8-informational?style=flat-square) + +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| https://kubernetes.github.io/autoscaler | cluster-autoscaler | 9.19.3 | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| cluster-autoscaler.prometheusRule.additionalLabels."prometheus.io/operator" | string | `"portefaix"` | | +| cluster-autoscaler.prometheusRule.enabled | bool | `true` | | +| cluster-autoscaler.prometheusRule.namespace | string | `"monitoring"` | | +| cluster-autoscaler.serviceMonitor.enabled | bool | `true` | | +| cluster-autoscaler.serviceMonitor.namespace | string | `"monitoring"` | | +| cluster-autoscaler.serviceMonitor.selector."prometheus.io/operator" | string | `"portefaix"` | | + +---------------------------------------------- +Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0) diff --git a/gitops/argocd/charts/kube-system/vertical-pod-autoscaler/values-k3s-homelab.yaml b/gitops/argocd/charts/kube-system/vertical-pod-autoscaler/values-k3s-homelab.yaml new file mode 100644 index 0000000000..bbe473aed5 --- /dev/null +++ b/gitops/argocd/charts/kube-system/vertical-pod-autoscaler/values-k3s-homelab.yaml @@ -0,0 +1,50 @@ +--- +# Copyright (C) Nicolas Lamirault +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +vertical-pod-autoscaler: + commonLabels: + portefaix.xyz/version: v0.54.0 + + admissionController: + replicaCount: 1 + resources: + limits: + # cpu: 200m + memory: 512Mi + requests: + cpu: 20m + memory: 100Mi + + recommender: + replicaCount: 1 + resources: + limits: + # cpu: 200m + memory: 512Mi + requests: + cpu: 20m + memory: 100Mi + + updater: + replicaCount: 1 + resources: + limits: + # cpu: 200m + memory: 512Mi + requests: + cpu: 20m + memory: 100Mi \ No newline at end of file diff --git a/gitops/argocd/charts/kube-system/vertical-pod-autoscaler/values.yaml b/gitops/argocd/charts/kube-system/vertical-pod-autoscaler/values.yaml new file mode 100644 index 0000000000..236f0d5487 --- /dev/null +++ b/gitops/argocd/charts/kube-system/vertical-pod-autoscaler/values.yaml @@ -0,0 +1,43 @@ +--- +# Copyright (C) Nicolas Lamirault +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +vertical-pod-autoscaler: + commonLabels: + portefaix.xyz/version: v0.54.0 + + admissionController: + enabled: false + metrics: + serviceMonitor: + enabled: true + labels: + prometheus.io/operator: portefaix + + recommender: + metrics: + serviceMonitor: + enabled: true + labels: + prometheus.io/operator: portefaix + + updater: + enabled: false + metrics: + serviceMonitor: + enabled: true + labels: + prometheus.io/operator: portefaix \ No newline at end of file diff --git a/gitops/argocd/charts/monitoring/kube-prometheus-stack/values.yaml b/gitops/argocd/charts/monitoring/kube-prometheus-stack/values.yaml index d9d1be87a9..4cb9fecd0a 100644 --- a/gitops/argocd/charts/monitoring/kube-prometheus-stack/values.yaml +++ b/gitops/argocd/charts/monitoring/kube-prometheus-stack/values.yaml @@ -301,6 +301,134 @@ kube-prometheus-stack: enabled: true additionalLabels: prometheus.io/operator: portefaix + rbac: + extraRules: + - apiGroups: ["autoscaling.k8s.io"] + resources: ["verticalpodautoscalers"] + verbs: ["list", "watch"] + customResourceState: + enabled: true + config: + kind: CustomResourceStateMetrics + spec: + resources: + - groupVersionKind: + group: autoscaling.k8s.io + kind: "VerticalPodAutoscaler" + version: "v1" + labelsFromPath: + verticalpodautoscaler: [metadata, name] + namespace: [metadata, namespace] + target_api_version: [spec, targetRef, apiVersion] + target_kind: [spec, targetRef, kind] + target_name: [spec, targetRef, name] + metrics: + # Labels + - name: "verticalpodautoscaler_labels" + help: "VPA container recommendations. Kubernetes labels converted to Prometheus labels" + each: + type: Info + info: + labelsFromPath: + name: [metadata, name] + # Memory Information + - name: "verticalpodautoscaler_status_recommendation_containerrecommendations_target" + help: "VPA container recommendations for memory. Target resources the VerticalPodAutoscaler recommends for the container." + each: + type: Gauge + gauge: + path: [status, recommendation, containerRecommendations] + valueFrom: [target, memory] + labelsFromPath: + container: [containerName] + commonLabels: + resource: "memory" + unit: "byte" + - name: "verticalpodautoscaler_status_recommendation_containerrecommendations_lowerbound" + help: "VPA container recommendations for memory. Minimum resources the container can use before the VerticalPodAutoscaler updater evicts it" + each: + type: Gauge + gauge: + path: [status, recommendation, containerRecommendations] + valueFrom: [lowerBound, memory] + labelsFromPath: + container: [containerName] + commonLabels: + resource: "memory" + unit: "byte" + - name: "verticalpodautoscaler_status_recommendation_containerrecommendations_upperbound" + help: "VPA container recommendations for memory. Maximum resources the container can use before the VerticalPodAutoscaler updater evicts it" + each: + type: Gauge + gauge: + path: [status, recommendation, containerRecommendations] + valueFrom: [upperBound, memory] + labelsFromPath: + container: [containerName] + commonLabels: + resource: "memory" + unit: "byte" + - name: "verticalpodautoscaler_status_recommendation_containerrecommendations_uncappedtarget" + help: "VPA container recommendations for memory. Target resources the VerticalPodAutoscaler recommends for the container ignoring bounds" + each: + type: Gauge + gauge: + path: [status, recommendation, containerRecommendations] + valueFrom: [uncappedTarget, memory] + labelsFromPath: + container: [containerName] + commonLabels: + resource: "memory" + unit: "byte" + # CPU Information + - name: "verticalpodautoscaler_status_recommendation_containerrecommendations_target" + help: "VPA container recommendations for cpu. Target resources the VerticalPodAutoscaler recommends for the container." + each: + type: Gauge + gauge: + path: [status, recommendation, containerRecommendations] + valueFrom: [target, cpu] + labelsFromPath: + container: [containerName] + commonLabels: + resource: "cpu" + unit: "core" + - name: "verticalpodautoscaler_status_recommendation_containerrecommendations_lowerbound" + help: "VPA container recommendations for cpu. Minimum resources the container can use before the VerticalPodAutoscaler updater evicts it" + each: + type: Gauge + gauge: + path: [status, recommendation, containerRecommendations] + valueFrom: [lowerBound, cpu] + labelsFromPath: + container: [containerName] + commonLabels: + resource: "cpu" + unit: "core" + - name: "verticalpodautoscaler_status_recommendation_containerrecommendations_upperbound" + help: "VPA container recommendations for cpu. Maximum resources the container can use before the VerticalPodAutoscaler updater evicts it" + each: + type: Gauge + gauge: + path: [status, recommendation, containerRecommendations] + valueFrom: [upperBound, cpu] + labelsFromPath: + container: [containerName] + commonLabels: + resource: "cpu" + unit: "core" + - name: "verticalpodautoscaler_status_recommendation_containerrecommendations_uncappedtarget" + help: "VPA container recommendations for cpu. Target resources the VerticalPodAutoscaler recommends for the container ignoring bounds" + each: + type: Gauge + gauge: + path: [status, recommendation, containerRecommendations] + valueFrom: [uncappedTarget, cpu] + labelsFromPath: + container: [containerName] + commonLabels: + resource: "cpu" + unit: "core" nodeExporter: enabled: true