Compare commits

...

1 Commits

Author SHA1 Message Date
Andrei Kvapil
215105ae36 Guacamole
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2024-09-09 23:18:33 +02:00
17 changed files with 667 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
apiVersion: v2
name: cozy-guacamole
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process

View File

@@ -0,0 +1,5 @@
update:
rm -rf charts
helm repo add beryju https://charts.beryju.io
helm repo update beryju
helm pull beryju/guacamole --untar --untardir charts

View File

@@ -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
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
README.md.gotmpl

View File

@@ -0,0 +1,14 @@
apiVersion: v1
appVersion: 1.5.5
description: Apache Guacamole is a clientless remote desktop gateway. It supports
standard protocols like VNC, RDP, and SSH.
icon: http://guacamole.apache.org/images/guacamole-logo-64.png
maintainers:
- email: helm@gavinmogan.com
name: Gavin Mogan
- email: jens@beryju.org
name: Jens Langhammer
name: guacamole
sources:
- http://guacamole.apache.org/
version: 1.4.1

View File

@@ -0,0 +1,84 @@
guacamole
=========
## TL;DR;
```console
$ helm repo add beryju https://charts.beryju.io
$ helm install guacamole beryju/guacamole
```
Apache Guacamole is a clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH.
This is a fork of https://artifacthub.io/packages/helm/halkeye/guacamole, but updated to support newer versions and more settings.
### Dependencies
This chart has a dependency on ``postgresql`` to be up and running _before_ this chart is deployed. The init-container will not fail if the ``postgresql`` service is not found.
Sample ``postgresql`` install which works with the defaults of this chart:
```console
helm install postgresql bitnami/postgresql \
--set auth.username=guacamole \
--set auth.password=password \
--set auth.postgresPassword=password \
--set auth.database=guacamole --wait
```
## Changelog
1.3.3 - Fixed ingress api and documented postgresql dependency
1.2.3 - Make guacamole run in ROOT context
0.2.3 - Add support for custom envs
0.2.2 - Update liveness and readiness probe path
0.2.1 - helm-docs doesn't add a tl;dr section, so add it manually
0.2.0 - Apparently I didn't actually use it before, i was running an old copy
* Fixed services to expose the ports properly
* Auto create the db on init if possible
## Chart Values
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | |
| dbcreation.image.pullPolicy | string | `"IfNotPresent"` | |
| dbcreation.image.repository | string | `"bitnami/postgresql"` | |
| dbcreation.image.tag | string | `"11.7.0-debian-10-r9"` | |
| fullnameOverride | string | `""` | |
| guacamole.image.pullPolicy | string | `"IfNotPresent"` | |
| guacamole.image.repository | string | `"guacamole/guacamole"` | |
| guacamole.image.tag | string | `"{{ .Chart.AppVersion }}"` | |
| guacd.image.pullPolicy | string | `"IfNotPresent"` | |
| guacd.image.repository | string | `"guacamole/guacd"` | |
| guacd.image.tag | string | `"{{ .Chart.AppVersion }}"` | |
| imagePullSecrets | list | `[]` | |
| ingress.annotations | object | `{}` | |
| ingress.enabled | bool | `false` | |
| ingress.hosts[0].host | string | `"chart-example.local"` | |
| ingress.hosts[0].paths | list | `[]` | |
| ingress.tls | list | `[]` | |
| nameOverride | string | `""` | |
| nodeSelector | object | `{}` | |
| podSecurityContext | object | `{}` | |
| postgres.database | string | `"guacamole"` | |
| postgres.hostname | string | `"postgresql"` | |
| postgres.password | string | `"password"` | |
| postgres.port | string | `"5432"` | |
| postgres.user | string | `"guacamole"` | |
| replicaCount | int | `1` | |
| resources | object | `{}` | |
| securityContext | object | `{}` | |
| service.port | int | `80` | |
| service.type | string | `"ClusterIP"` | |
| serviceAccount.create | bool | `true` | |
| serviceAccount.name | string | `nil` | |
| tolerations | list | `[]` | |

