diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 2da92665..7d833cf6 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -14,6 +14,7 @@ - [ ] Update [CHANGELOG.md](https://github.com/sourcegraph/sourcegraph/blob/main/CHANGELOG.md) - [ ] Update [K8s Upgrade notes](https://github.com/sourcegraph/sourcegraph/blob/main/doc/admin/updates/kubernetes.md) +- [ ] Kustomiz-specific changes - [ ] Update sister repository: [deploy-sourcegraph-helm](https://github.com/sourcegraph/deploy-sourcegraph-docker) - [ ] Update sister repository: [deploy-sourcegraph-docker](https://github.com/sourcegraph/deploy-sourcegraph-docker) - [ ] Verify all images have a valid tag and SHA256 sum diff --git a/base/monitoring/prometheus/prometheus.yml b/base/monitoring/prometheus/prometheus.yml index 372d41d8..30be6b72 100644 --- a/base/monitoring/prometheus/prometheus.yml +++ b/base/monitoring/prometheus/prometheus.yml @@ -43,7 +43,11 @@ scrape_configs: # Configure targets to scrape - 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] + - source_labels: + [ + container_label_io_kubernetes_container_name, + container_label_io_kubernetes_pod_name, + ] regex: (.+) action: replace target_label: name @@ -124,8 +128,12 @@ scrape_configs: # Configure targets to scrape relabel_configs: - source_labels: [__address__] target_label: instance - regex: (.*)\.(.*) - replacement: ${1}_${2} + regex: (.*)\:(.*) + replacement: ${1} + - source_labels: [__address__] + target_label: job + regex: (.*)\:(.*) + replacement: ${1} - source_labels: [container_label_io_kubernetes_pod_namespace] action: replace target_label: ns @@ -138,7 +146,7 @@ scrape_configs: # Configure targets to scrape action: drop static_configs: - labels: - job: sourcegraph-service + group: sourcegraph-service targets: - sourcegraph-frontend:6060 - github-proxy:6060 diff --git a/base/sourcegraph/frontend/sourcegraph-frontend.ConfigMap.yaml b/base/sourcegraph/frontend/sourcegraph-frontend.ConfigMap.yaml index 55a56178..5a280730 100644 --- a/base/sourcegraph/frontend/sourcegraph-frontend.ConfigMap.yaml +++ b/base/sourcegraph/frontend/sourcegraph-frontend.ConfigMap.yaml @@ -8,7 +8,7 @@ metadata: sourcegraph-resource-requires: no-cluster-admin name: sourcegraph-frontend-env data: - DEPLOY_TYPE: kubernetes + DEPLOY_TYPE: kustomize PGDATABASE: sg PGHOST: pgsql PGPORT: "5432" diff --git a/components/custom/old-patches/kustomization.yaml b/components/custom/old-patches/kustomization.yaml new file mode 100644 index 00000000..5fc79bf0 --- /dev/null +++ b/components/custom/old-patches/kustomization.yaml @@ -0,0 +1,5 @@ +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component + +patchesStrategicMerge: + - diff --git a/components/services/searcher/deployment/kustomization.yaml b/components/services/searcher/deployment/kustomization.yaml index 0b5a0e0a..6aeaf497 100644 --- a/components/services/searcher/deployment/kustomization.yaml +++ b/components/services/searcher/deployment/kustomization.yaml @@ -7,3 +7,9 @@ patches: target: kind: StatefulSet name: searcher + - patch: |- + - op: remove + path: /spec/clusterIP + target: + kind: Service + name: searcher diff --git a/components/services/searcher/deployment/patches/searcher.Deployment.yaml b/components/services/searcher/deployment/patches/searcher.Deployment.yaml index b44d6177..b7421be8 100644 --- a/components/services/searcher/deployment/patches/searcher.Deployment.yaml +++ b/components/services/searcher/deployment/patches/searcher.Deployment.yaml @@ -8,7 +8,7 @@ spec: maxSurge: 1 maxUnavailable: 1 type: RollingUpdate - replica: 2 + replicas: 2 template: spec: containers: @@ -56,4 +56,4 @@ spec: updateStrategy: $patch: delete volumeClaimTemplates: - serviceName: + serviceName: null diff --git a/components/services/symbols/deployment/kustomization.yaml b/components/services/symbols/deployment/kustomization.yaml index 179a0e4f..d524c60d 100644 --- a/components/services/symbols/deployment/kustomization.yaml +++ b/components/services/symbols/deployment/kustomization.yaml @@ -7,3 +7,9 @@ patches: target: kind: StatefulSet name: symbols + - patch: |- + - op: remove + path: /spec/clusterIP + target: + kind: Service + name: symbols diff --git a/components/services/symbols/deployment/patches/symbols.Deployment.yaml b/components/services/symbols/deployment/patches/symbols.Deployment.yaml index c325a61b..fb146b19 100644 --- a/components/services/symbols/deployment/patches/symbols.Deployment.yaml +++ b/components/services/symbols/deployment/patches/symbols.Deployment.yaml @@ -57,4 +57,4 @@ spec: updateStrategy: $patch: delete volumeClaimTemplates: - serviceName: + serviceName: null diff --git a/components/utils/migrate-to-nonprivileged/kustomization.yaml b/components/utils/migrate-to-nonprivileged/kustomization.yaml index 8b1ccce4..645a7712 100644 --- a/components/utils/migrate-to-nonprivileged/kustomization.yaml +++ b/components/utils/migrate-to-nonprivileged/kustomization.yaml @@ -1,18 +1,18 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component 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 + - 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/instances/template/kustomization.template.yaml b/instances/template/kustomization.template.yaml index 2519dc67..a2188d56 100644 --- a/instances/template/kustomization.template.yaml +++ b/instances/template/kustomization.template.yaml @@ -148,6 +148,12 @@ components: # - ../../components/utils/migrate-to-nonprivileged # -- Component for migrating from privileged to non-privileged # #--------------------------------------------------------------------------------------- + # Resource migration from deploy-sourcegraph + #--------------------------------------------------------------------------------------- + # - ../../components/clusters/old-base # -- Generate old cluster from deploy-sourcegraph + # - old-patches # -- Component to store patches from old deployment. See migration docs for more information + # + #--------------------------------------------------------------------------------------- # Use private registry #--------------------------------------------------------------------------------------- # - ../../components/enable/private-registry # -- Update images name to private registry name