Skip to content

Commit 76ef59c

Browse files
author
Sylvain Bossut
committed
add whosaid charts
1 parent f4f0e1e commit 76ef59c

22 files changed

+729
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea/

charts/whosaid/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

charts/whosaid/Chart.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: whosaid
3+
description: A Helm chart for Kubernetes
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.1.1
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "1.16.1"

charts/whosaid/templates/NOTES.txt

Whitespace-only changes.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "whosaid.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "whosaid.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "whosaid.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "whosaid.labels" -}}
37+
helm.sh/chart: {{ include "whosaid.chart" . }}
38+
{{ include "whosaid.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Common annotations
47+
*/}}
48+
{{- define "whosaid.annotations" -}}
49+
helm.sh/chart: {{ include "whosaid.chart" . }}
50+
{{ include "whosaid.selectorLabels" . }}
51+
{{- if .Chart.AppVersion }}
52+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
53+
{{- end }}
54+
app.kubernetes.io/managed-by: {{ .Release.Service }}
55+
{{- end }}
56+
57+
{{/*
58+
Selector labels
59+
*/}}
60+
{{- define "whosaid.environmentUrl" -}}
61+
{{- if eq .Values.whosaid.env "prod" }}
62+
{{- printf "%s" .Values.whosaid.domain }}
63+
{{- else }}
64+
{{- printf "%s.%s" .Values.whosaid.env .Values.whosaid.domain }}
65+
{{- end }}
66+
{{- end }}
67+
68+
{{- define "hasura.dbName" -}}
69+
{{- printf "hasura_%s" .Values.whosaid.env }}
70+
{{- end }}
71+
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
labels:
5+
app: api
6+
name: api
7+
namespace: {{ .Release.Namespace }}
8+
9+
{{- with .Values.whosaid.annotations }}
10+
annotations:
11+
{{- toYaml . | nindent 4 }}
12+
{{- end }}
13+
14+
spec:
15+
replicas: 1
16+
selector:
17+
matchLabels:
18+
app: api
19+
template:
20+
metadata:
21+
{{- with .Values.whosaid.annotations }}
22+
annotations:
23+
{{- toYaml . | nindent 8 }}
24+
{{- end }}
25+
26+
labels:
27+
app: api
28+
spec:
29+
{{- with .Values.whosaid.nodeSelector }}
30+
nodeSelector:
31+
{{- toYaml . | nindent 8 }}
32+
{{- end }}
33+
34+
containers:
35+
- image: "registry.gitlab.com/mania-dev/whosaid3/api:{{ .Values.whosaid.tag }}"
36+
imagePullPolicy: IfNotPresent
37+
name: api
38+
env:
39+
- name: DISCORD_CLIENT_ID
40+
value: {{ .Values.whosaid.client_id | quote }}
41+
- name: DISCORD_CLIENT_SECRET
42+
value: {{ .Values.whosaid.client_secret | quote }}
43+
- name: DISCORD_ENDPOINT
44+
value: https://discord.com/api/v8
45+
- name: DISCORD_SCOPE
46+
value: identity
47+
- name: REDIRECT_URI
48+
value: "https://{{- include "whosaid.environmentUrl" . }}/auth/discord"
49+
- name: CORS_ORIGIN
50+
value: "https://{{- include "whosaid.environmentUrl" . }}"
51+
52+
ports:
53+
- containerPort: 3000
54+
protocol: TCP
55+
resources:
56+
requests:
57+
memory: "128Mi"
58+
cpu: "50m"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: Ingress
3+
metadata:
4+
annotations:
5+
kubernetes.io/ingress.class: nginx
6+
cert-manager.io/cluster-issuer: letsencrypt-prod
7+
{{- with .Values.whosaid.annotations }}
8+
{{- toYaml . | nindent 4 }}
9+
{{- end }}
10+
11+
name: api-ingress
12+
namespace: {{ .Release.Namespace }}
13+
spec:
14+
tls:
15+
- hosts:
16+
- "api.{{- include "whosaid.environmentUrl" . }}"
17+
secretName: whosaid-api-tls-{{ .Values.whosaid.env }}
18+
rules:
19+
- host: "api.{{- include "whosaid.environmentUrl" . }}"
20+
http:
21+
paths:
22+
- path: /
23+
pathType: Prefix
24+
backend:
25+
service:
26+
name: api
27+
port:
28+
number: 80
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
labels:
5+
app: api
6+
name: api
7+
namespace: {{ .Release.Namespace }}
8+
{{- with .Values.whosaid.annotations }}
9+
annotations:
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
13+
spec:
14+
ports:
15+
- protocol: TCP
16+
port: 80
17+
targetPort: 3000
18+
selector:
19+
app: api
20+
type: NodePort
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
labels:
5+
app: bot
6+
name: bot
7+
namespace: {{ .Release.Namespace }}
8+
9+
{{- with .Values.whosaid.annotations }}
10+
annotations:
11+
{{- toYaml . | nindent 4 }}
12+
{{- end }}
13+
14+
spec:
15+
replicas: 1
16+
selector:
17+
matchLabels:
18+
app: bot
19+
template:
20+
metadata:
21+
{{- with .Values.whosaid.annotations }}
22+
annotations:
23+
{{- toYaml . | nindent 8 }}
24+
{{- end }}
25+
26+
labels:
27+
app: bot
28+
spec:
29+
{{- with .Values.whosaid.nodeSelector }}
30+
nodeSelector:
31+
{{- toYaml . | nindent 8 }}
32+
{{- end }}
33+
34+
containers:
35+
- image: "registry.gitlab.com/mania-dev/whosaid3/bot:{{ .Values.whosaid.tag }}"
36+
imagePullPolicy: IfNotPresent
37+
name: bot
38+
env:
39+
- name: DISCORD_TOKEN
40+
valueFrom:
41+
secretKeyRef:
42+
key: token
43+
name: bot-config
44+
- name: LOG_LEVEL
45+
value: {{ .Values.whosaid.bot.logLevel }}
46+
- name: HASURA_HTTP_PROTOCOL
47+
value: http
48+
- name: HASURA_WS_PROTOCOL
49+
value: ws
50+
- name: HASURA_HOST
51+
value: hasura
52+
- name: HASURA_PORT
53+
value: "80"
54+
- name: HASURA_PATH
55+
value: "/v1/graphql"
56+
- name: HASURA_ADMIN_SECRET
57+
value: {{ .Values.hasura.adminSecret }}
58+
ports:
59+
- containerPort: 3000
60+
protocol: TCP
61+
resources:
62+
requests:
63+
memory: "128Mi"
64+
cpu: "50m"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: bot-config
5+
namespace: {{ .Release.Namespace }}
6+
{{- with .Values.whosaid.annotations }}
7+
annotations:
8+
{{- toYaml . | nindent 4 }}
9+
{{- end }}
10+
11+
stringData:
12+
token: "{{ .Values.whosaid.token }}"

0 commit comments

Comments
 (0)