Skip to content

Commit

Permalink
add new hcfmailer plus
Browse files Browse the repository at this point in the history
  • Loading branch information
eltorio committed Dec 17, 2023
1 parent eb8545d commit 1fe5617
Show file tree
Hide file tree
Showing 42 changed files with 849 additions and 96 deletions.
4 changes: 2 additions & 2 deletions charts/hcfmailerplus/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.5
version: 0.2.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "v20230910.1"
appVersion: "v20231216.2"
icon: "https://raw.githubusercontent.com/highcanfly-club/hcfmailer-plus/hcf/client/static/hcfmailer%2B.svg"
9 changes: 9 additions & 0 deletions charts/hcfmailerplus/templates/configmap-cloudflared.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{ if .Values.cloudflared.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: cloudflared
data:
config.yaml: {{ .Values.cloudflared.config | toYaml | indent 2}}
cert.pem: {{ .Values.cloudflared.cert | toYaml | indent 2 }}
{{ end }}
89 changes: 89 additions & 0 deletions charts/hcfmailerplus/templates/deployment-cloudflared.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{{ if .Values.cloudflared.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: cloudflared
spec:
{{- if not .Values.cloudflared.autoscaling.enabled }}
replicas: {{ .Values.cloudflared.replicaCount }}
{{- end }}
selector:
matchLabels:
app: cloudflared
template:
metadata:
{{- with .Values.cloudflared.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app: cloudflared
spec:
{{- with .Values.cloudflared.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.cloudflared.podSecurityContext | nindent 8 }}
containers:
- name: {{ printf "%s-%s" .Chart.Name "cloudflared"}}
securityContext:
{{- toYaml .Values.cloudflared.securityContext | nindent 12 }}
image: "{{ .Values.cloudflared.image.repository }}:{{ .Values.cloudflared.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.cloudflared.image.pullPolicy }}
{{- if .Values.cloudflared.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.cloudflared.command "context" $) | nindent 12 }}
{{- else}}
command:
- cloudflared
{{- end }}
{{- if .Values.cloudflared.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.cloudflared.args "context" $) | nindent 12 }}
{{- else}}
- tunnel
- --config
- /etc/cloudflared/config/config.yaml
- --origincert=/etc/cloudflared/config/cert.pem
- run
{{- end }}
resources:
{{- toYaml .Values.cloudflared.resources | nindent 12 }}
livenessProbe:
httpGet:
path: /ready
port: 2000
failureThreshold: 3
initialDelaySeconds: 10
periodSeconds: 30
volumeMounts:
- name: creds
mountPath: /etc/cloudflared/creds
readOnly: true
- name: config
mountPath: /etc/cloudflared/config
readOnly: true
volumes:
- name: creds
secret:
secretName: cloudflared
- name: config
configMap:
name: cloudflared
items:
- key: config.yaml
path: config.yaml
- key: cert.pem
path: cert.pem
{{- with .Values.cloudflared.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.cloudflared.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.cloudflared.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{ end }}
24 changes: 20 additions & 4 deletions charts/hcfmailerplus/templates/deployments-hcfmailerplus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
matchLabels:
io.kompose.service: mailtrain
strategy:
type: RollingUpdate
type: Recreate
template:
metadata:
labels:
Expand Down Expand Up @@ -98,13 +98,29 @@ spec:
secretKeyRef:
name: mysql
key: MYSQL_PASSWORD
{{- if .Values.app.RELAY_HOST }}
- name: RELAY_HOST
value: {{.Values.app.RELAY_HOST | quote}}
{{- end }}
{{- if .Values.app.RELAY_HOST_PORT }}
- name: RELAY_HOST_PORT
value: {{.Values.app.RELAY_HOST_PORT | quote}}
{{- end }}
{{- if .Values.app.RELAY_HOST_USER }}
- name: RELAY_HOST_USER
value: {{.Values.app.RELAY_HOST_USER | quote}}
{{- end }}
{{- if .Values.app.RELAY_HOST_PASSWORD }}
- name: RELAY_HOST_PASSWORD
value: {{.Values.app.RELAY_HOST_PASSWORD | quote}}
{{- end }}
image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}"
{{if .Values.image.debug }}
{{- if .Values.image.debug }}
command:
- tail
- -f
- /dev/null
{{end}}
{{- end}}
name: mailtrain
ports:
- containerPort: {{ .Values.service.basePort }}
Expand All @@ -121,5 +137,5 @@ spec:
volumes:
- name: mailtrain-files
persistentVolumeClaim:
claimName: mailtrain-files
claimName: {{ not .Values.storage.main.existingClaim | ternary .Values.storage.main.claimName .Values.storage.main.existingClaim }}
status: {}
42 changes: 42 additions & 0 deletions charts/hcfmailerplus/templates/deployments-mongo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

{{ $storage := .Values.storage.kvdata.shareKvStorage | ternary .Values.storage.kvdata.claimName .Values.storage.mongo.claimName }}
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
io.kompose.service: mongo
name: mongo
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: mongo
strategy:
type: Recreate
template:
metadata:
creationTimestamp: null
labels:
io.kompose.network/hcf-default: "true"
io.kompose.service: mongo
spec:
containers:
- image: mongo:latest
name: mongo
ports:
- containerPort: 27019
resources:
limits:
cpu: 1
memory: "1Gi"
volumeMounts:
- mountPath: /data
name: {{ $storage }}
restartPolicy: Always
volumes:
- name: {{ $storage }}
persistentVolumeClaim:
claimName: {{ not .Values.storage.mongo.existingClaim | ternary $storage .Values.storage.mongo.existingClaim }}
status: {}
57 changes: 57 additions & 0 deletions charts/hcfmailerplus/templates/deployments-mysql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
io.kompose.service: mysql
name: mysql
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: mysql
strategy:
type: Recreate
template:
metadata:
labels:
io.kompose.network/hcf-default: "true"
io.kompose.service: mysql
spec:
containers:
- env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysql
key: MYSQL_ROOT_PASSWORD
- name: MYSQL_DATABASE
value: mailtrain
- name: MYSQL_USER
value: mailtrain
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: mysql
key: MYSQL_PASSWORD
image: mysql:latest
name: mysql
ports:
- containerPort: {{ .Values.storage.mysql.port }}
# resources:
# limits:
# cpu: "1"
# memory: "2Gi"
volumeMounts:
- mountPath: /var/lib/mysql
name: mailtrain-mysql
securityContext:
runAsUser: 0
runAsGroup: 0
restartPolicy: Always
volumes:
- name: mailtrain-mysql
persistentVolumeClaim:
claimName: {{ not .Values.storage.mysql.existingClaim | ternary .Values.storage.mysql.claimName .Values.storage.mysql.existingClaim }}
status: {}
37 changes: 37 additions & 0 deletions charts/hcfmailerplus/templates/deployments-phpmyadmin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
{{ if .Values.phpmyadmin.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
io.kompose.service: phpmyadmin
name: phpmyadmin
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: phpmyadmin
strategy:
type: RollingUpdate
template:
metadata:
labels:
io.kompose.network/hcf-default: "true"
io.kompose.service: phpmyadmin
spec:
containers:
- env:
- name: PMA_HOST
value: {{ .Values.app.MYSQL_HOST | quote }}
image: phpmyadmin:latest
name: phpmyadmin
ports:
- containerPort: {{ .Values.phpmyadmin.port }}
# resources:
# limits:
# cpu: "0.25"
# memory: "512M"
restartPolicy: Always
status: {}
{{ end }}
39 changes: 39 additions & 0 deletions charts/hcfmailerplus/templates/deployments-redis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
io.kompose.service: redis
name: redis
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: redis
strategy:
type: Recreate
template:
metadata:
labels:
io.kompose.network/hcf-default: "true"
io.kompose.service: redis
spec:
containers:
- image: redis:latest
name: redis
ports:
- containerPort: {{ .Values.storage.kvdata.redisPort }}
# resources:
# limits:
# cpu: 1
# memory: "1Gi"
volumeMounts:
- mountPath: /data
name: mailtrain-kvdata
restartPolicy: Always
volumes:
- name: mailtrain-kvdata
persistentVolumeClaim:
claimName: {{ not .Values.storage.kvdata.existingClaim | ternary .Values.storage.kvdata.claimName .Values.storage.kvdata.existingClaim }}
status: {}
33 changes: 33 additions & 0 deletions charts/hcfmailerplus/templates/ingress-hcfmailerplus-public.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{ if .Values.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: mailtrain-public
namespace: {{ .Release.Namespace }}
annotations:
{{ if .Values.ingress.clusterIssuer -}}
cert-manager.io/cluster-issuer: {{ .Values.ingress.clusterIssuer }}
{{ end -}}
{{ if .Values.ingress.annotations -}}
{{ .Values.ingress.annotations | toYaml | nindent 4}}
{{ end -}}
external-dns.alpha.kubernetes.io/hostname: {{ .Values.app.HOST_BASE_PUBLIC }}
spec:
ingressClassName: {{ .Values.ingress.className }}
rules:
- host: {{ .Values.app.HOST_BASE_PUBLIC }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: mailtrain
port:
number: {{ .Values.service.publicPort }}
{{ if .Values.ingress.clusterIssuer -}}
tls:
- hosts: [{{ .Values.app.HOST_BASE_PUBLIC }}]
secretName: mailtrain-public-tls-cert
{{ end }}
{{ end }}
Loading

0 comments on commit 1fe5617

Please sign in to comment.