Finished setting up chart

This commit is contained in:
2023-03-19 10:07:25 +00:00
parent da2afcd24b
commit e8095a7674
8 changed files with 287 additions and 118 deletions

View File

@@ -2,5 +2,5 @@ apiVersion: v2
name: cloudypress name: cloudypress
description: A helm chart for deploying Wordpress on Cloudyne Hosting description: A helm chart for deploying Wordpress on Cloudyne Hosting
type: application type: application
version: 0.1.0 version: 0.1.5
appVersion: "6.1.1" appVersion: "6.1.1"

View File

@@ -10,5 +10,13 @@ spec:
kind: ClusterIssuer kind: ClusterIssuer
secretName: {{ include "..fullname" . }}-cert-secret secretName: {{ include "..fullname" . }}-cert-secret
commonName: {{ .Values.site.url }} commonName: {{ .Values.site.url }}
dnsNames: {{ range .Values.site.ingressNames }} dnsNames:
- {{ . }}{{end}} - {{ .Values.site.url | replace "www." "" }}
- www.{{ .Values.site.url | replace "www." "" }}
- {{ .Values.site.url | replace "www." "" | replace "." "-" }}.eu.cust.azurecd.net
- www.{{ .Values.site.url | replace "www." "" | replace "." "-" }}.eu.cust.azurecd.net
{{- if .Values.site.additionalIngressNames }}
{{- range .Values.site.additionalIngressNames }}
- {{ . }}
{{- end }}
{{- end }}

View File

@@ -13,18 +13,18 @@ data:
WP_HOME: {{ .Values.site.url }} WP_HOME: {{ .Values.site.url }}
WP_SITEURL: {{ .Values.site.url }}/wp WP_SITEURL: {{ .Values.site.url }}/wp
{{- if and .values.Site.init .Values.site.init.composerPackage }} {{- if and .Values.site.init .Values.site.init.composerPackage }}
RUN_COMPOSER: "true" RUN_COMPOSER: "true"
INSTALL_SITE: {{ .Values.site.init.composerPackage }} INSTALL_SITE: {{ .Values.site.init.composerPackage }}
SET_THEME: {{ .Values.site.init.themeName | default "" }} SET_THEME: {{ .Values.site.init.themeName | default "" }}
{{- end }} {{- end }}
{{- if and .values.Site.init .Values.site.init.content .Values.site.init.content.import }} {{- if and .Values.site.init .Values.site.init.content .Values.site.init.content.import }}
RUN_IMPORTS: "true" RUN_IMPORTS: "true"
IMPORT_CONTENT: {{ .Values.site.init.content.url }} IMPORT_CONTENT: {{ .Values.site.init.content.url }}
{{- end }} {{- end }}
{{- if and .values.Site.init .Values.site.init.database .Values.site.init.database.import }} {{- if and .Values.site.init .Values.site.init.database .Values.site.init.database.import }}
RUN_DATABASEIMPORTS: "true" RUN_DATABASEIMPORTS: "true"
IMPORT_DATABASE: {{ .Values.site.init.database.url }} IMPORT_DATABASE: {{ .Values.site.init.database.url }}
FORCE_IMPORT_DB: {{ .Values.site.init.database.force | default "false" }} FORCE_IMPORT_DB: {{ .Values.site.init.database.force | default "false" }}
@@ -34,7 +34,7 @@ data:
kind: ConfigMap kind: ConfigMap
apiVersion: v1 apiVersion: v1
metadata: metadata:
name: {{ include "..fullname" . }}-configfiles name: {{ include "..fullname" . }}-cfg
labels: labels:
{{- include "..labels" . | nindent 8 }} {{- include "..labels" . | nindent 8 }}
data: data:

View File

