From 15033215bb08880a83d19d70c84bbf22f0646ab8 Mon Sep 17 00:00:00 2001 From: Beatrix Date: Fri, 17 Feb 2023 10:10:43 -0800 Subject: [PATCH 01/13] Remove deprecated vars and varRefs --- .../prometheus/prometheus.ConfigMap.yaml | 34 +- base/sourcegraph/kustomization.yaml | 8 - base/sourcegraph/pgsql/pgsql.StatefulSet.yaml | 7 +- .../aws/managed-cert/kustomization.yaml | 16 + .../patches/frontend.Ingress.yaml | 0 .../aws/mange-cert/kustomization.yaml | 19 - .../aws/mange-cert/patches/transformer.yaml | 4 - .../gke/managed-cert/kustomization.yaml | 16 + .../patches/frontend.Ingress.yaml | 0 .../gke/mange-cert/kustomization.yaml | 19 - .../gke/mange-cert/patches/transformer.yaml | 4 - components/clusters/k3s/kustomization.yaml | 5 +- .../k3s/monitoring/kustomization.yaml | 4 +- .../clusters/minikube/kustomization.yaml | 32 +- .../clusters/old-base/kustomization.yaml | 80 +-- .../otel-collector/backend/kustomization.yaml | 4 +- .../custom/resources/configs/resources.yaml | 518 ----------------- .../custom/resources/kustomization.yaml | 520 +++++++++++++++++- .../private-registry/kustomization.yaml | 139 ++--- .../private-registry/patches/transformer.yaml | 16 - .../preconfig/kustomization.yaml | 92 ---- components/ingress/domain/kustomization.yaml | 22 +- .../domain/patches/frontend.Ingress.yaml | 2 +- .../ingress/domain/patches/transformer.yaml | 4 - .../ingress/hostname/kustomization.yaml | 27 +- ...end.Ingress.yaml => frontend.Ingress.yaml} | 0 .../ingress/hostname/patches/transformer.yaml | 4 - components/network/tls/kustomization.yaml | 65 ++- ...end.Ingress.yaml => frontend.Ingress.yaml} | 0 .../network/tls/patches/transformer.yaml | 10 - .../remove/daemonset/kustomization.yaml | 74 +-- .../lower-requests/kustomization.yaml | 46 +- components/services/redis/kustomization.yaml | 124 ++++- components/services/redis/transformer.yaml | 9 - components/sizes/xs/kustomization.yaml | 194 ++++++- components/sizes/xs/patches/resources.yaml | 165 ------ .../aws/ebs-csi/kustomization.yaml | 38 +- .../aws/eks-ebs/kustomization.yaml | 38 +- .../storage-class/azure/kustomization.yaml | 38 +- .../storage-class/cloud/kustomization.yaml | 81 +-- .../patches/storageclass-transformer.yaml | 10 - .../storage-class/gcp/kustomization.yaml | 38 +- .../storage-class/k3s/kustomization.yaml | 24 +- .../storage-class/minikube/kustomization.yaml | 24 +- .../name-update/kustomization.yaml | 15 + .../replace-storageclass-name-pvc.yaml | 0 .../replace-storageclass-name-sts.yaml | 0 .../name-update/patches/replacement.yaml | 24 + .../sourcegraph/kustomization.yaml | 20 +- .../storage-class/ssd/kustomization.yaml | 28 +- .../ssd/patches/transformer.yaml | 4 - .../ssd/pod-tmp-gc/kustomization.yaml | 2 +- .../update-class-name/kustomization.yaml | 29 - .../patches/.sourcegraph_config.env | 1 - .../replace-storageclass-name-deploy.yaml | 4 - .../replace-storageclass-name-pvc.yaml | 4 - .../replace-storageclass-name-sts.yaml | 4 - .../patches/transformer.yaml | 9 - .../kustomization.yaml | 31 +- components/utils/migrator/kustomization.yaml | 4 +- .../multi-version-upgrade/kustomization.yaml | 22 +- components/utils/uid/kustomization.yaml | 8 +- examples/gke/kustomization.yaml | 3 - instances/template/config.template.yaml | 21 + .../template/kustomization.template.yaml | 80 ++- 65 files changed, 1316 insertions(+), 1571 deletions(-) create mode 100644 components/clusters/aws/managed-cert/kustomization.yaml rename components/clusters/aws/{mange-cert => managed-cert}/patches/frontend.Ingress.yaml (100%) delete mode 100644 components/clusters/aws/mange-cert/kustomization.yaml delete mode 100644 components/clusters/aws/mange-cert/patches/transformer.yaml create mode 100644 components/clusters/gke/managed-cert/kustomization.yaml rename components/clusters/gke/{mange-cert => managed-cert}/patches/frontend.Ingress.yaml (100%) delete mode 100644 components/clusters/gke/mange-cert/kustomization.yaml delete mode 100644 components/clusters/gke/mange-cert/patches/transformer.yaml delete mode 100644 components/custom/resources/configs/resources.yaml delete mode 100644 components/enable/private-registry/patches/transformer.yaml delete mode 100644 components/enable/private-registry/preconfig/kustomization.yaml delete mode 100644 components/ingress/domain/patches/transformer.yaml rename components/ingress/hostname/patches/{sourcegraph-frontend.Ingress.yaml => frontend.Ingress.yaml} (100%) delete mode 100644 components/ingress/hostname/patches/transformer.yaml rename components/network/tls/patches/{sourcegraph-frontend.Ingress.yaml => frontend.Ingress.yaml} (100%) delete mode 100644 components/network/tls/patches/transformer.yaml delete mode 100644 components/services/redis/transformer.yaml delete mode 100644 components/sizes/xs/patches/resources.yaml delete mode 100644 components/storage-class/cloud/patches/storageclass-transformer.yaml create mode 100644 components/storage-class/name-update/kustomization.yaml rename components/storage-class/{cloud => name-update}/patches/replace-storageclass-name-pvc.yaml (100%) rename components/storage-class/{cloud => name-update}/patches/replace-storageclass-name-sts.yaml (100%) create mode 100644 components/storage-class/name-update/patches/replacement.yaml delete mode 100644 components/storage-class/ssd/patches/transformer.yaml delete mode 100644 components/storage-class/update-class-name/kustomization.yaml delete mode 100644 components/storage-class/update-class-name/patches/.sourcegraph_config.env delete mode 100644 components/storage-class/update-class-name/patches/replace-storageclass-name-deploy.yaml delete mode 100644 components/storage-class/update-class-name/patches/replace-storageclass-name-pvc.yaml delete mode 100644 components/storage-class/update-class-name/patches/replace-storageclass-name-sts.yaml delete mode 100644 components/storage-class/update-class-name/patches/transformer.yaml create mode 100644 instances/template/config.template.yaml diff --git a/base/monitoring/prometheus/prometheus.ConfigMap.yaml b/base/monitoring/prometheus/prometheus.ConfigMap.yaml index cc11c477..17bec0f3 100644 --- a/base/monitoring/prometheus/prometheus.ConfigMap.yaml +++ b/base/monitoring/prometheus/prometheus.ConfigMap.yaml @@ -75,6 +75,21 @@ data: target_label: name separator: '-' + # Extra rules + extra_rules.yml: | + groups: + - name: container.rules + rules: + - record: container:process_cpu_seconds_total:ratio_rate5m + expr: sum by (instance) (rate(process_cpu_seconds_total[5m])) / engine_daemon_engine_cpus_cpus + - record: container:process_cpu_seconds_total:sum + expr: sum by (instance) (irate(process_cpu_seconds_total[1m])) + - record: container:process_resident_memory_bytes:max + expr: max by (instance) (process_resident_memory_bytes) + - record: container:process_virtual_memory_bytes:max + expr: max by (instance) (process_virtual_memory_bytes) + + # List of static targets prometheus_targets.yml: | - labels: nodename: "sourcegraph-services" @@ -103,7 +118,7 @@ data: - worker-executors:6996 - labels: nodename: "sourcegraph-services" - job: node + job: syntect-server targets: - syntect-server:6060 - labels: @@ -147,19 +162,7 @@ data: targets: - otel-collector:8888 - extra_rules.yml: | - groups: - - name: container.rules - rules: - - record: container:process_cpu_seconds_total:ratio_rate5m - expr: sum by (instance) (rate(process_cpu_seconds_total[5m])) / engine_daemon_engine_cpus_cpus - - record: container:process_cpu_seconds_total:sum - expr: sum by (instance) (irate(process_cpu_seconds_total[1m])) - - record: container:process_resident_memory_bytes:max - expr: max by (instance) (process_resident_memory_bytes) - - record: container:process_virtual_memory_bytes:max - expr: max by (instance) (process_virtual_memory_bytes) - + # Add new targets based on replica count of symbols symbols_targets.yml: | - labels: nodename: "sourcegraph-services" @@ -167,6 +170,7 @@ data: targets: - symbols-0.symbols:6060 + # Add new targets based on replica count of searcher searcher_targets.yml: | - labels: nodename: "sourcegraph-services" @@ -174,6 +178,7 @@ data: targets: - searcher-0.searcher:6060 + # Add new targets based on replica count of gitserver gitserver_targets.yml: | - labels: nodename: "sourcegraph-services" @@ -181,6 +186,7 @@ data: targets: - gitserver-0.gitserver:6060 + # Add new targets based on replica count of indexed-search indexed-search_targets.yml: | - labels: nodename: "sourcegraph-services" diff --git a/base/sourcegraph/kustomization.yaml b/base/sourcegraph/kustomization.yaml index 7fa6c4cb..3e4fb797 100644 --- a/base/sourcegraph/kustomization.yaml +++ b/base/sourcegraph/kustomization.yaml @@ -16,11 +16,3 @@ resources: - symbols - syntect-server - worker -# Create config map for kustomize configuration -generatorOptions: - labels: - name: sourcegraph-kustomize-configs -configMapGenerator: - - name: sourcegraph-kustomize-env - literals: - - deploy=sourcegraph diff --git a/base/sourcegraph/pgsql/pgsql.StatefulSet.yaml b/base/sourcegraph/pgsql/pgsql.StatefulSet.yaml index 7909b9f8..24bf70d2 100644 --- a/base/sourcegraph/pgsql/pgsql.StatefulSet.yaml +++ b/base/sourcegraph/pgsql/pgsql.StatefulSet.yaml @@ -28,7 +28,12 @@ spec: initContainers: - name: correct-data-dir-permissions image: index.docker.io/sourcegraph/alpine-3.14:4.4.2@sha256:f5b9588d8bc2107cf37ed135ae63ba1930df0828a425bd445a8d9eb3aad5f783 - command: ["sh", "-c", "if [ -d /data/pgdata-12 ]; then chmod 750 /data/pgdata-12; fi"] + command: + [ + "sh", + "-c", + "if [ -d /data/pgdata-12 ]; then chmod 750 /data/pgdata-12; fi", + ] volumeMounts: - mountPath: /data name: disk diff --git a/components/clusters/aws/managed-cert/kustomization.yaml b/components/clusters/aws/managed-cert/kustomization.yaml new file mode 100644 index 00000000..55a6663d --- /dev/null +++ b/components/clusters/aws/managed-cert/kustomization.yaml @@ -0,0 +1,16 @@ +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component +replacements: + - source: + fieldPath: data.AWS_MANAGED_CERT_ARN + kind: SourcegraphKustomizeConfig + name: sourcegraph-kustomize-env + version: v1 + targets: + - fieldPaths: + - metadata.annotations.[alb.ingress.kubernetes.io/certificate-arn] + select: + kind: Ingress + name: sourcegraph-frontend +patches: + - path: patches/frontend.Ingress.yaml diff --git a/components/clusters/aws/mange-cert/patches/frontend.Ingress.yaml b/components/clusters/aws/managed-cert/patches/frontend.Ingress.yaml similarity index 100% rename from components/clusters/aws/mange-cert/patches/frontend.Ingress.yaml rename to components/clusters/aws/managed-cert/patches/frontend.Ingress.yaml diff --git a/components/clusters/aws/mange-cert/kustomization.yaml b/components/clusters/aws/mange-cert/kustomization.yaml deleted file mode 100644 index fe21ba3b..00000000 --- a/components/clusters/aws/mange-cert/kustomization.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1alpha1 -kind: Component -patchesStrategicMerge: -- patches/frontend.Ingress.yaml -configMapGenerator: - - name: sourcegraph-kustomize-env - behavior: merge - literals: - - AWS_MANAGED_CERT_ARN=SOURCEGRAPH_OVERLAY_PLACEHOLDER -configurations: -- patches/transformer.yaml -vars: - - name: AWS_MANAGED_CERT_ARN - objref: - apiVersion: v1 - kind: ConfigMap - name: sourcegraph-kustomize-env - fieldref: - fieldpath: data.AWS_MANAGED_CERT_ARN diff --git a/components/clusters/aws/mange-cert/patches/transformer.yaml b/components/clusters/aws/mange-cert/patches/transformer.yaml deleted file mode 100644 index cc7163a6..00000000 --- a/components/clusters/aws/mange-cert/patches/transformer.yaml +++ /dev/null @@ -1,4 +0,0 @@ -varReference: - - kind: Ingress - name: sourcegraph-frontend - path: metadata/annotations \ No newline at end of file diff --git a/components/clusters/gke/managed-cert/kustomization.yaml b/components/clusters/gke/managed-cert/kustomization.yaml new file mode 100644 index 00000000..db18fae5 --- /dev/null +++ b/components/clusters/gke/managed-cert/kustomization.yaml @@ -0,0 +1,16 @@ +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component +replacements: + - source: + fieldPath: data.GKE_MANAGED_CERT_NAME + kind: SourcegraphKustomizeConfig + name: sourcegraph-kustomize-env + version: v1 + targets: + - fieldPaths: + - metadata.annotations.[networking.gke.io/managed-certificates] + select: + kind: Ingress + name: sourcegraph-frontend +patches: + - path: patches/frontend.Ingress.yaml diff --git a/components/clusters/gke/mange-cert/patches/frontend.Ingress.yaml b/components/clusters/gke/managed-cert/patches/frontend.Ingress.yaml similarity index 100% rename from components/clusters/gke/mange-cert/patches/frontend.Ingress.yaml rename to components/clusters/gke/managed-cert/patches/frontend.Ingress.yaml diff --git a/components/clusters/gke/mange-cert/kustomization.yaml b/components/clusters/gke/mange-cert/kustomization.yaml deleted file mode 100644 index 1f623597..00000000 --- a/components/clusters/gke/mange-cert/kustomization.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1alpha1 -kind: Component -patchesStrategicMerge: -- patches/frontend.Ingress.yaml -configMapGenerator: - - name: sourcegraph-kustomize-env - behavior: merge - literals: - - GKE_MANAGED_CERT_NAME=SOURCEGRAPH_OVERLAY_PLACEHOLDER -configurations: -- patches/transformer.yaml -vars: - - name: GKE_MANAGED_CERT_NAME - objref: - apiVersion: v1 - kind: ConfigMap - name: sourcegraph-kustomize-env - fieldref: - fieldpath: data.GKE_MANAGED_CERT_NAME diff --git a/components/clusters/gke/mange-cert/patches/transformer.yaml b/components/clusters/gke/mange-cert/patches/transformer.yaml deleted file mode 100644 index cc7163a6..00000000 --- a/components/clusters/gke/mange-cert/patches/transformer.yaml +++ /dev/null @@ -1,4 +0,0 @@ -varReference: - - kind: Ingress - name: sourcegraph-frontend - path: metadata/annotations \ No newline at end of file diff --git a/components/clusters/k3s/kustomization.yaml b/components/clusters/k3s/kustomization.yaml index 7773cc35..de763dee 100644 --- a/components/clusters/k3s/kustomization.yaml +++ b/components/clusters/k3s/kustomization.yaml @@ -3,6 +3,5 @@ kind: Component components: - monitoring - ../../storage-class/k3s - # - ../../privileged -patchesStrategicMerge: - - patches/sourcegraph-frontend.Ingress.yaml +patches: + - path: patches/sourcegraph-frontend.Ingress.yaml diff --git a/components/clusters/k3s/monitoring/kustomization.yaml b/components/clusters/k3s/monitoring/kustomization.yaml index 75437f5f..a790e0ed 100644 --- a/components/clusters/k3s/monitoring/kustomization.yaml +++ b/components/clusters/k3s/monitoring/kustomization.yaml @@ -6,5 +6,5 @@ resources: components: - ../../../monitoring/privileged - ../../../storage-class/k3s -patchesStrategicMerge: - - patches/prometheus.ConfigMap.yaml +patches: + - path: patches/prometheus.ConfigMap.yaml diff --git a/components/clusters/minikube/kustomization.yaml b/components/clusters/minikube/kustomization.yaml index 65b2dc95..dae07e81 100644 --- a/components/clusters/minikube/kustomization.yaml +++ b/components/clusters/minikube/kustomization.yaml @@ -3,33 +3,33 @@ kind: Component components: - ../../storage-class/minikube patches: - - target: + - path: patches/remove-deployment-resources-container-0.yaml + target: + group: apps kind: Deployment name: .* - group: apps version: v1 - path: patches/remove-deployment-resources-container-0.yaml - - target: + - path: patches/remove-deployment-resources-container-1.yaml + target: + group: apps kind: Deployment name: pgsql|redis-cache|redis-store|codeintel-db|codeinsights-db - group: apps version: v1 - path: patches/remove-deployment-resources-container-1.yaml - - target: + - path: patches/remove-statefulset-resources-container-0.yaml + target: + group: apps kind: StatefulSet name: .* - group: apps version: v1 - path: patches/remove-statefulset-resources-container-0.yaml - - target: + - path: patches/remove-statefulset-resources-container-1.yaml + target: + group: apps kind: StatefulSet name: indexed-search - group: apps version: v1 - path: patches/remove-statefulset-resources-container-1.yaml - - target: - kind: Deployment - name: sourcegraph-frontend|pgsql|codeintel-db|codeinsights-db + - path: patches/remove-deployment-resources-container-init.yaml + target: group: apps + kind: Deployment|StatefulSet + name: sourcegraph-frontend|pgsql|codeintel-db|codeinsights-db version: v1 - path: patches/remove-deployment-resources-container-init.yaml diff --git a/components/clusters/old-base/kustomization.yaml b/components/clusters/old-base/kustomization.yaml index e466aedb..2370210b 100644 --- a/components/clusters/old-base/kustomization.yaml +++ b/components/clusters/old-base/kustomization.yaml @@ -1,74 +1,74 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 -kind: Component +kind: + Component + # Switch below from StatefulSet to Deployment + # Add sourcegraph as default storage class name components: - ../../monitoring - ../../monitoring/otel - ../../monitoring/cadvisor - ../../monitoring/rbacs - ../../enable/service-discovery - # Switch below from StatefulSet to Deployment - ../../services/searcher/deployment - ../../services/symbols/deployment - ../../services/pgsql - ../../services/codeinsights-db - ../../services/codeintel-db - # Add sourcegraph as default storage class name - ../../storage-class/sourcegraph -patchesStrategicMerge: - - patches/blobstore/blobstore.Deployment.yaml - - patches/cadvisor/cadvisor.DaemonSet.yaml - - patches/frontend/sourcegraph-frontend.Deployment.yaml - - patches/github-proxy/github-proxy.Deployment.yaml - - patches/gitserver/gitserver.StatefulSet.yaml - - patches/indexed-search/indexed-search.StatefulSet.yaml - - patches/otel-collector/otel-collector.Deployment.yaml - - patches/precise-code-intel/worker.Deployment.yaml - - patches/redis/redis-cache.Deployment.yaml - - patches/redis/redis-store.Deployment.yaml - - patches/repo-updater/repo-updater.Deployment.yaml - - patches/syntect-server/syntect-server.Deployment.yaml - - patches/worker/worker.Deployment.yaml -patchesJson6902: - # To support searcher and symbols as both statefulset and deployment - - target: + # To support searcher and symbols as both statefulset and deployment +patches: + - path: patches/searcher/searcher.patchesJson6902.yaml + target: + group: apps kind: StatefulSet|Deployment name: searcher - group: apps version: v1 - path: patches/searcher/searcher.patchesJson6902.yaml - - target: + - path: patches/symbols/symbols.patchesJson6902.yaml + target: + group: apps kind: StatefulSet|Deployment name: symbols - group: apps version: v1 - path: patches/symbols/symbols.patchesJson6902.yaml - - target: + - path: patches/remove/securityContext-container-0.yaml + target: + group: apps kind: StatefulSet|Deployment name: .* - group: apps version: v1 - path: patches/remove/securityContext-container-0.yaml - - target: + - path: patches/remove/securityContext-daemonset.yaml + target: + group: apps kind: DaemonSet name: otel-agent - group: apps version: v1 - path: patches/remove/securityContext-daemonset.yaml - - target: + - path: patches/remove/securityContext-databases.yaml + target: + group: apps kind: StatefulSet|Deployment name: codeinsights-db|codeintel-db|pgsql|sourcegraph-frontend - group: apps version: v1 - path: patches/remove/securityContext-databases.yaml - - target: + - path: patches/remove/securityContext-initContainer.yaml + target: + group: apps kind: Deployment name: sourcegraph-frontend - group: apps version: v1 - path: patches/remove/securityContext-initContainer.yaml - - target: + - path: patches/remove/securityContext-container-1.yaml + target: + group: apps kind: Deployment|StatefulSet name: redis-cache|redis-store|indexed-search - group: apps version: v1 - path: patches/remove/securityContext-container-1.yaml + - path: patches/blobstore/blobstore.Deployment.yaml + - path: patches/cadvisor/cadvisor.DaemonSet.yaml + - path: patches/frontend/sourcegraph-frontend.Deployment.yaml + - path: patches/github-proxy/github-proxy.Deployment.yaml + - path: patches/gitserver/gitserver.StatefulSet.yaml + - path: patches/indexed-search/indexed-search.StatefulSet.yaml + - path: patches/otel-collector/otel-collector.Deployment.yaml + - path: patches/precise-code-intel/worker.Deployment.yaml + - path: patches/redis/redis-cache.Deployment.yaml + - path: patches/redis/redis-store.Deployment.yaml + - path: patches/repo-updater/repo-updater.Deployment.yaml + - path: patches/syntect-server/syntect-server.Deployment.yaml + - path: patches/worker/worker.Deployment.yaml diff --git a/components/custom/otel-collector/backend/kustomization.yaml b/components/custom/otel-collector/backend/kustomization.yaml index c4f0c4c0..d3a71f75 100644 --- a/components/custom/otel-collector/backend/kustomization.yaml +++ b/components/custom/otel-collector/backend/kustomization.yaml @@ -1,4 +1,4 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: -- patches/otel-collector.Deployment.yaml \ No newline at end of file +patches: + - path: patches/otel-collector.Deployment.yaml diff --git a/components/custom/resources/configs/resources.yaml b/components/custom/resources/configs/resources.yaml deleted file mode 100644 index 22c6dc3e..00000000 --- a/components/custom/resources/configs/resources.yaml +++ /dev/null @@ -1,518 +0,0 @@ -########################## HOW TO USE ######################################## -# Uncomment the services and update the values under resources -################################################################################ - -# apiVersion: apps/v1 -# kind: StatefulSet -# metadata: -# name: gitserver -# spec: -# replicas: 1 -# template: -# spec: -# containers: -# - name: gitserver -# resources: -# limits: -# cpu: "4" -# memory: 8G -# requests: -# cpu: "4" -# memory: 8G -# volumeClaimTemplates: -# - spec: -# resources: -# requests: -# storage: 200Gi # If you change this, also change indexed-search's disk size. ---- -# apiVersion: apps/v1 -# kind: DaemonSet -# metadata: -# name: cadvisor -# spec: -# template: -# spec: -# containers: -# - name: cadvisor -# resources: -# limits: -# cpu: 300m -# memory: 200Mi -# requests: -# cpu: 100m -# memory: 200Mi ---- -# apiVersion: apps/v1 -# kind: Deployment -# metadata: -# name: codeinsights-db -# spec: -# template: -# spec: -# containers: -# - name: codeinsights -# resources: -# limits: -# cpu: "4" -# memory: "2Gi" -# requests: -# cpu: "4" -# memory: "2Gi" ---- -# apiVersion: apps/v1 -# kind: StatefulSet -# metadata: -# name: codeinsights-db -# spec: -# template: -# spec: -# containers: -# - name: codeinsights -# resources: -# limits: -# cpu: "4" -# memory: "2Gi" -# requests: -# cpu: "4" -# memory: "2Gi" ---- -# apiVersion: apps/v1 -# kind: Deployment -# metadata: -# name: codeintel-db -# spec: -# template: -# spec: -# containers: -# - name: pgsql -# resources: -# limits: -# cpu: "16" -# memory: 16G -# requests: -# cpu: "8" -# memory: 8G ---- -# apiVersion: apps/v1 -# kind: StatefulSet -# metadata: -# name: codeintel-db -# spec: -# template: -# spec: -# containers: -# - name: pgsql -# resources: -# limits: -# cpu: "16" -# memory: 16G -# requests: -# cpu: "8" -# memory: 8G ---- -# apiVersion: apps/v1 -# kind: Deployment -# metadata: -# name: sourcegraph-frontend -# spec: -# replicas: 2 -# template: -# spec: -# containers: -# - name: frontend -# resources: -# limits: -# cpu: "2" -# ephemeral-storage: "8Gi" -# memory: 4G -# requests: -# cpu: "2" -# ephemeral-storage: "4Gi" -# memory: 2G ---- -# apiVersion: apps/v1 -# kind: StatefulSet -# metadata: -# name: grafana -# spec: -# template: -# spec: -# containers: -# - name: grafana -# resources: -# limits: -# cpu: "1" -# memory: 512Mi -# requests: -# cpu: 100m -# memory: 512Mi -# volumeClaimTemplates: -# - spec: -# resources: -# requests: -# storage: 2Gi ---- -# apiVersion: apps/v1 -# kind: StatefulSet -# metadata: -# name: indexed-search -# spec: -# replicas: 1 -# template: -# spec: -# containers: -# - name: zoekt-webserver -# resources: -# limits: -# cpu: "16" -# memory: 16G -# requests: -# cpu: "8" -# memory: 8G -# - name: zoekt-indexserver -# resources: -# limits: -# cpu: "16" -# memory: 16G -# requests: -# cpu: "8" -# memory: 8G -# volumeClaimTemplates: -# - spec: -# resources: -# requests: -# storage: 200Gi ---- -# apiVersion: apps/v1 -# kind: Deployment -# metadata: -# name: blobstore -# spec: -# template: -# spec: -# containers: -# - name: blobstore -# resources: -# limits: -# cpu: "1" -# memory: 500M -# requests: -# cpu: "1" -# memory: 500M ---- -# apiVersion: apps/v1 -# kind: Deployment -# metadata: -# name: pgsql -# spec: -# template: -# spec: -# containers: -# - name: pgsql -# resources: -# limits: -# cpu: "4" -# memory: 4Gi -# requests: -# cpu: "4" -# memory: 4Gi ---- -# apiVersion: apps/v1 -# kind: StatefulSet -# metadata: -# name: pgsql -# spec: -# template: -# spec: -# containers: -# - name: pgsql -# resources: -# limits: -# cpu: "4" -# memory: 4Gi -# requests: -# cpu: "4" -# memory: 4Gi ---- -# apiVersion: apps/v1 -# kind: Deployment -# metadata: -# name: precise-code-intel-worker -# spec: -# replicas: 2 -# template: -# spec: -# containers: -# - name: precise-code-intel-worker -# resources: -# limits: -# cpu: "2" -# memory: 4G -# requests: -# cpu: 500m -# memory: 2G ---- -# apiVersion: apps/v1 -# kind: Deployment -# metadata: -# name: prometheus -# spec: -# template: -# spec: -# containers: -# - name: prometheus -# resources: -# limits: -# cpu: "2" -# memory: 6G -# requests: -# cpu: 500m -# memory: 6G ---- -# apiVersion: apps/v1 -# kind: Deployment -# metadata: -# name: redis-cache -# spec: -# template: -# spec: -# containers: -# - name: redis-cache -# resources: -# limits: -# cpu: "1" -# memory: 7Gi -# requests: -# cpu: "1" -# memory: 7Gi -# - name: redis-exporter -# resources: -# limits: -# cpu: 10m -# memory: 100Mi -# requests: -# cpu: 10m -# memory: 100Mi ---- -# apiVersion: apps/v1 -# kind: Deployment -# metadata: -# name: redis-store -# spec: -# template: -# spec: -# containers: -# - name: redis-store -# resources: -# limits: -# cpu: "1" -# memory: 7Gi -# requests: -# cpu: "1" -# memory: 7Gi -# - name: redis-exporter -# resources: -# limits: -# cpu: 10m -# memory: 100Mi -# requests: -# cpu: 10m -# memory: 100Mi ---- -# apiVersion: apps/v1 -# kind: Deployment -# metadata: -# name: repo-updater -# spec: -# replicas: 1 # IMPORTANT: Singleton service. Do NOT add more replica. -# template: -# spec: -# containers: -# - name: repo-updater -# resources: -# limits: -# cpu: "1" -# memory: 2Gi -# requests: -# cpu: "1" -# memory: 500Mi ---- -# apiVersion: apps/v1 -# kind: Deployment -# metadata: -# name: searcher -# spec: -# replicas: 2 -# template: -# spec: -# containers: -# - name: searcher -# resources: -# limits: -# cpu: "2" -# ephemeral-storage: "26G" -# memory: 2G -# requests: -# cpu: 500m -# ephemeral-storage: "25G" -# memory: 500M ---- -# apiVersion: apps/v1 -# kind: Deployment -# metadata: -# name: symbols -# spec: -# replicas: 1 -# template: -# spec: -# containers: -# - name: symbols -# resources: -# limits: -# cpu: "2" -# ephemeral-storage: "12G" -# memory: 2G -# requests: -# cpu: 500m -# ephemeral-storage: "10G" -# memory: 500M ---- -# apiVersion: apps/v1 -# kind: Deployment -# metadata: -# name: syntect-server -# spec: -# replicas: 1 -# template: -# spec: -# containers: -# - name: syntect-server -# resources: -# limits: -# cpu: "4" -# memory: 6G -# requests: -# cpu: 250m -# memory: 2G ---- -# apiVersion: apps/v1 -# kind: Deployment -# metadata: -# name: worker -# spec: -# replicas: 1 -# template: -# spec: -# containers: -# - name: worker -# resources: -# limits: -# cpu: "2" -# memory: 4G -# requests: -# cpu: 500m -# memory: 2G ---- -# apiVersion: apps/v1 -# kind: DaemonSet -# metadata: -# name: otel-agent -# spec: -# template: -# spec: -# containers: -# - name: otel-agent -# resources: -# limits: -# cpu: "500m" -# memory: 500Mi -# requests: -# cpu: "100m" -# memory: 100Mi ---- -# apiVersion: apps/v1 -# kind: Deployment -# metadata: -# name: otel-collector -# spec: -# replicas: 1 -# template: -# spec: -# containers: -# - name: otel-collector -# resources: -# limits: -# cpu: "1" -# memory: 2Gi -# requests: -# cpu: "0.5" -# memory: 512Mi - ---- -############################# STORAGE ########################################## -# To update storage size for each PVC: -# Uncomment the services and update the storage values -################################################################################ - -# apiVersion: v1 -# kind: PersistentVolumeClaim -# metadata: -# name: blobstore -# spec: -# resources: -# requests: -# storage: 100Gi ---- -# apiVersion: v1 -# kind: PersistentVolumeClaim -# metadata: -# name: codeinsights-db -# spec: -# resources: -# requests: -# storage: 200Gi ---- -# apiVersion: v1 -# kind: PersistentVolumeClaim -# metadata: -# name: codeintel-db -# spec: -# resources: -# requests: -# storage: 200Gi ---- -# apiVersion: v1 -# kind: PersistentVolumeClaim -# metadata: -# name: pgsql -# spec: -# resources: -# requests: -# storage: 200Gi ---- -# apiVersion: v1 -# kind: PersistentVolumeClaim -# metadata: -# name: prometheus -# spec: -# resources: -# requests: -# storage: 200Gi ---- -# apiVersion: v1 -# kind: PersistentVolumeClaim -# metadata: -# name: redis-cache -# spec: -# resources: -# requests: -# storage: 100Gi ---- -# apiVersion: v1 -# kind: PersistentVolumeClaim -# metadata: -# name: redis-store -# spec: -# resources: -# requests: -# storage: 100Gi diff --git a/components/custom/resources/kustomization.yaml b/components/custom/resources/kustomization.yaml index d6af7589..26f3955b 100644 --- a/components/custom/resources/kustomization.yaml +++ b/components/custom/resources/kustomization.yaml @@ -1,12 +1,520 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component # DO NOT REMOVE: Handle updating endpoints configs for frontend -replacements: # DO NOT REMOVE +replacements: - path: patches/update-endpoints.yaml -patchesStrategicMerge: - - configs/resources.yaml + ########################## HOW TO USE ######################################## -# Step 1 Do not make any changes in this file -# Step 2 Update the resources values in the 'configs/resources.yaml' file -# Step 3 Include this component in your overlay: ../../components/custom/replica +# Uncomment the services and update the values under resources ################################################################################ + +patches: + - patch: |- + apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: gitserver + spec: + replicas: 1 + template: + spec: + containers: + - name: gitserver + resources: + limits: + cpu: "4" + memory: 8G + requests: + cpu: "4" + memory: 8G + volumeClaimTemplates: + - spec: + resources: + requests: + storage: 200Gi # If you change this, also change indexed-search's disk size. + - patch: |- + apiVersion: apps/v1 + kind: DaemonSet + metadata: + name: cadvisor + spec: + template: + spec: + containers: + - name: cadvisor + resources: + limits: + cpu: 300m + memory: 200Mi + requests: + cpu: 100m + memory: 200Mi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: codeinsights-db + spec: + template: + spec: + containers: + - name: codeinsights + resources: + limits: + cpu: "4" + memory: "2Gi" + requests: + cpu: "4" + memory: "2Gi" + - patch: |- + apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: codeinsights-db + spec: + template: + spec: + containers: + - name: codeinsights + resources: + limits: + cpu: "4" + memory: "2Gi" + requests: + cpu: "4" + memory: "2Gi" + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: codeintel-db + spec: + template: + spec: + containers: + - name: pgsql + resources: + limits: + cpu: "16" + memory: 16G + requests: + cpu: "8" + memory: 8G + - patch: |- + apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: codeintel-db + spec: + template: + spec: + containers: + - name: pgsql + resources: + limits: + cpu: "16" + memory: 16G + requests: + cpu: "8" + memory: 8G + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: sourcegraph-frontend + spec: + replicas: 2 + template: + spec: + containers: + - name: frontend + resources: + limits: + cpu: "2" + ephemeral-storage: "8Gi" + memory: 4G + requests: + cpu: "2" + ephemeral-storage: "4Gi" + memory: 2G + - patch: |- + apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: grafana + spec: + template: + spec: + containers: + - name: grafana + resources: + limits: + cpu: "1" + memory: 512Mi + requests: + cpu: 100m + memory: 512Mi + volumeClaimTemplates: + - spec: + resources: + requests: + storage: 2Gi + - patch: |- + apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: indexed-search + spec: + replicas: 1 + template: + spec: + containers: + - name: zoekt-webserver + resources: + limits: + cpu: "16" + memory: 16G + requests: + cpu: "8" + memory: 8G + - name: zoekt-indexserver + resources: + limits: + cpu: "16" + memory: 16G + requests: + cpu: "8" + memory: 8G + volumeClaimTemplates: + - spec: + resources: + requests: + storage: 200Gi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: blobstore + spec: + template: + spec: + containers: + - name: blobstore + resources: + limits: + cpu: "1" + memory: 500M + requests: + cpu: "1" + memory: 500M + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: pgsql + spec: + template: + spec: + containers: + - name: pgsql + resources: + limits: + cpu: "4" + memory: 4Gi + requests: + cpu: "4" + memory: 4Gi + - patch: |- + apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: pgsql + spec: + template: + spec: + containers: + - name: pgsql + resources: + limits: + cpu: "4" + memory: 4Gi + requests: + cpu: "4" + memory: 4Gi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: precise-code-intel-worker + spec: + replicas: 2 + template: + spec: + containers: + - name: precise-code-intel-worker + resources: + limits: + cpu: "2" + memory: 4G + requests: + cpu: 500m + memory: 2G + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: prometheus + spec: + template: + spec: + containers: + - name: prometheus + resources: + limits: + cpu: "2" + memory: 6G + requests: + cpu: 500m + memory: 6G + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: redis-cache + spec: + template: + spec: + containers: + - name: redis-cache + resources: + limits: + cpu: "1" + memory: 7Gi + requests: + cpu: "1" + memory: 7Gi + - name: redis-exporter + resources: + limits: + cpu: 10m + memory: 100Mi + requests: + cpu: 10m + memory: 100Mi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: redis-store + spec: + template: + spec: + containers: + - name: redis-store + resources: + limits: + cpu: "1" + memory: 7Gi + requests: + cpu: "1" + memory: 7Gi + - name: redis-exporter + resources: + limits: + cpu: 10m + memory: 100Mi + requests: + cpu: 10m + memory: 100Mi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: repo-updater + spec: + replicas: 1 # IMPORTANT: Singleton service. Do NOT add more replica. + template: + spec: + containers: + - name: repo-updater + resources: + limits: + cpu: "1" + memory: 2Gi + requests: + cpu: "1" + memory: 500Mi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: searcher + spec: + replicas: 2 + template: + spec: + containers: + - name: searcher + resources: + limits: + cpu: "2" + ephemeral-storage: "26G" + memory: 2G + requests: + cpu: 500m + ephemeral-storage: "25G" + memory: 500M + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: symbols + spec: + replicas: 1 + template: + spec: + containers: + - name: symbols + resources: + limits: + cpu: "2" + ephemeral-storage: "12G" + memory: 2G + requests: + cpu: 500m + ephemeral-storage: "10G" + memory: 500M + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: syntect-server + spec: + replicas: 1 + template: + spec: + containers: + - name: syntect-server + resources: + limits: + cpu: "4" + memory: 6G + requests: + cpu: 250m + memory: 2G + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: worker + spec: + replicas: 1 + template: + spec: + containers: + - name: worker + resources: + limits: + cpu: "2" + memory: 4G + requests: + cpu: 500m + memory: 2G + - patch: |- + apiVersion: apps/v1 + kind: DaemonSet + metadata: + name: otel-agent + spec: + template: + spec: + containers: + - name: otel-agent + resources: + limits: + cpu: "500m" + memory: 500Mi + requests: + cpu: "100m" + memory: 100Mi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: otel-collector + spec: + replicas: 1 + template: + spec: + containers: + - name: otel-collector + resources: + limits: + cpu: "1" + memory: 2Gi + requests: + cpu: "0.5" + memory: 512Mi + - patch: |- + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: blobstore + spec: + resources: + requests: + storage: 100Gi + - patch: |- + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: codeinsights-db + spec: + resources: + requests: + storage: 200Gi + - patch: |- + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: codeintel-db + spec: + resources: + requests: + storage: 200Gi + - patch: |- + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: pgsql + spec: + resources: + requests: + storage: 200Gi + - patch: |- + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: prometheus + spec: + resources: + requests: + storage: 200Gi + - patch: |- + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: redis-cache + spec: + resources: + requests: + storage: 100Gi + - patch: |- + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: redis-store + spec: + resources: + requests: + storage: 100Gi diff --git a/components/enable/private-registry/kustomization.yaml b/components/enable/private-registry/kustomization.yaml index 2ad00e30..52b28eb8 100644 --- a/components/enable/private-registry/kustomization.yaml +++ b/components/enable/private-registry/kustomization.yaml @@ -1,109 +1,36 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -components: - - preconfig -configMapGenerator: - - name: sourcegraph-kustomize-env - behavior: merge - literals: - - PRIVATE_REGISTRY=$(PRIVATE_REGISTRY) -configurations: - - patches/transformer.yaml -vars: - - name: PRIVATE_REGISTRY - objref: - apiVersion: v1 - kind: ConfigMap +replacements: + - source: + fieldPath: data.PRIVATE_REGISTRY + kind: SourcegraphKustomizeConfig name: sourcegraph-kustomize-env - fieldref: - fieldpath: data.PRIVATE_REGISTRY -########################## HOW TO USE ######################################## -# Replace the PRIVATE_REGISTRY variable with your registry -# -# Example: -# - name: index.docker.io/sourcegraph/blobstore -# newName: my.private.registry.docker.io/sourcegraph/blobstore -# -# You can also update the tag using the "newTag" field -################################################################################ -# images: -# # MAIN STACKS -# - name: index.docker.io/sourcegraph/blobstore -# newName: $(PRIVATE_REGISTRY)/sourcegraph/blobstore -# # newTag: new.private.tag -# - name: index.docker.io/sourcegraph/alpine-3.14 -# newName: $(PRIVATE_REGISTRY)/sourcegraph/alpine-3.14 -# # newTag: new.private.tag -# - name: index.docker.io/sourcegraph/codeinsights-db -# newName: $(PRIVATE_REGISTRY)/sourcegraph/codeinsights-db -# # newTag: new.private.tag -# - name: index.docker.io/sourcegraph/codeintel-db -# newName: $(PRIVATE_REGISTRY)/sourcegraph/codeintel-db -# # newTag: new.private.tag -# - name: index.docker.io/sourcegraph/frontend -# newName: $(PRIVATE_REGISTRY)/sourcegraph/frontend -# # newTag: new.private.tag -# - name: index.docker.io/sourcegraph/github-proxy -# newName: $(PRIVATE_REGISTRY)/sourcegraph/github-proxy -# # newTag: new.private.tag -# - name: index.docker.io/sourcegraph/gitserver -# newName: $(PRIVATE_REGISTRY)/sourcegraph/gitserver -# # newTag: new.private.tag -# - name: index.docker.io/sourcegraph/indexed-searcher -# newName: $(PRIVATE_REGISTRY)/sourcegraph/indexed-searcher -# # newTag: new.private.tag -# - name: index.docker.io/sourcegraph/migrator -# newName: $(PRIVATE_REGISTRY)/sourcegraph/migrator -# # newTag: new.private.tag -# - name: index.docker.io/sourcegraph/opentelemetry-collector -# newName: $(PRIVATE_REGISTRY)/sourcegraph/opentelemetry-collector -# # newTag: new.private.tag -# - name: index.docker.io/sourcegraph/postgres-12-alpine -# newName: $(PRIVATE_REGISTRY)/sourcegraph/postgres-12-alpine -# # newTag: new.private.tag -# - name: index.docker.io/sourcegraph/postgres_exporter -# newName: $(PRIVATE_REGISTRY)/sourcegraph/postgres_exporter -# # newTag: new.private.tag -# - name: index.docker.io/sourcegraph/precise-code-intel-worker -# newName: $(PRIVATE_REGISTRY)/sourcegraph/precise-code-intel-worker -# # newTag: new.private.tag -# - name: index.docker.io/sourcegraph/redis-cache -# newName: $(PRIVATE_REGISTRY)/sourcegraph/redis-cache -# # newTag: new.private.tag -# - name: index.docker.io/sourcegraph/redis-store -# newName: $(PRIVATE_REGISTRY)/sourcegraph/redis-store -# # newTag: new.private.tag -# - name: index.docker.io/sourcegraph/redis_exporter -# newName: $(PRIVATE_REGISTRY)/sourcegraph/redis_exporter -# # newTag: new.private.tag -# - name: index.docker.io/sourcegraph/repo-updater -# newName: $(PRIVATE_REGISTRY)/sourcegraph/repo-updater -# # newTag: new.private.tag -# - name: index.docker.io/sourcegraph/search-indexer -# newName: $(PRIVATE_REGISTRY)/sourcegraph/search-indexer -# # newTag: new.private.tag -# - name: index.docker.io/sourcegraph/searcher -# newName: $(PRIVATE_REGISTRY)/sourcegraph/searcher -# # newTag: new.private.tag -# - name: index.docker.io/sourcegraph/symbols -# newName: $(PRIVATE_REGISTRY)/sourcegraph/symbols -# # newTag: new.private.tag -# - name: index.docker.io/sourcegraph/syntax-highlighter -# newName: $(PRIVATE_REGISTRY)/sourcegraph/syntax-highlighter -# # newTag: new.private.tag -# - name: index.docker.io/sourcegraph/worker -# newName: $(PRIVATE_REGISTRY)/sourcegraph/worker -# # newTag: new.private.tag -# #################### MONITORING STACKS #################### -# - name: index.docker.io/sourcegraph/cadvisor -# newName: $(PRIVATE_REGISTRY)/sourcegraph/cadvisor -# # newTag: new.private.tag -# - name: index.docker.io/sourcegraph/grafana -# newName: $(PRIVATE_REGISTRY)/sourcegraph/grafana -# # newTag: new.private.tag -# - name: index.docker.io/sourcegraph/prometheus -# newName: $(PRIVATE_REGISTRY)/sourcegraph/prometheus -# # newTag: new.private.tag -# - name: index.docker.io/sourcegraph/node-exporter -# newName: $(PRIVATE_REGISTRY)/sourcegraph/prometheus -# # newTag: new.private.tag + version: v1 + targets: + - select: + kind: Deployment + group: apps + fieldPaths: + - spec.template.spec.containers.*.image + - spec.template.spec.initContainers.*.image + options: + delimiter: "/sourcegraph" + index: 0 + - select: + kind: StatefulSet + group: apps + fieldPaths: + - spec.template.spec.containers.*.image + - spec.template.spec.initContainers.*.image + options: + delimiter: "/sourcegraph" + index: 0 + - select: + kind: DaemonSet + group: apps + fieldPaths: + - spec.template.spec.containers.*.image + - spec.template.spec.initContainers.*.image + options: + delimiter: "/sourcegraph" + index: 0 diff --git a/components/enable/private-registry/patches/transformer.yaml b/components/enable/private-registry/patches/transformer.yaml deleted file mode 100644 index 2221e393..00000000 --- a/components/enable/private-registry/patches/transformer.yaml +++ /dev/null @@ -1,16 +0,0 @@ -varReference: - - kind: Deployment - group: apps - path: spec/template/spec/containers/image - - kind: Deployment - group: apps - path: spec/template/spec/initContainers/image - - kind: StatefulSet - group: apps - path: spec/template/spec/containers/image - - kind: StatefulSet - group: apps - path: spec/template/spec/initContainers/image - - kind: DaemonSet - group: apps - path: spec/template/spec/containers/image diff --git a/components/enable/private-registry/preconfig/kustomization.yaml b/components/enable/private-registry/preconfig/kustomization.yaml deleted file mode 100644 index 9de862f3..00000000 --- a/components/enable/private-registry/preconfig/kustomization.yaml +++ /dev/null @@ -1,92 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1alpha1 -kind: Component -########################## HOW TO USE ######################################## -# Replace the PRIVATE_REGISTRY variable with your registry -# -# Example: -# - name: index.docker.io/sourcegraph/blobstore -# newName: my.private.registry.docker.io/sourcegraph/blobstore -# -# You can also update the tag using the "newTag" field -################################################################################ -images: - # MAIN STACKS - - name: index.docker.io/sourcegraph/blobstore - newName: $(PRIVATE_REGISTRY)/sourcegraph/blobstore - # newTag: new.private.tag - - name: index.docker.io/sourcegraph/alpine-3.14 - newName: $(PRIVATE_REGISTRY)/sourcegraph/alpine-3.14 - # newTag: new.private.tag - - name: index.docker.io/sourcegraph/codeinsights-db - newName: $(PRIVATE_REGISTRY)/sourcegraph/codeinsights-db - # newTag: new.private.tag - - name: index.docker.io/sourcegraph/codeintel-db - newName: $(PRIVATE_REGISTRY)/sourcegraph/codeintel-db - # newTag: new.private.tag - - name: index.docker.io/sourcegraph/frontend - newName: $(PRIVATE_REGISTRY)/sourcegraph/frontend - # newTag: new.private.tag - - name: index.docker.io/sourcegraph/github-proxy - newName: $(PRIVATE_REGISTRY)/sourcegraph/github-proxy - # newTag: new.private.tag - - name: index.docker.io/sourcegraph/gitserver - newName: $(PRIVATE_REGISTRY)/sourcegraph/gitserver - # newTag: new.private.tag - - name: index.docker.io/sourcegraph/indexed-searcher - newName: $(PRIVATE_REGISTRY)/sourcegraph/indexed-searcher - # newTag: new.private.tag - - name: index.docker.io/sourcegraph/migrator - newName: $(PRIVATE_REGISTRY)/sourcegraph/migrator - # newTag: new.private.tag - - name: index.docker.io/sourcegraph/opentelemetry-collector - newName: $(PRIVATE_REGISTRY)/sourcegraph/opentelemetry-collector - # newTag: new.private.tag - - name: index.docker.io/sourcegraph/postgres-12-alpine - newName: $(PRIVATE_REGISTRY)/sourcegraph/postgres-12-alpine - # newTag: new.private.tag - - name: index.docker.io/sourcegraph/postgres_exporter - newName: $(PRIVATE_REGISTRY)/sourcegraph/postgres_exporter - # newTag: new.private.tag - - name: index.docker.io/sourcegraph/precise-code-intel-worker - newName: $(PRIVATE_REGISTRY)/sourcegraph/precise-code-intel-worker - # newTag: new.private.tag - - name: index.docker.io/sourcegraph/redis-cache - newName: $(PRIVATE_REGISTRY)/sourcegraph/redis-cache - # newTag: new.private.tag - - name: index.docker.io/sourcegraph/redis-store - newName: $(PRIVATE_REGISTRY)/sourcegraph/redis-store - # newTag: new.private.tag - - name: index.docker.io/sourcegraph/redis_exporter - newName: $(PRIVATE_REGISTRY)/sourcegraph/redis_exporter - # newTag: new.private.tag - - name: index.docker.io/sourcegraph/repo-updater - newName: $(PRIVATE_REGISTRY)/sourcegraph/repo-updater - # newTag: new.private.tag - - name: index.docker.io/sourcegraph/search-indexer - newName: $(PRIVATE_REGISTRY)/sourcegraph/search-indexer - # newTag: new.private.tag - - name: index.docker.io/sourcegraph/searcher - newName: $(PRIVATE_REGISTRY)/sourcegraph/searcher - # newTag: new.private.tag - - name: index.docker.io/sourcegraph/symbols - newName: $(PRIVATE_REGISTRY)/sourcegraph/symbols - # newTag: new.private.tag - - name: index.docker.io/sourcegraph/syntax-highlighter - newName: $(PRIVATE_REGISTRY)/sourcegraph/syntax-highlighter - # newTag: new.private.tag - - name: index.docker.io/sourcegraph/worker - newName: $(PRIVATE_REGISTRY)/sourcegraph/worker - # newTag: new.private.tag - #################### MONITORING STACKS #################### - - name: index.docker.io/sourcegraph/cadvisor - newName: $(PRIVATE_REGISTRY)/sourcegraph/cadvisor - # newTag: new.private.tag - - name: index.docker.io/sourcegraph/grafana - newName: $(PRIVATE_REGISTRY)/sourcegraph/grafana - # newTag: new.private.tag - - name: index.docker.io/sourcegraph/prometheus - newName: $(PRIVATE_REGISTRY)/sourcegraph/prometheus - # newTag: new.private.tag - - name: index.docker.io/sourcegraph/node-exporter - newName: $(PRIVATE_REGISTRY)/sourcegraph/node-exporter - # newTag: new.private.tag diff --git a/components/ingress/domain/kustomization.yaml b/components/ingress/domain/kustomization.yaml index 4c9e6eb6..bd0250bb 100644 --- a/components/ingress/domain/kustomization.yaml +++ b/components/ingress/domain/kustomization.yaml @@ -1,14 +1,16 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component patchesStrategicMerge: -- frontend.Ingress.yaml -configurations: -- patches/transformer.yaml -vars: - - name: HOST_DOMAIN - objref: - apiVersion: v1 - kind: ConfigMap + - patches/frontend.Ingress.yaml +replacements: + - source: + fieldPath: data.HOST_DOMAIN + kind: SourcegraphKustomizeConfig name: sourcegraph-kustomize-env - fieldref: - fieldpath: data.HOST_DOMAIN + version: v1 + targets: + - select: + kind: Ingress + name: sourcegraph-frontend + fieldPaths: + - metadata.host diff --git a/components/ingress/domain/patches/frontend.Ingress.yaml b/components/ingress/domain/patches/frontend.Ingress.yaml index 191328df..473c8917 100644 --- a/components/ingress/domain/patches/frontend.Ingress.yaml +++ b/components/ingress/domain/patches/frontend.Ingress.yaml @@ -2,4 +2,4 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: sourcegraph-frontend - host: $(HOST_DOMAIN) \ No newline at end of file + host: $(HOST_DOMAIN) diff --git a/components/ingress/domain/patches/transformer.yaml b/components/ingress/domain/patches/transformer.yaml deleted file mode 100644 index 4a7b1b66..00000000 --- a/components/ingress/domain/patches/transformer.yaml +++ /dev/null @@ -1,4 +0,0 @@ -varReference: - - kind: Ingress - name: sourcegraph-frontend - path: metadata/host \ No newline at end of file diff --git a/components/ingress/hostname/kustomization.yaml b/components/ingress/hostname/kustomization.yaml index 0e20592f..591a8578 100644 --- a/components/ingress/hostname/kustomization.yaml +++ b/components/ingress/hostname/kustomization.yaml @@ -1,19 +1,16 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component patchesStrategicMerge: -- patches/sourcegraph-frontend.Ingress.yaml -configurations: -- patches/transformer.yaml -configMapGenerator: - - name: sourcegraph-kustomize-env - behavior: merge - literals: - - HOST_DOMAIN=SOURCEGRAPH_OVERLAY_PLACEHOLDER -vars: - - name: HOST_DOMAIN - objref: - apiVersion: v1 - kind: ConfigMap + - patches/frontend.Ingress.yaml +replacements: + - source: + fieldPath: data.HOST_DOMAIN + kind: SourcegraphKustomizeConfig name: sourcegraph-kustomize-env - fieldref: - fieldpath: data.HOST_DOMAIN \ No newline at end of file + version: v1 + targets: + - select: + kind: Ingress + name: sourcegraph-frontend + fieldPaths: + - spec.rules.*.host diff --git a/components/ingress/hostname/patches/sourcegraph-frontend.Ingress.yaml b/components/ingress/hostname/patches/frontend.Ingress.yaml similarity index 100% rename from components/ingress/hostname/patches/sourcegraph-frontend.Ingress.yaml rename to components/ingress/hostname/patches/frontend.Ingress.yaml diff --git a/components/ingress/hostname/patches/transformer.yaml b/components/ingress/hostname/patches/transformer.yaml deleted file mode 100644 index ee9b9d26..00000000 --- a/components/ingress/hostname/patches/transformer.yaml +++ /dev/null @@ -1,4 +0,0 @@ -varReference: - - kind: Ingress - name: sourcegraph-frontend - path: spec/rules/host \ No newline at end of file diff --git a/components/network/tls/kustomization.yaml b/components/network/tls/kustomization.yaml index 97c5190a..e9f0b7e6 100644 --- a/components/network/tls/kustomization.yaml +++ b/components/network/tls/kustomization.yaml @@ -1,35 +1,42 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component patchesStrategicMerge: -- patches/sourcegraph-frontend.Ingress.yaml -configMapGenerator: - - name: sourcegraph-kustomize-env - behavior: merge - literals: - - TLS_HOST=SOURCEGRAPH_OVERLAY_PLACEHOLDER - - TLS_INGRESS_CLASS_NAME=SOURCEGRAPH_OVERLAY_PLACEHOLDER - - TLS_CLUSTER_ISSUER=SOURCEGRAPH_OVERLAY_PLACEHOLDER -configurations: -- patches/transformer.yaml -vars: - - name: TLS_HOST - objref: - apiVersion: v1 - kind: ConfigMap + - patches/frontend.Ingress.yaml +replacements: + - source: + fieldPath: data.TLS_HOST + kind: SourcegraphKustomizeConfig name: sourcegraph-kustomize-env - fieldref: - fieldpath: data.TLS_HOST - - name: TLS_INGRESS_CLASS_NAME - objref: - apiVersion: v1 - kind: ConfigMap + version: v1 + targets: + - select: + kind: Ingress + name: sourcegraph-frontend + fieldPaths: + - spec.tls.*.hosts + - spec.rules.*.host + + - source: + fieldPath: data.TLS_INGRESS_CLASS_NAME + kind: SourcegraphKustomizeConfig name: sourcegraph-kustomize-env - fieldref: - fieldpath: data.TLS_INGRESS_CLASS_NAME - - name: TLS_CLUSTER_ISSUER - objref: - apiVersion: v1 - kind: ConfigMap + version: v1 + targets: + - select: + kind: Ingress + name: sourcegraph-frontend + fieldPaths: + - spec.ingressClassName + - metadata.annotations.[kubernetes.io/ingress.class] + + - source: + fieldPath: data.TLS_CLUSTER_ISSUER + kind: SourcegraphKustomizeConfig name: sourcegraph-kustomize-env - fieldref: - fieldpath: data.TLS_CLUSTER_ISSUER \ No newline at end of file + version: v1 + targets: + - select: + kind: Ingress + name: sourcegraph-frontend + fieldPaths: + - metadata.annotations.[cert-manager.io/cluster-issuer] diff --git a/components/network/tls/patches/sourcegraph-frontend.Ingress.yaml b/components/network/tls/patches/frontend.Ingress.yaml similarity index 100% rename from components/network/tls/patches/sourcegraph-frontend.Ingress.yaml rename to components/network/tls/patches/frontend.Ingress.yaml diff --git a/components/network/tls/patches/transformer.yaml b/components/network/tls/patches/transformer.yaml deleted file mode 100644 index 50974c68..00000000 --- a/components/network/tls/patches/transformer.yaml +++ /dev/null @@ -1,10 +0,0 @@ -varReference: - - kind: Ingress - name: sourcegraph-frontend - path: spec/rules/host - - kind: Ingress - name: sourcegraph-frontend - path: metadata/annotations - - kind: Ingress - name: sourcegraph-frontend - path: spec/ingressClassName \ No newline at end of file diff --git a/components/remove/daemonset/kustomization.yaml b/components/remove/daemonset/kustomization.yaml index 620c41bc..95dec87b 100644 --- a/components/remove/daemonset/kustomization.yaml +++ b/components/remove/daemonset/kustomization.yaml @@ -1,65 +1,15 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesJson6902: - - target: +patches: + - patch: |- + $patch: delete + apiVersion: apps/v1 kind: DaemonSet - name: .* - version: v1 - patch: |- - - op: remove - path: /spec -patchesStrategicMerge: - - |- - $patch: delete - apiVersion: apps/v1 - kind: DaemonSet - metadata: - name: node-exporter - - |- - $patch: delete - apiVersion: apps/v1 - kind: DaemonSet - metadata: - name: otel-agent - - |- - $patch: delete - apiVersion: v1 - kind: Service - metadata: - name: node-exporter - - |- - $patch: delete - apiVersion: v1 - kind: ConfigMap - metadata: - name: otel-agent - - |- - $patch: delete - apiVersion: v1 - kind: ConfigMap - metadata: - name: otel-collector - - |- - $patch: delete - apiVersion: apps/v1 - kind: Deployment - metadata: - name: otel-collector - - |- - $patch: delete - apiVersion: v1 - kind: Service - metadata: - name: otel-collector - # - |- - # $patch: delete - # apiVersion: apps/v1 - # kind: DaemonSet - # metadata: - # name: cadvisor - # - |- - # $patch: delete - # apiVersion: v1 - # kind: ServiceAccount - # metadata: - # name: cadvisor + metadata: + name: node-exporter + - patch: |- + $patch: delete + apiVersion: v1 + kind: Service + metadata: + name: node-exporter diff --git a/components/resources/lower-requests/kustomization.yaml b/components/resources/lower-requests/kustomization.yaml index a53c3783..1ea543e3 100644 --- a/components/resources/lower-requests/kustomization.yaml +++ b/components/resources/lower-requests/kustomization.yaml @@ -1,25 +1,25 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesJson6902: - - target: - kind: Deployment|StatefulSet|DaemonSet - name: .* - version: v1 - patch: |- - - op: replace - path: /spec/template/spec/containers/0/resources/requests/cpu - value: 100m - - op: replace - path: /spec/template/spec/containers/0/resources/requests/memory - value: 250M - - target: - kind: StatefulSet - name: indexed-search - version: v1 - patch: |- - - op: replace - path: /spec/template/spec/containers/1/resources/requests/cpu - value: 100m - - op: replace - path: /spec/template/spec/containers/1/resources/requests/memory - value: 250M \ No newline at end of file +patches: +- patch: |- + - op: replace + path: /spec/template/spec/containers/0/resources/requests/cpu + value: 100m + - op: replace + path: /spec/template/spec/containers/0/resources/requests/memory + value: 250M + target: + kind: Deployment|StatefulSet|DaemonSet + name: .* + version: v1 +- patch: |- + - op: replace + path: /spec/template/spec/containers/1/resources/requests/cpu + value: 100m + - op: replace + path: /spec/template/spec/containers/1/resources/requests/memory + value: 250M + target: + kind: StatefulSet + name: indexed-search + version: v1 diff --git a/components/services/redis/kustomization.yaml b/components/services/redis/kustomization.yaml index e1c29e80..5cf5581e 100644 --- a/components/services/redis/kustomization.yaml +++ b/components/services/redis/kustomization.yaml @@ -1,12 +1,104 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesJson6902: - - target: - kind: StatefulSet|Deployment - name: repo-updater|gitserver|searcher|symbols|worker - group: apps +replacements: + - source: + fieldPath: data.NEW_REDIS_CACHE_ENDPOINT + kind: SourcegraphKustomizeConfig + name: sourcegraph-kustomize-env + version: v1 + targets: + - fieldPaths: + - data.REDIS_CACHE_ENDPOINT + options: + create: true + select: + kind: ConfigMap + name: sourcegraph-frontend-env + - fieldPaths: + - spec.template.spec.containers.0.env.[name=REDIS_CACHE_ENDPOINT].value + select: + kind: StatefulSet + name: gitserver + - fieldPaths: + - spec.template.spec.containers.0.env.[name=REDIS_CACHE_ENDPOINT].value + select: + kind: StatefulSet + name: searcher + - fieldPaths: + - spec.template.spec.containers.0.env.[name=REDIS_CACHE_ENDPOINT].value + select: + kind: StatefulSet + name: symbols + - fieldPaths: + - spec.template.spec.containers.0.env.[name=REDIS_CACHE_ENDPOINT].value + select: + kind: Deployment + name: searcher + - fieldPaths: + - spec.template.spec.containers.0.env.[name=REDIS_CACHE_ENDPOINT].value + select: + kind: Deployment + name: symbols + - fieldPaths: + - spec.template.spec.containers.0.env.[name=REDIS_CACHE_ENDPOINT].value + select: + kind: Deployment + name: repo-updater + - fieldPaths: + - spec.template.spec.containers.0.env.[name=REDIS_CACHE_ENDPOINT].value + select: + kind: Deployment + name: worker + - source: + fieldPath: data.NEW_REDIS_STORE_ENDPOINT + kind: SourcegraphKustomizeConfig + name: sourcegraph-kustomize-env version: v1 - patch: |- + targets: + - fieldPaths: + - data.REDIS_STORE_ENDPOINT + options: + create: true + select: + kind: ConfigMap + name: sourcegraph-frontend-env + - fieldPaths: + - spec.template.spec.containers.0.env.[name=REDIS_STORE_ENDPOINT].value + select: + kind: StatefulSet + name: gitserver + - fieldPaths: + - spec.template.spec.containers.0.env.[name=REDIS_STORE_ENDPOINT].value + select: + kind: StatefulSet + name: searcher + - fieldPaths: + - spec.template.spec.containers.0.env.[name=REDIS_STORE_ENDPOINT].value + select: + kind: StatefulSet + name: symbols + - fieldPaths: + - spec.template.spec.containers.0.env.[name=REDIS_STORE_ENDPOINT].value + select: + kind: Deployment + name: searcher + - fieldPaths: + - spec.template.spec.containers.0.env.[name=REDIS_STORE_ENDPOINT].value + select: + kind: Deployment + name: symbols + - fieldPaths: + - spec.template.spec.containers.0.env.[name=REDIS_STORE_ENDPOINT].value + select: + kind: Deployment + name: repo-updater + - fieldPaths: + - spec.template.spec.containers.0.env.[name=REDIS_STORE_ENDPOINT].value + select: + kind: Deployment + name: worker +patches: + - patch: |- - op: add path: /spec/template/spec/containers/0/env/- value: @@ -17,18 +109,8 @@ patchesJson6902: value: name: REDIS_STORE_ENDPOINT value: $(NEW_REDIS_STORE_ENDPOINT) -vars: - - name: NEW_REDIS_CACHE_ENDPOINT - objref: - apiVersion: v1 - kind: ConfigMap - name: sourcegraph-frontend-env - fieldref: - fieldpath: data.REDIS_CACHE_ENDPOINT - - name: NEW_REDIS_STORE_ENDPOINT - objref: - apiVersion: v1 - kind: ConfigMap - name: sourcegraph-frontend-env - fieldref: - fieldpath: data.REDIS_STORE_ENDPOINT \ No newline at end of file + target: + group: apps + kind: StatefulSet|Deployment + name: repo-updater|gitserver|searcher|symbols|worker + version: v1 diff --git a/components/services/redis/transformer.yaml b/components/services/redis/transformer.yaml deleted file mode 100644 index aca89454..00000000 --- a/components/services/redis/transformer.yaml +++ /dev/null @@ -1,9 +0,0 @@ -varReference: - - kind: StatefulSet - path: /spec/template/spec/containers/0/env/REDIS_CACHE_ENDPOINT - - kind: StatefulSet - path: /spec/template/spec/containers/0/env/REDIS_STORE_ENDPOINT - - kind: Deployment - path: /spec/template/spec/containers/0/env/REDIS_CACHE_ENDPOINT - - kind: Deployment - path: /spec/template/spec/containers/0/env/REDIS_STORE_ENDPOINT \ No newline at end of file diff --git a/components/sizes/xs/kustomization.yaml b/components/sizes/xs/kustomization.yaml index f836b83c..2304300c 100644 --- a/components/sizes/xs/kustomization.yaml +++ b/components/sizes/xs/kustomization.yaml @@ -2,31 +2,195 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component components: - ../../resources/lower-requests -patchesStrategicMerge: - - patches/resources.yaml - - patches/endpoints.yaml # To support searcher and symbols as both statefulset and deployment -patchesJson6902: - - target: +patches: + - path: patches/searcher.yaml + target: + group: apps kind: StatefulSet|Deployment name: searcher - group: apps version: v1 - path: patches/searcher.yaml - - target: + - path: patches/symbols.yaml + target: + group: apps kind: StatefulSet|Deployment name: symbols - group: apps version: v1 - path: patches/symbols.yaml - - target: + - path: patches/databases.yaml + target: + group: apps kind: StatefulSet|Deployment name: pgsql|codeinsights-db|codeintel-db - group: apps version: v1 - path: patches/databases.yaml - - target: + - path: patches/prometheus.yaml + target: kind: ConfigMap name: prometheus version: v1 - path: patches/prometheus.yaml + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: blobstore + spec: + template: + spec: + containers: + - name: blobstore + resources: + limits: + cpu: "1" + memory: 500M + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: github-proxy + spec: + template: + spec: + containers: + - name: github-proxy + resources: + limits: + cpu: "1" + memory: 1G + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: precise-code-intel-worker + spec: + replicas: 1 + template: + spec: + containers: + - name: precise-code-intel-worker + resources: + limits: + cpu: "2" + memory: 4G + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: redis-cache + spec: + template: + spec: + containers: + - name: redis-cache + resources: + limits: + cpu: "1" + memory: 3Gi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: redis-store + spec: + template: + spec: + containers: + - name: redis-store + resources: + limits: + cpu: "1" + memory: 3Gi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: repo-updater + spec: + template: + spec: + containers: + - name: repo-updater + resources: + limits: + cpu: "1" + memory: 2Gi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: sourcegraph-frontend + spec: + replicas: 2 + template: + spec: + containers: + - name: frontend + resources: + limits: + cpu: "4" + memory: 8G + ephemeral-storage: 8Gi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: syntect-server + spec: + replicas: 1 + template: + spec: + containers: + - name: syntect-server + resources: + limits: + cpu: "4" + memory: 6G + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: worker + spec: + replicas: 1 + template: + spec: + containers: + - name: worker + resources: + limits: + cpu: "4" + memory: 4G + - patch: |- + apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: gitserver + spec: + replicas: 1 + template: + spec: + containers: + - name: gitserver + resources: + limits: + cpu: "4" + memory: 8G + - patch: |- + apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: indexed-search + spec: + replicas: 1 + template: + spec: + containers: + - name: zoekt-webserver + resources: + limits: + cpu: "8" + memory: 50G + - name: zoekt-indexserver + resources: + limits: + cpu: "8" + memory: 8G + - path: patches/endpoints.yaml diff --git a/components/sizes/xs/patches/resources.yaml b/components/sizes/xs/patches/resources.yaml deleted file mode 100644 index 50ef7fa8..00000000 --- a/components/sizes/xs/patches/resources.yaml +++ /dev/null @@ -1,165 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: blobstore -spec: - template: - spec: - containers: - - name: blobstore - resources: - limits: - cpu: "1" - memory: 500M ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: github-proxy -spec: - template: - spec: - containers: - - name: github-proxy - resources: - limits: - cpu: "1" - memory: 1G ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: precise-code-intel-worker -spec: - replicas: 1 - template: - spec: - containers: - - name: precise-code-intel-worker - resources: - limits: - cpu: "2" - memory: 4G ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: redis-cache -spec: - template: - spec: - containers: - - name: redis-cache - resources: - limits: - cpu: "1" - memory: 3Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: redis-store -spec: - template: - spec: - containers: - - name: redis-store - resources: - limits: - cpu: "1" - memory: 3Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: repo-updater -spec: - template: - spec: - containers: - - name: repo-updater - resources: - limits: - cpu: "1" - memory: 2Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: sourcegraph-frontend -spec: - replicas: 2 - template: - spec: - containers: - - name: frontend - resources: - limits: - cpu: "4" - memory: 8G - ephemeral-storage: 8Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: syntect-server -spec: - replicas: 1 - template: - spec: - containers: - - name: syntect-server - resources: - limits: - cpu: "4" - memory: 6G ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: worker -spec: - replicas: 1 - template: - spec: - containers: - - name: worker - resources: - limits: - cpu: "4" - memory: 4G ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: gitserver -spec: - replicas: 1 - template: - spec: - containers: - - name: gitserver - resources: - limits: - cpu: "4" - memory: 8G ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: indexed-search -spec: - replicas: 1 - template: - spec: - containers: - - name: zoekt-webserver - resources: - limits: - cpu: "8" - memory: 50G - - name: zoekt-indexserver - resources: - limits: - cpu: "8" - memory: 8G diff --git a/components/storage-class/aws/ebs-csi/kustomization.yaml b/components/storage-class/aws/ebs-csi/kustomization.yaml index 7d4bc5f9..b178f676 100644 --- a/components/storage-class/aws/ebs-csi/kustomization.yaml +++ b/components/storage-class/aws/ebs-csi/kustomization.yaml @@ -1,22 +1,22 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component resources: - - sourcegraph.StorageClass.yaml -patchesJson6902: - - target: - kind: StatefulSet - name: searcher|symbols|indexed-search|grafana|gitserver - group: apps - version: v1 - patch: |- - - op: replace - path: /spec/volumeClaimTemplates/0/spec/storageClassName - value: sourcegraph - - target: - kind: PersistentVolumeClaim - name: .* - version: v1 - patch: |- - - op: replace - path: /spec/storageClassName - value: sourcegraph +- sourcegraph.StorageClass.yaml +patches: +- patch: |- + - op: replace + path: /spec/volumeClaimTemplates/0/spec/storageClassName + value: sourcegraph + target: + group: apps + kind: StatefulSet + name: searcher|symbols|indexed-search|grafana|gitserver + version: v1 +- patch: |- + - op: replace + path: /spec/storageClassName + value: sourcegraph + target: + kind: PersistentVolumeClaim + name: .* + version: v1 diff --git a/components/storage-class/aws/eks-ebs/kustomization.yaml b/components/storage-class/aws/eks-ebs/kustomization.yaml index 7d4bc5f9..b178f676 100644 --- a/components/storage-class/aws/eks-ebs/kustomization.yaml +++ b/components/storage-class/aws/eks-ebs/kustomization.yaml @@ -1,22 +1,22 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component resources: - - sourcegraph.StorageClass.yaml -patchesJson6902: - - target: - kind: StatefulSet - name: searcher|symbols|indexed-search|grafana|gitserver - group: apps - version: v1 - patch: |- - - op: replace - path: /spec/volumeClaimTemplates/0/spec/storageClassName - value: sourcegraph - - target: - kind: PersistentVolumeClaim - name: .* - version: v1 - patch: |- - - op: replace - path: /spec/storageClassName - value: sourcegraph +- sourcegraph.StorageClass.yaml +patches: +- patch: |- + - op: replace + path: /spec/volumeClaimTemplates/0/spec/storageClassName + value: sourcegraph + target: + group: apps + kind: StatefulSet + name: searcher|symbols|indexed-search|grafana|gitserver + version: v1 +- patch: |- + - op: replace + path: /spec/storageClassName + value: sourcegraph + target: + kind: PersistentVolumeClaim + name: .* + version: v1 diff --git a/components/storage-class/azure/kustomization.yaml b/components/storage-class/azure/kustomization.yaml index 7d4bc5f9..b178f676 100644 --- a/components/storage-class/azure/kustomization.yaml +++ b/components/storage-class/azure/kustomization.yaml @@ -1,22 +1,22 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component resources: - - sourcegraph.StorageClass.yaml -patchesJson6902: - - target: - kind: StatefulSet - name: searcher|symbols|indexed-search|grafana|gitserver - group: apps - version: v1 - patch: |- - - op: replace - path: /spec/volumeClaimTemplates/0/spec/storageClassName - value: sourcegraph - - target: - kind: PersistentVolumeClaim - name: .* - version: v1 - patch: |- - - op: replace - path: /spec/storageClassName - value: sourcegraph +- sourcegraph.StorageClass.yaml +patches: +- patch: |- + - op: replace + path: /spec/volumeClaimTemplates/0/spec/storageClassName + value: sourcegraph + target: + group: apps + kind: StatefulSet + name: searcher|symbols|indexed-search|grafana|gitserver + version: v1 +- patch: |- + - op: replace + path: /spec/storageClassName + value: sourcegraph + target: + kind: PersistentVolumeClaim + name: .* + version: v1 diff --git a/components/storage-class/cloud/kustomization.yaml b/components/storage-class/cloud/kustomization.yaml index 4ca71018..7ad42230 100644 --- a/components/storage-class/cloud/kustomization.yaml +++ b/components/storage-class/cloud/kustomization.yaml @@ -2,63 +2,28 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component resources: - patches/sourcegraph.StorageClass.yaml -configMapGenerator: - - name: sourcegraph-kustomize-env - behavior: merge - literals: - - STORAGECLASS_NAME=SOURCEGRAPH_OVERLAY_PLACEHOLDER - - STORAGECLASS_PROVISIONER=SOURCEGRAPH_OVERLAY_PLACEHOLDER - - STORAGECLASS_PARAM_TYPE=SOURCEGRAPH_OVERLAY_PLACEHOLDER -patchesJson6902: - - target: - kind: StatefulSet - name: searcher|symbols|indexed-search|grafana|gitserver - group: apps - version: v1 - patch: |- - - op: replace - path: /spec/volumeClaimTemplates/0/spec/storageClassName - value: sourcegraph - - target: - kind: PersistentVolumeClaim - name: .* - version: v1 - patch: |- - - op: replace - path: /spec/storageClassName - value: sourcegraph - - target: - kind: StatefulSet - name: searcher|symbols|indexed-search|grafana|gitserver - group: apps - version: v1 - path: patches/replace-storageclass-name-sts.yaml - - target: - kind: PersistentVolumeClaim - name: .* - version: v1 - path: patches/replace-storageclass-name-pvc.yaml -configurations: - - patches/storageclass-transformer.yaml -vars: - - name: STORAGECLASS_NAME - objref: - apiVersion: v1 - kind: ConfigMap +components: + - ../name-update +replacements: + - source: + fieldPath: data.STORAGECLASS_PROVISIONER + kind: SourcegraphKustomizeConfig name: sourcegraph-kustomize-env - fieldref: - fieldpath: data.STORAGECLASS_NAME - - name: STORAGECLASS_PROVISIONER - objref: - apiVersion: v1 - kind: ConfigMap - name: sourcegraph-kustomize-env - fieldref: - fieldpath: data.STORAGECLASS_PROVISIONER - - name: STORAGECLASS_PARAM_TYPE - objref: - apiVersion: v1 - kind: ConfigMap + version: v1 + targets: + - select: + kind: StorageClass + name: sourcegraph + fieldPaths: + - provisioner + - source: + fieldPath: data.STORAGECLASS_PARAM_TYPE + kind: SourcegraphKustomizeConfig name: sourcegraph-kustomize-env - fieldref: - fieldpath: data.STORAGECLASS_PARAM_TYPE + version: v1 + targets: + - select: + kind: StorageClass + name: sourcegraph + fieldPaths: + - parameters.type diff --git a/components/storage-class/cloud/patches/storageclass-transformer.yaml b/components/storage-class/cloud/patches/storageclass-transformer.yaml deleted file mode 100644 index 3a998243..00000000 --- a/components/storage-class/cloud/patches/storageclass-transformer.yaml +++ /dev/null @@ -1,10 +0,0 @@ -varReference: - - kind: PersistentVolumeClaim - path: spec/storageClassName - - kind: StatefulSet - group: apps - path: spec/volumeClaimTemplates/spec/storageClassName - - kind: StorageClass - path: provisioner - - kind: StorageClass - path: parameters/type diff --git a/components/storage-class/gcp/kustomization.yaml b/components/storage-class/gcp/kustomization.yaml index 7d4bc5f9..b178f676 100644 --- a/components/storage-class/gcp/kustomization.yaml +++ b/components/storage-class/gcp/kustomization.yaml @@ -1,22 +1,22 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component resources: - - sourcegraph.StorageClass.yaml -patchesJson6902: - - target: - kind: StatefulSet - name: searcher|symbols|indexed-search|grafana|gitserver - group: apps - version: v1 - patch: |- - - op: replace - path: /spec/volumeClaimTemplates/0/spec/storageClassName - value: sourcegraph - - target: - kind: PersistentVolumeClaim - name: .* - version: v1 - patch: |- - - op: replace - path: /spec/storageClassName - value: sourcegraph +- sourcegraph.StorageClass.yaml +patches: +- patch: |- + - op: replace + path: /spec/volumeClaimTemplates/0/spec/storageClassName + value: sourcegraph + target: + group: apps + kind: StatefulSet + name: searcher|symbols|indexed-search|grafana|gitserver + version: v1 +- patch: |- + - op: replace + path: /spec/storageClassName + value: sourcegraph + target: + kind: PersistentVolumeClaim + name: .* + version: v1 diff --git a/components/storage-class/k3s/kustomization.yaml b/components/storage-class/k3s/kustomization.yaml index 59d2b7ad..5c2f9f1e 100644 --- a/components/storage-class/k3s/kustomization.yaml +++ b/components/storage-class/k3s/kustomization.yaml @@ -1,14 +1,14 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesJson6902: - - target: - kind: StatefulSet - name: searcher|symbols|indexed-search|grafana|gitserver - group: apps - version: v1 - path: patches/replace-storageclass-name-sts.yaml - - target: - kind: PersistentVolumeClaim - name: .* - version: v1 - path: patches/replace-storageclass-name-pvc.yaml +patches: +- path: patches/replace-storageclass-name-sts.yaml + target: + group: apps + kind: StatefulSet + name: searcher|symbols|indexed-search|grafana|gitserver + version: v1 +- path: patches/replace-storageclass-name-pvc.yaml + target: + kind: PersistentVolumeClaim + name: .* + version: v1 diff --git a/components/storage-class/minikube/kustomization.yaml b/components/storage-class/minikube/kustomization.yaml index 574c616a..479a8f9f 100644 --- a/components/storage-class/minikube/kustomization.yaml +++ b/components/storage-class/minikube/kustomization.yaml @@ -1,26 +1,26 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component patches: - - target: - kind: StatefulSet - name: searcher|symbols|indexed-search|grafana|gitserver - group: apps - version: v1 - patch: |- + - patch: |- - op: replace path: /spec/volumeClaimTemplates/0/spec/storageClassName # This is the default storage class for minikube value: standard - - target: - kind: PersistentVolumeClaim - patch: |- + target: + group: apps + kind: StatefulSet + name: searcher|symbols|indexed-search|grafana|gitserver + version: v1 + - patch: |- - op: replace path: /spec/storageClassName # This is the default storage class for minikube value: standard - - target: + target: kind: PersistentVolumeClaim - patch: |- - - op: replace + - patch: |- + - op: replace path: /spec/resources/requests/storage value: 10Gi + target: + kind: PersistentVolumeClaim diff --git a/components/storage-class/name-update/kustomization.yaml b/components/storage-class/name-update/kustomization.yaml new file mode 100644 index 00000000..449546b2 --- /dev/null +++ b/components/storage-class/name-update/kustomization.yaml @@ -0,0 +1,15 @@ +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component +patches: + - path: patches/replace-storageclass-name-sts.yaml + target: + group: apps + kind: StatefulSet + name: indexed-search|grafana|gitserver|searcher|symbols + version: v1 + - path: patches/replace-storageclass-name-pvc.yaml + target: + kind: PersistentVolumeClaim + name: .* +replacements: + - path: patches/replacement.yaml diff --git a/components/storage-class/cloud/patches/replace-storageclass-name-pvc.yaml b/components/storage-class/name-update/patches/replace-storageclass-name-pvc.yaml similarity index 100% rename from components/storage-class/cloud/patches/replace-storageclass-name-pvc.yaml rename to components/storage-class/name-update/patches/replace-storageclass-name-pvc.yaml diff --git a/components/storage-class/cloud/patches/replace-storageclass-name-sts.yaml b/components/storage-class/name-update/patches/replace-storageclass-name-sts.yaml similarity index 100% rename from components/storage-class/cloud/patches/replace-storageclass-name-sts.yaml rename to components/storage-class/name-update/patches/replace-storageclass-name-sts.yaml diff --git a/components/storage-class/name-update/patches/replacement.yaml b/components/storage-class/name-update/patches/replacement.yaml new file mode 100644 index 00000000..5a6a53cf --- /dev/null +++ b/components/storage-class/name-update/patches/replacement.yaml @@ -0,0 +1,24 @@ +- source: + fieldPath: data.STORAGECLASS_NAME + kind: SourcegraphKustomizeConfig + name: sourcegraph-kustomize-env + version: v1 + targets: + - select: + kind: PersistentVolumeClaim + fieldPaths: + - spec.storageClassName +- source: + fieldPath: data.STORAGECLASS_NAME + kind: SourcegraphKustomizeConfig + name: sourcegraph-kustomize-env + version: v1 + targets: + - select: + kind: StatefulSet + fieldPaths: + - spec.volumeClaimTemplates.0.spec.storageClassName + reject: + - name: codeinsights-db + - name: codeintel-db + - name: pgsql diff --git a/components/storage-class/sourcegraph/kustomization.yaml b/components/storage-class/sourcegraph/kustomization.yaml index 5c7a1744..911ab7e5 100644 --- a/components/storage-class/sourcegraph/kustomization.yaml +++ b/components/storage-class/sourcegraph/kustomization.yaml @@ -1,20 +1,20 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesJson6902: - - target: +patches: + - patch: |- + - op: replace + path: /spec/volumeClaimTemplates/0/spec/storageClassName + value: sourcegraph + target: + group: apps kind: StatefulSet name: searcher|symbols|indexed-search|grafana|gitserver - group: apps version: v1 - patch: |- + - patch: |- - op: replace - path: /spec/volumeClaimTemplates/0/spec/storageClassName + path: /spec/storageClassName value: sourcegraph - - target: + target: kind: PersistentVolumeClaim name: .* version: v1 - patch: |- - - op: replace - path: /spec/storageClassName - value: sourcegraph diff --git a/components/storage-class/ssd/kustomization.yaml b/components/storage-class/ssd/kustomization.yaml index 2ebb405f..c847c868 100644 --- a/components/storage-class/ssd/kustomization.yaml +++ b/components/storage-class/ssd/kustomization.yaml @@ -1,19 +1,17 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component components: -- pod-tmp-gc -configMapGenerator: - - name: sourcegraph-kustomize-env - behavior: merge - literals: - - SSD_NODE_PATH=SOURCEGRAPH_OVERLAY_PLACEHOLDER -configurations: -- patches/transformer.yaml -vars: - - name: SSD_NODE_PATH - objref: - apiVersion: v1 - kind: ConfigMap + - pod-tmp-gc +replacements: + - source: + fieldPath: data.SSD_NODE_PATH + kind: SourcegraphKustomizeConfig name: sourcegraph-kustomize-env - fieldref: - fieldpath: data.SSD_NODE_PATH + version: v1 + targets: + - select: + kind: DaemonSet + group: apps + name: pod-tmp-gc + fieldPaths: + - spec.template.spec.containers.*.volumeMounts.*.mountPath diff --git a/components/storage-class/ssd/patches/transformer.yaml b/components/storage-class/ssd/patches/transformer.yaml deleted file mode 100644 index 749ef8cc..00000000 --- a/components/storage-class/ssd/patches/transformer.yaml +++ /dev/null @@ -1,4 +0,0 @@ -varReference: - - kind: DaemonSet - group: apps - path: spec/template/spec/containers/volumeMounts/mountPath \ No newline at end of file diff --git a/components/storage-class/ssd/pod-tmp-gc/kustomization.yaml b/components/storage-class/ssd/pod-tmp-gc/kustomization.yaml index f11dcfbe..e1da8d64 100644 --- a/components/storage-class/ssd/pod-tmp-gc/kustomization.yaml +++ b/components/storage-class/ssd/pod-tmp-gc/kustomization.yaml @@ -4,4 +4,4 @@ resources: - pod-tmp-gc.ClusterRole.yaml - pod-tmp-gc.ClusterRoleBinding.yaml - pod-tmp-gc.DaemonSet.yaml - - pod-tmp-gc.ServiceAccount.yaml \ No newline at end of file + - pod-tmp-gc.ServiceAccount.yaml diff --git a/components/storage-class/update-class-name/kustomization.yaml b/components/storage-class/update-class-name/kustomization.yaml deleted file mode 100644 index 85e72467..00000000 --- a/components/storage-class/update-class-name/kustomization.yaml +++ /dev/null @@ -1,29 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1alpha1 -kind: Component -configMapGenerator: - - name: sourcegraph-kustomize-env - behavior: merge - literals: - - STORAGECLASS_NAME=SOURCEGRAPH_OVERLAY_PLACEHOLDER -patchesJson6902: - - target: - kind: StatefulSet - name: indexed-search|grafana|gitserver|searcher|symbols - group: apps - version: v1 - path: patches/replace-storageclass-name-sts.yaml - - target: - kind: PersistentVolumeClaim - name: .* - version: v1 - path: patches/replace-storageclass-name-pvc.yaml -configurations: - - patches/transformer.yaml -vars: - - name: STORAGECLASS_NAME - objref: - apiVersion: v1 - kind: ConfigMap - name: sourcegraph-kustomize-env - fieldref: - fieldpath: data.STORAGECLASS_NAME diff --git a/components/storage-class/update-class-name/patches/.sourcegraph_config.env b/components/storage-class/update-class-name/patches/.sourcegraph_config.env deleted file mode 100644 index 1e2cbf89..00000000 --- a/components/storage-class/update-class-name/patches/.sourcegraph_config.env +++ /dev/null @@ -1 +0,0 @@ -STORAGECLASS_NAME=SOURCEGRAPH_OVERLAY_PLACEHOLDER \ No newline at end of file diff --git a/components/storage-class/update-class-name/patches/replace-storageclass-name-deploy.yaml b/components/storage-class/update-class-name/patches/replace-storageclass-name-deploy.yaml deleted file mode 100644 index 00576aad..00000000 --- a/components/storage-class/update-class-name/patches/replace-storageclass-name-deploy.yaml +++ /dev/null @@ -1,4 +0,0 @@ -- op: replace - path: /spec/template/spec/volumeClaimTemplates/0/spec/storageClassName - # update your storageclass value in overlays/storageclass/.sourcegraph_config.env - value: $(STORAGECLASS_NAME) diff --git a/components/storage-class/update-class-name/patches/replace-storageclass-name-pvc.yaml b/components/storage-class/update-class-name/patches/replace-storageclass-name-pvc.yaml deleted file mode 100644 index c8d78cad..00000000 --- a/components/storage-class/update-class-name/patches/replace-storageclass-name-pvc.yaml +++ /dev/null @@ -1,4 +0,0 @@ -- op: replace - path: /spec/storageClassName - # update your storageclass value in overlays/storageclass/.sourcegraph_config.env - value: $(STORAGECLASS_NAME) diff --git a/components/storage-class/update-class-name/patches/replace-storageclass-name-sts.yaml b/components/storage-class/update-class-name/patches/replace-storageclass-name-sts.yaml deleted file mode 100644 index 8f12cad7..00000000 --- a/components/storage-class/update-class-name/patches/replace-storageclass-name-sts.yaml +++ /dev/null @@ -1,4 +0,0 @@ -- op: replace - path: /spec/volumeClaimTemplates/0/spec/storageClassName - # update your storageclass value in overlays/storageclass/.sourcegraph_config.env - value: $(STORAGECLASS_NAME) diff --git a/components/storage-class/update-class-name/patches/transformer.yaml b/components/storage-class/update-class-name/patches/transformer.yaml deleted file mode 100644 index f4675bf1..00000000 --- a/components/storage-class/update-class-name/patches/transformer.yaml +++ /dev/null @@ -1,9 +0,0 @@ -varReference: - - kind: PersistentVolumeClaim - path: spec/storageClassName - - kind: StatefulSet - group: apps - path: spec/volumeClaimTemplates/spec/storageClassName - - kind: Deployment - group: apps - path: spec/volumeClaimTemplates/spec/storageClassName diff --git a/components/utils/migrate-to-nonprivileged/kustomization.yaml b/components/utils/migrate-to-nonprivileged/kustomization.yaml index 80a9c73c..8b1ccce4 100644 --- a/components/utils/migrate-to-nonprivileged/kustomization.yaml +++ b/components/utils/migrate-to-nonprivileged/kustomization.yaml @@ -1,19 +1,18 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: - - gitserver/gitserver.StatefulSet.yaml - - grafana/grafana.StatefulSet.yaml - - blobstore/blobstore.Deployment.yaml - - indexed-search/indexed-search.StatefulSet.yaml - - prometheus/prometheus.Deployment.yaml - - redis/redis-cache.Deployment.yaml - - redis/redis-store.Deployment.yaml -patchesJson6902: - - target: - kind: StatefulSet|Deployment - name: searcher - group: apps - version: v1 - path: searcher/searcher.Deployment.yaml replacements: - - path: images-update.yaml +- path: images-update.yaml +patches: +- path: searcher/searcher.Deployment.yaml + target: + group: apps + kind: StatefulSet|Deployment + name: searcher + version: v1 +- path: gitserver/gitserver.StatefulSet.yaml +- path: grafana/grafana.StatefulSet.yaml +- path: blobstore/blobstore.Deployment.yaml +- path: indexed-search/indexed-search.StatefulSet.yaml +- path: prometheus/prometheus.Deployment.yaml +- path: redis/redis-cache.Deployment.yaml +- path: redis/redis-store.Deployment.yaml diff --git a/components/utils/migrator/kustomization.yaml b/components/utils/migrator/kustomization.yaml index b090bab7..5fdf9cb2 100644 --- a/components/utils/migrator/kustomization.yaml +++ b/components/utils/migrator/kustomization.yaml @@ -1,5 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component resources: - - resources/migrator.Job.yaml - - resources/sourcegraph-frontend.ConfigMap.yaml +- resources/migrator.Job.yaml +- resources/sourcegraph-frontend.ConfigMap.yaml diff --git a/components/utils/multi-version-upgrade/kustomization.yaml b/components/utils/multi-version-upgrade/kustomization.yaml index 383341e0..5f274677 100644 --- a/components/utils/multi-version-upgrade/kustomization.yaml +++ b/components/utils/multi-version-upgrade/kustomization.yaml @@ -1,21 +1,21 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesJson6902: - - target: - kind: .* - name: .* - group: apps - version: v1 - patch: |- +patches: + - patch: |- - op: replace path: /spec/replicas value: 0 - - target: - kind: Deployment - name: pgsql|codeintel-db|codeinsights-db + target: group: apps + kind: .* + name: .* version: v1 - patch: |- + - patch: |- - op: replace path: /spec/replicas value: 1 + target: + group: apps + kind: Deployment|StatefulSet + name: pgsql|codeintel-db|codeinsights-db + version: v1 diff --git a/components/utils/uid/kustomization.yaml b/components/utils/uid/kustomization.yaml index 245e4104..7d38f729 100644 --- a/components/utils/uid/kustomization.yaml +++ b/components/utils/uid/kustomization.yaml @@ -1,9 +1,9 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesJson6902: - - target: +patches: + - path: patches/databases.yaml + target: + group: apps kind: StatefulSet|Deployment name: codeinsights-db|codeintel-db|pgsql - group: apps version: v1 - path: patches/databases.yaml diff --git a/examples/gke/kustomization.yaml b/examples/gke/kustomization.yaml index ab9bf141..70c4e45f 100644 --- a/examples/gke/kustomization.yaml +++ b/examples/gke/kustomization.yaml @@ -2,11 +2,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization namespace: default resources: - # Sourcegraph Main Stack - ../../base/sourcegraph components: - # Monitoring Stack - ../../components/monitoring - # Use resources for a size-XS instance - ../../components/sizes/xs - ../../components/clusters/gke/configure diff --git a/instances/template/config.template.yaml b/instances/template/config.template.yaml new file mode 100644 index 00000000..56043fa6 --- /dev/null +++ b/instances/template/config.template.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: SourcegraphKustomizeConfig +metadata: + labels: + deploy: sourcegraph-kustomize-configs + name: sourcegraph-kustomize-env +# Update config options below +data: + PRIVATE_REGISTRY: my.private.docker.io + STORAGECLASS_NAME: sourcegraph + STORAGECLASS_PROVISIONER: STORAGECLASS_PROVISIONER_PLACEHOLDER + STORAGECLASS_PARAM_TYPE: STORAGECLASS_PARAM_TYPE_PLACEHOLDER + HOST_DOMAIN: HOST_DOMAIN_PLACEHOLDER + TLS_HOST: TLS_HOST_PLACEHOLDER + TLS_INGRESS_CLASS_NAME: TLS_INGRESS_CLASS_NAME_PLACEHOLDER + TLS_CLUSTER_ISSUER: TLS_CLUSTER_ISSUER_PLACEHOLDER + SSD_NODE_PATH: /mnt/disks/ssd0 + AWS_MANAGED_CERT_ARN: AWS_MANAGED_CERT_ARN_PLACEHOLDER + GKE_MANAGED_CERT_NAME: GKE_MANAGED_CERT_NAME_PLACEHOLDER + NEW_REDIS_CACHE_ENDPOINT: test.redis.cache + NEW_REDIS_STORE_ENDPOINT: test.redis.store diff --git a/instances/template/kustomization.template.yaml b/instances/template/kustomization.template.yaml index 3753e465..462b2b10 100644 --- a/instances/template/kustomization.template.yaml +++ b/instances/template/kustomization.template.yaml @@ -14,6 +14,7 @@ kind: Kustomization # You can add additional resources to the end of this section if needed ########################################################################################## resources: + - config.yaml # [REQUIRED] Resources for the default Sourcegraph instance - ../../base/sourcegraph # -- Resources for Sourcegraph # Add additional resources below this line if needed @@ -31,8 +32,7 @@ namespace: sourcegraph # To configure your Sourcegraph deployment, uncomment the components/section # below following the instructions in our configuration docs. # -# Components with CONFIG KEYS require additional input in [BUILD CONFIGURATIONS] section -# at the bottom of this file +# Components with CONFIG KEYS require additional input in the config.yaml file # # Docs: # https://docs.sourcegraph.com/admin/deploy/kubernetes/kustomize/configure @@ -49,7 +49,7 @@ components: #--------------------------------------------------------------------------------------- # Use size XS resources by default. Include one only. # Find your instance size on https://docs.sourcegraph.com/admin/deploy/instance-size - - ../../components/sizes/xs # -- Allocate resources for size XS instance + # - ../../components/sizes/xs # -- Allocate resources for size XS instance # - ../../components/sizes/s # -- Allocate resources for size S instance # - ../../components/sizes/m # -- Allocate resources for size M instance # - ../../components/sizes/l # -- Allocate resources for size L instance @@ -61,11 +61,13 @@ components: # - ../../components/storage-class/aws # -- Create storage class resources for AWS EKS # - ../../components/storage-class/azure # -- Create storage class resources for Azure AKS # - ../../components/storage-class/gcp # -- Create storage class resources for GCP GKE + # - ../../components/storage-class/cloud # -- Create storage class resources for other cloud provider # - ../../components/storage-class/trident/ext3 # -- Create storage class resources for Trident, fsType ext3 # - ../../components/storage-class/trident/ext4 # -- Create storage class resources for Trident, fsType ext4 # - ../../components/storage-class/trident/xfs # -- Create storage class resources for Trident, fsType xfs # - ../../components/storage-class/k3s # -- Configure to use the default storage class in a k3s cluster # - ../../components/storage-class/sourcegraph # -- Update storageClassName for all resources to 'sourcegraph' + # - ../../components/storage-class/name-update # -- Update storageClassName to $STORAGECLASS_NAME # - ../../components/storage-class/update-class-name # -- Update storageClassName to $STORAGECLASS_NAME # CONFIG KEYS: STORAGECLASS_NAME @@ -88,9 +90,9 @@ components: # Monitoring Stack #--------------------------------------------------------------------------------------- - ../../components/monitoring # -- Add default resources for Sourcegraph monitoring services + # - ../../components/monitoring/otel # -- Deploy OpenTelemetry Collector + # - ../../components/monitoring/tracing # -- Deploy OpenTelemetry Collector with Jaeger as tracing backend # - ../../components/monitoring/cadvisor # -- Add resources for cAdvisor (requires privileges) - # - ../../components/monitoring/otel # -- Add resources for otel - # - ../../components/monitoring/tracing # -- Add resources for otel with Jaeger as tracing backend # - ../../components/monitoring/privileged # -- Run monitoring stack with privileged and root access # - ../../components/remove/daemonset # -- Remove all services with daemonsets: node-exporter & otel # - ../../components/remove/otel-collector # -- Remove otel-collector and otel-agent @@ -106,7 +108,10 @@ components: # - ../../components/ingress/gke # -- Ingress controller settings for GKE with HTTP load balancing enabled # - ../../components/ingress/alb # -- Ingress controller settings for AWS ALB # - ../../components/ingress/k3s # -- Ingress controller settings for K3s - + # - ../../components/clusters/aws/managed-cert # -- Apply settings to frontend ingress for aws managed cert + # - ../../components/clusters/gke/managed-cert # -- Apply settings to frontend ingress for gke managed cert + # - ../../components/ingress/domain # -- Set domain for your Sourcegraph ingress + # CONFIG KEYS: HOST_DOMAIN # - ../../components/ingress/hostname # -- Set hostname for your Sourcegraph ingress # CONFIG KEYS: HOST_DOMAIN @@ -187,33 +192,31 @@ components: # resources using patch files to customize your deployment ########################################################################################## -# patchesStrategicMerge: -# - patches/frontend-ingress.annotations.yaml # Add new annotations to frontend ingress -# - patches/frontend-env-vars.yaml # Update env vars in frontend -# - patches/prometheus.ConfigMap.yaml -# - patches/pgsql.ConfigMap.yaml -# - patches/otel-collector.ConfigMap.yaml -# - patches/custom.NodePort.yaml -# - patches/resources.yaml - -# ------------------------------------------------------------------------ -# Storage Size -# ------------------------------------------------------------------------ -# patchesJson6902: -# - target: -# kind: PersistentVolumeClaim -# name: blobstore|codeinsights-db|codeintel-db|pgsql|prometheus|redis-store|redis-cache -# patch: |- +# patches: +# - patch: patches/frontend-ingress.annotations.yaml +# - patch: patches/frontend-env-vars.yaml +# - patch: patches/prometheus.ConfigMap.yaml +# - patch: patches/pgsql.ConfigMap.yaml +# - patch: patches/otel-collector.ConfigMap.yaml +# - patch: patches/custom.NodePort.yaml +# - patch: patches/resources.yaml +# #--------------------------------------------------------------------------------------- +# # [STORAGE SIZES] +# #--------------------------------------------------------------------------------------- +# - patch: |- # - op: replace # path: /spec/resources/requests/storage # value: 100Gi -# - target: -# kind: StatefulSet -# name: gitserver|indexed-search|searcher|symbols -# patch: |- +# target: +# kind: PersistentVolumeClaim +# name: blobstore|codeinsights-db|codeintel-db|pgsql|prometheus|redis-store|redis-cache +# - patch: |- # - op: replace # path: /spec/volumeClaimTemplates/0/spec/resources/requests/storage # value: 200Gi +# target: +# kind: StatefulSet +# name: gitserver|indexed-search|searcher|symbols ########################################################################################## # [BUILD CONFIGURATIONS] Handles updating configs using env vars for kustomize @@ -224,30 +227,11 @@ components: # configMapGenerator: # # ------------------------------------------------------------------------ -# # BUILD CONFIGURATIONS -# # ------------------------------------------------------------------------ -# - name: sourcegraph-kustomize-env -# behavior: merge -# literals: -# - PRIVATE_REGISTRY=index.docker.io -# - STORAGECLASS_NAME=sourcegraph -# - STORAGECLASS_PROVISIONER= -# - STORAGECLASS_PARAM_TYPE= -# - HOST_DOMAIN= -# - TLS_HOST= -# - TLS_INGRESS_CLASS_NAME= -# - TLS_CLUSTER_ISSUER= -# - SSD_NODE_PATH=/mnt/disks/ssd0 -# - AWS_MANAGED_CERT_ARN= -# - GKE_MANAGED_CERT_NAME= -# - -# - -# - -# - -# # ------------------------------------------------------------------------ # # FRONTEND ENV VARS # # ------------------------------------------------------------------------ # - name: sourcegraph-frontend-env # behavior: merge # literals: # - DEPLOY_TYPE=kustomize # make your edit below this line +# replacements: +# - path: ../../components/storage-class/name-update/replacement.yaml From af1c6e0a4f7d1ac16a6f03a453dd21f76304e68a Mon Sep 17 00:00:00 2001 From: Beatrix Date: Fri, 17 Feb 2023 11:22:39 -0800 Subject: [PATCH 02/13] Replace patchesStrategicMerge and patchesJson6902 with patches --- .../aws/managed-cert/kustomization.yaml | 2 +- .../gke/managed-cert/kustomization.yaml | 2 +- .../disable/rockskip/kustomization.yaml | 26 +- .../service-discovery/kustomization.yaml | 8 +- .../role-binding/kustomization.yaml | 4 +- .../enable/otel-collector/kustomization.yaml | 28 +-- .../private-registry/kustomization.yaml | 31 ++- components/enable/rockskip/kustomization.yaml | 30 +-- .../kustomization.yaml | 6 +- .../service-discovery/kustomization.yaml | 6 +- .../enable/ssh/non-root/kustomization.yaml | 36 +-- components/enable/ssh/root/kustomization.yaml | 36 +-- components/ingress/alb/kustomization.yaml | 4 +- components/ingress/domain/kustomization.yaml | 12 +- components/ingress/gke/kustomization.yaml | 8 +- .../ingress/hostname/kustomization.yaml | 12 +- components/ingress/k3s/kustomization.yaml | 4 +- .../nginx-controller/kustomization.yaml | 6 +- components/monitoring/kustomization.yaml | 2 +- .../monitoring/no-rbacs/kustomization.yaml | 4 +- .../monitoring/non-root/kustomization.yaml | 14 +- .../monitoring/privileged/kustomization.yaml | 22 +- .../monitoring/rbacs/kustomization.yaml | 10 +- .../monitoring/tracing/kustomization.yaml | 5 +- .../network/loadbalancer/kustomization.yaml | 4 +- .../network/network-policy/kustomization.yaml | 4 +- .../network/nodeport/30080/kustomization.yaml | 4 +- .../nodeport/custom/kustomization.yaml | 4 +- .../network/nodeport/kustomization.yaml | 4 - components/network/tls/kustomization.yaml | 35 ++- components/privileged/kustomization.yaml | 43 ++-- .../deployment/kustomization.yaml | 50 ++-- .../statefulset/kustomization.yaml | 38 +-- .../deployment/kustomization.yaml | 50 ++-- .../statefulset/kustomization.yaml | 38 +-- .../remove/default-ingress/kustomization.yaml | 18 +- .../remove/otel-collector/kustomization.yaml | 71 +++--- .../pgsql/deployment/kustomization.yaml | 50 ++-- .../pgsql/statefulset/kustomization.yaml | 38 +-- .../remove/prometheus/kustomization.yaml | 92 ++++--- components/remove/pvcs/kustomization.yaml | 89 ++++--- components/remove/redis/kustomization.yaml | 74 +++--- components/remove/requests/kustomization.yaml | 22 +- .../remove/resources/kustomization.yaml | 16 +- .../searcher-statefulset/kustomization.yaml | 14 +- .../security-context/kustomization.yaml | 32 +-- .../symbols-statefulset/kustomization.yaml | 14 +- .../resources/ci-volume/kustomization.yaml | 16 +- components/services/redis/kustomization.yaml | 4 +- .../searcher/deployment/kustomization.yaml | 6 +- .../searcher/statefulset/kustomization.yaml | 6 +- .../symbols/deployment/kustomization.yaml | 6 +- .../symbols/statefulset/kustomization.yaml | 6 +- components/sizes/l/kustomization.yaml | 229 ++++++++++++++++-- components/sizes/l/patches/resources.yaml | 187 -------------- components/sizes/m/kustomization.yaml | 206 ++++++++++++++-- components/sizes/m/patches/resources.yaml | 165 ------------- components/sizes/s/kustomization.yaml | 206 ++++++++++++++-- components/sizes/s/patches/resources.yaml | 165 ------------- components/sizes/xl/kustomization.yaml | 208 ++++++++++++++-- components/sizes/xl/patches/resources.yaml | 165 ------------- components/sizes/xs/kustomization.yaml | 2 +- .../aws/ebs-csi/kustomization.yaml | 36 +-- .../aws/eks-ebs/kustomization.yaml | 36 +-- .../storage-class/azure/kustomization.yaml | 36 +-- .../storage-class/cloud/kustomization.yaml | 4 +- .../storage-class/gcp/kustomization.yaml | 36 +-- .../storage-class/k3s/kustomization.yaml | 22 +- .../name-update/patches/replacement.yaml | 4 +- .../storage-class/ssd/kustomization.yaml | 10 +- .../trident/ext3/kustomization.yaml | 2 +- .../trident/ext4/kustomization.yaml | 2 +- .../trident/xfs/kustomization.yaml | 2 +- examples/migrator/kustomization.yaml | 16 +- instances/template/config.template.yaml | 21 -- instances/template/config.yaml | 30 +++ 76 files changed, 1472 insertions(+), 1484 deletions(-) delete mode 100644 components/network/nodeport/kustomization.yaml delete mode 100644 components/sizes/l/patches/resources.yaml delete mode 100644 components/sizes/m/patches/resources.yaml delete mode 100644 components/sizes/s/patches/resources.yaml delete mode 100644 components/sizes/xl/patches/resources.yaml delete mode 100644 instances/template/config.template.yaml create mode 100644 instances/template/config.yaml diff --git a/components/clusters/aws/managed-cert/kustomization.yaml b/components/clusters/aws/managed-cert/kustomization.yaml index 55a6663d..abfe0234 100644 --- a/components/clusters/aws/managed-cert/kustomization.yaml +++ b/components/clusters/aws/managed-cert/kustomization.yaml @@ -4,7 +4,7 @@ replacements: - source: fieldPath: data.AWS_MANAGED_CERT_ARN kind: SourcegraphKustomizeConfig - name: sourcegraph-kustomize-env + name: sourcegraph-kustomize-config version: v1 targets: - fieldPaths: diff --git a/components/clusters/gke/managed-cert/kustomization.yaml b/components/clusters/gke/managed-cert/kustomization.yaml index db18fae5..48597f9b 100644 --- a/components/clusters/gke/managed-cert/kustomization.yaml +++ b/components/clusters/gke/managed-cert/kustomization.yaml @@ -4,7 +4,7 @@ replacements: - source: fieldPath: data.GKE_MANAGED_CERT_NAME kind: SourcegraphKustomizeConfig - name: sourcegraph-kustomize-env + name: sourcegraph-kustomize-config version: v1 targets: - fieldPaths: diff --git a/components/disable/rockskip/kustomization.yaml b/components/disable/rockskip/kustomization.yaml index 83b21ce0..3dbb6366 100644 --- a/components/disable/rockskip/kustomization.yaml +++ b/components/disable/rockskip/kustomization.yaml @@ -1,16 +1,16 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: -- |- - apiVersion: apps/v1 - kind: Deployment - metadata: - name: sourcegraph-frontend - spec: - template: +patches: + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: sourcegraph-frontend spec: - containers: - - name: frontend - env: - - name: USE_ROCKSKIP - value: "false" \ No newline at end of file + template: + spec: + containers: + - name: frontend + env: + - name: USE_ROCKSKIP + value: "false" diff --git a/components/disable/service-discovery/kustomization.yaml b/components/disable/service-discovery/kustomization.yaml index 86de6f3a..de00a23e 100644 --- a/components/disable/service-discovery/kustomization.yaml +++ b/components/disable/service-discovery/kustomization.yaml @@ -1,9 +1,9 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: - - patches/sourcegraph-frontend.Role.yaml - - patches/sourcegraph-frontend.ServiceAccount.yaml - - patches/sourcegraph-frontend.Deployment.yaml components: - role-binding - ../../utils/endpoints +patches: + - path: patches/sourcegraph-frontend.Role.yaml + - path: patches/sourcegraph-frontend.ServiceAccount.yaml + - path: patches/sourcegraph-frontend.Deployment.yaml diff --git a/components/disable/service-discovery/role-binding/kustomization.yaml b/components/disable/service-discovery/role-binding/kustomization.yaml index 4278658d..fc723649 100644 --- a/components/disable/service-discovery/role-binding/kustomization.yaml +++ b/components/disable/service-discovery/role-binding/kustomization.yaml @@ -1,4 +1,4 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: -- sourcegraph-frontend.RoleBinding.yaml \ No newline at end of file +patches: + - path: sourcegraph-frontend.RoleBinding.yaml diff --git a/components/enable/otel-collector/kustomization.yaml b/components/enable/otel-collector/kustomization.yaml index 08c1899d..d2007aa9 100644 --- a/components/enable/otel-collector/kustomization.yaml +++ b/components/enable/otel-collector/kustomization.yaml @@ -1,15 +1,11 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component resources: -- ../../../base/monitoring/otel-collector -patchesJson6902: - - target: - kind: StatefulSet|Deployment - name: sourcegraph-frontend|github-proxy|gitserver|indexed-search|precise-code-intel-worker|repo-updater|searcher|symbols|worker - group: apps - version: v1 + - ../../../base/monitoring/otel-collector # OTEL_AGENT_HOST must be defined before OTEL_EXPORTER_OTLP_ENDPOINT to substitute the node IP on which the DaemonSet pod instance runs in the latter variable - patch: |- + # OTEL_AGENT_HOST must be defined before OTEL_EXPORTER_OTLP_ENDPOINT to substitute the node IP on which the DaemonSet pod instance runs in the latter variable +patches: + - patch: |- - op: add path: /spec/template/spec/containers/0/env/- value: @@ -22,13 +18,12 @@ patchesJson6902: value: name: OTEL_EXPORTER_OTLP_ENDPOINT value: http://$(OTEL_AGENT_HOST):4317 - - target: - kind: StatefulSet - name: indexed-search + target: group: apps + kind: StatefulSet|Deployment + name: sourcegraph-frontend|github-proxy|gitserver|indexed-search|precise-code-intel-worker|repo-updater|searcher|symbols|worker version: v1 - # OTEL_AGENT_HOST must be defined before OTEL_EXPORTER_OTLP_ENDPOINT to substitute the node IP on which the DaemonSet pod instance runs in the latter variable - patch: |- + - patch: |- - op: add path: /spec/template/spec/containers/1/env/- value: @@ -40,4 +35,9 @@ patchesJson6902: path: /spec/template/spec/containers/0/env/- value: name: OTEL_EXPORTER_OTLP_ENDPOINT - value: http://$(OTEL_AGENT_HOST):4317 \ No newline at end of file + value: http://$(OTEL_AGENT_HOST):4317 + target: + group: apps + kind: StatefulSet + name: indexed-search + version: v1 diff --git a/components/enable/private-registry/kustomization.yaml b/components/enable/private-registry/kustomization.yaml index 52b28eb8..0d41853a 100644 --- a/components/enable/private-registry/kustomization.yaml +++ b/components/enable/private-registry/kustomization.yaml @@ -4,33 +4,30 @@ replacements: - source: fieldPath: data.PRIVATE_REGISTRY kind: SourcegraphKustomizeConfig - name: sourcegraph-kustomize-env + name: sourcegraph-kustomize-config version: v1 targets: - - select: - kind: Deployment - group: apps - fieldPaths: + - fieldPaths: - spec.template.spec.containers.*.image - spec.template.spec.initContainers.*.image options: - delimiter: "/sourcegraph" - index: 0 - - select: - kind: StatefulSet + delimiter: /sourcegraph + select: group: apps - fieldPaths: + kind: Deployment + - fieldPaths: - spec.template.spec.containers.*.image - spec.template.spec.initContainers.*.image options: - delimiter: "/sourcegraph" - index: 0 - - select: - kind: DaemonSet + delimiter: /sourcegraph + select: group: apps - fieldPaths: + kind: StatefulSet + - fieldPaths: - spec.template.spec.containers.*.image - spec.template.spec.initContainers.*.image options: - delimiter: "/sourcegraph" - index: 0 + delimiter: /sourcegraph + select: + group: apps + kind: DaemonSet diff --git a/components/enable/rockskip/kustomization.yaml b/components/enable/rockskip/kustomization.yaml index 86ac0716..da20e373 100644 --- a/components/enable/rockskip/kustomization.yaml +++ b/components/enable/rockskip/kustomization.yaml @@ -1,18 +1,18 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: -- |- - apiVersion: apps/v1 - kind: Deployment - metadata: - name: sourcegraph-frontend - spec: - template: +patches: + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: sourcegraph-frontend spec: - containers: - - name: frontend - env: - - name: ROCKSKIP_MIN_REPO_SIZE_MB - value: "1000" - - name: USE_ROCKSKIP - value: "true" \ No newline at end of file + template: + spec: + containers: + - name: frontend + env: + - name: ROCKSKIP_MIN_REPO_SIZE_MB + value: "1000" + - name: USE_ROCKSKIP + value: "true" diff --git a/components/enable/service-discovery-default/kustomization.yaml b/components/enable/service-discovery-default/kustomization.yaml index a3c12dc4..2bc21260 100644 --- a/components/enable/service-discovery-default/kustomization.yaml +++ b/components/enable/service-discovery-default/kustomization.yaml @@ -1,5 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: - - patches/sourcegraph-frontend.Deployment.yaml - - patches/sourcegraph-frontend.ConfigMap.yaml +patches: + - path: patches/sourcegraph-frontend.Deployment.yaml + - path: patches/sourcegraph-frontend.ConfigMap.yaml diff --git a/components/enable/service-discovery/kustomization.yaml b/components/enable/service-discovery/kustomization.yaml index 20acffa5..0b2df4d0 100644 --- a/components/enable/service-discovery/kustomization.yaml +++ b/components/enable/service-discovery/kustomization.yaml @@ -4,6 +4,6 @@ resources: - rbac/sourcegraph-frontend.Role.yaml - rbac/sourcegraph-frontend.RoleBinding.yaml - rbac/sourcegraph-frontend.ServiceAccount.yaml -patchesStrategicMerge: - - patches/sourcegraph-frontend.Deployment.yaml - - patches/sourcegraph-frontend.ConfigMap.yaml +patches: + - path: patches/sourcegraph-frontend.Deployment.yaml + - path: patches/sourcegraph-frontend.ConfigMap.yaml diff --git a/components/enable/ssh/non-root/kustomization.yaml b/components/enable/ssh/non-root/kustomization.yaml index 8e344a7a..0c061890 100644 --- a/components/enable/ssh/non-root/kustomization.yaml +++ b/components/enable/ssh/non-root/kustomization.yaml @@ -1,21 +1,21 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: -- |- - apiVersion: apps/v1 - kind: StatefulSet - metadata: - name: gitserver - spec: - template: +patches: + - patch: |- + apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: gitserver spec: - containers: - - name: gitserver - volumeMounts: - - mountPath: /home/sourcegraph/.ssh - name: ssh - volumes: - - name: ssh - secret: - defaultMode: 0644 - secretName: gitserver-ssh + template: + spec: + containers: + - name: gitserver + volumeMounts: + - mountPath: /home/sourcegraph/.ssh + name: ssh + volumes: + - name: ssh + secret: + defaultMode: 0644 + secretName: gitserver-ssh diff --git a/components/enable/ssh/root/kustomization.yaml b/components/enable/ssh/root/kustomization.yaml index 15ff49f4..18f70503 100644 --- a/components/enable/ssh/root/kustomization.yaml +++ b/components/enable/ssh/root/kustomization.yaml @@ -1,21 +1,21 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: -- |- - apiVersion: apps/v1 - kind: StatefulSet - metadata: - name: gitserver - spec: - template: +patches: + - patch: |- + apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: gitserver spec: - containers: - - name: gitserver - volumeMounts: - - mountPath: /root/.ssh - name: ssh - volumes: - - name: ssh - secret: - defaultMode: 0644 - secretName: gitserver-ssh + template: + spec: + containers: + - name: gitserver + volumeMounts: + - mountPath: /root/.ssh + name: ssh + volumes: + - name: ssh + secret: + defaultMode: 0644 + secretName: gitserver-ssh diff --git a/components/ingress/alb/kustomization.yaml b/components/ingress/alb/kustomization.yaml index 5ca9a8b2..1ff6e853 100644 --- a/components/ingress/alb/kustomization.yaml +++ b/components/ingress/alb/kustomization.yaml @@ -1,4 +1,4 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: - - patches/frontend.Ingress.yaml +patches: + - path: patches/frontend.Ingress.yaml diff --git a/components/ingress/domain/kustomization.yaml b/components/ingress/domain/kustomization.yaml index bd0250bb..b54e742a 100644 --- a/components/ingress/domain/kustomization.yaml +++ b/components/ingress/domain/kustomization.yaml @@ -1,16 +1,16 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: - - patches/frontend.Ingress.yaml replacements: - source: fieldPath: data.HOST_DOMAIN kind: SourcegraphKustomizeConfig - name: sourcegraph-kustomize-env + name: sourcegraph-kustomize-config version: v1 targets: - - select: + - fieldPaths: + - metadata.host + select: kind: Ingress name: sourcegraph-frontend - fieldPaths: - - metadata.host +patches: + - path: patches/frontend.Ingress.yaml diff --git a/components/ingress/gke/kustomization.yaml b/components/ingress/gke/kustomization.yaml index 5372bba8..bcddd8fb 100644 --- a/components/ingress/gke/kustomization.yaml +++ b/components/ingress/gke/kustomization.yaml @@ -2,7 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component resources: - patches/frontend.BackendConfig.yaml -patchesStrategicMerge: - - patches/frontend.Service.yaml - - patches/frontend-internal.Service.yaml - - patches/frontend.Ingress.yaml +patches: + - path: patches/frontend.Service.yaml + - path: patches/frontend-internal.Service.yaml + - path: patches/frontend.Ingress.yaml diff --git a/components/ingress/hostname/kustomization.yaml b/components/ingress/hostname/kustomization.yaml index 591a8578..5aaf2f3c 100644 --- a/components/ingress/hostname/kustomization.yaml +++ b/components/ingress/hostname/kustomization.yaml @@ -1,16 +1,16 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: - - patches/frontend.Ingress.yaml replacements: - source: fieldPath: data.HOST_DOMAIN kind: SourcegraphKustomizeConfig - name: sourcegraph-kustomize-env + name: sourcegraph-kustomize-config version: v1 targets: - - select: + - fieldPaths: + - spec.rules.*.host + select: kind: Ingress name: sourcegraph-frontend - fieldPaths: - - spec.rules.*.host +patches: + - path: patches/frontend.Ingress.yaml diff --git a/components/ingress/k3s/kustomization.yaml b/components/ingress/k3s/kustomization.yaml index 94bca1b7..5e802783 100644 --- a/components/ingress/k3s/kustomization.yaml +++ b/components/ingress/k3s/kustomization.yaml @@ -1,4 +1,4 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: - - patches/sourcegraph-frontend.Ingress.yaml +patches: + - path: patches/sourcegraph-frontend.Ingress.yaml diff --git a/components/ingress/nginx-controller/kustomization.yaml b/components/ingress/nginx-controller/kustomization.yaml index 3432067e..9e386934 100644 --- a/components/ingress/nginx-controller/kustomization.yaml +++ b/components/ingress/nginx-controller/kustomization.yaml @@ -1,5 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: -- patches/ingress-nginx.Deployment.yaml -- patches/ingress-nginx.Service.yaml \ No newline at end of file +patches: + - path: patches/ingress-nginx.Deployment.yaml + - path: patches/ingress-nginx.Service.yaml diff --git a/components/monitoring/kustomization.yaml b/components/monitoring/kustomization.yaml index 39ceec39..b7c91e5a 100644 --- a/components/monitoring/kustomization.yaml +++ b/components/monitoring/kustomization.yaml @@ -1,4 +1,4 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component resources: -- ../../base/monitoring + - ../../base/monitoring diff --git a/components/monitoring/no-rbacs/kustomization.yaml b/components/monitoring/no-rbacs/kustomization.yaml index dcb17b26..cbe7f69d 100644 --- a/components/monitoring/no-rbacs/kustomization.yaml +++ b/components/monitoring/no-rbacs/kustomization.yaml @@ -5,5 +5,5 @@ resources: components: - ../../remove/daemonset - ../../remove/prometheus -patchesStrategicMerge: - - patches/grafana/grafana.StatefulSet.yaml +patches: + - path: patches/grafana/grafana.StatefulSet.yaml diff --git a/components/monitoring/non-root/kustomization.yaml b/components/monitoring/non-root/kustomization.yaml index 17ef01af..3c615ecc 100644 --- a/components/monitoring/non-root/kustomization.yaml +++ b/components/monitoring/non-root/kustomization.yaml @@ -1,11 +1,11 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component resources: -- ../../../base/monitoring -- patches/prometheus/prometheus.RoleBinding.yaml + - ../../../base/monitoring + - patches/prometheus/prometheus.RoleBinding.yaml components: -- ../../remove/daemonset -patchesStrategicMerge: -- patches/grafana/grafana.StatefulSet.yaml -- patches/prometheus/prometheus.ConfigMap.yaml -- patches/prometheus/prometheus.Deployment.yaml + - ../../remove/daemonset +patches: + - path: patches/grafana/grafana.StatefulSet.yaml + - path: patches/prometheus/prometheus.ConfigMap.yaml + - path: patches/prometheus/prometheus.Deployment.yaml diff --git a/components/monitoring/privileged/kustomization.yaml b/components/monitoring/privileged/kustomization.yaml index 9948622f..c5908d68 100644 --- a/components/monitoring/privileged/kustomization.yaml +++ b/components/monitoring/privileged/kustomization.yaml @@ -4,24 +4,24 @@ kind: Component components: - ../rbacs # Remove security context -patchesJson6902: - - target: - kind: StatefulSet|Deployment - name: grafana|prometheus|otel-collector - group: apps - version: v1 - patch: |- +patches: + - patch: |- - op: replace path: /spec/template/spec/securityContext value: runAsUser: 0 - op: remove path: /spec/template/spec/containers/0/securityContext - - target: - kind: DaemonSet - name: otel-agent + target: group: apps + kind: StatefulSet|Deployment + name: grafana|prometheus|otel-collector version: v1 - patch: |- + - patch: |- - op: remove path: /spec/template/spec/containers/0/securityContext + target: + group: apps + kind: DaemonSet + name: otel-agent + version: v1 diff --git a/components/monitoring/rbacs/kustomization.yaml b/components/monitoring/rbacs/kustomization.yaml index 18bd6d6c..7b55c07d 100644 --- a/components/monitoring/rbacs/kustomization.yaml +++ b/components/monitoring/rbacs/kustomization.yaml @@ -5,8 +5,8 @@ resources: - prometheus/prometheus.ClusterRole.yaml - prometheus/prometheus.ClusterRoleBinding.yaml - prometheus/prometheus.ServiceAccount.yaml -patchesStrategicMerge: - - prometheus/prometheus.ConfigMap.yaml - - grafana/grafana.StatefulSet.yaml - - prometheus/prometheus.Deployment.yaml - - grafana/grafana.Dashboards.ConfigMap.yaml +patches: + - path: prometheus/prometheus.ConfigMap.yaml + - path: grafana/grafana.StatefulSet.yaml + - path: prometheus/prometheus.Deployment.yaml + - path: grafana/grafana.Dashboards.ConfigMap.yaml diff --git a/components/monitoring/tracing/kustomization.yaml b/components/monitoring/tracing/kustomization.yaml index 6883cf80..59a7a23e 100644 --- a/components/monitoring/tracing/kustomization.yaml +++ b/components/monitoring/tracing/kustomization.yaml @@ -3,9 +3,6 @@ kind: Component resources: - ../../../base/monitoring/otel-collector - ../../../base/monitoring/jaeger -patchesStrategicMerge: - - patches/otel-collector.Deployment.yaml - - patches/grafana.ConfigMap.yaml patches: - patch: |- - op: add @@ -16,3 +13,5 @@ patches: target: kind: Deployment name: sourcegraph-frontend + - path: patches/otel-collector.Deployment.yaml + - path: patches/grafana.ConfigMap.yaml diff --git a/components/network/loadbalancer/kustomization.yaml b/components/network/loadbalancer/kustomization.yaml index bbff53d7..9640dcf1 100644 --- a/components/network/loadbalancer/kustomization.yaml +++ b/components/network/loadbalancer/kustomization.yaml @@ -1,4 +1,4 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: - - patches/sourcegraph-frontend.Service.yaml +patches: + - path: patches/sourcegraph-frontend.Service.yaml diff --git a/components/network/network-policy/kustomization.yaml b/components/network/network-policy/kustomization.yaml index 3b87d1f8..e857a5c9 100644 --- a/components/network/network-policy/kustomization.yaml +++ b/components/network/network-policy/kustomization.yaml @@ -1,5 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component resources: -- patches/sourcegraph.Namespace.yaml -- patches/sourcegraph.NetworkPolicy.yaml \ No newline at end of file + - patches/sourcegraph.Namespace.yaml + - patches/sourcegraph.NetworkPolicy.yaml diff --git a/components/network/nodeport/30080/kustomization.yaml b/components/network/nodeport/30080/kustomization.yaml index 81a394c8..e9d2a6d6 100644 --- a/components/network/nodeport/30080/kustomization.yaml +++ b/components/network/nodeport/30080/kustomization.yaml @@ -1,4 +1,4 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: -- patches/30080.yaml \ No newline at end of file +patches: + - path: patches/30080.yaml diff --git a/components/network/nodeport/custom/kustomization.yaml b/components/network/nodeport/custom/kustomization.yaml index c7871181..de5e2ce8 100644 --- a/components/network/nodeport/custom/kustomization.yaml +++ b/components/network/nodeport/custom/kustomization.yaml @@ -1,4 +1,4 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: -- patches/custom.NodePort.yaml \ No newline at end of file +patches: + - path: patches/custom.NodePort.yaml diff --git a/components/network/nodeport/kustomization.yaml b/components/network/nodeport/kustomization.yaml deleted file mode 100644 index 81a394c8..00000000 --- a/components/network/nodeport/kustomization.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1alpha1 -kind: Component -patchesStrategicMerge: -- patches/30080.yaml \ No newline at end of file diff --git a/components/network/tls/kustomization.yaml b/components/network/tls/kustomization.yaml index e9f0b7e6..692f98bc 100644 --- a/components/network/tls/kustomization.yaml +++ b/components/network/tls/kustomization.yaml @@ -1,42 +1,41 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: - - patches/frontend.Ingress.yaml + replacements: - source: fieldPath: data.TLS_HOST kind: SourcegraphKustomizeConfig - name: sourcegraph-kustomize-env + name: sourcegraph-kustomize-config version: v1 targets: - - select: - kind: Ingress - name: sourcegraph-frontend - fieldPaths: + - fieldPaths: - spec.tls.*.hosts - spec.rules.*.host - + select: + kind: Ingress + name: sourcegraph-frontend - source: fieldPath: data.TLS_INGRESS_CLASS_NAME kind: SourcegraphKustomizeConfig - name: sourcegraph-kustomize-env + name: sourcegraph-kustomize-config version: v1 targets: - - select: - kind: Ingress - name: sourcegraph-frontend - fieldPaths: + - fieldPaths: - spec.ingressClassName - metadata.annotations.[kubernetes.io/ingress.class] - + select: + kind: Ingress + name: sourcegraph-frontend - source: fieldPath: data.TLS_CLUSTER_ISSUER kind: SourcegraphKustomizeConfig - name: sourcegraph-kustomize-env + name: sourcegraph-kustomize-config version: v1 targets: - - select: + - fieldPaths: + - metadata.annotations.[cert-manager.io/cluster-issuer] + select: kind: Ingress name: sourcegraph-frontend - fieldPaths: - - metadata.annotations.[cert-manager.io/cluster-issuer] +patches: + - path: patches/frontend.Ingress.yaml diff --git a/components/privileged/kustomization.yaml b/components/privileged/kustomization.yaml index 5c4f3a17..7c8d1160 100644 --- a/components/privileged/kustomization.yaml +++ b/components/privileged/kustomization.yaml @@ -1,34 +1,33 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: - - patches/blobstore/blobstore.Deployment.yaml - - patches/frontend/sourcegraph-frontend.Deployment.yaml - - patches/github-proxy/github-proxy.Deployment.yaml - - patches/gitserver/gitserver.StatefulSet.yaml - - patches/indexed-search/indexed-search.StatefulSet.yaml - - patches/precise-code-intel/worker.Deployment.yaml - - patches/redis/redis-cache.Deployment.yaml - - patches/redis/redis-store.Deployment.yaml - - patches/repo-updater/repo-updater.Deployment.yaml - - patches/syntect-server/syntect-server.Deployment.yaml - - patches/worker/worker.Deployment.yaml # To support searcher and symbols as both statefulset and deployment -patchesJson6902: - - target: +patches: + - path: patches/searcher/searcher.yaml + target: + group: apps kind: StatefulSet|Deployment name: searcher - group: apps version: v1 - path: patches/searcher/searcher.yaml - - target: + - path: patches/symbols/symbols.yaml + target: + group: apps kind: StatefulSet|Deployment name: symbols - group: apps version: v1 - path: patches/symbols/symbols.yaml - - target: + - path: patches/databases/securityContext.yaml + target: + group: apps kind: StatefulSet|Deployment name: codeinsights-db|codeintel-db|pgsql - group: apps version: v1 - path: patches/databases/securityContext.yaml + - path: patches/blobstore/blobstore.Deployment.yaml + - path: patches/frontend/sourcegraph-frontend.Deployment.yaml + - path: patches/github-proxy/github-proxy.Deployment.yaml + - path: patches/gitserver/gitserver.StatefulSet.yaml + - path: patches/indexed-search/indexed-search.StatefulSet.yaml + - path: patches/precise-code-intel/worker.Deployment.yaml + - path: patches/redis/redis-cache.Deployment.yaml + - path: patches/redis/redis-store.Deployment.yaml + - path: patches/repo-updater/repo-updater.Deployment.yaml + - path: patches/syntect-server/syntect-server.Deployment.yaml + - path: patches/worker/worker.Deployment.yaml diff --git a/components/remove/codeinsights-db/deployment/kustomization.yaml b/components/remove/codeinsights-db/deployment/kustomization.yaml index f570b2bf..a5d96c40 100644 --- a/components/remove/codeinsights-db/deployment/kustomization.yaml +++ b/components/remove/codeinsights-db/deployment/kustomization.yaml @@ -1,27 +1,27 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: - - |- - $patch: delete - apiVersion: v1 - kind: ConfigMap - metadata: - name: codeinsights-db-conf - - |- - $patch: delete - apiVersion: apps/v1 - kind: Deployment - metadata: - name: codeinsights-db - - |- - $patch: delete - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - name: codeinsights-db - - |- - $patch: delete - apiVersion: v1 - kind: Service - metadata: - name: codeinsights-db +patches: + - patch: |- + $patch: delete + apiVersion: v1 + kind: ConfigMap + metadata: + name: codeinsights-db-conf + - patch: |- + $patch: delete + apiVersion: apps/v1 + kind: Deployment + metadata: + name: codeinsights-db + - patch: |- + $patch: delete + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: codeinsights-db + - patch: |- + $patch: delete + apiVersion: v1 + kind: Service + metadata: + name: codeinsights-db diff --git a/components/remove/codeinsights-db/statefulset/kustomization.yaml b/components/remove/codeinsights-db/statefulset/kustomization.yaml index 1f0f42e8..8b2eb960 100644 --- a/components/remove/codeinsights-db/statefulset/kustomization.yaml +++ b/components/remove/codeinsights-db/statefulset/kustomization.yaml @@ -1,21 +1,21 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: - - |- - $patch: delete - apiVersion: v1 - kind: ConfigMap - metadata: - name: codeinsights-db-conf - - |- - $patch: delete - apiVersion: apps/v1 - kind: StatefulSet - metadata: - name: codeinsights-db - - |- - $patch: delete - apiVersion: v1 - kind: Service - metadata: - name: codeinsights-db +patches: + - patch: |- + $patch: delete + apiVersion: v1 + kind: ConfigMap + metadata: + name: codeinsights-db-conf + - patch: |- + $patch: delete + apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: codeinsights-db + - patch: |- + $patch: delete + apiVersion: v1 + kind: Service + metadata: + name: codeinsights-db diff --git a/components/remove/codeintel-db/deployment/kustomization.yaml b/components/remove/codeintel-db/deployment/kustomization.yaml index f26ca772..32de200d 100644 --- a/components/remove/codeintel-db/deployment/kustomization.yaml +++ b/components/remove/codeintel-db/deployment/kustomization.yaml @@ -1,27 +1,27 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: - - |- - $patch: delete - apiVersion: v1 - kind: ConfigMap - metadata: - name: codeintel-db-conf - - |- - $patch: delete - apiVersion: apps/v1 - kind: Deployment - metadata: - name: codeintel-db - - |- - $patch: delete - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - name: codeintel-db - - |- - $patch: delete - apiVersion: v1 - kind: Service - metadata: - name: codeintel-db +patches: + - patch: |- + $patch: delete + apiVersion: v1 + kind: ConfigMap + metadata: + name: codeintel-db-conf + - patch: |- + $patch: delete + apiVersion: apps/v1 + kind: Deployment + metadata: + name: codeintel-db + - patch: |- + $patch: delete + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: codeintel-db + - patch: |- + $patch: delete + apiVersion: v1 + kind: Service + metadata: + name: codeintel-db diff --git a/components/remove/codeintel-db/statefulset/kustomization.yaml b/components/remove/codeintel-db/statefulset/kustomization.yaml index bf8ce68c..0137ed42 100644 --- a/components/remove/codeintel-db/statefulset/kustomization.yaml +++ b/components/remove/codeintel-db/statefulset/kustomization.yaml @@ -1,21 +1,21 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: - - |- - $patch: delete - apiVersion: v1 - kind: ConfigMap - metadata: - name: codeintel-db-conf - - |- - $patch: delete - apiVersion: apps/v1 - kind: StatefulSet - metadata: - name: codeintel-db - - |- - $patch: delete - apiVersion: v1 - kind: Service - metadata: - name: codeintel-db +patches: + - patch: |- + $patch: delete + apiVersion: v1 + kind: ConfigMap + metadata: + name: codeintel-db-conf + - patch: |- + $patch: delete + apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: codeintel-db + - patch: |- + $patch: delete + apiVersion: v1 + kind: Service + metadata: + name: codeintel-db diff --git a/components/remove/default-ingress/kustomization.yaml b/components/remove/default-ingress/kustomization.yaml index 2529039f..b91a5ded 100644 --- a/components/remove/default-ingress/kustomization.yaml +++ b/components/remove/default-ingress/kustomization.yaml @@ -1,11 +1,11 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: -- |- - $patch: delete - apiVersion: networking.k8s.io/v1 - kind: Ingress - metadata: - labels: - app: sourcegraph-frontend - name: sourcegraph-frontend \ No newline at end of file +patches: + - patch: |- + $patch: delete + apiVersion: networking.k8s.io/v1 + kind: Ingress + metadata: + labels: + app: sourcegraph-frontend + name: sourcegraph-frontend diff --git a/components/remove/otel-collector/kustomization.yaml b/components/remove/otel-collector/kustomization.yaml index 4b904b79..00fed6f3 100644 --- a/components/remove/otel-collector/kustomization.yaml +++ b/components/remove/otel-collector/kustomization.yaml @@ -1,41 +1,40 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesJson6902: - - target: +patches: + - patch: |- + - op: remove + path: /spec + target: kind: .* name: otel-collector|otel-agent version: v1 - patch: |- - - op: remove - path: /spec -patchesStrategicMerge: -- |- - $patch: delete - apiVersion: v1 - kind: ConfigMap - metadata: - name: otel-agent -- |- - $patch: delete - apiVersion: apps/v1 - kind: DaemonSet - metadata: - name: otel-agent -- |- - $patch: delete - apiVersion: v1 - kind: ConfigMap - metadata: - name: otel-collector -- |- - $patch: delete - apiVersion: apps/v1 - kind: Deployment - metadata: - name: otel-collector -- |- - $patch: delete - apiVersion: v1 - kind: Service - metadata: - name: otel-collector + - patch: |- + $patch: delete + apiVersion: v1 + kind: ConfigMap + metadata: + name: otel-agent + - patch: |- + $patch: delete + apiVersion: apps/v1 + kind: DaemonSet + metadata: + name: otel-agent + - patch: |- + $patch: delete + apiVersion: v1 + kind: ConfigMap + metadata: + name: otel-collector + - patch: |- + $patch: delete + apiVersion: apps/v1 + kind: Deployment + metadata: + name: otel-collector + - patch: |- + $patch: delete + apiVersion: v1 + kind: Service + metadata: + name: otel-collector diff --git a/components/remove/pgsql/deployment/kustomization.yaml b/components/remove/pgsql/deployment/kustomization.yaml index ef077d9b..358e1313 100644 --- a/components/remove/pgsql/deployment/kustomization.yaml +++ b/components/remove/pgsql/deployment/kustomization.yaml @@ -1,27 +1,27 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: - - |- - $patch: delete - apiVersion: v1 - kind: ConfigMap - metadata: - name: pgsql-conf - - |- - $patch: delete - apiVersion: apps/v1 - kind: Deployment - metadata: - name: pgsql - - |- - $patch: delete - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - name: pgsql - - |- - $patch: delete - apiVersion: v1 - kind: Service - metadata: - name: pgsql +patches: + - patch: |- + $patch: delete + apiVersion: v1 + kind: ConfigMap + metadata: + name: pgsql-conf + - patch: |- + $patch: delete + apiVersion: apps/v1 + kind: Deployment + metadata: + name: pgsql + - patch: |- + $patch: delete + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: pgsql + - patch: |- + $patch: delete + apiVersion: v1 + kind: Service + metadata: + name: pgsql diff --git a/components/remove/pgsql/statefulset/kustomization.yaml b/components/remove/pgsql/statefulset/kustomization.yaml index efb8ba77..db2adfeb 100644 --- a/components/remove/pgsql/statefulset/kustomization.yaml +++ b/components/remove/pgsql/statefulset/kustomization.yaml @@ -1,21 +1,21 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: - - |- - $patch: delete - apiVersion: v1 - kind: ConfigMap - metadata: - name: pgsql-conf - - |- - $patch: delete - apiVersion: apps/v1 - kind: StatefulSet - metadata: - name: pgsql - - |- - $patch: delete - apiVersion: v1 - kind: Service - metadata: - name: pgsql +patches: + - patch: |- + $patch: delete + apiVersion: v1 + kind: ConfigMap + metadata: + name: pgsql-conf + - patch: |- + $patch: delete + apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: pgsql + - patch: |- + $patch: delete + apiVersion: v1 + kind: Service + metadata: + name: pgsql diff --git a/components/remove/prometheus/kustomization.yaml b/components/remove/prometheus/kustomization.yaml index b3d570b0..cafbc7b0 100644 --- a/components/remove/prometheus/kustomization.yaml +++ b/components/remove/prometheus/kustomization.yaml @@ -1,51 +1,45 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: -- |- - $patch: delete - apiVersion: rbac.authorization.k8s.io/v1 - kind: ClusterRole - metadata: - name: prometheus -- |- - $patch: delete - apiVersion: v1 - kind: ServiceAccount - metadata: - name: prometheus -- |- - $patch: delete - apiVersion: rbac.authorization.k8s.io/v1 - kind: ClusterRoleBinding - metadata: - name: prometheus -- |- - $patch: delete - apiVersion: v1 - kind: ConfigMap - metadata: - name: prometheus -- |- - $patch: delete - apiVersion: v1 - kind: Service - metadata: - name: prometheus -- |- - $patch: delete - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - name: prometheus -- |- - $patch: delete - apiVersion: apps/v1 - kind: Deployment - metadata: - name: prometheus -# - |- -# $patch: delete -# apiVersion: rbac.authorization.k8s.io/v1 -# kind: RoleBinding -# metadata: -# name: prometheus-nonprivileged \ No newline at end of file +patches: + - patch: |- + $patch: delete + apiVersion: rbac.authorization.k8s.io/v1 + kind: ClusterRole + metadata: + name: prometheus + - patch: |- + $patch: delete + apiVersion: v1 + kind: ServiceAccount + metadata: + name: prometheus + - patch: |- + $patch: delete + apiVersion: rbac.authorization.k8s.io/v1 + kind: ClusterRoleBinding + metadata: + name: prometheus + - patch: |- + $patch: delete + apiVersion: v1 + kind: ConfigMap + metadata: + name: prometheus + - patch: |- + $patch: delete + apiVersion: v1 + kind: Service + metadata: + name: prometheus + - patch: |- + $patch: delete + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: prometheus + - patch: |- + $patch: delete + apiVersion: apps/v1 + kind: Deployment + metadata: + name: prometheus diff --git a/components/remove/pvcs/kustomization.yaml b/components/remove/pvcs/kustomization.yaml index b8881440..91a7ddb8 100644 --- a/components/remove/pvcs/kustomization.yaml +++ b/components/remove/pvcs/kustomization.yaml @@ -1,54 +1,53 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesJson6902: - - target: +patches: + - patch: |- + - op: remove + path: /spec/template/spec/volumes/0/persistentVolumeClaim + target: kind: StatefulSet|Deployment name: blobstore|codeinsights-db|codeintel-db|pgsql|redis-cache|redis-store|prometheus version: v1 - patch: |- + - patch: |- - op: remove - path: /spec/template/spec/volumes/0/persistentVolumeClaim - - target: + path: /spec + target: kind: PersistentVolumeClaim name: .* version: v1 - patch: |- - - op: remove - path: /spec -patchesStrategicMerge: - - |- - $patch: delete - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - name: blobstore - - |- - $patch: delete - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - name: codeinsights-db - - |- - $patch: delete - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - name: codeintel-db - - |- - $patch: delete - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - name: pgsql - - |- - $patch: delete - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - name: redis-cache - - |- - $patch: delete - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - name: redis-store + - patch: |- + $patch: delete + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: blobstore + - patch: |- + $patch: delete + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: codeinsights-db + - patch: |- + $patch: delete + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: codeintel-db + - patch: |- + $patch: delete + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: pgsql + - patch: |- + $patch: delete + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: redis-cache + - patch: |- + $patch: delete + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: redis-store diff --git a/components/remove/redis/kustomization.yaml b/components/remove/redis/kustomization.yaml index 3ac38329..0b0fc44b 100644 --- a/components/remove/redis/kustomization.yaml +++ b/components/remove/redis/kustomization.yaml @@ -1,39 +1,39 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: - - |- - $patch: delete - apiVersion: apps/v1 - kind: Deployment - metadata: - name: redis-cache - - |- - $patch: delete - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - name: redis-cache - - |- - $patch: delete - apiVersion: v1 - kind: Service - metadata: - name: redis-cache - - |- - $patch: delete - apiVersion: apps/v1 - kind: Deployment - metadata: - name: redis-store - - |- - $patch: delete - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - name: redis-store - - |- - $patch: delete - apiVersion: v1 - kind: Service - metadata: - name: redis-store +patches: + - patch: |- + $patch: delete + apiVersion: apps/v1 + kind: Deployment + metadata: + name: redis-cache + - patch: |- + $patch: delete + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: redis-cache + - patch: |- + $patch: delete + apiVersion: v1 + kind: Service + metadata: + name: redis-cache + - patch: |- + $patch: delete + apiVersion: apps/v1 + kind: Deployment + metadata: + name: redis-store + - patch: |- + $patch: delete + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: redis-store + - patch: |- + $patch: delete + apiVersion: v1 + kind: Service + metadata: + name: redis-store diff --git a/components/remove/requests/kustomization.yaml b/components/remove/requests/kustomization.yaml index 0a612036..b9363102 100644 --- a/components/remove/requests/kustomization.yaml +++ b/components/remove/requests/kustomization.yaml @@ -1,24 +1,24 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesJson6902: - - target: +patches: + - patch: |- + - op: remove + path: /spec/template/spec/containers/0/resources/requests + target: kind: Deployment|StatefulSet|DaemonSet name: .* version: v1 - patch: |- + - patch: |- - op: remove - path: /spec/template/spec/containers/0/resources/requests - - target: + path: /spec/template/spec/containers/1/resources/requests + target: kind: StatefulSet|Deployment name: pgsql|codeinsights-db|codeintel-db|indexed-search|redis-cache|redis-store version: v1 - patch: |- + - patch: |- - op: remove - path: /spec/template/spec/containers/1/resources/requests - - target: + path: /spec/template/spec/initContainers/0/resources/requests + target: kind: StatefulSet|Deployment name: pgsql|codeinsights-db|codeintel-db|sourcegraph-frontend version: v1 - patch: |- - - op: remove - path: /spec/template/spec/initContainers/0/resources/requests diff --git a/components/remove/resources/kustomization.yaml b/components/remove/resources/kustomization.yaml index 5c7504cf..b1820aae 100644 --- a/components/remove/resources/kustomization.yaml +++ b/components/remove/resources/kustomization.yaml @@ -1,19 +1,19 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesJson6902: - - target: +patches: + - path: patches/container-0.yaml + target: + group: apps kind: Deployment|StatefulSet|DaemonSet name: .* - group: apps version: v1 - path: patches/container-0.yaml - - target: + - path: patches/container-1.yaml + target: kind: StatefulSet|Deployment name: pgsql|codeinsights-db|codeintel-db|indexed-search|redis-cache|redis-store version: v1 - path: patches/container-1.yaml - - target: + - path: patches/container-init.yaml + target: kind: StatefulSet|Deployment name: pgsql|codeinsights-db|codeintel-db|sourcegraph-frontend version: v1 - path: patches/container-init.yaml diff --git a/components/remove/searcher-statefulset/kustomization.yaml b/components/remove/searcher-statefulset/kustomization.yaml index 53f788ec..2a91f2bf 100644 --- a/components/remove/searcher-statefulset/kustomization.yaml +++ b/components/remove/searcher-statefulset/kustomization.yaml @@ -1,9 +1,9 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: -- |- - $patch: delete - apiVersion: apps/v1 - kind: StatefulSet - metadata: - name: searcher \ No newline at end of file +patches: +- patch: |- + $patch: delete + apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: searcher diff --git a/components/remove/security-context/kustomization.yaml b/components/remove/security-context/kustomization.yaml index abce6631..962d611a 100644 --- a/components/remove/security-context/kustomization.yaml +++ b/components/remove/security-context/kustomization.yaml @@ -1,33 +1,33 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesJson6902: - - target: +patches: + - path: patches/securityContext-container-0.yaml + target: + group: apps kind: StatefulSet|Deployment name: .* - group: apps version: v1 - path: patches/securityContext-container-0.yaml - - target: + - path: patches/securityContext-daemonset.yaml + target: + group: apps kind: DaemonSet name: otel-agent - group: apps version: v1 - path: patches/securityContext-daemonset.yaml - - target: + - path: patches/securityContext-databases.yaml + target: + group: apps kind: Deployment|StatefulSet name: codeinsights-db|codeintel-db|pgsql|sourcegraph-frontend - group: apps version: v1 - path: patches/securityContext-databases.yaml - - target: + - path: patches/securityContext-initContainer.yaml + target: + group: apps kind: Deployment|StatefulSet name: codeinsights-db|codeintel-db|pgsql|sourcegraph-frontend - group: apps version: v1 - path: patches/securityContext-initContainer.yaml - - target: + - path: patches/securityContext-container-1.yaml + target: + group: apps kind: Deployment|StatefulSet name: redis-cache|redis-store|indexed-search - group: apps version: v1 - path: patches/securityContext-container-1.yaml diff --git a/components/remove/symbols-statefulset/kustomization.yaml b/components/remove/symbols-statefulset/kustomization.yaml index cabb8423..71571948 100644 --- a/components/remove/symbols-statefulset/kustomization.yaml +++ b/components/remove/symbols-statefulset/kustomization.yaml @@ -1,9 +1,9 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -patchesStrategicMerge: -- |- - $patch: delete - apiVersion: apps/v1 - kind: StatefulSet - metadata: - name: symbols \ No newline at end of file +patches: + - patch: |- + $patch: delete + apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: symbols diff --git a/components/resources/ci-volume/kustomization.yaml b/components/resources/ci-volume/kustomization.yaml index 59bd3f35..81298ed8 100644 --- a/components/resources/ci-volume/kustomization.yaml +++ b/components/resources/ci-volume/kustomization.yaml @@ -1,11 +1,11 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component patches: -- path: patches/indexed-search-patch.yaml - target: - kind: StatefulSet - name: indexed-search -- path: patches/gitserver-patch.yaml - target: - kind: StatefulSet - name: gitserver \ No newline at end of file + - path: patches/indexed-search-patch.yaml + target: + kind: StatefulSet + name: indexed-search + - path: patches/gitserver-patch.yaml + target: + kind: StatefulSet + name: gitserver diff --git a/components/services/redis/kustomization.yaml b/components/services/redis/kustomization.yaml index 5cf5581e..fa7126ee 100644 --- a/components/services/redis/kustomization.yaml +++ b/components/services/redis/kustomization.yaml @@ -4,7 +4,7 @@ replacements: - source: fieldPath: data.NEW_REDIS_CACHE_ENDPOINT kind: SourcegraphKustomizeConfig - name: sourcegraph-kustomize-env + name: sourcegraph-kustomize-config version: v1 targets: - fieldPaths: @@ -52,7 +52,7 @@ replacements: - source: fieldPath: data.NEW_REDIS_STORE_ENDPOINT kind: SourcegraphKustomizeConfig - name: sourcegraph-kustomize-env + name: sourcegraph-kustomize-config version: v1 targets: - fieldPaths: diff --git a/components/services/searcher/deployment/kustomization.yaml b/components/services/searcher/deployment/kustomization.yaml index d2727f6e..0b5a0e0a 100644 --- a/components/services/searcher/deployment/kustomization.yaml +++ b/components/services/searcher/deployment/kustomization.yaml @@ -1,9 +1,9 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component patches: - - path: patches/searcher.Deployment.yaml + - options: + allowKindChange: true + path: patches/searcher.Deployment.yaml target: kind: StatefulSet name: searcher - options: - allowKindChange: true diff --git a/components/services/searcher/statefulset/kustomization.yaml b/components/services/searcher/statefulset/kustomization.yaml index 0915e4d2..0a0abf12 100644 --- a/components/services/searcher/statefulset/kustomization.yaml +++ b/components/services/searcher/statefulset/kustomization.yaml @@ -1,9 +1,9 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component patches: - - path: patches/searcher.StatefulSet.yaml + - options: + allowKindChange: true + path: patches/searcher.StatefulSet.yaml target: kind: Deployment name: searcher - options: - allowKindChange: true diff --git a/components/services/symbols/deployment/kustomization.yaml b/components/services/symbols/deployment/kustomization.yaml index bc13f790..179a0e4f 100644 --- a/components/services/symbols/deployment/kustomization.yaml +++ b/components/services/symbols/deployment/kustomization.yaml @@ -1,9 +1,9 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component patches: - - path: patches/symbols.Deployment.yaml + - options: + allowKindChange: true + path: patches/symbols.Deployment.yaml target: kind: StatefulSet name: symbols - options: - allowKindChange: true diff --git a/components/services/symbols/statefulset/kustomization.yaml b/components/services/symbols/statefulset/kustomization.yaml index 40abc8e0..bdc464bd 100644 --- a/components/services/symbols/statefulset/kustomization.yaml +++ b/components/services/symbols/statefulset/kustomization.yaml @@ -1,9 +1,9 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component patches: - - path: patches/symbols.StatefulSet.yaml + - options: + allowKindChange: true + path: patches/symbols.StatefulSet.yaml target: kind: Deployment name: symbols - options: - allowKindChange: true diff --git a/components/sizes/l/kustomization.yaml b/components/sizes/l/kustomization.yaml index 351ffc12..39b7eb59 100644 --- a/components/sizes/l/kustomization.yaml +++ b/components/sizes/l/kustomization.yaml @@ -2,43 +2,230 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component components: - ../../resources/lower-requests -patchesStrategicMerge: - - patches/resources.yaml - - patches/endpoints.yaml # To support searcher and symbols as both statefulset and deployment -patchesJson6902: - - target: +patches: + - path: patches/searcher.yaml + target: + group: apps kind: StatefulSet|Deployment name: searcher - group: apps version: v1 - path: patches/searcher.yaml - - target: + - path: patches/symbols.yaml + target: + group: apps kind: StatefulSet|Deployment name: symbols - group: apps version: v1 - path: patches/symbols.yaml - - target: + - path: patches/pgsql.yaml + target: + group: apps kind: StatefulSet|Deployment name: pgsql - group: apps version: v1 - path: patches/pgsql.yaml - - target: + - path: patches/codeinsights-db.yaml + target: + group: apps kind: StatefulSet|Deployment name: codeinsights-db - group: apps version: v1 - path: patches/codeinsights-db.yaml - - target: + - path: patches/codeintel-db.yaml + target: + group: apps kind: StatefulSet|Deployment name: codeintel-db - group: apps version: v1 - path: patches/codeintel-db.yaml - - target: + - path: patches/prometheus.yaml + target: kind: ConfigMap name: prometheus version: v1 - path: patches/prometheus.yaml + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: blobstore + spec: + template: + spec: + containers: + - name: blobstore + resources: + limits: + cpu: "2" + memory: 2Gi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: github-proxy + spec: + template: + spec: + containers: + - name: github-proxy + resources: + limits: + cpu: "1" + memory: 1G + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: precise-code-intel-worker + spec: + replicas: 1 + template: + spec: + containers: + - name: precise-code-intel-worker + resources: + limits: + cpu: "2" + memory: 50G + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: redis-cache + spec: + template: + spec: + containers: + - name: redis-cache + resources: + limits: + cpu: "1" + memory: 5Gi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: redis-store + spec: + template: + spec: + containers: + - name: redis-store + resources: + limits: + cpu: "1" + memory: 6Gi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: repo-updater + spec: + template: + spec: + containers: + - name: repo-updater + resources: + limits: + cpu: "4" + memory: 4Gi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: sourcegraph-frontend + spec: + replicas: 2 + template: + spec: + containers: + - name: frontend + resources: + limits: + cpu: "6" + memory: 6G + ephemeral-storage: 8Gi + - patch: |- + apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: symbols + spec: + replicas: 1 + template: + spec: + containers: + - name: symbols + resources: + limits: + cpu: "4" + memory: 4G + env: + # Enables Rockskip + - name: USE_ROCKSKIP + value: "true" + # Uses Rockskip for all repositories over 1GB + - name: ROCKSKIP_MIN_REPO_SIZE_MB + value: "1000" + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: syntect-server + spec: + replicas: 1 + template: + spec: + containers: + - name: syntect-server + resources: + limits: + cpu: "4" + memory: 6G + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: worker + spec: + replicas: 1 + template: + spec: + containers: + - name: worker + resources: + limits: + cpu: "4" + memory: 4G + - patch: |- + apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: gitserver + spec: + replicas: 1 + template: + spec: + containers: + - name: gitserver + resources: + limits: + cpu: "8" + memory: 26G + - patch: |- + apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: indexed-search + spec: + replicas: 2 + template: + spec: + containers: + - name: zoekt-webserver + resources: + limits: + cpu: "8" + memory: 16G + - name: zoekt-indexserver + resources: + limits: + cpu: "4" + memory: 16G + + - path: patches/endpoints.yaml diff --git a/components/sizes/l/patches/resources.yaml b/components/sizes/l/patches/resources.yaml deleted file mode 100644 index e7cff5ed..00000000 --- a/components/sizes/l/patches/resources.yaml +++ /dev/null @@ -1,187 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: blobstore -spec: - template: - spec: - containers: - - name: blobstore - resources: - limits: - cpu: "2" - memory: 2Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: github-proxy -spec: - template: - spec: - containers: - - name: github-proxy - resources: - limits: - cpu: "1" - memory: 1G ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: precise-code-intel-worker -spec: - replicas: 1 - template: - spec: - containers: - - name: precise-code-intel-worker - resources: - limits: - cpu: "2" - memory: 50G ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: redis-cache -spec: - template: - spec: - containers: - - name: redis-cache - resources: - limits: - cpu: "1" - memory: 5Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: redis-store -spec: - template: - spec: - containers: - - name: redis-store - resources: - limits: - cpu: "1" - memory: 6Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: repo-updater -spec: - template: - spec: - containers: - - name: repo-updater - resources: - limits: - cpu: "4" - memory: 4Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: sourcegraph-frontend -spec: - replicas: 2 - template: - spec: - containers: - - name: frontend - resources: - limits: - cpu: "6" - memory: 6G - ephemeral-storage: 8Gi ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: symbols -spec: - replicas: 1 - template: - spec: - containers: - - name: symbols - resources: - limits: - cpu: "4" - memory: 4G - env: - # Enables Rockskip - - name: USE_ROCKSKIP - value: "true" - # Uses Rockskip for all repositories over 1GB - - name: ROCKSKIP_MIN_REPO_SIZE_MB - value: "1000" ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: syntect-server -spec: - replicas: 1 - template: - spec: - containers: - - name: syntect-server - resources: - limits: - cpu: "4" - memory: 6G ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: worker -spec: - replicas: 1 - template: - spec: - containers: - - name: worker - resources: - limits: - cpu: "4" - memory: 4G ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: gitserver -spec: - replicas: 1 - template: - spec: - containers: - - name: gitserver - resources: - limits: - cpu: "8" - memory: 26G ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: indexed-search -spec: - replicas: 2 - template: - spec: - containers: - - name: zoekt-webserver - resources: - limits: - cpu: "8" - memory: 16G - - name: zoekt-indexserver - resources: - limits: - cpu: "4" - memory: 16G diff --git a/components/sizes/m/kustomization.yaml b/components/sizes/m/kustomization.yaml index 351ffc12..5514e982 100644 --- a/components/sizes/m/kustomization.yaml +++ b/components/sizes/m/kustomization.yaml @@ -2,43 +2,207 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component components: - ../../resources/lower-requests -patchesStrategicMerge: - - patches/resources.yaml - - patches/endpoints.yaml # To support searcher and symbols as both statefulset and deployment -patchesJson6902: - - target: +patches: + - path: patches/searcher.yaml + target: + group: apps kind: StatefulSet|Deployment name: searcher - group: apps version: v1 - path: patches/searcher.yaml - - target: + - path: patches/symbols.yaml + target: + group: apps kind: StatefulSet|Deployment name: symbols - group: apps version: v1 - path: patches/symbols.yaml - - target: + - path: patches/pgsql.yaml + target: + group: apps kind: StatefulSet|Deployment name: pgsql - group: apps version: v1 - path: patches/pgsql.yaml - - target: + - path: patches/codeinsights-db.yaml + target: + group: apps kind: StatefulSet|Deployment name: codeinsights-db - group: apps version: v1 - path: patches/codeinsights-db.yaml - - target: + - path: patches/codeintel-db.yaml + target: + group: apps kind: StatefulSet|Deployment name: codeintel-db - group: apps version: v1 - path: patches/codeintel-db.yaml - - target: + - path: patches/prometheus.yaml + target: kind: ConfigMap name: prometheus version: v1 - path: patches/prometheus.yaml + - path: patches/endpoints.yaml + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: blobstore + spec: + template: + spec: + containers: + - name: blobstore + resources: + limits: + cpu: "2" + memory: 2Gi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: github-proxy + spec: + template: + spec: + containers: + - name: github-proxy + resources: + limits: + cpu: "1" + memory: 1G + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: precise-code-intel-worker + spec: + replicas: 1 + template: + spec: + containers: + - name: precise-code-intel-worker + resources: + limits: + cpu: "2" + memory: 50G + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: redis-cache + spec: + template: + spec: + containers: + - name: redis-cache + resources: + limits: + cpu: "1" + memory: 5Gi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: redis-store + spec: + template: + spec: + containers: + - name: redis-store + resources: + limits: + cpu: "1" + memory: 5Gi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: repo-updater + spec: + template: + spec: + containers: + - name: repo-updater + resources: + limits: + cpu: "4" + memory: 4Gi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: sourcegraph-frontend + spec: + replicas: 2 + template: + spec: + containers: + - name: frontend + resources: + limits: + cpu: "4" + memory: 8G + ephemeral-storage: 8Gi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: syntect-server + spec: + replicas: 1 + template: + spec: + containers: + - name: syntect-server + resources: + limits: + cpu: "4" + memory: 6G + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: worker + spec: + replicas: 1 + template: + spec: + containers: + - name: worker + resources: + limits: + cpu: "4" + memory: 4G + - patch: |- + apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: gitserver + spec: + replicas: 1 + template: + spec: + containers: + - name: gitserver + resources: + limits: + cpu: "6" + memory: 26G + - patch: |- + apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: indexed-search + spec: + replicas: 1 + template: + spec: + containers: + - name: zoekt-webserver + resources: + limits: + cpu: "6" + memory: 12G + - name: zoekt-indexserver + resources: + limits: + cpu: "4" + memory: 12G diff --git a/components/sizes/m/patches/resources.yaml b/components/sizes/m/patches/resources.yaml deleted file mode 100644 index 76476777..00000000 --- a/components/sizes/m/patches/resources.yaml +++ /dev/null @@ -1,165 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: blobstore -spec: - template: - spec: - containers: - - name: blobstore - resources: - limits: - cpu: "2" - memory: 2Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: github-proxy -spec: - template: - spec: - containers: - - name: github-proxy - resources: - limits: - cpu: "1" - memory: 1G ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: precise-code-intel-worker -spec: - replicas: 1 - template: - spec: - containers: - - name: precise-code-intel-worker - resources: - limits: - cpu: "2" - memory: 50G ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: redis-cache -spec: - template: - spec: - containers: - - name: redis-cache - resources: - limits: - cpu: "1" - memory: 5Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: redis-store -spec: - template: - spec: - containers: - - name: redis-store - resources: - limits: - cpu: "1" - memory: 5Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: repo-updater -spec: - template: - spec: - containers: - - name: repo-updater - resources: - limits: - cpu: "4" - memory: 4Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: sourcegraph-frontend -spec: - replicas: 2 - template: - spec: - containers: - - name: frontend - resources: - limits: - cpu: "4" - memory: 8G - ephemeral-storage: 8Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: syntect-server -spec: - replicas: 1 - template: - spec: - containers: - - name: syntect-server - resources: - limits: - cpu: "4" - memory: 6G ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: worker -spec: - replicas: 1 - template: - spec: - containers: - - name: worker - resources: - limits: - cpu: "4" - memory: 4G ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: gitserver -spec: - replicas: 1 - template: - spec: - containers: - - name: gitserver - resources: - limits: - cpu: "6" - memory: 26G ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: indexed-search -spec: - replicas: 1 - template: - spec: - containers: - - name: zoekt-webserver - resources: - limits: - cpu: "6" - memory: 12G - - name: zoekt-indexserver - resources: - limits: - cpu: "4" - memory: 12G diff --git a/components/sizes/s/kustomization.yaml b/components/sizes/s/kustomization.yaml index 351ffc12..f8cdb6fe 100644 --- a/components/sizes/s/kustomization.yaml +++ b/components/sizes/s/kustomization.yaml @@ -2,43 +2,207 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component components: - ../../resources/lower-requests -patchesStrategicMerge: - - patches/resources.yaml - - patches/endpoints.yaml # To support searcher and symbols as both statefulset and deployment -patchesJson6902: - - target: +patches: + - path: patches/searcher.yaml + target: + group: apps kind: StatefulSet|Deployment name: searcher - group: apps version: v1 - path: patches/searcher.yaml - - target: + - path: patches/symbols.yaml + target: + group: apps kind: StatefulSet|Deployment name: symbols - group: apps version: v1 - path: patches/symbols.yaml - - target: + - path: patches/pgsql.yaml + target: + group: apps kind: StatefulSet|Deployment name: pgsql - group: apps version: v1 - path: patches/pgsql.yaml - - target: + - path: patches/codeinsights-db.yaml + target: + group: apps kind: StatefulSet|Deployment name: codeinsights-db - group: apps version: v1 - path: patches/codeinsights-db.yaml - - target: + - path: patches/codeintel-db.yaml + target: + group: apps kind: StatefulSet|Deployment name: codeintel-db - group: apps version: v1 - path: patches/codeintel-db.yaml - - target: + - path: patches/prometheus.yaml + target: kind: ConfigMap name: prometheus version: v1 - path: patches/prometheus.yaml + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: blobstore + spec: + template: + spec: + containers: + - name: blobstore + resources: + limits: + cpu: "2" + memory: 2Gi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: github-proxy + spec: + template: + spec: + containers: + - name: github-proxy + resources: + limits: + cpu: "1" + memory: 1G + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: precise-code-intel-worker + spec: + replicas: 1 + template: + spec: + containers: + - name: precise-code-intel-worker + resources: + limits: + cpu: "2" + memory: 50G + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: redis-cache + spec: + template: + spec: + containers: + - name: redis-cache + resources: + limits: + cpu: "1" + memory: 2Gi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: redis-store + spec: + template: + spec: + containers: + - name: redis-store + resources: + limits: + cpu: "1" + memory: 4Gi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: repo-updater + spec: + template: + spec: + containers: + - name: repo-updater + resources: + limits: + cpu: "4" + memory: 4Gi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: sourcegraph-frontend + spec: + replicas: 2 + template: + spec: + containers: + - name: frontend + resources: + limits: + cpu: "4" + memory: 8G + ephemeral-storage: 8Gi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: syntect-server + spec: + replicas: 1 + template: + spec: + containers: + - name: syntect-server + resources: + limits: + cpu: "4" + memory: 6G + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: worker + spec: + replicas: 1 + template: + spec: + containers: + - name: worker + resources: + limits: + cpu: "4" + memory: 4G + - patch: |- + apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: gitserver + spec: + replicas: 1 + template: + spec: + containers: + - name: gitserver + resources: + limits: + cpu: "6" + memory: 26G + - patch: |- + apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: indexed-search + spec: + replicas: 1 + template: + spec: + containers: + - name: zoekt-webserver + resources: + limits: + cpu: "6" + memory: 24G + - name: zoekt-indexserver + resources: + limits: + cpu: "6" + memory: 16G + - path: patches/endpoints.yaml diff --git a/components/sizes/s/patches/resources.yaml b/components/sizes/s/patches/resources.yaml deleted file mode 100644 index 63f398ec..00000000 --- a/components/sizes/s/patches/resources.yaml +++ /dev/null @@ -1,165 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: blobstore -spec: - template: - spec: - containers: - - name: blobstore - resources: - limits: - cpu: "2" - memory: 2Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: github-proxy -spec: - template: - spec: - containers: - - name: github-proxy - resources: - limits: - cpu: "1" - memory: 1G ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: precise-code-intel-worker -spec: - replicas: 1 - template: - spec: - containers: - - name: precise-code-intel-worker - resources: - limits: - cpu: "2" - memory: 50G ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: redis-cache -spec: - template: - spec: - containers: - - name: redis-cache - resources: - limits: - cpu: "1" - memory: 2Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: redis-store -spec: - template: - spec: - containers: - - name: redis-store - resources: - limits: - cpu: "1" - memory: 4Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: repo-updater -spec: - template: - spec: - containers: - - name: repo-updater - resources: - limits: - cpu: "4" - memory: 4Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: sourcegraph-frontend -spec: - replicas: 2 - template: - spec: - containers: - - name: frontend - resources: - limits: - cpu: "4" - memory: 8G - ephemeral-storage: 8Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: syntect-server -spec: - replicas: 1 - template: - spec: - containers: - - name: syntect-server - resources: - limits: - cpu: "4" - memory: 6G ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: worker -spec: - replicas: 1 - template: - spec: - containers: - - name: worker - resources: - limits: - cpu: "4" - memory: 4G ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: gitserver -spec: - replicas: 1 - template: - spec: - containers: - - name: gitserver - resources: - limits: - cpu: "6" - memory: 26G ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: indexed-search -spec: - replicas: 1 - template: - spec: - containers: - - name: zoekt-webserver - resources: - limits: - cpu: "4" - memory: 12G - - name: zoekt-indexserver - resources: - limits: - cpu: "4" - memory: 12G diff --git a/components/sizes/xl/kustomization.yaml b/components/sizes/xl/kustomization.yaml index 3686dc08..cac413e9 100644 --- a/components/sizes/xl/kustomization.yaml +++ b/components/sizes/xl/kustomization.yaml @@ -2,44 +2,208 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component components: - ../../resources/lower-requests -patchesStrategicMerge: - - patches/resources.yaml - - patches/pgsql-conf.yaml - - patches/endpoints.yaml # To support searcher and symbols as both statefulset and deployment -patchesJson6902: - - target: +patches: + - path: patches/searcher.yaml + target: + group: apps kind: StatefulSet|Deployment name: searcher - group: apps version: v1 - path: patches/searcher.yaml - - target: + - path: patches/symbols.yaml + target: + group: apps kind: StatefulSet|Deployment name: symbols - group: apps version: v1 - path: patches/symbols.yaml - - target: + - path: patches/pgsql.yaml + target: + group: apps kind: StatefulSet|Deployment name: pgsql - group: apps version: v1 - path: patches/pgsql.yaml - - target: + - path: patches/codeinsights-db.yaml + target: + group: apps kind: StatefulSet|Deployment name: codeinsights-db - group: apps version: v1 - path: patches/codeinsights-db.yaml - - target: + - path: patches/codeintel-db.yaml + target: + group: apps kind: StatefulSet|Deployment name: codeintel-db - group: apps version: v1 - path: patches/codeintel-db.yaml - - target: + - path: patches/prometheus.yaml + target: kind: ConfigMap name: prometheus version: v1 - path: patches/prometheus.yaml + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: blobstore + spec: + template: + spec: + containers: + - name: blobstore + resources: + limits: + cpu: "2" + memory: 2Gi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: github-proxy + spec: + template: + spec: + containers: + - name: github-proxy + resources: + limits: + cpu: "1" + memory: 1G + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: precise-code-intel-worker + spec: + replicas: 1 + template: + spec: + containers: + - name: precise-code-intel-worker + resources: + limits: + cpu: "2" + memory: 50G + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: redis-cache + spec: + template: + spec: + containers: + - name: redis-cache + resources: + limits: + cpu: "1" + memory: 5Gi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: redis-store + spec: + template: + spec: + containers: + - name: redis-store + resources: + limits: + cpu: "1" + memory: 8Gi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: repo-updater + spec: + template: + spec: + containers: + - name: repo-updater + resources: + limits: + cpu: "4" + memory: 4Gi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: sourcegraph-frontend + spec: + replicas: 2 + template: + spec: + containers: + - name: frontend + resources: + limits: + cpu: "9" + memory: 24G + ephemeral-storage: 12Gi + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: syntect-server + spec: + replicas: 1 + template: + spec: + containers: + - name: syntect-server + resources: + limits: + cpu: "4" + memory: 6G + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: worker + spec: + replicas: 1 + template: + spec: + containers: + - name: worker + resources: + limits: + cpu: "4" + memory: 4G + - patch: |- + apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: gitserver + spec: + replicas: 2 + template: + spec: + containers: + - name: gitserver + resources: + limits: + cpu: "12" + memory: 20G + - patch: |- + apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: indexed-search + spec: + replicas: 3 + template: + spec: + containers: + - name: zoekt-webserver + resources: + limits: + cpu: "12" + memory: 16G + - name: zoekt-indexserver + resources: + limits: + cpu: "5" + memory: 10G + - path: patches/pgsql-conf.yaml + - path: patches/endpoints.yaml diff --git a/components/sizes/xl/patches/resources.yaml b/components/sizes/xl/patches/resources.yaml deleted file mode 100644 index 1231d1c5..00000000 --- a/components/sizes/xl/patches/resources.yaml +++ /dev/null @@ -1,165 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: blobstore -spec: - template: - spec: - containers: - - name: blobstore - resources: - limits: - cpu: "2" - memory: 2Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: github-proxy -spec: - template: - spec: - containers: - - name: github-proxy - resources: - limits: - cpu: "1" - memory: 1G ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: precise-code-intel-worker -spec: - replicas: 1 - template: - spec: - containers: - - name: precise-code-intel-worker - resources: - limits: - cpu: "2" - memory: 50G ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: redis-cache -spec: - template: - spec: - containers: - - name: redis-cache - resources: - limits: - cpu: "1" - memory: 5Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: redis-store -spec: - template: - spec: - containers: - - name: redis-store - resources: - limits: - cpu: "1" - memory: 8Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: repo-updater -spec: - template: - spec: - containers: - - name: repo-updater - resources: - limits: - cpu: "4" - memory: 4Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: sourcegraph-frontend -spec: - replicas: 2 - template: - spec: - containers: - - name: frontend - resources: - limits: - cpu: "9" - memory: 24G - ephemeral-storage: 12Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: syntect-server -spec: - replicas: 1 - template: - spec: - containers: - - name: syntect-server - resources: - limits: - cpu: "4" - memory: 6G ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: worker -spec: - replicas: 1 - template: - spec: - containers: - - name: worker - resources: - limits: - cpu: "4" - memory: 4G ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: gitserver -spec: - replicas: 2 - template: - spec: - containers: - - name: gitserver - resources: - limits: - cpu: "12" - memory: 20G ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: indexed-search -spec: - replicas: 3 - template: - spec: - containers: - - name: zoekt-webserver - resources: - limits: - cpu: "12" - memory: 16G - - name: zoekt-indexserver - resources: - limits: - cpu: "5" - memory: 10G diff --git a/components/sizes/xs/kustomization.yaml b/components/sizes/xs/kustomization.yaml index 2304300c..dfe0dc61 100644 --- a/components/sizes/xs/kustomization.yaml +++ b/components/sizes/xs/kustomization.yaml @@ -187,7 +187,7 @@ patches: resources: limits: cpu: "8" - memory: 50G + memory: 16G - name: zoekt-indexserver resources: limits: diff --git a/components/storage-class/aws/ebs-csi/kustomization.yaml b/components/storage-class/aws/ebs-csi/kustomization.yaml index b178f676..b52821f7 100644 --- a/components/storage-class/aws/ebs-csi/kustomization.yaml +++ b/components/storage-class/aws/ebs-csi/kustomization.yaml @@ -1,22 +1,22 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component resources: -- sourcegraph.StorageClass.yaml + - sourcegraph.StorageClass.yaml patches: -- patch: |- - - op: replace - path: /spec/volumeClaimTemplates/0/spec/storageClassName - value: sourcegraph - target: - group: apps - kind: StatefulSet - name: searcher|symbols|indexed-search|grafana|gitserver - version: v1 -- patch: |- - - op: replace - path: /spec/storageClassName - value: sourcegraph - target: - kind: PersistentVolumeClaim - name: .* - version: v1 + - patch: |- + - op: replace + path: /spec/volumeClaimTemplates/0/spec/storageClassName + value: sourcegraph + target: + group: apps + kind: StatefulSet + name: searcher|symbols|indexed-search|grafana|gitserver + version: v1 + - patch: |- + - op: replace + path: /spec/storageClassName + value: sourcegraph + target: + kind: PersistentVolumeClaim + name: .* + version: v1 diff --git a/components/storage-class/aws/eks-ebs/kustomization.yaml b/components/storage-class/aws/eks-ebs/kustomization.yaml index b178f676..b52821f7 100644 --- a/components/storage-class/aws/eks-ebs/kustomization.yaml +++ b/components/storage-class/aws/eks-ebs/kustomization.yaml @@ -1,22 +1,22 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component resources: -- sourcegraph.StorageClass.yaml + - sourcegraph.StorageClass.yaml patches: -- patch: |- - - op: replace - path: /spec/volumeClaimTemplates/0/spec/storageClassName - value: sourcegraph - target: - group: apps - kind: StatefulSet - name: searcher|symbols|indexed-search|grafana|gitserver - version: v1 -- patch: |- - - op: replace - path: /spec/storageClassName - value: sourcegraph - target: - kind: PersistentVolumeClaim - name: .* - version: v1 + - patch: |- + - op: replace + path: /spec/volumeClaimTemplates/0/spec/storageClassName + value: sourcegraph + target: + group: apps + kind: StatefulSet + name: searcher|symbols|indexed-search|grafana|gitserver + version: v1 + - patch: |- + - op: replace + path: /spec/storageClassName + value: sourcegraph + target: + kind: PersistentVolumeClaim + name: .* + version: v1 diff --git a/components/storage-class/azure/kustomization.yaml b/components/storage-class/azure/kustomization.yaml index b178f676..b52821f7 100644 --- a/components/storage-class/azure/kustomization.yaml +++ b/components/storage-class/azure/kustomization.yaml @@ -1,22 +1,22 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component resources: -- sourcegraph.StorageClass.yaml + - sourcegraph.StorageClass.yaml patches: -- patch: |- - - op: replace - path: /spec/volumeClaimTemplates/0/spec/storageClassName - value: sourcegraph - target: - group: apps - kind: StatefulSet - name: searcher|symbols|indexed-search|grafana|gitserver - version: v1 -- patch: |- - - op: replace - path: /spec/storageClassName - value: sourcegraph - target: - kind: PersistentVolumeClaim - name: .* - version: v1 + - patch: |- + - op: replace + path: /spec/volumeClaimTemplates/0/spec/storageClassName + value: sourcegraph + target: + group: apps + kind: StatefulSet + name: searcher|symbols|indexed-search|grafana|gitserver + version: v1 + - patch: |- + - op: replace + path: /spec/storageClassName + value: sourcegraph + target: + kind: PersistentVolumeClaim + name: .* + version: v1 diff --git a/components/storage-class/cloud/kustomization.yaml b/components/storage-class/cloud/kustomization.yaml index 7ad42230..3ca25482 100644 --- a/components/storage-class/cloud/kustomization.yaml +++ b/components/storage-class/cloud/kustomization.yaml @@ -8,7 +8,7 @@ replacements: - source: fieldPath: data.STORAGECLASS_PROVISIONER kind: SourcegraphKustomizeConfig - name: sourcegraph-kustomize-env + name: sourcegraph-kustomize-config version: v1 targets: - select: @@ -19,7 +19,7 @@ replacements: - source: fieldPath: data.STORAGECLASS_PARAM_TYPE kind: SourcegraphKustomizeConfig - name: sourcegraph-kustomize-env + name: sourcegraph-kustomize-config version: v1 targets: - select: diff --git a/components/storage-class/gcp/kustomization.yaml b/components/storage-class/gcp/kustomization.yaml index b178f676..b52821f7 100644 --- a/components/storage-class/gcp/kustomization.yaml +++ b/components/storage-class/gcp/kustomization.yaml @@ -1,22 +1,22 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component resources: -- sourcegraph.StorageClass.yaml + - sourcegraph.StorageClass.yaml patches: -- patch: |- - - op: replace - path: /spec/volumeClaimTemplates/0/spec/storageClassName - value: sourcegraph - target: - group: apps - kind: StatefulSet - name: searcher|symbols|indexed-search|grafana|gitserver - version: v1 -- patch: |- - - op: replace - path: /spec/storageClassName - value: sourcegraph - target: - kind: PersistentVolumeClaim - name: .* - version: v1 + - patch: |- + - op: replace + path: /spec/volumeClaimTemplates/0/spec/storageClassName + value: sourcegraph + target: + group: apps + kind: StatefulSet + name: searcher|symbols|indexed-search|grafana|gitserver + version: v1 + - patch: |- + - op: replace + path: /spec/storageClassName + value: sourcegraph + target: + kind: PersistentVolumeClaim + name: .* + version: v1 diff --git a/components/storage-class/k3s/kustomization.yaml b/components/storage-class/k3s/kustomization.yaml index 5c2f9f1e..02f83e7f 100644 --- a/components/storage-class/k3s/kustomization.yaml +++ b/components/storage-class/k3s/kustomization.yaml @@ -1,14 +1,14 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component patches: -- path: patches/replace-storageclass-name-sts.yaml - target: - group: apps - kind: StatefulSet - name: searcher|symbols|indexed-search|grafana|gitserver - version: v1 -- path: patches/replace-storageclass-name-pvc.yaml - target: - kind: PersistentVolumeClaim - name: .* - version: v1 + - path: patches/replace-storageclass-name-sts.yaml + target: + group: apps + kind: StatefulSet + name: searcher|symbols|indexed-search|grafana|gitserver + version: v1 + - path: patches/replace-storageclass-name-pvc.yaml + target: + kind: PersistentVolumeClaim + name: .* + version: v1 diff --git a/components/storage-class/name-update/patches/replacement.yaml b/components/storage-class/name-update/patches/replacement.yaml index 5a6a53cf..b915398a 100644 --- a/components/storage-class/name-update/patches/replacement.yaml +++ b/components/storage-class/name-update/patches/replacement.yaml @@ -1,7 +1,7 @@ - source: fieldPath: data.STORAGECLASS_NAME kind: SourcegraphKustomizeConfig - name: sourcegraph-kustomize-env + name: sourcegraph-kustomize-config version: v1 targets: - select: @@ -11,7 +11,7 @@ - source: fieldPath: data.STORAGECLASS_NAME kind: SourcegraphKustomizeConfig - name: sourcegraph-kustomize-env + name: sourcegraph-kustomize-config version: v1 targets: - select: diff --git a/components/storage-class/ssd/kustomization.yaml b/components/storage-class/ssd/kustomization.yaml index c847c868..2236f8d6 100644 --- a/components/storage-class/ssd/kustomization.yaml +++ b/components/storage-class/ssd/kustomization.yaml @@ -6,12 +6,12 @@ replacements: - source: fieldPath: data.SSD_NODE_PATH kind: SourcegraphKustomizeConfig - name: sourcegraph-kustomize-env + name: sourcegraph-kustomize-config version: v1 targets: - - select: - kind: DaemonSet + - fieldPaths: + - spec.template.spec.containers.*.volumeMounts.*.mountPath + select: group: apps + kind: DaemonSet name: pod-tmp-gc - fieldPaths: - - spec.template.spec.containers.*.volumeMounts.*.mountPath diff --git a/components/storage-class/trident/ext3/kustomization.yaml b/components/storage-class/trident/ext3/kustomization.yaml index 43c42c9b..6fa32cbe 100644 --- a/components/storage-class/trident/ext3/kustomization.yaml +++ b/components/storage-class/trident/ext3/kustomization.yaml @@ -3,4 +3,4 @@ kind: Component resources: - sourcegraph.StorageClass.yaml components: -- ../../sourcegraph \ No newline at end of file + - ../../sourcegraph diff --git a/components/storage-class/trident/ext4/kustomization.yaml b/components/storage-class/trident/ext4/kustomization.yaml index 43c42c9b..6fa32cbe 100644 --- a/components/storage-class/trident/ext4/kustomization.yaml +++ b/components/storage-class/trident/ext4/kustomization.yaml @@ -3,4 +3,4 @@ kind: Component resources: - sourcegraph.StorageClass.yaml components: -- ../../sourcegraph \ No newline at end of file + - ../../sourcegraph diff --git a/components/storage-class/trident/xfs/kustomization.yaml b/components/storage-class/trident/xfs/kustomization.yaml index 43c42c9b..6fa32cbe 100644 --- a/components/storage-class/trident/xfs/kustomization.yaml +++ b/components/storage-class/trident/xfs/kustomization.yaml @@ -3,4 +3,4 @@ kind: Component resources: - sourcegraph.StorageClass.yaml components: -- ../../sourcegraph \ No newline at end of file + - ../../sourcegraph diff --git a/examples/migrator/kustomization.yaml b/examples/migrator/kustomization.yaml index 3df069c9..367d8786 100644 --- a/examples/migrator/kustomization.yaml +++ b/examples/migrator/kustomization.yaml @@ -4,22 +4,22 @@ namespace: default components: - ../../components/utils/migrator -patchesJson6902: - - target: - version: v1 - kind: Job - name: migrator - patch: |- +patches: + - patch: |- - op: replace path: /spec/template/spec/containers/0/args value: - upgrade - -from=v3.36 - -to=v4.0 + target: + kind: Job + name: migrator + version: v1 # Update env vars for migrator at the end of this file configMapGenerator: - - name: sourcegraph-frontend-env - behavior: merge + - behavior: merge literals: - ENV_VAR=VALUE + name: sourcegraph-frontend-env diff --git a/instances/template/config.template.yaml b/instances/template/config.template.yaml deleted file mode 100644 index 56043fa6..00000000 --- a/instances/template/config.template.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: v1 -kind: SourcegraphKustomizeConfig -metadata: - labels: - deploy: sourcegraph-kustomize-configs - name: sourcegraph-kustomize-env -# Update config options below -data: - PRIVATE_REGISTRY: my.private.docker.io - STORAGECLASS_NAME: sourcegraph - STORAGECLASS_PROVISIONER: STORAGECLASS_PROVISIONER_PLACEHOLDER - STORAGECLASS_PARAM_TYPE: STORAGECLASS_PARAM_TYPE_PLACEHOLDER - HOST_DOMAIN: HOST_DOMAIN_PLACEHOLDER - TLS_HOST: TLS_HOST_PLACEHOLDER - TLS_INGRESS_CLASS_NAME: TLS_INGRESS_CLASS_NAME_PLACEHOLDER - TLS_CLUSTER_ISSUER: TLS_CLUSTER_ISSUER_PLACEHOLDER - SSD_NODE_PATH: /mnt/disks/ssd0 - AWS_MANAGED_CERT_ARN: AWS_MANAGED_CERT_ARN_PLACEHOLDER - GKE_MANAGED_CERT_NAME: GKE_MANAGED_CERT_NAME_PLACEHOLDER - NEW_REDIS_CACHE_ENDPOINT: test.redis.cache - NEW_REDIS_STORE_ENDPOINT: test.redis.store diff --git a/instances/template/config.yaml b/instances/template/config.yaml new file mode 100644 index 00000000..78e12966 --- /dev/null +++ b/instances/template/config.yaml @@ -0,0 +1,30 @@ +########################################################################################## +# [DEPLOYMENT CONFIGURATIONS] +# Some components read the configuration values in this file during the building process +# +# HOW TO USE: +# Enter the configuration values as instructed by components used +# Always refer to the component’s documentation or comments before updating +########################################################################################## +apiVersion: v1 +kind: SourcegraphKustomizeConfig +metadata: + labels: + deploy: sourcegraph-kustomize + name: sourcegraph-kustomize-config +data: + #-------- Update config options below ---------# + EXAMPLE: __placeholder__ + AWS_MANAGED_CERT_ARN: __placeholder__ + GKE_MANAGED_CERT_NAME: __placeholder__ + HOST_DOMAIN: __placeholder__ + NEW_REDIS_CACHE_ENDPOINT: __placeholder__ + NEW_REDIS_STORE_ENDPOINT: __placeholder__ + PRIVATE_REGISTRY: __placeholder__ + SSD_NODE_PATH: __placeholder__ + STORAGECLASS_NAME: __placeholder__ + STORAGECLASS_PROVISIONER: __placeholder__ + STORAGECLASS_PARAM_TYPE: __placeholder__ + TLS_HOST: __placeholder__ + TLS_INGRESS_CLASS_NAME: __placeholder__ + TLS_CLUSTER_ISSUER: __placeholder__ From ff05151f3438afc9744468c4ebbed964caec2a70 Mon Sep 17 00:00:00 2001 From: Beatrix Date: Fri, 17 Feb 2023 11:32:20 -0800 Subject: [PATCH 03/13] Update migrator --- examples/migrator/kustomization.yaml | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/examples/migrator/kustomization.yaml b/examples/migrator/kustomization.yaml index 367d8786..2e46ac7d 100644 --- a/examples/migrator/kustomization.yaml +++ b/examples/migrator/kustomization.yaml @@ -4,6 +4,7 @@ namespace: default components: - ../../components/utils/migrator +# Update migration commands under the value field patches: - patch: |- - op: replace @@ -17,9 +18,26 @@ patches: name: migrator version: v1 -# Update env vars for migrator at the end of this file +# Update env vars for migrator below configMapGenerator: - behavior: merge - literals: - - ENV_VAR=VALUE name: sourcegraph-frontend-env + literals: + - PGHOST=pgsql + - PGPORT=5432 + - PGUSER=sg + - PGPASSWORD=sg + - PGDATABASE=sg + - PGSSLMODE=disable + - CODEINTEL_PGHOST=codeintel-db + - CODEINTEL_PGPORT=5432 + - CODEINTEL_PGUSER=sg + - CODEINTEL_PGPASSWORD=sg + - CODEINTEL_PGDATABASE=sg + - CODEINTEL_PGSSLMODE=disable + - CODEINSIGHTS_PGHOST=codeinsights-db + - CODEINSIGHTS_PGPORT=5432 + - CODEINSIGHTS_PGUSER=postgres + - CODEINSIGHTS_PGPASSWORD=password + - CODEINSIGHTS_PGDATABASE=postgres + - CODEINSIGHTS_PGSSLMODE=disable From 2fefc323041943ab5c157d8479318e02c41ab2b7 Mon Sep 17 00:00:00 2001 From: Beatrix Date: Fri, 17 Feb 2023 15:07:14 -0800 Subject: [PATCH 04/13] update SourcegraphKustomizeConfig --- .../aws/managed-cert/kustomization.yaml | 2 +- .../gke/managed-cert/kustomization.yaml | 2 +- .../private-registry/kustomization.yaml | 2 +- components/ingress/domain/kustomization.yaml | 2 +- .../ingress/hostname/kustomization.yaml | 2 +- components/network/tls/kustomization.yaml | 6 +-- components/services/redis/kustomization.yaml | 4 +- .../storage-class/cloud/kustomization.yaml | 4 +- .../name-update/patches/replacement.yaml | 4 +- .../storage-class/ssd/kustomization.yaml | 2 +- ...{config.yaml => buildConfig.template.yaml} | 28 +++++----- .../template/kustomization.template.yaml | 53 +++++++++++-------- 12 files changed, 59 insertions(+), 52 deletions(-) rename instances/template/{config.yaml => buildConfig.template.yaml} (53%) diff --git a/components/clusters/aws/managed-cert/kustomization.yaml b/components/clusters/aws/managed-cert/kustomization.yaml index abfe0234..3902440a 100644 --- a/components/clusters/aws/managed-cert/kustomization.yaml +++ b/components/clusters/aws/managed-cert/kustomization.yaml @@ -3,7 +3,7 @@ kind: Component replacements: - source: fieldPath: data.AWS_MANAGED_CERT_ARN - kind: SourcegraphKustomizeConfig + kind: SourcegraphBuildConfig name: sourcegraph-kustomize-config version: v1 targets: diff --git a/components/clusters/gke/managed-cert/kustomization.yaml b/components/clusters/gke/managed-cert/kustomization.yaml index 48597f9b..dd30186c 100644 --- a/components/clusters/gke/managed-cert/kustomization.yaml +++ b/components/clusters/gke/managed-cert/kustomization.yaml @@ -3,7 +3,7 @@ kind: Component replacements: - source: fieldPath: data.GKE_MANAGED_CERT_NAME - kind: SourcegraphKustomizeConfig + kind: SourcegraphBuildConfig name: sourcegraph-kustomize-config version: v1 targets: diff --git a/components/enable/private-registry/kustomization.yaml b/components/enable/private-registry/kustomization.yaml index 0d41853a..29ad8473 100644 --- a/components/enable/private-registry/kustomization.yaml +++ b/components/enable/private-registry/kustomization.yaml @@ -3,7 +3,7 @@ kind: Component replacements: - source: fieldPath: data.PRIVATE_REGISTRY - kind: SourcegraphKustomizeConfig + kind: SourcegraphBuildConfig name: sourcegraph-kustomize-config version: v1 targets: diff --git a/components/ingress/domain/kustomization.yaml b/components/ingress/domain/kustomization.yaml index b54e742a..e108f8a4 100644 --- a/components/ingress/domain/kustomization.yaml +++ b/components/ingress/domain/kustomization.yaml @@ -3,7 +3,7 @@ kind: Component replacements: - source: fieldPath: data.HOST_DOMAIN - kind: SourcegraphKustomizeConfig + kind: SourcegraphBuildConfig name: sourcegraph-kustomize-config version: v1 targets: diff --git a/components/ingress/hostname/kustomization.yaml b/components/ingress/hostname/kustomization.yaml index 5aaf2f3c..6a581982 100644 --- a/components/ingress/hostname/kustomization.yaml +++ b/components/ingress/hostname/kustomization.yaml @@ -3,7 +3,7 @@ kind: Component replacements: - source: fieldPath: data.HOST_DOMAIN - kind: SourcegraphKustomizeConfig + kind: SourcegraphBuildConfig name: sourcegraph-kustomize-config version: v1 targets: diff --git a/components/network/tls/kustomization.yaml b/components/network/tls/kustomization.yaml index 692f98bc..436d8aaa 100644 --- a/components/network/tls/kustomization.yaml +++ b/components/network/tls/kustomization.yaml @@ -4,7 +4,7 @@ kind: Component replacements: - source: fieldPath: data.TLS_HOST - kind: SourcegraphKustomizeConfig + kind: SourcegraphBuildConfig name: sourcegraph-kustomize-config version: v1 targets: @@ -16,7 +16,7 @@ replacements: name: sourcegraph-frontend - source: fieldPath: data.TLS_INGRESS_CLASS_NAME - kind: SourcegraphKustomizeConfig + kind: SourcegraphBuildConfig name: sourcegraph-kustomize-config version: v1 targets: @@ -28,7 +28,7 @@ replacements: name: sourcegraph-frontend - source: fieldPath: data.TLS_CLUSTER_ISSUER - kind: SourcegraphKustomizeConfig + kind: SourcegraphBuildConfig name: sourcegraph-kustomize-config version: v1 targets: diff --git a/components/services/redis/kustomization.yaml b/components/services/redis/kustomization.yaml index fa7126ee..11d33299 100644 --- a/components/services/redis/kustomization.yaml +++ b/components/services/redis/kustomization.yaml @@ -3,7 +3,7 @@ kind: Component replacements: - source: fieldPath: data.NEW_REDIS_CACHE_ENDPOINT - kind: SourcegraphKustomizeConfig + kind: SourcegraphBuildConfig name: sourcegraph-kustomize-config version: v1 targets: @@ -51,7 +51,7 @@ replacements: name: worker - source: fieldPath: data.NEW_REDIS_STORE_ENDPOINT - kind: SourcegraphKustomizeConfig + kind: SourcegraphBuildConfig name: sourcegraph-kustomize-config version: v1 targets: diff --git a/components/storage-class/cloud/kustomization.yaml b/components/storage-class/cloud/kustomization.yaml index 3ca25482..c5d6ca01 100644 --- a/components/storage-class/cloud/kustomization.yaml +++ b/components/storage-class/cloud/kustomization.yaml @@ -7,7 +7,7 @@ components: replacements: - source: fieldPath: data.STORAGECLASS_PROVISIONER - kind: SourcegraphKustomizeConfig + kind: SourcegraphBuildConfig name: sourcegraph-kustomize-config version: v1 targets: @@ -18,7 +18,7 @@ replacements: - provisioner - source: fieldPath: data.STORAGECLASS_PARAM_TYPE - kind: SourcegraphKustomizeConfig + kind: SourcegraphBuildConfig name: sourcegraph-kustomize-config version: v1 targets: diff --git a/components/storage-class/name-update/patches/replacement.yaml b/components/storage-class/name-update/patches/replacement.yaml index b915398a..1d666d34 100644 --- a/components/storage-class/name-update/patches/replacement.yaml +++ b/components/storage-class/name-update/patches/replacement.yaml @@ -1,6 +1,6 @@ - source: fieldPath: data.STORAGECLASS_NAME - kind: SourcegraphKustomizeConfig + kind: SourcegraphBuildConfig name: sourcegraph-kustomize-config version: v1 targets: @@ -10,7 +10,7 @@ - spec.storageClassName - source: fieldPath: data.STORAGECLASS_NAME - kind: SourcegraphKustomizeConfig + kind: SourcegraphBuildConfig name: sourcegraph-kustomize-config version: v1 targets: diff --git a/components/storage-class/ssd/kustomization.yaml b/components/storage-class/ssd/kustomization.yaml index 2236f8d6..226a48f0 100644 --- a/components/storage-class/ssd/kustomization.yaml +++ b/components/storage-class/ssd/kustomization.yaml @@ -5,7 +5,7 @@ components: replacements: - source: fieldPath: data.SSD_NODE_PATH - kind: SourcegraphKustomizeConfig + kind: SourcegraphBuildConfig name: sourcegraph-kustomize-config version: v1 targets: diff --git a/instances/template/config.yaml b/instances/template/buildConfig.template.yaml similarity index 53% rename from instances/template/config.yaml rename to instances/template/buildConfig.template.yaml index 78e12966..8fd05e1b 100644 --- a/instances/template/config.yaml +++ b/instances/template/buildConfig.template.yaml @@ -7,7 +7,7 @@ # Always refer to the component’s documentation or comments before updating ########################################################################################## apiVersion: v1 -kind: SourcegraphKustomizeConfig +kind: SourcegraphBuildConfig metadata: labels: deploy: sourcegraph-kustomize @@ -15,16 +15,16 @@ metadata: data: #-------- Update config options below ---------# EXAMPLE: __placeholder__ - AWS_MANAGED_CERT_ARN: __placeholder__ - GKE_MANAGED_CERT_NAME: __placeholder__ - HOST_DOMAIN: __placeholder__ - NEW_REDIS_CACHE_ENDPOINT: __placeholder__ - NEW_REDIS_STORE_ENDPOINT: __placeholder__ - PRIVATE_REGISTRY: __placeholder__ - SSD_NODE_PATH: __placeholder__ - STORAGECLASS_NAME: __placeholder__ - STORAGECLASS_PROVISIONER: __placeholder__ - STORAGECLASS_PARAM_TYPE: __placeholder__ - TLS_HOST: __placeholder__ - TLS_INGRESS_CLASS_NAME: __placeholder__ - TLS_CLUSTER_ISSUER: __placeholder__ + # AWS_MANAGED_CERT_ARN: __placeholder__ + # GKE_MANAGED_CERT_NAME: __placeholder__ + # HOST_DOMAIN: __placeholder__ + # NEW_REDIS_CACHE_ENDPOINT: __placeholder__ + # NEW_REDIS_STORE_ENDPOINT: __placeholder__ + # PRIVATE_REGISTRY: __placeholder__ + # SSD_NODE_PATH: __placeholder__ + # STORAGECLASS_NAME: __placeholder__ + # STORAGECLASS_PROVISIONER: __placeholder__ + # STORAGECLASS_PARAM_TYPE: __placeholder__ + # TLS_HOST: __placeholder__ + # TLS_INGRESS_CLASS_NAME: __placeholder__ + # TLS_CLUSTER_ISSUER: __placeholder__ diff --git a/instances/template/kustomization.template.yaml b/instances/template/kustomization.template.yaml index 462b2b10..0048638e 100644 --- a/instances/template/kustomization.template.yaml +++ b/instances/template/kustomization.template.yaml @@ -14,10 +14,13 @@ kind: Kustomization # You can add additional resources to the end of this section if needed ########################################################################################## resources: - - config.yaml + # [BUILD CONFIG] Include this file when using components that require "CONFIG KEY" + # - buildConfig.yaml # -- Update the CONFIG Key values in buildConfig.yaml when needed + # # [REQUIRED] Resources for the default Sourcegraph instance - ../../base/sourcegraph # -- Resources for Sourcegraph - # Add additional resources below this line if needed + # + # --- Add additional resources below this line if needed ########################################################################################## # [NAMESPACE] Add namespace to all resources generated by this overlay @@ -43,18 +46,18 @@ components: # Namespace Creation #--------------------------------------------------------------------------------------- # - ../../components/resources/namespace # -- Create namespace based on NAMESPACE input above - + # #--------------------------------------------------------------------------------------- # Resource Allocation - Instance size based #--------------------------------------------------------------------------------------- # Use size XS resources by default. Include one only. # Find your instance size on https://docs.sourcegraph.com/admin/deploy/instance-size - # - ../../components/sizes/xs # -- Allocate resources for size XS instance + - ../../components/sizes/xs # -- Allocate resources for size XS instance # - ../../components/sizes/s # -- Allocate resources for size S instance # - ../../components/sizes/m # -- Allocate resources for size M instance # - ../../components/sizes/l # -- Allocate resources for size L instance # - ../../components/sizes/xl # -- Allocate resources for size XL instance - + # #--------------------------------------------------------------------------------------- # Storage class #--------------------------------------------------------------------------------------- @@ -68,24 +71,24 @@ components: # - ../../components/storage-class/k3s # -- Configure to use the default storage class in a k3s cluster # - ../../components/storage-class/sourcegraph # -- Update storageClassName for all resources to 'sourcegraph' # - ../../components/storage-class/name-update # -- Update storageClassName to $STORAGECLASS_NAME - + # # - ../../components/storage-class/update-class-name # -- Update storageClassName to $STORAGECLASS_NAME # CONFIG KEYS: STORAGECLASS_NAME - + # # - ../../components/storage-class/cloud # -- Create a custom storage class for other cloud providers # CONFIG KEYS: STORAGECLASS_NAME # STORAGECLASS_PROVISIONER # STORAGECLASS_PARAM_TYPE - + # # - ../../components/storage-class/ssd # -- Create resources to use local SSDs - requires RBACs # CONFIG KEYS: SSD_NODE_PATH - + # #--------------------------------------------------------------------------------------- # Use private registry #--------------------------------------------------------------------------------------- # - ../../components/enable/private-registry # -- Update images name to private registry name # CONFIG KEYS: PRIVATE_REGISTRY - + # #--------------------------------------------------------------------------------------- # Monitoring Stack #--------------------------------------------------------------------------------------- @@ -96,7 +99,7 @@ components: # - ../../components/monitoring/privileged # -- Run monitoring stack with privileged and root access # - ../../components/remove/daemonset # -- Remove all services with daemonsets: node-exporter & otel # - ../../components/remove/otel-collector # -- Remove otel-collector and otel-agent - + # #--------------------------------------------------------------------------------------- # Networking #--------------------------------------------------------------------------------------- @@ -110,16 +113,18 @@ components: # - ../../components/ingress/k3s # -- Ingress controller settings for K3s # - ../../components/clusters/aws/managed-cert # -- Apply settings to frontend ingress for aws managed cert # - ../../components/clusters/gke/managed-cert # -- Apply settings to frontend ingress for gke managed cert + # # - ../../components/ingress/domain # -- Set domain for your Sourcegraph ingress # CONFIG KEYS: HOST_DOMAIN + # # - ../../components/ingress/hostname # -- Set hostname for your Sourcegraph ingress # CONFIG KEYS: HOST_DOMAIN - + # # - ../../components/network/tls # -- Enable TLS with exisiting certificates # CONFIG KEYS: TLS_HOST # TLS_INGRESS_CLASS_NAME # TLS_CLUSTER_ISSUER - + # #--------------------------------------------------------------------------------------- # External Services # You must add external instances via frontend env vars if you remove the bundled instances @@ -130,13 +135,13 @@ components: # - ../../components/remove/codeintel-db/statefulset # -- Remove default database statefulset for code-intel # - ../../components/remove/codeinsights-db/deployment # -- Remove default database deployment for code-insights # - ../../components/remove/codeinsights-db/statefulset # -- Remove default database statefulset for code-insights - + # # - ../../components/remove/redis # -- Remove embedded redis instance - + # # - ../../components/services/redis # -- Use external redis servers # CONFIG KEYS: REDIS_CACHE_ENDPOINT # REDIS_STORE_ENDPOINT - + # #--------------------------------------------------------------------------------------- # Other Configurations #--------------------------------------------------------------------------------------- @@ -153,20 +158,21 @@ components: # - ../../components/utils/uid # -- Run all Postgres database with valid users on host # - ../../components/utils/multi-version-upgrade # -- Scale down non-database pods to 0 for multi-version upgrade # - ../../components/utils/migrate-to-nonprivileged # -- Component for migrating from privileged to non-privileged - + # # ------------------------------------------------------------------------ # Keep these as the LAST components # ------------------------------------------------------------------------ # - ../../components/privileged # -- Run Sourcegraph with privileged and root access + # # Recommended for clusters with RBAC enabled. # - ../../components/enable/service-discovery # -- Enable service-discovery for frontend -# + # ########################################################################################## # [SECRETS GENERATOR] Turns the contents of the secret files into Kubernetes secrets # # Copy and paste all the associated files to the root of this directory ########################################################################################## - +# # secretGenerator: # # - SSH for Gitserver to clone repositories - # - name: gitserver-ssh @@ -183,7 +189,7 @@ components: # - name: dbs-secrets # files: # - secrets.env - +# ########################################################################################## # [CUSTOM RESOURCES] Add files as patches to customize resources # @@ -191,7 +197,7 @@ components: # instructed by the configuration docs to update ConfigMaps and other # resources using patch files to customize your deployment ########################################################################################## - +# # patches: # - patch: patches/frontend-ingress.annotations.yaml # - patch: patches/frontend-env-vars.yaml @@ -200,6 +206,7 @@ components: # - patch: patches/otel-collector.ConfigMap.yaml # - patch: patches/custom.NodePort.yaml # - patch: patches/resources.yaml +# # #--------------------------------------------------------------------------------------- # # [STORAGE SIZES] # #--------------------------------------------------------------------------------------- @@ -217,14 +224,14 @@ components: # target: # kind: StatefulSet # name: gitserver|indexed-search|searcher|symbols - +# ########################################################################################## # [BUILD CONFIGURATIONS] Handles updating configs using env vars for kustomize # # Enter the configuration values as instructed by components used # Always refer to the component’s documentation or comments before updating ########################################################################################## - +# # configMapGenerator: # # ------------------------------------------------------------------------ # # FRONTEND ENV VARS From 9f56365f5bf5c37e0fc99e35384cc7ee599aa7ba Mon Sep 17 00:00:00 2001 From: Beatrix Date: Mon, 20 Feb 2023 12:01:29 -0800 Subject: [PATCH 05/13] Drop kube-system metrics --- .../monitoring/rbacs/prometheus/prometheus.ConfigMap.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/monitoring/rbacs/prometheus/prometheus.ConfigMap.yaml b/components/monitoring/rbacs/prometheus/prometheus.ConfigMap.yaml index 07fade2f..e3f69c40 100644 --- a/components/monitoring/rbacs/prometheus/prometheus.ConfigMap.yaml +++ b/components/monitoring/rbacs/prometheus/prometheus.ConfigMap.yaml @@ -269,6 +269,9 @@ data: # - source_labels: [container_label_io_kubernetes_pod_namespace] # regex: ^$|ns-sourcegraph # ensure this matches with namespace declarations # action: keep + - source_labels: [container_label_io_kubernetes_pod_namespace] + regex: kube-system + action: drop # cAdvisor-specific customization. We want container metrics to be named after their container name label. # Note that 'io.kubernetes.container.name' and 'io.kubernetes.pod.name' must be provided in cAdvisor # '--whitelisted_container_labels' (see cadvisor.DaemonSet.yaml) From 9af38e21b5e86a24ef37de25b209590f10b9d644 Mon Sep 17 00:00:00 2001 From: Beatrix Date: Mon, 20 Feb 2023 12:11:31 -0800 Subject: [PATCH 06/13] update minikube cluster --- components/clusters/minikube/kustomization.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/clusters/minikube/kustomization.yaml b/components/clusters/minikube/kustomization.yaml index dae07e81..5907e1c7 100644 --- a/components/clusters/minikube/kustomization.yaml +++ b/components/clusters/minikube/kustomization.yaml @@ -12,7 +12,7 @@ patches: - path: patches/remove-deployment-resources-container-1.yaml target: group: apps - kind: Deployment + kind: Deployment|StatefulSet name: pgsql|redis-cache|redis-store|codeintel-db|codeinsights-db version: v1 - path: patches/remove-statefulset-resources-container-0.yaml From 7e1511a5fd2b879f6908a995e006bc50d8446ebb Mon Sep 17 00:00:00 2001 From: Beatrix Date: Tue, 21 Feb 2023 15:17:58 -0800 Subject: [PATCH 07/13] Move monitoring from components to resources --- README.md | 8 +- .../clusters/aws/eks-ebs/kustomization.yaml | 2 +- .../clusters/old-base/kustomization.yaml | 6 +- .../ingress/alb/patches/frontend.Ingress.yaml | 4 +- components/ingress/domain/kustomization.yaml | 16 --- .../domain/patches/frontend.Ingress.yaml | 5 - .../aws/{eks-ebs => aws-ebs}/README.md | 0 .../{eks-ebs => aws-ebs}/kustomization.yaml | 0 .../sourcegraph.StorageClass.yaml | 0 examples/aws/ebs/kustomization.yaml | 4 +- examples/aws/kustomization.yaml | 6 +- examples/aws/with-tracing/kustomization.yaml | 4 +- examples/base/kustomization.yaml | 4 +- examples/base/l/kustomization.yaml | 4 +- examples/base/m/kustomization.yaml | 4 +- examples/base/s/kustomization.yaml | 4 +- examples/base/xl/kustomization.yaml | 5 +- examples/base/xs/kustomization.yaml | 4 +- examples/dev/kustomization.yaml | 4 +- examples/gke/kustomization.yaml | 2 +- examples/gke/rbac/kustomization.yaml | 2 +- examples/minikube/full/kustomization.yaml | 4 +- examples/monitoring/kustomization.yaml | 4 +- .../monitoring/privileged/kustomization.yaml | 3 +- examples/privileged/kustomization.yaml | 6 +- examples/privileged/l/kustomization.yaml | 6 +- examples/privileged/m/kustomization.yaml | 6 +- examples/privileged/s/kustomization.yaml | 6 +- examples/privileged/xl/kustomization.yaml | 6 +- examples/privileged/xs/kustomization.yaml | 6 +- instances/template/buildConfig.template.yaml | 15 +- .../template/kustomization.template.yaml | 134 +++++++++++------- 32 files changed, 146 insertions(+), 138 deletions(-) delete mode 100644 components/ingress/domain/kustomization.yaml delete mode 100644 components/ingress/domain/patches/frontend.Ingress.yaml rename components/storage-class/aws/{eks-ebs => aws-ebs}/README.md (100%) rename components/storage-class/aws/{eks-ebs => aws-ebs}/kustomization.yaml (100%) rename components/storage-class/aws/{eks-ebs => aws-ebs}/sourcegraph.StorageClass.yaml (100%) diff --git a/README.md b/README.md index 89647781..e6559c84 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ [![sourcegraph: beta](https://img.shields.io/badge/sourcegraph-beta-blue.svg)](https://sourcegraph.com/github.com/sourcegraph/deploy-sourcegrap-k8s) -> **Warning** -> The contents of this repository are currently in beta and will not be officially released until v4.5.0. While we encourage testing and feedback, please do not use this in production environments. We cannot guarantee support for these beta features and recommend that you use them at your own risk. We will keep you updated as development progresses and official releases become available. +> **Note** +> This deployment method only supports Sourcegraph version 4.5.0 and above. Deploying Sourcegraph into a Kubernetes cluster is for organizations that need highly scalable and available code search and code intelligence. This repository contains documentation for creating, @@ -26,9 +26,7 @@ Please refer to the [Sourcegraph Kustomize docs](https://docs.sourcegraph.com/ad When upgrading Sourcegraph, please check the [upgrade docs for Kubernetes](https://docs.sourcegraph.com/admin/updates/kubernetes) to confirm if manual migrations is necessary. -## Development - -The `dev` branch is used to track development. +## Feedback We've made our deployment configurations open source to better serve our customers' needs. If there is anything we can do to make deploying Sourcegraph easier just [open an issue (in sourcegraph/sourcegraph)](https://github.com/sourcegraph/sourcegraph/issues/new?assignees=&labels=deploy-sourcegraph-k8s&template=deploy-sourcegraph.md&title=%5Bdeploy-sourcegraph-k8s%5D) or a pull request and we will respond as soon as possible! diff --git a/components/clusters/aws/eks-ebs/kustomization.yaml b/components/clusters/aws/eks-ebs/kustomization.yaml index b1a3428c..82c7464c 100644 --- a/components/clusters/aws/eks-ebs/kustomization.yaml +++ b/components/clusters/aws/eks-ebs/kustomization.yaml @@ -2,5 +2,5 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component components: - ../../../storage-class/sourcegraph - - ../../../storage-class/aws/eks-ebs + - ../../../storage-class/aws/aws-ebs - ../../../ingress/alb diff --git a/components/clusters/old-base/kustomization.yaml b/components/clusters/old-base/kustomization.yaml index 2370210b..213d0e8a 100644 --- a/components/clusters/old-base/kustomization.yaml +++ b/components/clusters/old-base/kustomization.yaml @@ -1,8 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 -kind: - Component - # Switch below from StatefulSet to Deployment - # Add sourcegraph as default storage class name +kind: Component components: - ../../monitoring - ../../monitoring/otel @@ -14,6 +11,7 @@ components: - ../../services/pgsql - ../../services/codeinsights-db - ../../services/codeintel-db + # Add sourcegraph as default storage class name - ../../storage-class/sourcegraph # To support searcher and symbols as both statefulset and deployment patches: diff --git a/components/ingress/alb/patches/frontend.Ingress.yaml b/components/ingress/alb/patches/frontend.Ingress.yaml index 5e4ebcf4..4c3cf605 100644 --- a/components/ingress/alb/patches/frontend.Ingress.yaml +++ b/components/ingress/alb/patches/frontend.Ingress.yaml @@ -3,6 +3,6 @@ kind: Ingress metadata: name: sourcegraph-frontend annotations: + alb.ingress.kubernetes.io/target-type: ip kubernetes.io/ingress.class: alb # aws load balancer controller ingressClass name - # additional aws alb ingress controller supported annotations - # host: $(HOST_DOMAIN) \ No newline at end of file + # Add additional aws alb ingress controller supported annotations below diff --git a/components/ingress/domain/kustomization.yaml b/components/ingress/domain/kustomization.yaml deleted file mode 100644 index e108f8a4..00000000 --- a/components/ingress/domain/kustomization.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1alpha1 -kind: Component -replacements: - - source: - fieldPath: data.HOST_DOMAIN - kind: SourcegraphBuildConfig - name: sourcegraph-kustomize-config - version: v1 - targets: - - fieldPaths: - - metadata.host - select: - kind: Ingress - name: sourcegraph-frontend -patches: - - path: patches/frontend.Ingress.yaml diff --git a/components/ingress/domain/patches/frontend.Ingress.yaml b/components/ingress/domain/patches/frontend.Ingress.yaml deleted file mode 100644 index 473c8917..00000000 --- a/components/ingress/domain/patches/frontend.Ingress.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: sourcegraph-frontend - host: $(HOST_DOMAIN) diff --git a/components/storage-class/aws/eks-ebs/README.md b/components/storage-class/aws/aws-ebs/README.md similarity index 100% rename from components/storage-class/aws/eks-ebs/README.md rename to components/storage-class/aws/aws-ebs/README.md diff --git a/components/storage-class/aws/eks-ebs/kustomization.yaml b/components/storage-class/aws/aws-ebs/kustomization.yaml similarity index 100% rename from components/storage-class/aws/eks-ebs/kustomization.yaml rename to components/storage-class/aws/aws-ebs/kustomization.yaml diff --git a/components/storage-class/aws/eks-ebs/sourcegraph.StorageClass.yaml b/components/storage-class/aws/aws-ebs/sourcegraph.StorageClass.yaml similarity index 100% rename from components/storage-class/aws/eks-ebs/sourcegraph.StorageClass.yaml rename to components/storage-class/aws/aws-ebs/sourcegraph.StorageClass.yaml diff --git a/examples/aws/ebs/kustomization.yaml b/examples/aws/ebs/kustomization.yaml index b506b924..f1368c2a 100644 --- a/examples/aws/ebs/kustomization.yaml +++ b/examples/aws/ebs/kustomization.yaml @@ -4,9 +4,9 @@ namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph -components: # Monitoring Stack - - ../../../components/monitoring + - ../../../base/monitoring +components: # Use resources for a size-XS instance - ../../../components/sizes/xs - ../../../components/clusters/aws/ebs-csi diff --git a/examples/aws/kustomization.yaml b/examples/aws/kustomization.yaml index 74053459..3acd9f61 100644 --- a/examples/aws/kustomization.yaml +++ b/examples/aws/kustomization.yaml @@ -4,9 +4,9 @@ namespace: default resources: # Sourcegraph Main Stack - ../../base/sourcegraph + # Monitoring Stack + - ../../base/monitoring components: # Use resources for a size-XS instance - ../../components/sizes/xs - - ../../components/clusters/aws/eks-ebs - # Monitoring Stack - - ../../components/monitoring + - ../../components/clusters/aws/aws-ebs diff --git a/examples/aws/with-tracing/kustomization.yaml b/examples/aws/with-tracing/kustomization.yaml index 200369e8..c8a98f49 100644 --- a/examples/aws/with-tracing/kustomization.yaml +++ b/examples/aws/with-tracing/kustomization.yaml @@ -4,9 +4,9 @@ namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph -components: # Monitoring Stack - - ../../../components/monitoring + - ../../../base/monitoring +components: - ../../../components/monitoring/tracing # Use resources for a size-XS instance - ../../../components/sizes/xs diff --git a/examples/base/kustomization.yaml b/examples/base/kustomization.yaml index c34e2e87..8301f36f 100644 --- a/examples/base/kustomization.yaml +++ b/examples/base/kustomization.yaml @@ -5,7 +5,7 @@ namespace: default resources: # Sourcegraph Main Stack - ../../base/sourcegraph -components: # Monitoring Stack - - ../../components/monitoring + - ../../base/monitoring +components: - ../../components/monitoring/tracing diff --git a/examples/base/l/kustomization.yaml b/examples/base/l/kustomization.yaml index e5a5d36c..6051ed2a 100644 --- a/examples/base/l/kustomization.yaml +++ b/examples/base/l/kustomization.yaml @@ -4,7 +4,7 @@ namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph + # Monitoring Stack + - ../../../base/monitoring components: - # Monitoring Stack - - ../../../components/monitoring - ../../../components/sizes/l diff --git a/examples/base/m/kustomization.yaml b/examples/base/m/kustomization.yaml index 4b911176..9051f8f3 100644 --- a/examples/base/m/kustomization.yaml +++ b/examples/base/m/kustomization.yaml @@ -4,7 +4,7 @@ namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph + # Monitoring Stack + - ../../../base/monitoring components: - # Monitoring Stack - - ../../../components/monitoring - ../../../components/sizes/m diff --git a/examples/base/s/kustomization.yaml b/examples/base/s/kustomization.yaml index b15d3a29..9fe5898d 100644 --- a/examples/base/s/kustomization.yaml +++ b/examples/base/s/kustomization.yaml @@ -4,7 +4,7 @@ namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph + # Monitoring Stack + - ../../../base/monitoring components: - # Monitoring Stack - - ../../../components/monitoring - ../../../components/sizes/s diff --git a/examples/base/xl/kustomization.yaml b/examples/base/xl/kustomization.yaml index eb8b4a2b..8507eaf6 100644 --- a/examples/base/xl/kustomization.yaml +++ b/examples/base/xl/kustomization.yaml @@ -1,10 +1,11 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization namespace: default +resources: resources: # Sourcegraph Main Stack - ../../../base/sourcegraph + # Monitoring Stack + - ../../../base/monitoring components: - # Monitoring Stack - - ../../../components/monitoring - ../../../components/sizes/xl diff --git a/examples/base/xs/kustomization.yaml b/examples/base/xs/kustomization.yaml index 61fff4f0..ddd4f544 100644 --- a/examples/base/xs/kustomization.yaml +++ b/examples/base/xs/kustomization.yaml @@ -4,8 +4,8 @@ namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph + # Monitoring Stack + - ../../../base/monitoring components: - # Monitoring Stack - - ../../../components/monitoring # Use resources for a size-XS instance - ../../../components/sizes/xs diff --git a/examples/dev/kustomization.yaml b/examples/dev/kustomization.yaml index a9854c66..116c8598 100644 --- a/examples/dev/kustomization.yaml +++ b/examples/dev/kustomization.yaml @@ -4,9 +4,9 @@ namespace: default resources: # Sourcegraph Main Stack - ../../base/sourcegraph -components: # Monitoring Stack - - ../../components/monitoring + - ../../base/monitoring +components: - ../../components/resources/ci-volume - ../../components/remove/resources - ../../components/remove/pvcs diff --git a/examples/gke/kustomization.yaml b/examples/gke/kustomization.yaml index 70c4e45f..7633988d 100644 --- a/examples/gke/kustomization.yaml +++ b/examples/gke/kustomization.yaml @@ -3,7 +3,7 @@ kind: Kustomization namespace: default resources: - ../../base/sourcegraph + - ../../base/monitoring components: - - ../../components/monitoring - ../../components/sizes/xs - ../../components/clusters/gke/configure diff --git a/examples/gke/rbac/kustomization.yaml b/examples/gke/rbac/kustomization.yaml index a7fb123f..6e29c60e 100644 --- a/examples/gke/rbac/kustomization.yaml +++ b/examples/gke/rbac/kustomization.yaml @@ -4,8 +4,8 @@ namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph + - ../../../base/monitoring components: - - ../../../components/monitoring - ../../../components/monitoring/cadvisor - ../../../components/monitoring/privileged # Use resources for a size-XS instance diff --git a/examples/minikube/full/kustomization.yaml b/examples/minikube/full/kustomization.yaml index 6048651d..b522194c 100644 --- a/examples/minikube/full/kustomization.yaml +++ b/examples/minikube/full/kustomization.yaml @@ -3,6 +3,6 @@ kind: Kustomization namespace: default resources: - ../../../base/sourcegraph + - ../../../base/monitoring components: - - ../../../components/monitoring - - ../../../components/clusters/minikube \ No newline at end of file + - ../../../components/clusters/minikube diff --git a/examples/monitoring/kustomization.yaml b/examples/monitoring/kustomization.yaml index ea989f49..3d6b02d7 100644 --- a/examples/monitoring/kustomization.yaml +++ b/examples/monitoring/kustomization.yaml @@ -1,5 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization namespace: default -components: - - ../../components/monitoring +resources: + - ../../base/monitoring diff --git a/examples/monitoring/privileged/kustomization.yaml b/examples/monitoring/privileged/kustomization.yaml index 03925ac4..7f95047b 100644 --- a/examples/monitoring/privileged/kustomization.yaml +++ b/examples/monitoring/privileged/kustomization.yaml @@ -1,6 +1,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization namespace: default +resources: + - ../../../base/monitoring components: - - ../../../components/monitoring - ../../../components/monitoring/privileged diff --git a/examples/privileged/kustomization.yaml b/examples/privileged/kustomization.yaml index aa94ec97..b6c883d9 100644 --- a/examples/privileged/kustomization.yaml +++ b/examples/privileged/kustomization.yaml @@ -4,11 +4,11 @@ namespace: default resources: # Sourcegraph Main Stack - ../../base/sourcegraph -components: # Monitoring Stack - - ../../components/monitoring + - ../../base/monitoring +components: - ../../components/monitoring/cadvisor - - ../../components/monitoring/privileged - ../../components/sizes/xs - ../../components/privileged + - ../../components/monitoring/privileged - ../../components/enable/service-discovery diff --git a/examples/privileged/l/kustomization.yaml b/examples/privileged/l/kustomization.yaml index 0e57ca29..657db19b 100644 --- a/examples/privileged/l/kustomization.yaml +++ b/examples/privileged/l/kustomization.yaml @@ -4,11 +4,11 @@ namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph -components: # Monitoring Stack - - ../../../components/monitoring + - ../../../base/monitoring +components: - ../../../components/monitoring/cadvisor - - ../../../components/monitoring/privileged - ../../../components/sizes/l - ../../../components/privileged + - ../../../components/monitoring/privileged - ../../../components/enable/service-discovery diff --git a/examples/privileged/m/kustomization.yaml b/examples/privileged/m/kustomization.yaml index d3fe93ef..c167ce83 100644 --- a/examples/privileged/m/kustomization.yaml +++ b/examples/privileged/m/kustomization.yaml @@ -4,11 +4,11 @@ namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph -components: # Monitoring Stack - - ../../../components/monitoring + - ../../../base/monitoring +components: - ../../../components/monitoring/cadvisor - - ../../../components/monitoring/privileged - ../../../components/sizes/m - ../../../components/privileged + - ../../../components/monitoring/privileged - ../../../components/enable/service-discovery diff --git a/examples/privileged/s/kustomization.yaml b/examples/privileged/s/kustomization.yaml index 377451d7..d1f4570e 100644 --- a/examples/privileged/s/kustomization.yaml +++ b/examples/privileged/s/kustomization.yaml @@ -4,11 +4,11 @@ namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph -components: # Monitoring Stack - - ../../../components/monitoring + - ../../../base/monitoring +components: - ../../../components/monitoring/cadvisor - - ../../../components/monitoring/privileged - ../../../components/sizes/s - ../../../components/privileged + - ../../../components/monitoring/privileged - ../../../components/enable/service-discovery diff --git a/examples/privileged/xl/kustomization.yaml b/examples/privileged/xl/kustomization.yaml index 87906975..45f83522 100644 --- a/examples/privileged/xl/kustomization.yaml +++ b/examples/privileged/xl/kustomization.yaml @@ -4,11 +4,11 @@ namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph -components: # Monitoring Stack - - ../../../components/monitoring + - ../../../base/monitoring +components: - ../../../components/monitoring/cadvisor - - ../../../components/monitoring/privileged - ../../../components/sizes/xl - ../../../components/privileged + - ../../../components/monitoring/privileged - ../../../components/enable/service-discovery diff --git a/examples/privileged/xs/kustomization.yaml b/examples/privileged/xs/kustomization.yaml index de12f47b..739346e2 100644 --- a/examples/privileged/xs/kustomization.yaml +++ b/examples/privileged/xs/kustomization.yaml @@ -4,9 +4,11 @@ namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph -components: # Monitoring Stack - - ../../../components/monitoring + - ../../../base/monitoring +components: + - ../../../components/monitoring/cadvisor - ../../../components/sizes/xs - ../../../components/privileged + - ../../../components/monitoring/privileged - ../../../components/enable/service-discovery diff --git a/instances/template/buildConfig.template.yaml b/instances/template/buildConfig.template.yaml index 8fd05e1b..b81b0db1 100644 --- a/instances/template/buildConfig.template.yaml +++ b/instances/template/buildConfig.template.yaml @@ -1,20 +1,23 @@ -########################################################################################## -# [DEPLOYMENT CONFIGURATIONS] -# Some components read the configuration values in this file during the building process +################################################################################################ +# [BUILD CONFIGURATIONS] +# Some components read the configuration values in this file during the Kustomize build-process # # HOW TO USE: -# Enter the configuration values as instructed by components used +# Enter the configuration values as instructed by components used in your kustomization.yaml # Always refer to the component’s documentation or comments before updating -########################################################################################## +################################################################################################ apiVersion: v1 kind: SourcegraphBuildConfig metadata: + annotations: + description: Some components read the configuration values from the "data" field below during the build process. You only need to update this file if you are using components that require specific CONFIG_KEYS. If no components in your overlay require extra configuration, no update is necessary. labels: deploy: sourcegraph-kustomize name: sourcegraph-kustomize-config data: + # example: + EXAMPLE_CONFIG_KEY: example #-------- Update config options below ---------# - EXAMPLE: __placeholder__ # AWS_MANAGED_CERT_ARN: __placeholder__ # GKE_MANAGED_CERT_NAME: __placeholder__ # HOST_DOMAIN: __placeholder__ diff --git a/instances/template/kustomization.template.yaml b/instances/template/kustomization.template.yaml index ee7095f7..4ecaa290 100644 --- a/instances/template/kustomization.template.yaml +++ b/instances/template/kustomization.template.yaml @@ -7,40 +7,36 @@ ########################################################################################## apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization - ########################################################################################## # [RESOURCES] Resources with default settings # # You can add additional resources to the end of this section if needed ########################################################################################## resources: - # [BUILD CONFIG] Include this file when using components that require "CONFIG KEY" - # - buildConfig.yaml # -- Update the CONFIG Key values in buildConfig.yaml when needed - # - # [REQUIRED] Resources for the default Sourcegraph instance + # [REQUIRED: BUILD CONFIG] Update this file when using components that have "CONFIG KEYS" + - buildConfig.yaml # -- Update the CONFIG Key values in buildConfig.yaml when instructed + # [REQUIRED: RESOURCES] Resources for the default Sourcegraph instance - ../../base/sourcegraph # -- Resources for Sourcegraph - # - # --- Add additional resources below this line if needed - + - ../../base/monitoring # -- Resources for Sourcegraph Monitoring Stack + # ---------------- Add additional resources below this line if needed ---------------- # + # - ########################################################################################## # [NAMESPACE] Add namespace to all resources generated by this overlay # # NOTE: Include the 'namespace' component to create namespace with the same name if needed ########################################################################################## namespace: sourcegraph - ########################################################################################## # [COMPONENTS] Uncomment the lines for the components you'd like to include # # To configure your Sourcegraph deployment, uncomment the components/section # below following the instructions in our configuration docs. # -# Components with CONFIG KEYS require additional input in the config.yaml file +# Components with CONFIG KEYS require additional input in the ./buildConfig.yaml file # # Docs: # https://docs.sourcegraph.com/admin/deploy/kubernetes/kustomize/configure ########################################################################################## - components: #--------------------------------------------------------------------------------------- # Namespace Creation @@ -48,6 +44,15 @@ components: # - ../../components/resources/namespace # -- Create namespace based on NAMESPACE input above # #--------------------------------------------------------------------------------------- + # Monitoring Stack + #--------------------------------------------------------------------------------------- + # - ../../components/monitoring/otel # -- Deploy OpenTelemetry Collector + # - ../../components/monitoring/tracing # -- Deploy OpenTelemetry Collector with Jaeger as tracing backend + # - ../../components/monitoring/cadvisor # -- Add resources for cAdvisor (requires privileges) + # - ../../components/remove/daemonset # -- Remove all services with daemonsets: node-exporter & otel + # - ../../components/remove/otel-collector # -- Remove otel-collector and otel-agent + # + #--------------------------------------------------------------------------------------- # Resource Allocation - Instance size based #--------------------------------------------------------------------------------------- # Use size XS resources by default. Include one only. @@ -61,7 +66,8 @@ components: #--------------------------------------------------------------------------------------- # Storage class #--------------------------------------------------------------------------------------- - # - ../../components/storage-class/aws # -- Create storage class resources for AWS EKS + # - ../../components/storage-class/aws/aws-ebs # -- Create storage class resources for AWS when provisioner = `kubernetes.io/aws-ebs` + # - ../../components/storage-class/aws/ebs-csi # -- Create storage class resources for AWS when provisioner = `ebs.csi.aws.com` # - ../../components/storage-class/azure # -- Create storage class resources for Azure AKS # - ../../components/storage-class/gcp # -- Create storage class resources for GCP GKE # - ../../components/storage-class/cloud # -- Create storage class resources for other cloud provider @@ -70,9 +76,8 @@ components: # - ../../components/storage-class/trident/xfs # -- Create storage class resources for Trident, fsType xfs # - ../../components/storage-class/k3s # -- Configure to use the default storage class in a k3s cluster # - ../../components/storage-class/sourcegraph # -- Update storageClassName for all resources to 'sourcegraph' - # - ../../components/storage-class/name-update # -- Update storageClassName to $STORAGECLASS_NAME # - # - ../../components/storage-class/update-class-name # -- Update storageClassName to $STORAGECLASS_NAME + # - ../../components/storage-class/name-update # -- Update storageClassName to $STORAGECLASS_NAME # CONFIG KEYS: STORAGECLASS_NAME # # - ../../components/storage-class/cloud # -- Create a custom storage class for other cloud providers @@ -84,23 +89,6 @@ components: # CONFIG KEYS: SSD_NODE_PATH # #--------------------------------------------------------------------------------------- - # Use private registry - #--------------------------------------------------------------------------------------- - # - ../../components/enable/private-registry # -- Update images name to private registry name - # CONFIG KEYS: PRIVATE_REGISTRY - # - #--------------------------------------------------------------------------------------- - # Monitoring Stack - #--------------------------------------------------------------------------------------- - - ../../components/monitoring # -- Add default resources for Sourcegraph monitoring services - # - ../../components/monitoring/otel # -- Deploy OpenTelemetry Collector - # - ../../components/monitoring/tracing # -- Deploy OpenTelemetry Collector with Jaeger as tracing backend - # - ../../components/monitoring/cadvisor # -- Add resources for cAdvisor (requires privileges) - # - ../../components/monitoring/privileged # -- Run monitoring stack with privileged and root access - # - ../../components/remove/daemonset # -- Remove all services with daemonsets: node-exporter & otel - # - ../../components/remove/otel-collector # -- Remove otel-collector and otel-agent - # - #--------------------------------------------------------------------------------------- # Networking #--------------------------------------------------------------------------------------- # - ../../components/remove/default-ingress # -- Remove the default ingress from frontend @@ -114,10 +102,7 @@ components: # - ../../components/clusters/aws/managed-cert # -- Apply settings to frontend ingress for aws managed cert # - ../../components/clusters/gke/managed-cert # -- Apply settings to frontend ingress for gke managed cert # - # - ../../components/ingress/domain # -- Set domain for your Sourcegraph ingress - # CONFIG KEYS: HOST_DOMAIN - # - # - ../../components/ingress/hostname # -- Set hostname for your Sourcegraph ingress + # - ../../components/ingress/hostname # -- Set hostname/domain for your Sourcegraph ingress # CONFIG KEYS: HOST_DOMAIN # # - ../../components/network/tls # -- Enable TLS with exisiting certificates @@ -149,59 +134,73 @@ components: # - ../../components/clusters/minikube # -- Configure instance to run in a minikube cluster (storage class, network, etc) # - ../../components/enable/rockskip # -- Enable rockskip # - ../../components/disable/rockskip # -- Disable rockskip - # - ../../components/enable/ssh/non-root # Enable SSH to clon repositories as non-root user - # - ../../components/enable/ssh/root # Enable SSH to clon repositories as root user + # - ../../components/enable/ssh/non-root # Enable SSH to clon repositories as non-root user (default) + # - ../../components/enable/ssh/root # Enable SSH to clon repositories as root user (when using privileged component) # - ../../components/remove/pvcs # -- Remove all pvcs resources - # ../../components/remove/prometheus # -- Remove prometheus + # - ../../components/remove/prometheus # -- Remove prometheus # - ../../components/remove/resources # -- Remove resources (Limits, requests) from all containers # - ../../components/remove/security-context # -- Remove security context from all resources # - ../../components/utils/uid # -- Run all Postgres database with valid users on host # - ../../components/utils/multi-version-upgrade # -- Scale down non-database pods to 0 for multi-version upgrade # - ../../components/utils/migrate-to-nonprivileged # -- Component for migrating from privileged to non-privileged # + #--------------------------------------------------------------------------------------- + # Use private registry + #--------------------------------------------------------------------------------------- + # - ../../components/enable/private-registry # -- Update images name to private registry name + # CONFIG KEYS: PRIVATE_REGISTRY + # # ------------------------------------------------------------------------ - # Keep these as the LAST components + # Permission Configurations + # IMPORTANT: Keep the components below as the LAST components # ------------------------------------------------------------------------ # - ../../components/privileged # -- Run Sourcegraph with privileged and root access + # - ../../components/monitoring/privileged # -- Run monitoring stack with privileged and root access # # Recommended for clusters with RBAC enabled. # - ../../components/enable/service-discovery # -- Enable service-discovery for frontend - # +# +# ########################################################################################## # [SECRETS GENERATOR] Turns the contents of the secret files into Kubernetes secrets # # Copy and paste all the associated files to the root of this directory ########################################################################################## -# # secretGenerator: +# # # - SSH for Gitserver to clone repositories - # - name: gitserver-ssh # files: # - id_rsa # - known_hosts +# # # - TLS - # - name: sourcegraph-frontend-tls # behavior: create # files: # - tls.crt # - tls.key +# # # - Database - # - name: dbs-secrets # files: # - secrets.env # +# ########################################################################################## # [CUSTOM RESOURCES] Add files as patches to customize resources # # Create a directory `patches` and then copy the required files as # instructed by the configuration docs to update ConfigMaps and other # resources using patch files to customize your deployment +# Do not use the built-in replcias field to update replica counts ########################################################################################## # - # patches: +# #--------------------------------------------------------------------------------------- +# # custom patches +# #--------------------------------------------------------------------------------------- # - patch: patches/frontend-ingress.annotations.yaml -# - patch: patches/frontend-env-vars.yaml # - patch: patches/prometheus.ConfigMap.yaml # - patch: patches/pgsql.ConfigMap.yaml # - patch: patches/otel-collector.ConfigMap.yaml @@ -209,7 +208,40 @@ components: # - patch: patches/resources.yaml # # #--------------------------------------------------------------------------------------- -# # [STORAGE SIZES] +# # Update env vars for non-frontend services +# #--------------------------------------------------------------------------------------- +# - patch: |- +# - op: add +# path: /spec/template/spec/containers/0/env/- +# value: +# name: SRC_ENABLE_GC_AUTO +# value: "true" +# target: +# name: gitserver +# kind: StatefulSet +# +# - patch: |- +# - op: replace +# path: /spec/template/spec/containers/0/env/0 +# value: +# name: SEARCHER_CACHE_SIZE_MB +# value: "50000" +# target: +# name: searcher +# kind: StatefulSet|Deployment +# +# - patch: |- +# - op: replace +# path: /spec/template/spec/containers/0/env/0 +# value: +# name: SYMBOLS_CACHE_SIZE_MB +# value: "50000" +# target: +# name: symbols +# kind: StatefulSet|Deployment +# +# #--------------------------------------------------------------------------------------- +# # Adjust Storage Sizes # #--------------------------------------------------------------------------------------- # - patch: |- # - op: replace @@ -218,6 +250,7 @@ components: # target: # kind: PersistentVolumeClaim # name: blobstore|codeinsights-db|codeintel-db|pgsql|prometheus|redis-store|redis-cache +# # - patch: |- # - op: replace # path: /spec/volumeClaimTemplates/0/spec/resources/requests/storage @@ -226,21 +259,14 @@ components: # kind: StatefulSet # name: gitserver|indexed-search|searcher|symbols # - -########################################################################################## -# [BUILD CONFIGURATIONS] Handles updating configs using env vars for kustomize # -# Enter the configuration values as instructed by components used -# Always refer to the component’s documentation or comments before updating +########################################################################################## +# [FRONTEND ENV VARS] Handles updating env vars for sourcegraph-frontend ########################################################################################## # # configMapGenerator: -# # ------------------------------------------------------------------------ -# # FRONTEND ENV VARS -# # ------------------------------------------------------------------------ # - name: sourcegraph-frontend-env # behavior: merge # literals: # - DEPLOY_TYPE=kustomize # make your edit below this line -# replacements: -# - path: ../../components/storage-class/name-update/replacement.yaml +# From 0be66b8b7d8f4a38b39236a62d8fe8e63ab2e00d Mon Sep 17 00:00:00 2001 From: Beatrix Date: Wed, 22 Feb 2023 09:50:59 -0800 Subject: [PATCH 08/13] remove default namespace from examples --- .../prometheus/prometheus.ConfigMap.yaml | 45 ++++++++++++++++++- .../prometheus/prometheus.Deployment.yaml | 5 +++ .../aws/{eks-ebs => aws-ebs}/README.md | 0 .../{eks-ebs => aws-ebs}/kustomization.yaml | 2 +- .../clusters/aws/ebs-csi/kustomization.yaml | 2 +- examples/aws/ebs/kustomization.yaml | 1 - examples/aws/kustomization.yaml | 1 - examples/aws/with-tracing/kustomization.yaml | 1 - examples/base/kustomization.yaml | 1 - examples/base/l/kustomization.yaml | 1 - examples/base/m/kustomization.yaml | 1 - examples/base/s/kustomization.yaml | 1 - examples/base/xl/kustomization.yaml | 2 - examples/base/xs/kustomization.yaml | 1 - examples/dev/kustomization.yaml | 1 - examples/gke/kustomization.yaml | 1 - examples/gke/rbac/kustomization.yaml | 1 - examples/k3s/kustomization.yaml | 1 - examples/k3s/l/kustomization.yaml | 1 - examples/k3s/m/kustomization.yaml | 1 - examples/k3s/s/kustomization.yaml | 1 - examples/k3s/xl/kustomization.yaml | 1 - examples/k3s/xs/kustomization.yaml | 1 - examples/migrator/kustomization.yaml | 1 - examples/minikube/full/kustomization.yaml | 1 - examples/minikube/kustomization.yaml | 1 - .../monitoring/cadvisor/kustomization.yaml | 1 - examples/monitoring/kustomization.yaml | 1 - .../monitoring/privileged/kustomization.yaml | 1 - examples/old-cluster/kustomization.yaml | 1 - examples/privileged/kustomization.yaml | 1 - examples/privileged/l/kustomization.yaml | 1 - examples/privileged/m/kustomization.yaml | 1 - examples/privileged/s/kustomization.yaml | 1 - examples/privileged/xl/kustomization.yaml | 1 - examples/privileged/xs/kustomization.yaml | 1 - instances/README.md | 12 ++++- .../template/kustomization.template.yaml | 3 +- 38 files changed, 61 insertions(+), 40 deletions(-) rename components/clusters/aws/{eks-ebs => aws-ebs}/README.md (100%) rename components/clusters/aws/{eks-ebs => aws-ebs}/kustomization.yaml (100%) diff --git a/base/monitoring/prometheus/prometheus.ConfigMap.yaml b/base/monitoring/prometheus/prometheus.ConfigMap.yaml index 17bec0f3..980dda74 100644 --- a/base/monitoring/prometheus/prometheus.ConfigMap.yaml +++ b/base/monitoring/prometheus/prometheus.ConfigMap.yaml @@ -56,8 +56,12 @@ data: - '/sg_prometheus_add_ons/*_targets.yml' - job_name: 'cadvisor' - static_configs: - - targets: ['cadvisor:48080'] + dns_sd_configs: + - names: + - 'cadvisor.default.svc.cluster.local' + - 'cadvisor.ns-sourcegraph.svc.cluster.local' + type: A + port: 48080 relabel_configs: - source_labels: [__address__] target_label: instance @@ -74,6 +78,38 @@ data: action: replace target_label: name separator: '-' + # - source_labels: [container_label_io_kubernetes_pod_namespace] + # regex: ^$|ns-sourcegraph # ACTION: replace ns-sourcegraph with your namespace + # action: keep + + - job_name: 'sourcegraph-statefulsets' + dns_sd_configs: + - names: + - 'symbols.default.svc.cluster.local' + - 'symbols.ns-sourcegraph.svc.cluster.local' + - 'searcher.default.svc.cluster.local' + - 'searcher.ns-sourcegraph.svc.cluster.local' + - 'gitserver.default.svc.cluster.local' + - 'gitserver.ns-sourcegraph.svc.cluster.local' + - 'sourcegraph-frontend.default.svc.cluster.local' + - 'sourcegraph-frontend.ns-sourcegraph.svc.cluster.local' + type: A + port: 6060 + - names: + - 'indexed-search.default.svc.cluster.local' + - 'indexed-search.ns-sourcegraph.svc.cluster.local' + type: A + port: 6070 + - names: + - 'indexed-search-indexer.default.svc.cluster.local' + - 'indexed-search-indexer.ns-sourcegraph.svc.cluster.local' + type: A + port: 6072 + relabel_configs: + - source_labels: [__meta_dns_name] + target_label: service_name + regex: (.*)\..*\..*\..*\..* + replacement: ${1} # Extra rules extra_rules.yml: | @@ -91,6 +127,11 @@ data: # List of static targets prometheus_targets.yml: | + - labels: + nodename: "sourcegraph-services" + job: cadvisor + targets: + - cadvisor:48080 - labels: nodename: "sourcegraph-services" job: sourcegraph-frontend diff --git a/base/monitoring/prometheus/prometheus.Deployment.yaml b/base/monitoring/prometheus/prometheus.Deployment.yaml index f3992a28..a1360e56 100644 --- a/base/monitoring/prometheus/prometheus.Deployment.yaml +++ b/base/monitoring/prometheus/prometheus.Deployment.yaml @@ -27,6 +27,11 @@ spec: - name: prometheus image: index.docker.io/sourcegraph/prometheus:4.4.2@sha256:d833d00a39937cf700f276f816dc789615d6396979418a7d9362386513b1fc9d terminationMessagePolicy: FallbackToLogsOnError + env: + - name: MY_POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace readinessProbe: httpGet: path: /-/ready diff --git a/components/clusters/aws/eks-ebs/README.md b/components/clusters/aws/aws-ebs/README.md similarity index 100% rename from components/clusters/aws/eks-ebs/README.md rename to components/clusters/aws/aws-ebs/README.md diff --git a/components/clusters/aws/eks-ebs/kustomization.yaml b/components/clusters/aws/aws-ebs/kustomization.yaml similarity index 100% rename from components/clusters/aws/eks-ebs/kustomization.yaml rename to components/clusters/aws/aws-ebs/kustomization.yaml index 82c7464c..73e6d735 100644 --- a/components/clusters/aws/eks-ebs/kustomization.yaml +++ b/components/clusters/aws/aws-ebs/kustomization.yaml @@ -1,6 +1,6 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component components: - - ../../../storage-class/sourcegraph - ../../../storage-class/aws/aws-ebs + - ../../../storage-class/sourcegraph - ../../../ingress/alb diff --git a/components/clusters/aws/ebs-csi/kustomization.yaml b/components/clusters/aws/ebs-csi/kustomization.yaml index c9a277f9..8ae981f8 100644 --- a/components/clusters/aws/ebs-csi/kustomization.yaml +++ b/components/clusters/aws/ebs-csi/kustomization.yaml @@ -1,6 +1,6 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component components: - - ../../../storage-class/sourcegraph - ../../../storage-class/aws/ebs-csi + - ../../../storage-class/sourcegraph - ../../../ingress/alb diff --git a/examples/aws/ebs/kustomization.yaml b/examples/aws/ebs/kustomization.yaml index f1368c2a..33f08725 100644 --- a/examples/aws/ebs/kustomization.yaml +++ b/examples/aws/ebs/kustomization.yaml @@ -1,6 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph diff --git a/examples/aws/kustomization.yaml b/examples/aws/kustomization.yaml index 3acd9f61..429a4a74 100644 --- a/examples/aws/kustomization.yaml +++ b/examples/aws/kustomization.yaml @@ -1,6 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: # Sourcegraph Main Stack - ../../base/sourcegraph diff --git a/examples/aws/with-tracing/kustomization.yaml b/examples/aws/with-tracing/kustomization.yaml index c8a98f49..6619ee59 100644 --- a/examples/aws/with-tracing/kustomization.yaml +++ b/examples/aws/with-tracing/kustomization.yaml @@ -1,6 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph diff --git a/examples/base/kustomization.yaml b/examples/base/kustomization.yaml index 8301f36f..890b121f 100644 --- a/examples/base/kustomization.yaml +++ b/examples/base/kustomization.yaml @@ -1,6 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default # Run all services with default values resources: # Sourcegraph Main Stack diff --git a/examples/base/l/kustomization.yaml b/examples/base/l/kustomization.yaml index 6051ed2a..1730ecbc 100644 --- a/examples/base/l/kustomization.yaml +++ b/examples/base/l/kustomization.yaml @@ -1,6 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph diff --git a/examples/base/m/kustomization.yaml b/examples/base/m/kustomization.yaml index 9051f8f3..766c72e1 100644 --- a/examples/base/m/kustomization.yaml +++ b/examples/base/m/kustomization.yaml @@ -1,6 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph diff --git a/examples/base/s/kustomization.yaml b/examples/base/s/kustomization.yaml index 9fe5898d..e30d157b 100644 --- a/examples/base/s/kustomization.yaml +++ b/examples/base/s/kustomization.yaml @@ -1,6 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph diff --git a/examples/base/xl/kustomization.yaml b/examples/base/xl/kustomization.yaml index 8507eaf6..9cb6b69b 100644 --- a/examples/base/xl/kustomization.yaml +++ b/examples/base/xl/kustomization.yaml @@ -1,7 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default -resources: resources: # Sourcegraph Main Stack - ../../../base/sourcegraph diff --git a/examples/base/xs/kustomization.yaml b/examples/base/xs/kustomization.yaml index ddd4f544..b11ec73c 100644 --- a/examples/base/xs/kustomization.yaml +++ b/examples/base/xs/kustomization.yaml @@ -1,6 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph diff --git a/examples/dev/kustomization.yaml b/examples/dev/kustomization.yaml index 116c8598..4f070755 100644 --- a/examples/dev/kustomization.yaml +++ b/examples/dev/kustomization.yaml @@ -1,6 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: # Sourcegraph Main Stack - ../../base/sourcegraph diff --git a/examples/gke/kustomization.yaml b/examples/gke/kustomization.yaml index 7633988d..4ee8945b 100644 --- a/examples/gke/kustomization.yaml +++ b/examples/gke/kustomization.yaml @@ -1,6 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: - ../../base/sourcegraph - ../../base/monitoring diff --git a/examples/gke/rbac/kustomization.yaml b/examples/gke/rbac/kustomization.yaml index 6e29c60e..cbcdff95 100644 --- a/examples/gke/rbac/kustomization.yaml +++ b/examples/gke/rbac/kustomization.yaml @@ -1,6 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph diff --git a/examples/k3s/kustomization.yaml b/examples/k3s/kustomization.yaml index 6d7be908..74e5e44e 100644 --- a/examples/k3s/kustomization.yaml +++ b/examples/k3s/kustomization.yaml @@ -1,7 +1,6 @@ # Includes RBAC resources apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: # Sourcegraph Main Stack - ../../base/sourcegraph diff --git a/examples/k3s/l/kustomization.yaml b/examples/k3s/l/kustomization.yaml index 86125910..914a4834 100644 --- a/examples/k3s/l/kustomization.yaml +++ b/examples/k3s/l/kustomization.yaml @@ -1,7 +1,6 @@ # Includes RBAC resources apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph diff --git a/examples/k3s/m/kustomization.yaml b/examples/k3s/m/kustomization.yaml index 9c1e5e6e..c0c02271 100644 --- a/examples/k3s/m/kustomization.yaml +++ b/examples/k3s/m/kustomization.yaml @@ -1,7 +1,6 @@ # Includes RBAC resources apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph diff --git a/examples/k3s/s/kustomization.yaml b/examples/k3s/s/kustomization.yaml index b15da606..dd445d86 100644 --- a/examples/k3s/s/kustomization.yaml +++ b/examples/k3s/s/kustomization.yaml @@ -1,7 +1,6 @@ # Includes RBAC resources apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph diff --git a/examples/k3s/xl/kustomization.yaml b/examples/k3s/xl/kustomization.yaml index 6a41c210..4772b926 100644 --- a/examples/k3s/xl/kustomization.yaml +++ b/examples/k3s/xl/kustomization.yaml @@ -1,7 +1,6 @@ # Includes RBAC resources apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph diff --git a/examples/k3s/xs/kustomization.yaml b/examples/k3s/xs/kustomization.yaml index a863dc8c..e9fe2dfb 100644 --- a/examples/k3s/xs/kustomization.yaml +++ b/examples/k3s/xs/kustomization.yaml @@ -1,7 +1,6 @@ # Includes RBAC resources apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph diff --git a/examples/migrator/kustomization.yaml b/examples/migrator/kustomization.yaml index 2e46ac7d..540144f9 100644 --- a/examples/migrator/kustomization.yaml +++ b/examples/migrator/kustomization.yaml @@ -1,6 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default components: - ../../components/utils/migrator diff --git a/examples/minikube/full/kustomization.yaml b/examples/minikube/full/kustomization.yaml index b522194c..411a2b78 100644 --- a/examples/minikube/full/kustomization.yaml +++ b/examples/minikube/full/kustomization.yaml @@ -1,6 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: - ../../../base/sourcegraph - ../../../base/monitoring diff --git a/examples/minikube/kustomization.yaml b/examples/minikube/kustomization.yaml index a7c54bb6..4a3c28ea 100644 --- a/examples/minikube/kustomization.yaml +++ b/examples/minikube/kustomization.yaml @@ -1,6 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: - ../../base/sourcegraph components: diff --git a/examples/monitoring/cadvisor/kustomization.yaml b/examples/monitoring/cadvisor/kustomization.yaml index 724f864e..6c16e5d3 100644 --- a/examples/monitoring/cadvisor/kustomization.yaml +++ b/examples/monitoring/cadvisor/kustomization.yaml @@ -1,5 +1,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default components: - ../../../components/monitoring/cadvisor diff --git a/examples/monitoring/kustomization.yaml b/examples/monitoring/kustomization.yaml index 3d6b02d7..865b0076 100644 --- a/examples/monitoring/kustomization.yaml +++ b/examples/monitoring/kustomization.yaml @@ -1,5 +1,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: - ../../base/monitoring diff --git a/examples/monitoring/privileged/kustomization.yaml b/examples/monitoring/privileged/kustomization.yaml index 7f95047b..056f279f 100644 --- a/examples/monitoring/privileged/kustomization.yaml +++ b/examples/monitoring/privileged/kustomization.yaml @@ -1,6 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: - ../../../base/monitoring components: diff --git a/examples/old-cluster/kustomization.yaml b/examples/old-cluster/kustomization.yaml index d1f8fccd..5b5c41f1 100644 --- a/examples/old-cluster/kustomization.yaml +++ b/examples/old-cluster/kustomization.yaml @@ -1,6 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: # Sourcegraph Main Stack - ../../base/sourcegraph diff --git a/examples/privileged/kustomization.yaml b/examples/privileged/kustomization.yaml index b6c883d9..a571f9c3 100644 --- a/examples/privileged/kustomization.yaml +++ b/examples/privileged/kustomization.yaml @@ -1,6 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: # Sourcegraph Main Stack - ../../base/sourcegraph diff --git a/examples/privileged/l/kustomization.yaml b/examples/privileged/l/kustomization.yaml index 657db19b..db827fc5 100644 --- a/examples/privileged/l/kustomization.yaml +++ b/examples/privileged/l/kustomization.yaml @@ -1,6 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph diff --git a/examples/privileged/m/kustomization.yaml b/examples/privileged/m/kustomization.yaml index c167ce83..e4fc7d7c 100644 --- a/examples/privileged/m/kustomization.yaml +++ b/examples/privileged/m/kustomization.yaml @@ -1,6 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph diff --git a/examples/privileged/s/kustomization.yaml b/examples/privileged/s/kustomization.yaml index d1f4570e..b1d0b032 100644 --- a/examples/privileged/s/kustomization.yaml +++ b/examples/privileged/s/kustomization.yaml @@ -1,6 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph diff --git a/examples/privileged/xl/kustomization.yaml b/examples/privileged/xl/kustomization.yaml index 45f83522..35a27c64 100644 --- a/examples/privileged/xl/kustomization.yaml +++ b/examples/privileged/xl/kustomization.yaml @@ -1,6 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph diff --git a/examples/privileged/xs/kustomization.yaml b/examples/privileged/xs/kustomization.yaml index 739346e2..a02c391a 100644 --- a/examples/privileged/xs/kustomization.yaml +++ b/examples/privileged/xs/kustomization.yaml @@ -1,6 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph diff --git a/instances/README.md b/instances/README.md index 2c2e8dca..632a58df 100644 --- a/instances/README.md +++ b/instances/README.md @@ -6,12 +6,14 @@ See the [Sourcegraph Kustomize docs](https://docs.sourcegraph.com/admin/deploy/k The [instances/template](template) folder contains a file named [kustomization.template.yaml](template/kustomization.template.yaml)) that is preconfigured to construct a Kustomize overlay for deploying Sourcegraph. -**Step 1**: Create a new directory within the `instances` subdirectory. +**Step 1**: Create a new directory named `$INSTANCE_NAME` within the `instances` subdirectory -- The name of this directory, $INSTANCE_NAME, serves as the name of your overlay, for example, dev, prod, staging, etc. +- The name of this directory, `$INSTANCE_NAME`, serves as the name of your overlay (ex. dev, prod, staging, etc). ```bash # from the root of this repository +# replace production with the name of your choice +export INSTANCE_NAME=production mkdir instances/$INSTANCE_NAME ``` @@ -21,4 +23,10 @@ mkdir instances/$INSTANCE_NAME cp instances/template/kustomization.template.yaml instances/$INSTANCE_NAME/kustomization.yaml ``` +**Step 3**: Copy the `buildConfig.template.yaml` file from the `instances/template` directory to the new directory created in step 1, and rename it to `buildConfig.yaml`. + +```bash +cp instances/template/buildConfig.template.yaml instances/$INSTANCE_NAME/buildConfig.yaml +``` + **Step 3**: You can begin customizing your Sourcegraph deployment by updating the [kustomization.yaml file](https://docs.sourcegraph.com/admin/deploy/kubernetes/kustomize/intro#kustomization-yaml) inside $INSTANCE_NAME (the directory for your instance). Please follow our [configuration guides](https://docs.sourcegraph.com/admin/deploy/kubernetes/kustomize/configure.md) for guidance. diff --git a/instances/template/kustomization.template.yaml b/instances/template/kustomization.template.yaml index 4ecaa290..43a23efc 100644 --- a/instances/template/kustomization.template.yaml +++ b/instances/template/kustomization.template.yaml @@ -25,7 +25,7 @@ resources: # # NOTE: Include the 'namespace' component to create namespace with the same name if needed ########################################################################################## -namespace: sourcegraph +namespace: ns-sourcegraph ########################################################################################## # [COMPONENTS] Uncomment the lines for the components you'd like to include # @@ -120,7 +120,6 @@ components: # - ../../components/remove/codeintel-db/statefulset # -- Remove default database statefulset for code-intel # - ../../components/remove/codeinsights-db/deployment # -- Remove default database deployment for code-insights # - ../../components/remove/codeinsights-db/statefulset # -- Remove default database statefulset for code-insights - # # - ../../components/remove/redis # -- Remove embedded redis instance # # - ../../components/services/redis # -- Use external redis servers From 02babd3c72e718a50f9e68765c615ea9be1ad792 Mon Sep 17 00:00:00 2001 From: Beatrix Date: Wed, 22 Feb 2023 15:40:51 -0800 Subject: [PATCH 09/13] Add ns-sourcegraph as default namespace --- .../grafana/rbac}/grafana.ServiceAccount.yaml | 0 .../grafana/rbac/kustomization.yaml | 4 ++ .../prometheus/prometheus.ConfigMap.yaml | 65 +++++++------------ .../prometheus/prometheus.Deployment.yaml | 3 +- .../prometheus/rbac/kustomization.yaml | 7 ++ .../rbac}/prometheus.ClusterRole.yaml | 0 .../rbac}/prometheus.ClusterRoleBinding.yaml | 0 .../rbac}/prometheus.ConfigMap.yaml | 2 +- .../rbac}/prometheus.ServiceAccount.yaml | 0 .../frontend/rbac/kustomization.yaml | 6 ++ .../rbac/sourcegraph-frontend.Role.yaml | 0 .../sourcegraph-frontend.RoleBinding.yaml | 4 +- .../sourcegraph-frontend.ServiceAccount.yaml | 4 +- .../clusters/old-base/kustomization.yaml | 5 +- .../service-discovery/kustomization.yaml | 4 +- .../monitoring/rbacs/kustomization.yaml | 28 ++++++-- .../prometheus/prometheus.Deployment.yaml | 5 ++ examples/aws/ebs/kustomization.yaml | 3 +- examples/aws/kustomization.yaml | 3 +- examples/aws/with-tracing/kustomization.yaml | 3 +- examples/base/kustomization.yaml | 4 +- examples/base/l/kustomization.yaml | 2 + examples/base/m/kustomization.yaml | 2 + examples/base/s/kustomization.yaml | 2 + examples/base/xl/kustomization.yaml | 2 + examples/base/xs/kustomization.yaml | 2 + examples/dev/kustomization.yaml | 4 +- examples/gke/kustomization.yaml | 3 + examples/gke/rbac/kustomization.yaml | 6 +- examples/k3s/kustomization.yaml | 3 +- examples/k3s/l/kustomization.yaml | 1 + examples/k3s/m/kustomization.yaml | 1 + examples/k3s/s/kustomization.yaml | 1 + examples/k3s/xl/kustomization.yaml | 1 + examples/k3s/xs/kustomization.yaml | 1 + examples/migrator/kustomization.yaml | 1 + examples/minikube/full/kustomization.yaml | 4 ++ examples/minikube/kustomization.yaml | 3 + .../monitoring/cadvisor/kustomization.yaml | 1 + examples/monitoring/kustomization.yaml | 1 + .../monitoring/privileged/kustomization.yaml | 1 + examples/old-cluster/kustomization.yaml | 3 + examples/privileged/kustomization.yaml | 4 +- examples/privileged/l/kustomization.yaml | 4 +- examples/privileged/m/kustomization.yaml | 4 +- examples/privileged/s/kustomization.yaml | 4 +- examples/privileged/xl/kustomization.yaml | 4 +- examples/privileged/xs/kustomization.yaml | 4 +- 48 files changed, 142 insertions(+), 77 deletions(-) rename {components/monitoring/rbacs/grafana => base/monitoring/grafana/rbac}/grafana.ServiceAccount.yaml (100%) create mode 100644 base/monitoring/grafana/rbac/kustomization.yaml create mode 100644 base/monitoring/prometheus/rbac/kustomization.yaml rename {components/monitoring/rbacs/prometheus => base/monitoring/prometheus/rbac}/prometheus.ClusterRole.yaml (100%) rename {components/monitoring/rbacs/prometheus => base/monitoring/prometheus/rbac}/prometheus.ClusterRoleBinding.yaml (100%) rename {components/monitoring/rbacs/prometheus => base/monitoring/prometheus/rbac}/prometheus.ConfigMap.yaml (99%) rename {components/monitoring/rbacs/prometheus => base/monitoring/prometheus/rbac}/prometheus.ServiceAccount.yaml (100%) create mode 100644 base/sourcegraph/frontend/rbac/kustomization.yaml rename {components/enable/service-discovery => base/sourcegraph/frontend}/rbac/sourcegraph-frontend.Role.yaml (100%) rename {components/enable/service-discovery => base/sourcegraph/frontend}/rbac/sourcegraph-frontend.RoleBinding.yaml (85%) rename {components/enable/service-discovery => base/sourcegraph/frontend}/rbac/sourcegraph-frontend.ServiceAccount.yaml (90%) diff --git a/components/monitoring/rbacs/grafana/grafana.ServiceAccount.yaml b/base/monitoring/grafana/rbac/grafana.ServiceAccount.yaml similarity index 100% rename from components/monitoring/rbacs/grafana/grafana.ServiceAccount.yaml rename to base/monitoring/grafana/rbac/grafana.ServiceAccount.yaml diff --git a/base/monitoring/grafana/rbac/kustomization.yaml b/base/monitoring/grafana/rbac/kustomization.yaml new file mode 100644 index 00000000..49a541ea --- /dev/null +++ b/base/monitoring/grafana/rbac/kustomization.yaml @@ -0,0 +1,4 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - grafana.ServiceAccount.yaml diff --git a/base/monitoring/prometheus/prometheus.ConfigMap.yaml b/base/monitoring/prometheus/prometheus.ConfigMap.yaml index 980dda74..3efa31ff 100644 --- a/base/monitoring/prometheus/prometheus.ConfigMap.yaml +++ b/base/monitoring/prometheus/prometheus.ConfigMap.yaml @@ -8,8 +8,8 @@ metadata: name: prometheus data: prometheus.yml: | - # Prometheus global config global: + # Prometheus global config scrape_interval: 30s evaluation_interval: 30s # scrape_timeout is set to the global default (10s). @@ -41,21 +41,11 @@ data: static_configs: - targets: ['127.0.0.1:9093'] - - job_name: 'sourcegraph-services' - relabel_configs: - - source_labels: [__address__] - target_label: instance - regex: (.*)\.(.*) - replacement: ${1}_${2} - metric_relabel_configs: - - source_labels: [container_label_io_kubernetes_pod_namespace] - regex: kube-system - action: drop - file_sd_configs: - - files: - - '/sg_prometheus_add_ons/*_targets.yml' - - - job_name: 'cadvisor' + ########################################################################################## + # cadvisor + ########################################################################################## + + - job_name: 'kubernetes-pods' dns_sd_configs: - names: - 'cadvisor.default.svc.cluster.local' @@ -82,34 +72,23 @@ data: # regex: ^$|ns-sourcegraph # ACTION: replace ns-sourcegraph with your namespace # action: keep - - job_name: 'sourcegraph-statefulsets' - dns_sd_configs: - - names: - - 'symbols.default.svc.cluster.local' - - 'symbols.ns-sourcegraph.svc.cluster.local' - - 'searcher.default.svc.cluster.local' - - 'searcher.ns-sourcegraph.svc.cluster.local' - - 'gitserver.default.svc.cluster.local' - - 'gitserver.ns-sourcegraph.svc.cluster.local' - - 'sourcegraph-frontend.default.svc.cluster.local' - - 'sourcegraph-frontend.ns-sourcegraph.svc.cluster.local' - type: A - port: 6060 - - names: - - 'indexed-search.default.svc.cluster.local' - - 'indexed-search.ns-sourcegraph.svc.cluster.local' - type: A - port: 6070 - - names: - - 'indexed-search-indexer.default.svc.cluster.local' - - 'indexed-search-indexer.ns-sourcegraph.svc.cluster.local' - type: A - port: 6072 + ########################################################################################## + # sourcegraph-services + ########################################################################################## + + - job_name: 'sourcegraph-services' relabel_configs: - - source_labels: [__meta_dns_name] - target_label: service_name - regex: (.*)\..*\..*\..*\..* - replacement: ${1} + - source_labels: [__address__] + target_label: instance + regex: (.*)\.(.*) + replacement: ${1}_${2} + metric_relabel_configs: + - source_labels: [container_label_io_kubernetes_pod_namespace] + regex: kube-system + action: drop + file_sd_configs: + - files: + - '/sg_prometheus_add_ons/*_targets.yml' # Extra rules extra_rules.yml: | diff --git a/base/monitoring/prometheus/prometheus.Deployment.yaml b/base/monitoring/prometheus/prometheus.Deployment.yaml index a1360e56..018bb3d1 100644 --- a/base/monitoring/prometheus/prometheus.Deployment.yaml +++ b/base/monitoring/prometheus/prometheus.Deployment.yaml @@ -28,7 +28,7 @@ spec: image: index.docker.io/sourcegraph/prometheus:4.4.2@sha256:d833d00a39937cf700f276f816dc789615d6396979418a7d9362386513b1fc9d terminationMessagePolicy: FallbackToLogsOnError env: - - name: MY_POD_NAMESPACE + - name: SG_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace @@ -70,7 +70,6 @@ spec: runAsUser: 100 fsGroup: 100 fsGroupChangePolicy: "OnRootMismatch" - # serviceAccountName: prometheus volumes: - name: data persistentVolumeClaim: diff --git a/base/monitoring/prometheus/rbac/kustomization.yaml b/base/monitoring/prometheus/rbac/kustomization.yaml new file mode 100644 index 00000000..abcf88c1 --- /dev/null +++ b/base/monitoring/prometheus/rbac/kustomization.yaml @@ -0,0 +1,7 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - prometheus.ConfigMap.yaml + - prometheus.ClusterRole.yaml + - prometheus.ClusterRoleBinding.yaml + - prometheus.ServiceAccount.yaml diff --git a/components/monitoring/rbacs/prometheus/prometheus.ClusterRole.yaml b/base/monitoring/prometheus/rbac/prometheus.ClusterRole.yaml similarity index 100% rename from components/monitoring/rbacs/prometheus/prometheus.ClusterRole.yaml rename to base/monitoring/prometheus/rbac/prometheus.ClusterRole.yaml diff --git a/components/monitoring/rbacs/prometheus/prometheus.ClusterRoleBinding.yaml b/base/monitoring/prometheus/rbac/prometheus.ClusterRoleBinding.yaml similarity index 100% rename from components/monitoring/rbacs/prometheus/prometheus.ClusterRoleBinding.yaml rename to base/monitoring/prometheus/rbac/prometheus.ClusterRoleBinding.yaml diff --git a/components/monitoring/rbacs/prometheus/prometheus.ConfigMap.yaml b/base/monitoring/prometheus/rbac/prometheus.ConfigMap.yaml similarity index 99% rename from components/monitoring/rbacs/prometheus/prometheus.ConfigMap.yaml rename to base/monitoring/prometheus/rbac/prometheus.ConfigMap.yaml index e3f69c40..3e7ae454 100644 --- a/components/monitoring/rbacs/prometheus/prometheus.ConfigMap.yaml +++ b/base/monitoring/prometheus/rbac/prometheus.ConfigMap.yaml @@ -5,7 +5,7 @@ metadata: deploy: sourcegraph sourcegraph-resource-requires: no-cluster-admin app.kubernetes.io/component: prometheus - name: prometheus + name: prometheus-rbac data: prometheus.yml: | global: diff --git a/components/monitoring/rbacs/prometheus/prometheus.ServiceAccount.yaml b/base/monitoring/prometheus/rbac/prometheus.ServiceAccount.yaml similarity index 100% rename from components/monitoring/rbacs/prometheus/prometheus.ServiceAccount.yaml rename to base/monitoring/prometheus/rbac/prometheus.ServiceAccount.yaml diff --git a/base/sourcegraph/frontend/rbac/kustomization.yaml b/base/sourcegraph/frontend/rbac/kustomization.yaml new file mode 100644 index 00000000..b299f63b --- /dev/null +++ b/base/sourcegraph/frontend/rbac/kustomization.yaml @@ -0,0 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - sourcegraph-frontend.Role.yaml + - sourcegraph-frontend.RoleBinding.yaml + - sourcegraph-frontend.ServiceAccount.yaml diff --git a/components/enable/service-discovery/rbac/sourcegraph-frontend.Role.yaml b/base/sourcegraph/frontend/rbac/sourcegraph-frontend.Role.yaml similarity index 100% rename from components/enable/service-discovery/rbac/sourcegraph-frontend.Role.yaml rename to base/sourcegraph/frontend/rbac/sourcegraph-frontend.Role.yaml diff --git a/components/enable/service-discovery/rbac/sourcegraph-frontend.RoleBinding.yaml b/base/sourcegraph/frontend/rbac/sourcegraph-frontend.RoleBinding.yaml similarity index 85% rename from components/enable/service-discovery/rbac/sourcegraph-frontend.RoleBinding.yaml rename to base/sourcegraph/frontend/rbac/sourcegraph-frontend.RoleBinding.yaml index 9440ef27..dcf010c8 100644 --- a/components/enable/service-discovery/rbac/sourcegraph-frontend.RoleBinding.yaml +++ b/base/sourcegraph/frontend/rbac/sourcegraph-frontend.RoleBinding.yaml @@ -12,5 +12,5 @@ roleRef: kind: Role name: sourcegraph-frontend subjects: -- kind: ServiceAccount - name: sourcegraph-frontend + - kind: ServiceAccount + name: sourcegraph-frontend diff --git a/components/enable/service-discovery/rbac/sourcegraph-frontend.ServiceAccount.yaml b/base/sourcegraph/frontend/rbac/sourcegraph-frontend.ServiceAccount.yaml similarity index 90% rename from components/enable/service-discovery/rbac/sourcegraph-frontend.ServiceAccount.yaml rename to base/sourcegraph/frontend/rbac/sourcegraph-frontend.ServiceAccount.yaml index 74e52ced..9d003d13 100644 --- a/components/enable/service-discovery/rbac/sourcegraph-frontend.ServiceAccount.yaml +++ b/base/sourcegraph/frontend/rbac/sourcegraph-frontend.ServiceAccount.yaml @@ -1,6 +1,4 @@ apiVersion: v1 -imagePullSecrets: -- name: docker-registry kind: ServiceAccount metadata: labels: @@ -9,3 +7,5 @@ metadata: sourcegraph-resource-requires: no-cluster-admin app.kubernetes.io/component: frontend name: sourcegraph-frontend +imagePullSecrets: + - name: docker-registry diff --git a/components/clusters/old-base/kustomization.yaml b/components/clusters/old-base/kustomization.yaml index 213d0e8a..16382d7d 100644 --- a/components/clusters/old-base/kustomization.yaml +++ b/components/clusters/old-base/kustomization.yaml @@ -1,11 +1,9 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component components: - - ../../monitoring - ../../monitoring/otel - ../../monitoring/cadvisor - ../../monitoring/rbacs - - ../../enable/service-discovery - ../../services/searcher/deployment - ../../services/symbols/deployment - ../../services/pgsql @@ -13,8 +11,9 @@ components: - ../../services/codeintel-db # Add sourcegraph as default storage class name - ../../storage-class/sourcegraph - # To support searcher and symbols as both statefulset and deployment + - ../../enable/service-discovery patches: + # To support searcher and symbols as both statefulset and deployment - path: patches/searcher/searcher.patchesJson6902.yaml target: group: apps diff --git a/components/enable/service-discovery/kustomization.yaml b/components/enable/service-discovery/kustomization.yaml index 0b2df4d0..85f1ac87 100644 --- a/components/enable/service-discovery/kustomization.yaml +++ b/components/enable/service-discovery/kustomization.yaml @@ -1,9 +1,7 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component resources: - - rbac/sourcegraph-frontend.Role.yaml - - rbac/sourcegraph-frontend.RoleBinding.yaml - - rbac/sourcegraph-frontend.ServiceAccount.yaml + - ../../../base/sourcegraph/frontend/rbac patches: - path: patches/sourcegraph-frontend.Deployment.yaml - path: patches/sourcegraph-frontend.ConfigMap.yaml diff --git a/components/monitoring/rbacs/kustomization.yaml b/components/monitoring/rbacs/kustomization.yaml index 7b55c07d..ae57be12 100644 --- a/components/monitoring/rbacs/kustomization.yaml +++ b/components/monitoring/rbacs/kustomization.yaml @@ -1,12 +1,28 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component resources: - - grafana/grafana.ServiceAccount.yaml - - prometheus/prometheus.ClusterRole.yaml - - prometheus/prometheus.ClusterRoleBinding.yaml - - prometheus/prometheus.ServiceAccount.yaml + - ../../../base/monitoring/grafana/rbac + - ../../../base/monitoring/prometheus/rbac patches: - - path: prometheus/prometheus.ConfigMap.yaml - - path: grafana/grafana.StatefulSet.yaml - path: prometheus/prometheus.Deployment.yaml + - path: grafana/grafana.StatefulSet.yaml - path: grafana/grafana.Dashboards.ConfigMap.yaml + - patch: |- + - op: remove + path: /data/prometheus.yml + - op: remove + path: /data/gitserver_targets.yml + - op: remove + path: /data/indexed-search_targets.yml + - op: remove + path: /data/prometheus_targets.yml + - op: remove + path: /data/searcher_targets.yml + - op: remove + path: /data/symbols_targets.yml + - op: remove + path: /data/extra_rules.yml + target: + name: prometheus + version: v1 + kind: ConfigMap diff --git a/components/monitoring/rbacs/prometheus/prometheus.Deployment.yaml b/components/monitoring/rbacs/prometheus/prometheus.Deployment.yaml index 44bf7a30..d28c78c0 100644 --- a/components/monitoring/rbacs/prometheus/prometheus.Deployment.yaml +++ b/components/monitoring/rbacs/prometheus/prometheus.Deployment.yaml @@ -6,3 +6,8 @@ spec: template: spec: serviceAccountName: prometheus + volumes: + - configMap: + defaultMode: 0777 + name: prometheus-rbac + name: config diff --git a/examples/aws/ebs/kustomization.yaml b/examples/aws/ebs/kustomization.yaml index 33f08725..5ce329a9 100644 --- a/examples/aws/ebs/kustomization.yaml +++ b/examples/aws/ebs/kustomization.yaml @@ -1,11 +1,12 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: ns-sourcegraph resources: # Sourcegraph Main Stack - ../../../base/sourcegraph - # Monitoring Stack - ../../../base/monitoring components: + - ../../../components/resources/namespace # Use resources for a size-XS instance - ../../../components/sizes/xs - ../../../components/clusters/aws/ebs-csi diff --git a/examples/aws/kustomization.yaml b/examples/aws/kustomization.yaml index 429a4a74..7041a8ec 100644 --- a/examples/aws/kustomization.yaml +++ b/examples/aws/kustomization.yaml @@ -1,11 +1,12 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: ns-sourcegraph resources: # Sourcegraph Main Stack - ../../base/sourcegraph - # Monitoring Stack - ../../base/monitoring components: + - ../../components/resources/namespace # Use resources for a size-XS instance - ../../components/sizes/xs - ../../components/clusters/aws/aws-ebs diff --git a/examples/aws/with-tracing/kustomization.yaml b/examples/aws/with-tracing/kustomization.yaml index 6619ee59..0cd21e33 100644 --- a/examples/aws/with-tracing/kustomization.yaml +++ b/examples/aws/with-tracing/kustomization.yaml @@ -1,11 +1,12 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: ns-sourcegraph resources: # Sourcegraph Main Stack - ../../../base/sourcegraph - # Monitoring Stack - ../../../base/monitoring components: + - ../../../components/resources/namespace - ../../../components/monitoring/tracing # Use resources for a size-XS instance - ../../../components/sizes/xs diff --git a/examples/base/kustomization.yaml b/examples/base/kustomization.yaml index 890b121f..cb472722 100644 --- a/examples/base/kustomization.yaml +++ b/examples/base/kustomization.yaml @@ -1,10 +1,10 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: ns-sourcegraph # Run all services with default values resources: - # Sourcegraph Main Stack - ../../base/sourcegraph - # Monitoring Stack - ../../base/monitoring components: + - ../../components/resources/namespace - ../../components/monitoring/tracing diff --git a/examples/base/l/kustomization.yaml b/examples/base/l/kustomization.yaml index 1730ecbc..1b5b20a5 100644 --- a/examples/base/l/kustomization.yaml +++ b/examples/base/l/kustomization.yaml @@ -1,9 +1,11 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: ns-sourcegraph resources: # Sourcegraph Main Stack - ../../../base/sourcegraph # Monitoring Stack - ../../../base/monitoring components: + - ../../../components/resources/namespace - ../../../components/sizes/l diff --git a/examples/base/m/kustomization.yaml b/examples/base/m/kustomization.yaml index 766c72e1..a8ac0c10 100644 --- a/examples/base/m/kustomization.yaml +++ b/examples/base/m/kustomization.yaml @@ -1,9 +1,11 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: ns-sourcegraph resources: # Sourcegraph Main Stack - ../../../base/sourcegraph # Monitoring Stack - ../../../base/monitoring components: + - ../../../components/resources/namespace - ../../../components/sizes/m diff --git a/examples/base/s/kustomization.yaml b/examples/base/s/kustomization.yaml index e30d157b..f268d0b2 100644 --- a/examples/base/s/kustomization.yaml +++ b/examples/base/s/kustomization.yaml @@ -1,9 +1,11 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: ns-sourcegraph resources: # Sourcegraph Main Stack - ../../../base/sourcegraph # Monitoring Stack - ../../../base/monitoring components: + - ../../../components/resources/namespace - ../../../components/sizes/s diff --git a/examples/base/xl/kustomization.yaml b/examples/base/xl/kustomization.yaml index 9cb6b69b..1a5de396 100644 --- a/examples/base/xl/kustomization.yaml +++ b/examples/base/xl/kustomization.yaml @@ -1,9 +1,11 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: ns-sourcegraph resources: # Sourcegraph Main Stack - ../../../base/sourcegraph # Monitoring Stack - ../../../base/monitoring components: + - ../../../components/resources/namespace - ../../../components/sizes/xl diff --git a/examples/base/xs/kustomization.yaml b/examples/base/xs/kustomization.yaml index b11ec73c..ba053591 100644 --- a/examples/base/xs/kustomization.yaml +++ b/examples/base/xs/kustomization.yaml @@ -1,10 +1,12 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: ns-sourcegraph resources: # Sourcegraph Main Stack - ../../../base/sourcegraph # Monitoring Stack - ../../../base/monitoring components: + - ../../../components/resources/namespace # Use resources for a size-XS instance - ../../../components/sizes/xs diff --git a/examples/dev/kustomization.yaml b/examples/dev/kustomization.yaml index 4f070755..ca802f25 100644 --- a/examples/dev/kustomization.yaml +++ b/examples/dev/kustomization.yaml @@ -1,11 +1,13 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: dev-sourcegraph resources: # Sourcegraph Main Stack - ../../base/sourcegraph - # Monitoring Stack + # Monitoring Stack - ../../base/monitoring components: + - ../../components/resources/namespace - ../../components/resources/ci-volume - ../../components/remove/resources - ../../components/remove/pvcs diff --git a/examples/gke/kustomization.yaml b/examples/gke/kustomization.yaml index 4ee8945b..811e671a 100644 --- a/examples/gke/kustomization.yaml +++ b/examples/gke/kustomization.yaml @@ -1,8 +1,11 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: ns-sourcegraph resources: + # Sourcegraph Main Stack - ../../base/sourcegraph - ../../base/monitoring components: + - ../../components/resources/namespace - ../../components/sizes/xs - ../../components/clusters/gke/configure diff --git a/examples/gke/rbac/kustomization.yaml b/examples/gke/rbac/kustomization.yaml index cbcdff95..1d22e802 100644 --- a/examples/gke/rbac/kustomization.yaml +++ b/examples/gke/rbac/kustomization.yaml @@ -1,14 +1,16 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: ns-sourcegraph resources: # Sourcegraph Main Stack - ../../../base/sourcegraph - ../../../base/monitoring components: + - ../../../components/resources/namespace - ../../../components/monitoring/cadvisor - - ../../../components/monitoring/privileged # Use resources for a size-XS instance - ../../../components/sizes/xs - - ../../../components/privileged - ../../../components/clusters/gke/configure + - ../../../components/privileged + - ../../../components/monitoring/privileged - ../../../components/enable/service-discovery diff --git a/examples/k3s/kustomization.yaml b/examples/k3s/kustomization.yaml index 74e5e44e..8b6d6007 100644 --- a/examples/k3s/kustomization.yaml +++ b/examples/k3s/kustomization.yaml @@ -1,9 +1,10 @@ # Includes RBAC resources apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: default resources: # Sourcegraph Main Stack - - ../../base/sourcegraph + - ../../../base/sourcegraph components: # Use resources for a size-XS instance - ../../components/sizes/xs diff --git a/examples/k3s/l/kustomization.yaml b/examples/k3s/l/kustomization.yaml index 914a4834..86125910 100644 --- a/examples/k3s/l/kustomization.yaml +++ b/examples/k3s/l/kustomization.yaml @@ -1,6 +1,7 @@ # Includes RBAC resources apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph diff --git a/examples/k3s/m/kustomization.yaml b/examples/k3s/m/kustomization.yaml index c0c02271..9c1e5e6e 100644 --- a/examples/k3s/m/kustomization.yaml +++ b/examples/k3s/m/kustomization.yaml @@ -1,6 +1,7 @@ # Includes RBAC resources apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph diff --git a/examples/k3s/s/kustomization.yaml b/examples/k3s/s/kustomization.yaml index dd445d86..b15da606 100644 --- a/examples/k3s/s/kustomization.yaml +++ b/examples/k3s/s/kustomization.yaml @@ -1,6 +1,7 @@ # Includes RBAC resources apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph diff --git a/examples/k3s/xl/kustomization.yaml b/examples/k3s/xl/kustomization.yaml index 4772b926..6a41c210 100644 --- a/examples/k3s/xl/kustomization.yaml +++ b/examples/k3s/xl/kustomization.yaml @@ -1,6 +1,7 @@ # Includes RBAC resources apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph diff --git a/examples/k3s/xs/kustomization.yaml b/examples/k3s/xs/kustomization.yaml index e9fe2dfb..a863dc8c 100644 --- a/examples/k3s/xs/kustomization.yaml +++ b/examples/k3s/xs/kustomization.yaml @@ -1,6 +1,7 @@ # Includes RBAC resources apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: default resources: # Sourcegraph Main Stack - ../../../base/sourcegraph diff --git a/examples/migrator/kustomization.yaml b/examples/migrator/kustomization.yaml index 540144f9..ff625284 100644 --- a/examples/migrator/kustomization.yaml +++ b/examples/migrator/kustomization.yaml @@ -1,5 +1,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: ns-sourcegraph components: - ../../components/utils/migrator diff --git a/examples/minikube/full/kustomization.yaml b/examples/minikube/full/kustomization.yaml index 411a2b78..f398fe96 100644 --- a/examples/minikube/full/kustomization.yaml +++ b/examples/minikube/full/kustomization.yaml @@ -1,7 +1,11 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: ns-sourcegraph resources: + # Sourcegraph Main Stack - ../../../base/sourcegraph + # Monitoring Stack - ../../../base/monitoring components: + - ../../../components/resources/namespace - ../../../components/clusters/minikube diff --git a/examples/minikube/kustomization.yaml b/examples/minikube/kustomization.yaml index 4a3c28ea..601fbe81 100644 --- a/examples/minikube/kustomization.yaml +++ b/examples/minikube/kustomization.yaml @@ -1,6 +1,9 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: ns-sourcegraph resources: + # Sourcegraph Main Stack - ../../base/sourcegraph components: + - ../../components/resources/namespace - ../../components/clusters/minikube diff --git a/examples/monitoring/cadvisor/kustomization.yaml b/examples/monitoring/cadvisor/kustomization.yaml index 6c16e5d3..bd949bfc 100644 --- a/examples/monitoring/cadvisor/kustomization.yaml +++ b/examples/monitoring/cadvisor/kustomization.yaml @@ -1,4 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: ns-sourcegraph components: - ../../../components/monitoring/cadvisor diff --git a/examples/monitoring/kustomization.yaml b/examples/monitoring/kustomization.yaml index 865b0076..cd005d55 100644 --- a/examples/monitoring/kustomization.yaml +++ b/examples/monitoring/kustomization.yaml @@ -1,4 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: ns-sourcegraph resources: - ../../base/monitoring diff --git a/examples/monitoring/privileged/kustomization.yaml b/examples/monitoring/privileged/kustomization.yaml index 056f279f..fbac2e67 100644 --- a/examples/monitoring/privileged/kustomization.yaml +++ b/examples/monitoring/privileged/kustomization.yaml @@ -1,5 +1,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: ns-sourcegraph resources: - ../../../base/monitoring components: diff --git a/examples/old-cluster/kustomization.yaml b/examples/old-cluster/kustomization.yaml index 5b5c41f1..d0639637 100644 --- a/examples/old-cluster/kustomization.yaml +++ b/examples/old-cluster/kustomization.yaml @@ -1,8 +1,11 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: ns-sourcegraph resources: # Sourcegraph Main Stack - ../../base/sourcegraph + # Monitoring Stack + - ../../base/monitoring components: # Update and generate resources for the old cluster # This includes the monitoring stack diff --git a/examples/privileged/kustomization.yaml b/examples/privileged/kustomization.yaml index a571f9c3..eacdf8a1 100644 --- a/examples/privileged/kustomization.yaml +++ b/examples/privileged/kustomization.yaml @@ -1,11 +1,13 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: ns-sourcegraph resources: # Sourcegraph Main Stack - ../../base/sourcegraph - # Monitoring Stack + # Monitoring Stack - ../../base/monitoring components: + - ../../components/resources/namespace - ../../components/monitoring/cadvisor - ../../components/sizes/xs - ../../components/privileged diff --git a/examples/privileged/l/kustomization.yaml b/examples/privileged/l/kustomization.yaml index db827fc5..181f220f 100644 --- a/examples/privileged/l/kustomization.yaml +++ b/examples/privileged/l/kustomization.yaml @@ -1,11 +1,13 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: ns-sourcegraph resources: # Sourcegraph Main Stack - ../../../base/sourcegraph - # Monitoring Stack + # Monitoring Stack - ../../../base/monitoring components: + - ../../../components/resources/namespace - ../../../components/monitoring/cadvisor - ../../../components/sizes/l - ../../../components/privileged diff --git a/examples/privileged/m/kustomization.yaml b/examples/privileged/m/kustomization.yaml index e4fc7d7c..0788b1d6 100644 --- a/examples/privileged/m/kustomization.yaml +++ b/examples/privileged/m/kustomization.yaml @@ -1,11 +1,13 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: ns-sourcegraph resources: # Sourcegraph Main Stack - ../../../base/sourcegraph - # Monitoring Stack + # Monitoring Stack - ../../../base/monitoring components: + - ../../../components/resources/namespace - ../../../components/monitoring/cadvisor - ../../../components/sizes/m - ../../../components/privileged diff --git a/examples/privileged/s/kustomization.yaml b/examples/privileged/s/kustomization.yaml index b1d0b032..fa11dd3f 100644 --- a/examples/privileged/s/kustomization.yaml +++ b/examples/privileged/s/kustomization.yaml @@ -1,11 +1,13 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: ns-sourcegraph resources: # Sourcegraph Main Stack - ../../../base/sourcegraph - # Monitoring Stack + # Monitoring Stack - ../../../base/monitoring components: + - ../../../components/resources/namespace - ../../../components/monitoring/cadvisor - ../../../components/sizes/s - ../../../components/privileged diff --git a/examples/privileged/xl/kustomization.yaml b/examples/privileged/xl/kustomization.yaml index 35a27c64..9bd3cc03 100644 --- a/examples/privileged/xl/kustomization.yaml +++ b/examples/privileged/xl/kustomization.yaml @@ -1,11 +1,13 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: ns-sourcegraph resources: # Sourcegraph Main Stack - ../../../base/sourcegraph - # Monitoring Stack + # Monitoring Stack - ../../../base/monitoring components: + - ../../../components/resources/namespace - ../../../components/monitoring/cadvisor - ../../../components/sizes/xl - ../../../components/privileged diff --git a/examples/privileged/xs/kustomization.yaml b/examples/privileged/xs/kustomization.yaml index a02c391a..f65f73d5 100644 --- a/examples/privileged/xs/kustomization.yaml +++ b/examples/privileged/xs/kustomization.yaml @@ -1,11 +1,13 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: ns-sourcegraph resources: # Sourcegraph Main Stack - ../../../base/sourcegraph - # Monitoring Stack + # Monitoring Stack - ../../../base/monitoring components: + - ../../../components/resources/namespace - ../../../components/monitoring/cadvisor - ../../../components/sizes/xs - ../../../components/privileged From bb20363213f845aa14dd1404adccf8190f66a6b4 Mon Sep 17 00:00:00 2001 From: Beatrix Date: Wed, 22 Feb 2023 15:59:41 -0800 Subject: [PATCH 10/13] Fix k3s overlay --- examples/k3s/kustomization.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/k3s/kustomization.yaml b/examples/k3s/kustomization.yaml index 58fb49f5..74e5e44e 100644 --- a/examples/k3s/kustomization.yaml +++ b/examples/k3s/kustomization.yaml @@ -3,7 +3,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: # Sourcegraph Main Stack - - ../../../base/sourcegraph + - ../../base/sourcegraph components: # Use resources for a size-XS instance - ../../components/sizes/xs From 9c5127e4a1ce1c75e4784c449a84ba1f2841217c Mon Sep 17 00:00:00 2001 From: Beatrix Date: Thu, 23 Feb 2023 08:52:07 -0800 Subject: [PATCH 11/13] Update prometheus to use dns service discovery --- .../prometheus/prometheus.ConfigMap.yaml | 126 +- .../prometheus/rbac/prometheus.ConfigMap.yaml | 4 - components/custom/replica/kustomization.yaml | 4 +- .../replica/patches/endpoints-update.yaml | 46 - .../custom/resources/kustomization.yaml | 1066 +++++++++-------- .../monitoring/rbacs/kustomization.yaml | 10 - components/sizes/l/kustomization.yaml | 5 - components/sizes/l/patches/prometheus.yaml | 39 - components/sizes/m/kustomization.yaml | 5 - components/sizes/m/patches/prometheus.yaml | 37 - components/sizes/s/kustomization.yaml | 5 - components/sizes/s/patches/prometheus.yaml | 37 - components/sizes/xl/kustomization.yaml | 5 - components/sizes/xl/patches/prometheus.yaml | 43 - components/sizes/xs/kustomization.yaml | 5 - components/sizes/xs/patches/prometheus.yaml | 37 - .../template/kustomization.template.yaml | 7 +- 17 files changed, 633 insertions(+), 848 deletions(-) delete mode 100644 components/custom/replica/patches/endpoints-update.yaml delete mode 100644 components/sizes/l/patches/prometheus.yaml delete mode 100644 components/sizes/m/patches/prometheus.yaml delete mode 100644 components/sizes/s/patches/prometheus.yaml delete mode 100644 components/sizes/xl/patches/prometheus.yaml delete mode 100644 components/sizes/xs/patches/prometheus.yaml diff --git a/base/monitoring/prometheus/prometheus.ConfigMap.yaml b/base/monitoring/prometheus/prometheus.ConfigMap.yaml index 3efa31ff..08703259 100644 --- a/base/monitoring/prometheus/prometheus.ConfigMap.yaml +++ b/base/monitoring/prometheus/prometheus.ConfigMap.yaml @@ -8,8 +8,8 @@ metadata: name: prometheus data: prometheus.yml: | + # Prometheus global config global: - # Prometheus global config scrape_interval: 30s evaluation_interval: 30s # scrape_timeout is set to the global default (10s). @@ -68,9 +68,6 @@ data: action: replace target_label: name separator: '-' - # - source_labels: [container_label_io_kubernetes_pod_namespace] - # regex: ^$|ns-sourcegraph # ACTION: replace ns-sourcegraph with your namespace - # action: keep ########################################################################################## # sourcegraph-services @@ -90,21 +87,66 @@ data: - files: - '/sg_prometheus_add_ons/*_targets.yml' - # Extra rules - extra_rules.yml: | - groups: - - name: container.rules - rules: - - record: container:process_cpu_seconds_total:ratio_rate5m - expr: sum by (instance) (rate(process_cpu_seconds_total[5m])) / engine_daemon_engine_cpus_cpus - - record: container:process_cpu_seconds_total:sum - expr: sum by (instance) (irate(process_cpu_seconds_total[1m])) - - record: container:process_resident_memory_bytes:max - expr: max by (instance) (process_resident_memory_bytes) - - record: container:process_virtual_memory_bytes:max - expr: max by (instance) (process_virtual_memory_bytes) + - job_name: 'sourcegraph-statefulsets' + dns_sd_configs: + - names: + - 'symbols.default.svc.cluster.local' + - 'symbols.ns-sourcegraph.svc.cluster.local' + - 'symbols.$SG_NAMESPACE.svc.cluster.local' + - 'searcher.default.svc.cluster.local' + - 'searcher.ns-sourcegraph.svc.cluster.local' + - 'searcher.$SG_NAMESPACE.svc.cluster.local' + - 'gitserver.default.svc.cluster.local' + - 'gitserver.ns-sourcegraph.svc.cluster.local' + - 'gitserver.$SG_NAMESPACE.svc.cluster.local' + - 'sourcegraph-frontend.default.svc.cluster.local' + - 'sourcegraph-frontend.ns-sourcegraph.svc.cluster.local' + - 'sourcegraph-frontend.$SG_NAMESPACE.svc.cluster.local' + - 'indexed-search.default.svc.cluster.local' + - 'indexed-search.ns-sourcegraph.svc.cluster.local' + - 'indexed-search.$SG_NAMESPACE.svc.cluster.local' + - 'indexed-search-indexer.default.svc.cluster.local' + - 'indexed-search-indexer.ns-sourcegraph.svc.cluster.local' + - 'indexed-search-indexer.$SG_NAMESPACE.svc.cluster.local' + type: SRV + relabel_configs: + - source_labels: [__meta_dns_srv_record_target] + target_label: __address__ + regex: (.*)\. + replacement: ${1}:6060 + - source_labels: [__meta_dns_srv_record_target] + target_label: __address__ + regex: ^(indexed-search.*)\. + replacement: ${1}:6070 + - source_labels: [__meta_dns_srv_record_target] + target_label: __address__ + regex: (.*)\.(indexed-search-indexer.*)\. + replacement: ${1}.${2}:6072 + - source_labels: [__meta_dns_srv_record_port] + target_label: __meta_dns_srv_record_port + replacement: 6060 + - source_labels: [__address__] + regex: ^(indexed-search).*$ + target_label: __meta_dns_srv_record_port + replacement: 6070 + - source_labels: [__meta_dns_name] + target_label: job + regex: (.*)\..*\..*\..*\..* + replacement: ${1} + - source_labels: [__meta_dns_srv_record_target] + regex: (.*)\.(.*)\..*\..*\..*\..*\..* + target_label: instance + replacement: ${2}_${1} + metric_relabel_configs: + - source_labels: [__address__] + target_label: instance + regex: (.*)\:.* + replacement: $1:6060 + - source_labels: [__address__] + target_label: instance + regex: (.*)\.(.*)\..*\..*\..*\..*\..* + replacement: ${2}_${1} - # List of static targets prometheus_targets.yml: | - labels: nodename: "sourcegraph-services" @@ -182,39 +224,15 @@ data: targets: - otel-collector:8888 - # Add new targets based on replica count of symbols - symbols_targets.yml: | - - labels: - nodename: "sourcegraph-services" - job: symbols - targets: - - symbols-0.symbols:6060 - - # Add new targets based on replica count of searcher - searcher_targets.yml: | - - labels: - nodename: "sourcegraph-services" - job: searcher - targets: - - searcher-0.searcher:6060 - - # Add new targets based on replica count of gitserver - gitserver_targets.yml: | - - labels: - nodename: "sourcegraph-services" - job: gitserver - targets: - - gitserver-0.gitserver:6060 - - # Add new targets based on replica count of indexed-search - indexed-search_targets.yml: | - - labels: - nodename: "sourcegraph-services" - job: zoekt-indexserver - targets: - - indexed-search-0.indexed-search:6072 - - labels: - nodename: "sourcegraph-services" - job: zoekt-webserver - targets: - - indexed-search-0.indexed-search:6070 + extra_rules.yml: | + groups: + - name: container.rules + rules: + - record: container:process_cpu_seconds_total:ratio_rate5m + expr: sum by (instance) (rate(process_cpu_seconds_total[5m])) / engine_daemon_engine_cpus_cpus + - record: container:process_cpu_seconds_total:sum + expr: sum by (instance) (irate(process_cpu_seconds_total[1m])) + - record: container:process_resident_memory_bytes:max + expr: max by (instance) (process_resident_memory_bytes) + - record: container:process_virtual_memory_bytes:max + expr: max by (instance) (process_virtual_memory_bytes) diff --git a/base/monitoring/prometheus/rbac/prometheus.ConfigMap.yaml b/base/monitoring/prometheus/rbac/prometheus.ConfigMap.yaml index 3e7ae454..593e1c9e 100644 --- a/base/monitoring/prometheus/rbac/prometheus.ConfigMap.yaml +++ b/base/monitoring/prometheus/rbac/prometheus.ConfigMap.yaml @@ -299,7 +299,3 @@ data: app: alertmanager extra_rules.yml: "" prometheus_targets.yml: "" - symbols_targets.yml: "" - searcher_targets.yml: "" - gitserver_targets.yml: "" - indexed-search_targets.yml: "" diff --git a/components/custom/replica/kustomization.yaml b/components/custom/replica/kustomization.yaml index f0d6580f..269147c6 100644 --- a/components/custom/replica/kustomization.yaml +++ b/components/custom/replica/kustomization.yaml @@ -1,8 +1,8 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component # DO NOT REMOVE: Handle updating endpoints configs for frontend -replacements: - - path: patches/endpoints-update.yaml +components: + - ../../utils/endpoints ########################## HOW TO USE ######################################## # IMPORTANT: No changes should be made above this line # Step 1 Uncomment the "name" and "count" for service you'd like to scale diff --git a/components/custom/replica/patches/endpoints-update.yaml b/components/custom/replica/patches/endpoints-update.yaml deleted file mode 100644 index f131bd1b..00000000 --- a/components/custom/replica/patches/endpoints-update.yaml +++ /dev/null @@ -1,46 +0,0 @@ -- source: - kind: StatefulSet - name: gitserver - fieldPath: spec.replicas - targets: - - select: - kind: ConfigMap - name: sourcegraph-frontend-env - fieldPaths: - - data.SRC_GIT_SERVERS -- source: - group: apps - name: searcher - fieldPath: spec.replicas - reject: - - kind: Service - - kind: Deployment - targets: - - select: - kind: ConfigMap - name: sourcegraph-frontend-env - fieldPaths: - - data.SEARCHER_URL -- source: - group: apps - name: symbols - fieldPath: spec.replicas - reject: - - kind: Service - - kind: Deployment - targets: - - select: - kind: ConfigMap - name: sourcegraph-frontend-env - fieldPaths: - - data.SYMBOLS_URL -- source: - kind: StatefulSet - name: indexed-search - fieldPath: spec.replicas - targets: - - select: - kind: ConfigMap - name: sourcegraph-frontend-env - fieldPaths: - - data.INDEXED_SEARCH_SERVERS diff --git a/components/custom/resources/kustomization.yaml b/components/custom/resources/kustomization.yaml index 26f3955b..ef07e2be 100644 --- a/components/custom/resources/kustomization.yaml +++ b/components/custom/resources/kustomization.yaml @@ -3,518 +3,558 @@ kind: Component # DO NOT REMOVE: Handle updating endpoints configs for frontend replacements: - path: patches/update-endpoints.yaml - +patches: ########################## HOW TO USE ######################################## -# Uncomment the services and update the values under resources +# 1. Uncomment the patches for services you'd like to adjust resources for +# 2. update the values under resources +# NOTE: Scroll to the bottom to update storage sizes for PVCs ################################################################################ - -patches: - - patch: |- - apiVersion: apps/v1 - kind: StatefulSet - metadata: - name: gitserver - spec: - replicas: 1 - template: - spec: - containers: - - name: gitserver - resources: - limits: - cpu: "4" - memory: 8G - requests: - cpu: "4" - memory: 8G - volumeClaimTemplates: - - spec: - resources: - requests: - storage: 200Gi # If you change this, also change indexed-search's disk size. - - patch: |- - apiVersion: apps/v1 - kind: DaemonSet - metadata: - name: cadvisor - spec: - template: - spec: - containers: - - name: cadvisor - resources: - limits: - cpu: 300m - memory: 200Mi - requests: - cpu: 100m - memory: 200Mi - - patch: |- - apiVersion: apps/v1 - kind: Deployment - metadata: - name: codeinsights-db - spec: - template: - spec: - containers: - - name: codeinsights - resources: - limits: - cpu: "4" - memory: "2Gi" - requests: - cpu: "4" - memory: "2Gi" - - patch: |- - apiVersion: apps/v1 - kind: StatefulSet - metadata: - name: codeinsights-db - spec: - template: - spec: - containers: - - name: codeinsights - resources: - limits: - cpu: "4" - memory: "2Gi" - requests: - cpu: "4" - memory: "2Gi" - - patch: |- - apiVersion: apps/v1 - kind: Deployment - metadata: - name: codeintel-db - spec: - template: - spec: - containers: - - name: pgsql - resources: - limits: - cpu: "16" - memory: 16G - requests: - cpu: "8" - memory: 8G - - patch: |- - apiVersion: apps/v1 - kind: StatefulSet - metadata: - name: codeintel-db - spec: - template: - spec: - containers: - - name: pgsql - resources: - limits: - cpu: "16" - memory: 16G - requests: - cpu: "8" - memory: 8G - - patch: |- - apiVersion: apps/v1 - kind: Deployment - metadata: - name: sourcegraph-frontend - spec: - replicas: 2 - template: - spec: - containers: - - name: frontend - resources: - limits: - cpu: "2" - ephemeral-storage: "8Gi" - memory: 4G - requests: - cpu: "2" - ephemeral-storage: "4Gi" - memory: 2G - - patch: |- - apiVersion: apps/v1 - kind: StatefulSet - metadata: - name: grafana - spec: - template: - spec: - containers: - - name: grafana - resources: - limits: - cpu: "1" - memory: 512Mi - requests: - cpu: 100m - memory: 512Mi - volumeClaimTemplates: - - spec: - resources: - requests: - storage: 2Gi - - patch: |- - apiVersion: apps/v1 - kind: StatefulSet - metadata: - name: indexed-search - spec: - replicas: 1 - template: - spec: - containers: - - name: zoekt-webserver - resources: - limits: - cpu: "16" - memory: 16G - requests: - cpu: "8" - memory: 8G - - name: zoekt-indexserver - resources: - limits: - cpu: "16" - memory: 16G - requests: - cpu: "8" - memory: 8G - volumeClaimTemplates: - - spec: - resources: - requests: - storage: 200Gi - - patch: |- - apiVersion: apps/v1 - kind: Deployment - metadata: - name: blobstore - spec: - template: - spec: - containers: - - name: blobstore - resources: - limits: - cpu: "1" - memory: 500M - requests: - cpu: "1" - memory: 500M - - patch: |- - apiVersion: apps/v1 - kind: Deployment - metadata: - name: pgsql - spec: - template: - spec: - containers: - - name: pgsql - resources: - limits: - cpu: "4" - memory: 4Gi - requests: - cpu: "4" - memory: 4Gi - - patch: |- - apiVersion: apps/v1 - kind: StatefulSet - metadata: - name: pgsql - spec: - template: - spec: - containers: - - name: pgsql - resources: - limits: - cpu: "4" - memory: 4Gi - requests: - cpu: "4" - memory: 4Gi - - patch: |- - apiVersion: apps/v1 - kind: Deployment - metadata: - name: precise-code-intel-worker - spec: - replicas: 2 - template: - spec: - containers: - - name: precise-code-intel-worker - resources: - limits: - cpu: "2" - memory: 4G - requests: - cpu: 500m - memory: 2G - - patch: |- - apiVersion: apps/v1 - kind: Deployment - metadata: - name: prometheus - spec: - template: - spec: - containers: - - name: prometheus - resources: - limits: - cpu: "2" - memory: 6G - requests: - cpu: 500m - memory: 6G - - patch: |- - apiVersion: apps/v1 - kind: Deployment - metadata: - name: redis-cache - spec: - template: - spec: - containers: - - name: redis-cache - resources: - limits: - cpu: "1" - memory: 7Gi - requests: - cpu: "1" - memory: 7Gi - - name: redis-exporter - resources: - limits: - cpu: 10m - memory: 100Mi - requests: - cpu: 10m - memory: 100Mi - - patch: |- - apiVersion: apps/v1 - kind: Deployment - metadata: - name: redis-store - spec: - template: - spec: - containers: - - name: redis-store - resources: - limits: - cpu: "1" - memory: 7Gi - requests: - cpu: "1" - memory: 7Gi - - name: redis-exporter - resources: - limits: - cpu: 10m - memory: 100Mi - requests: - cpu: 10m - memory: 100Mi - - patch: |- - apiVersion: apps/v1 - kind: Deployment - metadata: - name: repo-updater - spec: - replicas: 1 # IMPORTANT: Singleton service. Do NOT add more replica. - template: - spec: - containers: - - name: repo-updater - resources: - limits: - cpu: "1" - memory: 2Gi - requests: - cpu: "1" - memory: 500Mi - - patch: |- - apiVersion: apps/v1 - kind: Deployment - metadata: - name: searcher - spec: - replicas: 2 - template: - spec: - containers: - - name: searcher - resources: - limits: - cpu: "2" - ephemeral-storage: "26G" - memory: 2G - requests: - cpu: 500m - ephemeral-storage: "25G" - memory: 500M - - patch: |- - apiVersion: apps/v1 - kind: Deployment - metadata: - name: symbols - spec: - replicas: 1 - template: - spec: - containers: - - name: symbols - resources: - limits: - cpu: "2" - ephemeral-storage: "12G" - memory: 2G - requests: - cpu: 500m - ephemeral-storage: "10G" - memory: 500M - - patch: |- - apiVersion: apps/v1 - kind: Deployment - metadata: - name: syntect-server - spec: - replicas: 1 - template: - spec: - containers: - - name: syntect-server - resources: - limits: - cpu: "4" - memory: 6G - requests: - cpu: 250m - memory: 2G - - patch: |- - apiVersion: apps/v1 - kind: Deployment - metadata: - name: worker - spec: - replicas: 1 - template: - spec: - containers: - - name: worker - resources: - limits: - cpu: "2" - memory: 4G - requests: - cpu: 500m - memory: 2G - - patch: |- - apiVersion: apps/v1 - kind: DaemonSet - metadata: - name: otel-agent - spec: - template: - spec: - containers: - - name: otel-agent - resources: - limits: - cpu: "500m" - memory: 500Mi - requests: - cpu: "100m" - memory: 100Mi - - patch: |- - apiVersion: apps/v1 - kind: Deployment - metadata: - name: otel-collector - spec: - replicas: 1 - template: - spec: - containers: - - name: otel-collector - resources: - limits: - cpu: "1" - memory: 2Gi - requests: - cpu: "0.5" - memory: 512Mi - - patch: |- - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - name: blobstore - spec: - resources: - requests: - storage: 100Gi - - patch: |- - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - name: codeinsights-db - spec: - resources: - requests: - storage: 200Gi - - patch: |- - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - name: codeintel-db - spec: - resources: - requests: - storage: 200Gi - - patch: |- - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - name: pgsql - spec: - resources: - requests: - storage: 200Gi - - patch: |- - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - name: prometheus - spec: - resources: - requests: - storage: 200Gi - - patch: |- - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - name: redis-cache - spec: - resources: - requests: - storage: 100Gi - - patch: |- - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - name: redis-store - spec: - resources: - requests: - storage: 100Gi +# - patch: |- +# apiVersion: apps/v1 +# kind: StatefulSet +# metadata: +# name: gitserver +# spec: +# replicas: 1 +# template: +# spec: +# containers: +# - name: gitserver +# resources: +# limits: +# cpu: "4" +# memory: 8G +# requests: +# cpu: "4" +# memory: 8G +# volumeClaimTemplates: +# - spec: +# resources: +# requests: +# storage: 200Gi # Must be the same value as the indexed-search's disk size. +# - patch: |- +# apiVersion: apps/v1 +# kind: DaemonSet +# metadata: +# name: cadvisor +# spec: +# template: +# spec: +# containers: +# - name: cadvisor +# resources: +# limits: +# cpu: 300m +# memory: 200Mi +# requests: +# cpu: 100m +# memory: 200Mi +# - patch: |- +# apiVersion: apps/v1 +# kind: Deployment +# metadata: +# name: codeinsights-db +# spec: +# template: +# spec: +# containers: +# - name: codeinsights +# resources: +# limits: +# cpu: "4" +# memory: "2Gi" +# requests: +# cpu: "4" +# memory: "2Gi" +# - patch: |- +# apiVersion: apps/v1 +# kind: StatefulSet +# metadata: +# name: codeinsights-db +# spec: +# template: +# spec: +# containers: +# - name: codeinsights +# resources: +# limits: +# cpu: "4" +# memory: "2Gi" +# requests: +# cpu: "4" +# memory: "2Gi" +# - patch: |- +# apiVersion: apps/v1 +# kind: Deployment +# metadata: +# name: codeintel-db +# spec: +# template: +# spec: +# containers: +# - name: pgsql +# resources: +# limits: +# cpu: "16" +# memory: 16G +# requests: +# cpu: "8" +# memory: 8G +# - patch: |- +# apiVersion: apps/v1 +# kind: StatefulSet +# metadata: +# name: codeintel-db +# spec: +# template: +# spec: +# containers: +# - name: pgsql +# resources: +# limits: +# cpu: "16" +# memory: 16G +# requests: +# cpu: "8" +# memory: 8G +# - patch: |- +# apiVersion: apps/v1 +# kind: Deployment +# metadata: +# name: sourcegraph-frontend +# spec: +# replicas: 2 +# template: +# spec: +# containers: +# - name: frontend +# resources: +# limits: +# cpu: "2" +# ephemeral-storage: "8Gi" +# memory: 4G +# requests: +# cpu: "2" +# ephemeral-storage: "4Gi" +# memory: 2G +# - patch: |- +# apiVersion: apps/v1 +# kind: StatefulSet +# metadata: +# name: grafana +# spec: +# template: +# spec: +# containers: +# - name: grafana +# resources: +# limits: +# cpu: "1" +# memory: 512Mi +# requests: +# cpu: 100m +# memory: 512Mi +# volumeClaimTemplates: +# - spec: +# resources: +# requests: +# storage: 2Gi +# - patch: |- +# apiVersion: apps/v1 +# kind: StatefulSet +# metadata: +# name: indexed-search +# spec: +# replicas: 1 +# template: +# spec: +# containers: +# - name: zoekt-webserver +# resources: +# limits: +# cpu: "16" +# memory: 16G +# requests: +# cpu: "8" +# memory: 8G +# - name: zoekt-indexserver +# resources: +# limits: +# cpu: "16" +# memory: 16G +# requests: +# cpu: "8" +# memory: 8G +# volumeClaimTemplates: +# - spec: +# resources: +# requests: +# storage: 200Gi # Must be the same value as the gitserver's disk size. +# - patch: |- +# apiVersion: apps/v1 +# kind: Deployment +# metadata: +# name: blobstore +# spec: +# template: +# spec: +# containers: +# - name: blobstore +# resources: +# limits: +# cpu: "1" +# memory: 500M +# requests: +# cpu: "1" +# memory: 500M +# - patch: |- +# apiVersion: apps/v1 +# kind: Deployment +# metadata: +# name: pgsql +# spec: +# template: +# spec: +# containers: +# - name: pgsql +# resources: +# limits: +# cpu: "4" +# memory: 4Gi +# requests: +# cpu: "4" +# memory: 4Gi +# - patch: |- +# apiVersion: apps/v1 +# kind: StatefulSet +# metadata: +# name: pgsql +# spec: +# template: +# spec: +# containers: +# - name: pgsql +# resources: +# limits: +# cpu: "4" +# memory: 4Gi +# requests: +# cpu: "4" +# memory: 4Gi +# - patch: |- +# apiVersion: apps/v1 +# kind: Deployment +# metadata: +# name: precise-code-intel-worker +# spec: +# replicas: 2 +# template: +# spec: +# containers: +# - name: precise-code-intel-worker +# resources: +# limits: +# cpu: "2" +# memory: 4G +# requests: +# cpu: 500m +# memory: 2G +# - patch: |- +# apiVersion: apps/v1 +# kind: Deployment +# metadata: +# name: prometheus +# spec: +# template: +# spec: +# containers: +# - name: prometheus +# resources: +# limits: +# cpu: "2" +# memory: 6G +# requests: +# cpu: 500m +# memory: 6G +# - patch: |- +# apiVersion: apps/v1 +# kind: Deployment +# metadata: +# name: redis-cache +# spec: +# template: +# spec: +# containers: +# - name: redis-cache +# resources: +# limits: +# cpu: "1" +# memory: 7Gi +# requests: +# cpu: "1" +# memory: 7Gi +# - name: redis-exporter +# resources: +# limits: +# cpu: 10m +# memory: 100Mi +# requests: +# cpu: 10m +# memory: 100Mi +# - patch: |- +# apiVersion: apps/v1 +# kind: Deployment +# metadata: +# name: redis-store +# spec: +# template: +# spec: +# containers: +# - name: redis-store +# resources: +# limits: +# cpu: "1" +# memory: 7Gi +# requests: +# cpu: "1" +# memory: 7Gi +# - name: redis-exporter +# resources: +# limits: +# cpu: 10m +# memory: 100Mi +# requests: +# cpu: 10m +# memory: 100Mi +# - patch: |- +# apiVersion: apps/v1 +# kind: Deployment +# metadata: +# name: repo-updater +# spec: +# replicas: 1 # IMPORTANT: Singleton service. Do NOT add more replica. +# template: +# spec: +# containers: +# - name: repo-updater +# resources: +# limits: +# cpu: "1" +# memory: 2Gi +# requests: +# cpu: "1" +# memory: 500Mi +# - patch: |- +# apiVersion: apps/v1 +# kind: StatefulSet +# metadata: +# name: searcher +# spec: +# replicas: 1 +# template: +# spec: +# containers: +# - name: searcher +# resources: +# limits: +# cpu: "2" +# ephemeral-storage: "26G" +# memory: 2G +# requests: +# cpu: 500m +# ephemeral-storage: "25G" +# memory: 500M +# - patch: |- +# apiVersion: apps/v1 +# kind: StatefulSet +# metadata: +# name: symbols +# spec: +# replicas: 1 +# template: +# spec: +# containers: +# - name: symbols +# resources: +# limits: +# cpu: "2" +# ephemeral-storage: "12G" +# memory: 2G +# requests: +# cpu: 500m +# ephemeral-storage: "10G" +# memory: 500M +# - patch: |- +# apiVersion: apps/v1 +# kind: Deployment +# metadata: +# name: searcher +# spec: +# replicas: 2 +# template: +# spec: +# containers: +# - name: searcher +# resources: +# limits: +# cpu: "2" +# ephemeral-storage: "26G" +# memory: 2G +# requests: +# cpu: 500m +# ephemeral-storage: "25G" +# memory: 500M +# - patch: |- +# apiVersion: apps/v1 +# kind: Deployment +# metadata: +# name: symbols +# spec: +# replicas: 1 +# template: +# spec: +# containers: +# - name: symbols +# resources: +# limits: +# cpu: "2" +# ephemeral-storage: "12G" +# memory: 2G +# requests: +# cpu: 500m +# ephemeral-storage: "10G" +# memory: 500M +# - patch: |- +# apiVersion: apps/v1 +# kind: Deployment +# metadata: +# name: syntect-server +# spec: +# replicas: 1 +# template: +# spec: +# containers: +# - name: syntect-server +# resources: +# limits: +# cpu: "4" +# memory: 6G +# requests: +# cpu: 250m +# memory: 2G +# - patch: |- +# apiVersion: apps/v1 +# kind: Deployment +# metadata: +# name: worker +# spec: +# replicas: 1 +# template: +# spec: +# containers: +# - name: worker +# resources: +# limits: +# cpu: "2" +# memory: 4G +# requests: +# cpu: 500m +# memory: 2G +# - patch: |- +# apiVersion: apps/v1 +# kind: DaemonSet +# metadata: +# name: otel-agent +# spec: +# template: +# spec: +# containers: +# - name: otel-agent +# resources: +# limits: +# cpu: "500m" +# memory: 500Mi +# requests: +# cpu: "100m" +# memory: 100Mi +# - patch: |- +# apiVersion: apps/v1 +# kind: Deployment +# metadata: +# name: otel-collector +# spec: +# replicas: 1 +# template: +# spec: +# containers: +# - name: otel-collector +# resources: +# limits: +# cpu: "1" +# memory: 2Gi +# requests: +# cpu: "0.5" +# memory: 512Mi +# - patch: |- +# apiVersion: v1 +# kind: PersistentVolumeClaim +# metadata: +# name: blobstore +# spec: +# resources: +# requests: +# storage: 100Gi +# - patch: |- +# apiVersion: v1 +# kind: PersistentVolumeClaim +# metadata: +# name: codeinsights-db +# spec: +# resources: +# requests: +# storage: 200Gi +# - patch: |- +# apiVersion: v1 +# kind: PersistentVolumeClaim +# metadata: +# name: codeintel-db +# spec: +# resources: +# requests: +# storage: 200Gi +# - patch: |- +# apiVersion: v1 +# kind: PersistentVolumeClaim +# metadata: +# name: pgsql +# spec: +# resources: +# requests: +# storage: 200Gi +# - patch: |- +# apiVersion: v1 +# kind: PersistentVolumeClaim +# metadata: +# name: prometheus +# spec: +# resources: +# requests: +# storage: 200Gi +# - patch: |- +# apiVersion: v1 +# kind: PersistentVolumeClaim +# metadata: +# name: redis-cache +# spec: +# resources: +# requests: +# storage: 100Gi +# - patch: |- +# apiVersion: v1 +# kind: PersistentVolumeClaim +# metadata: +# name: redis-store +# spec: +# resources: +# requests: +# storage: 100Gi diff --git a/components/monitoring/rbacs/kustomization.yaml b/components/monitoring/rbacs/kustomization.yaml index ae57be12..e2ab8174 100644 --- a/components/monitoring/rbacs/kustomization.yaml +++ b/components/monitoring/rbacs/kustomization.yaml @@ -10,16 +10,6 @@ patches: - patch: |- - op: remove path: /data/prometheus.yml - - op: remove - path: /data/gitserver_targets.yml - - op: remove - path: /data/indexed-search_targets.yml - - op: remove - path: /data/prometheus_targets.yml - - op: remove - path: /data/searcher_targets.yml - - op: remove - path: /data/symbols_targets.yml - op: remove path: /data/extra_rules.yml target: diff --git a/components/sizes/l/kustomization.yaml b/components/sizes/l/kustomization.yaml index 39b7eb59..c4a298aa 100644 --- a/components/sizes/l/kustomization.yaml +++ b/components/sizes/l/kustomization.yaml @@ -34,11 +34,6 @@ patches: kind: StatefulSet|Deployment name: codeintel-db version: v1 - - path: patches/prometheus.yaml - target: - kind: ConfigMap - name: prometheus - version: v1 - patch: |- apiVersion: apps/v1 kind: Deployment diff --git a/components/sizes/l/patches/prometheus.yaml b/components/sizes/l/patches/prometheus.yaml deleted file mode 100644 index d055bafa..00000000 --- a/components/sizes/l/patches/prometheus.yaml +++ /dev/null @@ -1,39 +0,0 @@ -- op: replace - path: /data/indexed-search_targets.yml - value: | - - labels: - nodename: "sourcegraph-services" - job: zoekt-indexserver - targets: - - indexed-search-0.indexed-search:6072 - - indexed-search-1.indexed-search:6072 - - labels: - nodename: "sourcegraph-services" - job: zoekt-webserver - targets: - - indexed-search-0.indexed-search:6070 - - indexed-search-1.indexed-search:6070 -- op: replace - path: /data/gitserver_targets.yml - value: | - - labels: - nodename: "sourcegraph-services" - job: gitserver - targets: - - gitserver-0.gitserver:6060 -- op: replace - path: /data/searcher_targets.yml - value: | - - labels: - nodename: "sourcegraph-services" - job: searcher - targets: - - searcher-0.searcher:6060 -- op: replace - path: /data/symbols_targets.yml - value: | - - labels: - nodename: "sourcegraph-services" - job: symbols - targets: - - symbols-0.symbols:6060 diff --git a/components/sizes/m/kustomization.yaml b/components/sizes/m/kustomization.yaml index 5514e982..41d6b7b5 100644 --- a/components/sizes/m/kustomization.yaml +++ b/components/sizes/m/kustomization.yaml @@ -34,11 +34,6 @@ patches: kind: StatefulSet|Deployment name: codeintel-db version: v1 - - path: patches/prometheus.yaml - target: - kind: ConfigMap - name: prometheus - version: v1 - path: patches/endpoints.yaml - patch: |- apiVersion: apps/v1 diff --git a/components/sizes/m/patches/prometheus.yaml b/components/sizes/m/patches/prometheus.yaml deleted file mode 100644 index 378b4a55..00000000 --- a/components/sizes/m/patches/prometheus.yaml +++ /dev/null @@ -1,37 +0,0 @@ -- op: replace - path: /data/indexed-search_targets.yml - value: | - - labels: - nodename: "sourcegraph-services" - job: zoekt-indexserver - targets: - - indexed-search-0.indexed-search:6072 - - labels: - nodename: "sourcegraph-services" - job: zoekt-webserver - targets: - - indexed-search-0.indexed-search:6070 -- op: replace - path: /data/gitserver_targets.yml - value: | - - labels: - nodename: "sourcegraph-services" - job: gitserver - targets: - - gitserver-0.gitserver:6060 -- op: replace - path: /data/searcher_targets.yml - value: | - - labels: - nodename: "sourcegraph-services" - job: searcher - targets: - - searcher-0.searcher:6060 -- op: replace - path: /data/symbols_targets.yml - value: | - - labels: - nodename: "sourcegraph-services" - job: symbols - targets: - - symbols-0.symbols:6060 diff --git a/components/sizes/s/kustomization.yaml b/components/sizes/s/kustomization.yaml index f8cdb6fe..93eb0290 100644 --- a/components/sizes/s/kustomization.yaml +++ b/components/sizes/s/kustomization.yaml @@ -34,11 +34,6 @@ patches: kind: StatefulSet|Deployment name: codeintel-db version: v1 - - path: patches/prometheus.yaml - target: - kind: ConfigMap - name: prometheus - version: v1 - patch: |- apiVersion: apps/v1 kind: Deployment diff --git a/components/sizes/s/patches/prometheus.yaml b/components/sizes/s/patches/prometheus.yaml deleted file mode 100644 index 378b4a55..00000000 --- a/components/sizes/s/patches/prometheus.yaml +++ /dev/null @@ -1,37 +0,0 @@ -- op: replace - path: /data/indexed-search_targets.yml - value: | - - labels: - nodename: "sourcegraph-services" - job: zoekt-indexserver - targets: - - indexed-search-0.indexed-search:6072 - - labels: - nodename: "sourcegraph-services" - job: zoekt-webserver - targets: - - indexed-search-0.indexed-search:6070 -- op: replace - path: /data/gitserver_targets.yml - value: | - - labels: - nodename: "sourcegraph-services" - job: gitserver - targets: - - gitserver-0.gitserver:6060 -- op: replace - path: /data/searcher_targets.yml - value: | - - labels: - nodename: "sourcegraph-services" - job: searcher - targets: - - searcher-0.searcher:6060 -- op: replace - path: /data/symbols_targets.yml - value: | - - labels: - nodename: "sourcegraph-services" - job: symbols - targets: - - symbols-0.symbols:6060 diff --git a/components/sizes/xl/kustomization.yaml b/components/sizes/xl/kustomization.yaml index cac413e9..ac42be79 100644 --- a/components/sizes/xl/kustomization.yaml +++ b/components/sizes/xl/kustomization.yaml @@ -34,11 +34,6 @@ patches: kind: StatefulSet|Deployment name: codeintel-db version: v1 - - path: patches/prometheus.yaml - target: - kind: ConfigMap - name: prometheus - version: v1 - patch: |- apiVersion: apps/v1 kind: Deployment diff --git a/components/sizes/xl/patches/prometheus.yaml b/components/sizes/xl/patches/prometheus.yaml deleted file mode 100644 index 3827a2b8..00000000 --- a/components/sizes/xl/patches/prometheus.yaml +++ /dev/null @@ -1,43 +0,0 @@ -- op: replace - path: /data/indexed-search_targets.yml - value: | - - labels: - nodename: "sourcegraph-services" - job: zoekt-indexserver - targets: - - indexed-search-0.indexed-search:6072 - - indexed-search-1.indexed-search:6072 - - indexed-search-2.indexed-search:6072 - - labels: - nodename: "sourcegraph-services" - job: zoekt-webserver - targets: - - indexed-search-0.indexed-search:6070 - - indexed-search-1.indexed-search:6070 - - indexed-search-2.indexed-search:6070 -- op: replace - path: /data/gitserver_targets.yml - value: | - - labels: - nodename: "sourcegraph-services" - job: gitserver - targets: - - gitserver-0.gitserver:6060 - - gitserver-1.gitserver:6060 -- op: replace - path: /data/searcher_targets.yml - value: | - - labels: - nodename: "sourcegraph-services" - job: searcher - targets: - - searcher-0.searcher:6060 - - searcher-1.searcher:6060 -- op: replace - path: /data/symbols_targets.yml - value: | - - labels: - nodename: "sourcegraph-services" - job: symbols - targets: - - symbols-0.symbols:6060 diff --git a/components/sizes/xs/kustomization.yaml b/components/sizes/xs/kustomization.yaml index dfe0dc61..0e7daaea 100644 --- a/components/sizes/xs/kustomization.yaml +++ b/components/sizes/xs/kustomization.yaml @@ -22,11 +22,6 @@ patches: kind: StatefulSet|Deployment name: pgsql|codeinsights-db|codeintel-db version: v1 - - path: patches/prometheus.yaml - target: - kind: ConfigMap - name: prometheus - version: v1 - patch: |- apiVersion: apps/v1 kind: Deployment diff --git a/components/sizes/xs/patches/prometheus.yaml b/components/sizes/xs/patches/prometheus.yaml deleted file mode 100644 index 378b4a55..00000000 --- a/components/sizes/xs/patches/prometheus.yaml +++ /dev/null @@ -1,37 +0,0 @@ -- op: replace - path: /data/indexed-search_targets.yml - value: | - - labels: - nodename: "sourcegraph-services" - job: zoekt-indexserver - targets: - - indexed-search-0.indexed-search:6072 - - labels: - nodename: "sourcegraph-services" - job: zoekt-webserver - targets: - - indexed-search-0.indexed-search:6070 -- op: replace - path: /data/gitserver_targets.yml - value: | - - labels: - nodename: "sourcegraph-services" - job: gitserver - targets: - - gitserver-0.gitserver:6060 -- op: replace - path: /data/searcher_targets.yml - value: | - - labels: - nodename: "sourcegraph-services" - job: searcher - targets: - - searcher-0.searcher:6060 -- op: replace - path: /data/symbols_targets.yml - value: | - - labels: - nodename: "sourcegraph-services" - job: symbols - targets: - - symbols-0.symbols:6060 diff --git a/instances/template/kustomization.template.yaml b/instances/template/kustomization.template.yaml index 43a23efc..d8044d23 100644 --- a/instances/template/kustomization.template.yaml +++ b/instances/template/kustomization.template.yaml @@ -21,7 +21,7 @@ resources: # ---------------- Add additional resources below this line if needed ---------------- # # - ########################################################################################## -# [NAMESPACE] Add namespace to all resources generated by this overlay +# [REQUIRED: NAMESPACE] Add namespace to all resources generated by this overlay # # NOTE: Include the 'namespace' component to create namespace with the same name if needed ########################################################################################## @@ -62,6 +62,7 @@ components: # - ../../components/sizes/m # -- Allocate resources for size M instance # - ../../components/sizes/l # -- Allocate resources for size L instance # - ../../components/sizes/xl # -- Allocate resources for size XL instance + # - custom-resources # -- Allocate customized resources --See docs for detailed instructions # #--------------------------------------------------------------------------------------- # Storage class @@ -153,6 +154,10 @@ components: # Permission Configurations # IMPORTANT: Keep the components below as the LAST components # ------------------------------------------------------------------------ + # [DO NOT REMOVE] This component add replica count for some statefulset services as env vars to frontend + # so that when service discovery is disabled, frontend can generate service endpoints based on replica count + - ../../components/utils/endpoints # REQUIRED - DO NOT REMOVE + # # - ../../components/privileged # -- Run Sourcegraph with privileged and root access # - ../../components/monitoring/privileged # -- Run monitoring stack with privileged and root access # From d673ef5b56561e8d547b4b6b2a1b6b62d5101ce7 Mon Sep 17 00:00:00 2001 From: Beatrix Date: Thu, 23 Feb 2023 08:58:14 -0800 Subject: [PATCH 12/13] release: sourcegraph@4.5.0 --- .../cadvisor/cadvisor.DaemonSet.yaml | 2 +- .../grafana/grafana.StatefulSet.yaml | 2 +- base/monitoring/jaeger/jaeger.Deployment.yaml | 2 +- .../node-exporter.DaemonSet.yaml | 2 +- .../otel-collector/otel-agent.DaemonSet.yaml | 2 +- .../otel-collector.Deployment.yaml | 2 +- .../prometheus/prometheus.ConfigMap.yaml | 142 +-------- .../prometheus/prometheus.Deployment.yaml | 2 +- .../prometheus/rbac/prometheus.ConfigMap.yaml | 291 +----------------- .../blobstore/blobstore.Deployment.yaml | 2 +- .../codeinsights-db.StatefulSet.yaml | 6 +- .../codeintel-db.StatefulSet.yaml | 6 +- .../rbac/sourcegraph-frontend.Role.yaml | 11 +- .../sourcegraph-frontend.Deployment.yaml | 4 +- .../github-proxy/github-proxy.Deployment.yaml | 2 +- .../gitserver/gitserver.StatefulSet.yaml | 2 +- .../indexed-search.StatefulSet.yaml | 4 +- base/sourcegraph/pgsql/pgsql.StatefulSet.yaml | 13 +- .../precise-code-intel/worker.Deployment.yaml | 2 +- .../redis/redis-cache.Deployment.yaml | 4 +- .../redis/redis-store.Deployment.yaml | 4 +- .../repo-updater/repo-updater.Deployment.yaml | 2 +- .../searcher/searcher.StatefulSet.yaml | 2 +- .../symbols/symbols.StatefulSet.yaml | 2 +- .../syntect-server.Deployment.yaml | 2 +- .../sourcegraph/worker/worker.Deployment.yaml | 2 +- 26 files changed, 41 insertions(+), 476 deletions(-) diff --git a/base/monitoring/cadvisor/cadvisor.DaemonSet.yaml b/base/monitoring/cadvisor/cadvisor.DaemonSet.yaml index 9a5cba78..fdb25514 100644 --- a/base/monitoring/cadvisor/cadvisor.DaemonSet.yaml +++ b/base/monitoring/cadvisor/cadvisor.DaemonSet.yaml @@ -26,7 +26,7 @@ spec: serviceAccountName: cadvisor containers: - name: cadvisor - image: index.docker.io/sourcegraph/cadvisor:4.4.2@sha256:4c3af0c4fd9ea4425d38f7d1a784833c5fd542542cdbb81292044773e686fa60 + image: index.docker.io/sourcegraph/cadvisor:4.5.0@sha256:5117f2bc817c16fb129acb6f9b070af8f1be09d3d9a8f88e3297f7adfff9af0d args: # Kubernetes-specific flags below (other flags are baked into the Docker image) # diff --git a/base/monitoring/grafana/grafana.StatefulSet.yaml b/base/monitoring/grafana/grafana.StatefulSet.yaml index 9ebc6e03..2be58cbe 100644 --- a/base/monitoring/grafana/grafana.StatefulSet.yaml +++ b/base/monitoring/grafana/grafana.StatefulSet.yaml @@ -26,7 +26,7 @@ spec: spec: containers: - name: grafana - image: index.docker.io/sourcegraph/grafana:4.4.2@sha256:69777c3a895a03eee035c173c91c0f25893285118c06e51a67728ec4259e2296 + image: index.docker.io/sourcegraph/grafana:4.5.0@sha256:f70a7f79c5c90cab0d5cfb8f3dbca4dc60ed390b045aff1a86079c87bfe9a8af terminationMessagePolicy: FallbackToLogsOnError ports: - containerPort: 3370 diff --git a/base/monitoring/jaeger/jaeger.Deployment.yaml b/base/monitoring/jaeger/jaeger.Deployment.yaml index 5bf5d281..6af6fe65 100644 --- a/base/monitoring/jaeger/jaeger.Deployment.yaml +++ b/base/monitoring/jaeger/jaeger.Deployment.yaml @@ -30,7 +30,7 @@ spec: spec: containers: - name: jaeger - image: index.docker.io/sourcegraph/jaeger-all-in-one:insiders@sha256:462ef3b4a5fa9227f04c2f4bc2968970fad0fcc9efbaf89adaad0ef98a24b53f + image: index.docker.io/sourcegraph/jaeger-all-in-one:4.5.0@sha256:461476b01968324a0d8cb43a0176713e006f99cdb1f2efc3ab2210fd0bb812c2 args: ["--memory.max-traces=20000"] ports: - containerPort: 5775 diff --git a/base/monitoring/node-exporter/node-exporter.DaemonSet.yaml b/base/monitoring/node-exporter/node-exporter.DaemonSet.yaml index 7116d6d5..defd94a3 100644 --- a/base/monitoring/node-exporter/node-exporter.DaemonSet.yaml +++ b/base/monitoring/node-exporter/node-exporter.DaemonSet.yaml @@ -24,7 +24,7 @@ spec: spec: containers: - name: node-exporter - image: index.docker.io/sourcegraph/node-exporter:4.4.2@sha256:fa8e5700b7762fffe0674e944762f44bb787a7e44d97569fe55348260453bf80 + image: index.docker.io/sourcegraph/node-exporter:4.5.0@sha256:fa8e5700b7762fffe0674e944762f44bb787a7e44d97569fe55348260453bf80 imagePullPolicy: IfNotPresent resources: limits: diff --git a/base/monitoring/otel-collector/otel-agent.DaemonSet.yaml b/base/monitoring/otel-collector/otel-agent.DaemonSet.yaml index e47fbb05..87e98e24 100644 --- a/base/monitoring/otel-collector/otel-agent.DaemonSet.yaml +++ b/base/monitoring/otel-collector/otel-agent.DaemonSet.yaml @@ -26,7 +26,7 @@ spec: spec: containers: - name: otel-agent - image: index.docker.io/sourcegraph/opentelemetry-collector:4.4.2@sha256:f0723c96c973258ad3123ddc479261bb8f5827bbac1d091b6a683fde55334413 + image: index.docker.io/sourcegraph/opentelemetry-collector:4.5.0@sha256:12f3fc137edea8319ebf574e15e6c27c19fb0b7ca17165973f98c8d8c342ca1d command: - "/bin/otelcol-sourcegraph" - "--config=/etc/otel-agent/config.yaml" diff --git a/base/monitoring/otel-collector/otel-collector.Deployment.yaml b/base/monitoring/otel-collector/otel-collector.Deployment.yaml index d7ac4a8b..07efca7e 100644 --- a/base/monitoring/otel-collector/otel-collector.Deployment.yaml +++ b/base/monitoring/otel-collector/otel-collector.Deployment.yaml @@ -26,7 +26,7 @@ spec: spec: containers: - name: otel-collector - image: index.docker.io/sourcegraph/opentelemetry-collector:4.4.2@sha256:f0723c96c973258ad3123ddc479261bb8f5827bbac1d091b6a683fde55334413 + image: index.docker.io/sourcegraph/opentelemetry-collector:4.5.0@sha256:12f3fc137edea8319ebf574e15e6c27c19fb0b7ca17165973f98c8d8c342ca1d command: - "/bin/otelcol-sourcegraph" # To use a custom configuration, edit otel-collector.ConfigMap.yaml diff --git a/base/monitoring/prometheus/prometheus.ConfigMap.yaml b/base/monitoring/prometheus/prometheus.ConfigMap.yaml index 08703259..1ee94a98 100644 --- a/base/monitoring/prometheus/prometheus.ConfigMap.yaml +++ b/base/monitoring/prometheus/prometheus.ConfigMap.yaml @@ -7,146 +7,7 @@ metadata: app.kubernetes.io/component: prometheus name: prometheus data: - prometheus.yml: | - # Prometheus global config - global: - scrape_interval: 30s - evaluation_interval: 30s - # scrape_timeout is set to the global default (10s). - - # Alertmanager configuration - alerting: - alertmanagers: - # bundled alertmanager, started by prom-wrapper - - static_configs: - - targets: ['127.0.0.1:9093'] - path_prefix: /alertmanager - # add more alertmanagers here - - # Load rules once and periodically evaluate them according to the global 'evaluation_interval'. - rule_files: - - '/sg_config_prometheus/*_rules.yml' - - '/sg_prometheus_add_ons/*_rules.yml' - - # Configure targets to scrape - scrape_configs: - - # Scrape prometheus itself for metrics. - - job_name: 'builtin-prometheus' - static_configs: - - targets: ['127.0.0.1:9092'] - - - job_name: 'builtin-alertmanager' - metrics_path: /alertmanager/metrics - static_configs: - - targets: ['127.0.0.1:9093'] - - ########################################################################################## - # cadvisor - ########################################################################################## - - - job_name: 'kubernetes-pods' - dns_sd_configs: - - names: - - 'cadvisor.default.svc.cluster.local' - - 'cadvisor.ns-sourcegraph.svc.cluster.local' - type: A - port: 48080 - relabel_configs: - - source_labels: [__address__] - target_label: instance - regex: (.*)\.(.*) - replacement: ${1}_${2} - - source_labels: [container_label_io_kubernetes_pod_name] - target_label: name - metric_relabel_configs: - - source_labels: [container_label_io_kubernetes_pod_namespace] - regex: kube-system - action: drop - - source_labels: [container_label_io_kubernetes_container_name, container_label_io_kubernetes_pod_name] - regex: (.+) - action: replace - target_label: name - separator: '-' - - ########################################################################################## - # sourcegraph-services - ########################################################################################## - - - job_name: 'sourcegraph-services' - relabel_configs: - - source_labels: [__address__] - target_label: instance - regex: (.*)\.(.*) - replacement: ${1}_${2} - metric_relabel_configs: - - source_labels: [container_label_io_kubernetes_pod_namespace] - regex: kube-system - action: drop - file_sd_configs: - - files: - - '/sg_prometheus_add_ons/*_targets.yml' - - - job_name: 'sourcegraph-statefulsets' - dns_sd_configs: - - names: - - 'symbols.default.svc.cluster.local' - - 'symbols.ns-sourcegraph.svc.cluster.local' - - 'symbols.$SG_NAMESPACE.svc.cluster.local' - - 'searcher.default.svc.cluster.local' - - 'searcher.ns-sourcegraph.svc.cluster.local' - - 'searcher.$SG_NAMESPACE.svc.cluster.local' - - 'gitserver.default.svc.cluster.local' - - 'gitserver.ns-sourcegraph.svc.cluster.local' - - 'gitserver.$SG_NAMESPACE.svc.cluster.local' - - 'sourcegraph-frontend.default.svc.cluster.local' - - 'sourcegraph-frontend.ns-sourcegraph.svc.cluster.local' - - 'sourcegraph-frontend.$SG_NAMESPACE.svc.cluster.local' - - 'indexed-search.default.svc.cluster.local' - - 'indexed-search.ns-sourcegraph.svc.cluster.local' - - 'indexed-search.$SG_NAMESPACE.svc.cluster.local' - - 'indexed-search-indexer.default.svc.cluster.local' - - 'indexed-search-indexer.ns-sourcegraph.svc.cluster.local' - - 'indexed-search-indexer.$SG_NAMESPACE.svc.cluster.local' - type: SRV - relabel_configs: - - source_labels: [__meta_dns_srv_record_target] - target_label: __address__ - regex: (.*)\. - replacement: ${1}:6060 - - source_labels: [__meta_dns_srv_record_target] - target_label: __address__ - regex: ^(indexed-search.*)\. - replacement: ${1}:6070 - - source_labels: [__meta_dns_srv_record_target] - target_label: __address__ - regex: (.*)\.(indexed-search-indexer.*)\. - replacement: ${1}.${2}:6072 - - source_labels: [__meta_dns_srv_record_port] - target_label: __meta_dns_srv_record_port - replacement: 6060 - - source_labels: [__address__] - regex: ^(indexed-search).*$ - target_label: __meta_dns_srv_record_port - replacement: 6070 - - source_labels: [__meta_dns_name] - target_label: job - regex: (.*)\..*\..*\..*\..* - replacement: ${1} - - source_labels: [__meta_dns_srv_record_target] - regex: (.*)\.(.*)\..*\..*\..*\..*\..* - target_label: instance - replacement: ${2}_${1} - metric_relabel_configs: - - source_labels: [__address__] - target_label: instance - regex: (.*)\:.* - replacement: $1:6060 - - source_labels: [__address__] - target_label: instance - regex: (.*)\.(.*)\..*\..*\..*\..*\..* - replacement: ${2}_${1} - + prometheus.yml: "# Prometheus global config\nglobal:\n scrape_interval: 30s\n evaluation_interval: 30s\n # scrape_timeout is set to the global default (10s).\n\n# Alertmanager configuration\nalerting:\n alertmanagers:\n # bundled alertmanager, started by prom-wrapper\n - static_configs:\n - targets: ['127.0.0.1:9093']\n path_prefix: /alertmanager\n # add more alertmanagers here\n\n# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.\nrule_files:\n - '/sg_config_prometheus/*_rules.yml'\n - '/sg_prometheus_add_ons/*_rules.yml'\n\n# Configure targets to scrape\nscrape_configs:\n\n # Scrape prometheus itself for metrics.\n - job_name: 'builtin-prometheus'\n static_configs:\n - targets: ['127.0.0.1:9092']\n\n - job_name: 'builtin-alertmanager'\n metrics_path: /alertmanager/metrics\n static_configs:\n - targets: ['127.0.0.1:9093']\n\n ##########################################################################################\n # cadvisor \n ##########################################################################################\n\n - job_name: 'kubernetes-pods'\n dns_sd_configs:\n - names:\n - 'cadvisor.default.svc.cluster.local'\n - 'cadvisor.ns-sourcegraph.svc.cluster.local'\n type: A\n port: 48080\n relabel_configs:\n - source_labels: [__address__]\n target_label: instance\n regex: (.*)\\.(.*)\n replacement: ${1}_${2}\n - source_labels: [container_label_io_kubernetes_pod_name]\n target_label: name\n metric_relabel_configs:\n - source_labels: [container_label_io_kubernetes_pod_namespace]\n regex: kube-system\n action: drop\n - source_labels: [container_label_io_kubernetes_container_name, container_label_io_kubernetes_pod_name]\n regex: (.+)\n action: replace\n target_label: name\n separator: '-'\n \n ##########################################################################################\n # sourcegraph-services \n ##########################################################################################\n \n - job_name: 'sourcegraph-services'\n relabel_configs:\n - source_labels: [__address__]\n target_label: instance\n regex: (.*)\\.(.*)\n replacement: ${1}_${2}\n metric_relabel_configs:\n - source_labels: [container_label_io_kubernetes_pod_namespace]\n regex: kube-system\n action: drop\n file_sd_configs:\n - files:\n - '/sg_prometheus_add_ons/*_targets.yml'\n\n - job_name: 'sourcegraph-statefulsets'\n dns_sd_configs:\n - names:\n - 'symbols.default.svc.cluster.local'\n - 'symbols.ns-sourcegraph.svc.cluster.local'\n - 'symbols.$SG_NAMESPACE.svc.cluster.local'\n - 'searcher.default.svc.cluster.local'\n - 'searcher.ns-sourcegraph.svc.cluster.local'\n - 'searcher.$SG_NAMESPACE.svc.cluster.local'\n - 'gitserver.default.svc.cluster.local'\n - 'gitserver.ns-sourcegraph.svc.cluster.local'\n - 'gitserver.$SG_NAMESPACE.svc.cluster.local'\n - 'sourcegraph-frontend.default.svc.cluster.local'\n - 'sourcegraph-frontend.ns-sourcegraph.svc.cluster.local'\n - 'sourcegraph-frontend.$SG_NAMESPACE.svc.cluster.local'\n - 'indexed-search.default.svc.cluster.local'\n - 'indexed-search.ns-sourcegraph.svc.cluster.local'\n - 'indexed-search.$SG_NAMESPACE.svc.cluster.local'\n - 'indexed-search-indexer.default.svc.cluster.local'\n - 'indexed-search-indexer.ns-sourcegraph.svc.cluster.local'\n - 'indexed-search-indexer.$SG_NAMESPACE.svc.cluster.local'\n type: SRV\n relabel_configs:\n - source_labels: [__meta_dns_srv_record_target]\n target_label: __address__\n regex: (.*)\\.\n replacement: ${1}:6060\n - source_labels: [__meta_dns_srv_record_target]\n target_label: __address__\n regex: ^(indexed-search.*)\\.\n replacement: ${1}:6070\n - source_labels: [__meta_dns_srv_record_target]\n target_label: __address__\n regex: (.*)\\.(indexed-search-indexer.*)\\.\n replacement: ${1}.${2}:6072\n - source_labels: [__meta_dns_srv_record_port]\n target_label: __meta_dns_srv_record_port\n replacement: 6060\n - source_labels: [__address__]\n regex: ^(indexed-search).*$\n target_label: __meta_dns_srv_record_port\n replacement: 6070\n - source_labels: [__meta_dns_name]\n target_label: job\n regex: (.*)\\..*\\..*\\..*\\..*\n replacement: ${1}\n - source_labels: [__meta_dns_srv_record_target]\n regex: (.*)\\.(.*)\\..*\\..*\\..*\\..*\\..*\n target_label: instance\n replacement: ${2}_${1}\n metric_relabel_configs:\n - source_labels: [__address__]\n target_label: instance\n regex: (.*)\\:.*\n replacement: $1:6060\n - source_labels: [__address__]\n target_label: instance\n regex: (.*)\\.(.*)\\..*\\..*\\..*\\..*\\..*\n replacement: ${2}_${1}\n" prometheus_targets.yml: | - labels: nodename: "sourcegraph-services" @@ -223,7 +84,6 @@ data: job: otel-collector targets: - otel-collector:8888 - extra_rules.yml: | groups: - name: container.rules diff --git a/base/monitoring/prometheus/prometheus.Deployment.yaml b/base/monitoring/prometheus/prometheus.Deployment.yaml index 018bb3d1..2c11ad00 100644 --- a/base/monitoring/prometheus/prometheus.Deployment.yaml +++ b/base/monitoring/prometheus/prometheus.Deployment.yaml @@ -25,7 +25,7 @@ spec: spec: containers: - name: prometheus - image: index.docker.io/sourcegraph/prometheus:4.4.2@sha256:d833d00a39937cf700f276f816dc789615d6396979418a7d9362386513b1fc9d + image: index.docker.io/sourcegraph/prometheus:4.5.0@sha256:4fe9a5fdee206b1aac9d32afb31ad57e1882394aad9e7e9f719a1b2741afcae5 terminationMessagePolicy: FallbackToLogsOnError env: - name: SG_NAMESPACE diff --git a/base/monitoring/prometheus/rbac/prometheus.ConfigMap.yaml b/base/monitoring/prometheus/rbac/prometheus.ConfigMap.yaml index 593e1c9e..1157f429 100644 --- a/base/monitoring/prometheus/rbac/prometheus.ConfigMap.yaml +++ b/base/monitoring/prometheus/rbac/prometheus.ConfigMap.yaml @@ -7,295 +7,6 @@ metadata: app.kubernetes.io/component: prometheus name: prometheus-rbac data: - prometheus.yml: | - global: - scrape_interval: 30s - evaluation_interval: 30s - - alerting: - alertmanagers: - # Bundled Alertmanager, started by prom-wrapper - - static_configs: - - targets: ['127.0.0.1:9093'] - path_prefix: /alertmanager - # Uncomment the following to have alerts delivered to additional Alertmanagers discovered - # in the cluster. This configuration is not required if you use Sourcegraph's built-in alerting: - # https://docs.sourcegraph.com/admin/observability/alerting - # - kubernetes_sd_configs: - # - role: endpoints - # relabel_configs: - # - source_labels: [__meta_kubernetes_service_name] - # regex: alertmanager - # action: keep - - rule_files: - - '*_rules.yml' - - "/sg_config_prometheus/*_rules.yml" - - "/sg_prometheus_add_ons/*_rules.yml" - - # A scrape configuration for running Prometheus on a Kubernetes cluster. - # This uses separate scrape configs for cluster components (i.e. API server, node) - # and services to allow each to use different authentication configs. - # - # Kubernetes labels will be added as Prometheus labels on metrics via the - # `labelmap` relabeling action. - - # Scrape config for API servers. - # - # Kubernetes exposes API servers as endpoints to the default/kubernetes - # service so this uses `endpoints` role and uses relabelling to only keep - # the endpoints associated with the default/kubernetes service using the - # default named port `https`. This works for single API server deployments as - # well as HA API server deployments. - scrape_configs: - - job_name: 'kubernetes-apiservers' - - kubernetes_sd_configs: - - role: endpoints - - # Default to scraping over https. If required, just disable this or change to - # `http`. - scheme: https - - # This TLS & bearer token file config is used to connect to the actual scrape - # endpoints for cluster components. This is separate to discovery auth - # configuration because discovery & scraping are two separate concerns in - # Prometheus. The discovery auth config is automatic if Prometheus runs inside - # the cluster. Otherwise, more config options have to be provided within the - # . - tls_config: - ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt - # If your node certificates are self-signed or use a different CA to the - # master CA, then disable certificate verification below. Note that - # certificate verification is an integral part of a secure infrastructure - # so this should only be disabled in a controlled environment. You can - # disable certificate verification by uncommenting the line below. - # - # insecure_skip_verify: true - bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token - - # Keep only the default/kubernetes service endpoints for the https port. This - # will add targets for each API server which Kubernetes adds an endpoint to - # the default/kubernetes service. - relabel_configs: - - source_labels: [__meta_kubernetes_namespace, __meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name] - action: keep - regex: default;kubernetes;https - - - job_name: 'kubernetes-nodes' - - # Default to scraping over https. If required, just disable this or change to - # `http`. - scheme: https - - # This TLS & bearer token file config is used to connect to the actual scrape - # endpoints for cluster components. This is separate to discovery auth - # configuration because discovery & scraping are two separate concerns in - # Prometheus. The discovery auth config is automatic if Prometheus runs inside - # the cluster. Otherwise, more config options have to be provided within the - # . - tls_config: - ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt - # If your node certificates are self-signed or use a different CA to the - # master CA, then disable certificate verification below. Note that - # certificate verification is an integral part of a secure infrastructure - # so this should only be disabled in a controlled environment. You can - # disable certificate verification by uncommenting the line below. - # - insecure_skip_verify: true - bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token - - kubernetes_sd_configs: - - role: node - - relabel_configs: - - action: labelmap - regex: __meta_kubernetes_node_label_(.+) - - target_label: __address__ - replacement: kubernetes.default.svc:443 - - source_labels: [__meta_kubernetes_node_name] - regex: (.+) - target_label: __metrics_path__ - replacement: /api/v1/nodes/${1}/proxy/metrics - - # Scrape config for service endpoints. - # - # The relabeling allows the actual service scrape endpoint to be configured - # via the following annotations: - # - # * `sourcegraph.prometheus/scrape`: Only scrape services that have a value of `true` - # * `prometheus.io/scheme`: If the metrics endpoint is secured then you will need - # to set this to `https` & most likely set the `tls_config` of the scrape config. - # * `prometheus.io/path`: If the metrics path is not `/metrics` override this. - # * `prometheus.io/port`: If the metrics are exposed on a different port to the - # service then set this appropriately. - - job_name: 'kubernetes-service-endpoints' - - kubernetes_sd_configs: - - role: endpoints - - relabel_configs: - # Sourcegraph specific customization, only scrape pods with our annotation - - source_labels: [__meta_kubernetes_service_annotation_sourcegraph_prometheus_scrape] - action: keep - regex: true - - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scheme] - action: replace - target_label: __scheme__ - regex: (https?) - - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_path] - action: replace - target_label: __metrics_path__ - regex: (.+) - - source_labels: [__address__, __meta_kubernetes_service_annotation_prometheus_io_port] - action: replace - target_label: __address__ - regex: (.+)(?::\d+);(\d+) - replacement: $1:$2 - - action: labelmap - regex: __meta_kubernetes_service_label_(.+) - - source_labels: [__meta_kubernetes_namespace] - action: replace - # Sourcegraph specific customization. We want a more convenient to type label. - # target_label: kubernetes_namespace - target_label: ns - - source_labels: [__meta_kubernetes_service_name] - action: replace - target_label: kubernetes_name - # Sourcegraph specific customization. We want a nicer name for job - - source_labels: [app] - action: replace - target_label: job - # Sourcegraph specific customization. We want a nicer name for instance - - source_labels: [__meta_kubernetes_pod_name] - action: replace - target_label: instance - # Sourcegraph specific customization. We want to add a label to every - # metric that indicates the node it came from. - - source_labels: [__meta_kubernetes_endpoint_node_name] - action: replace - target_label: nodename - metric_relabel_configs: - # Sourcegraph specific customization. Drop metrics with empty nodename responses from the k8s API - - source_labels: [nodename] - regex: ^$ - action: drop - - # Example scrape config for probing services via the Blackbox Exporter. - # - # The relabeling allows the actual service scrape endpoint to be configured - # via the following annotations: - # - # * `prometheus.io/probe`: Only probe services that have a value of `true` - - job_name: 'kubernetes-services' - - metrics_path: /probe - params: - module: [http_2xx] - - kubernetes_sd_configs: - - role: service - - relabel_configs: - - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_probe] - action: keep - regex: true - - source_labels: [__address__] - target_label: __param_target - - target_label: __address__ - replacement: blackbox - - source_labels: [__param_target] - target_label: instance - - action: labelmap - regex: __meta_kubernetes_service_label_(.+) - - source_labels: [__meta_kubernetes_service_namespace] - # Sourcegraph specific customization. We want a more convenient to type label. - # target_label: kubernetes_namespace - target_label: ns - - source_labels: [__meta_kubernetes_service_name] - target_label: kubernetes_name - - # Example scrape config for pods - # - # The relabeling allows the actual pod scrape endpoint to be configured via the - # following annotations: - # - # * `sourcegraph.prometheus/scrape`: Only scrape pods that have a value of `true` - # * `prometheus.io/path`: If the metrics path is not `/metrics` override this. - # * `prometheus.io/port`: Scrape the pod on the indicated port instead of the default of `9102`. - - job_name: 'kubernetes-pods' - - kubernetes_sd_configs: - - role: pod - - relabel_configs: - # Sourcegraph specific customization, only scrape pods with our annotation - - source_labels: [__meta_kubernetes_pod_annotation_sourcegraph_prometheus_scrape] - action: keep - regex: true - - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path] - action: replace - target_label: __metrics_path__ - regex: (.+) - - source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port] - action: replace - regex: (.+):(?:\d+);(\d+) - replacement: ${1}:${2} - target_label: __address__ - - action: labelmap - regex: __meta_kubernetes_pod_label_(.+) - - source_labels: [__meta_kubernetes_pod_name] - action: replace - target_label: kubernetes_pod_name - # Sourcegraph specific customization. We want a more convenient to type label. - # target_label: kubernetes_namespace - - source_labels: [__meta_kubernetes_namespace] - action: replace - target_label: ns - # Sourcegraph specific customization. We want to add a label to every - # metric that indicates the node it came from. - - source_labels: [__meta_kubernetes_pod_node_name] - action: replace - target_label: nodename - - metric_relabel_configs: - # cAdvisor-specific customization. Drop container metrics exported by cAdvisor - # not in the same namespace as Sourcegraph. - # Uncomment this if you have problems with certain dashboards or cAdvisor itself - # picking up non-Sourcegraph services. Ensure all Sourcegraph services are running - # within the Sourcegraph namespace you have defined. - # The regex must keep matches on '^$' (empty string) to ensure other metrics do not - # get dropped. - # - source_labels: [container_label_io_kubernetes_pod_namespace] - # regex: ^$|ns-sourcegraph # ensure this matches with namespace declarations - # action: keep - - source_labels: [container_label_io_kubernetes_pod_namespace] - regex: kube-system - action: drop - # cAdvisor-specific customization. We want container metrics to be named after their container name label. - # Note that 'io.kubernetes.container.name' and 'io.kubernetes.pod.name' must be provided in cAdvisor - # '--whitelisted_container_labels' (see cadvisor.DaemonSet.yaml) - - source_labels: [container_label_io_kubernetes_container_name, container_label_io_kubernetes_pod_name] - regex: (.+) - action: replace - target_label: name - separator: '-' - # Sourcegraph specific customization. Drop metrics with empty nodename responses from the k8s API - - source_labels: [nodename] - regex: ^$ - action: drop - - # Scrape prometheus itself for metrics. - - job_name: 'builtin-prometheus' - static_configs: - - targets: ['127.0.0.1:9092'] - labels: - app: prometheus - - job_name: 'builtin-alertmanager' - metrics_path: /alertmanager/metrics - static_configs: - - targets: ['127.0.0.1:9093'] - labels: - app: alertmanager + prometheus.yml: "global:\n scrape_interval: 30s\n evaluation_interval: 30s\n\nalerting:\n alertmanagers:\n # Bundled Alertmanager, started by prom-wrapper\n - static_configs:\n - targets: ['127.0.0.1:9093']\n path_prefix: /alertmanager\n # Uncomment the following to have alerts delivered to additional Alertmanagers discovered\n # in the cluster. This configuration is not required if you use Sourcegraph's built-in alerting:\n # https://docs.sourcegraph.com/admin/observability/alerting\n # - kubernetes_sd_configs:\n # - role: endpoints\n # relabel_configs:\n # - source_labels: [__meta_kubernetes_service_name]\n # regex: alertmanager\n # action: keep\n\nrule_files:\n - '*_rules.yml'\n - \"/sg_config_prometheus/*_rules.yml\"\n - \"/sg_prometheus_add_ons/*_rules.yml\"\n\n# A scrape configuration for running Prometheus on a Kubernetes cluster.\n# This uses separate scrape configs for cluster components (i.e. API server, node)\n# and services to allow each to use different authentication configs.\n#\n# Kubernetes labels will be added as Prometheus labels on metrics via the\n# `labelmap` relabeling action.\n\n# Scrape config for API servers.\n#\n# Kubernetes exposes API servers as endpoints to the default/kubernetes\n# service so this uses `endpoints` role and uses relabelling to only keep\n# the endpoints associated with the default/kubernetes service using the\n# default named port `https`. This works for single API server deployments as\n# well as HA API server deployments.\nscrape_configs:\n- job_name: 'kubernetes-apiservers'\n\n kubernetes_sd_configs:\n - role: endpoints\n\n # Default to scraping over https. If required, just disable this or change to\n # `http`.\n scheme: https\n\n # This TLS & bearer token file config is used to connect to the actual scrape\n # endpoints for cluster components. This is separate to discovery auth\n # configuration because discovery & scraping are two separate concerns in\n # Prometheus. The discovery auth config is automatic if Prometheus runs inside\n # the cluster. Otherwise, more config options have to be provided within the\n # .\n tls_config:\n ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt\n # If your node certificates are self-signed or use a different CA to the\n # master CA, then disable certificate verification below. Note that\n # certificate verification is an integral part of a secure infrastructure\n # so this should only be disabled in a controlled environment. You can\n # disable certificate verification by uncommenting the line below.\n #\n # insecure_skip_verify: true\n bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token\n\n # Keep only the default/kubernetes service endpoints for the https port. This\n # will add targets for each API server which Kubernetes adds an endpoint to\n # the default/kubernetes service.\n relabel_configs:\n - source_labels: [__meta_kubernetes_namespace, __meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]\n action: keep\n regex: default;kubernetes;https\n\n- job_name: 'kubernetes-nodes'\n\n # Default to scraping over https. If required, just disable this or change to\n # `http`.\n scheme: https\n\n # This TLS & bearer token file config is used to connect to the actual scrape\n # endpoints for cluster components. This is separate to discovery auth\n # configuration because discovery & scraping are two separate concerns in\n # Prometheus. The discovery auth config is automatic if Prometheus runs inside\n # the cluster. Otherwise, more config options have to be provided within the\n # .\n tls_config:\n ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt\n # If your node certificates are self-signed or use a different CA to the\n # master CA, then disable certificate verification below. Note that\n # certificate verification is an integral part of a secure infrastructure\n # so this should only be disabled in a controlled environment. You can\n # disable certificate verification by uncommenting the line below.\n #\n insecure_skip_verify: true\n bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token\n\n kubernetes_sd_configs:\n - role: node\n\n relabel_configs:\n - action: labelmap\n regex: __meta_kubernetes_node_label_(.+)\n - target_label: __address__\n replacement: kubernetes.default.svc:443\n - source_labels: [__meta_kubernetes_node_name]\n regex: (.+)\n target_label: __metrics_path__\n replacement: /api/v1/nodes/${1}/proxy/metrics\n\n# Scrape config for service endpoints.\n#\n# The relabeling allows the actual service scrape endpoint to be configured\n# via the following annotations:\n#\n# * `sourcegraph.prometheus/scrape`: Only scrape services that have a value of `true`\n# * `prometheus.io/scheme`: If the metrics endpoint is secured then you will need\n# to set this to `https` & most likely set the `tls_config` of the scrape config.\n# * `prometheus.io/path`: If the metrics path is not `/metrics` override this.\n# * `prometheus.io/port`: If the metrics are exposed on a different port to the\n# service then set this appropriately.\n- job_name: 'kubernetes-service-endpoints'\n\n kubernetes_sd_configs:\n - role: endpoints\n\n relabel_configs:\n # Sourcegraph specific customization, only scrape pods with our annotation\n - source_labels: [__meta_kubernetes_service_annotation_sourcegraph_prometheus_scrape]\n action: keep\n regex: true\n - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scheme]\n action: replace\n target_label: __scheme__\n regex: (https?)\n - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_path]\n action: replace\n target_label: __metrics_path__\n regex: (.+)\n - source_labels: [__address__, __meta_kubernetes_service_annotation_prometheus_io_port]\n action: replace\n target_label: __address__\n regex: (.+)(?::\\d+);(\\d+)\n replacement: $1:$2\n - action: labelmap\n regex: __meta_kubernetes_service_label_(.+)\n - source_labels: [__meta_kubernetes_namespace]\n action: replace\n # Sourcegraph specific customization. We want a more convenient to type label.\n # target_label: kubernetes_namespace\n target_label: ns\n - source_labels: [__meta_kubernetes_service_name]\n action: replace\n target_label: kubernetes_name\n # Sourcegraph specific customization. We want a nicer name for job\n - source_labels: [app]\n action: replace\n target_label: job\n # Sourcegraph specific customization. We want a nicer name for instance\n - source_labels: [__meta_kubernetes_pod_name]\n action: replace\n target_label: instance\n # Sourcegraph specific customization. We want to add a label to every \n # metric that indicates the node it came from.\n - source_labels: [__meta_kubernetes_endpoint_node_name]\n action: replace\n target_label: nodename\n metric_relabel_configs:\n # Sourcegraph specific customization. Drop metrics with empty nodename responses from the k8s API\n - source_labels: [nodename]\n regex: ^$\n action: drop\n\n# Example scrape config for probing services via the Blackbox Exporter.\n#\n# The relabeling allows the actual service scrape endpoint to be configured\n# via the following annotations:\n#\n# * `prometheus.io/probe`: Only probe services that have a value of `true`\n- job_name: 'kubernetes-services'\n\n metrics_path: /probe\n params:\n module: [http_2xx]\n\n kubernetes_sd_configs:\n - role: service\n\n relabel_configs:\n - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_probe]\n action: keep\n regex: true\n - source_labels: [__address__]\n target_label: __param_target\n - target_label: __address__\n replacement: blackbox\n - source_labels: [__param_target]\n target_label: instance\n - action: labelmap\n regex: __meta_kubernetes_service_label_(.+)\n - source_labels: [__meta_kubernetes_service_namespace]\n # Sourcegraph specific customization. We want a more convenient to type label.\n # target_label: kubernetes_namespace\n target_label: ns\n - source_labels: [__meta_kubernetes_service_name]\n target_label: kubernetes_name\n\n# Example scrape config for pods\n#\n# The relabeling allows the actual pod scrape endpoint to be configured via the\n# following annotations:\n#\n# * `sourcegraph.prometheus/scrape`: Only scrape pods that have a value of `true`\n# * `prometheus.io/path`: If the metrics path is not `/metrics` override this.\n# * `prometheus.io/port`: Scrape the pod on the indicated port instead of the default of `9102`.\n- job_name: 'kubernetes-pods'\n\n kubernetes_sd_configs:\n - role: pod\n\n relabel_configs:\n # Sourcegraph specific customization, only scrape pods with our annotation\n - source_labels: [__meta_kubernetes_pod_annotation_sourcegraph_prometheus_scrape]\n action: keep\n regex: true\n - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path]\n action: replace\n target_label: __metrics_path__\n regex: (.+)\n - source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]\n action: replace\n regex: (.+):(?:\\d+);(\\d+)\n replacement: ${1}:${2}\n target_label: __address__\n - action: labelmap\n regex: __meta_kubernetes_pod_label_(.+)\n - source_labels: [__meta_kubernetes_pod_name]\n action: replace\n target_label: kubernetes_pod_name\n # Sourcegraph specific customization. We want a more convenient to type label.\n # target_label: kubernetes_namespace\n - source_labels: [__meta_kubernetes_namespace]\n action: replace\n target_label: ns\n # Sourcegraph specific customization. We want to add a label to every \n # metric that indicates the node it came from.\n - source_labels: [__meta_kubernetes_pod_node_name]\n action: replace\n target_label: nodename\n\n metric_relabel_configs:\n # cAdvisor-specific customization. Drop container metrics exported by cAdvisor\n # not in the same namespace as Sourcegraph.\n # Uncomment this if you have problems with certain dashboards or cAdvisor itself\n # picking up non-Sourcegraph services. Ensure all Sourcegraph services are running\n # within the Sourcegraph namespace you have defined.\n # The regex must keep matches on '^$' (empty string) to ensure other metrics do not\n # get dropped.\n # - source_labels: [container_label_io_kubernetes_pod_namespace]\n # regex: ^$|ns-sourcegraph # ensure this matches with namespace declarations\n # action: keep\n - source_labels: [container_label_io_kubernetes_pod_namespace]\n regex: kube-system\n action: drop\n # cAdvisor-specific customization. We want container metrics to be named after their container name label.\n # Note that 'io.kubernetes.container.name' and 'io.kubernetes.pod.name' must be provided in cAdvisor\n # '--whitelisted_container_labels' (see cadvisor.DaemonSet.yaml)\n - source_labels: [container_label_io_kubernetes_container_name, container_label_io_kubernetes_pod_name]\n regex: (.+)\n action: replace\n target_label: name\n separator: '-'\n # Sourcegraph specific customization. Drop metrics with empty nodename responses from the k8s API\n - source_labels: [nodename]\n regex: ^$\n action: drop\n\n# Scrape prometheus itself for metrics.\n- job_name: 'builtin-prometheus'\n static_configs:\n - targets: ['127.0.0.1:9092']\n labels:\n app: prometheus\n- job_name: 'builtin-alertmanager'\n metrics_path: /alertmanager/metrics\n static_configs:\n - targets: ['127.0.0.1:9093']\n labels:\n app: alertmanager\n" extra_rules.yml: "" prometheus_targets.yml: "" diff --git a/base/sourcegraph/blobstore/blobstore.Deployment.yaml b/base/sourcegraph/blobstore/blobstore.Deployment.yaml index 619c843e..e9ee6f20 100644 --- a/base/sourcegraph/blobstore/blobstore.Deployment.yaml +++ b/base/sourcegraph/blobstore/blobstore.Deployment.yaml @@ -26,7 +26,7 @@ spec: spec: containers: - name: blobstore - image: index.docker.io/sourcegraph/blobstore:4.4.2@sha256:61aa6837e27a898953ea310276d0b2cde6dcd45392d90d7ca4a4395841d8a965 + image: index.docker.io/sourcegraph/blobstore:4.5.0@sha256:c698fc450e913c78f0dba798013efe02d2bb6abcb481b1679d9b0f1b68bdb120 livenessProbe: httpGet: path: / diff --git a/base/sourcegraph/codeinsights-db/codeinsights-db.StatefulSet.yaml b/base/sourcegraph/codeinsights-db/codeinsights-db.StatefulSet.yaml index 0bc6a5cd..74cc0e7a 100644 --- a/base/sourcegraph/codeinsights-db/codeinsights-db.StatefulSet.yaml +++ b/base/sourcegraph/codeinsights-db/codeinsights-db.StatefulSet.yaml @@ -26,7 +26,7 @@ spec: spec: initContainers: - name: correct-data-dir-permissions - image: index.docker.io/sourcegraph/alpine-3.14:4.4.2@sha256:f5b9588d8bc2107cf37ed135ae63ba1930df0828a425bd445a8d9eb3aad5f783 + image: index.docker.io/sourcegraph/alpine-3.14:4.5.0@sha256:8fe0f9e1fea1be080809380c707b512218ad7b665c2632c0253776f8efa9ee68 command: ["sh", "-c", "if [ -d /var/lib/postgresql/data/pgdata ]; then chmod 750 /var/lib/postgresql/data/pgdata; fi"] volumeMounts: - mountPath: /var/lib/postgresql/data/ @@ -45,7 +45,7 @@ spec: runAsUser: 70 containers: - name: codeinsights - image: index.docker.io/sourcegraph/codeinsights-db:4.4.2@sha256:2206b7554f4fde2fbe946163a514b3580e62096c0316f706121363a3c4e30baf + image: index.docker.io/sourcegraph/codeinsights-db:4.5.0@sha256:6c38760505cffe11b3490599078f586b58ca1922bee066e45f98cd7c458ae678 env: - name: POSTGRES_DB value: postgres @@ -82,7 +82,7 @@ spec: value: postgres://postgres:@localhost:5432/?sslmode=disable - name: PG_EXPORTER_EXTEND_QUERY_PATH value: /config/code_insights_queries.yaml - image: index.docker.io/sourcegraph/postgres_exporter:4.4.2@sha256:f928bb932a5f8202d283d78cff686bc0a090b8a407b43337c1aa62d6c65cfb34 + image: index.docker.io/sourcegraph/postgres_exporter:4.5.0@sha256:b6b6c42c8068b3ce3ae290e936c7031f9a9314e011bbdecfeb7b345356968567 terminationMessagePolicy: FallbackToLogsOnError name: pgsql-exporter ports: diff --git a/base/sourcegraph/codeintel-db/codeintel-db.StatefulSet.yaml b/base/sourcegraph/codeintel-db/codeintel-db.StatefulSet.yaml index 27b7bae6..b414f533 100644 --- a/base/sourcegraph/codeintel-db/codeintel-db.StatefulSet.yaml +++ b/base/sourcegraph/codeintel-db/codeintel-db.StatefulSet.yaml @@ -27,7 +27,7 @@ spec: spec: initContainers: - name: correct-data-dir-permissions - image: index.docker.io/sourcegraph/alpine-3.14:4.4.2@sha256:f5b9588d8bc2107cf37ed135ae63ba1930df0828a425bd445a8d9eb3aad5f783 + image: index.docker.io/sourcegraph/alpine-3.14:4.5.0@sha256:8fe0f9e1fea1be080809380c707b512218ad7b665c2632c0253776f8efa9ee68 command: ["sh", "-c", "if [ -d /data/pgdata-12 ]; then chmod 750 /data/pgdata-12; fi"] volumeMounts: - mountPath: /data @@ -45,7 +45,7 @@ spec: memory: "50Mi" containers: - name: pgsql - image: index.docker.io/sourcegraph/codeintel-db:4.4.2@sha256:87a375d13344ae5c3556f77b2aab553b3b799cab21476ff998f9b17bd287ea37 + image: index.docker.io/sourcegraph/codeintel-db:4.5.0@sha256:fc923d60a330b0b4b5dc086cf2a7a52dab7cff62592f1fc6dc466914df9d3f1b terminationMessagePolicy: FallbackToLogsOnError readinessProbe: exec: @@ -87,7 +87,7 @@ spec: value: postgres://sg:@localhost:5432/?sslmode=disable - name: PG_EXPORTER_EXTEND_QUERY_PATH value: /config/code_intel_queries.yaml - image: index.docker.io/sourcegraph/postgres_exporter:4.4.2@sha256:f928bb932a5f8202d283d78cff686bc0a090b8a407b43337c1aa62d6c65cfb34 + image: index.docker.io/sourcegraph/postgres_exporter:4.5.0@sha256:b6b6c42c8068b3ce3ae290e936c7031f9a9314e011bbdecfeb7b345356968567 terminationMessagePolicy: FallbackToLogsOnError name: pgsql-exporter ports: diff --git a/base/sourcegraph/frontend/rbac/sourcegraph-frontend.Role.yaml b/base/sourcegraph/frontend/rbac/sourcegraph-frontend.Role.yaml index 8b513c8f..fd928b04 100644 --- a/base/sourcegraph/frontend/rbac/sourcegraph-frontend.Role.yaml +++ b/base/sourcegraph/frontend/rbac/sourcegraph-frontend.Role.yaml @@ -19,13 +19,12 @@ rules: - get - list - watch - - apiGroups: - "apps" resources: - # necessary for resolving k8s+http://indexed-search?kind=sts URLs - - statefulsets + # necessary for resolving k8s+http://indexed-search?kind=sts URLs + - statefulsets verbs: - - get - - list - - watch + - get + - list + - watch diff --git a/base/sourcegraph/frontend/sourcegraph-frontend.Deployment.yaml b/base/sourcegraph/frontend/sourcegraph-frontend.Deployment.yaml index 80591c16..2bb98759 100644 --- a/base/sourcegraph/frontend/sourcegraph-frontend.Deployment.yaml +++ b/base/sourcegraph/frontend/sourcegraph-frontend.Deployment.yaml @@ -29,7 +29,7 @@ spec: spec: initContainers: - name: migrator - image: index.docker.io/sourcegraph/migrator:4.4.2@sha256:603b17216b6390e486fed6ff3ce4d6bced1446f8ef820b5b4e1278e4d885123f + image: index.docker.io/sourcegraph/migrator:4.5.0@sha256:687bb1794f530d178d30da4c5d32d2168fc95438d3727b7beed053fe1bcc6d9b args: ["up"] resources: limits: @@ -48,7 +48,7 @@ spec: name: sourcegraph-frontend-env containers: - name: frontend - image: index.docker.io/sourcegraph/frontend:4.4.2@sha256:9f7b7d2feccc8e6b404bd4d82f2866b61880447e21a56015ec393547ca3981ce + image: index.docker.io/sourcegraph/frontend:4.5.0@sha256:3bf28af73687fa83af1f03ff21b1393f4b60949286a055d1ef4e529d2be840c5 args: - serve envFrom: diff --git a/base/sourcegraph/github-proxy/github-proxy.Deployment.yaml b/base/sourcegraph/github-proxy/github-proxy.Deployment.yaml index de5e30df..2d6a6d2b 100644 --- a/base/sourcegraph/github-proxy/github-proxy.Deployment.yaml +++ b/base/sourcegraph/github-proxy/github-proxy.Deployment.yaml @@ -29,7 +29,7 @@ spec: spec: containers: - name: github-proxy - image: index.docker.io/sourcegraph/github-proxy:4.4.2@sha256:f5b2b2e8251e6599a5757ad5cbab8fdfe11b3f71446af852b70cf2a58cc062e1 + image: index.docker.io/sourcegraph/github-proxy:4.5.0@sha256:9599bd71a35fcde829ea272ade23c3b2ce9b0d4a46011220e7be844c807307c9 env: # OTEL_AGENT_HOST must be defined before OTEL_EXPORTER_OTLP_ENDPOINT to substitute the node IP on which the DaemonSet pod instance runs in the latter variable - name: OTEL_AGENT_HOST diff --git a/base/sourcegraph/gitserver/gitserver.StatefulSet.yaml b/base/sourcegraph/gitserver/gitserver.StatefulSet.yaml index 4c1fab0f..b244a655 100644 --- a/base/sourcegraph/gitserver/gitserver.StatefulSet.yaml +++ b/base/sourcegraph/gitserver/gitserver.StatefulSet.yaml @@ -35,7 +35,7 @@ spec: fieldPath: status.hostIP - name: OTEL_EXPORTER_OTLP_ENDPOINT value: http://$(OTEL_AGENT_HOST):4317 - image: index.docker.io/sourcegraph/gitserver:4.4.2@sha256:198e9516a79a8aeac4d1d04c9b0bbe5c1bbb71f2395efe645570c93c09e184ab + image: index.docker.io/sourcegraph/gitserver:4.5.0@sha256:fd390905aca509bc37f6e2b912338de33eb689abf17caf4e58c16e4c3e94b0cf terminationMessagePolicy: FallbackToLogsOnError livenessProbe: initialDelaySeconds: 5 diff --git a/base/sourcegraph/indexed-search/indexed-search.StatefulSet.yaml b/base/sourcegraph/indexed-search/indexed-search.StatefulSet.yaml index 27eab5a1..2204793f 100644 --- a/base/sourcegraph/indexed-search/indexed-search.StatefulSet.yaml +++ b/base/sourcegraph/indexed-search/indexed-search.StatefulSet.yaml @@ -33,7 +33,7 @@ spec: value: http://$(OTEL_AGENT_HOST):4317 - name: OPENTELEMETRY_DISABLED value: "false" - image: index.docker.io/sourcegraph/indexed-searcher:4.4.2@sha256:013190418308b94521e072972ae2342c41f99144205f58d61f5dfeda29ac0f58 + image: index.docker.io/sourcegraph/indexed-searcher:4.5.0@sha256:e58d02918558b617fa7533526d51ec176c0277d0051b0cb5aa3d03c84f3963fe terminationMessagePolicy: FallbackToLogsOnError ports: - containerPort: 6070 @@ -72,7 +72,7 @@ spec: value: http://$(OTEL_AGENT_HOST):4317 - name: OPENTELEMETRY_DISABLED value: "false" - image: index.docker.io/sourcegraph/search-indexer:4.4.2@sha256:7716a32597300f7dfb7e974465a3bd3c62fae3aa485b48d9aa9f79ea3348f87f + image: index.docker.io/sourcegraph/search-indexer:4.5.0@sha256:2cab0ebb22aacec48e65762e819b2bb4a5969ff1feb7a8c7b645e54700fb14ad terminationMessagePolicy: FallbackToLogsOnError ports: - containerPort: 6072 diff --git a/base/sourcegraph/pgsql/pgsql.StatefulSet.yaml b/base/sourcegraph/pgsql/pgsql.StatefulSet.yaml index 24bf70d2..f0d22760 100644 --- a/base/sourcegraph/pgsql/pgsql.StatefulSet.yaml +++ b/base/sourcegraph/pgsql/pgsql.StatefulSet.yaml @@ -27,13 +27,8 @@ spec: spec: initContainers: - name: correct-data-dir-permissions - image: index.docker.io/sourcegraph/alpine-3.14:4.4.2@sha256:f5b9588d8bc2107cf37ed135ae63ba1930df0828a425bd445a8d9eb3aad5f783 - command: - [ - "sh", - "-c", - "if [ -d /data/pgdata-12 ]; then chmod 750 /data/pgdata-12; fi", - ] + image: index.docker.io/sourcegraph/alpine-3.14:4.5.0@sha256:8fe0f9e1fea1be080809380c707b512218ad7b665c2632c0253776f8efa9ee68 + command: ["sh", "-c", "if [ -d /data/pgdata-12 ]; then chmod 750 /data/pgdata-12; fi"] volumeMounts: - mountPath: /data name: disk @@ -51,7 +46,7 @@ spec: memory: "50Mi" containers: - name: pgsql - image: index.docker.io/sourcegraph/postgres-12-alpine:4.4.2@sha256:ed669f0b7a2062fa6c5e734ddbbba26e34b3dc9e7503f88b99324327e45352f1 + image: index.docker.io/sourcegraph/postgres-12-alpine:4.5.0@sha256:fc27849a8a70eb395afd22cea6d482f81c73bcf062eb7f78fa2f6e5a429b6a16 terminationMessagePolicy: FallbackToLogsOnError readinessProbe: exec: @@ -95,7 +90,7 @@ spec: value: postgres://sg:@localhost:5432/?sslmode=disable - name: PG_EXPORTER_EXTEND_QUERY_PATH value: /config/queries.yaml - image: index.docker.io/sourcegraph/postgres_exporter:4.4.2@sha256:f928bb932a5f8202d283d78cff686bc0a090b8a407b43337c1aa62d6c65cfb34 + image: index.docker.io/sourcegraph/postgres_exporter:4.5.0@sha256:b6b6c42c8068b3ce3ae290e936c7031f9a9314e011bbdecfeb7b345356968567 terminationMessagePolicy: FallbackToLogsOnError name: pgsql-exporter ports: diff --git a/base/sourcegraph/precise-code-intel/worker.Deployment.yaml b/base/sourcegraph/precise-code-intel/worker.Deployment.yaml index be3cddcf..477b2b78 100644 --- a/base/sourcegraph/precise-code-intel/worker.Deployment.yaml +++ b/base/sourcegraph/precise-code-intel/worker.Deployment.yaml @@ -46,7 +46,7 @@ spec: fieldPath: status.hostIP - name: OTEL_EXPORTER_OTLP_ENDPOINT value: http://$(OTEL_AGENT_HOST):4317 - image: index.docker.io/sourcegraph/precise-code-intel-worker:4.4.2@sha256:87f00201b234483e2b7cd98980621668e69cb11ab9a39e3304b3f2e681ae4d60 + image: index.docker.io/sourcegraph/precise-code-intel-worker:4.5.0@sha256:b8fbdec7c2abdbe7fabf50be3d25568739a42ef2ee951b712ed4bf42ff2a2c4b terminationMessagePolicy: FallbackToLogsOnError livenessProbe: httpGet: diff --git a/base/sourcegraph/redis/redis-cache.Deployment.yaml b/base/sourcegraph/redis/redis-cache.Deployment.yaml index cdd6c02e..0f70d2c8 100644 --- a/base/sourcegraph/redis/redis-cache.Deployment.yaml +++ b/base/sourcegraph/redis/redis-cache.Deployment.yaml @@ -26,7 +26,7 @@ spec: spec: containers: - name: redis-cache - image: index.docker.io/sourcegraph/redis-cache:4.4.2@sha256:133a5996f9f4e0e1c407c6c7c4060ccc0eef0eb3195ff05085fd8411d2e5a311 + image: index.docker.io/sourcegraph/redis-cache:4.5.0@sha256:acdb0b6436648f88bbdee692d4f9f0b2b83d9e16f3ba16c3faa439bef0408d13 terminationMessagePolicy: FallbackToLogsOnError livenessProbe: initialDelaySeconds: 30 @@ -54,7 +54,7 @@ spec: - mountPath: /redis-data name: redis-data - name: redis-exporter - image: index.docker.io/sourcegraph/redis_exporter:4.4.2@sha256:edb0c9b19cacd90acc78f13f0908a7e6efd1df704e401805c24bffd241285f70 + image: index.docker.io/sourcegraph/redis_exporter:4.5.0@sha256:edb0c9b19cacd90acc78f13f0908a7e6efd1df704e401805c24bffd241285f70 terminationMessagePolicy: FallbackToLogsOnError ports: - containerPort: 9121 diff --git a/base/sourcegraph/redis/redis-store.Deployment.yaml b/base/sourcegraph/redis/redis-store.Deployment.yaml index 1d588c7b..8e971172 100644 --- a/base/sourcegraph/redis/redis-store.Deployment.yaml +++ b/base/sourcegraph/redis/redis-store.Deployment.yaml @@ -25,7 +25,7 @@ spec: spec: containers: - name: redis-store - image: index.docker.io/sourcegraph/redis-store:4.4.2@sha256:bc7f73b47ef52bc4b76020ecfeffed5b88e9207a5e79ecc6bb8dbcec61bd4225 + image: index.docker.io/sourcegraph/redis-store:4.5.0@sha256:1a134767207c443f883cc9b04ad8a29d1c56dd637138eb05fb276c47c1f1da5b terminationMessagePolicy: FallbackToLogsOnError livenessProbe: initialDelaySeconds: 30 @@ -53,7 +53,7 @@ spec: - mountPath: /redis-data name: redis-data - name: redis-exporter - image: index.docker.io/sourcegraph/redis_exporter:4.4.2@sha256:edb0c9b19cacd90acc78f13f0908a7e6efd1df704e401805c24bffd241285f70 + image: index.docker.io/sourcegraph/redis_exporter:4.5.0@sha256:edb0c9b19cacd90acc78f13f0908a7e6efd1df704e401805c24bffd241285f70 terminationMessagePolicy: FallbackToLogsOnError ports: - containerPort: 9121 diff --git a/base/sourcegraph/repo-updater/repo-updater.Deployment.yaml b/base/sourcegraph/repo-updater/repo-updater.Deployment.yaml index 8d82809a..a483299e 100644 --- a/base/sourcegraph/repo-updater/repo-updater.Deployment.yaml +++ b/base/sourcegraph/repo-updater/repo-updater.Deployment.yaml @@ -29,7 +29,7 @@ spec: spec: containers: - name: repo-updater - image: index.docker.io/sourcegraph/repo-updater:4.4.2@sha256:b2e5940eaac58788b0cc6cb2a4de4d53e15d28477fb7bd12ec31d416426cdbd0 + image: index.docker.io/sourcegraph/repo-updater:4.5.0@sha256:9d1672276d37dcd6b2144328293bc89399b7e1d58fbfaea956b2ecf890edfbd3 env: # Required when service discovery is disabled - name: GITHUB_BASE_URL diff --git a/base/sourcegraph/searcher/searcher.StatefulSet.yaml b/base/sourcegraph/searcher/searcher.StatefulSet.yaml index ae97b006..f2ef89bc 100644 --- a/base/sourcegraph/searcher/searcher.StatefulSet.yaml +++ b/base/sourcegraph/searcher/searcher.StatefulSet.yaml @@ -46,7 +46,7 @@ spec: fieldPath: status.hostIP - name: OTEL_EXPORTER_OTLP_ENDPOINT value: http://$(OTEL_AGENT_HOST):4317 - image: index.docker.io/sourcegraph/searcher:4.4.2@sha256:62554970dfe2a82c82fb82fa6b8fb77f0acef2ce0d9760c8745433f48d8113be + image: index.docker.io/sourcegraph/searcher:4.5.0@sha256:7fdab442b17dbba759c3af11665ad153e5139f3f8aeabc52a71b730be43cf2b1 terminationMessagePolicy: FallbackToLogsOnError ports: - containerPort: 3181 diff --git a/base/sourcegraph/symbols/symbols.StatefulSet.yaml b/base/sourcegraph/symbols/symbols.StatefulSet.yaml index c1639c7e..339cd945 100644 --- a/base/sourcegraph/symbols/symbols.StatefulSet.yaml +++ b/base/sourcegraph/symbols/symbols.StatefulSet.yaml @@ -43,7 +43,7 @@ spec: fieldPath: status.hostIP - name: OTEL_EXPORTER_OTLP_ENDPOINT value: http://$(OTEL_AGENT_HOST):4317 - image: index.docker.io/sourcegraph/symbols:4.4.2@sha256:8c00918153e3e4e1155c19ba59f93cc889ffaaac6f8f7dc91ff2e5d610e1b740 + image: index.docker.io/sourcegraph/symbols:4.5.0@sha256:faa08c08907146181d7fbdcb4e971f1180aaba6eef5137e1bc4d270726258ec5 livenessProbe: httpGet: path: /healthz diff --git a/base/sourcegraph/syntect-server/syntect-server.Deployment.yaml b/base/sourcegraph/syntect-server/syntect-server.Deployment.yaml index 483acf9e..237b948b 100644 --- a/base/sourcegraph/syntect-server/syntect-server.Deployment.yaml +++ b/base/sourcegraph/syntect-server/syntect-server.Deployment.yaml @@ -32,7 +32,7 @@ spec: allowPrivilegeEscalation: false runAsGroup: 101 runAsUser: 100 - image: index.docker.io/sourcegraph/syntax-highlighter:4.4.2@sha256:e02c9d64e431815bf51b05036463d60a2472f4a6ba8c3c475083c3b116ed0fe6 + image: index.docker.io/sourcegraph/syntax-highlighter:4.5.0@sha256:2f9eab98c5913cc813e79489a11247718fb17ba9a06fd6283e802fade2fb60fa terminationMessagePolicy: FallbackToLogsOnError livenessProbe: httpGet: diff --git a/base/sourcegraph/worker/worker.Deployment.yaml b/base/sourcegraph/worker/worker.Deployment.yaml index fad087df..5396b31f 100644 --- a/base/sourcegraph/worker/worker.Deployment.yaml +++ b/base/sourcegraph/worker/worker.Deployment.yaml @@ -48,7 +48,7 @@ spec: fieldPath: status.hostIP - name: OTEL_EXPORTER_OTLP_ENDPOINT value: http://$(OTEL_AGENT_HOST):4317 - image: index.docker.io/sourcegraph/worker:4.4.2@sha256:88403801cc0809ed7227b9bed7be4a15c9fb382b7ce639d39adac0648d6acfc7 + image: index.docker.io/sourcegraph/worker:4.5.0@sha256:249ebd13177f6f61d59e5cb24fa40373a9ad65d2ebd622de3ba33b9221a9b8b2 terminationMessagePolicy: FallbackToLogsOnError livenessProbe: httpGet: From 2f25c4f737bdbfa793c61ef84fba5b6df7ded136 Mon Sep 17 00:00:00 2001 From: Beatrix Date: Thu, 23 Feb 2023 09:41:05 -0800 Subject: [PATCH 13/13] Update to use old default volume size --- .../prometheus/prometheus.ConfigMap.yaml | 147 +++++++++++++++++- .../prometheus.PersistentVolumeClaim.yaml | 2 +- .../blobstore.PersistentVolumeClaim.yaml | 2 +- ...codeinsights-db.PersistentVolumeClaim.yaml | 2 +- .../codeintel-db.PersistentVolumeClaim.yaml | 2 +- .../redis-cache.PersistentVolumeClaim.yaml | 2 +- .../redis-store.PersistentVolumeClaim.yaml | 2 +- 7 files changed, 152 insertions(+), 7 deletions(-) diff --git a/base/monitoring/prometheus/prometheus.ConfigMap.yaml b/base/monitoring/prometheus/prometheus.ConfigMap.yaml index 1ee94a98..21e30b01 100644 --- a/base/monitoring/prometheus/prometheus.ConfigMap.yaml +++ b/base/monitoring/prometheus/prometheus.ConfigMap.yaml @@ -7,7 +7,152 @@ metadata: app.kubernetes.io/component: prometheus name: prometheus data: - prometheus.yml: "# Prometheus global config\nglobal:\n scrape_interval: 30s\n evaluation_interval: 30s\n # scrape_timeout is set to the global default (10s).\n\n# Alertmanager configuration\nalerting:\n alertmanagers:\n # bundled alertmanager, started by prom-wrapper\n - static_configs:\n - targets: ['127.0.0.1:9093']\n path_prefix: /alertmanager\n # add more alertmanagers here\n\n# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.\nrule_files:\n - '/sg_config_prometheus/*_rules.yml'\n - '/sg_prometheus_add_ons/*_rules.yml'\n\n# Configure targets to scrape\nscrape_configs:\n\n # Scrape prometheus itself for metrics.\n - job_name: 'builtin-prometheus'\n static_configs:\n - targets: ['127.0.0.1:9092']\n\n - job_name: 'builtin-alertmanager'\n metrics_path: /alertmanager/metrics\n static_configs:\n - targets: ['127.0.0.1:9093']\n\n ##########################################################################################\n # cadvisor \n ##########################################################################################\n\n - job_name: 'kubernetes-pods'\n dns_sd_configs:\n - names:\n - 'cadvisor.default.svc.cluster.local'\n - 'cadvisor.ns-sourcegraph.svc.cluster.local'\n type: A\n port: 48080\n relabel_configs:\n - source_labels: [__address__]\n target_label: instance\n regex: (.*)\\.(.*)\n replacement: ${1}_${2}\n - source_labels: [container_label_io_kubernetes_pod_name]\n target_label: name\n metric_relabel_configs:\n - source_labels: [container_label_io_kubernetes_pod_namespace]\n regex: kube-system\n action: drop\n - source_labels: [container_label_io_kubernetes_container_name, container_label_io_kubernetes_pod_name]\n regex: (.+)\n action: replace\n target_label: name\n separator: '-'\n \n ##########################################################################################\n # sourcegraph-services \n ##########################################################################################\n \n - job_name: 'sourcegraph-services'\n relabel_configs:\n - source_labels: [__address__]\n target_label: instance\n regex: (.*)\\.(.*)\n replacement: ${1}_${2}\n metric_relabel_configs:\n - source_labels: [container_label_io_kubernetes_pod_namespace]\n regex: kube-system\n action: drop\n file_sd_configs:\n - files:\n - '/sg_prometheus_add_ons/*_targets.yml'\n\n - job_name: 'sourcegraph-statefulsets'\n dns_sd_configs:\n - names:\n - 'symbols.default.svc.cluster.local'\n - 'symbols.ns-sourcegraph.svc.cluster.local'\n - 'symbols.$SG_NAMESPACE.svc.cluster.local'\n - 'searcher.default.svc.cluster.local'\n - 'searcher.ns-sourcegraph.svc.cluster.local'\n - 'searcher.$SG_NAMESPACE.svc.cluster.local'\n - 'gitserver.default.svc.cluster.local'\n - 'gitserver.ns-sourcegraph.svc.cluster.local'\n - 'gitserver.$SG_NAMESPACE.svc.cluster.local'\n - 'sourcegraph-frontend.default.svc.cluster.local'\n - 'sourcegraph-frontend.ns-sourcegraph.svc.cluster.local'\n - 'sourcegraph-frontend.$SG_NAMESPACE.svc.cluster.local'\n - 'indexed-search.default.svc.cluster.local'\n - 'indexed-search.ns-sourcegraph.svc.cluster.local'\n - 'indexed-search.$SG_NAMESPACE.svc.cluster.local'\n - 'indexed-search-indexer.default.svc.cluster.local'\n - 'indexed-search-indexer.ns-sourcegraph.svc.cluster.local'\n - 'indexed-search-indexer.$SG_NAMESPACE.svc.cluster.local'\n type: SRV\n relabel_configs:\n - source_labels: [__meta_dns_srv_record_target]\n target_label: __address__\n regex: (.*)\\.\n replacement: ${1}:6060\n - source_labels: [__meta_dns_srv_record_target]\n target_label: __address__\n regex: ^(indexed-search.*)\\.\n replacement: ${1}:6070\n - source_labels: [__meta_dns_srv_record_target]\n target_label: __address__\n regex: (.*)\\.(indexed-search-indexer.*)\\.\n replacement: ${1}.${2}:6072\n - source_labels: [__meta_dns_srv_record_port]\n target_label: __meta_dns_srv_record_port\n replacement: 6060\n - source_labels: [__address__]\n regex: ^(indexed-search).*$\n target_label: __meta_dns_srv_record_port\n replacement: 6070\n - source_labels: [__meta_dns_name]\n target_label: job\n regex: (.*)\\..*\\..*\\..*\\..*\n replacement: ${1}\n - source_labels: [__meta_dns_srv_record_target]\n regex: (.*)\\.(.*)\\..*\\..*\\..*\\..*\\..*\n target_label: instance\n replacement: ${2}_${1}\n metric_relabel_configs:\n - source_labels: [__address__]\n target_label: instance\n regex: (.*)\\:.*\n replacement: $1:6060\n - source_labels: [__address__]\n target_label: instance\n regex: (.*)\\.(.*)\\..*\\..*\\..*\\..*\\..*\n replacement: ${2}_${1}\n" + prometheus.yml: | + # Prometheus global config + global: + scrape_interval: 30s + evaluation_interval: 30s + # scrape_timeout is set to the global default (10s). + + # Alertmanager configuration + alerting: + alertmanagers: + # bundled alertmanager, started by prom-wrapper + - static_configs: + - targets: ["127.0.0.1:9093"] + path_prefix: /alertmanager + # add more alertmanagers here + + # Load rules once and periodically evaluate them according to the global 'evaluation_interval'. + rule_files: + - "/sg_config_prometheus/*_rules.yml" + - "/sg_prometheus_add_ons/*_rules.yml" + + # Configure targets to scrape + scrape_configs: + # Scrape prometheus itself for metrics. + - job_name: "builtin-prometheus" + static_configs: + - targets: ["127.0.0.1:9092"] + + - job_name: "builtin-alertmanager" + metrics_path: /alertmanager/metrics + static_configs: + - targets: ["127.0.0.1:9093"] + + ########################################################################################## + # cadvisor + ########################################################################################## + + - job_name: "kubernetes-pods" + dns_sd_configs: + - names: + - "cadvisor.default.svc.cluster.local" + - "cadvisor.ns-sourcegraph.svc.cluster.local" + type: A + port: 48080 + relabel_configs: + - source_labels: [__address__] + target_label: instance + regex: (.*)\.(.*) + replacement: ${1}_${2} + - source_labels: [container_label_io_kubernetes_pod_name] + target_label: name + metric_relabel_configs: + - source_labels: [container_label_io_kubernetes_pod_namespace] + regex: kube-system + action: drop + - source_labels: + [ + container_label_io_kubernetes_container_name, + container_label_io_kubernetes_pod_name, + ] + regex: (.+) + action: replace + target_label: name + separator: "-" + + ########################################################################################## + # sourcegraph-services + ########################################################################################## + + - job_name: "sourcegraph-services" + relabel_configs: + - source_labels: [__address__] + target_label: instance + regex: (.*)\.(.*) + replacement: ${1}_${2} + metric_relabel_configs: + - source_labels: [container_label_io_kubernetes_pod_namespace] + regex: kube-system + action: drop + file_sd_configs: + - files: + - "/sg_prometheus_add_ons/*_targets.yml" + + - job_name: "sourcegraph-statefulsets" + dns_sd_configs: + - names: + - "symbols.default.svc.cluster.local" + - "symbols.ns-sourcegraph.svc.cluster.local" + - "symbols.$SG_NAMESPACE.svc.cluster.local" + - "searcher.default.svc.cluster.local" + - "searcher.ns-sourcegraph.svc.cluster.local" + - "searcher.$SG_NAMESPACE.svc.cluster.local" + - "gitserver.default.svc.cluster.local" + - "gitserver.ns-sourcegraph.svc.cluster.local" + - "gitserver.$SG_NAMESPACE.svc.cluster.local" + - "sourcegraph-frontend.default.svc.cluster.local" + - "sourcegraph-frontend.ns-sourcegraph.svc.cluster.local" + - "sourcegraph-frontend.$SG_NAMESPACE.svc.cluster.local" + - "indexed-search.default.svc.cluster.local" + - "indexed-search.ns-sourcegraph.svc.cluster.local" + - "indexed-search.$SG_NAMESPACE.svc.cluster.local" + - "indexed-search-indexer.default.svc.cluster.local" + - "indexed-search-indexer.ns-sourcegraph.svc.cluster.local" + - "indexed-search-indexer.$SG_NAMESPACE.svc.cluster.local" + type: SRV + relabel_configs: + - source_labels: [__meta_dns_srv_record_target] + target_label: __address__ + regex: (.*)\. + replacement: ${1}:6060 + - source_labels: [__meta_dns_srv_record_target] + target_label: __address__ + regex: ^(indexed-search.*)\. + replacement: ${1}:6070 + - source_labels: [__meta_dns_srv_record_target] + target_label: __address__ + regex: (.*)\.(indexed-search-indexer.*)\. + replacement: ${1}.${2}:6072 + - source_labels: [__meta_dns_srv_record_port] + target_label: __meta_dns_srv_record_port + replacement: 6060 + - source_labels: [__address__] + regex: ^(indexed-search).*$ + target_label: __meta_dns_srv_record_port + replacement: 6070 + - source_labels: [__meta_dns_name] + target_label: job + regex: (.*)\..*\..*\..*\..* + replacement: ${1} + - source_labels: [__meta_dns_srv_record_target] + regex: (.*)\.(.*)\..*\..*\..*\..*\..* + target_label: instance + replacement: ${2}_${1} + metric_relabel_configs: + - source_labels: [container_label_io_kubernetes_pod_namespace] + regex: kube-system + action: drop + - source_labels: [__address__] + target_label: instance + regex: (.*)\:.* + replacement: $1:6060 + - source_labels: [__address__] + target_label: instance + regex: (.*)\.(.*)\..*\..*\..*\..*\..* + replacement: ${2}_${1} + prometheus_targets.yml: | - labels: nodename: "sourcegraph-services" diff --git a/base/monitoring/prometheus/prometheus.PersistentVolumeClaim.yaml b/base/monitoring/prometheus/prometheus.PersistentVolumeClaim.yaml index 872e3348..d5083de1 100644 --- a/base/monitoring/prometheus/prometheus.PersistentVolumeClaim.yaml +++ b/base/monitoring/prometheus/prometheus.PersistentVolumeClaim.yaml @@ -11,4 +11,4 @@ spec: - ReadWriteOnce resources: requests: - storage: 50Gi + storage: 200Gi diff --git a/base/sourcegraph/blobstore/blobstore.PersistentVolumeClaim.yaml b/base/sourcegraph/blobstore/blobstore.PersistentVolumeClaim.yaml index 43bf9e93..d06e485b 100644 --- a/base/sourcegraph/blobstore/blobstore.PersistentVolumeClaim.yaml +++ b/base/sourcegraph/blobstore/blobstore.PersistentVolumeClaim.yaml @@ -11,4 +11,4 @@ spec: - ReadWriteOnce resources: requests: - storage: 20Gi + storage: 100Gi diff --git a/base/sourcegraph/codeinsights-db/codeinsights-db.PersistentVolumeClaim.yaml b/base/sourcegraph/codeinsights-db/codeinsights-db.PersistentVolumeClaim.yaml index 3dcf6ebb..97b4e651 100644 --- a/base/sourcegraph/codeinsights-db/codeinsights-db.PersistentVolumeClaim.yaml +++ b/base/sourcegraph/codeinsights-db/codeinsights-db.PersistentVolumeClaim.yaml @@ -11,4 +11,4 @@ spec: - ReadWriteOnce resources: requests: - storage: 50Gi + storage: 200Gi diff --git a/base/sourcegraph/codeintel-db/codeintel-db.PersistentVolumeClaim.yaml b/base/sourcegraph/codeintel-db/codeintel-db.PersistentVolumeClaim.yaml index 1c9177ff..92a070b0 100644 --- a/base/sourcegraph/codeintel-db/codeintel-db.PersistentVolumeClaim.yaml +++ b/base/sourcegraph/codeintel-db/codeintel-db.PersistentVolumeClaim.yaml @@ -11,4 +11,4 @@ spec: - ReadWriteOnce resources: requests: - storage: 50Gi + storage: 200Gi diff --git a/base/sourcegraph/redis/redis-cache.PersistentVolumeClaim.yaml b/base/sourcegraph/redis/redis-cache.PersistentVolumeClaim.yaml index 79ce4ccc..78e6868d 100644 --- a/base/sourcegraph/redis/redis-cache.PersistentVolumeClaim.yaml +++ b/base/sourcegraph/redis/redis-cache.PersistentVolumeClaim.yaml @@ -11,4 +11,4 @@ spec: - ReadWriteOnce resources: requests: - storage: 50Gi + storage: 100Gi diff --git a/base/sourcegraph/redis/redis-store.PersistentVolumeClaim.yaml b/base/sourcegraph/redis/redis-store.PersistentVolumeClaim.yaml index 8ddf1703..d16491a0 100644 --- a/base/sourcegraph/redis/redis-store.PersistentVolumeClaim.yaml +++ b/base/sourcegraph/redis/redis-store.PersistentVolumeClaim.yaml @@ -11,4 +11,4 @@ spec: - ReadWriteOnce resources: requests: - storage: 50Gi + storage: 100Gi