Skip to content

Commit 40ef1e0

Browse files
authored
update: set default deployType to Kustomize (#16)
* Components touch up * update deployType * Update PR template * Fix prometheus job relabel for statics * lower case
1 parent fd29bfe commit 40ef1e0

File tree

10 files changed

+54
-22
lines changed

10 files changed

+54
-22
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
- [ ] Update [CHANGELOG.md](https://github.com/sourcegraph/sourcegraph/blob/main/CHANGELOG.md)
1616
- [ ] Update [K8s Upgrade notes](https://github.com/sourcegraph/sourcegraph/blob/main/doc/admin/updates/kubernetes.md)
17+
- [ ] Kustomiz-specific changes
1718
- [ ] Update sister repository: [deploy-sourcegraph-helm](https://github.com/sourcegraph/deploy-sourcegraph-docker)
1819
- [ ] Update sister repository: [deploy-sourcegraph-docker](https://github.com/sourcegraph/deploy-sourcegraph-docker)
1920
- [ ] Verify all images have a valid tag and SHA256 sum

base/monitoring/prometheus/prometheus.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ scrape_configs: # Configure targets to scrape
4343
- source_labels: [container_label_io_kubernetes_pod_namespace]
4444
regex: kube-system
4545
action: drop
46-
- source_labels: [container_label_io_kubernetes_container_name, container_label_io_kubernetes_pod_name]
46+
- source_labels:
47+
[
48+
container_label_io_kubernetes_container_name,
49+
container_label_io_kubernetes_pod_name,
50+
]
4751
regex: (.+)
4852
action: replace
4953
target_label: name
@@ -124,8 +128,12 @@ scrape_configs: # Configure targets to scrape
124128
relabel_configs:
125129
- source_labels: [__address__]
126130
target_label: instance
127-
regex: (.*)\.(.*)
128-
replacement: ${1}_${2}
131+
regex: (.*)\:(.*)
132+
replacement: ${1}
133+
- source_labels: [__address__]
134+
target_label: job
135+
regex: (.*)\:(.*)
136+
replacement: ${1}
129137
- source_labels: [container_label_io_kubernetes_pod_namespace]
130138
action: replace
131139
target_label: ns
@@ -138,7 +146,7 @@ scrape_configs: # Configure targets to scrape
138146
action: drop
139147
static_configs:
140148
- labels:
141-
job: sourcegraph-service
149+
group: sourcegraph-service
142150
targets:
143151
- sourcegraph-frontend:6060
144152
- github-proxy:6060

base/sourcegraph/frontend/sourcegraph-frontend.ConfigMap.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ metadata:
88
sourcegraph-resource-requires: no-cluster-admin
99
name: sourcegraph-frontend-env
1010
data:
11-
DEPLOY_TYPE: kubernetes
11+
DEPLOY_TYPE: kustomize
1212
PGDATABASE: sg
1313
PGHOST: pgsql
1414
PGPORT: "5432"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: kustomize.config.k8s.io/v1alpha1
2+
kind: Component
3+
4+
patchesStrategicMerge:
5+
-

components/services/searcher/deployment/kustomization.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,9 @@ patches:
77
target:
88
kind: StatefulSet
99
name: searcher
10+
- patch: |-
11+
- op: remove
12+
path: /spec/clusterIP
13+
target:
14+
kind: Service
15+
name: searcher

components/services/searcher/deployment/patches/searcher.Deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ spec:
88
maxSurge: 1
99
maxUnavailable: 1
1010
type: RollingUpdate
11-
replica: 2
11+
replicas: 2
1212
template:
1313
spec:
1414
containers:
@@ -56,4 +56,4 @@ spec:
5656
updateStrategy:
5757
$patch: delete
5858
volumeClaimTemplates:
59-
serviceName:
59+
serviceName: null

components/services/symbols/deployment/kustomization.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,9 @@ patches:
77
target:
88
kind: StatefulSet
99
name: symbols
10+
- patch: |-
11+
- op: remove
12+
path: /spec/clusterIP
13+
target:
14+
kind: Service
15+
name: symbols

components/services/symbols/deployment/patches/symbols.Deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ spec:
5757
updateStrategy:
5858
$patch: delete
5959
volumeClaimTemplates:
60-
serviceName:
60+
serviceName: null
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
apiVersion: kustomize.config.k8s.io/v1alpha1
22
kind: Component
33
replacements:
4-
- path: images-update.yaml
4+
- path: images-update.yaml
55
patches:
6-
- path: searcher/searcher.Deployment.yaml
7-
target:
8-
group: apps
9-
kind: StatefulSet|Deployment
10-
name: searcher
11-
version: v1
12-
- path: gitserver/gitserver.StatefulSet.yaml
13-
- path: grafana/grafana.StatefulSet.yaml
14-
- path: blobstore/blobstore.Deployment.yaml
15-
- path: indexed-search/indexed-search.StatefulSet.yaml
16-
- path: prometheus/prometheus.Deployment.yaml
17-
- path: redis/redis-cache.Deployment.yaml
18-
- path: redis/redis-store.Deployment.yaml
6+
- path: searcher/searcher.Deployment.yaml
7+
target:
8+
group: apps
9+
kind: StatefulSet|Deployment
10+
name: searcher
11+
version: v1
12+
- path: gitserver/gitserver.StatefulSet.yaml
13+
- path: grafana/grafana.StatefulSet.yaml
14+
- path: blobstore/blobstore.Deployment.yaml
15+
- path: indexed-search/indexed-search.StatefulSet.yaml
16+
- path: prometheus/prometheus.Deployment.yaml
17+
- path: redis/redis-cache.Deployment.yaml
18+
- path: redis/redis-store.Deployment.yaml

instances/template/kustomization.template.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,12 @@ components:
148148
# - ../../components/utils/migrate-to-nonprivileged # -- Component for migrating from privileged to non-privileged
149149
#
150150
#---------------------------------------------------------------------------------------
151+
# Resource migration from deploy-sourcegraph
152+
#---------------------------------------------------------------------------------------
153+
# - ../../components/clusters/old-base # -- Generate old cluster from deploy-sourcegraph
154+
# - old-patches # -- Component to store patches from old deployment. See migration docs for more information
155+
#
156+
#---------------------------------------------------------------------------------------
151157
# Use private registry
152158
#---------------------------------------------------------------------------------------
153159
# - ../../components/enable/private-registry # -- Update images name to private registry name

0 commit comments

Comments
 (0)