You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3d258bf
Browse filesBrowse the repository at this point in the historyBrowse files
sourcegraph: add labels to PVCs, ServiceAccounts, and RBAC objects
Render sourcegraph.labels on the standalone PersistentVolumeClaims, every
ServiceAccount, and the prometheus RBAC objects, and add per-component
storageLabels and serviceAccount.labels values, so a release that takes over
objects created outside the chart can keep the labels they already have.
Also fix the jaeger ServiceAccount, which read its name and annotations from
a tracing value that does not exist and failed to render.
Amp-Thread-ID: https://ampcode.com/threads/T-c7c725c9-ed68-48e2-9f2d-0b8c31e76050
Co-authored-by: Amp <amp@ampcode.com>
Copy file name to clipboardExpand all lines: charts/sourcegraph/CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,8 @@ Use `**BREAKING**:` to denote a breaking change
8
8
9
9
## Unreleased
10
10
11
+
- Added `storageLabels` on `blobstore`, `codeInsightsDB`, `codeIntelDB`, `pgsql`, `prometheus`, `redisCache`, and `redisStore` to label each component's PersistentVolumeClaim, and `<serviceName>.serviceAccount.labels` to label a component's ServiceAccount and, for `frontend` and `prometheus`, its Role, RoleBinding, ClusterRole, and ClusterRoleBinding. `sourcegraph.labels` and the chart's standard labels (`helm.sh/chart`, `app.kubernetes.io/name`, `app.kubernetes.io/instance`, `app.kubernetes.io/version`, `app.kubernetes.io/managed-by`) are now also rendered on these PersistentVolumeClaims, on every ServiceAccount, and on the `prometheus` RBAC objects, as they already are on every workload and on the `frontend` Role and RoleBinding, so existing releases gain these labels on upgrade. Labels on these objects can be changed in place, so nothing is recreated or restarted. See [Adopting existing workloads](README.md#adopting-existing-workloads).
12
+
- Fixed the `jaeger` ServiceAccount failing to render with `jaeger.serviceAccount.create: true`. Its name and annotations were read from a `tracing` value that does not exist, and are now read from `jaeger.serviceAccount`, as the `jaeger` Deployment's `serviceAccountName` already was.
11
13
- Added `sourcegraph.selectorLabelsOverride`, `<serviceName>.extraSelectorLabels`, and `storageLabels` on `gitserver`, `grafana`, `indexedSearch`, and `searcher`, so the chart can render the selectors and volume claim templates of workloads created outside it, such as with Kustomize, and a Helm release can take them over without deleting them. All default to empty, so existing releases render the same selectors. Never change them on an installed release: Kubernetes does not allow changing these fields. See [Adopting existing workloads](README.md#adopting-existing-workloads).
12
14
- Fixed `frontend.command` and `migrator.command` rendering a list as a single element, e.g. `["sh", "-c", "<script>"]` became `[sh -c <script>]`, so the container failed to start. Both are now rendered as YAML lists and documented in `values.yaml`. A string holding a YAML list, the only form that worked before, still renders unchanged.
13
15
- Added `openTelemetry.gateway.command` to replace the `otel-collector` container's command, e.g. with a shell wrapper that exports an exporter API key read from a mounted file
- `<serviceName>.serviceAccount.labels`adds labels to one component's
113
+
ServiceAccount, and to the Role, RoleBinding, ClusterRole, and
114
+
ClusterRoleBinding of `frontend` and `prometheus`.
115
+
116
+
```yaml
117
+
sourcegraph:
118
+
labels:
119
+
example.com/project: sourcegraph
120
+
blobstore:
121
+
storageLabels:
122
+
example.com/service: blobstore
123
+
frontend:
124
+
serviceAccount:
125
+
labels:
126
+
example.com/service: frontend
127
+
```
128
+
104
129
Helm only takes over an existing object that has the
105
130
`app.kubernetes.io/managed-by: Helm` label and the `meta.helm.sh/release-name`
106
131
and `meta.helm.sh/release-namespace` annotations, or when installing with
@@ -129,6 +154,7 @@ In addition to the documented values, all services also support the following va
129
154
- `<serviceName>.extraSelectorLabels`- add labels to the service's workload selector, pod labels, and Service and PodDisruptionBudget selectors. See [Adopting existing workloads](#adopting-existing-workloads)
130
155
- `<serviceName>.serivceAccount.create`- create service account for service
131
156
- `<serviceName>.serviceAccount.annotations`- Annotations for the service-specific service account
157
+
- `<serviceName>.serviceAccount.labels`- Labels for the service-specific service account, and for the Role, RoleBinding, ClusterRole, and ClusterRoleBinding of `frontend` and `prometheus`, in addition to `sourcegraph.labels`
132
158
- `<serviceName>.image.repository`- override the global `sourcegraph.image.repository` (registry or prefix) for this service. Defaults to `sourcegraph.image.repository` when unset.
133
159
134
160
| Key | Type | Default | Description |
@@ -148,6 +174,7 @@ In addition to the documented values, all services also support the following va
148
174
| blobstore.serviceAccount.create | bool | `false` | Enable creation of ServiceAccount for `blobstore` |
149
175
| blobstore.serviceAccount.name | string | `""` | Name of the ServiceAccount to be created or an existing ServiceAccount |
150
176
| blobstore.storageAnnotations | object | `{}` | Optional annotations to add to the `blobstore` PVC |
177
+
| blobstore.storageLabels | object | `{}` | Optional labels to add to the `blobstore` PVC, in addition to `sourcegraph.labels` |
151
178
| blobstore.storageSize | string | `"100Gi"` | PVC Storage Request for `blobstore` data volume |
152
179
| blobstore.storageSubPath | string | `""` | Optional subPath for the `blobstore` primary data volume mount |
153
180
| cadvisor.containerSecurityContext | object | `{"privileged":true}` | Security context for the `cadvisor` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) |
@@ -180,6 +207,7 @@ In addition to the documented values, all services also support the following va
180
207
| codeInsightsDB.serviceAccount.create | bool | `false` | Enable creation of ServiceAccount for `codeinsights-db` |
181
208
| codeInsightsDB.serviceAccount.name | string | `""` | Name of the ServiceAccount to be created or an existing ServiceAccount |
182
209
| codeInsightsDB.storageAnnotations | object | `{}` | Optional annotations to add to the `codeinsights-db` PVC |
210
+
| codeInsightsDB.storageLabels | object | `{}` | Optional labels to add to the `codeinsights-db` PVC, in addition to `sourcegraph.labels` |
183
211
| codeInsightsDB.storageSize | string | `"200Gi"` | PVC Storage Request for `codeinsights-db` data volume |
184
212
| codeInsightsDB.storageSubPath | string | `""` | Optional subPath for the `codeinsights-db` primary data volume mount |
185
213
| codeIntelDB.additionalConfig | string | `""` | Additional PostgreSQL configuration. This will override or extend our default configuration. Notes: This is expecting a multiline string. Learn more from our [recommended PostgreSQL configuration](https://docs.sourcegraph.com/admin/config/postgres-conf) and [PostgreSQL documentation](https://www.postgresql.org/docs/12/config-setting.html) |
@@ -202,6 +230,7 @@ In addition to the documented values, all services also support the following va
202
230
| codeIntelDB.serviceAccount.create | bool | `false` | Enable creation of ServiceAccount for `codeintel-db` |
203
231
| codeIntelDB.serviceAccount.name | string | `""` | Name of the ServiceAccount to be created or an existing ServiceAccount |
204
232
| codeIntelDB.storageAnnotations | object | `{}` | Optional annotations to add to the `codeintel-db` PVC |
233
+
| codeIntelDB.storageLabels | object | `{}` | Optional labels to add to the `codeintel-db` PVC, in addition to `sourcegraph.labels` |
205
234
| codeIntelDB.storageSize | string | `"200Gi"` | PVC Storage Request for `codeintel-db` data volume |
206
235
| codeIntelDB.storageSubPath | string | `""` | Optional subPath for the `codeintel-db` primary data volume mount |
207
236
| extraResources | list | `[]` | Additional resources to include in the rendered manifest. Templates are supported. |
@@ -376,6 +405,7 @@ In addition to the documented values, all services also support the following va
376
405
| pgsql.serviceAccount.create | bool | `false` | Enable creation of ServiceAccount for `pgsql` |
377
406
| pgsql.serviceAccount.name | string | `""` | Name of the ServiceAccount to be created or an existing ServiceAccount |
378
407
| pgsql.storageAnnotations | object | `{}` | Optional annotations to add to the `pgsql` PVC |
408
+
| pgsql.storageLabels | object | `{}` | Optional labels to add to the `pgsql` PVC, in addition to `sourcegraph.labels` |
379
409
| pgsql.storageSize | string | `"200Gi"` | PVC Storage Request for `pgsql` data volume |
380
410
| pgsql.storageSubPath | string | `""` | Optional subPath for the `pgsql` primary data volume mount |
381
411
| postgresExporter.image.defaultTag | string | `<appVersion>@sha256:<digest>`, pinned by each release | Docker image tag for the `pgsql-exporter` image |
@@ -409,6 +439,7 @@ In addition to the documented values, all services also support the following va
| prometheus.serviceAccount.name | string | `"prometheus"` | Name of the ServiceAccount to be created or an existing ServiceAccount |
411
441
| prometheus.storageAnnotations | object | `{}` | Optional annotations to add to the `prometheus` PVC |
442
+
| prometheus.storageLabels | object | `{}` | Optional labels to add to the `prometheus` PVC, in addition to `sourcegraph.labels` |
412
443
| prometheus.storageSize | string | `"200Gi"` | PVC Storage Request for `prometheus` data volume |
413
444
| prometheus.storageSubPath | string | `""` | Optional subPath for the `prometheus` primary data volume mount |
414
445
| redisCache.config.additionalConfig | string | `""` | Additional raw redis directives appended to the vendored `redis-cache` config. Notes: This is expecting a multiline string. It renders into a ConfigMap in plaintext, so do not put secrets such as `requirepass` here or in `existingConfig` (also a ConfigMap). For secrets, set `config.enabled: false` and mount a Secret using `extraVolumeMounts`. |
@@ -430,6 +461,7 @@ In addition to the documented values, all services also support the following va
430
461
| redisCache.serviceAccount.create | bool | `false` | Enable creation of ServiceAccount for `redis-cache` |
431
462
| redisCache.serviceAccount.name | string | `""` | Name of the ServiceAccount to be created or an existing ServiceAccount |
432
463
| redisCache.storageAnnotations | object | `{}` | Optional annotations to add to the `redis-cache` PVC |
464
+
| redisCache.storageLabels | object | `{}` | Optional labels to add to the `redis-cache` PVC, in addition to `sourcegraph.labels` |
433
465
| redisCache.storageSize | string | `"100Gi"` | PVC Storage Request for `redis-cache` data volume |
434
466
| redisCache.storageSubPath | string | `""` | Optional subPath for the `redis-cache` primary data volume mount |
435
467
| redisExporter.containerSecurityContext | object | `{"allowPrivilegeEscalation":false,"readOnlyRootFilesystem":true,"runAsGroup":1000,"runAsUser":999}` | Security context for the `redis-exporter` sidecar container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) |
@@ -455,6 +487,7 @@ In addition to the documented values, all services also support the following va
455
487
| redisStore.serviceAccount.create | bool | `false` | Enable creation of ServiceAccount for `redis-store` |
456
488
| redisStore.serviceAccount.name | string | `""` | Name of the ServiceAccount to be created or an existing ServiceAccount |
457
489
| redisStore.storageAnnotations | object | `{}` | Optional annotations to add to the `redis-store` PVC |
490
+
| redisStore.storageLabels | object | `{}` | Optional labels to add to the `redis-store` PVC, in addition to `sourcegraph.labels` |
458
491
| redisStore.storageSize | string | `"100Gi"` | PVC Storage Request for `redis-store` data volume |
459
492
| redisStore.storageSubPath | string | `""` | Optional subPath for the `redis-store` primary data volume mount |
460
493
| searcher.autoCacheSize | bool | `false` | When enabled, omit the `SEARCHER_CACHE_SIZE_MB` and `SYMBOLS_CACHE_SIZE_MB` env vars so `searcher` auto-sizes its cache to ~45% of the live cache volume. This tracks PVC expansion automatically, whereas the hardcoded env vars are frozen to the initial `storageSize` and do not follow later disk growth. |
- `<serviceName>.serviceAccount.labels` adds labels to one component's
113
+
ServiceAccount, and to the Role, RoleBinding, ClusterRole, and
114
+
ClusterRoleBinding of `frontend`and`prometheus`.
115
+
116
+
```yaml
117
+
sourcegraph:
118
+
labels:
119
+
example.com/project: sourcegraph
120
+
blobstore:
121
+
storageLabels:
122
+
example.com/service: blobstore
123
+
frontend:
124
+
serviceAccount:
125
+
labels:
126
+
example.com/service: frontend
127
+
```
128
+
104
129
Helm only takes over an existing object that has the
105
130
`app.kubernetes.io/managed-by: Helm` label and the `meta.helm.sh/release-name`
106
131
and`meta.helm.sh/release-namespace` annotations, or when installing with
@@ -129,6 +154,7 @@ In addition to the documented values, all services also support the following va
129
154
- `<serviceName>.extraSelectorLabels` - add labels to the service's workload selector, pod labels, and Service and PodDisruptionBudget selectors. See [Adopting existing workloads](#adopting-existing-workloads)
130
155
- `<serviceName>.serivceAccount.create` - create service account for service
131
156
- `<serviceName>.serviceAccount.annotations` - Annotations for the service-specific service account
157
+
- `<serviceName>.serviceAccount.labels` - Labels for the service-specific service account, and for the Role, RoleBinding, ClusterRole, and ClusterRoleBinding of `frontend`and`prometheus`, in addition to `sourcegraph.labels`
132
158
- `<serviceName>.image.repository` - override the global `sourcegraph.image.repository` (registry or prefix) for this service. Defaults to `sourcegraph.image.repository` when unset.
0 commit comments