|
| 1 | +########################################################################################## |
| 2 | +# DEPLOY INSTRUCTIONS |
| 3 | +# |
| 4 | +# Build Manifests: kubectl kustomize instances/$CURRENT_DIR -o cluster.yaml |
| 5 | +# Review Manifests: less cluster.yaml |
| 6 | +# kubectl apply --prune -l deploy=sourcegraph -f cluster.yaml |
| 7 | +########################################################################################## |
| 8 | +apiVersion: kustomize.config.k8s.io/v1beta1 |
| 9 | +kind: Kustomization |
| 10 | +########################################################################################## |
| 11 | +# [RESOURCES] Resources with default settings |
| 12 | +# |
| 13 | +# You can add additional resources to the end of this section if needed |
| 14 | +########################################################################################## |
| 15 | +resources: |
| 16 | + # [REQUIRED: BUILD CONFIG] Update this file when using components that have "CONFIG KEYS" |
| 17 | + - buildConfig.yaml # -- Update the CONFIG Key values in buildConfig.yaml when instructed |
| 18 | + # [REQUIRED: RESOURCES] Resources for the default Sourcegraph instance |
| 19 | + - ../../base/sourcegraph # -- Resources for Sourcegraph |
| 20 | + - ../../base/monitoring # -- Resources for Sourcegraph Monitoring Stack |
| 21 | + # ---------------- Add additional resources below this line if needed ---------------- # |
| 22 | + # - |
| 23 | +########################################################################################## |
| 24 | +# [REQUIRED: NAMESPACE] Add namespace to all resources generated by this overlay |
| 25 | +# |
| 26 | +# NOTE: Include the 'namespace' component to create namespace with the same name if needed |
| 27 | +########################################################################################## |
| 28 | +namespace: default |
| 29 | +########################################################################################## |
| 30 | +# [COMPONENTS] Uncomment the lines for the components you'd like to include |
| 31 | +# |
| 32 | +# To configure your Sourcegraph deployment, uncomment the components/section |
| 33 | +# below following the instructions in our configuration docs. |
| 34 | +# |
| 35 | +# Components with CONFIG KEYS require additional input in the ./buildConfig.yaml file |
| 36 | +# |
| 37 | +# Docs: |
| 38 | +# https://docs.sourcegraph.com/admin/deploy/kubernetes/kustomize/configure |
| 39 | +########################################################################################## |
| 40 | +components: |
| 41 | + #--------------------------------------------------------------------------------------- |
| 42 | + # Namespace Creation |
| 43 | + #--------------------------------------------------------------------------------------- |
| 44 | + # - ../../components/resources/namespace # -- Create namespace based on NAMESPACE input above |
| 45 | + # |
| 46 | + #--------------------------------------------------------------------------------------- |
| 47 | + # Monitoring Stack |
| 48 | + #--------------------------------------------------------------------------------------- |
| 49 | + # - ../../components/monitoring/otel # -- Deploy OpenTelemetry Collector |
| 50 | + # - ../../components/monitoring/tracing # -- Deploy OpenTelemetry Collector with Jaeger as tracing backend |
| 51 | + # - ../../components/monitoring/cadvisor # -- Add resources for cAdvisor (requires privileges) |
| 52 | + # - ../../components/remove/daemonset # -- Remove all services with daemonsets: node-exporter & otel |
| 53 | + # - ../../components/remove/otel-collector # -- Remove otel-collector and otel-agent |
| 54 | + # |
| 55 | + #--------------------------------------------------------------------------------------- |
| 56 | + # Resource Allocation - Instance size based |
| 57 | + #--------------------------------------------------------------------------------------- |
| 58 | + # Use size XS resources by default. Include one only. |
| 59 | + # Find your instance size on https://docs.sourcegraph.com/admin/deploy/instance-size |
| 60 | + - ../../components/sizes/xs # -- Allocate resources for size XS instance |
| 61 | + # - ../../components/sizes/s # -- Allocate resources for size S instance |
| 62 | + # - ../../components/sizes/m # -- Allocate resources for size M instance |
| 63 | + # - ../../components/sizes/l # -- Allocate resources for size L instance |
| 64 | + # - ../../components/sizes/xl # -- Allocate resources for size XL instance |
| 65 | + # - custom-resources # -- Allocate customized resources --See docs for detailed instructions |
| 66 | + # |
| 67 | + #--------------------------------------------------------------------------------------- |
| 68 | + # Storage class |
| 69 | + #--------------------------------------------------------------------------------------- |
| 70 | + # - ../../components/storage-class/aws/aws-ebs # -- Create storage class resources for AWS when provisioner = `kubernetes.io/aws-ebs` |
| 71 | + # - ../../components/storage-class/aws/ebs-csi # -- Create storage class resources for AWS when provisioner = `ebs.csi.aws.com` |
| 72 | + # - ../../components/storage-class/azure # -- Create storage class resources for Azure AKS |
| 73 | + # - ../../components/storage-class/gcp # -- Create storage class resources for GCP GKE |
| 74 | + # - ../../components/storage-class/cloud # -- Create storage class resources for other cloud provider |
| 75 | + # - ../../components/storage-class/trident/ext3 # -- Create storage class resources for Trident, fsType ext3 |
| 76 | + # - ../../components/storage-class/trident/ext4 # -- Create storage class resources for Trident, fsType ext4 |
| 77 | + # - ../../components/storage-class/trident/xfs # -- Create storage class resources for Trident, fsType xfs |
| 78 | + # - ../../components/storage-class/k3s # -- Configure to use the default storage class in a k3s cluster |
| 79 | + # - ../../components/storage-class/sourcegraph # -- Update storageClassName for all resources to 'sourcegraph' |
| 80 | + # |
| 81 | + # - ../../components/storage-class/name-update # -- Update storageClassName to $STORAGECLASS_NAME |
| 82 | + # CONFIG KEYS: STORAGECLASS_NAME |
| 83 | + # |
| 84 | + # - ../../components/storage-class/cloud # -- Create a custom storage class for other cloud providers |
| 85 | + # CONFIG KEYS: STORAGECLASS_NAME |
| 86 | + # STORAGECLASS_PROVISIONER |
| 87 | + # STORAGECLASS_PARAM_TYPE |
| 88 | + # |
| 89 | + # - ../../components/storage-class/ssd # -- Create resources to use local SSDs - requires RBACs |
| 90 | + # CONFIG KEYS: SSD_NODE_PATH |
| 91 | + # |
| 92 | + #--------------------------------------------------------------------------------------- |
| 93 | + # Networking |
| 94 | + #--------------------------------------------------------------------------------------- |
| 95 | + # - ../../components/remove/default-ingress # -- Remove the default ingress from frontend |
| 96 | + # - ../../components/network/nodeport/30080 # -- Use nodeport 30080 for frontend service |
| 97 | + # - ../../components/network/loadbalancer # -- Use load balancer type for frontend service |
| 98 | + # - ../../components/network/network-policy # -- Add NetworkPolicy |
| 99 | + # - ../../components/network/envoy # -- Add EnvoyFilter to resolve known issues caused by service mesh |
| 100 | + # - ../../components/ingress/gke # -- Ingress controller settings for GKE with HTTP load balancing enabled |
| 101 | + # - ../../components/ingress/alb # -- Ingress controller settings for AWS ALB |
| 102 | + # - ../../components/ingress/k3s # -- Ingress controller settings for K3s |
| 103 | + # - ../../components/clusters/aws/managed-cert # -- Apply settings to frontend ingress for aws managed cert |
| 104 | + # - ../../components/clusters/gke/managed-cert # -- Apply settings to frontend ingress for gke managed cert |
| 105 | + # |
| 106 | + # - ../../components/ingress/hostname # -- Set hostname/domain for your Sourcegraph ingress |
| 107 | + # CONFIG KEYS: HOST_DOMAIN |
| 108 | + # |
| 109 | + # - ../../components/network/tls # -- Enable TLS with existing certificates |
| 110 | + # CONFIG KEYS: TLS_HOST |
| 111 | + # TLS_INGRESS_CLASS_NAME |
| 112 | + # TLS_CLUSTER_ISSUER |
| 113 | + # |
| 114 | + # - ../../components/network/tls-secretname # -- Replace TLS secretName with TLS_SECRET_NAME |
| 115 | + # CONFIG KEYS: TLS_SECRET_NAME |
| 116 | + # |
| 117 | + #--------------------------------------------------------------------------------------- |
| 118 | + # External Services |
| 119 | + # You must add external instances via frontend env vars if you remove the bundled instances |
| 120 | + #--------------------------------------------------------------------------------------- |
| 121 | + # - ../../components/remove/pgsql/deployment # -- Remove default database deployment for frontend |
| 122 | + # - ../../components/remove/pgsql/statefulset # -- Remove default database statefulset for frontend |
| 123 | + # - ../../components/remove/codeintel-db/deployment # -- Remove default database deployment for code-intel |
| 124 | + # - ../../components/remove/codeintel-db/statefulset # -- Remove default database statefulset for code-intel |
| 125 | + # - ../../components/remove/codeinsights-db/deployment # -- Remove default database deployment for code-insights |
| 126 | + # - ../../components/remove/codeinsights-db/statefulset # -- Remove default database statefulset for code-insights |
| 127 | + # - ../../components/remove/redis # -- Remove embedded redis instance |
| 128 | + # |
| 129 | + # - ../../components/services/redis # -- Use external redis servers |
| 130 | + # CONFIG KEYS: REDIS_CACHE_ENDPOINT |
| 131 | + # REDIS_STORE_ENDPOINT |
| 132 | + # |
| 133 | + #--------------------------------------------------------------------------------------- |
| 134 | + # Executors |
| 135 | + # See https://docs.sourcegraph.com/admin/executors for information and instructions |
| 136 | + #--------------------------------------------------------------------------------------- |
| 137 | + # - ../../components/executors/k8s # -- Enable native K8s executors |
| 138 | + # - ../../components/executors/dind # -- Enable dind executors |
| 139 | + # - ../../components/executors/dind/private-docker-registry # -- Enable private docker registry |
| 140 | + # |
| 141 | + #--------------------------------------------------------------------------------------- |
| 142 | + # Other Configurations |
| 143 | + #--------------------------------------------------------------------------------------- |
| 144 | + - ../../components/clusters/k3s # -- Configure instance to run in a k3s cluster (storage class, network, etc) |
| 145 | + # - ../../components/clusters/minikube # -- Configure instance to run in a minikube cluster (storage class, network, etc) |
| 146 | + # - ../../components/enable/rockskip # -- Enable rockskip |
| 147 | + # - ../../components/disable/rockskip # -- Disable rockskip |
| 148 | + # - ../../components/enable/ssh/non-root # Enable SSH to clon repositories as non-root user (default) |
| 149 | + # - ../../components/enable/ssh/root # Enable SSH to clon repositories as root user (when using privileged component) |
| 150 | + # - ../../components/remove/pvcs # -- Remove all pvcs resources |
| 151 | + # - ../../components/remove/prometheus # -- Remove prometheus |
| 152 | + # - ../../components/remove/resources # -- Remove resources (Limits, requests) from all containers |
| 153 | + # - ../../components/remove/security-context # -- Remove security context from all resources |
| 154 | + # - ../../components/utils/uid # -- Run all Postgres database with valid users on host |
| 155 | + # - ../../components/utils/multi-version-upgrade # -- Scale down non-database pods to 0 for multi-version upgrade |
| 156 | + # - ../../components/utils/migrate-to-nonprivileged # -- Component for migrating from privileged to non-privileged |
| 157 | + # |
| 158 | + #--------------------------------------------------------------------------------------- |
| 159 | + # Resource migration from deploy-sourcegraph |
| 160 | + #--------------------------------------------------------------------------------------- |
| 161 | + # - ../../components/clusters/old-base # -- Generate old cluster from deploy-sourcegraph |
| 162 | + # - old-patches # -- Component to store patches from old deployment. See migration docs for more information |
| 163 | + # |
| 164 | + #--------------------------------------------------------------------------------------- |
| 165 | + # Use private registry |
| 166 | + #--------------------------------------------------------------------------------------- |
| 167 | + - ../../components/enable/private-registry # -- Update images name to private registry name |
| 168 | + # CONFIG KEYS: PRIVATE_REGISTRY |
| 169 | + # |
| 170 | + # - ../../components/resources/imagepullsecrets # -- Add imagePullSecrets field to all resources |
| 171 | + # CONFIG KEYS: IMAGE_PULL_SECRET_NAME |
| 172 | + # |
| 173 | + # ------------------------------------------------------------------------ |
| 174 | + # Permission Configurations |
| 175 | + # IMPORTANT: Keep the components below as the LAST components |
| 176 | + # ------------------------------------------------------------------------ |
| 177 | + # [DO NOT REMOVE] This component add replica count for some statefulset services as env vars to frontend |
| 178 | + # so that when service discovery is disabled, frontend can generate service endpoints based on replica count |
| 179 | + - ../../components/utils/endpoints # REQUIRED - DO NOT REMOVE |
| 180 | + # |
| 181 | + # - ../../components/privileged # -- Run Sourcegraph with privileged and root access |
| 182 | + # - ../../components/monitoring/privileged # -- Run monitoring stack with privileged and root access |
| 183 | + # |
| 184 | + # Recommended for clusters with RBAC enabled. |
| 185 | + # - ../../components/enable/service-discovery # -- Enable service-discovery for frontend |
| 186 | +# |
| 187 | +# |
| 188 | +########################################################################################## |
| 189 | +# [SECRETS GENERATOR] Turns the contents of the secret files into Kubernetes secrets |
| 190 | +# |
| 191 | +# Copy and paste all the associated files to the root of this directory |
| 192 | +########################################################################################## |
| 193 | +# secretGenerator: |
| 194 | +# |
| 195 | +# # - SSH for Gitserver to clone repositories - |
| 196 | +# - name: gitserver-ssh |
| 197 | +# files: |
| 198 | +# - id_rsa |
| 199 | +# - known_hosts |
| 200 | +# |
| 201 | +# # - TLS - |
| 202 | +# - name: sourcegraph-frontend-tls |
| 203 | +# behavior: create |
| 204 | +# files: |
| 205 | +# - tls.crt |
| 206 | +# - tls.key |
| 207 | +# |
| 208 | +# # - Database - |
| 209 | +# - name: dbs-secrets |
| 210 | +# files: |
| 211 | +# - secrets.env |
| 212 | +# |
| 213 | +# # - Executor - |
| 214 | +# - name: executor-secret |
| 215 | +# behavior: create |
| 216 | +# literals: |
| 217 | +# - password=our-shared-secret |
| 218 | +# |
| 219 | +########################################################################################## |
| 220 | +# [CUSTOM RESOURCES] Add files as patches to customize resources |
| 221 | +# |
| 222 | +# Create a directory `patches` and then copy the required files as |
| 223 | +# instructed by the configuration docs to update ConfigMaps and other |
| 224 | +# resources using patch files to customize your deployment |
| 225 | +# Do not use the built-in replicas field to update replica counts |
| 226 | +########################################################################################## |
| 227 | +# |
| 228 | +# patches: |
| 229 | +# #--------------------------------------------------------------------------------------- |
| 230 | +# # custom patches |
| 231 | +# #--------------------------------------------------------------------------------------- |
| 232 | +# - path: patches/frontend-ingress.annotations.yaml |
| 233 | +# - path: patches/prometheus.ConfigMap.yaml |
| 234 | +# - path: patches/pgsql.ConfigMap.yaml |
| 235 | +# - path: patches/otel-collector.ConfigMap.yaml |
| 236 | +# - path: patches/custom.NodePort.yaml |
| 237 | +# - path: patches/resources.yaml |
| 238 | +# - path: patches/executor.ConfigMap.yaml |
| 239 | +# |
| 240 | +# #--------------------------------------------------------------------------------------- |
| 241 | +# # Update env vars for non-frontend services |
| 242 | +# #--------------------------------------------------------------------------------------- |
| 243 | +# - patch: |- |
| 244 | +# - op: add |
| 245 | +# path: /spec/template/spec/containers/0/env/- |
| 246 | +# value: |
| 247 | +# name: SRC_ENABLE_GC_AUTO |
| 248 | +# value: "true" |
| 249 | +# target: |
| 250 | +# name: gitserver |
| 251 | +# kind: StatefulSet |
| 252 | +# |
| 253 | +# - patch: |- |
| 254 | +# - op: replace |
| 255 | +# path: /spec/template/spec/containers/0/env/0 |
| 256 | +# value: |
| 257 | +# name: SEARCHER_CACHE_SIZE_MB |
| 258 | +# value: "50000" |
| 259 | +# target: |
| 260 | +# name: searcher |
| 261 | +# kind: StatefulSet|Deployment |
| 262 | +# |
| 263 | +# - patch: |- |
| 264 | +# - op: replace |
| 265 | +# path: /spec/template/spec/containers/0/env/0 |
| 266 | +# value: |
| 267 | +# name: SYMBOLS_CACHE_SIZE_MB |
| 268 | +# value: "50000" |
| 269 | +# target: |
| 270 | +# name: symbols |
| 271 | +# kind: StatefulSet|Deployment |
| 272 | +# # |
| 273 | +# - patch: |- |
| 274 | +# - op: add |
| 275 | +# path: /spec/template/spec/containers/0/env/- |
| 276 | +# value: |
| 277 | +# name: SRC_ENABLE_GC_AUTO |
| 278 | +# value: "true" |
| 279 | +# target: |
| 280 | +# name: grafana |
| 281 | +# kind: StatefulSet |
| 282 | +# |
| 283 | +# |
| 284 | +# #--------------------------------------------------------------------------------------- |
| 285 | +# # Adjust Storage Sizes |
| 286 | +# #--------------------------------------------------------------------------------------- |
| 287 | +# - patch: |- |
| 288 | +# - op: replace |
| 289 | +# path: /spec/resources/requests/storage |
| 290 | +# value: 100Gi |
| 291 | +# target: |
| 292 | +# kind: PersistentVolumeClaim |
| 293 | +# name: blobstore|codeinsights-db|codeintel-db|pgsql|prometheus|redis-store|redis-cache|private-docker-registry |
| 294 | +# |
| 295 | +# - patch: |- |
| 296 | +# - op: replace |
| 297 | +# path: /spec/volumeClaimTemplates/0/spec/resources/requests/storage |
| 298 | +# value: 200Gi |
| 299 | +# target: |
| 300 | +# kind: StatefulSet |
| 301 | +# name: gitserver|indexed-search|searcher|symbols |
| 302 | +# |
| 303 | +# |
| 304 | +########################################################################################## |
| 305 | +# [FRONTEND ENV VARS] Handles updating env vars for sourcegraph-frontend |
| 306 | +########################################################################################## |
| 307 | +# |
| 308 | +# configMapGenerator: |
| 309 | +# - name: sourcegraph-frontend-env |
| 310 | +# behavior: merge |
| 311 | +# literals: |
| 312 | +# - DEPLOY_TYPE=kustomize # make your edit below this line |
| 313 | +# |
0 commit comments