View File

@@ -0,0 +1,21 @@
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 }}{{ . }}
{{- 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 "guacamole.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 "guacamole.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "guacamole.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 "guacamole.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:80
{{- end }}

View File

@@ -0,0 +1,56 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "guacamole.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 "guacamole.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 "guacamole.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "guacamole.labels" -}}
app.kubernetes.io/name: {{ include "guacamole.name" . }}
helm.sh/chart: {{ include "guacamole.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
{{/*
Create the name of the service account to use
*/}}
{{- define "guacamole.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "guacamole.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

View File

@@ -0,0 +1,186 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "guacamole.fullname" . }}-guacamole
labels:
{{ include "guacamole.labels" . | indent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "guacamole.name" . }}-guacamole
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "guacamole.name" . }}-guacamole
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
{{- with .Values.guacamole.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
dnsConfig:
options:
- name: ndots
value: "1"
serviceAccountName: {{ template "guacamole.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
- name: create-init-db
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.guacamole.image.repository }}:{{ tpl .Values.guacamole.image.tag . }}"
imagePullPolicy: {{ .Values.guacamole.image.pullPolicy }}
envFrom:
- secretRef:
name: {{ include "guacamole.fullname" . }}
env:
- name: POSTGRES_HOSTNAME
valueFrom:
secretKeyRef:
name: guacamole-db-app
key: host
- name: POSTGRES_PORT
valueFrom:
secretKeyRef:
name: guacamole-db-app
key: port
- name: POSTGRES_DATABASE
valueFrom:
secretKeyRef:
name: guacamole-db-app
key: dbname
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: guacamole-db-app
key: user
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: guacamole-db-app
key: password
volumeMounts:
- name: initdb
mountPath: /data
command: ["/bin/sh"]
args:
- -c
- |
/opt/guacamole/bin/initdb.sh --postgresql > /data/initdb.sql
resources:
{{- toYaml .Values.resources | nindent 12 }}
- name: loaddb
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.dbcreation.image.repository }}:{{ .Values.dbcreation.image.tag }}"
imagePullPolicy: {{ .Values.dbcreation.image.pullPolicy }}
envFrom:
- secretRef:
name: {{ include "guacamole.fullname" . }}
env:
- name: POSTGRES_HOSTNAME
valueFrom:
secretKeyRef:
name: guacamole-db-app
key: host
- name: POSTGRES_PORT
valueFrom:
secretKeyRef:
name: guacamole-db-app
key: port
- name: POSTGRES_DATABASE
valueFrom:
secretKeyRef:
name: guacamole-db-app
key: dbname
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: guacamole-db-app
key: user
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: guacamole-db-app
key: password
volumeMounts:
- name: initdb
mountPath: /data
command: ["/bin/sh"]
args:
- -c
- |
export PGPASSWORD=$POSTGRES_PASSWORD
# most likely already created, so don't fail, just log and move on
psql -h $POSTGRES_HOSTNAME -d $POSTGRES_DATABASE -U $POSTGRES_USER -p $POSTGRES_PORT -a -w -f /data/initdb.sql || true
resources:
{{- toYaml .Values.resources | nindent 12 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.guacamole.image.repository }}:{{ tpl .Values.guacamole.image.tag . }}"
imagePullPolicy: {{ .Values.guacamole.image.pullPolicy }}
envFrom:
- secretRef:
name: {{ include "guacamole.fullname" . }}
env:
- name: POSTGRES_HOSTNAME
valueFrom:
secretKeyRef:
name: guacamole-db-app
key: host
- name: POSTGRES_PORT
valueFrom:
secretKeyRef:
name: guacamole-db-app
key: port
- name: POSTGRES_DATABASE
valueFrom:
secretKeyRef:
name: guacamole-db-app
key: dbname
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: guacamole-db-app
key: user
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: guacamole-db-app
key: password
ports:
- name: http
containerPort: 8080
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
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 }}
volumes:
- name: initdb
emptyDir: {}