@@ -1,63 +1,111 @@
apiVersion: apps/v1 apiVersion: apps/v1
kind: Certificate kind: Deployment
metadata: metadata:
name: {{ include "..fullname" . }}-cert name: {{ include "..fullname" . }}-cert
labels: labels:
{{- include "..labels" . | nindent 8 }} {{- include "..labels" . | nindent 4 }}
cloudyne.systems/component: site cloudyne.systems/component: site
spec: spec:
{{- if and .Values.customer .Values.customer.package }} {{- if and .Values.customer .Values.customer.package }}
replicas: {{ .Values.customer.package.replicas | default 1 }} replicas: {{ .Values.customer.package.replicas | default 1 }}
{{- end }} {{- else }}
selector: replicas: 1
matchLabels: {{- end }}
cloudyne.systems/customer: {{ .Values.customer.name }} selector:
cloudyne.systems/site: {{ .Values.site.url }} matchLabels:
template: cloudyne.systems/customer: {{ .Values.customer.name }}
metadata: cloudyne.systems/site: {{ .Values.site.url }}
labels: template:
cloudyne.systems/customer: {{ .Values.customer.name }} metadata:
cloudyne.systems/site: {{ .Values.site.url }} labels:
spec: cloudyne.systems/customer: {{ .Values.customer.name }}
securityContext: cloudyne.systems/site: {{ .Values.site.url }}
fsGroup: 65534 spec:
volumes: securityContext:
- name: cloud fsGroup: 65534
persistentVolumeClaim: volumes:
claimName: pvc-{{ include "..fullname" . }} - name: cloud
- name: local persistentVolumeClaim:
emptyDir: {} claimName: pvc-{{ include "..fullname" . }}
initContainers: - name: local
- name: deploy emptyDir: {}
securityContext: - name: serverconfig
allowPrivilegeEscalation: false configMap:
runAsUser: 0 name: {{ include "..fullname" . }}-cfg
{{- if .Values.global }} initContainers:
image: {{ .Values.global.initImage }}:{{ .Values.global.imagetag }} - name: deploy
{{- else }} securityContext:
image: ghcr.io/cloudynes/php-init:latest allowPrivilegeEscalation: false
{{- end }} runAsUser: 0
imagePullPolicy: Always {{- if .Values.global }}
command: [ "bash", "/init-py/init.sh" ] image: {{ .Values.global.initImage | default "ghcr.io/cloudynes/php-init" }}:{{ .Values.global.imagetag | default "latest" }}
volumeMounts: {{- else }}
- name: site image: ghcr.io/cloudynes/php-init:latest
mountPath: /app {{- end }}
{{- if and .Values.site .Values.site.storage .Values.site.storage.cloud .Values.site.storage.cloud.folders }} imagePullPolicy: Always
{{- range $v := .Values.site.storage.cloud.folders }} volumeMounts:
- name: cloud - name: site
mountPath: {{ $v.localPath }} mountPath: /app
subPath: {{ $v.cloudPath }} {{- if and .Values.site .Values.site.storage .Values.site.storage.cloud .Values.site.storage.cloud.folders }}
{{- end }} {{- range $v := .Values.site.storage.cloud.folders }}
{{- end }} - name: cloud
envFrom: mountPath: {{ $v.localPath }}
- configMapRef: subPath: {{ $v.cloudPath }}
name: {{ include "..fullname" . }}-env {{- end }}
- secretRef: {{- end }}
name: {{ include "..fullname" . }}-db-auth envFrom:
containers: - configMapRef:
- name: wordpress name: {{ include "..fullname" . }}-env
securityContext: - secretRef:
runAsUser: 65534 name: {{ include "..fullname" . }}-db-auth
containers:
- name: wordpress
securityContext:
runAsUser: 65534
{{- if .Values.global }}
image: {{ .Values.global.initImage | default "ghcr.io/cloudynes/php-nginx" }}:{{ .Values.global.imagetag | default "latest" }}
{{- else }}
image: ghcr.io/cloudynes/php-nginx:latest
{{- end }}
imagePullPolicy: Always
volumeMounts:
- name: site
mountPath: /app
- name: serverconfig
mountPath: /etx/nginx/nginx.conf
subPath: nginx.conf
- name: serverconfig
mountPath: /usr/local/etc/php-fpm.d/www.conf
{{- if and .Values.site .Values.site.storage .Values.site.storage.cloud .Values.site.storage.cloud.folders }}
{{- range $v := .Values.site.storage.cloud.folders }}
- name: cloud
mountPath: {{ $v.localPath }}
subPath: {{ $v.cloudPath }}
{{- end }}
{{- end }}
envFrom:
- configMapRef:
name: {{ include "..fullname" . }}-env
- secretRef:
name: {{ include "..fullname" . }}-db-auth
resources:
{{- if and .Values.customer .Values.customer.package .Values.customer.package.cpu }}
requests:
cpu: {{ .Values.customer.package.cpu.avg | default "1000m" }}
memory: {{ .Values.customer.package.mem.avg | default "1Gi" }}
limits:
cpu: {{ .Values.customer.package.cpu.peak | default "1000m" }}
memory: {{ .Values.customer.package.mem.peak | default "1Gi" }}
{{- else }}
requests:
cpu: 1000m
memory: 1Gi
limits:
cpu: 1000m
memory: 1Gi
{{- end }}
ports:
- containerPort: 8080
name: http
protocol: TCP

