-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
86f735c
commit 4005d92
Showing
19 changed files
with
654 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Release Helm Chart | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- dev | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Configure Git | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "$GITHUB_ACTOR@users.noreply.github.com" | ||
- name: Install Helm | ||
uses: azure/setup-helm@v4 | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
|
||
- name: Run chart-releaser | ||
uses: helm/chart-releaser-action@v1.6.0 | ||
with: | ||
charts_dir: charts | ||
env: | ||
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: v2 | ||
name: warbot | ||
description: A Helm chart for deploying WarBOT | ||
|
||
version: 0.1.0 | ||
appVersion: "1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "warbot.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
*/}} | ||
{{- define "warbot.fullname" -}} | ||
{{- if .Values.fullnameOverride }} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- else }} | ||
{{- include "warbot.name" . }}-{{ .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "warbot.labels" -}} | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
{{ include "warbot.selectorLabels" . }} | ||
{{- end -}} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "warbot.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "warbot.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: common | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "warbot.labels" . | nindent 4 }} | ||
data: | ||
DB_HOST: {{ .Values.database.host | quote }} | ||
DB_PORT: {{ .Values.database.port | quote }} | ||
PUBLIC_URL: {{ .Values.publicUrl | quote }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{{- if .Values.ui.enabled }} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: web-config | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "warbot.labels" . | nindent 4 }} | ||
data: | ||
PUBLIC_URL: {{ .Values.publicUrl | quote }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "warbot.fullname" . }}-bot | ||
labels: | ||
{{- include "warbot.labels" . | nindent 4 }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
{{- include "warbot.selectorLabels" . | nindent 6 }} | ||
role: bot | ||
template: | ||
metadata: | ||
labels: | ||
{{- include "warbot.selectorLabels" . | nindent 8 }} | ||
role: bot | ||
spec: | ||
securityContext: | ||
{{- toYaml .Values.podSecurityContext | nindent 8 }} | ||
containers: | ||
- name: warbot | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
env: | ||
- name: SUPERADMIN_USER_IDS | ||
value: {{ .Values.env.SUPERADMIN_USER_IDS | quote }} | ||
- name: ADMIN_GUILDS | ||
value: {{ .Values.env.ADMIN_GUILDS | quote }} | ||
- name: DB_HOST | ||
value: {{ if .Values.database.enabled }}db{{ else }}{{ .Values.externalDatabase.host | quote }}{{ end }} | ||
- name: DB_PORT | ||
value: {{ if .Values.database.enabled }}3306{{ else }}{{ .Values.externalDatabase.port | quote }}{{ end }} | ||
- name: DB_NAME | ||
value: {{ if .Values.database.enabled }}warbot{{ else }}{{ .Values.externalDatabase.name | quote }}{{ end }} | ||
- name: DB_USER | ||
value: {{ if .Values.database.enabled }}warbot_user{{ else }}{{ .Values.externalDatabase.user | quote }}{{ end }} | ||
- name: DB_PASS | ||
value: {{ if .Values.database.enabled }}secret{{ else }}{{ .Values.externalDatabase.password | quote }}{{ end }} | ||
- name: DISCORD_TOKEN | ||
value: {{ .Values.discord.token | quote }} | ||
- name: DISCORD_ID | ||
value: {{ .Values.discord.id | quote }} | ||
- name: DISCORD_SECRET | ||
value: {{ .Values.discord.secret | quote }} | ||
- name: PUBLIC_URL | ||
value: {{ .Values.publicUrl | quote }} | ||
ports: | ||
- containerPort: 80 | ||
name: http | ||
livenessProbe: | ||
exec: | ||
command: | ||
- /bin/bash | ||
- -c | ||
- "end=$(date -u +%s);start=$(stat -c %Z /proc/1 | awk '{print int($1)}'); test $(($end-$start)) -lt 172800" | ||
readinessProbe: | ||
httpGet: | ||
path: /health | ||
port: http | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{{- if .Values.ui.enabled }} | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "warbot.fullname" . }}-ui | ||
labels: | ||
{{- include "warbot.labels" . | nindent 4 }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
{{- include "warbot.selectorLabels" . | nindent 6 }} | ||
role: web | ||
template: | ||
metadata: | ||
labels: | ||
{{- include "warbot.selectorLabels" . | nindent 8 }} | ||
role: web | ||
spec: | ||
securityContext: | ||
{{- toYaml .Values.podSecurityContext | nindent 8 }} | ||
containers: | ||
- name: web | ||
image: "{{ .Values.ui.image.repository }}:{{ .Values.ui.image.tag }}" | ||
imagePullPolicy: {{ .Values.ui.image.pullPolicy }} | ||
env: | ||
- name: DB_HOST | ||
value: {{ if .Values.database.enabled }}db{{ else }}{{ .Values.externalDatabase.host | quote }}{{ end }} | ||
- name: DB_PORT | ||
value: {{ if .Values.database.enabled }}3306{{ else }}{{ .Values.externalDatabase.port | quote }}{{ end }} | ||
- name: DB_NAME | ||
value: {{ if .Values.database.enabled }}warbot{{ else }}{{ .Values.externalDatabase.name | quote }}{{ end }} | ||
- name: DB_USER | ||
value: {{ if .Values.database.enabled }}warbot_user{{ else }}{{ .Values.externalDatabase.user | quote }}{{ end }} | ||
- name: DB_PASS | ||
value: {{ if .Values.database.enabled }}secret{{ else }}{{ .Values.externalDatabase.password | quote }}{{ end }} | ||
- name: PUBLIC_URL | ||
value: {{ .Values.publicUrl | quote }} | ||
ports: | ||
- containerPort: 80 | ||
name: http | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{{- if .Values.ingress.enabled -}} | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: {{ include "warbot.fullname" . }} | ||
labels: | ||
{{- include "warbot.labels" . | nindent 4 }} | ||
annotations: | ||
{{- toYaml .Values.ingress.annotations | nindent 4 }} | ||
spec: | ||
rules: | ||
{{- range .Values.ingress.hosts }} | ||
- host: {{ .host | quote }} | ||
http: | ||
paths: | ||
{{- range .paths }} | ||
- path: {{ . }} | ||
pathType: ImplementationSpecific | ||
backend: | ||
service: | ||
name: {{ include "warbot.fullname" $. }} | ||
port: | ||
number: {{ $.Values.service.port }} | ||
{{- end }} | ||
{{- end }} | ||
{{- if .Values.ingress.tls }} | ||
tls: | ||
{{- range .Values.ingress.tls }} | ||
- hosts: | ||
{{- range .hosts }} | ||
- {{ . | quote }} | ||
{{- end }} | ||
secretName: {{ .secretName }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{{- if .Values.ingressRoute.enabled -}} | ||
apiVersion: traefik.containo.us/v1alpha1 | ||
kind: IngressRoute | ||
metadata: | ||
name: {{ include "warbot.fullname" . }} | ||
labels: | ||
{{- include "warbot.labels" . | nindent 4 }} | ||
spec: | ||
entryPoints: | ||
{{- toYaml .Values.ingressRoute.entryPoints | nindent 4 }} | ||
routes: | ||
{{- range .Values.ingressRoute.routes }} | ||
- match: {{ .match | quote }} | ||
kind: {{ .kind }} | ||
services: | ||
{{- range .services }} | ||
- name: {{ .name }} | ||
port: {{ .port }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{{- if .Values.networkPolicies.enabled -}} | ||
{{- range .Values.networkPolicies.policies }} | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: {{ .name }} | ||
namespace: {{ $.Release.Namespace }} | ||
labels: | ||
{{- include "warbot.labels" $ | nindent 4 }} | ||
spec: | ||
podSelector: | ||
{{- toYaml .podSelector | nindent 4 }} | ||
policyTypes: | ||
{{- if .ingress }} | ||
- Ingress | ||
{{- end }} | ||
{{- if .egress }} | ||
- Egress | ||
{{- end }} | ||
{{- if .ingress }} | ||
ingress: | ||
{{- range .ingress }} | ||
- from: | ||
{{- toYaml .from | nindent 6 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- if .egress }} | ||
egress: | ||
{{- range .egress }} | ||
- to: | ||
{{- toYaml .to | nindent 6 }} | ||
ports: | ||
{{- toYaml .ports | nindent 6 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{{- if .Values.database.enabled }} | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: db-data | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "warbot.labels" . | nindent 4 }} | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 1Gi | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{{- if .Values.ui.enabled }} | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: ui-data | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "warbot.labels" . | nindent 4 }} | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 1Gi | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: db-secrets | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "warbot.labels" . | nindent 4 }} | ||
stringData: | ||
MYSQL_ROOT_PASSWORD: {{ .Values.database.password | quote }} | ||
MYSQL_DATABASE: {{ .Values.database.name | quote }} | ||
MYSQL_USER: {{ .Values.database.user | quote }} | ||
MYSQL_PASSWORD: {{ .Values.database.password | quote }} | ||
MARIADB_AUTO_UPGRADE: "1" | ||
MARIADB_INITDB_SKIP_TZINFO: "1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: discord-secrets | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "warbot.labels" . | nindent 4 }} | ||
stringData: | ||
DISCORD_ID: {{ .Values.discord.id | quote }} | ||
DISCORD_TOKEN: {{ .Values.discord.token | quote }} | ||
DISCORD_SECRET: {{ .Values.discord.secret | quote }} |
Oops, something went wrong.