Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions charts/sourcegraph/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Use `**BREAKING**:` to denote a breaking change

## Unreleased

- Added `frontend.internalServiceAnnotations` and `frontend.internalServiceLabels` for the `sourcegraph-frontend-internal` Service. That Service no longer renders `frontend.serviceAnnotations` and `frontend.serviceLabels`, which now apply to the `sourcegraph-frontend` Service only, so load balancer annotations or a service mesh label set for the external Service no longer land on the internal one. If you relied on them on the internal Service, set the new values.
- The `correct-data-dir-permissions` init containers of `pgsql`, `codeintel-db`, and `codeinsights-db` now run the database's own image instead of `sourcegraph/alpine-3.14`, which was based on an end-of-life Alpine release. The chart no longer pulls `alpine-3.14`, so private registries no longer need to mirror it. `alpine.image` has been removed and is ignored if set; `alpine.containerSecurityContext`, `alpine.resources`, and `codeInsightsDB.init.containerSecurityContext` still apply.
- 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. Also added `storageLabels` on `preciseCodeIntel` and `syntacticCodeIntel`, to label the per-pod `/tmp` scratch PersistentVolumeClaim when `storageType` is `pvc`; they default to empty, so no pod restarts. `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).
- 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.
Expand Down
2 changes: 2 additions & 0 deletions charts/sourcegraph/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ In addition to the documented values, all services also support the following va
| frontend.ingress.ingressClassName | string | `nil` | IngressClassName for the Ingress (Available in Kubernetes 1.18+) If you set this field, set the annotation `frontend.ingress.annotations."kubernetes.io/ingress.class"` to `null` |
| frontend.ingress.tls | list | `[]` | Full TLS configuration for the ingress. Supersedes `tlsSecret` if set. Cannot be set together with `tlsSecret`. Omit `secretName` for controllers that manage certificates themselves (e.g. Tailscale). Example: tls: - hosts: - sourcegraph.example.com secretName: sourcegraph-tls # optional |
| frontend.ingress.tlsSecret | string | `""` | Secret containing TLS cert. Cannot be set together with `tls`. |
| frontend.internalServiceAnnotations | object | `{}` | Annotations for the `sourcegraph-frontend-internal` Service. `frontend.serviceAnnotations` is for the `sourcegraph-frontend` Service only |
| frontend.internalServiceLabels | object | `{}` | Labels for the `sourcegraph-frontend-internal` Service. `frontend.serviceLabels` is for the `sourcegraph-frontend` Service only |
| frontend.name | string | `"sourcegraph-frontend"` | Name used by resources. Does not affect service names or PVCs. |
| frontend.podSecurityContext | object | `{}` | Security context for the `frontend` pod, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) |
| frontend.privileged | bool | `true` | Enable creation of Role and RoleBinding (RBAC). Uses [view](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles) ClusterRole if set to false |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
apiVersion: v1
kind: Service
metadata:
{{- if .Values.frontend.serviceAnnotations }}
{{- with .Values.frontend.internalServiceAnnotations }}
annotations:
{{- toYaml .Values.frontend.serviceAnnotations | nindent 4 }}
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
app: sourcegraph-frontend
deploy: sourcegraph
app.kubernetes.io/component: frontend
{{- if .Values.frontend.serviceLabels }}
{{- toYaml .Values.frontend.serviceLabels | nindent 4 }}
{{- with .Values.frontend.internalServiceLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
name: sourcegraph-frontend-internal
spec:
Expand Down
57 changes: 57 additions & 0 deletions charts/sourcegraph/tests/frontendInternalService_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
suite: annotations and labels of the sourcegraph-frontend-internal Service
templates:
- frontend/sourcegraph-frontend.Service.yaml
- frontend/sourcegraph-frontend-internal.Service.yaml
tests:
- it: should render no annotations on the internal Service by default
template: frontend/sourcegraph-frontend-internal.Service.yaml
asserts:
- notExists:
path: metadata.annotations
- equal:
path: metadata.labels.app
value: sourcegraph-frontend

- it: should keep the frontend Service's annotations and labels off the internal Service
set:
frontend.serviceAnnotations: &serviceAnnotations
example.com/load-balancer: external
frontend.serviceLabels: &serviceLabels
example.com/mesh: enabled
asserts:
- notExists:
path: metadata.annotations
template: frontend/sourcegraph-frontend-internal.Service.yaml
- notExists:
path: metadata.labels["example.com/mesh"]
template: frontend/sourcegraph-frontend-internal.Service.yaml
- isSubset:
path: metadata.annotations
content: *serviceAnnotations
template: frontend/sourcegraph-frontend.Service.yaml
- isSubset:
path: metadata.labels
content: *serviceLabels
template: frontend/sourcegraph-frontend.Service.yaml

- it: should render the internal Service's own annotations and labels, and keep them off the frontend Service
set:
frontend.internalServiceAnnotations: &internalServiceAnnotations
example.com/internal: "true"
frontend.internalServiceLabels: &internalServiceLabels
example.com/tier: internal
asserts:
- equal:
path: metadata.annotations
value: *internalServiceAnnotations
template: frontend/sourcegraph-frontend-internal.Service.yaml
- isSubset:
path: metadata.labels
content: *internalServiceLabels
template: frontend/sourcegraph-frontend-internal.Service.yaml
- notExists:
path: metadata.annotations["example.com/internal"]
template: frontend/sourcegraph-frontend.Service.yaml
- notExists:
path: metadata.labels["example.com/tier"]
template: frontend/sourcegraph-frontend.Service.yaml
6 changes: 6 additions & 0 deletions charts/sourcegraph/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,12 @@ frontend:
# - sourcegraph.example.com
# secretName: sourcegraph-tls # optional
tls: []
# -- Annotations for the `sourcegraph-frontend-internal` Service.
# `frontend.serviceAnnotations` is for the `sourcegraph-frontend` Service only
internalServiceAnnotations: {}
# -- Labels for the `sourcegraph-frontend-internal` Service.
# `frontend.serviceLabels` is for the `sourcegraph-frontend` Service only
internalServiceLabels: {}
# -- Security context for the `frontend` container,
# learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container)
containerSecurityContext:
Expand Down
Loading