View File

@@ -0,0 +1,57 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "guacamole.fullname" . }}-guacd
labels:
{{ include "guacamole.labels" . | indent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "guacamole.name" . }}-guacd
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "guacamole.name" . }}-guacd
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
{{- with .Values.guacd.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
dnsConfig:
options:
- name: ndots
value: "1"
serviceAccountName: {{ template "guacamole.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.guacd.image.repository }}:{{ tpl .Values.guacd.image.tag . }}"
imagePullPolicy: {{ .Values.guacd.image.pullPolicy }}
envFrom:
- secretRef:
name: {{ include "guacamole.fullname" . }}
ports:
- name: guacd
containerPort: 4822
protocol: TCP
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 }}

View File

@@ -0,0 +1,43 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "guacamole.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{ include "guacamole.labels" . | indent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.className }}
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: {{ . }}
backend:
service:
name: {{ $fullName }}-guacamole
port:
number: {{ $svcPort }}
pathType: Prefix
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,14 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "guacamole.fullname" . }}
labels:
{{ include "guacamole.labels" . | indent 4 }}
type: Opaque
data:
GUACD_HOSTNAME: {{ printf "%s-%s" (include "guacamole.name" .) "guacd" | b64enc | quote }}
GUACD_PORT: {{ "4822" | b64enc | quote }}
WEBAPP_CONTEXT: {{ "ROOT" | b64enc | quote }}
{{- range $key, $value := .Values.guacamole.settings }}
{{ $key }}: {{ $value | b64enc | quote }}
{{- end }}

View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "guacamole.fullname" . }}-guacamole
labels:
{{ include "guacamole.labels" . | indent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
app.kubernetes.io/name: {{ include "guacamole.name" . }}-guacamole
app.kubernetes.io/instance: {{ .Release.Name }}

View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "guacamole.fullname" . }}-guacd
labels:
{{ include "guacamole.labels" . | indent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: 4822
targetPort: guacd
protocol: TCP
name: guacd
selector:
app.kubernetes.io/name: {{ include "guacamole.name" . }}-guacd
app.kubernetes.io/instance: {{ .Release.Name }}

View File

@@ -0,0 +1,8 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "guacamole.serviceAccountName" . }}
labels:
{{ include "guacamole.labels" . | indent 4 }}
{{- end -}}

View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "guacamole.fullname" . }}-test-connection"
labels:
{{ include "guacamole.labels" . | indent 4 }}
annotations:
"helm.sh/hook": test-success
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "guacamole.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never

View File

@@ -0,0 +1,94 @@
# Default values for guacamole.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
guacamole:
image:
repository: guacamole/guacamole
tag: "{{ .Chart.AppVersion }}"
pullPolicy: IfNotPresent
# Key-value settings directly passed as environment variables
settings: {}
guacd:
image:
repository: guacamole/guacd
tag: "{{ .Chart.AppVersion }}"
pullPolicy: IfNotPresent
dbcreation:
image:
repository: bitnami/postgresql
tag: 14.3.0-debian-10-r9
pullPolicy: IfNotPresent
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
serviceAccount:
# Specifies whether a service account should be created
create: true
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name:
podSecurityContext:
{}
# fsGroup: 2000
securityContext:
{}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
service:
type: ClusterIP
port: 80
ingress:
enabled: false
className: null
annotations:
{}
# kubernetes.io/ingress.class: nginx
hosts:
- host: chart-example.local
paths: []
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
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: {}
tolerations: []
affinity: {}
postgres:
hostname: "postgresql"
port: "5432"
database: "guacamole"
user: "guacamole"
password: "password"

View File

@@ -0,0 +1,12 @@
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: guacamole-db
spec:
instances: 2
storage:
size: 10Gi
inheritedMetadata:
labels:
policy.cozystack.io/allow-to-apiserver: "true"