Skip to content

Commit e7d1e39

Browse files
committed
add web and app service
1 parent cd2b003 commit e7d1e39

24 files changed

+668
-7
lines changed

charts/ctrlplane/Chart.lock

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,11 @@ dependencies:
2020
- name: workspace-engine
2121
repository: file://charts/workspace-engine
2222
version: 0.1.0
23-
digest: sha256:0e91f273ef3731567ede504f5dee53983823962a69f54d2e13047e221253f98b
24-
generated: "2025-10-20T11:22:56.849671-07:00"
23+
- name: api
24+
repository: file://charts/api
25+
version: 1.0.0
26+
- name: web
27+
repository: file://charts/web
28+
version: 1.0.0
29+
digest: sha256:756516a6f12884144d13d94d9316e767188d95aedb9009634e80f16e46b1bbd7
30+
generated: "2025-10-26T13:32:54.817996-04:00"

charts/ctrlplane/Chart.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: ctrlplane
33
description: Ctrlplane Helm chart for Kubernetes
44
type: application
5-
version: 0.5.1
5+
version: 0.6.0
66
appVersion: "1.16.0"
77

88
maintainers:
@@ -39,3 +39,11 @@ dependencies:
3939
condition: workspace-engine.install
4040
version: "*.*.*"
4141
repository: "file://charts/workspace-engine"
42+
- name: api
43+
condition: api.install
44+
version: "*.*.*"
45+
repository: "file://charts/api"
46+
- name: web
47+
condition: web.install
48+
version: "*.*.*"
49+
repository: "file://charts/web"
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/
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v2
2+
name: api
3+
description: A Helm chart for Kubernetes
4+
type: application
5+
version: 1.0.0
6+
appVersion: "1.0.0"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# webservice
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "api.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 "api.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 "api.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "api.labels" -}}
37+
helm.sh/chart: {{ include "api.chart" . }}
38+
{{ include "api.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+
Selector labels
47+
*/}}
48+
{{- define "api.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "api.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "api.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "api.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
{{- $imageCfg := dict "global" $.Values.global.image "local" $.Values.image -}}
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: {{ include "api.fullname" . }}
6+
labels:
7+
{{- include "api.labels" . | nindent 4 }}
8+
{{- if .Values.deployment.labels -}}
9+
{{- toYaml .Values.deployment.labels | nindent 4 }}
10+
{{- end }}
11+
annotations:
12+
{{- if .Values.deployment.annotations -}}
13+
{{- toYaml .Values.deployment.annotations | nindent 4 }}
14+
{{- end }}
15+
spec:
16+
replicas: {{ .Values.replica }}
17+
selector:
18+
matchLabels:
19+
{{- include "api.selectorLabels" . | nindent 6 }}
20+
template:
21+
metadata:
22+
labels:
23+
{{- include "api.labels" . | nindent 8 }}
24+
annotations:
25+
{{- if .Values.pod.annotations -}}
26+
{{- toYaml .Values.pod.annotations | nindent 8 }}
27+
{{- end }}
28+
spec:
29+
serviceAccountName: {{ include "api.serviceAccountName" . }}
30+
{{- if .tolerations }}
31+
tolerations:
32+
{{- toYaml .tolerations | nindent 8 }}
33+
{{- end }}
34+
{{- include "ctrlplane.nodeSelector" . | nindent 6 }}
35+
{{- include "ctrlplane.priorityClassName" . | nindent 6 }}
36+
{{- include "ctrlplane.podSecurityContext" .Values.pod.securityContext | nindent 6 }}
37+
containers:
38+
- name: api
39+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
40+
ports:
41+
- name: api
42+
containerPort: 8081
43+
protocol: TCP
44+
env:
45+
- name: BASE_URL
46+
value: {{ .Values.global.fqdn }}
47+
- name: AUTH_URL
48+
value: {{ .Values.global.fqdn }}
49+
50+
- name: VARIABLES_AES_256_KEY
51+
valueFrom:
52+
secretKeyRef:
53+
name: {{ .Release.Name }}-encryption-key
54+
key: AES_256_KEY
55+
56+
{{- if ne .Values.global.authProviders.google.clientId "" }}
57+
- name: AUTH_GOOGLE_CLIENT_ID
58+
value: {{ .Values.global.authProviders.google.clientId }}
59+
- name: AUTH_GOOGLE_CLIENT_SECRET
60+
value: {{ .Values.global.authProviders.google.clientSecret }}
61+
{{- end }}
62+
63+
{{- if ne .Values.global.authProviders.oidc.clientId "" }}
64+
- name: AUTH_OIDC_ISSUER
65+
value: {{ .Values.global.authProviders.oidc.issuer }}
66+
- name: AUTH_OIDC_CLIENT_ID
67+
value: {{ .Values.global.authProviders.oidc.clientId }}
68+
- name: AUTH_OIDC_CLIENT_SECRET
69+
value: {{ .Values.global.authProviders.oidc.clientSecret }}
70+
{{- end }}
71+
72+
{{- if eq .Values.global.authProviders.credentials.enabled "true" }}
73+
- name: AUTH_CREDENTIALS_ENABLED
74+
value: "true"
75+
{{- else if eq .Values.global.authProviders.credentials.enabled "false" }}
76+
- name: AUTH_CREDENTIALS_ENABLED
77+
value: "false"
78+
{{- else }}
79+
- name: AUTH_CREDENTIALS_ENABLED
80+
value: "auto"
81+
{{- end }}
82+
83+
- name: KAFKA_BROKERS
84+
value: {{ .Values.global.kafkaBrokers | quote }}
85+
86+
- name: POSTGRES_URL
87+
valueFrom:
88+
secretKeyRef:
89+
name: {{ .Release.Name }}-connections
90+
key: POSTGRES_URL
91+
92+
- name: AUTH_SECRET
93+
valueFrom:
94+
secretKeyRef:
95+
name: {{ include "api.fullname" . }}
96+
key: AUTH_SECRET
97+
- name: GITHUB_URL
98+
value: {{ include "ctrlplane.githubUrl" . }}
99+
{{- with (include "ctrlplane.githubBot" . | fromYaml) }}
100+
- name: GITHUB_BOT_NAME
101+
value: {{ .name | quote }}
102+
- name: GITHUB_BOT_APP_ID
103+
value: {{ .appId | quote }}
104+
- name: GITHUB_BOT_CLIENT_ID
105+
value: {{ .clientId | quote }}
106+
- name: GITHUB_BOT_CLIENT_SECRET
107+
valueFrom:
108+
secretKeyRef:
109+
name: {{ .secretRef }}
110+
key: GITHUB_BOT_CLIENT_SECRET
111+
optional: true
112+
- name: GITHUB_BOT_PRIVATE_KEY
113+
valueFrom:
114+
secretKeyRef:
115+
name: {{ .secretRef }}
116+
key: GITHUB_BOT_PRIVATE_KEY
117+
optional: true
118+
- name: GITHUB_WEBHOOK_SECRET
119+
valueFrom:
120+
secretKeyRef:
121+
name: {{ .secretRef }}
122+
key: GITHUB_WEBHOOK_SECRET
123+
optional: true
124+
# - name: OTEL_EXPORTER_OTLP_ENDPOINT
125+
# value: http://{{ $.Release.Name }}-otel:4318
126+
{{- end }}
127+
{{- with (include "ctrlplane.azureApp" . | fromYaml) }}
128+
- name: AZURE_APP_CLIENT_ID
129+
value: {{ .clientId | quote }}
130+
{{- end }}
131+
{{- include "ctrlplane.extraEnv" . | nindent 12 }}
132+
{{- include "ctrlplane.extraEnvFrom" (dict "root" $ "local" .) | nindent 12 }}
133+
livenessProbe:
134+
httpGet:
135+
path: /api/healthz
136+
port: api
137+
readinessProbe:
138+
httpGet:
139+
path: /api/healthz
140+
port: api
141+
startupProbe:
142+
httpGet:
143+
path: /api/healthz
144+
port: api
145+
resources:
146+
{{- toYaml .Values.resources | nindent 12 }}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
apiVersion: autoscaling/v2
2+
kind: HorizontalPodAutoscaler
3+
metadata:
4+
name: {{ include "api.fullname" . }}
5+
namespace: {{ $.Release.Namespace }}
6+
labels:
7+
{{- include "api.labels" . | nindent 4 }}
8+
{{- if .Values.hpa.labels -}}
9+
{{- toYaml .Values.hpa.labels | nindent 4 }}
10+
{{- end }}
11+
annotations:
12+
{{- if .Values.hpa.annotations -}}
13+
{{- toYaml .Values.hpa.annotations | nindent 4 }}
14+
{{- end }}
15+
spec:
16+
scaleTargetRef:
17+
apiVersion: apps/v1
18+
kind: Deployment
19+
name: {{ include "api.fullname" . }}
20+
minReplicas: {{ .Values.hpa.minReplicas }}
21+
maxReplicas: {{ .Values.hpa.maxReplicas }}
22+
metrics:
23+
- type: Resource
24+
resource:
25+
name: cpu
26+
target:
27+
type: Utilization
28+
averageUtilization: 70
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{{- $secretName := (include "api.fullname" .) }}
2+
{{- $secret := (lookup "v1" "Secret" .Release.Namespace $secretName) }}
3+
apiVersion: v1
4+
kind: Secret
5+
metadata:
6+
name: {{ $secretName }}
7+
labels:
8+
{{- include "api.labels" . | nindent 4 }}
9+
data:
10+
{{- if $secret }}
11+
AUTH_SECRET: {{ $secret.data.AUTH_SECRET }}
12+
{{- else }}
13+
AUTH_SECRET: {{ randAlphaNum 64 | b64enc }}
14+
{{- end }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "api.fullname" . }}
5+
labels:
6+
{{- include "api.labels" . | nindent 4 }}
7+
{{- if .Values.service.labels -}}
8+
{{- toYaml .Values.service.labels | nindent 4 }}
9+
{{- end }}
10+
annotations:
11+
{{- if .Values.service.annotations -}}
12+
{{- toYaml .Values.service.annotations | nindent 4 }}
13+
{{- end }}
14+
spec:
15+
type: {{ .Values.service.type }}
16+
ports:
17+
- port: 8081
18+
protocol: TCP
19+
name: http-api
20+
selector:
21+
{{- include "api.labels" . | nindent 4 }}

0 commit comments

Comments
 (0)