Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add charts for shlink and shlink-web #1370

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions charts/shlink-web/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v2
name: shlink-web
description: A Helm chart to deploy shlink-web
icon: https://shlink.io/favicon.svg
type: application
version: 0.1.0
appVersion: 4.3.0
home: https://shlink.io
sources:
- https://github.com/shlinkio/shlink-web-client/tree/main
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: The URL could be canonicalized

Suggested change
- https://github.com/shlinkio/shlink-web-client/tree/main
- https://github.com/shlinkio/shlink-web-client/

- https://github.com/adfinis/helm-charts/tree/main/charts/shlink-web
jon4hz marked this conversation as resolved.
Show resolved Hide resolved
maintainers:
- name: adfinis
email: [email protected]
url: https://adfinis.com
annotations:
artifacthub.io/changes: |
- kind: added
description: "Initial release"
61 changes: 61 additions & 0 deletions charts/shlink-web/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 63 additions & 0 deletions charts/shlink-web/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "shlink-web.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 "shlink-web.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 "shlink-web.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "shlink-web.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "shlink-web.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
68 changes: 68 additions & 0 deletions charts/shlink-web/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "shlink-web.fullname" . }}
labels:
{{- include "shlink-web.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "shlink-web.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "shlink-web.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "shlink-web.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 }}
env:
- name: SHLINK_SERVER_URL
value: {{ .Values.env.SHLINK_SERVER_URL | quote }}
- name: SHLINK_SERVER_NAME
value: {{ .Values.env.SHLINK_SERVER_NAME | quote }}
{{- if .Values.externalSecret.enabled }}
- name: SHLINK_SERVER_API_KEY
valueFrom:
secretKeyRef:
name: {{ .Values.externalSecret.name | quote }}
key: {{ .Values.externalSecret.key | quote }}
{{- else }}
- name: SHLINK_SERVER_API_KEY
value: {{ .Values.env.SHLINK_SERVER_API_KEY | quote }}
{{- end }}
ports:
- name: http
containerPort: 8080
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
initialDelaySeconds: 30
periodSeconds: 60
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
49 changes: 49 additions & 0 deletions charts/shlink-web/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "shlink-web.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 "shlink-web.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
ingressClassName: {{ .Values.ingress.className }}
tls:
- hosts:
- {{ .Values.env.DOMAIN_NAME }}
secretName: {{ .Values.env.DOMAIN_NAME }}
rules:
- host: {{ .Values.env.DOMAIN_NAME }}
http:
paths:
- path: /
{{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
pathType: ImplementationSpecific
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
15 changes: 15 additions & 0 deletions charts/shlink-web/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "shlink-web.fullname" . }}
labels:
{{- include "shlink-web.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "shlink-web.selectorLabels" . | nindent 4 }}
12 changes: 12 additions & 0 deletions charts/shlink-web/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "shlink-web.serviceAccountName" . }}
labels:
{{- include "shlink-web.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end -}}
77 changes: 77 additions & 0 deletions charts/shlink-web/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Default values for shlink-web.

replicaCount: 1

image:
# -- Shlink Web image name
repository: ghcr.io/shlinkio/shlink-web-client
# -- Shlink Web image pull policy
pullPolicy: IfNotPresent

env:
# -- Shlink Web domain
DOMAIN_NAME: shlink.io
# -- Shlink API URL
SHLINK_SERVER_URL: https://shlink.io
# -- Shlink API Key
SHLINK_SERVER_API_KEY: ""
# -- Shlink Server Name
SHLINK_SERVER_NAME: Shlink

externalSecret:
# -- Specifies whether an external secret should be used
enabled: false
# -- Name of the secret containing the API key
name: shlink-api-key
# -- Key in the secret containing the API key
key: shlink-api-key

serviceAccount:
# -- Specifies whether a service account should be created
create: false
# -- 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 of the service account
name:

podSecurityContext: {}
# fsGroup: 2000

securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000

service:
# -- Shlink Web service type
type: ClusterIP
# -- Shlink Web service port
port: 80

ingress:
# -- Enable ingress for shlink web
enabled: false
# -- Ingress class name
className: nginx
# -- Ingress annotations
annotations: {}


resources: {}
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

nodeSelector: {}

tolerations: []

affinity: {}
6 changes: 6 additions & 0 deletions charts/shlink/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: 16.3.4
digest: sha256:e47096b5845be86703bf083d6a44cfb0d7513d9fac02ec1789930aade318e309
generated: "2024-12-24T10:56:01.222789714+01:00"
Loading
Loading