View File

@@ -0,0 +1,76 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "..fullname" . }}
labels:
{{- include "..labels" . | nindent 4 }}
spec:
ingressClassName: nginx
tls:
- secretName: {{ include "..fullname" . }}-cert-secret
hosts:
- {{ .Values.site.url | replace "www." "" }}
- www.{{ .Values.site.url | replace "www." "" }}
- {{ .Values.site.url | replace "www." "" | replace "." "-" }}.eu.cust.azurecd.net
- www.{{ .Values.site.url | replace "www." "" | replace "." "-" }}.eu.cust.azurecd.net
{{- if .Values.site.additionalIngressNames }}
{{- range .Values.site.additionalIngressNames }}
- {{ . }}
{{- end }}
{{- end }}
rules:
- host: {{ .Values.site.url | replace "www." "" }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ include "..fullname" . }}
port:
number: 80
- host: www.{{ .Values.site.url | replace "www." "" }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ include "..fullname" . }}
port:
number: 80
- host: {{ .Values.site.url | replace "www." "" | replace "." "-" }}.eu.cust.azurecd.net
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ include "..fullname" . }}
port:
number: 80
- host: www.{{ .Values.site.url | replace "www." "" | replace "." "-" }}.eu.cust.azurecd.net
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ include "..fullname" . }}
port:
number: 80
{{- if .Values.site.additionalIngressNames }}
{{- range .Values.site.additionalIngressNames }}
- host: {{ . }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ include "..fullname" . }}
port:
number: 80
{{- end }}
{{- end }}

View File

@@ -6,7 +6,19 @@ metadata:
{{- include "..labels" . | nindent 4 }} {{- include "..labels" . | nindent 4 }}
spec: spec:
hard: hard:
requests.cpu: {{ .Values.customer.package.cpu.avg }} {{- if and .Values.customer .Values.customer.package }}
limits.cpu: {{ .Values.customer.package.cpu.peak }} {{- if .Values.customer.package.cpu }}
requests.memory: {{ .Values.customer.package.mem.avg }} requests.cpu: {{ .Values.customer.package.cpu.avg | default "1000m" }}
limits.memory: {{ .Values.customer.package.mem.peak }} limits.cpu: {{ .Values.customer.package.cpu.peak | default "1500m"}}
{{- else }}
requests.cpu: 1000m
limits.cpu: 1500m
{{- end }}
{{- if .Values.customer.package.mem }}
requests.memory: {{ .Values.customer.package.mem.avg | default "512Mi" }}
limits.memory: {{ .Values.customer.package.mem.peak | default "1Gi" }}
{{- else }}
requests.memory: 512Mi
limits.memory: 1Gi
{{- end }}
{{- end }}

