New approach with helm chart and add gd and opcache
Publish PHP Apache image / Build, test and push (push) Failing after 21s
Publish PHP Apache image / Build, test and push (push) Failing after 21s
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
apiVersion: v2
|
||||
name: php-homepage
|
||||
description: Serve a PHP website from a persistent shared web root
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: latest
|
||||
home: https://code.brunner.ninja/feedc0de/php-apache
|
||||
sources:
|
||||
- https://code.brunner.ninja/feedc0de/php-apache
|
||||
@@ -0,0 +1,61 @@
|
||||
# PHP homepage chart
|
||||
|
||||
This chart runs the unified `php-apache` image with a web root mounted at
|
||||
`/srv/http`. It is intended for sites whose source and mutable application data
|
||||
live on CephFS so the same files are available to the runtime pod and the
|
||||
browser-based development container.
|
||||
|
||||
Published chart packages set `appVersion` to the unique php-apache image tag
|
||||
created in the same CI run. `image.tag` is empty by default and therefore uses
|
||||
that `appVersion`. Keep site-specific values free of image overrides so a chart
|
||||
upgrade also upgrades the runtime image.
|
||||
|
||||
Add and refresh the Gitea chart repository with:
|
||||
|
||||
```sh
|
||||
helm repo add brunner https://code.brunner.ninja/api/packages/feedc0de/helm
|
||||
helm repo update brunner
|
||||
```
|
||||
|
||||
## Existing sites
|
||||
|
||||
Set the existing RWX claim in the site's values file:
|
||||
|
||||
```yaml
|
||||
fullnameOverride: example-site
|
||||
|
||||
persistence:
|
||||
existingClaim: example-site
|
||||
```
|
||||
|
||||
When `existingClaim` is set, the chart emits no PersistentVolumeClaim. Helm
|
||||
therefore neither owns nor deletes the claim. Deleting the release removes the
|
||||
workload but leaves all website files intact.
|
||||
|
||||
The first installation can adopt a Deployment, Service, and Ingress previously
|
||||
created by `kubectl apply`:
|
||||
|
||||
```sh
|
||||
helm upgrade --install example-site brunner/php-homepage \
|
||||
--namespace default \
|
||||
--values /path/to/example-site/values.yaml \
|
||||
--take-ownership \
|
||||
--wait
|
||||
```
|
||||
|
||||
Review `helm template` or a server-side dry-run before adoption. The release
|
||||
name and `fullnameOverride` must match the existing resource names. The chart's
|
||||
selector remains the legacy `app: <resource-name>` selector so Kubernetes does
|
||||
not reject the Deployment because its selector is immutable.
|
||||
|
||||
## New sites
|
||||
|
||||
With `persistence.existingClaim` empty, the chart creates an RWX PVC using
|
||||
`rook-cephfs`. The PVC has `helm.sh/resource-policy: keep` by default, so an
|
||||
uninstall does not discard site content. Set `persistence.retain: false` only
|
||||
when deleting the release should also delete its dynamically created claim.
|
||||
|
||||
Ingress, TLS, probes, scheduling, storage size, and the image tag are all
|
||||
configurable through `values.yaml`. TCP probes are used by default because
|
||||
individual websites may redirect `/`, require authentication, or select their
|
||||
own HTTP status behavior.
|
||||
@@ -0,0 +1,13 @@
|
||||
{{- if .Values.persistence.existingClaim }}
|
||||
Web content is mounted from existing PVC {{ .Values.persistence.existingClaim }}.
|
||||
That PVC is referenced but is not managed by this Helm release.
|
||||
{{- else if .Values.persistence.enabled }}
|
||||
Web content is mounted from PVC {{ include "php-homepage.fullname" . }}.
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.ingress.enabled }}
|
||||
Website hosts:
|
||||
{{- range .Values.ingress.hosts }}
|
||||
{{ .host }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,28 @@
|
||||
{{- define "php-homepage.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "php-homepage.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "php-homepage.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "php-homepage.selectorLabels" -}}
|
||||
app: {{ include "php-homepage.fullname" . }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "php-homepage.labels" -}}
|
||||
helm.sh/chart: {{ include "php-homepage.chart" . }}
|
||||
{{ include "php-homepage.selectorLabels" . }}
|
||||
app.kubernetes.io/name: {{ include "php-homepage.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/version: {{ default .Chart.AppVersion .Values.image.tag | quote }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,93 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "php-homepage.fullname" . }}
|
||||
labels:
|
||||
{{- include "php-homepage.labels" . | nindent 4 }}
|
||||
{{- with .Values.deploymentAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
minReadySeconds: 5
|
||||
revisionHistoryLimit: 3
|
||||
strategy:
|
||||
{{- toYaml .Values.strategy | nindent 4 }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "php-homepage.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "php-homepage.labels" . | nindent 8 }}
|
||||
{{- with .Values.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
automountServiceAccountToken: false
|
||||
terminationGracePeriodSeconds: 30
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ include "php-homepage.fullname" . }}
|
||||
image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 80
|
||||
protocol: TCP
|
||||
{{- if .Values.probes.startup.enabled }}
|
||||
startupProbe:
|
||||
tcpSocket:
|
||||
port: http
|
||||
periodSeconds: {{ .Values.probes.startup.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.probes.startup.timeoutSeconds }}
|
||||
failureThreshold: {{ .Values.probes.startup.failureThreshold }}
|
||||
{{- end }}
|
||||
{{- if .Values.probes.readiness.enabled }}
|
||||
readinessProbe:
|
||||
tcpSocket:
|
||||
port: http
|
||||
periodSeconds: {{ .Values.probes.readiness.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.probes.readiness.timeoutSeconds }}
|
||||
failureThreshold: {{ .Values.probes.readiness.failureThreshold }}
|
||||
{{- end }}
|
||||
{{- if .Values.probes.liveness.enabled }}
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
port: http
|
||||
periodSeconds: {{ .Values.probes.liveness.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.probes.liveness.timeoutSeconds }}
|
||||
failureThreshold: {{ .Values.probes.liveness.failureThreshold }}
|
||||
{{- end }}
|
||||
{{- with .Values.resources }}
|
||||
resources:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.persistence.enabled }}
|
||||
volumeMounts:
|
||||
- name: webroot
|
||||
mountPath: {{ .Values.persistence.mountPath }}
|
||||
{{- end }}
|
||||
{{- if .Values.persistence.enabled }}
|
||||
volumes:
|
||||
- name: webroot
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ default (include "php-homepage.fullname" .) .Values.persistence.existingClaim }}
|
||||
{{- 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 }}
|
||||
@@ -0,0 +1,35 @@
|
||||
{{- if .Values.ingress.enabled }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ include "php-homepage.fullname" . }}
|
||||
labels:
|
||||
{{- include "php-homepage.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.ingress.className }}
|
||||
ingressClassName: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range .Values.ingress.hosts }}
|
||||
- host: {{ .host | quote }}
|
||||
http:
|
||||
paths:
|
||||
{{- range .paths }}
|
||||
- path: {{ .path }}
|
||||
pathType: {{ .pathType }}
|
||||
backend:
|
||||
service:
|
||||
name: {{ include "php-homepage.fullname" $ }}
|
||||
port:
|
||||
name: http
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,21 @@
|
||||
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ include "php-homepage.fullname" . }}
|
||||
labels:
|
||||
{{- include "php-homepage.labels" . | nindent 4 }}
|
||||
{{- if .Values.persistence.retain }}
|
||||
annotations:
|
||||
helm.sh/resource-policy: keep
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes:
|
||||
{{- toYaml .Values.persistence.accessModes | nindent 4 }}
|
||||
{{- with .Values.persistence.storageClass }}
|
||||
storageClassName: {{ . }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "php-homepage.fullname" . }}
|
||||
labels:
|
||||
{{- include "php-homepage.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- name: http
|
||||
port: {{ .Values.service.port }}
|
||||
protocol: TCP
|
||||
targetPort: http
|
||||
selector:
|
||||
{{- include "php-homepage.selectorLabels" . | nindent 4 }}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"type": "object",
|
||||
"required": ["image", "persistence", "service", "ingress"],
|
||||
"properties": {
|
||||
"replicaCount": { "type": "integer", "minimum": 1 },
|
||||
"fullnameOverride": { "type": "string" },
|
||||
"image": {
|
||||
"type": "object",
|
||||
"required": ["repository", "tag", "pullPolicy"],
|
||||
"properties": {
|
||||
"repository": { "type": "string", "minLength": 1 },
|
||||
"tag": { "type": "string" },
|
||||
"pullPolicy": { "enum": ["Always", "IfNotPresent", "Never"] }
|
||||
}
|
||||
},
|
||||
"persistence": {
|
||||
"type": "object",
|
||||
"required": ["enabled", "existingClaim", "mountPath"],
|
||||
"properties": {
|
||||
"enabled": { "type": "boolean" },
|
||||
"existingClaim": { "type": "string" },
|
||||
"mountPath": { "type": "string", "minLength": 1 },
|
||||
"retain": { "type": "boolean" }
|
||||
}
|
||||
},
|
||||
"ingress": {
|
||||
"type": "object",
|
||||
"required": ["enabled"],
|
||||
"properties": {
|
||||
"enabled": { "type": "boolean" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
replicaCount: 1
|
||||
|
||||
image:
|
||||
repository: registry.brunner.ninja/feedc0de/php-apache
|
||||
# Empty means the chart's appVersion. Published charts set appVersion to
|
||||
# the exact image build tag produced in the same CI run.
|
||||
tag: ""
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
imagePullSecrets:
|
||||
- name: quay-pull-secret
|
||||
|
||||
nameOverride: ""
|
||||
fullnameOverride: ""
|
||||
|
||||
deploymentAnnotations: {}
|
||||
podAnnotations: {}
|
||||
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
maxUnavailable: 0
|
||||
maxSurge: 1
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 80
|
||||
|
||||
persistence:
|
||||
enabled: true
|
||||
existingClaim: ""
|
||||
mountPath: /srv/http
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
storageClass: rook-cephfs
|
||||
size: 1Gi
|
||||
retain: true
|
||||
|
||||
ingress:
|
||||
enabled: false
|
||||
className: traefik
|
||||
annotations:
|
||||
traefik.ingress.kubernetes.io/router.entrypoints: websecure
|
||||
hosts:
|
||||
- host: example.invalid
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
tls: []
|
||||
|
||||
probes:
|
||||
startup:
|
||||
enabled: true
|
||||
periodSeconds: 2
|
||||
timeoutSeconds: 2
|
||||
failureThreshold: 60
|
||||
readiness:
|
||||
enabled: true
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 2
|
||||
failureThreshold: 3
|
||||
liveness:
|
||||
enabled: true
|
||||
periodSeconds: 15
|
||||
timeoutSeconds: 2
|
||||
failureThreshold: 3
|
||||
|
||||
resources: {}
|
||||
|
||||
nodeSelector: {}
|
||||
tolerations: []
|
||||
affinity: {}
|
||||
Reference in New Issue
Block a user