Skip to content

Commit 184e9bd

Browse files
authored
Update helm chart (#2)
* Some renaming to better align with our needs, make badges and hub launch in k8s * Finish adding missing env vars for hub chart * Align ports; remove container layer control across all * Add hub env vars to grafana deployment * Grafana updates complete; http port fixed * coderabbit fixes * Fix one secret inconsistency * Add notes for external secrets? About as good as we can do since we don't generate the secrets. * Coderabbit is super picky
1 parent 7c7a6f1 commit 184e9bd

16 files changed

+241
-102
lines changed

charts/lunar-hub/Chart.yaml

Lines changed: 0 additions & 5 deletions
This file was deleted.

charts/lunar-hub/templates/hub-service.yaml

Lines changed: 0 additions & 19 deletions
This file was deleted.

charts/lunar/Chart.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v2
2+
name: lunar
3+
description: A Helm chart for Earthly Lunar 🌙
4+
type: application
5+
version: 0.1.0

charts/lunar/templates/NOTES.txt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
🌙 Lunar has been installed!
2+
3+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
4+
5+
The following Kubernetes secrets must exist in the target namespace
6+
before pods will start. Create them manually, or use an external
7+
secret manager (e.g. External Secrets Operator, Sealed Secrets, Vault).
8+
9+
Secret names and keys are configurable in values.yaml.
10+
11+
Hub (required):
12+
{{ printf "%-30s" .Values.hub.db.user.secretName }} key: {{ .Values.hub.db.user.secretKey }}
13+
{{ printf "%-30s" .Values.hub.db.pass.secretName }} key: {{ .Values.hub.db.pass.secretKey }}
14+
{{ printf "%-30s" .Values.hub.auth.secretName }} key: {{ .Values.hub.auth.secretKey }}
15+
{{ printf "%-30s" .Values.hub.github.app.privateKey.secretName }} key: {{ .Values.hub.github.app.privateKey.secretKey }}
16+
{{ printf "%-30s" .Values.hub.github.token.secretName }} key: {{ .Values.hub.github.token.secretKey }}
17+
{{ printf "%-30s" .Values.hub.github.webhookSecret.secretName }} key: {{ .Values.hub.github.webhookSecret.secretKey }}
18+
{{ printf "%-30s" .Values.hub.secrets.collector.secretName }} key: {{ .Values.hub.secrets.collector.secretKey }}
19+
{{ printf "%-30s" .Values.hub.secrets.cataloger.secretName }} key: {{ .Values.hub.secrets.cataloger.secretKey }}
20+
{{ printf "%-30s" .Values.hub.secrets.policy.secretName }} key: {{ .Values.hub.secrets.policy.secretKey }}
21+
{{- if .Values.hub.logging.elastic.url }}
22+
23+
Elastic (when hub.logging.elastic.url is set):
24+
{{ printf "%-30s" .Values.hub.logging.elastic.apiKeySecret.secretName }} key: {{ .Values.hub.logging.elastic.apiKeySecret.secretKey }}
25+
{{- end }}
26+
{{- if .Values.badges.enabled }}
27+
28+
Badges (when badges.enabled is true):
29+
{{ printf "%-30s" .Values.badges.secret.name }} key: {{ .Values.badges.secret.key }}
30+
{{- end }}
31+
{{- if .Values.grafana.enabled }}
32+
33+
Grafana (when grafana.enabled is true):
34+
{{ printf "%-30s" .Values.grafana.admin.user.secretName }} key: {{ .Values.grafana.admin.user.secretKey }}
35+
{{ printf "%-30s" .Values.grafana.admin.password.secretName }} key: {{ .Values.grafana.admin.password.secretKey }}
36+
{{- end }}
37+
38+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{/*
22
Expand the name of the chart.
33
*/}}
4-
{{- define "lunar-hub.name" -}}
4+
{{- define "lunar.name" -}}
55
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
66
{{- end }}
77

@@ -10,7 +10,7 @@ Create a default fully qualified app name.
1010
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
1111
If release name contains chart name it will be used as a full name.
1212
*/}}
13-
{{- define "lunar-hub.fullname" -}}
13+
{{- define "lunar.fullname" -}}
1414
{{- if .Values.fullnameOverride }}
1515
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
1616
{{- else }}
@@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name.
2626
{{/*
2727
Create chart name and version as used by the chart label.
2828
*/}}
29-
{{- define "lunar-hub.chart" -}}
29+
{{- define "lunar.chart" -}}
3030
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
3131
{{- end }}
3232

3333
{{/*
3434
Common labels
3535
*/}}
36-
{{- define "lunar-hub.labels" -}}
37-
helm.sh/chart: {{ include "lunar-hub.chart" . }}
38-
{{ include "lunar-hub.selectorLabels" . }}
36+
{{- define "lunar.labels" -}}
37+
helm.sh/chart: {{ include "lunar.chart" . }}
38+
{{ include "lunar.selectorLabels" . }}
3939
{{- if .Chart.AppVersion }}
4040
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
4141
{{- end }}
@@ -45,17 +45,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
4545
{{/*
4646
Selector labels
4747
*/}}
48-
{{- define "lunar-hub.selectorLabels" -}}
49-
app.kubernetes.io/name: {{ include "lunar-hub.name" . }}
48+
{{- define "lunar.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "lunar.name" . }}
5050
app.kubernetes.io/instance: {{ .Release.Name }}
5151
{{- end }}
5252

5353
{{/*
5454
Create the name of the service account to use
5555
*/}}
56-
{{- define "lunar-hub.serviceAccountName" -}}
56+
{{- define "lunar.serviceAccountName" -}}
5757
{{- if .Values.serviceAccount.create }}
58-
{{- default (include "lunar-hub.fullname" .) .Values.serviceAccount.name }}
58+
{{- default (include "lunar.fullname" .) .Values.serviceAccount.name }}
5959
{{- else }}
6060
{{- default "default" .Values.serviceAccount.name }}
6161
{{- end }}

charts/lunar-hub/templates/badges-deployment.yaml renamed to charts/lunar/templates/badges-deployment.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
apiVersion: apps/v1
33
kind: Deployment
44
metadata:
5-
name: {{ include "lunar-hub.fullname" . }}-badges
5+
name: {{ include "lunar.fullname" . }}-badges
66
labels:
7-
{{- include "lunar-hub.labels" . | nindent 4 }}
7+
{{- include "lunar.labels" . | nindent 4 }}
88
spec:
99
replicas: 1
1010
selector:
1111
matchLabels:
12-
{{- include "lunar-hub.selectorLabels" . | nindent 6 }}
12+
{{- include "lunar.selectorLabels" . | nindent 6 }}
1313
template:
1414
metadata:
1515
{{- with .Values.badges.podAnnotations }}
1616
annotations:
1717
{{- toYaml . | nindent 8 }}
1818
{{- end }}
1919
labels:
20-
{{- include "lunar-hub.labels" . | nindent 8 }}
20+
{{- include "lunar.labels" . | nindent 8 }}
2121
{{- with .Values.badges.podLabels }}
2222
{{- toYaml . | nindent 8 }}
2323
{{- end }}
@@ -26,7 +26,7 @@ spec:
2626
imagePullSecrets:
2727
{{- toYaml . | nindent 8 }}
2828
{{- end }}
29-
serviceAccountName: {{ include "lunar-hub.serviceAccountName" . }}
29+
serviceAccountName: {{ include "lunar.serviceAccountName" . }}
3030
{{- with .Values.badges.podSecurityContext }}
3131
securityContext:
3232
{{- toYaml . | nindent 8 }}
@@ -41,17 +41,18 @@ spec:
4141
imagePullPolicy: {{ .Values.badges.image.pullPolicy }}
4242
{{- with .Values.badges }}
4343
env:
44-
- name: BADGES_PORT
45-
value: {{ .port | quote }}
4644
- name: BADGES_SECRET
4745
valueFrom:
4846
secretKeyRef:
4947
name: {{ .secret.name }}
5048
key: {{ .secret.key }}
5149
{{- end }}
50+
{{- with .Values.badges.extraEnv }}
51+
{{- toYaml . | nindent 12 }}
52+
{{- end }}
5253
ports:
5354
- name: http
54-
containerPort: {{ .Values.badges.port }}
55+
containerPort: 8080
5556
protocol: TCP
5657
{{- with .Values.badges.resources }}
5758
resources:

charts/lunar-hub/templates/badges-ingress.yaml renamed to charts/lunar/templates/badges-ingress.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
{{- if .Values.hub.ingress.enabled -}}
1+
{{- if .Values.badges.ingress.enabled -}}
22
apiVersion: networking.k8s.io/v1
33
kind: Ingress
44
metadata:
5-
name: {{ include "lunar-hub.fullname" . }}-badges
5+
name: {{ include "lunar.fullname" . }}-badges
66
labels:
7-
{{- include "lunar-hub.labels" . | nindent 4 }}
8-
{{- with .Values.hub.ingress.annotations }}
7+
{{- include "lunar.labels" . | nindent 4 }}
8+
{{- with .Values.badges.ingress.annotations }}
99
annotations:
1010
{{- toYaml . | nindent 4 }}
1111
{{- end }}
@@ -35,7 +35,7 @@ spec:
3535
{{- end }}
3636
backend:
3737
service:
38-
name: {{ include "lunar-hub.fullname" $ }}-badges
38+
name: {{ include "lunar.fullname" $ }}-badges
3939
port:
4040
number: {{ $.Values.badges.service.port }}
4141
{{- end }}

charts/lunar-hub/templates/badges-service.yaml renamed to charts/lunar/templates/badges-service.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
apiVersion: v1
33
kind: Service
44
metadata:
5-
name: {{ include "lunar-hub.fullname" . }}-badges
5+
name: {{ include "lunar.fullname" . }}-badges
66
labels:
7-
{{- include "lunar-hub.labels" . | nindent 4 }}
7+
{{- include "lunar.labels" . | nindent 4 }}
88
spec:
99
type: {{ .Values.badges.service.type }}
1010
ports:
1111
- port: {{ .Values.badges.service.port }}
12-
targetPort: {{ .Values.badges.port }}
12+
targetPort: http
1313
protocol: TCP
1414
name: badges-rest
1515
selector:
16-
{{- include "lunar-hub.selectorLabels" . | nindent 4 }}
16+
{{- include "lunar.selectorLabels" . | nindent 4 }}
1717
{{- end }}

charts/lunar-hub/templates/grafana-deployment.yaml renamed to charts/lunar/templates/grafana-deployment.yaml

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
apiVersion: apps/v1
33
kind: Deployment
44
metadata:
5-
name: {{ include "lunar-hub.fullname" . }}-grafana
5+
name: {{ include "lunar.fullname" . }}-grafana
66
labels:
7-
{{- include "lunar-hub.labels" . | nindent 4 }}
7+
{{- include "lunar.labels" . | nindent 4 }}
88
spec:
99
replicas: 1
1010
selector:
1111
matchLabels:
12-
{{- include "lunar-hub.selectorLabels" . | nindent 6 }}
12+
{{- include "lunar.selectorLabels" . | nindent 6 }}
1313
template:
1414
metadata:
1515
{{- with .Values.grafana.podAnnotations }}
1616
annotations:
1717
{{- toYaml . | nindent 8 }}
1818
{{- end }}
1919
labels:
20-
{{- include "lunar-hub.labels" . | nindent 8 }}
20+
{{- include "lunar.labels" . | nindent 8 }}
2121
{{- with .Values.grafana.podLabels }}
2222
{{- toYaml . | nindent 8 }}
2323
{{- end }}
@@ -26,7 +26,7 @@ spec:
2626
imagePullSecrets:
2727
{{- toYaml . | nindent 8 }}
2828
{{- end }}
29-
serviceAccountName: {{ include "lunar-hub.serviceAccountName" . }}
29+
serviceAccountName: {{ include "lunar.serviceAccountName" . }}
3030
{{- with .Values.grafana.podSecurityContext }}
3131
securityContext:
3232
{{- toYaml . | nindent 8 }}
@@ -57,15 +57,42 @@ spec:
5757
key: {{ $.Values.hub.db.pass.secretKey }}
5858
- name: POSTGRES_DB
5959
value: {{ $.Values.hub.db.name | quote }}
60+
- name: LUNAR_HUB_HOST
61+
value: {{ include "lunar.fullname" $ }}-hub
62+
- name: LUNAR_HUB_TOKEN
63+
valueFrom:
64+
secretKeyRef:
65+
name: {{ $.Values.hub.auth.secretName }}
66+
key: {{ $.Values.hub.auth.secretKey }}
67+
- name: GF_SECURITY_ADMIN_USER
68+
valueFrom:
69+
secretKeyRef:
70+
name: {{ .admin.user.secretName }}
71+
key: {{ .admin.user.secretKey }}
72+
- name: GF_SECURITY_ADMIN_PASSWORD
73+
valueFrom:
74+
secretKeyRef:
75+
name: {{ .admin.password.secretName }}
76+
key: {{ .admin.password.secretKey }}
6077
- name: GF_INSTALL_PLUGINS
61-
value: "yesoreyeram-infinity-datasource"
78+
value: "yesoreyeram-infinity-datasource,marcusolsson-dynamictext-panel,volkovlabs-echarts-panel"
79+
- name: GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS
80+
value: "earthly-json-tree-panel"
81+
- name: GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH
82+
value: "/etc/grafana/provisioning/dashboards/home.json"
83+
- name: GF_USERS_ALLOW_SIGN_UP
84+
value: "false"
85+
- name: GF_USERS_DEFAULT_THEME
86+
value: "tron"
87+
- name: GF_FEATURE_TOGGLES_ENABLE
88+
value: "grafanaconThemes"
6289
{{- with .extraEnv }}
6390
{{- toYaml . | nindent 12 }}
6491
{{- end }}
6592
{{- end }}
6693
ports:
6794
- name: http
68-
containerPort: {{ .Values.grafana.port }}
95+
containerPort: 3000
6996
protocol: TCP
7097
{{- with .Values.grafana.resources }}
7198
resources:

charts/lunar-hub/templates/grafana-ingress.yaml renamed to charts/lunar/templates/grafana-ingress.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
apiVersion: networking.k8s.io/v1
33
kind: Ingress
44
metadata:
5-
name: {{ include "lunar-hub.fullname" . }}-grafana
5+
name: {{ include "lunar.fullname" . }}-grafana
66
labels:
7-
{{- include "lunar-hub.labels" . | nindent 4 }}
7+
{{- include "lunar.labels" . | nindent 4 }}
88
{{- with .Values.grafana.ingress.annotations }}
99
annotations:
1010
{{- toYaml . | nindent 4 }}
@@ -35,7 +35,7 @@ spec:
3535
{{- end }}
3636
backend:
3737
service:
38-
name: {{ include "lunar-hub.fullname" $ }}-grafana
38+
name: {{ include "lunar.fullname" $ }}-grafana
3939
port:
4040
number: {{ $.Values.grafana.service.port }}
4141
{{- end }}

0 commit comments

Comments
 (0)