diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md new file mode 100644 index 0000000..d8cc340 --- /dev/null +++ b/CONTRIBUTORS.md @@ -0,0 +1,4 @@ +# Contributors (alphabetical by surname) + +* **[Philipp Born](https://github.com/tamcore)** + * Helm Chart diff --git a/contrib/charts/dragonfly/.helmignore b/contrib/charts/dragonfly/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/contrib/charts/dragonfly/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/contrib/charts/dragonfly/Chart.yaml b/contrib/charts/dragonfly/Chart.yaml new file mode 100644 index 0000000..267c3db --- /dev/null +++ b/contrib/charts/dragonfly/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: dragonfly +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "v0.1.0" diff --git a/contrib/charts/dragonfly/README.md b/contrib/charts/dragonfly/README.md new file mode 100644 index 0000000..f73da1d --- /dev/null +++ b/contrib/charts/dragonfly/README.md @@ -0,0 +1,40 @@ +# dragonfly + +![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.1.0](https://img.shields.io/badge/AppVersion-v0.1.0-informational?style=flat-square) + +A Helm chart for Kubernetes + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | Affinity for pod assignment | +| extraArgs | list | `[]` | Extra arguments to pass to the dragonfly binary | +| extraVolumeMounts | list | `[]` | Extra volume mounts corresponding to the volumes mounted above | +| extraVolumes | list | `[]` | Extra volumes to mount into the pods | +| fullnameOverride | string | `""` | String to fully override dragonfly.fullname | +| image.pullPolicy | string | `"IfNotPresent"` | Dragonfly image pull policy | +| image.repository | string | `"docker.dragonflydb.io/dragonflydb/dragonfly"` | Container Image Registry to pull the image from | +| image.tag | string | `"latest"` | Overrides the image tag whose default is the chart appVersion. | +| imagePullSecrets | list | `[]` | Container Registry Secret names in an array | +| initContainers | list | `[]` | A list of initContainers to run before each pod starts | +| nameOverride | string | `""` | String to partially override dragonfly.fullname | +| nodeSelector | object | `{}` | Node labels for pod assignment | +| podAnnotations | object | `{}` | Annotations for pods | +| podSecurityContext | object | `{}` | Set securityContext for pod itself | +| replicaCount | int | `1` | Number of replicas to deploy | +| resources.limits | object | `{}` | The resource limits for the containers | +| resources.requests | object | `{}` | The requested resources for the containers | +| securityContext | object | `{}` | Set securityContext for containers | +| service.port | int | `6379` | Dragonfly service port | +| service.type | string | `"ClusterIP"` | Service type to provision. Can be NodePort, ClusterIP or LoadBalancer | +| serviceAccount.annotations | object | `{}` | Annotations to add to the service account | +| serviceAccount.create | bool | `true` | Specifies whether a service account should be created | +| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template | +| storage.enabled | bool | `false` | If /data should persist. This will provision a StatefulSet instead. | +| storage.requests | string | `"128Mi"` | Volume size to request for the PVC | +| storage.storageClassName | string | `""` | Global StorageClass for Persistent Volume(s) | +| tolerations | list | `[]` | Tolerations for pod assignment | + +---------------------------------------------- +Autogenerated from chart metadata using [helm-docs v1.10.0](https://github.com/norwoodj/helm-docs/releases/v1.10.0) diff --git a/contrib/charts/dragonfly/templates/NOTES.txt b/contrib/charts/dragonfly/templates/NOTES.txt new file mode 100644 index 0000000..93be047 --- /dev/null +++ b/contrib/charts/dragonfly/templates/NOTES.txt @@ -0,0 +1,17 @@ +1. Get the application URL by running these commands: + +{{- if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "dragonfly.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "dragonfly.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "dragonfly.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "dragonfly.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "You can use redis-cli to connect against localhost:6379" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 6379:$CONTAINER_PORT +{{- end }} \ No newline at end of file diff --git a/contrib/charts/dragonfly/templates/_helpers.tpl b/contrib/charts/dragonfly/templates/_helpers.tpl new file mode 100644 index 0000000..fc17b20 --- /dev/null +++ b/contrib/charts/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 }} diff --git a/contrib/charts/dragonfly/templates/deployment.yaml b/contrib/charts/dragonfly/templates/deployment.yaml new file mode 100644 index 0000000..91d6ef7 --- /dev/null +++ b/contrib/charts/dragonfly/templates/deployment.yaml @@ -0,0 +1,85 @@ +{{- if not .Values.storage.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "dragonfly.fullname" . }} + labels: + {{- include "dragonfly.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "dragonfly.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "dragonfly.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "dragonfly.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} +{{- if .Values.initContainers }} + initContainers: {{- toYaml .Values.initContainers | nindent 6 }} + {{- if .Values.resources }} + resources: + {{- toYaml .Values.resources | nindent 10 }} + {{- end }} + {{- if .Values.extraVolumeMounts }} + volumeMounts: + {{- toYaml .Values.extraVolumeMounts | nindent 10 }} + {{- end }} +{{- end }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: dragonfly + containerPort: 6379 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: dragonfly + readinessProbe: + httpGet: + path: / + port: dragonfly + args: + - "--alsologtostderr" + {{- if .Values.extraArgs }} + {{- toYaml .Values.extraArgs | nindent 12 }} + {{- end }} + resources: + {{- toYaml .Values.resources | nindent 12 }} +{{- if .Values.extraVolumeMounts }} + volumeMounts: + {{- toYaml .Values.extraVolumeMounts | nindent 12 }} +{{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- if .Values.extraVolumes }} + volumes: + {{- toYaml .Values.extraVolumes | nindent 8 }} +{{- end }} +{{- end }} diff --git a/contrib/charts/dragonfly/templates/service.yaml b/contrib/charts/dragonfly/templates/service.yaml new file mode 100644 index 0000000..c555d33 --- /dev/null +++ b/contrib/charts/dragonfly/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "dragonfly.fullname" . }} + labels: + {{- include "dragonfly.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: dragonfly + protocol: TCP + name: dragonfly + selector: + {{- include "dragonfly.selectorLabels" . | nindent 4 }} diff --git a/contrib/charts/dragonfly/templates/serviceaccount.yaml b/contrib/charts/dragonfly/templates/serviceaccount.yaml new file mode 100644 index 0000000..deef7e3 --- /dev/null +++ b/contrib/charts/dragonfly/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "dragonfly.serviceAccountName" . }} + labels: + {{- include "dragonfly.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/contrib/charts/dragonfly/templates/statefulset.yaml b/contrib/charts/dragonfly/templates/statefulset.yaml new file mode 100644 index 0000000..7c6e174 --- /dev/null +++ b/contrib/charts/dragonfly/templates/statefulset.yaml @@ -0,0 +1,99 @@ +{{- if .Values.storage.enabled }} +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ include "dragonfly.fullname" . }} + labels: + {{- include "dragonfly.labels" . | nindent 4 }} +spec: + serviceName: {{ .Release.Name }} + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "dragonfly.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "dragonfly.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "dragonfly.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} +{{- if .Values.initContainers }} + initContainers: {{- toYaml .Values.initContainers | nindent 6 }} + {{- if .Values.resources }} + resources: + {{- toYaml .Values.resources | nindent 10 }} + {{- end }} + volumeMounts: + - mountPath: /data + name: "{{ .Release.Name }}-data" + {{- if .Values.extraVolumeMounts }} + {{- toYaml .Values.extraVolumeMounts | nindent 10 }} + {{- end }} +{{- end }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: dragonfly + containerPort: 6379 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: dragonfly + readinessProbe: + httpGet: + path: / + port: dragonfly + args: + - "--alsologtostderr" + {{- if .Values.extraArgs }} + {{- toYaml .Values.extraArgs | nindent 12 }} + {{- end }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - mountPath: /data + name: "{{ .Release.Name }}-data" +{{- if .Values.extraVolumeMounts }} + {{- toYaml .Values.extraVolumeMounts | nindent 12 }} +{{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- if .Values.extraVolumes }} + volumes: + {{- toYaml .Values.extraVolumes | nindent 8 }} +{{- end }} + volumeClaimTemplates: + - metadata: + name: "{{ .Release.Name }}-data" + spec: + accessModes: [ "ReadWriteOnce" ] + storageClassName: {{ .Values.storage.storageClassName }} + resources: + requests: + storage: {{ .Values.storage.requests }} +{{- end }} diff --git a/contrib/charts/dragonfly/values.yaml b/contrib/charts/dragonfly/values.yaml new file mode 100644 index 0000000..88cdbf1 --- /dev/null +++ b/contrib/charts/dragonfly/values.yaml @@ -0,0 +1,93 @@ +# Default values for dragonfly. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +# -- Number of replicas to deploy +replicaCount: 1 + +image: + # -- Container Image Registry to pull the image from + repository: docker.dragonflydb.io/dragonflydb/dragonfly + # -- Dragonfly image pull policy + pullPolicy: IfNotPresent + # -- Overrides the image tag whose default is the chart appVersion. + tag: "latest" # TODO: remove as soon as there's a properly tagged image available + +# -- Container Registry Secret names in an array +imagePullSecrets: [] + +# -- String to partially override dragonfly.fullname +nameOverride: "" + +# -- String to fully override dragonfly.fullname +fullnameOverride: "" + +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: "" + +# -- Annotations for pods +podAnnotations: {} + +# -- Set securityContext for pod itself +podSecurityContext: {} + # fsGroup: 2000 + +# -- Set securityContext for containers +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + # -- Service type to provision. Can be NodePort, ClusterIP or LoadBalancer + type: ClusterIP + # -- Dragonfly service port + port: 6379 + +storage: + # -- If /data should persist. This will provision a StatefulSet instead. + enabled: false + # -- Global StorageClass for Persistent Volume(s) + storageClassName: "" + # -- Volume size to request for the PVC + requests: 128Mi + +# -- Extra arguments to pass to the dragonfly binary +extraArgs: [] + +# -- Extra volumes to mount into the pods +extraVolumes: [] + +# -- Extra volume mounts corresponding to the volumes mounted above +extraVolumeMounts: [] + +# -- A list of initContainers to run before each pod starts +initContainers: [] + +resources: + # -- The requested resources for the containers + requests: {} + # cpu: 100m + # memory: 128Mi + # -- The resource limits for the containers + limits: {} + # cpu: 100m + # memory: 128Mi + +# -- Node labels for pod assignment +nodeSelector: {} + +# -- Tolerations for pod assignment +tolerations: [] + +# -- Affinity for pod assignment +affinity: {}