Skip to content
Merged
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
7 changes: 7 additions & 0 deletions charts/sourcegraph/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ In addition to the documented values, all services also support the following va
| gitserver.image.defaultTag | string | `"6.0.0@sha256:aec9bf6993c243a283109104cd7c44be3c85680b77e3e8be0c5fba8f01a3bd35"` | Docker image tag for the `gitserver` image |
| gitserver.image.name | string | `"gitserver"` | Docker image name for the `gitserver` image |
| gitserver.name | string | `"gitserver"` | Name used by resources. Does not affect service names or PVCs. |
| gitserver.podDisruptionBudget | object | `{}` | Pod disruption budget for `gitserver`. Configure either `minAvailable` or `maxUnavailable` to enable it. |
| gitserver.podSecurityContext | object | `{"fsGroup":101,"fsGroupChangePolicy":"OnRootMismatch","runAsGroup":101,"runAsUser":100}` | Security context for the `gitserver` pod, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) |
| gitserver.replicaCount | int | `1` | Number of `gitserver` pod |
| gitserver.resources | object | `{"limits":{"cpu":"4","memory":"8G"},"requests":{"cpu":"4","memory":"8G"}}` | Resource requests & limits for the `gitserver` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) |
Expand Down Expand Up @@ -165,6 +166,7 @@ In addition to the documented values, all services also support the following va
| indexedSearch.image.defaultTag | string | `"6.0.0@sha256:99038e0ec9bef930030c118d774fcdcd67d7fe57ad4c80d216703a4d29d64323"` | Docker image tag for the `zoekt-webserver` image |
| indexedSearch.image.name | string | `"indexed-searcher"` | Docker image name for the `zoekt-webserver` image |
| indexedSearch.name | string | `"indexed-search"` | Name used by resources. Does not affect service names or PVCs. |
| indexedSearch.podDisruptionBudget | object | `{}` | Pod disruption budget for `indexed-search`. Configure either `minAvailable` or `maxUnavailable` to enable it. |
| indexedSearch.podSecurityContext | object | `{"fsGroup":101,"fsGroupChangePolicy":"OnRootMismatch"}` | Security context for the `indexed-search` pod, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) |
| indexedSearch.replicaCount | int | `1` | Number of `indexed-search` pod |
| indexedSearch.resources | object | `{"limits":{"cpu":"2","memory":"4G"},"requests":{"cpu":"500m","memory":"2G"}}` | Resource requests & limits for the `zoekt-webserver` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) |
Expand Down Expand Up @@ -276,6 +278,7 @@ In addition to the documented values, all services also support the following va
| preciseCodeIntel.image.defaultTag | string | `"6.0.0@sha256:3a72cf893cb25731d4636593c544c91781d925d867417416255e56debc27ed37"` | Docker image tag for the `precise-code-intel-worker` image |
| preciseCodeIntel.image.name | string | `"precise-code-intel-worker"` | Docker image name for the `precise-code-intel-worker` image |
| preciseCodeIntel.name | string | `"precise-code-intel-worker"` | Name used by resources. Does not affect service names or PVCs. |
| preciseCodeIntel.podDisruptionBudget | object | `{}` | Pod disruption budget for `precise-code-intel-worker`. Configure either `minAvailable` or `maxUnavailable` to enable it. |
| preciseCodeIntel.podSecurityContext | object | `{}` | Security context for the `precise-code-intel-worker` pod, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) |
| preciseCodeIntel.replicaCount | int | `2` | Number of `precise-code-intel-worker` pod |
| preciseCodeIntel.resources | object | `{"limits":{"cpu":"2","memory":"4G"},"requests":{"cpu":"500m","memory":"2G"}}` | Resource requests & limits for the `precise-code-intel-worker` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) |
Expand Down Expand Up @@ -304,6 +307,7 @@ In addition to the documented values, all services also support the following va
| redisCache.image.defaultTag | string | `"6.0.0@sha256:40ea19e8944b93e05d7697c808969fe0c81a014a56245f3a97b645aa34a9ab78"` | Docker image tag for the `redis-cache` image |
| redisCache.image.name | string | `"redis-cache"` | Docker image name for the `redis-cache` image |
| redisCache.name | string | `"redis-cache"` | Name used by resources. Does not affect service names or PVCs. |
| redisCache.podDisruptionBudget | object | `{}` | Pod disruption budget for `redis-cache`. Configure either `minAvailable` or `maxUnavailable` to enable it. |
| redisCache.podSecurityContext | object | `{"fsGroup":1000,"fsGroupChangePolicy":"OnRootMismatch"}` | Security context for the `redis-cache` pod, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) |
| redisCache.resources | object | `{"limits":{"cpu":"1","memory":"7Gi"},"requests":{"cpu":"1","memory":"7Gi"}}` | Resource requests & limits for the `redis-cache` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) |
| redisCache.serviceAccount.create | bool | `false` | Enable creation of ServiceAccount for `redis-cache` |
Expand All @@ -322,6 +326,7 @@ In addition to the documented values, all services also support the following va
| redisStore.image.defaultTag | string | `"6.0.0@sha256:39f3b27d993652c202c1f892df83e1a3e8e8ea5ae58291f79ad14b56672ab8be"` | Docker image tag for the `redis-store` image |
| redisStore.image.name | string | `"redis-store"` | Docker image name for the `redis-store` image |
| redisStore.name | string | `"redis-store"` | Name used by resources. Does not affect service names or PVCs. |
| redisStore.podDisruptionBudget | object | `{}` | Pod disruption budget for `redis-store`. Configure either `minAvailable` or `maxUnavailable` to enable it. |
| redisStore.podSecurityContext | object | `{"fsGroup":1000,"fsGroupChangePolicy":"OnRootMismatch"}` | Security context for the `redis-store` pod, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) |
| redisStore.resources | object | `{"limits":{"cpu":"1","memory":"7Gi"},"requests":{"cpu":"1","memory":"7Gi"}}` | Resource requests & limits for the `redis-store` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) |
| redisStore.serviceAccount.create | bool | `false` | Enable creation of ServiceAccount for `redis-store` |
Expand Down Expand Up @@ -377,6 +382,7 @@ In addition to the documented values, all services also support the following va
| syntacticCodeIntel.image.defaultTag | string | `"6.0.0@sha256:50bdeb38b196f0fc21404969016bf8263f78144292e905867e93480f66c8251c"` | Docker image tag for the `syntactic-code-intel-worker` image |
| syntacticCodeIntel.image.name | string | `"syntactic-code-intel-worker"` | Docker image name for the `syntactic-code-intel-worker` image |
| syntacticCodeIntel.name | string | `"syntactic-code-intel-worker"` | Name used by resources. Does not affect service names or PVCs. |
| syntacticCodeIntel.podDisruptionBudget | object | `{}` | Pod disruption budget for `syntactic-code-intel-worker`. Configure either `minAvailable` or `maxUnavailable` to enable it. |
| syntacticCodeIntel.podSecurityContext | object | `{}` | Security context for the `syntactic-code-intel-worker` pod, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) |
| syntacticCodeIntel.properties.workerPort | int | `3188` | port to whick worker API will bind |
| syntacticCodeIntel.replicaCount | int | `2` | Number of `syntactic-code-intel-worker` pod |
Expand All @@ -400,6 +406,7 @@ In addition to the documented values, all services also support the following va
| worker.image.defaultTag | string | `"6.0.0@sha256:4892c5aa107d4384f811afcf1980e0fb2cb8beb5585a15adcb64353a2d8abf5a"` | Docker image tag for the `worker` image |
| worker.image.name | string | `"worker"` | Docker image name for the `worker` image |
| worker.name | string | `"worker"` | Name used by resources. Does not affect service names or PVCs. |
| worker.podDisruptionBudget | object | `{}` | Pod disruption budget for every `worker` deployment. Configure either `minAvailable` or `maxUnavailable` to enable it. |
| worker.podSecurityContext | object | `{}` | Security context for the `worker` pod, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) |
| worker.replicaCount | int | `1` | Number of `worker` pod |
| worker.replicas | list | `[]` | Scale worker horizontally by configuring additional replicas dedicated to specific jobs. for each replica, configure the dedicated jobs to run on this replica. learn more from https://sourcegraph.com/docs/admin/workers#3-split-jobs-and-scale-independently |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.gitserver.podDisruptionBudget }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ .Values.gitserver.name }}
spec:
{{- toYaml .Values.gitserver.podDisruptionBudget | nindent 2 }}
selector:
matchLabels:
{{- include "sourcegraph.selectorLabels" . | nindent 6 }}
app: gitserver
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.indexedSearch.podDisruptionBudget }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ .Values.indexedSearch.name }}
spec:
{{- toYaml .Values.indexedSearch.podDisruptionBudget | nindent 2 }}
selector:
matchLabels:
{{- include "sourcegraph.selectorLabels" . | nindent 6 }}
app: indexed-search
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.preciseCodeIntel.podDisruptionBudget }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ .Values.preciseCodeIntel.name }}
spec:
{{- toYaml .Values.preciseCodeIntel.podDisruptionBudget | nindent 2 }}
selector:
matchLabels:
{{- include "sourcegraph.selectorLabels" . | nindent 6 }}
app: precise-code-intel-worker
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if and .Values.redisCache.enabled .Values.redisCache.podDisruptionBudget }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ .Values.redisCache.name }}
spec:
{{- toYaml .Values.redisCache.podDisruptionBudget | nindent 2 }}
selector:
matchLabels:
{{- include "sourcegraph.selectorLabels" . | nindent 6 }}
app: redis-cache
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if and .Values.redisStore.enabled .Values.redisStore.podDisruptionBudget }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ .Values.redisStore.name }}
spec:
{{- toYaml .Values.redisStore.podDisruptionBudget | nindent 2 }}
selector:
matchLabels:
{{- include "sourcegraph.selectorLabels" . | nindent 6 }}
app: redis-store
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if and .Values.syntacticCodeIntel.enabled .Values.syntacticCodeIntel.podDisruptionBudget }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ .Values.syntacticCodeIntel.name }}
spec:
{{- toYaml .Values.syntacticCodeIntel.podDisruptionBudget | nindent 2 }}
selector:
matchLabels:
{{- include "sourcegraph.selectorLabels" . | nindent 6 }}
app: syntactic-code-intel-worker
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{{- define "sourcegraph.worker.podDisruptionBudget" -}}
{{- $top := index . 0 -}}
{{- $suffix := index . 1 -}}
{{- $name := $top.Values.worker.name -}}
{{- if $suffix -}}
{{- $name = printf "%s-%s" $name $suffix -}}
{{- end -}}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ $name }}
spec:
{{- toYaml $top.Values.worker.podDisruptionBudget | nindent 2 }}
selector:
matchLabels:
{{- include "sourcegraph.selectorLabels" $top | nindent 6 }}
app: worker
{{- if $suffix }}
worker-replica: {{ $name | quote }}
{{- end }}
{{- if and (not $suffix) $top.Values.worker.replicas }}
matchExpressions:
- key: worker-replica
operator: DoesNotExist
{{- end }}
{{- end -}}

