From 0b20594f84aaa8e237432321d7b293bb21acceee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E5=AE=B5?= Date: Thu, 15 Aug 2024 10:47:44 +0800 Subject: [PATCH 1/4] feat(karpor): add etcd custom sc support --- charts/karpor/templates/etcd.yml | 14 ++++++-- charts/karpor/tmp.yaml | 61 ++++++++++++++++++++++++++++++++ charts/karpor/values.yaml | 12 +++++++ 3 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 charts/karpor/tmp.yaml diff --git a/charts/karpor/templates/etcd.yml b/charts/karpor/templates/etcd.yml index 9ce7423..c1b0ef4 100644 --- a/charts/karpor/templates/etcd.yml +++ b/charts/karpor/templates/etcd.yml @@ -49,7 +49,17 @@ spec: - metadata: name: data spec: - accessModes: [ "ReadWriteOnce" ] + accessModes: + {{- range .Values.etcd.persistence.accessModes }} + - {{ . | quote }} + {{- end }} resources: requests: - storage: 10Gi + storage: {{ .Values.etcd.persistence.size | quote }} + {{- if .Values.etcd.persistence.storageClass }} + {{- if (eq "-" .Values.etcd.persistence.storageClass) }} + storageClassName: "" + {{- else }} + storageClassName: "{{ .Values.etcd.persistence.storageClass }}" + {{- end }} + {{- end }} diff --git a/charts/karpor/tmp.yaml b/charts/karpor/tmp.yaml new file mode 100644 index 0000000..419587d --- /dev/null +++ b/charts/karpor/tmp.yaml @@ -0,0 +1,61 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: etcd + namespace: demo + labels: + helm.sh/chart: karpor-0.6.0 + app.kubernetes.io/name: karpor + app.kubernetes.io/component: etcd + app.kubernetes.io/instance: release-name + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/version: 0.4.7 +spec: + serviceName: etcd + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: karpor + app.kubernetes.io/component: etcd + app.kubernetes.io/instance: release-name + template: + metadata: + labels: + app.kubernetes.io/name: karpor + app.kubernetes.io/component: etcd + app.kubernetes.io/instance: release-name + spec: + containers: + - name: etcd + image: quay.io/coreos/etcd:v3.5.11 + imagePullPolicy: IfNotPresent + command: + - /usr/local/bin/etcd + - --listen-client-urls=http://0.0.0.0:2379 + - --advertise-client-urls=http://localhost:2379 + env: + - name: ETCD_DATA_DIR + value: /etcd-data/default.etcd + ports: + - containerPort: 2379 + volumeMounts: + - name: data + mountPath: /etcd-data + resources: + limits: + cpu: 500m + ephemeral-storage: 10Gi + memory: 1Gi + requests: + cpu: 250m + ephemeral-storage: 2Gi + memory: 256Mi + volumeClaimTemplates: + - metadata: + name: data + spec: + accessModes: + - "ReadWriteOnce" + resources: + requests: + storage: "11Gi" \ No newline at end of file diff --git a/charts/karpor/values.yaml b/charts/karpor/values.yaml index 3ebc476..5678ff4 100644 --- a/charts/karpor/values.yaml +++ b/charts/karpor/values.yaml @@ -111,6 +111,18 @@ etcd: cpu: 500m memory: 1Gi ephemeral-storage: 10Gi + persistence: + # enabled: true + size: 11Gi + accessModes: + - ReadWriteOnce + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + # storageClass: "-" # Configuration for Jobs job: From b1b38139648e0e50e9c63eee05544e8a1b08b3c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E5=AE=B5?= Date: Thu, 15 Aug 2024 10:51:23 +0800 Subject: [PATCH 2/4] fix: revert defalut size --- charts/karpor/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/karpor/values.yaml b/charts/karpor/values.yaml index 5678ff4..1bb8838 100644 --- a/charts/karpor/values.yaml +++ b/charts/karpor/values.yaml @@ -113,7 +113,7 @@ etcd: ephemeral-storage: 10Gi persistence: # enabled: true - size: 11Gi + size: 10Gi accessModes: - ReadWriteOnce ## If defined, storageClassName: From 3380d3f9e901b5d3c01363c084085d1b562afc52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E5=AE=B5?= Date: Thu, 15 Aug 2024 10:51:52 +0800 Subject: [PATCH 3/4] fix: remove tmp file --- charts/karpor/tmp.yaml | 61 ------------------------------------------ 1 file changed, 61 deletions(-) delete mode 100644 charts/karpor/tmp.yaml diff --git a/charts/karpor/tmp.yaml b/charts/karpor/tmp.yaml deleted file mode 100644 index 419587d..0000000 --- a/charts/karpor/tmp.yaml +++ /dev/null @@ -1,61 +0,0 @@ -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: etcd - namespace: demo - labels: - helm.sh/chart: karpor-0.6.0 - app.kubernetes.io/name: karpor - app.kubernetes.io/component: etcd - app.kubernetes.io/instance: release-name - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/version: 0.4.7 -spec: - serviceName: etcd - replicas: 1 - selector: - matchLabels: - app.kubernetes.io/name: karpor - app.kubernetes.io/component: etcd - app.kubernetes.io/instance: release-name - template: - metadata: - labels: - app.kubernetes.io/name: karpor - app.kubernetes.io/component: etcd - app.kubernetes.io/instance: release-name - spec: - containers: - - name: etcd - image: quay.io/coreos/etcd:v3.5.11 - imagePullPolicy: IfNotPresent - command: - - /usr/local/bin/etcd - - --listen-client-urls=http://0.0.0.0:2379 - - --advertise-client-urls=http://localhost:2379 - env: - - name: ETCD_DATA_DIR - value: /etcd-data/default.etcd - ports: - - containerPort: 2379 - volumeMounts: - - name: data - mountPath: /etcd-data - resources: - limits: - cpu: 500m - ephemeral-storage: 10Gi - memory: 1Gi - requests: - cpu: 250m - ephemeral-storage: 2Gi - memory: 256Mi - volumeClaimTemplates: - - metadata: - name: data - spec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: "11Gi" \ No newline at end of file From 2d5b6b45a1ade0846fdd890c15e064262b9fec3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E5=AE=B5?= Date: Thu, 15 Aug 2024 14:35:58 +0800 Subject: [PATCH 4/4] fix: bump chart version --- charts/karpor/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/karpor/Chart.yaml b/charts/karpor/Chart.yaml index dffaab6..4e7a148 100644 --- a/charts/karpor/Chart.yaml +++ b/charts/karpor/Chart.yaml @@ -3,7 +3,7 @@ apiVersion: v2 name: karpor # The Chart Version -version: 0.6.0 +version: 0.6.2 type: application # The Application Version in the Chart appVersion: 0.4.7