Skip to content

Commit

Permalink
Gotosocial Chart Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
0hlov3 committed Apr 20, 2023
1 parent dd4a7cb commit 851a164
Show file tree
Hide file tree
Showing 15 changed files with 1,026 additions and 0 deletions.
5 changes: 5 additions & 0 deletions charts/gotosocial/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Developement Stuff
./values-test.yaml
values-test.yaml
testing/
testing/*
28 changes: 28 additions & 0 deletions charts/gotosocial/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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/
# Developement Stuff
./values-test.yaml
values-test.yaml
testing/
testing/*
6 changes: 6 additions & 0 deletions charts/gotosocial/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 11.9.13
digest: sha256:b55a6186717d0cd6e1364a4ca3f9a7deed0e7aa01ee19db2bb50c808b9b1443d
generated: "2023-02-18T20:51:44.444534806+01:00"
29 changes: 29 additions & 0 deletions charts/gotosocial/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: v2
name: gotosocial
description: A Helm chart for Kubernetes
icon: https://docs.gotosocial.org/en/latest/assets/sloth.png
home: https://github.com/superseriousbusiness/gotosocial

type: application
# Chart Version
version: "0.3.7"
# gotosocial version
appVersion: "0.8.0"

maintainers:
- name: 0hlov3
email: dev+github@schoenwald.aero
url: https://schoenwald.aero

dependencies:
- name: postgresql
version: ~11.9.13
repository: https://charts.bitnami.com/bitnami
condition: postgresql.enabled


annotations:
artifacthub.io/containsSecurityUpdates: "false"
artifacthub.io/images: |
- name: gotosocial
image: superseriousbusiness/gotosocial:0.8.0
203 changes: 203 additions & 0 deletions charts/gotosocial/README.md

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions charts/gotosocial/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "gotosocial.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 "gotosocial.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "gotosocial.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 "gotosocial.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 "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}
78 changes: 78 additions & 0 deletions charts/gotosocial/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "gotosocial.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 "gotosocial.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 "gotosocial.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "gotosocial.labels" -}}
helm.sh/chart: {{ include "gotosocial.chart" . }}
{{ include "gotosocial.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "gotosocial.selectorLabels" -}}
app.kubernetes.io/name: {{ include "gotosocial.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "gotosocial.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "gotosocial.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- 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).
*/}}
{{- define "gotosocial.postgresql.fullname" -}}
{{- printf "%s-%s" .Release.Name "postgresql" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Set postgres host
*/}}
{{- define "gotosocial.postgresql.host" -}}
{{- if .Values.postgresql.enabled -}}
{{- template "gotosocial.postgresql.fullname" . -}}
{{- end -}}
{{- end -}}
121 changes: 121 additions & 0 deletions charts/gotosocial/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
{{- $fullName := include "gotosocial.fullname" . -}}
{{- $podAnnotations := .Values.podAnnotations }}
{{- $secretAnnotation := dict "checksum/secrets" (include (print $.Template.BasePath "/secrets.yaml") . | sha256sum) }}
{{- $podAnnotations := merge $podAnnotations $secretAnnotation }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ $fullName }}
labels:
{{- include "gotosocial.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
strategy:
{{- toYaml .Values.gotosocial.strategy | nindent 4 }}
selector:
matchLabels:
{{- include "gotosocial.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with $podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "gotosocial.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "gotosocial.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args: ["--config-path", "/config/config.yaml"]
ports:
- name: gotosocial
containerPort: {{ .Values.service.port }}
protocol: TCP
startupProbe:
httpGet:
path: /
port: gotosocial
failureThreshold: 60
periodSeconds: 10
livenessProbe:
httpGet:
path: /
port: gotosocial
readinessProbe:
httpGet:
path: /
port: gotosocial
failureThreshold: 5
resources:
{{- toYaml .Values.resources | nindent 12 }}
env:
- name: USELESS_ENV_VAR_FOR_HELM
value: "making_templating_easier"
{{- if and .Values.postgresql.enabled .Values.postgresql.auth.existingSecret }}
- name: GTS_DB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.postgresql.auth.existingSecret }}
key: password
{{- end }}
{{- if and .Values.externalPostgresql.enabled .Values.externalPostgresql.existingSecret }}
- name: GTS_DB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.externalPostgresql.existingSecret }}
key: {{ .Values.externalPostgresql.existingSecretPasswordKey }}
{{- end }}
{{- if .Values.gotosocial.config.smtp.existingSecretName }}
- name: GTS_SMTP_PASSWORD
value:
valueFrom:
secretKeyRef:
name: {{ .Values.gotosocial.config.smtp.existingSecretName }}
key: {{ .Values.gotosocial.config.smtp.existingSecretKey }}
{{- end }}
volumeMounts:
- name: gotosocial-config
mountPath: "/config/"
readOnly: true
{{- if .Values.gotosocial.persistence.enabled }}
- name: gotosocial-data
mountPath: "/gotosocial/storage/"
readOnly: false
{{- end }}
volumes:
- name: gotosocial-config
secret:
secretName: {{ $fullName }}
optional: false
#items:
#- key: "config.yaml"
# path: "config.yaml"
{{- if .Values.gotosocial.persistence.enabled }}
- name: gotosocial-data
persistentVolumeClaim:
claimName: {{ $fullName }}-data
{{- 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 }}
61 changes: 61 additions & 0 deletions charts/gotosocial/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "gotosocial.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "gotosocial.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
20 changes: 20 additions & 0 deletions charts/gotosocial/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if .Values.gotosocial.persistence.enabled }}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "gotosocial.fullname" . }}-data
spec:
accessModes:
- {{ .Values.gotosocial.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.gotosocial.persistence.size | quote }}
{{- if .Values.gotosocial.persistence.storageClass }}
{{- if (eq "-" .Values.gotosocial.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.gotosocial.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end }}
Loading

0 comments on commit 851a164

Please sign in to comment.