View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "..fullname" . }}-cert
labels:
{{- include "..labels" . | nindent 8 }}
cloudyne.systems/component: site
spec:
ports:
- name: http
port: 80
targetPort: 8080
selector:
cloudyne.systems/customer: {{ .Values.customer.name }}
cloudyne.systems/site: {{ .Values.site.url }}
type: ClusterIP

View File

@@ -2,80 +2,89 @@
customer: customer:
# Customer Name/identifier # Customer Name/identifier
name: gunnarnilssonmaskin name: mycustomer
# Timezone for customer # Timezone for customer
timezone: "Europe/Stockholm" timezone: "Europe/Stockholm"
# Package/Resource Settings # Package/Resource Settings
package: package: {}
size: small
replicas: 1 # Defaults:
cpu: # package:
avg: 500m # size: small
peak: 1000m # replicas: 1
mem: # cpu:
avg: 512Mi # avg: 500m
peak: 1Gi # peak: 1000m
disk: 5Gi # mem:
# avg: 512Mi
# peak: 1Gi
# disk: 5Gi
# Website Configuration # Website Configuration
site: site:
# The main URL for the website # The main URL for the website
url: "www.gunnarnilssonmaskin.se" url: "www.mycustomer.com"
# Settings for the webroot (used by Nginx)
webroot:
path: "/app/web"
indexes: "index.php index.html index.htm"
# Whether to keep plugins and Wordpress updated # Whether to keep plugins and Wordpress updated
autoUpdate: true autoUpdate: true
# Storage settings
storage: {}
# Defaults:
# storage:
# cloud:
# class: "premium01"
# type: "Premium_LRS"
# container: "www-mycustomer-com"
# folders:
# - cloudPath: "uploads"
# localPath: "/app/web/app/uploads"
# - cloudyPath: "gallery"
# localPath: "/app/web/app/uploads"
# Initialization Settings # Initialization Settings
init: init:
# The composer package that contains the site # The composer package that contains the site
composerPackage: "buildahome/gunnarnilssonmaskin-se" composerPackage: "somens/mycustomer-app"
# The name of the theme which the composer package refers to # The name of the theme which the composer package refers to
themeName: "gunnarnilssonmaskin-se-theme" themeName: "mycustomer-app-theme"
# Import content to wp-content directory from zip file # Optional: Import content to wp-content directory from zip file
content: content: {}
import: true
url: "https://www.gunnarnilssonmaskin.se/gunnar.zip" # content:
# import: true
# url: "https://mycustomer.com/wp-content-data.zip"
# Optional: Import database from URL
database: {}
# # Import database from URL
# database: # database:
# import: true # import: true
# force: false # force: false
# url: "https://www.gunnarnilssonmaskin.se/gunnar.sql" # url: "https://www.mycustomer.com/mysqldump.sql"
# The allowed names for ingress to this site # Settings for the webroot (used by Nginx)
ingressNames: webroot: {}
- "gunnarnilssonmaskin.se"
- "www.gunnarnilssonmaskin.se" # Defaults:
- "gunnarnilssonmaskin-se.eu.cust.azurecd.net" # webroot:
- "www-gunnarnilssonmaskin-se.eu.cust.azurecd.net" # path: "/app/web"
# indexes: "index.php index.html index.htm"
# Storage settings # Additional ingress names for the site
storage: # Default ingress names are (customer domain: testsite.com, domain = testsite, tld = com):
# - <domain>.<tld>
# - www.<domain>.<tld>
# - <domain>-<tld>.eu.cust.azurecd.net
# - www-<domain>-<tld>.eu.cust.azurecd.net
additionalIngressNames: []
# Settings for cloud storage
cloud:
# Storage class to use for the cloud storage
class: "premium01"
type: "Premium_LRS"
# The container in Azure storage
container: "gunnarnilssonmaskin-se"
# Folders to map up to the Azure storage
folders:
- cloudPath: "uploads"
localPath: "/app/web/app/uploads"
- cloudyPath: "gallery"
localPath: "/app/web/app/uploads"
# Global configuration # Global configuration
global: global: