Skip to content

Commit 20b216e

Browse files
authored
Converting deprecating Kustomize fields to supported fields. (#8)
1 parent 481edca commit 20b216e

File tree

161 files changed

+2749
-2961
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+2749
-2961
lines changed

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
[![sourcegraph: beta](https://img.shields.io/badge/sourcegraph-beta-blue.svg)](https://sourcegraph.com/github.com/sourcegraph/deploy-sourcegrap-k8s)
44

5-
> **Warning**
6-
> 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.
5+
> **Note**
6+
> This deployment method only supports Sourcegraph version 4.5.0 and above.
77
88
Deploying Sourcegraph into a Kubernetes cluster is for organizations that need highly scalable and
99
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
2626

2727
When upgrading Sourcegraph, please check the [upgrade docs for Kubernetes](https://docs.sourcegraph.com/admin/updates/kubernetes) to confirm if manual migrations is necessary.
2828

29-
## Development
30-
31-
The `dev` branch is used to track development.
29+
## Feedback
3230

3331
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!
3432

base/monitoring/prometheus/prometheus.ConfigMap.yaml

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,12 @@ data:
5656
- '/sg_prometheus_add_ons/*_targets.yml'
5757
5858
- job_name: 'cadvisor'
59-
static_configs:
60-
- targets: ['cadvisor:48080']
59+
dns_sd_configs:
60+
- names:
61+
- 'cadvisor.default.svc.cluster.local'
62+
- 'cadvisor.ns-sourcegraph.svc.cluster.local'
63+
type: A
64+
port: 48080
6165
relabel_configs:
6266
- source_labels: [__address__]
6367
target_label: instance
@@ -74,6 +78,38 @@ data:
7478
action: replace
7579
target_label: name
7680
separator: '-'
81+
# - source_labels: [container_label_io_kubernetes_pod_namespace]
82+
# regex: ^$|ns-sourcegraph # ACTION: replace ns-sourcegraph with your namespace
83+
# action: keep
84+
85+
- job_name: 'sourcegraph-statefulsets'
86+
dns_sd_configs:
87+
- names:
88+
- 'symbols.default.svc.cluster.local'
89+
- 'symbols.ns-sourcegraph.svc.cluster.local'
90+
- 'searcher.default.svc.cluster.local'
91+
- 'searcher.ns-sourcegraph.svc.cluster.local'
92+
- 'gitserver.default.svc.cluster.local'
93+
- 'gitserver.ns-sourcegraph.svc.cluster.local'
94+
- 'sourcegraph-frontend.default.svc.cluster.local'
95+
- 'sourcegraph-frontend.ns-sourcegraph.svc.cluster.local'
96+
type: A
97+
port: 6060
98+
- names:
99+
- 'indexed-search.default.svc.cluster.local'
100+
- 'indexed-search.ns-sourcegraph.svc.cluster.local'
101+
type: A
102+
port: 6070
103+
- names:
104+
- 'indexed-search-indexer.default.svc.cluster.local'
105+
- 'indexed-search-indexer.ns-sourcegraph.svc.cluster.local'
106+
type: A
107+
port: 6072
108+
relabel_configs:
109+
- source_labels: [__meta_dns_name]
110+
target_label: service_name
111+
regex: (.*)\..*\..*\..*\..*
112+
replacement: ${1}
77113
78114
# Extra rules
79115
extra_rules.yml: |
@@ -91,6 +127,11 @@ data:
91127
92128
# List of static targets
93129
prometheus_targets.yml: |
130+
- labels:
131+
nodename: "sourcegraph-services"
132+
job: cadvisor
133+
targets:
134+
- cadvisor:48080
94135
- labels:
95136
nodename: "sourcegraph-services"
96137
job: sourcegraph-frontend

base/monitoring/prometheus/prometheus.Deployment.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ spec:
2727
- name: prometheus
2828
image: index.docker.io/sourcegraph/prometheus:4.4.2@sha256:d833d00a39937cf700f276f816dc789615d6396979418a7d9362386513b1fc9d
2929
terminationMessagePolicy: FallbackToLogsOnError
30+
env:
31+
- name: MY_POD_NAMESPACE
32+
valueFrom:
33+
fieldRef:
34+
fieldPath: metadata.namespace
3035
readinessProbe:
3136
httpGet:
3237
path: /-/ready

base/sourcegraph/kustomization.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,3 @@ resources:
1616
- symbols
1717
- syntect-server
1818
- worker
19-
# Create config map for kustomize configuration
20-
generatorOptions:
21-
labels:
22-
name: sourcegraph-kustomize-configs
23-
configMapGenerator:
24-
- name: sourcegraph-kustomize-env
25-
literals:
26-
- deploy=sourcegraph

base/sourcegraph/pgsql/pgsql.StatefulSet.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ spec:
2828
initContainers:
2929
- name: correct-data-dir-permissions
3030
image: index.docker.io/sourcegraph/alpine-3.14:4.4.2@sha256:f5b9588d8bc2107cf37ed135ae63ba1930df0828a425bd445a8d9eb3aad5f783
31-
command: ["sh", "-c", "if [ -d /data/pgdata-12 ]; then chmod 750 /data/pgdata-12; fi"]
31+
command:
32+
[
33+
"sh",
34+
"-c",
35+
"if [ -d /data/pgdata-12 ]; then chmod 750 /data/pgdata-12; fi",
36+
]
3237
volumeMounts:
3338
- mountPath: /data
3439
name: disk
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: kustomize.config.k8s.io/v1alpha1
22
kind: Component
33
components:
4+
- ../../../storage-class/aws/aws-ebs
45
- ../../../storage-class/sourcegraph
5-
- ../../../storage-class/aws/eks-ebs
66
- ../../../ingress/alb
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: kustomize.config.k8s.io/v1alpha1
22
kind: Component
33
components:
4-
- ../../../storage-class/sourcegraph
54
- ../../../storage-class/aws/ebs-csi
5+
- ../../../storage-class/sourcegraph
66
- ../../../ingress/alb
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: kustomize.config.k8s.io/v1alpha1
2+
kind: Component
3+
replacements:
4+
- source:
5+
fieldPath: data.AWS_MANAGED_CERT_ARN
6+
kind: SourcegraphBuildConfig
7+
name: sourcegraph-kustomize-config
8+
version: v1
9+
targets:
10+
- fieldPaths:
11+
- metadata.annotations.[alb.ingress.kubernetes.io/certificate-arn]
12+
select:
13+
kind: Ingress
14+
name: sourcegraph-frontend
15+
patches:
16+
- path: patches/frontend.Ingress.yaml

0 commit comments

Comments
 (0)