From 00bb542054d0deacd539887b184d9fdc74f3d271 Mon Sep 17 00:00:00 2001 From: elliotxx <951376975@qq.com> Date: Tue, 23 Jul 2024 21:49:14 +0800 Subject: [PATCH] feat: support custom replicas and resources in karpor chart --- charts/karpor/Chart.yaml | 2 +- charts/karpor/README.md | 14 ++++- charts/karpor/templates/elasticsearch.yml | 11 +--- charts/karpor/templates/etcd.yml | 4 +- charts/karpor/templates/karpor-server.yml | 4 +- charts/karpor/templates/karpor-syncer.yml | 4 +- charts/karpor/values.yaml | 67 ++++++++++++++++++++--- 7 files changed, 81 insertions(+), 25 deletions(-) diff --git a/charts/karpor/Chart.yaml b/charts/karpor/Chart.yaml index 82ed766..6dbc599 100644 --- a/charts/karpor/Chart.yaml +++ b/charts/karpor/Chart.yaml @@ -3,7 +3,7 @@ apiVersion: v2 name: karpor # The Chart Version -version: 0.5.1 +version: 0.5.2 type: application # The Application Version in the Chart appVersion: 0.4.2 diff --git a/charts/karpor/README.md b/charts/karpor/README.md index d8a1984..5e2f529 100644 --- a/charts/karpor/README.md +++ b/charts/karpor/README.md @@ -1,6 +1,6 @@ # Karpor Chart -![Version: 0.5.1](https://img.shields.io/badge/Version-0.5.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.4.2](https://img.shields.io/badge/AppVersion-0.4.2-informational?style=flat-square) +![Version: 0.5.2](https://img.shields.io/badge/Version-0.5.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.4.2](https://img.shields.io/badge/AppVersion-0.4.2-informational?style=flat-square) A Helm chart for Karpor, a modern kubernetes visualization tool. @@ -65,8 +65,10 @@ The Karpor Server Component is main backend server. It itself is an `apiserver`, |-----|------|---------|-------------| | server.image.repo | string | `"kusionstack/karpor"` | Repository for Karpor server image. | | server.image.tag | string | `""` | Tag for Karpor server image. Defaults to the chart's appVersion if not specified. | -| server.name | string | `"karpor-server"` | Component name for Karpor server. | -| server.port | int | `7443` | Port for Karpor server. | +| server.name | string | `"karpor-server"` | Component name for karpor server. | +| server.port | int | `7443` | Port for karpor server. | +| server.replicas | int | `1` | The number of karpor server pods to run. | +| server.resources | object | `{"limits":{"cpu":"500m","ephemeral-storage":"10Gi","memory":"1Gi"},"requests":{"cpu":"250m","ephemeral-storage":"2Gi","memory":"256Mi"}}` | Resource limits and requests for the karpor server pods. | ### Karpor Syncer @@ -78,6 +80,8 @@ The Karpor Syncer Component is independent server to synchronize cluster resourc | syncer.image.tag | string | `""` | Tag for Karpor syncer image. Defaults to the chart's appVersion if not specified. | | syncer.name | string | `"karpor-syncer"` | Component name for Karpor syncer. | | syncer.port | int | `7443` | Port for Karpor syncer. | +| syncer.replicas | int | `1` | The number of karpor syncer pods to run. | +| syncer.resources | object | `{"limits":{"cpu":"500m","ephemeral-storage":"10Gi","memory":"1Gi"},"requests":{"cpu":"250m","ephemeral-storage":"2Gi","memory":"256Mi"}}` | Resource limits and requests for the karpor syncer pods. | ### ElasticSearch @@ -89,6 +93,8 @@ The ElasticSearch Component to store the synchronized resources and user data. | elasticsearch.image.tag | string | `"8.6.2"` | Specific tag for ElasticSearch image. | | elasticsearch.name | string | `"elasticsearch"` | Component name for ElasticSearch. | | elasticsearch.port | int | `9200` | Port for ElasticSearch. | +| elasticsearch.replicas | int | `1` | The number of ElasticSearch pods to run. | +| elasticsearch.resources | object | `{"limits":{"cpu":"2","ephemeral-storage":"10Gi","memory":"4Gi"},"requests":{"cpu":"2","ephemeral-storage":"10Gi","memory":"4Gi"}}` | Resource limits and requests for the karpor elasticsearch pods. | ### ETCD @@ -100,6 +106,8 @@ The ETCD Component is the storage of Karpor Server as `apiserver`. | etcd.image.tag | string | `"v3.5.11"` | Specific tag for ETCD image. | | etcd.name | string | `"etcd"` | Component name for ETCD. | | etcd.port | int | `2379` | Port for ETCD. | +| etcd.replicas | int | `1` | The number of etcd pods to run. | +| etcd.resources | object | `{"limits":{"cpu":"500m","ephemeral-storage":"10Gi","memory":"1Gi"},"requests":{"cpu":"250m","ephemeral-storage":"2Gi","memory":"256Mi"}}` | Resource limits and requests for the karpor etcd pods. | ### Job diff --git a/charts/karpor/templates/elasticsearch.yml b/charts/karpor/templates/elasticsearch.yml index 90dbab6..a4211dd 100644 --- a/charts/karpor/templates/elasticsearch.yml +++ b/charts/karpor/templates/elasticsearch.yml @@ -17,7 +17,7 @@ metadata: name: elasticsearch namespace: {{ .Values.namespace }} spec: - replicas: 1 + replicas: {{ .Values.elasticsearch.replicas }} selector: matchLabels: {{- include "karpor.selectorLabels" (dict "context" . "component" .Values.elasticsearch.name) | nindent 6 }} @@ -49,14 +49,7 @@ spec: - containerPort: {{ .Values.elasticsearch.port }} protocol: TCP resources: - limits: - cpu: "2" - memory: 4Gi - ephemeral-storage: 10Gi - requests: - cpu: "2" - memory: 4Gi - ephemeral-storage: 10Gi + {{- toYaml .Values.elasticsearch.resources | nindent 12 }} volumeMounts: - mountPath: /usr/share/elasticsearch/data name: data diff --git a/charts/karpor/templates/etcd.yml b/charts/karpor/templates/etcd.yml index c35139b..9ce7423 100644 --- a/charts/karpor/templates/etcd.yml +++ b/charts/karpor/templates/etcd.yml @@ -18,7 +18,7 @@ metadata: {{- include "karpor.labels" (dict "context" . "component" .Values.etcd.name) | nindent 4 }} spec: serviceName: etcd - replicas: 1 + replicas: {{ .Values.etcd.replicas }} selector: matchLabels: {{- include "karpor.selectorLabels" (dict "context" . "component" .Values.etcd.name) | nindent 6 }} @@ -43,6 +43,8 @@ spec: volumeMounts: - name: data mountPath: /etcd-data + resources: + {{- toYaml .Values.etcd.resources | nindent 12 }} volumeClaimTemplates: - metadata: name: data diff --git a/charts/karpor/templates/karpor-server.yml b/charts/karpor/templates/karpor-server.yml index 197ddad..e253e3f 100644 --- a/charts/karpor/templates/karpor-server.yml +++ b/charts/karpor/templates/karpor-server.yml @@ -17,7 +17,7 @@ metadata: name: karpor-server namespace: {{ .Values.namespace }} spec: - replicas: 1 + replicas: {{ .Values.server.replicas }} selector: matchLabels: {{- include "karpor.selectorLabels" (dict "context" . "component" .Values.server.name) | nindent 6 }} @@ -43,6 +43,8 @@ spec: volumeMounts: - mountPath: /etc/karpor/ name: karpor-secret + resources: + {{- toYaml .Values.server.resources | nindent 12 }} volumes: - name: karpor-secret secret: diff --git a/charts/karpor/templates/karpor-syncer.yml b/charts/karpor/templates/karpor-syncer.yml index d39f421..f4648d2 100644 --- a/charts/karpor/templates/karpor-syncer.yml +++ b/charts/karpor/templates/karpor-syncer.yml @@ -6,7 +6,7 @@ metadata: name: karpor-syncer namespace: {{ .Values.namespace }} spec: - replicas: 1 + replicas: {{ .Values.syncer.replicas }} selector: matchLabels: {{- include "karpor.selectorLabels" (dict "context" . "component" .Values.syncer.name) | nindent 6 }} @@ -32,6 +32,8 @@ spec: volumeMounts: - mountPath: /etc/karpor/ name: karpor-kubeconfig + resources: + {{- toYaml .Values.syncer.resources | nindent 12 }} volumes: - name: karpor-kubeconfig configMap: diff --git a/charts/karpor/values.yaml b/charts/karpor/values.yaml index d5c8f01..816c9c7 100644 --- a/charts/karpor/values.yaml +++ b/charts/karpor/values.yaml @@ -17,51 +17,100 @@ global: # Configuration for Karpor server server: - # -- Component name for Karpor server. + # -- Component name for karpor server. name: karpor-server + # -- The number of karpor server pods to run. + replicas: 1 + # -- Port for karpor server. + port: 7443 image: # -- Repository for Karpor server image. repo: kusionstack/karpor # -- Tag for Karpor server image. Defaults to the chart's appVersion if not specified. tag: "" - # -- Port for Karpor server. - port: 7443 + # -- Resource limits and requests for the karpor server pods. + resources: + requests: + cpu: 250m + memory: 256Mi + ephemeral-storage: 2Gi + limits: + cpu: 500m + memory: 1Gi + ephemeral-storage: 10Gi + # Configuration for Karpor syncer syncer: # -- Component name for Karpor syncer. name: karpor-syncer + # -- The number of karpor syncer pods to run. + replicas: 1 + # -- Port for Karpor syncer. + port: 7443 image: # -- Repository for Karpor syncer image. repo: kusionstack/karpor # -- Tag for Karpor syncer image. Defaults to the chart's appVersion if not specified. tag: "" - # -- Port for Karpor syncer. - port: 7443 + # -- Resource limits and requests for the karpor syncer pods. + resources: + requests: + cpu: 250m + memory: 256Mi + ephemeral-storage: 2Gi + limits: + cpu: 500m + memory: 1Gi + ephemeral-storage: 10Gi # Configuration for ElasticSearch elasticsearch: # -- Component name for ElasticSearch. name: elasticsearch + # -- The number of ElasticSearch pods to run. + replicas: 1 + # -- Port for ElasticSearch. + port: 9200 image: # -- Repository for ElasticSearch image. repo: docker.elastic.co/elasticsearch/elasticsearch # -- Specific tag for ElasticSearch image. tag: "8.6.2" - # -- Port for ElasticSearch. - port: 9200 + # -- Resource limits and requests for the karpor elasticsearch pods. + resources: + requests: + cpu: "2" + memory: 4Gi + ephemeral-storage: 10Gi + limits: + cpu: "2" + memory: 4Gi + ephemeral-storage: 10Gi # Configuration for ETCD etcd: # -- Component name for ETCD. name: etcd + # -- The number of etcd pods to run. + replicas: 1 + # -- Port for ETCD. + port: 2379 image: # -- Repository for ETCD image. repo: quay.io/coreos/etcd # -- Specific tag for ETCD image. tag: "v3.5.11" - # -- Port for ETCD. - port: 2379 + # -- Resource limits and requests for the karpor etcd pods. + resources: + requests: + cpu: 250m + memory: 256Mi + ephemeral-storage: 2Gi + limits: + cpu: 500m + memory: 1Gi + ephemeral-storage: 10Gi # Configuration for Jobs job: