Skip to content

Commit 520056e

Browse files
committed
fix(chart): allow metadata and additional labels
1 parent 5fcd99d commit 520056e

5 files changed

Lines changed: 39 additions & 2 deletions

File tree

charts/sourcebot/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ Sourcebot is a self-hosted tool that helps you understand your codebase.
2222

2323
| Key | Type | Default | Description |
2424
|-----|------|---------|-------------|
25+
| additionalLabels | object | `{}` | Add extra labels to all resources |
2526
| fullnameOverride | string | `""` | Override the full name of the deployed resources, defaults to a combination of the release name and the name for the selector labels |
2627
| global.imagePullSecrets | list | `[]` | Global Docker registry secret names as an array |
28+
| global.metadata | object | `{}` | Global metadata for deployment tooling |
2729
| global.security.allowInsecureImages | bool | `true` | Allow insecure images to use bitnami legacy repository. Can be set to false if secure images are being used (Paid). |
2830
| nameOverride | string | `""` | Override the name for the selector labels, defaults to the chart name |
2931
| postgresql.auth.args | string | `""` | Additional database connection arguments |

charts/sourcebot/templates/_helpers.tpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ helm.sh/chart: {{ include "sourcebot.chart" $ }}
4040
app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }}
4141
{{- end }}
4242
app.kubernetes.io/managed-by: {{ $.Release.Service }}
43-
{{- with $.Values.additionalLabels }}
43+
{{- $additionalLabels := mergeOverwrite (dict) (default dict $.Values.sourcebot.additionalLabels) (default dict $.Values.additionalLabels) }}
44+
{{- with $additionalLabels }}
4445
{{ toYaml . }}
4546
{{- end }}
4647
{{- end }}

charts/sourcebot/tests/basic_test.yaml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,28 @@ tests:
6767
value: Helm
6868
template: deployment.yaml
6969

70+
- it: should include root additional labels
71+
values:
72+
- ../values.lint.yaml
73+
set:
74+
additionalLabels.component: sourcebot
75+
asserts:
76+
- equal:
77+
path: metadata.labels.component
78+
value: sourcebot
79+
template: deployment.yaml
80+
81+
- it: should include sourcebot additional labels
82+
values:
83+
- ../values.lint.yaml
84+
set:
85+
sourcebot.additionalLabels.component: sourcebot
86+
asserts:
87+
- equal:
88+
path: metadata.labels.component
89+
value: sourcebot
90+
template: deployment.yaml
91+
7092
- it: should use correct image when tag is specified
7193
values:
7294
- ../values.lint.yaml
@@ -183,4 +205,3 @@ tests:
183205
- isNotEmpty:
184206
path: data["config.json"]
185207
template: config.yaml
186-

charts/sourcebot/values.schema.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
"imagePullSecrets": {
2020
"type": "array",
2121
"items": { "type": "string" }
22+
},
23+
"metadata": {
24+
"type": "object"
2225
}
2326
}
2427
},
@@ -28,6 +31,9 @@
2831
"fullnameOverride": {
2932
"type": "string"
3033
},
34+
"additionalLabels": {
35+
"type": "object"
36+
},
3137
"sourcebot": {
3238
"type": "object",
3339
"additionalProperties": false,

charts/sourcebot/values.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,19 @@ global:
88
# -- Global Docker registry secret names as an array
99
imagePullSecrets: []
1010

11+
# -- Global metadata for deployment tooling
12+
metadata: {}
13+
1114
# -- Override the name for the selector labels, defaults to the chart name
1215
nameOverride: ""
1316

1417
# -- Override the full name of the deployed resources, defaults to a combination of the release name and the name for the selector labels
1518
fullnameOverride: ""
1619

20+
# -- Add extra labels to all resources
21+
additionalLabels: {}
22+
# team: sourcebot
23+
1724
# Core Sourcebot Configuration
1825
sourcebot:
1926
# -- Set the number of replicas for the deployment

0 commit comments

Comments
 (0)