Skip to content
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
File renamed without changes.
2 changes: 2 additions & 0 deletions k8s/helm/apache/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*~
.git
14 changes: 14 additions & 0 deletions k8s/helm/apache/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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
28 changes: 28 additions & 0 deletions k8s/helm/apache/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -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 }}
15 changes: 15 additions & 0 deletions k8s/helm/apache/templates/app.yaml
Original file line number Diff line number Diff line change
@@ -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" . }}
17 changes: 17 additions & 0 deletions k8s/helm/apache/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
119 changes: 119 additions & 0 deletions k8s/helm/apache/values.yaml
Original file line number Diff line number Diff line change
@@ -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 "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">"

<Macro WebDAVShare $alias>
Alias /$alias /usr/local/apache2/htdocs/webdav/$alias
<Directory /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
<LimitExcept GET HEAD OPTIONS PROPFIND>
Require valid-user
</LimitExcept>
</Directory>

<Directory /usr/local/apache2/htdocs/webdav/$alias/cgi-bin/*>
Options ExecCGI
SetHandler cgi-script
DirectoryIndex
</Directory>
</Macro>
extras.conf:
Use WebDAVShare user1
1 change: 1 addition & 0 deletions k8s/helm/instances/webdav
Loading