Skip to content

Commit

Permalink
Merge pull request #23 from cinaq/retraced
Browse files Browse the repository at this point in the history
retraced chart
  • Loading branch information
vktrbrlv authored Mar 11, 2024
2 parents 19cfe3c + ab22d95 commit 347bcbe
Show file tree
Hide file tree
Showing 23 changed files with 950 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/retraced/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions charts/retraced/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: retraced
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: "1.16.0"
8 changes: 8 additions & 0 deletions charts/retraced/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- end }}
62 changes: 62 additions & 0 deletions charts/retraced/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "retraced.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "retraced.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "retraced.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "retraced.labels" -}}
helm.sh/chart: {{ include "retraced.chart" . }}
{{ include "retraced.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "retraced.selectorLabels" -}}
app.kubernetes.io/name: {{ include "retraced.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "retraced.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "retraced.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
52 changes: 52 additions & 0 deletions charts/retraced/templates/retraced-admin-portal-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "retraced.fullname" . }}-admin-portal
labels:
{{- include "retraced.labels" . | nindent 4 }}
retraceddev: "1"
spec:
replicas: 1
selector:
matchLabels:
retraceddev: "1"
tier: admin-portal
template:
metadata:
labels:
app: auditlog
retraceddev: "1"
tier: admin-portal
spec:
containers:
- envFrom:
- secretRef:
name: {{ include "retraced.fullname" . }}-admin-portal
image: boxyhq/jackson:1.12.0
imagePullPolicy: IfNotPresent
name: admin-portal
ports:
- containerPort: 5225
name: http
protocol: TCP
readinessProbe:
failureThreshold: 5
httpGet:
path: /api/health
port: 5225
periodSeconds: 30
successThreshold: 2
timeoutSeconds: 10
resources:
limits:
cpu: 1000m
requests:
cpu: 100m
startupProbe:
failureThreshold: 5
httpGet:
path: /api/health
port: 5225
periodSeconds: 10
timeoutSeconds: 10
60 changes: 60 additions & 0 deletions charts/retraced/templates/retraced-admin-portal-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "retraced.fullname" . -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}-admin-portal
labels:
{{- include "retraced.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}-admin-portal
port:
number: 5225
{{- else }}
serviceName: {{ $fullName }}-admin-portal
servicePort: 5225
{{- end }}
{{- end }}
{{- end }}
{{- end }}
30 changes: 30 additions & 0 deletions charts/retraced/templates/retraced-admin-portal-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
apiVersion: v1
kind: Secret
metadata:
name: {{ include "retraced.fullname" . }}-admin-portal
labels:
{{- include "retraced.labels" . | nindent 4 }}
app: adminportal
retraceddev: "1"
stringData:
BOXYHQ_LICENSE_KEY: {{ .Values.adminPortal.secret.BOXYHQ_LICENSE_KEY }}
DB_CLEANUP_LIMIT: {{ .Values.adminPortal.secret.DB_CLEANUP_LIMIT }}
DB_ENCRYPTION_KEY: {{ .Values.adminPortal.secret.DB_ENCRYPTION_KEY }}
DB_TTL: {{ .Values.adminPortal.secret.DB_TTL }}
DB_TYPE: {{ .Values.adminPortal.secret.DB_TYPE }}
DB_URL: {{ .Values.adminPortal.secret.DB_URL }}
JACKSON_API_KEYS: {{ .Values.adminPortal.secret.JACKSON_API_KEYS }}
NEXTAUTH_ACL: {{ .Values.adminPortal.secret.NEXTAUTH_ACL }}
NEXTAUTH_JWT_SIGNING_PRIVATE_KEY: {{ .Values.adminPortal.secret.NEXTAUTH_JWT_SIGNING_PRIVATE_KEY }}
NEXTAUTH_SECRET: {{ .Values.adminPortal.secret.NEXTAUTH_SECRET }}
NEXTAUTH_URL: {{ .Values.adminPortal.secret.NEXTAUTH_URL }}
RETRACED_ADMIN_ROOT_TOKEN: {{ .Values.adminPortal.secret.RETRACED_ADMIN_ROOT_TOKEN }}
RETRACED_EXTERNAL_URL: http://{{ include "retraced.fullname" . }}-api:3000/auditlog
RETRACED_HOST_URL: http://{{ include "retraced.fullname" . }}-api:3000/auditlog
SAML_AUDIENCE: {{ .Values.adminPortal.secret.SAML_AUDIENCE }}
SMTP_FROM: {{ .Values.adminPortal.secret.SMTP_FROM }}
SMTP_HOST: {{ .Values.adminPortal.secret.SMTP_HOST }}
SMTP_PASSWORD: {{ .Values.adminPortal.secret.SMTP_PASSWORD }}
SMTP_PORT: {{ .Values.adminPortal.secret.SMTP_PORT }}
SMTP_USER: {{ .Values.adminPortal.secret.SMTP_USER }}
20 changes: 20 additions & 0 deletions charts/retraced/templates/retraced-admin-portal-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "retraced.fullname" . }}-admin-portal
labels:
{{- include "retraced.labels" . | nindent 4 }}
app: auditlog
retraceddev: "1"
tier: admin-portal
spec:
ports:
- name: http
port: 5225
targetPort: 5225
selector:
app: auditlog
retraceddev: "1"
tier: admin-portal
type: ClusterIP
14 changes: 14 additions & 0 deletions charts/retraced/templates/retraced-api-bootstrap-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
apiVersion: v1
kind: Secret
metadata:
name: {{ include "retraced.fullname" . }}-bootstrap
labels:
{{- include "retraced.labels" . | nindent 4 }}
app: bootstrap
retraceddev: "1"
stringData:
BOOTSTRAP_API_TOKEN: {{ .Values.api.secret.BOOTSTRAP_API_TOKEN }}
BOOTSTRAP_ENVIRONMENT_ID: {{ .Values.api.secret.BOOTSTRAP_ENVIRONMENT_ID }}
BOOTSTRAP_PROJECT_ID: {{ .Values.api.secret.BOOTSTRAP_PROJECT_ID }}
BOOTSTRAP_PROJECT_NAME: {{ .Values.api.secret.BOOTSTRAP_PROJECT_NAME }}
95 changes: 95 additions & 0 deletions charts/retraced/templates/retraced-api-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "retraced.fullname" . }}-api
labels:
{{- include "retraced.labels" . | nindent 4 }}
retraceddev: "1"
spec:
replicas: 1
selector:
matchLabels:
retraceddev: "1"
tier: api
template:
metadata:
labels:
app: auditlog
retraceddev: "1"
tier: api
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- auditlog
- key: tier
operator: In
values:
- api
topologyKey: kubernetes.io/hostname
weight: 1
containers:
- command:
- node
- --inspect=0.0.0.0
- build/src/index.js
env:
- name: BUGSNAG_TOKEN
valueFrom:
secretKeyRef:
key: API_TOKEN
name: {{ include "retraced.fullname" . }}-api
- name: EXPORT_PAGE_SIZE_INTERNAL
value: "2"
envFrom:
- secretRef:
name: {{ include "retraced.fullname" . }}-api
image: retracedhq/retraced:1.8.0
imagePullPolicy: IfNotPresent
name: api
ports:
- containerPort: 3000
name: http
protocol: TCP
readinessProbe:
failureThreshold: 5
httpGet:
path: /healthz
port: 3000
periodSeconds: 30
successThreshold: 2
timeoutSeconds: 10
resources:
limits:
cpu: 1000m
requests:
cpu: 100m
startupProbe:
failureThreshold: 5
httpGet:
path: /healthz
port: 3000
periodSeconds: 10
timeoutSeconds: 10
initContainers:
- args:
- -c
- ./build/src/retracedctl bootstrap --projectName "$BOOTSTRAP_PROJECT_NAME"
--projectId "$BOOTSTRAP_PROJECT_ID" --environmentId "$BOOTSTRAP_ENVIRONMENT_ID"
--apiKey "$BOOTSTRAP_API_TOKEN"
command:
- /bin/sh
envFrom:
- secretRef:
name: {{ include "retraced.fullname" . }}-api
- secretRef:
name: {{ include "retraced.fullname" . }}-bootstrap
image: retracedhq/retraced:1.8.0
name: bootstrap
Loading

0 comments on commit 347bcbe

Please sign in to comment.