{{- if .Values.worker.podDisruptionBudget }}
{{- include "sourcegraph.worker.podDisruptionBudget" (list . "") }}
{{- range $idx, $_ := .Values.worker.replicas }}
---
{{- include "sourcegraph.worker.podDisruptionBudget" (list $ (printf "%d" $idx)) | nindent 0 }}
{{- end }}
{{- end }}
126 changes: 126 additions & 0 deletions charts/sourcegraph/tests/podDisruptionBudget_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,129 @@ tests:
- equal:
path: spec.selector.matchLabels["app.kubernetes.io/instance"]
value: sourcegraph
- it: should render podDisruptionBudget for gitserver
template: gitserver/gitserver.PodDisruptionBudget.yaml
set:
gitserver.podDisruptionBudget.minAvailable: 1
asserts:
- equal:
path: metadata.name
value: gitserver
- equal:
path: spec.minAvailable
value: 1
- equal:
path: spec.selector.matchLabels.app
value: gitserver
- it: should render podDisruptionBudget for indexed search
template: indexed-search/indexed-search.PodDisruptionBudget.yaml
set:
indexedSearch.podDisruptionBudget.maxUnavailable: 1
asserts:
- equal:
path: metadata.name
value: indexed-search
- equal:
path: spec.maxUnavailable
value: 1
- equal:
path: spec.selector.matchLabels.app
value: indexed-search
- it: should render podDisruptionBudget for precise code intel
template: precise-code-intel/worker.PodDisruptionBudget.yaml
set:
preciseCodeIntel.podDisruptionBudget.maxUnavailable: 1
asserts:
- equal:
path: metadata.name
value: precise-code-intel-worker
- equal:
path: spec.maxUnavailable
value: 1
- equal:
path: spec.selector.matchLabels.app
value: precise-code-intel-worker
- it: should render podDisruptionBudget for redis cache
template: redis/redis-cache.PodDisruptionBudget.yaml
set:
redisCache.podDisruptionBudget.minAvailable: 1
asserts:
- equal:
path: metadata.name
value: redis-cache
- equal:
path: spec.minAvailable
value: 1
- equal:
path: spec.selector.matchLabels.app
value: redis-cache
- it: should render podDisruptionBudget for redis store
template: redis/redis-store.PodDisruptionBudget.yaml
set:
redisStore.podDisruptionBudget.minAvailable: 1
asserts:
- equal:
path: metadata.name
value: redis-store
- equal:
path: spec.minAvailable
value: 1
- equal:
path: spec.selector.matchLabels.app
value: redis-store
- it: should render podDisruptionBudget for syntactic code intel when enabled
template: syntactic-code-intel/worker.PodDisruptionBudget.yaml
set:
syntacticCodeIntel.enabled: true
syntacticCodeIntel.podDisruptionBudget.maxUnavailable: 1
asserts:
- equal:
path: metadata.name
value: syntactic-code-intel-worker
- equal:
path: spec.maxUnavailable
value: 1
- equal:
path: spec.selector.matchLabels.app
value: syntactic-code-intel-worker
- it: should render a podDisruptionBudget for every worker deployment
template: worker/worker.PodDisruptionBudget.yaml
set:
worker:
podDisruptionBudget:
maxUnavailable: 1
replicas:
- jobs: ["job1"]
- jobs: ["job2"]
asserts:
- hasDocuments:
count: 3
- equal:
path: metadata.name
value: worker
documentIndex: 0
- notExists:
path: spec.selector.matchLabels.worker-replica
documentIndex: 0
- equal:
path: spec.selector.matchExpressions[0]
value:
key: worker-replica
operator: DoesNotExist
documentIndex: 0
- equal:
path: metadata.name
value: worker-0
documentIndex: 1
- equal:
path: spec.selector.matchLabels.worker-replica
value: worker-0
documentIndex: 1
- equal:
path: metadata.name
value: worker-1
documentIndex: 2
- equal:
path: spec.selector.matchLabels.worker-replica
value: worker-1
documentIndex: 2
14 changes: 14 additions & 0 deletions charts/sourcegraph/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,8 @@ gitserver:
readOnlyRootFilesystem: true
# -- Number of `gitserver` pod
replicaCount: 1
# -- Pod disruption budget for `gitserver`. Configure either `minAvailable` or `maxUnavailable` to enable it.
podDisruptionBudget: {}
# -- Resource requests & limits for the `gitserver` container,
# learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/)
resources:
Expand Down Expand Up @@ -569,6 +571,8 @@ indexedSearch:
name: "indexed-search"
# -- Number of `indexed-search` pod
replicaCount: 1
# -- Pod disruption budget for `indexed-search`. Configure either `minAvailable` or `maxUnavailable` to enable it.
podDisruptionBudget: {}
# -- Resource requests & limits for the `zoekt-webserver` container,
# learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/)
resources:
Expand Down Expand Up @@ -916,6 +920,8 @@ syntacticCodeIntel:
podSecurityContext: {}
# -- Number of `syntactic-code-intel-worker` pod
replicaCount: 2
# -- Pod disruption budget for `syntactic-code-intel-worker`. Configure either `minAvailable` or `maxUnavailable` to enable it.
podDisruptionBudget: {}
# -- Resource requests & limits for the `syntactic-code-intel-worker` container,
# learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/)
resources:
Expand Down Expand Up @@ -958,6 +964,8 @@ preciseCodeIntel:
podSecurityContext: {}
# -- Number of `precise-code-intel-worker` pod
replicaCount: 2
# -- Pod disruption budget for `precise-code-intel-worker`. Configure either `minAvailable` or `maxUnavailable` to enable it.
podDisruptionBudget: {}
# -- Resource requests & limits for the `precise-code-intel-worker` container,
# learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/)
resources:
Expand Down Expand Up @@ -1069,6 +1077,8 @@ redisCache:
podSecurityContext:
fsGroup: 1000
fsGroupChangePolicy: "OnRootMismatch"
# -- Pod disruption budget for `redis-cache`. Configure either `minAvailable` or `maxUnavailable` to enable it.
podDisruptionBudget: {}
serviceAccount:
# -- Enable creation of ServiceAccount for `redis-cache`
create: false
Expand Down Expand Up @@ -1142,6 +1152,8 @@ redisStore:
podSecurityContext:
fsGroup: 1000
fsGroupChangePolicy: "OnRootMismatch"
# -- Pod disruption budget for `redis-store`. Configure either `minAvailable` or `maxUnavailable` to enable it.
podDisruptionBudget: {}
serviceAccount:
# -- Enable creation of ServiceAccount for `redis-store`
create: false
Expand Down Expand Up @@ -1375,6 +1387,8 @@ worker:
podSecurityContext: {}
# -- Number of `worker` pod
replicaCount: 1
# -- Pod disruption budget for every `worker` deployment. Configure either `minAvailable` or `maxUnavailable` to enable it.
podDisruptionBudget: {}
# -- List of jobs to block globally
# If replicas are configured, use this values to block jobs instead of manually setting WORKER_JOB_BLOCKLIST
blocklist: []
Expand Down
Loading