diff --git a/k8s/helm/nextcloud/.helmignore b/k8s/helm-deprecated/nextcloud/.helmignore similarity index 100% rename from k8s/helm/nextcloud/.helmignore rename to k8s/helm-deprecated/nextcloud/.helmignore diff --git a/k8s/helm/nextcloud/Chart.yaml b/k8s/helm-deprecated/nextcloud/Chart.yaml similarity index 100% rename from k8s/helm/nextcloud/Chart.yaml rename to k8s/helm-deprecated/nextcloud/Chart.yaml diff --git a/k8s/helm/nextcloud/templates/NOTES.txt b/k8s/helm-deprecated/nextcloud/templates/NOTES.txt similarity index 100% rename from k8s/helm/nextcloud/templates/NOTES.txt rename to k8s/helm-deprecated/nextcloud/templates/NOTES.txt diff --git a/k8s/helm/nextcloud/templates/app.yaml b/k8s/helm-deprecated/nextcloud/templates/app.yaml similarity index 100% rename from k8s/helm/nextcloud/templates/app.yaml rename to k8s/helm-deprecated/nextcloud/templates/app.yaml diff --git a/k8s/helm/nextcloud/templates/configmap.yaml b/k8s/helm-deprecated/nextcloud/templates/configmap.yaml similarity index 100% rename from k8s/helm/nextcloud/templates/configmap.yaml rename to k8s/helm-deprecated/nextcloud/templates/configmap.yaml diff --git a/k8s/helm/nextcloud/templates/redis-deployment.yaml b/k8s/helm-deprecated/nextcloud/templates/redis-deployment.yaml similarity index 100% rename from k8s/helm/nextcloud/templates/redis-deployment.yaml rename to k8s/helm-deprecated/nextcloud/templates/redis-deployment.yaml diff --git a/k8s/helm/nextcloud/templates/redis-service.yaml b/k8s/helm-deprecated/nextcloud/templates/redis-service.yaml similarity index 100% rename from k8s/helm/nextcloud/templates/redis-service.yaml rename to k8s/helm-deprecated/nextcloud/templates/redis-service.yaml diff --git a/k8s/helm/nextcloud/templates/tests/test-connection.yaml b/k8s/helm-deprecated/nextcloud/templates/tests/test-connection.yaml similarity index 100% rename from k8s/helm/nextcloud/templates/tests/test-connection.yaml rename to k8s/helm-deprecated/nextcloud/templates/tests/test-connection.yaml diff --git a/k8s/helm/nextcloud/values.yaml b/k8s/helm-deprecated/nextcloud/values.yaml similarity index 100% rename from k8s/helm/nextcloud/values.yaml rename to k8s/helm-deprecated/nextcloud/values.yaml diff --git a/k8s/helm/apache/.helmignore b/k8s/helm/apache/.helmignore new file mode 100644 index 00000000..839de881 --- /dev/null +++ b/k8s/helm/apache/.helmignore @@ -0,0 +1,2 @@ +*~ +.git diff --git a/k8s/helm/apache/Chart.yaml b/k8s/helm/apache/Chart.yaml new file mode 100644 index 00000000..48db7dcc --- /dev/null +++ b/k8s/helm/apache/Chart.yaml @@ -0,0 +1,14 @@ +apiVersion: v2 +name: apache +description: apache httpd +home: https://github.com/instantlinux/docker-tools +sources: +- https://github.com/instantlinux/docker-tools +- https://github.com/apache/httpd +type: application +version: 0.1.0 +appVersion: "2.4.68" +dependencies: +- name: chartlib + version: 0.1.8 + repository: https://instantlinux.github.io/docker-tools diff --git a/k8s/helm/apache/templates/NOTES.txt b/k8s/helm/apache/templates/NOTES.txt new file mode 100644 index 00000000..62ea3f4b --- /dev/null +++ b/k8s/helm/apache/templates/NOTES.txt @@ -0,0 +1,28 @@ +{{- if hasKey .Values "service" }} +{{- if or .Values.service.enabled (not (hasKey .Values.service "enabled")) }} +1. Get the application URL by running these commands: +{{- if hasKey .Values "ingress" }} +{{- 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 "local.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 "local.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "local.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 "local.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 }} +{{- end }} +{{- end }} +{{- end }} diff --git a/k8s/helm/apache/templates/app.yaml b/k8s/helm/apache/templates/app.yaml new file mode 100644 index 00000000..5a01911b --- /dev/null +++ b/k8s/helm/apache/templates/app.yaml @@ -0,0 +1,15 @@ +{{- include "chartlib.configmap" . }} +--- +{{- include "chartlib.deployment" . }} +--- +{{- include "chartlib.hpa" . }} +--- +{{- include "chartlib.ingress" . }} +--- +{{- include "chartlib.ingresstotp" . }} +--- +{{- include "chartlib.service" . }} +--- +{{- include "chartlib.serviceaccount" . }} +--- +{{- include "chartlib.statefulset" . }} diff --git a/k8s/helm/apache/templates/tests/test-connection.yaml b/k8s/helm/apache/templates/tests/test-connection.yaml new file mode 100644 index 00000000..ae159a4f --- /dev/null +++ b/k8s/helm/apache/templates/tests/test-connection.yaml @@ -0,0 +1,17 @@ +{{- if hasKey .Values "service" }} +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "local.fullname" . }}-test-connection" + labels: + {{- include "local.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "local.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never +{{- end }} diff --git a/k8s/helm/apache/values.yaml b/k8s/helm/apache/values.yaml new file mode 100644 index 00000000..759c1f21 --- /dev/null +++ b/k8s/helm/apache/values.yaml @@ -0,0 +1,119 @@ +# Default values for apache. + +# This is a general-purpose helm chart; the configmap below provides +# an example use-case for WebDAV as described by +# https://simonh.uk/2021/12/25/a-guide-to-setting-up-webdav-with-apache-httpd/ +tlsHostname: apache.example.com + +deployment: + command: ["/bin/sh", "-c"] + args: + - | + APACHE_ROOT=/usr/local/apache2/conf + echo "Include $APACHE_ROOT/custom.conf" >> $APACHE_ROOT/httpd.conf + echo "Include $APACHE_ROOT/extras.conf" >> $APACHE_ROOT/httpd.conf + exec httpd-foreground + containerPorts: + - containerPort: 80 +volumeMounts: +- mountPath: /usr/local/apache2/conf/custom.conf + name: config + readOnly: true + subPath: custom.conf +- mountPath: /usr/local/apache2/conf/extras.conf + name: config + readOnly: true + subPath: extras.conf +- mountPath: /usr/local/apache2/htdocs + name: share + subPath: apache/data +- mountPath: /usr/local/apache2/var + name: share + subPath: apache/var +volumes: +- name: config + configMap: + name: apache +- name: share + hostPath: { path: /var/lib/docker/k8s-volumes/share } + +image: + repository: httpd + pullPolicy: IfNotPresent + # tag: default + +nameOverride: "" +fullnameOverride: "" + +serviceAccount: {} +service: + clusterIP: None + ports: + - { port: 80, targetPort: 80, name: apache } + type: ClusterIP + +ingress: + enabled: true + className: "" + annotations: + cert-manager.io/cluster-issuer: letsencrypt-prod + kubernetes.io/ingress.class: nginx + nginx.ingress.kubernetes.io/enable-access-log: "false" + nginx.ingress.kubernetes.io/proxy-body-size: "50m" + nginx.ingress.kubernetes.io/ssl-redirect: "false" + +autoscaling: + enabled: false + +configmap: + data: + custom.conf: | + # Custom directives defined via kubernetes configmap + LoadModule authn_dbm_module modules/mod_authn_dbm.so + LoadModule authz_dbm_module modules/mod_authz_dbm.so + LoadModule dav_module modules/mod_dav.so + LoadModule dav_fs_module modules/mod_dav_fs.so + LoadModule macro_module modules/mod_macro.so + + DavLockDB /usr/local/apache2/var/DavLock + + DocumentRoot "/usr/local/apache2/htdocs" + + # Directory Listing Display Options + IndexOptions +FancyIndexing + IndexOptions +VersionSort + IndexOptions +HTMLTable + IndexOptions +FoldersFirst + IndexOptions +IconsAreLinks + IndexOptions +IgnoreCase + IndexOptions +XHTML + IndexOptions +NameWidth=* + IndexOptions +SuppressDescription + IndexOptions +SuppressHTMLPreamble + IndexOptions +Charset=UTF-8 + # Make it responsive + IndexHeadInsert "" + + + Alias /$alias /usr/local/apache2/htdocs/webdav/$alias + + DAV On + AuthType Basic + AuthName "webdav" + AuthBasicProvider dbm + AuthDBMUserFile "/usr/local/apache2/var/users.dbm" + AuthDBMGroupFile "/usr/local/apache2/var/users.dbm" + Require dbm-group admin $alias + + Require valid-user + + + + + Options ExecCGI + SetHandler cgi-script + DirectoryIndex + + + extras.conf: + Use WebDAVShare user1 diff --git a/k8s/helm/instances/webdav b/k8s/helm/instances/webdav new file mode 120000 index 00000000..6cadf428 --- /dev/null +++ b/k8s/helm/instances/webdav @@ -0,0 +1 @@ +../apache \ No newline at end of file