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
25 changes: 25 additions & 0 deletions .github/workflows/kustomize_render.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Render charts through kustomize
on:
push:
branches:
- main
- release/**
pull_request:

jobs:
kustomize-render:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

# Installs the Helm and kubeconform versions in .tool-versions, the same
# ones Buildkite uses. kubectl, with its built-in kustomize, comes with the
# runner image.
- name: Set up Helm and kubeconform
uses: jdx/mise-action@924e7c586e33d7d4bae9c14e26c5d22e2beb6e78 # v5.3.0
with:
install_args: helm kubeconform

- name: Render each chart's tests/kustomizeRender_*.yaml and check the output
run: scripts/ci/kustomize-render.sh
138 changes: 138 additions & 0 deletions charts/sourcegraph-executor/dind/tests/kustomizeRender_allValues.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# Used by CI: the "Render charts through kustomize" GitHub Actions job
# (.github/workflows/kustomize_render.yml) renders this chart with this file
# through scripts/ci/kustomize-render.sh.
#
# Sets every value the templates read to a non-default value, to catch
# templates that break or render invalid manifests when a value is used.
# kustomizeRender_allValuesAlternate.yaml covers the other side of each
# either-or choice. All names and endpoints are placeholders.

nameOverride: example-executor

sourcegraph:
image:
defaultTag: 1.2.3
pullPolicy: Always
repository: registry.example.com/sourcegraph
useGlobalTagAsDefault: true
imagePullSecrets:
- name: registry-credentials
labels:
example.com/project: sourcegraph
podAnnotations:
example.com/pod-annotation: global
podLabels:
example.com/pod-label: global
priorityClassName: example-priority
nodeSelector:
example.com/dedicated: executors
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: example.com/dedicated
operator: In
values: [executors]
tolerations:
- key: example.com/dedicated
operator: Exists
effect: NoSchedule

storageClass:
create: true
name: example-storage-class
provisioner: pd.csi.storage.gke.io
type: pd-ssd
parameters:
replication-type: regional-pd

executor:
priorityClassName: example-executor-priority
image:
name: example-executor-image
tag: 4.5.6
frontendUrl: https://sourcegraph.example.com
frontendExistingSecret: executor-credentials # checkov:skip=CKV_SECRET_6: placeholder in test values
log:
level: debug
format: condensed
maximumRuntimePerJob: 1h
maximumNumJobs: 4
replicaCount: 2
resources:
limits:
cpu: "4"
memory: 8Gi
requests:
cpu: "1"
memory: 2Gi
env:
EXAMPLE_VALUE:
value: example
EXAMPLE_SECRET:
valueFrom:
secretKeyRef:
name: example-secret
key: EXAMPLE_SECRET
storage:
type: ephemeral
size: 100Gi
class: example-storage-class
podSecurityContext:
fsGroup: 101
runAsNonRoot: false
labels:
example.com/service: executor
podAnnotations:
example.com/pod-annotation-executor: executor
podLabels:
example.com/pod-label-executor: executor

# One Deployment per queue, each overriding the executor defaults
queues:
- name: batches
queueName: batches
replicaCount: 3
resources:
requests:
cpu: "2"
memory: 4Gi
env:
EXAMPLE_QUEUE_VALUE:
value: batches
- name: codeintel
queueNames: [codeintel, other]

dind:
image:
registry: registry.example.com
repository: example-docker
tag: 1.0.0-dind
daemonConfig:
mtu: 1400
registry-mirrors:
- https://mirror.example.com
gVisor:
enabled: true
daemonConfig:
storage-driver: overlay2

privateDockerRegistry:
enabled: true
image:
registry: registry.example.com
repository: example-registry
tag: "3.1"
storageSize: 50Gi
env:
REGISTRY_PROXY_REMOTEURL:
value: https://mirror.example.com
labels:
example.com/service: executor-registry
podAnnotations:
example.com/pod-annotation-registry: registry
podLabels:
example.com/pod-label-registry: registry
serviceAnnotations:
example.com/service-annotation: registry
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Used by CI: the "Render charts through kustomize" GitHub Actions job
# (.github/workflows/kustomize_render.yml) renders this chart with this file
# through scripts/ci/kustomize-render.sh.
#
# The other side of each either-or choice in kustomizeRender_allValues.yaml:
# one Deployment for one queue, an inline password, a size-limited emptyDir,
# no gVisor, and no private registry. All names and endpoints are
# placeholders.

executor:
frontendUrl: https://sourcegraph.example.com
frontendPassword: placeholder-password # checkov:skip=CKV_SECRET_6: placeholder in test values
queueName: batches
storage:
type: emptyDir
size: 20Gi

privateDockerRegistry:
enabled: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Used by CI: the "Render charts through kustomize" GitHub Actions job
# (.github/workflows/kustomize_render.yml) renders this chart with this file
# through scripts/ci/kustomize-render.sh.
#
# Shaped like common self-hosted deployments: several queues, organization
# labels, a private registry, and persistent registry storage. All names and
# endpoints are placeholders.

sourcegraph:
image:
repository: registry.example.com/sourcegraph
imagePullSecrets:
- name: registry-credentials
labels:
example.com/project: sourcegraph
podLabels:
example.com/project: sourcegraph
podAnnotations:
metrics.example.com/scrape: "true"
nodeSelector:
example.com/dedicated: executors
tolerations:
- key: example.com/dedicated
operator: Exists
effect: NoSchedule

storageClass:
create: true
name: sourcegraph-executors

executor:
frontendUrl: https://sourcegraph.example.com
frontendExistingSecret: executor-credentials # checkov:skip=CKV_SECRET_6: placeholder in test values
queueNames: [batches, codeintel]
labels:
example.com/service: executor
podLabels:
example.com/service: executor
env:
HTTPS_PROXY:
value: http://proxy.example.com:3128

privateDockerRegistry:
labels:
example.com/service: executor-registry
podLabels:
example.com/service: executor-registry
storageSize: 50Gi
132 changes: 132 additions & 0 deletions charts/sourcegraph-executor/k8s/tests/kustomizeRender_allValues.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Used by CI: the "Render charts through kustomize" GitHub Actions job
# (.github/workflows/kustomize_render.yml) renders this chart with this file
# through scripts/ci/kustomize-render.sh.
#
# Sets every value the templates read to a non-default value, to catch
# templates that break or render invalid manifests when a value is used.
# kustomizeRender_allValuesAlternate.yaml covers the other side of each
# either-or choice. All names and endpoints are placeholders.

nameOverride: example-executor

sourcegraph:
image:
defaultTag: 1.2.3
pullPolicy: Always
repository: registry.example.com/sourcegraph
useGlobalTagAsDefault: true
imagePullSecrets:
- name: registry-credentials
labels:
example.com/project: sourcegraph
podAnnotations:
example.com/pod-annotation: global
podLabels:
example.com/pod-label: global
priorityClassName: example-priority
# Documented, but the executor reads executor.nodeSelector, affinity, and tolerations
nodeSelector:
example.com/dedicated: sourcegraph
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: example.com/dedicated
operator: Exists
tolerations:
- key: example.com/dedicated
operator: Exists
effect: NoSchedule

executor:
configureRbac: true
priorityClassName: example-executor-priority
image:
name: example-executor-image
tag: 4.5.6
frontendUrl: https://sourcegraph.example.com
frontendPassword: placeholder-password # checkov:skip=CKV_SECRET_6: placeholder in test values
queueName: batches
maximumNumJobs: 4
maximumRuntimePerJob: 1h
log:
level: debug
format: json
trace: "true"
namespace: sourcegraph-executors
kubeconfigPath: /etc/kube/config
labels:
example.com/service: executor
podAnnotations:
example.com/pod-annotation-executor: executor
podLabels:
example.com/pod-label-executor: executor
serviceAnnotations:
example.com/service-annotation: executor
serviceLabels:
example.com/service-label: executor
serviceType: NodePort
resources:
limits:
cpu: "2"
memory: 8Gi
requests:
cpu: "1"
memory: 1Gi
containerSecurityContext:
privileged: false
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
podSecurityContext:
runAsNonRoot: true
fsGroup: 1000
kubernetesJob:
deadline: "600"
runAsUser: "1000"
runAsGroup: "1000"
fsGroup: "1000"
resources:
requests:
cpu: 500m
memory: 2Gi
limits:
cpu: "4"
memory: 16Gi
node:
name: example-node
selector: example.com/executors=true
# The template does not quote these values, so their quotes must be escaped, as values.yaml documents
tolerations: '[{\"key\":\"example.com/executors\",\"operator\":\"Equal\",\"value\":\"true\",\"effect\":\"NoSchedule\"}]'
requiredAffinityMatchExpressions: '[{\"key\":\"example.com/executors\",\"operator\":\"In\",\"values\":[\"true\"]}]'
requiredAffinityMatchFields: '[{\"key\":\"metadata.name\",\"operator\":\"In\",\"values\":[\"example-node\"]}]'
pod:
affinity: '[{\"labelSelector\":{\"matchExpressions\":[{\"key\":\"app\",\"operator\":\"In\",\"values\":[\"example\"]}]},\"topologyKey\":\"kubernetes.io/hostname\"}]'
antiAffinity: '[{\"labelSelector\":{\"matchExpressions\":[{\"key\":\"app\",\"operator\":\"In\",\"values\":[\"example\"]}]},\"topologyKey\":\"kubernetes.io/hostname\"}]'
debug:
keepJobs: "true"
keepWorkspaces: "true"
dockerAddHostGateway: "true"
nodeSelector:
example.com/executors: "true"
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: example.com/executors
operator: In
values: ["true"]
tolerations:
- key: example.com/executors
operator: Equal
value: "true"
effect: NoSchedule
extraEnv:
- name: EXAMPLE_VALUE
value: example
- name: EXAMPLE_SECRET
valueFrom:
secretKeyRef:
name: example-secret
key: EXAMPLE_SECRET
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Used by CI: the "Render charts through kustomize" GitHub Actions job
# (.github/workflows/kustomize_render.yml) renders this chart with this file
# through scripts/ci/kustomize-render.sh.
#
# The other side of each either-or choice in kustomizeRender_allValues.yaml:
# several queues, an existing Secret, the individual securityContext values,
# no RBAC, and local development mode. All names are placeholders.

sourcegraph:
localDevMode: true

executor:
configureRbac: false
frontendUrl: https://sourcegraph.example.com
frontendExistingSecret: executor-credentials # checkov:skip=CKV_SECRET_6: placeholder in test values
queueNames: [batches, codeintel]
podSecurityContext: {}
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
privileged: false
Loading
Loading