From 6989790fed2f2ecb95ed22891d8e1f1cc5a790f0 Mon Sep 17 00:00:00 2001 From: ashish111333 Date: Mon, 5 Aug 2024 15:25:11 +0530 Subject: [PATCH 01/21] added chart.yaml --- dragonfly/chart.yaml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 dragonfly/chart.yaml diff --git a/dragonfly/chart.yaml b/dragonfly/chart.yaml new file mode 100644 index 0000000..4fc7e34 --- /dev/null +++ b/dragonfly/chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: dragonfly +description: "a modern in-memory datastore, fully compatible with Redis and Memcached APIs" + +version: 0.0.0 \ No newline at end of file From af459b743ac06691746ec05089f045aabbd25f4a Mon Sep 17 00:00:00 2001 From: ashish111333 Date: Mon, 5 Aug 2024 15:46:05 +0530 Subject: [PATCH 02/21] added values.yaml --- dragonfly/values.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 dragonfly/values.yaml diff --git a/dragonfly/values.yaml b/dragonfly/values.yaml new file mode 100644 index 0000000..e69de29 From cbbb008abd611152400f6128502ab74f9b164192 Mon Sep 17 00:00:00 2001 From: ashish111333 Date: Mon, 5 Aug 2024 17:24:05 +0530 Subject: [PATCH 03/21] added values.schema.json --- dragonfly/values.schema.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 dragonfly/values.schema.json diff --git a/dragonfly/values.schema.json b/dragonfly/values.schema.json new file mode 100644 index 0000000..e69de29 From 791f103b6ec1f69dc2c66b7803d6828e0be074ca Mon Sep 17 00:00:00 2001 From: ashish111333 Date: Mon, 5 Aug 2024 18:32:49 +0530 Subject: [PATCH 04/21] updates --- dragonfly/values.yaml | 26 ++++++++++++++++++++++++++ values.schema.json | 0 2 files changed, 26 insertions(+) create mode 100644 values.schema.json diff --git a/dragonfly/values.yaml b/dragonfly/values.yaml index e69de29..33c832b 100644 --- a/dragonfly/values.yaml +++ b/dragonfly/values.yaml @@ -0,0 +1,26 @@ +# default configuration for dragonfly + + +replicaCount: 1 + +image: + repository: docker.dragonflydb.io/dragonflydb/dragonfly + + + +# default resource requirements, you can change it according to your needs +resources: + requests: + cpu: 100m + memory: 128Mi + + limits: + cpu: 1000m + memory: 500Mi + + + +service: + type: ClusterIP + + diff --git a/values.schema.json b/values.schema.json new file mode 100644 index 0000000..e69de29 From 6047062214b34f9258cdfc83e8efce4b3810fe71 Mon Sep 17 00:00:00 2001 From: ashish111333 Date: Mon, 5 Aug 2024 21:52:19 +0530 Subject: [PATCH 05/21] updated values.yaml --- dragonfly/values.yaml | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/dragonfly/values.yaml b/dragonfly/values.yaml index 33c832b..2bf3cf6 100644 --- a/dragonfly/values.yaml +++ b/dragonfly/values.yaml @@ -1,6 +1,6 @@ # default configuration for dragonfly - +# no of dragonfly replicas to deploy replicaCount: 1 image: @@ -8,7 +8,7 @@ image: -# default resource requirements, you can change it according to your needs +# default resource requirements, you can change it according to your needs. resources: requests: cpu: 100m @@ -16,11 +16,39 @@ resources: limits: cpu: 1000m - memory: 500Mi + memory: 512Mi service: + type: ClusterIP + # Load balancer static ip to use when service type is set to LoadBalancer + loadBalancerIP: "" + # Dragonfly default service port + port: 6379 + + metrics: + # name for the metrics port + portName: metrics + # serviceType for the metrics service + serviceType: ClusterIP + + + +storage: + # you can set this to true for production use cases,if you want dragonfly to persist data. + enabled: false + + storageClassName: "" + # Volume size to request for the PVC,default is 128Mb + requests: 128Mi + + + +# extra arguments to pass to dragonfly binary +extraArgs: [] + + From eb07b7b4cabb0c82b220e6b14f336a63ddfce3f1 Mon Sep 17 00:00:00 2001 From: ashish111333 Date: Mon, 5 Aug 2024 22:30:12 +0530 Subject: [PATCH 06/21] updates values.yaml --- dragonfly/values.yaml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/dragonfly/values.yaml b/dragonfly/values.yaml index 2bf3cf6..c1981ff 100644 --- a/dragonfly/values.yaml +++ b/dragonfly/values.yaml @@ -11,11 +11,15 @@ image: # default resource requirements, you can change it according to your needs. resources: requests: + # min cpu millisecs cpu: 100m + # min memory for dragonfly deployment memory: 128Mi limits: + #max cpu millisecs cpu: 1000m + # max memory limit for dragonfly deployment memory: 512Mi @@ -47,8 +51,22 @@ storage: # extra arguments to pass to dragonfly binary -extraArgs: [] +extraArgs: + # + - --dbfilename=dump.rdb + - --snapshot_cron=* * * * * - +securityContexts: + capabilities: + drop: + - ALL + # sets file system permission as read-only for dragonfly container + readOnlyRootFilesystem: true + # sets the dragon container to run as non-root + runAsNonRoot: true + # + runAsUser: 1000 + + From baa5df445b64e74044efe5b303ed10a1f3e632a3 Mon Sep 17 00:00:00 2001 From: ashish111333 Date: Mon, 5 Aug 2024 23:35:08 +0530 Subject: [PATCH 07/21] updated values.yaml --- dragonfly/chart.yaml | 2 +- dragonfly/values.yaml | 33 +++++++++++++++++++++++++++++---- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/dragonfly/chart.yaml b/dragonfly/chart.yaml index 4fc7e34..7bc4b98 100644 --- a/dragonfly/chart.yaml +++ b/dragonfly/chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 name: dragonfly -description: "a modern in-memory datastore, fully compatible with Redis and Memcached APIs" +description: "a modern superfast in-memory datastore, fully compatible with Redis and Memcached APIs" version: 0.0.0 \ No newline at end of file diff --git a/dragonfly/values.yaml b/dragonfly/values.yaml index c1981ff..b2d62c1 100644 --- a/dragonfly/values.yaml +++ b/dragonfly/values.yaml @@ -17,7 +17,7 @@ resources: memory: 128Mi limits: - #max cpu millisecs + #max cpu millisecs for dragonfly deployment cpu: 1000m # max memory limit for dragonfly deployment memory: 512Mi @@ -45,15 +45,16 @@ storage: enabled: false storageClassName: "" - # Volume size to request for the PVC,default is 128Mb + # Volume size to request for the PVC,default set to 128Mb requests: 128Mi # extra arguments to pass to dragonfly binary extraArgs: - # + # database dump file for backups - --dbfilename=dump.rdb + # takes snapshots - --snapshot_cron=* * * * * @@ -66,7 +67,31 @@ securityContexts: readOnlyRootFilesystem: true # sets the dragon container to run as non-root runAsNonRoot: true - # + # run dragonfly container with user-Id as 1000 runAsUser: 1000 + +# the below fields serviceMonitor and promtheiumsRule requires you have promtheus operator running in your cluster + +#serviceMonitor: + # -- If true, a ServiceMonitor CRD is created for a prometheus operator + #enabled: false + # -- namespace in which to deploy the ServiceMonitor CR. defaults to the application namespace + #namespace: "" + # -- additional labels to apply to the metrics + #labels: {} + # -- additional annotations to apply to the metrics + #annotations: {} + # -- scrape interval + #interval: 10s + # -- scrape timeout + #scrapeTimeout: 10s + +#prometheusRule: + # -- Deploy a PrometheusRule + #enabled: false + # -- PrometheusRule.Spec + # https://awesome-prometheus-alerts.grep.to/rules + #spec: [] + From a9c839b9c98fa048e7a3cdfc592a21237f1cdb84 Mon Sep 17 00:00:00 2001 From: ashish111333 Date: Tue, 6 Aug 2024 09:48:45 +0530 Subject: [PATCH 08/21] added templates and values.scehma.json --- dragonfly/templates/_helpers.tpl | 62 +++++++++++ dragonfly/templates/_pod.tpl | 132 +++++++++++++++++++++++ dragonfly/templates/certificate.yaml | 31 ++++++ dragonfly/templates/deployment.yaml | 30 ++++++ dragonfly/templates/metrics-service.yaml | 19 ++++ dragonfly/templates/prometheusrule.yaml | 14 +++ dragonfly/templates/service.yaml | 26 +++++ dragonfly/templates/serviceaccount.yaml | 13 +++ dragonfly/templates/statefulset.yaml | 37 +++++++ dragonfly/templates/tls-secret.yaml | 13 +++ dragonfly/values.schema.json | 29 +++++ dragonfly/values.yaml | 96 +++++++++++++---- 12 files changed, 480 insertions(+), 22 deletions(-) create mode 100644 dragonfly/templates/_helpers.tpl create mode 100644 dragonfly/templates/_pod.tpl create mode 100644 dragonfly/templates/certificate.yaml create mode 100644 dragonfly/templates/deployment.yaml create mode 100644 dragonfly/templates/metrics-service.yaml create mode 100644 dragonfly/templates/prometheusrule.yaml create mode 100644 dragonfly/templates/service.yaml create mode 100644 dragonfly/templates/serviceaccount.yaml create mode 100644 dragonfly/templates/statefulset.yaml create mode 100644 dragonfly/templates/tls-secret.yaml diff --git a/dragonfly/templates/_helpers.tpl b/dragonfly/templates/_helpers.tpl new file mode 100644 index 0000000..02a2289 --- /dev/null +++ b/dragonfly/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "dragonfly.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "dragonfly.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "dragonfly.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "dragonfly.labels" -}} +helm.sh/chart: {{ include "dragonfly.chart" . }} +{{ include "dragonfly.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "dragonfly.selectorLabels" -}} +app.kubernetes.io/name: {{ include "dragonfly.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "dragonfly.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "dragonfly.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/dragonfly/templates/_pod.tpl b/dragonfly/templates/_pod.tpl new file mode 100644 index 0000000..ca4dec2 --- /dev/null +++ b/dragonfly/templates/_pod.tpl @@ -0,0 +1,132 @@ +{{- define "dragonfly.volumemounts" -}} +{{- if or (.Values.storage.enabled) (.Values.extraVolumeMounts) (.Values.tls.enabled) }} +volumeMounts: + {{- if .Values.storage.enabled }} + - mountPath: /data + name: "{{ .Release.Name }}-data" + {{- end }} + {{- if and .Values.tls .Values.tls.enabled }} + - mountPath: /etc/dragonfly/tls + name: tls + {{- end }} + {{- with .Values.extraVolumeMounts }} + {{- toYaml . | trim | nindent 2 }} + {{- end }} +{{- end }} +{{- end }} + +{{- define "dragonfly.pod" -}} +{{- if ne .Values.priorityClassName "" }} +priorityClassName: {{ .Values.priorityClassName }} +{{- end }} +{{- with .Values.tolerations }} +tolerations: + {{- toYaml . | trim | nindent 2 -}} +{{- end }} +{{- with .Values.nodeSelector }} +nodeSelector: + {{- toYaml . | trim | nindent 2 -}} +{{- end }} +{{- with .Values.affinity }} +affinity: + {{- toYaml . | trim | nindent 2 -}} +{{- end }} +serviceAccountName: {{ include "dragonfly.serviceAccountName" . }} +{{- with .Values.imagePullSecrets }} +imagePullSecrets: + {{- toYaml . | trim | nindent 2 }} +{{- end }} +{{- with .Values.podSecurityContext }} +securityContext: + {{- toYaml . | trim | nindent 2 }} +{{- end }} +{{- with .Values.initContainers }} +initContainers: + {{- if eq (typeOf .) "string" }} + {{- tpl . $ | trim | nindent 2 }} + {{- else }} + {{- toYaml . | trim | nindent 2 }} + {{- end }} +{{- end }} +containers: + {{- with .Values.extraContainers }} + {{- if eq (typeOf .) "string" -}} + {{- tpl . $ | trim | nindent 2 }} + {{- else }} + {{- toYaml . | trim | nindent 2 }} + {{- end }} + {{- end }} + - name: {{ .Chart.Name }} + {{- with .Values.securityContext }} + securityContext: + {{- toYaml . | trim | nindent 6 }} + {{- end }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: dragonfly + containerPort: 6379 + protocol: TCP + {{- with .Values.probes }} + {{- toYaml . | trim | nindent 4 }} + {{- end }} + {{- with .Values.command }} + command: + {{- toYaml . | trim | nindent 6 }} + {{- end }} + args: + - "--alsologtostderr" + {{- with .Values.extraArgs }} + {{- toYaml . | trim | nindent 6 }} + {{- end }} + {{- if .Values.tls.enabled }} + - "--tls" + - "--tls_cert_file=/etc/dragonfly/tls/tls.crt" + - "--tls_key_file=/etc/dragonfly/tls/tls.key" + {{- end }} + {{- with .Values.resources }} + resources: + {{- toYaml . | trim | nindent 6 }} + {{- end }} + {{- include "dragonfly.volumemounts" . | trim | nindent 4 }} + {{- if .Values.passwordFromSecret.enable }} + {{- $appVersion := .Chart.AppVersion | trimPrefix "v" }} + {{- $imageTag := .Values.image.tag | trimPrefix "v" }} + {{- $effectiveVersion := $appVersion }} + {{- if and $imageTag (ne $imageTag "") }} + {{- $effectiveVersion = $imageTag }} + {{- end }} + env: + {{- if semverCompare ">=1.14.0" $effectiveVersion }} + - name: DFLY_requirepass + {{- else }} + - name: DFLY_PASSWORD + {{- end }} + valueFrom: + secretKeyRef: + name: {{ .Values.passwordFromSecret.existingSecret.name }} + key: {{ .Values.passwordFromSecret.existingSecret.key }} + {{- end }} + +{{- if or (.Values.tls.enabled) (.Values.extraVolumes) }} +volumes: +{{- if and .Values.tls .Values.tls.enabled }} + {{- if .Values.tls.existing_secret }} + - name: tls + secret: + secretName: {{ .Values.tls.existing_secret }} + {{- else if .Values.tls.createCerts }} + - name: tls + secret: + secretName: '{{ include "dragonfly.fullname" . }}-server-tls' + {{- else }} + - name: tls + secret: + secretName: {{ include "dragonfly.fullname" . }}-tls + {{- end }} +{{- end }} +{{- with .Values.extraVolumes }} + {{- toYaml . | trim | nindent 2 }} +{{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/dragonfly/templates/certificate.yaml b/dragonfly/templates/certificate.yaml new file mode 100644 index 0000000..bfd2510 --- /dev/null +++ b/dragonfly/templates/certificate.yaml @@ -0,0 +1,31 @@ +{{- if and .Values.tls.enabled .Values.tls.createCerts }} +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: {{ include "dragonfly.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "dragonfly.labels" . | nindent 4 }} +spec: + commonName: '{{ include "dragonfly.fullname" . }}' + dnsNames: + - '*.{{ include "dragonfly.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local' + - '{{ include "dragonfly.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local' + - '{{ include "dragonfly.fullname" . }}.{{ .Release.Namespace }}.svc' + - '{{ include "dragonfly.fullname" . }}.{{ .Release.Namespace }}' + - '{{ include "dragonfly.fullname" . }}' + - localhost + duration: {{ required "tls.duration is required, if createCerts is enabled" .Values.tls.duration }} + ipAddresses: + - 127.0.0.1 + issuerRef: + kind: {{ required "tls.issuer.kind is required, if createCerts is enabled" .Values.tls.issuer.kind }} + name: {{ required "tls.issuer.name is required, if createCerts is enabled" .Values.tls.issuer.name }} + group: {{ .Values.tls.issuer.group }} + secretName: '{{ include "dragonfly.fullname" . }}-server-tls' + usages: + - client auth + - server auth + - signing + - key encipherment +{{- end }} \ No newline at end of file diff --git a/dragonfly/templates/deployment.yaml b/dragonfly/templates/deployment.yaml new file mode 100644 index 0000000..9328001 --- /dev/null +++ b/dragonfly/templates/deployment.yaml @@ -0,0 +1,30 @@ +{{- if not .Values.storage.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "dragonfly.name" }} + + +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "dragonfly.selectorLabels" . | nindent 6 }} + + template: + metadata: + annotations: + {{- if and (.Values.tls.enabled) (not .Values.tls.existing_secret) }} + checksum/tls-secret: {{ include (print $.Template.BasePath "/tls-secret.yaml") . | sha256sum }} + {{- end }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "dragonfly.selectorLabels" . | nindent 8 }} + spec: + {{- include "dragonfly.pod" . | trim | nindent 6 }} +{{- end }} + + + \ No newline at end of file diff --git a/dragonfly/templates/metrics-service.yaml b/dragonfly/templates/metrics-service.yaml new file mode 100644 index 0000000..cd47e2a --- /dev/null +++ b/dragonfly/templates/metrics-service.yaml @@ -0,0 +1,19 @@ +{{- if .Values.serviceMonitor.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "dragonfly.fullname" . }}-metrics + namespace: {{ .Release.Namespace }} + labels: + {{- include "dragonfly.labels" . | nindent 4 }} + type: metrics +spec: + type: {{ .Values.service.metrics.serviceType }} + ports: + - name: {{ .Values.service.metrics.portName }} + port: {{ .Values.service.port }} + targetPort: {{ .Values.service.port }} + protocol: TCP + selector: + {{- include "dragonfly.selectorLabels" . | nindent 4 }} +{{- end }} \ No newline at end of file diff --git a/dragonfly/templates/prometheusrule.yaml b/dragonfly/templates/prometheusrule.yaml new file mode 100644 index 0000000..4cbc1a4 --- /dev/null +++ b/dragonfly/templates/prometheusrule.yaml @@ -0,0 +1,14 @@ +{{- if and ( .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" ) .Values.serviceMonitor.enabled .Values.prometheusRule.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + name: {{ template "dragonfly.fullname" . }}-metrics + namespace: {{ .Values.prometheusRule.namespace | default .Release.Namespace }} + labels: + {{- include "dragonfly.labels" . | nindent 4 }} +spec: + groups: + - name: {{ template "dragonfly.name" . }} + rules: + {{- toYaml .Values.prometheusRule.spec | nindent 6 }} +{{- end }} \ No newline at end of file diff --git a/dragonfly/templates/service.yaml b/dragonfly/templates/service.yaml new file mode 100644 index 0000000..fc3dd99 --- /dev/null +++ b/dragonfly/templates/service.yaml @@ -0,0 +1,26 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "dragonfly.fullname" . }} + namespace: {{ .Release.Namespace }} + {{- with .Values.service.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} + labels: + {{- with .Values.service.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- include "dragonfly.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + {{- if and (eq .Values.service.type "LoadBalancer") (ne .Values.service.loadBalancerIP "") }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} + {{- end }} + ports: + - port: {{ .Values.service.port }} + targetPort: dragonfly + protocol: TCP + name: dragonfly + selector: + {{- include "dragonfly.selectorLabels" . | nindent 4 }} \ No newline at end of file diff --git a/dragonfly/templates/serviceaccount.yaml b/dragonfly/templates/serviceaccount.yaml new file mode 100644 index 0000000..9529e2f --- /dev/null +++ b/dragonfly/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "dragonfly.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} + labels: + {{- include "dragonfly.labels" . | nindent 4 }} +{{- end }} \ No newline at end of file diff --git a/dragonfly/templates/statefulset.yaml b/dragonfly/templates/statefulset.yaml new file mode 100644 index 0000000..a0c6326 --- /dev/null +++ b/dragonfly/templates/statefulset.yaml @@ -0,0 +1,37 @@ +{{- if .Values.storage.enabled }} +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ include "dragonfly.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "dragonfly.labels" . | nindent 4 }} +spec: + serviceName: {{ .Release.Name }} + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "dragonfly.selectorLabels" . | nindent 6 }} + template: + metadata: + annotations: + {{- if and (.Values.tls.enabled) (not .Values.tls.existing_secret) }} + checksum/tls-secret: {{ include (print $.Template.BasePath "/tls-secret.yaml") . | sha256sum }} + {{- end }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "dragonfly.selectorLabels" . | nindent 8 }} + spec: + {{- include "dragonfly.pod" . | trim | nindent 6 }} + volumeClaimTemplates: + - metadata: + name: "{{ .Release.Name }}-data" + spec: + accessModes: [ "ReadWriteOnce" ] + storageClassName: {{ .Values.storage.storageClassName }} + resources: + requests: + storage: {{ .Values.storage.requests }} +{{- end }} \ No newline at end of file diff --git a/dragonfly/templates/tls-secret.yaml b/dragonfly/templates/tls-secret.yaml new file mode 100644 index 0000000..81b09c3 --- /dev/null +++ b/dragonfly/templates/tls-secret.yaml @@ -0,0 +1,13 @@ +{{- if and (.Values.tls.enabled) (.Values.tls.cert) (.Values.tls.key) (not .Values.tls.existing_secret) }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "dragonfly.fullname" . }}-tls + namespace: {{ .Release.Namespace }} + labels: + {{- include "dragonfly.labels" . | nindent 4 }} +type: kubernetes.io/tls +data: + tls.crt: {{ default "" .Values.tls.cert | b64enc | quote }} + tls.key: {{ default "" .Values.tls.key | b64enc | quote }} +{{- end }} \ No newline at end of file diff --git a/dragonfly/values.schema.json b/dragonfly/values.schema.json index e69de29..a5d64b1 100644 --- a/dragonfly/values.schema.json +++ b/dragonfly/values.schema.json @@ -0,0 +1,29 @@ +{ + + "properties": { + "replicaCount":{ + "description": "number of replicas of dragonflyDb", + "type":"integer" + }, + "storage":{ + + "description": "enables persistent storage", + "type":"boolean" + }, + "serviceMonitor":{ + "description": "enables service monitor ,requires kube-promtheus installed in your cluster", + "type":"boolean" + + } + + + + + + + + + } + + +} \ No newline at end of file diff --git a/dragonfly/values.yaml b/dragonfly/values.yaml index b2d62c1..b37274d 100644 --- a/dragonfly/values.yaml +++ b/dragonfly/values.yaml @@ -38,7 +38,17 @@ service: # serviceType for the metrics service serviceType: ClusterIP - + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + + storage: # you can set this to true for production use cases,if you want dragonfly to persist data. @@ -72,26 +82,68 @@ securityContexts: -# the below fields serviceMonitor and promtheiumsRule requires you have promtheus operator running in your cluster - -#serviceMonitor: - # -- If true, a ServiceMonitor CRD is created for a prometheus operator - #enabled: false - # -- namespace in which to deploy the ServiceMonitor CR. defaults to the application namespace - #namespace: "" - # -- additional labels to apply to the metrics - #labels: {} - # -- additional annotations to apply to the metrics - #annotations: {} - # -- scrape interval - #interval: 10s - # -- scrape timeout - #scrapeTimeout: 10s - -#prometheusRule: - # -- Deploy a PrometheusRule - #enabled: false - # -- PrometheusRule.Spec +# the below fields serviceMonitor and promtheiumsRule requires you have prometheus operator running in your cluster. + +serviceMonitor: + # If true, a ServiceMonitor CRD is created for a prometheus operator + enabled: false + # namespace in which to deploy the ServiceMonitor CR. defaults to the application namespace + namespace: "" + # additional labels to apply to the metrics + labels: {} + # additional annotations to apply to the metrics + annotations: {} + # scrape interval + interval: 10s + # scrape timeout + scrapeTimeout: 10s + +prometheusRule: + # Deploy a PrometheusRule + enabled: false + # PrometheusRule.Spec # https://awesome-prometheus-alerts.grep.to/rules - #spec: [] + spec: [] + +tls: + # -enable TLS + enabled: false + # use cert-manager to automatically create the certificate + createCerts: false + # duration or ttl of the validity of the created certificate + duration: 87600h0m0s + issuer: + # - cert-manager issuer kind. Usually Issuer or ClusterIssuer + kind: ClusterIssuer + # -name of the referenced issuer + name: selfsigned + # - group of the referenced issuer + # if you are using an external issuer, change this to that issuer group. + group: cert-manager.io + # - use TLS certificates from existing secret + existing_secret: "" + # - TLS certificate + cert: "" + # cert: | + # -----BEGIN CERTIFICATE----- + # MIIDazCCAlOgAwIBAgIUfV3ygaaVW3+yzK5Dq6Aw6TsZ494wDQYJKoZIhvcNAQEL + # ... + # BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM + # zJAL4hNw4Tr6E52fqdmX + # -----END CERTIFICATE----- + # -- TLS private key + key: "" + + + + +passwordFromSecret: + enable: false + existingSecret: + name: "" + key: "" + + + +# for more fields check dragon fly helm chart \ No newline at end of file From 9beaace9176cd8e4eaa4c22db01bf128e7ecd126 Mon Sep 17 00:00:00 2001 From: ashish111333 Date: Tue, 6 Aug 2024 12:16:32 +0530 Subject: [PATCH 09/21] updates --- dragonfly/values.schema.json | 87 ++++++++++++++++++++++++++++++++---- dragonfly/values.yaml | 2 +- 2 files changed, 80 insertions(+), 9 deletions(-) diff --git a/dragonfly/values.schema.json b/dragonfly/values.schema.json index a5d64b1..b4bc1c3 100644 --- a/dragonfly/values.schema.json +++ b/dragonfly/values.schema.json @@ -6,24 +6,95 @@ "type":"integer" }, "storage":{ - - "description": "enables persistent storage", - "type":"boolean" + + "description": "storage for dragonflydb,default is 128Mi", + "type":"object", + "properties": { + "enabled":{ + "description": "enables storage if set to true ,default is false", + "type":"boolean" + + }, + "requests":{ + "description":"requests storage,default 128Mi", + "type":"string" + } + } + }, "serviceMonitor":{ "description": "enables service monitor ,requires kube-promtheus installed in your cluster", "type":"boolean" + }, + "resources":{ + + "description": "allocate cpu and ram for dragonfly", + "title": "resources", + "type":"object", + "properties": { + + "requests":{ + + "title": "Request resoures", + "type":"object", + "properties": { + + + "cpu":{ + + "description":"request to allocates cpu resource,default is 100m", + "type":"string" + + }, + "memory":{ + + "description":"requests memory for dragonfly, default 128Mi(Megabyte)", + "type":"string" + } + } + }, + "limits":{ + + "title":"resource limits", + "description": "sets upper limits for resources", + "type":"object", + "properties": { + + "cpu":{ + "description":"cpu resource limit,deafult is 1000m", + "type":"string" + }, + "memory":{ + "description": "memory limit for dragonfly,default 512Mi", + "type":"string" + } + } + + + } + + } + } - - - - + }, + "order":[ + "replicaCount", + "storage", + "resources", + "serviceMonitor" - } + ], + "required": [ + "replicaCount", + "storage", + "resources", + "serviceMonitor" + ] + } \ No newline at end of file diff --git a/dragonfly/values.yaml b/dragonfly/values.yaml index b37274d..df1c1dc 100644 --- a/dragonfly/values.yaml +++ b/dragonfly/values.yaml @@ -52,7 +52,7 @@ serviceAccount: storage: # you can set this to true for production use cases,if you want dragonfly to persist data. - enabled: false + enabled: false storageClassName: "" # Volume size to request for the PVC,default set to 128Mb From fbef106ec42900102b6223ad56fdd5da092087cd Mon Sep 17 00:00:00 2001 From: ashish111333 Date: Tue, 6 Aug 2024 12:22:08 +0530 Subject: [PATCH 10/21] updates --- dragonfly/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dragonfly/values.yaml b/dragonfly/values.yaml index df1c1dc..61f5647 100644 --- a/dragonfly/values.yaml +++ b/dragonfly/values.yaml @@ -64,7 +64,7 @@ storage: extraArgs: # database dump file for backups - --dbfilename=dump.rdb - # takes snapshots + # takes snapshots at every minute - --snapshot_cron=* * * * * From 6a80f60735fde448b999eeffeb8f084a81107d70 Mon Sep 17 00:00:00 2001 From: ashish111333 Date: Tue, 6 Aug 2024 12:49:23 +0530 Subject: [PATCH 11/21] small fix --- dragonfly/{chart.yaml => Chart.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename dragonfly/{chart.yaml => Chart.yaml} (100%) diff --git a/dragonfly/chart.yaml b/dragonfly/Chart.yaml similarity index 100% rename from dragonfly/chart.yaml rename to dragonfly/Chart.yaml From cb512989b62cbffaefe1d11ffeebf6d2acab0226 Mon Sep 17 00:00:00 2001 From: ashish111333 Date: Tue, 6 Aug 2024 13:03:36 +0530 Subject: [PATCH 12/21] fix --- dragonfly/templates/deployment.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dragonfly/templates/deployment.yaml b/dragonfly/templates/deployment.yaml index 9328001..69ce36a 100644 --- a/dragonfly/templates/deployment.yaml +++ b/dragonfly/templates/deployment.yaml @@ -2,7 +2,10 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "dragonfly.name" }} + name: {{ include "dragonfly.fullname" .}} + namespace: {{ .Release.Namespace }} + labels: + {{- include "dragonfly.labels" . | nindent 4 }} spec: From 6853e2cc45feff3d9386a184ce3d88972bbbdd8b Mon Sep 17 00:00:00 2001 From: ashish111333 Date: Tue, 6 Aug 2024 22:18:00 +0530 Subject: [PATCH 13/21] minor fix --- dragonfly/values.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/dragonfly/values.yaml b/dragonfly/values.yaml index 61f5647..197ae5a 100644 --- a/dragonfly/values.yaml +++ b/dragonfly/values.yaml @@ -5,6 +5,7 @@ replicaCount: 1 image: repository: docker.dragonflydb.io/dragonflydb/dragonfly + tag: "latest" From cae69a2bae422121dbc59b6ccec7f462c138d541 Mon Sep 17 00:00:00 2001 From: ashish111333 Date: Tue, 6 Aug 2024 23:15:54 +0530 Subject: [PATCH 14/21] edits --- dragonfly/Chart.yaml | 2 +- dragonfly/values.yaml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/dragonfly/Chart.yaml b/dragonfly/Chart.yaml index 7bc4b98..b03409c 100644 --- a/dragonfly/Chart.yaml +++ b/dragonfly/Chart.yaml @@ -2,4 +2,4 @@ apiVersion: v2 name: dragonfly description: "a modern superfast in-memory datastore, fully compatible with Redis and Memcached APIs" -version: 0.0.0 \ No newline at end of file +version: v1.20.1 diff --git a/dragonfly/values.yaml b/dragonfly/values.yaml index 197ae5a..429fdb5 100644 --- a/dragonfly/values.yaml +++ b/dragonfly/values.yaml @@ -5,8 +5,7 @@ replicaCount: 1 image: repository: docker.dragonflydb.io/dragonflydb/dragonfly - tag: "latest" - + tag: "" # default resource requirements, you can change it according to your needs. From 3eb14554110cb65dde3191e5523753d05b152f50 Mon Sep 17 00:00:00 2001 From: ashish111333 Date: Tue, 6 Aug 2024 23:17:58 +0530 Subject: [PATCH 15/21] small fix check --- dragonfly/Chart.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/dragonfly/Chart.yaml b/dragonfly/Chart.yaml index b03409c..0a38621 100644 --- a/dragonfly/Chart.yaml +++ b/dragonfly/Chart.yaml @@ -3,3 +3,4 @@ name: dragonfly description: "a modern superfast in-memory datastore, fully compatible with Redis and Memcached APIs" version: v1.20.1 +appVersion: "v1.20.1" From 19037305e0c3e837a3f16bad49eacf1dc7cff5c8 Mon Sep 17 00:00:00 2001 From: ashish111333 Date: Tue, 6 Aug 2024 23:44:57 +0530 Subject: [PATCH 16/21] updated --- dragonfly/values.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dragonfly/values.yaml b/dragonfly/values.yaml index 429fdb5..68a3c1b 100644 --- a/dragonfly/values.yaml +++ b/dragonfly/values.yaml @@ -67,7 +67,10 @@ extraArgs: # takes snapshots at every minute - --snapshot_cron=* * * * * - + +podSecurityContext: + fsGroup: 2000 + securityContexts: capabilities: From 1c143177c5e3cda2cb3c17ba3ef97394a8f3ef7f Mon Sep 17 00:00:00 2001 From: ashish111333 Date: Tue, 6 Aug 2024 23:55:04 +0530 Subject: [PATCH 17/21] update --- dragonfly/values.yaml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/dragonfly/values.yaml b/dragonfly/values.yaml index 68a3c1b..e7fe31f 100644 --- a/dragonfly/values.yaml +++ b/dragonfly/values.yaml @@ -61,12 +61,8 @@ storage: # extra arguments to pass to dragonfly binary -extraArgs: - # database dump file for backups - - --dbfilename=dump.rdb - # takes snapshots at every minute - - --snapshot_cron=* * * * * - +extraArgs: [] + podSecurityContext: fsGroup: 2000 From 40ef8b58158dfb5386dea59bc23eda388729af29 Mon Sep 17 00:00:00 2001 From: ashish111333 Date: Wed, 7 Aug 2024 20:21:32 +0530 Subject: [PATCH 18/21] deleted values.schema.json root --- values.schema.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 values.schema.json diff --git a/values.schema.json b/values.schema.json deleted file mode 100644 index e69de29..0000000 From 9e0166f75d1cdbb8e19800d0c2178fed3d50069a Mon Sep 17 00:00:00 2001 From: ashish111333 Date: Fri, 9 Aug 2024 17:48:23 +0530 Subject: [PATCH 19/21] small fix --- dragonfly/values.schema.json | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dragonfly/values.schema.json b/dragonfly/values.schema.json index b4bc1c3..fa36144 100644 --- a/dragonfly/values.schema.json +++ b/dragonfly/values.schema.json @@ -24,7 +24,18 @@ }, "serviceMonitor":{ "description": "enables service monitor ,requires kube-promtheus installed in your cluster", - "type":"boolean" + "type":"object", + "properties": { + "enabled":{ + "type":"boolean" + }, + "namespace":{ + "description": "namespace to deploy in,default is application namespace", + "type":"string" + } + + + } }, "resources":{ From 6b90011819ada28dc649c2b41065e5a07b4b756a Mon Sep 17 00:00:00 2001 From: ashish111333 Date: Fri, 9 Aug 2024 18:20:34 +0530 Subject: [PATCH 20/21] small fix --- dragonfly/values.schema.json | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/dragonfly/values.schema.json b/dragonfly/values.schema.json index fa36144..1d2e57f 100644 --- a/dragonfly/values.schema.json +++ b/dragonfly/values.schema.json @@ -6,21 +6,18 @@ "type":"integer" }, "storage":{ - "description": "storage for dragonflydb,default is 128Mi", "type":"object", "properties": { "enabled":{ "description": "enables storage if set to true ,default is false", "type":"boolean" - }, "requests":{ "description":"requests storage,default 128Mi", "type":"string" } } - }, "serviceMonitor":{ "description": "enables service monitor ,requires kube-promtheus installed in your cluster", @@ -33,45 +30,32 @@ "description": "namespace to deploy in,default is application namespace", "type":"string" } - - - } - + } }, "resources":{ - "description": "allocate cpu and ram for dragonfly", "title": "resources", "type":"object", "properties": { - "requests":{ - "title": "Request resoures", "type":"object", "properties": { - - "cpu":{ - "description":"request to allocates cpu resource,default is 100m", "type":"string" - }, "memory":{ - "description":"requests memory for dragonfly, default 128Mi(Megabyte)", "type":"string" } } }, "limits":{ - "title":"resource limits", "description": "sets upper limits for resources", "type":"object", "properties": { - "cpu":{ "description":"cpu resource limit,deafult is 1000m", "type":"string" @@ -81,23 +65,15 @@ "type":"string" } } - - } - } - } - - }, "order":[ - "replicaCount", "storage", "resources", "serviceMonitor" - ], "required": [ "replicaCount", @@ -105,7 +81,4 @@ "resources", "serviceMonitor" ] - - - } \ No newline at end of file From a525f9ab5a5a87971a0f5cae32540d32a1e18d65 Mon Sep 17 00:00:00 2001 From: ashish111333 Date: Fri, 9 Aug 2024 22:27:14 +0530 Subject: [PATCH 21/21] small fix --- dragonfly/values.schema.json | 1 - 1 file changed, 1 deletion(-) diff --git a/dragonfly/values.schema.json b/dragonfly/values.schema.json index 1d2e57f..3f22821 100644 --- a/dragonfly/values.schema.json +++ b/dragonfly/values.schema.json @@ -1,5 +1,4 @@ { - "properties": { "replicaCount":{ "description": "number of replicas of dragonflyDb",