diff --git a/charts/dragonfly-mastodon-deploy/.helmignore b/charts/dragonfly-mastodon-deploy/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/dragonfly-mastodon-deploy/.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/charts/dragonfly-mastodon-deploy/Chart.yaml b/charts/dragonfly-mastodon-deploy/Chart.yaml new file mode 100644 index 0000000..bb2fda5 --- /dev/null +++ b/charts/dragonfly-mastodon-deploy/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: dragonfly-mastodon-deploy +description: Dragonfly deployments for a Mastodon app. + +# 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.2.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: "v1.31.2" diff --git a/charts/dragonfly-mastodon-deploy/templates/_helpers.tpl b/charts/dragonfly-mastodon-deploy/templates/_helpers.tpl new file mode 100644 index 0000000..a19be1c --- /dev/null +++ b/charts/dragonfly-mastodon-deploy/templates/_helpers.tpl @@ -0,0 +1,46 @@ +{{/* +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" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/name: dragonfly +app.kubernetes.io/instance: {{ include "dragonfly.fullname" . }} +app.kubernetes.io/part-of: dragonfly-operator +app.kubernetes.io/created-by: dragonfly-operator +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} diff --git a/charts/dragonfly-mastodon-deploy/templates/dragonfly-app.yml b/charts/dragonfly-mastodon-deploy/templates/dragonfly-app.yml new file mode 100644 index 0000000..327e1b5 --- /dev/null +++ b/charts/dragonfly-mastodon-deploy/templates/dragonfly-app.yml @@ -0,0 +1,47 @@ +apiVersion: dragonflydb.io/v1alpha1 +kind: Dragonfly +metadata: + {{- if .Values.separate }} + name: {{ include "dragonfly.fullname" . }}-app + {{- else }} + name: {{ include "dragonfly.fullname" . }}-app-sidekiq + {{- end }} + labels: + {{- include "dragonfly.labels" . | nindent 4 }} + {{- with .Values.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + {{- if .Values.nodeSelector }} + nodeSelector: + {{- with .Values.nodeSelector }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- end }} + replicas: {{ .Values.replicas }} + args: + - "--dbfilename=dragonflydbSnapshot" + {{- with .Values.args }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- if .Values.authentication.secret }} + authentication: + passwordFromSecret: + name: {{ .Values.authentication.secret }} + key: {{ .Values.authentication.key }} + {{- end }} + snapshot: + cron: "{{ .Values.snapshot.cron }}" + persistentVolumeClaimSpec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ .Values.snapshot.storage }} + {{- if .Values.resources }} + resources: + {{- with .Values.resources }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- end }} diff --git a/charts/dragonfly-mastodon-deploy/templates/dragonfly-cache.yml b/charts/dragonfly-mastodon-deploy/templates/dragonfly-cache.yml new file mode 100644 index 0000000..42b47d0 --- /dev/null +++ b/charts/dragonfly-mastodon-deploy/templates/dragonfly-cache.yml @@ -0,0 +1,43 @@ +apiVersion: dragonflydb.io/v1alpha1 +kind: Dragonfly +metadata: + name: {{ include "dragonfly.fullname" . }}-cache + labels: + {{- include "dragonfly.labels" . | nindent 4 }} + {{- with .Values.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + {{- if .Values.nodeSelector }} + nodeSelector: + {{- with .Values.nodeSelector }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- end }} + replicas: {{ .Values.replicas }} + args: + - "--dbfilename=dragonflydbSnapshot" + {{- with .Values.args }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- if .Values.authentication.secret }} + authentication: + passwordFromSecret: + name: {{ .Values.authentication.secret }} + key: {{ .Values.authentication.key }} + {{- end }} + snapshot: + cron: "{{ .Values.snapshot.cron }}" + persistentVolumeClaimSpec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ .Values.snapshot.storage }} + {{- if .Values.resources }} + resources: + {{- with .Values.resources }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- end }} diff --git a/charts/dragonfly-mastodon-deploy/templates/dragonfly-sidekiq.yml b/charts/dragonfly-mastodon-deploy/templates/dragonfly-sidekiq.yml new file mode 100644 index 0000000..c19e451 --- /dev/null +++ b/charts/dragonfly-mastodon-deploy/templates/dragonfly-sidekiq.yml @@ -0,0 +1,45 @@ +{{- if .Values.separate }} +apiVersion: dragonflydb.io/v1alpha1 +kind: Dragonfly +metadata: + name: {{ include "dragonfly.fullname" . }}-sidekiq + labels: + {{- include "dragonfly.labels" . | nindent 4 }} + {{- with .Values.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + {{- if .Values.nodeSelector }} + nodeSelector: + {{- with .Values.nodeSelector }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- end }} + replicas: {{ .Values.replicas }} + args: + - "--dbfilename=dragonflydbSnapshot" + {{- with .Values.args }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- if .Values.authentication.secret }} + authentication: + passwordFromSecret: + name: {{ .Values.authentication.secret }} + key: {{ .Values.authentication.key }} + {{- end }} + snapshot: + cron: "{{ .Values.snapshot.cron }}" + persistentVolumeClaimSpec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ .Values.snapshot.storage }} + {{- if .Values.resources }} + resources: + {{- with .Values.resources }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/dragonfly-mastodon-deploy/values.yaml b/charts/dragonfly-mastodon-deploy/values.yaml new file mode 100644 index 0000000..1ca7a1d --- /dev/null +++ b/charts/dragonfly-mastodon-deploy/values.yaml @@ -0,0 +1,45 @@ +# Default values for dragonfly. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +# Number of replicas for each dragonfly cluster. +replicas: 1 + +image: + repository: ghcr.io/dragonflydb/dragonfly + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +nameOverride: "" +fullnameOverride: "" + +# Whether to enable password authentication. +authentication: + secret: + key: password + +# Whether we should use separate dragonflies for app and sidekiq +separate: false + +# Regular snapshot backups to be made to an attached volume. +snapshot: + cron: "*/5 * * * *" # Every 5 minutes + storage: 20Gi + +# Additional arguments to add to the process. +args: [] + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {}