Skip to content

Commit

Permalink
Two Deployment chart templates
Browse files Browse the repository at this point in the history
  • Loading branch information
rielas committed Jan 11, 2024
1 parent b79a3a0 commit 950e3d8
Show file tree
Hide file tree
Showing 10 changed files with 176 additions and 271 deletions.
4 changes: 2 additions & 2 deletions charts/brokencrystals/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Expand the name of the chart.
*/}}
{{- define "brokencrystals.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 50 | trimSuffix "-" }}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Expand All @@ -27,7 +27,7 @@ If release name contains chart name it will be used as a full name.
Create chart name and version as used by the chart label.
*/}}
{{- define "brokencrystals.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 50 | trimSuffix "-" }}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Expand Down
62 changes: 0 additions & 62 deletions charts/brokencrystals/templates/bc-postgres-deployment.yaml

This file was deleted.

171 changes: 149 additions & 22 deletions charts/brokencrystals/templates/bc-prod-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,37 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "brokencrystals.fullname" . }}-nodejs
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
labels:
app: {{ include "brokencrystals.fullname" . }}-nodejs
app: {{ .Release.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
selector:
matchLabels:
app: {{ include "brokencrystals.fullname" . }}-nodejs
app: {{ .Release.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ include "brokencrystals.fullname" . }}-nodejs
app.kubernetes.io/instance: {{ .Release.Name }}
app: {{ .Release.Name }}
spec:
hostAliases:
- ip: "127.0.0.1"
hostnames:
- "postgres"
- "keycloak"
- "nodejs"
- "proxy"
containers:
- name: {{ include "brokencrystals.fullname" . }}-nodejs-app
image: neuralegion/brokencrystals:{{ .Values.images.main }}
# command: ["/bin/sleep"]
# args: ["10000"]
- name: nodejs
image: brightsec/brokencrystals:{{ .Values.images.main }}
env:
- name: URL
value: "https://{{ .Values.ingress.url }}"
# value: "https://brokencrystals.com"
- name: DATABASE_HOST
value: "{{ include "brokencrystals.fullname" . }}-postgres"
value: "postgres"
- name: DATABASE_SCHEMA
value: "bc"
- name: DATABASE_USER
Expand Down Expand Up @@ -58,31 +64,152 @@ spec:
value: "https://raw.githubusercontent.com/NeuraLegion/brokencrystals/development/config/keys/x509.crt"
resources:
requests:
cpu: 1800m
cpu: 500m
memory: 1024Mi
limits:
memory: 15G
livenessProbe:
httpGet:
path: /api/config
port: 3000
scheme: HTTP
initialDelaySeconds: 120
periodSeconds: 30
- name: postgres
image: postgres
livenessProbe:
tcpSocket:
port: 5432
initialDelaySeconds: 60
periodSeconds: 30
env:
- name: POSTGRES_DB
value: "bc"
- name: POSTGRES_USER
value: "bc"
- name: POSTGRES_PASSWORD
value: "bc"
resources:
requests:
cpu: 200m
memory: 100Mi
volumeMounts:
- name: {{ include "brokencrystals.fullname" . }}-postgres
mountPath: /docker-entrypoint-initdb.d/pg.sql
subPath: pg.sql
readOnly: true

- name: keycloak
image: jboss/keycloak:latest
resources:
requests:
cpu: 100m
memory: 500Mi
livenessProbe:
httpGet:
path: /
port: 8080
scheme: HTTP
initialDelaySeconds: 120
periodSeconds: 30
env:
- name: DB_VENDOR
value: "POSTGRES"
- name: DB_ADDR
value: "{{ include "brokencrystals.fullname" . }}-keycloak-postgres"
- name: DB_DATABASE
value: "keycloak"
- name: DB_SCHEMA
value: "public"
- name: DB_PASSWORD
value: "password"
- name: KEYCLOAK_USER
value: "admin"
- name: KEYCLOAK_PASSWORD
value: "Pa55w0rd"
- name: KEYCLOAK_IMPORT
value: "/opt/jboss/keycloak/imports/realm-export.json -Dkeycloak.profile.feature.upload_scripts=enabled"
- name: PROXY_ADDRESS_FORWARDING
value: "true"
- name: KEYCLOAK_FRONTEND_URL
value: "https://auth{{ .Values.ingress.authlevel }}{{ .Values.ingress.url }}/auth/"
volumeMounts:
- name: {{ include "brokencrystals.fullname" . }}-keycloak
mountPath: /opt/jboss/keycloak/imports/realm-export.json
subPath: realm-export.json
readOnly: true
- name: proxy
image: neuralegion/brokencrystals-proxy-http:{{ .Values.images.client }}
env:
- name: URL
value: "https://{{ .Values.ingress.url }}"
- name: DATABASE_HOST
value: "postgres"
- name: DATABASE_SCHEMA
value: "bc"
- name: DATABASE_USER
value: "bc"
- name: DATABASE_PASSWORD
value: "bc"
- name: DATABASE_PORT
value: "5432"
- name: DATABASE_DEBUG
value: "true"
- name: AWS_BUCKET
value: "https://neuralegion-open-bucket.s3.amazonaws.com"
- name: GOOGLE_MAPS_API
value: "AIzaSyD2wIxpYCuNI0Zjt8kChs2hLTS5abVQfRQ"
- name: JWT_PRIVATE_KEY_LOCATION
value: "config/keys/jwtRS256.key"
- name: JWT_PUBLIC_KEY_LOCATION
value: "config/keys/jwtRS256.key.pub.pem"
- name: JWT_SECRET_KEY
value: "1234"
- name: JWK_PRIVATE_KEY_LOCATION
value: "config/keys/jwk.key.pem"
- name: JWK_PUBLIC_KEY_LOCATION
value: "config/keys/jwk.pub.key.pem"
- name: JWK_PUBLIC_JSON
value: "config/keys/jwk.pub.json"
- name: JKU_URL
value: "https://raw.githubusercontent.com/NeuraLegion/brokencrystals/development/config/keys/jku.json"
- name: X5U_URL
value: "https://raw.githubusercontent.com/NeuraLegion/brokencrystals/development/config/keys/x509.crt"
volumeMounts:
- name: {{ include "brokencrystals.fullname" . }}-nginx-proxy
mountPath: /etc/nginx/conf.d/default.conf
subPath: default.conf
readOnly: true
resources:
requests:
cpu: 500m
memory: 50Mi
livenessProbe:
httpGet:
path: /
port: 80
scheme: HTTP
initialDelaySeconds: 120
periodSeconds: 30
restartPolicy: Always

volumes:
- name: {{ include "brokencrystals.fullname" . }}-postgres
configMap:
name: {{ include "brokencrystals.fullname" . }}-postgres
- name: {{ include "brokencrystals.fullname" . }}-keycloak
configMap:
name: {{ include "brokencrystals.fullname" . }}-keycloak
- name: {{ include "brokencrystals.fullname" . }}-nginx-proxy
configMap:
name: {{ include "brokencrystals.fullname" . }}-nginx-proxy
---
kind: Service
apiVersion: v1
metadata:
# name: bc-nodejs-prod-service
name: {{ include "brokencrystals.fullname" . }}-nodejs
namespace: {{ .Release.Namespace }}
name: {{ .Release.Name }}
spec:
selector:
app: {{ include "brokencrystals.fullname" . }}-nodejs
app: {{ .Release.Name }}
ports:
- name: http
port: 3000
- port: 80
protocol: TCP
targetPort: 3000

targetPort: 80
91 changes: 0 additions & 91 deletions charts/brokencrystals/templates/bc-prod-proxy-deployment.yaml

This file was deleted.

File renamed without changes.
Loading

0 comments on commit 950e3d8

Please sign in to comment.