Skip to content

Commit 58159e1

Browse files
authored
Merge pull request #69 from OWASP/helmcharts
Add helm charts
2 parents 943f996 + 41579d5 commit 58159e1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+678
-30
lines changed

deploy/docker/docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ services:
134134
ports:
135135
- "127.0.0.1:8888:80"
136136
environment:
137-
- GO_SERVICE=crapi-community:${COMMUNITY_SERVER_PORT:-8087}
138-
- JAVA_SERVICE=crapi-identity:${IDENTITY_SERVER_PORT:-8080}
139-
- PYTHON_SERVICE=crapi-workshop:${WORKSHOP_SERVER_PORT:-8000}
137+
- COMMUNITY_SERVICE=crapi-community:${COMMUNITY_SERVER_PORT:-8087}
138+
- IDENTITY_SERVICE=crapi-identity:${IDENTITY_SERVER_PORT:-8080}
139+
- WORKSHOP_SERVICE=crapi-workshop:${WORKSHOP_SERVER_PORT:-8000}
140140
depends_on:
141141
crapi-community:
142142
condition: service_healthy

deploy/helm/.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/

deploy/helm/Chart.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: v2
2+
name: crapi
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.0
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+
appVersion: helm
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: crapi-community-configmap
5+
labels:
6+
app: crapi-community
7+
data:
8+
DB_HOST: postgresdb
9+
DB_DRIVER: postgres
10+
JWT_SECRET: crapi
11+
DB_USER: admin
12+
DB_PASSWORD: crapisecretpassword
13+
DB_NAME: crapi
14+
DB_PORT: "5432"
15+
MONGO_DB_HOST: mongodb
16+
MONGO_DB_DRIVER: mongodb
17+
MONGO_DB_PORT: "27017"
18+
MONGO_DB_USER: admin
19+
MONGO_DB_PASSWORD: crapisecretpassword
20+
MONGO_DB_NAME: crapi
21+
SERVER_PORT: "{{ .Values.community.port }}"
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: crapi-community
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app: crapi-community
10+
template:
11+
metadata:
12+
labels:
13+
app: crapi-community
14+
spec:
15+
initContainers:
16+
- name: wait-for-postgres
17+
image: groundnuty/k8s-wait-for:v1.3
18+
imagePullPolicy: Always
19+
args:
20+
- "service"
21+
- "postgresdb"
22+
- name: wait-for-mongo
23+
image: groundnuty/k8s-wait-for:v1.3
24+
imagePullPolicy: Always
25+
args:
26+
- "service"
27+
- "mongodb"
28+
- name: wait-for-java
29+
image: groundnuty/k8s-wait-for:v1.3
30+
imagePullPolicy: Always
31+
args:
32+
- "service"
33+
- "crapi-identity"
34+
containers:
35+
- name: crapi-community
36+
image: {{ .Values.community.image }}:{{ .Chart.AppVersion }}
37+
imagePullPolicy: {{ .Values.imagePullPolicy }}
38+
ports:
39+
- containerPort: {{ .Values.community.port }}
40+
envFrom:
41+
- configMapRef:
42+
name: crapi-community-configmap
43+
resources:
44+
limits:
45+
cpu: "500m"
46+
requests:
47+
cpu: 256m
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: crapi-community
5+
labels:
6+
app: crapi-community
7+
spec:
8+
ports:
9+
- port: {{ .Values.community.port }}
10+
name: go
11+
selector:
12+
app: crapi-community
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: crapi-identity-configmap
5+
labels:
6+
app: crapi-identity
7+
data:
8+
DB_HOST: postgresdb
9+
DB_DRIVER: postgresql
10+
JWT_SECRET: crapi #Used for creating a JWT. Can be anything
11+
DB_USER: admin
12+
DB_PASSWORD: crapisecretpassword
13+
DB_NAME: crapi
14+
DB_PORT: "5432"
15+
APP_NAME: "crapi-identity"
16+
BLOCK_SHELL_INJECTION: "true"
17+
MAILHOG_HOST: mailhog
18+
MAILHOG_PORT: "1025"
19+
MAILHOG_DOMAIN: "example.com"
20+
SMTP_HOST: "smtp.example.com"
21+
SMTP_PORT: "587"
22+
SMTP_EMAIL: "[email protected]"
23+
SMTP_PASS: "xxxxxxxxxxxxxx"
24+
SMTP_FROM: "[email protected]"
25+
SMTP_AUTH: "true"
26+
SMTP_STARTTLS: "true"
27+
SERVER_PORT: "{{ .Values.identity.port }}"
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: crapi-identity
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app: crapi-identity
10+
template:
11+
metadata:
12+
labels:
13+
app: crapi-identity
14+
spec:
15+
initContainers:
16+
- name: wait-for-postgres
17+
image: groundnuty/k8s-wait-for:v1.3
18+
imagePullPolicy: Always
19+
args:
20+
- "service"
21+
- "postgresdb"
22+
containers:
23+
- name: crapi-identity
24+
image: {{ .Values.identity.image }}:{{ .Chart.AppVersion }}
25+
imagePullPolicy: {{ .Values.imagePullPolicy }}
26+
ports:
27+
- containerPort: {{ .Values.identity.port }}
28+
envFrom:
29+
- configMapRef:
30+
name: crapi-identity-configmap
31+
resources:
32+
limits:
33+
cpu: "500m"
34+
requests:
35+
cpu: 256m
36+
readinessProbe:
37+
tcpSocket:
38+
port: {{ .Values.identity.port }}
39+
initialDelaySeconds: 15
40+
periodSeconds: 10
41+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: crapi-identity
5+
labels:
6+
app: crapi-identity
7+
spec:
8+
ports:
9+
- port: {{ .Values.identity.port }}
10+
name: java
11+
selector:
12+
app: crapi-identity
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: mailhog-configmap
5+
labels:
6+
app: mailhog
7+
data:
8+
MH_MONGO_URI: admin:crapisecretpassword@mongodb:27017
9+
MH_STORAGE: mongodb

0 commit comments

Comments
 (0)