Skip to content

Commit 6976b1b

Browse files
authored
various kustomization overlays (sourcegraph#541)
1 parent e58edef commit 6976b1b

File tree

13 files changed

+216
-0
lines changed

13 files changed

+216
-0
lines changed

README.dev.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,5 @@ IMAGE=repo-updater:dev ./cmd/repo-updater/build.sh
107107
kubectl edit deployment/repo-updater # set imagePullPolicy to Never
108108
kubectl set image deployment repo-updater '*=repo-updater:dev'
109109
```
110+
111+
You can also use the [minikube overlay](overlays/minikube/README.md). This avoids modifying the config files in `base`.

overlays/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Overlays for kustomizations
2+
3+
This directory contains overlays for various [kustomizations](https://kustomize.io/). kustomize has become a standard way
4+
to specialize a set of Kubernetes YAML config files for different cluster setups, environments and other parametrizations.
5+
Starting with client version 1.14 of `kubectl` it is built into kubectl itself and can be used with the `apply` command
6+
and the flag `-k` instead of flag `-f`.
7+
8+
If your kubectl version is older and doesn't support `apply -k` you can still use these kustomizations. You need to
9+
install the standalone [kustomize](https://kustomize.io/) binary, generate the YAML files with `kustomize build` and
10+
then use the built YAML with `kubectl apply -f`. For example:
11+
12+
```shell script
13+
cd overlays/namespaced
14+
kustomize build | kubectl apply -f -
15+
```
16+
17+
18+
19+

overlays/migrate-to-nonroot/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
This kustomization injects initContainers in all pods with persistent volumes to transfer ownership of directories to
2+
specified non-root users. It is used for migrating existing installations to a non-root environment.
3+
4+
This only needs to be run once for installations that want to upgrade to 3.14. Afterwards it can be ignored.
5+
6+
```shell script
7+
cd overlays/migrate-to-nonroot
8+
kubectl apply -k .
9+
```
10+

overlays/minikube/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
This kustomization deletes resource declarations and storage classnames to enable runnning Sourcegraph on minikube.
2+
3+
Starting Sourcegraph:
4+
5+
```shell script
6+
minikube start
7+
cd overlays/minikube
8+
kubectl create namespace ns-sourcegraph
9+
kubectl -n ns-sourcegraph apply -l deploy=sourcegraph -k .
10+
kubectl -n ns-sourcegraph expose deployment sourcegraph-frontend --type=NodePort --name sourcegraph
11+
minikube service list
12+
```
13+
14+
Tearing it down:
15+
16+
```shell script
17+
kubectl delete namespaces ns-sourcegraph
18+
minikube stop
19+
```
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- op: remove
2+
path: /spec/template/spec/containers/0/resources
3+
- op: remove
4+
path: /spec/template/spec/containers/1/resources
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- op: remove
2+
path: /spec/template/spec/containers/0/resources
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- op: remove
2+
path: /spec/storageClassName
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- op: remove
2+
path: /spec/volumeClaimTemplates/0/spec/storageClassName
3+
- op: remove
4+
path: /spec/template/spec/containers/0/resources
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- op: remove
2+
path: /spec/volumeClaimTemplates/0/spec/storageClassName
3+
- op: remove
4+
path: /spec/template/spec/containers/0/resources
5+
- op: remove
6+
path: /spec/template/spec/containers/1/resources

overlays/minikube/kustomization.yaml

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
namespace: ns-sourcegraph
4+
bases:
5+
- ../../base
6+
patchesJson6902:
7+
- target:
8+
kind: Deployment
9+
name: sourcegraph-frontend
10+
group: apps
11+
version: v1
12+
path: delete-resources.yaml
13+
- target:
14+
kind: Deployment
15+
name: github-proxy
16+
group: apps
17+
version: v1
18+
path: delete-resources.yaml
19+
- target:
20+
kind: StatefulSet
21+
name: gitserver
22+
group: apps
23+
version: v1
24+
path: gitserver-patch.yaml
25+
- target:
26+
kind: Deployment
27+
name: grafana
28+
group: apps
29+
version: v1
30+
path: delete-resources.yaml
31+
- target:
32+
kind: StatefulSet
33+
name: indexed-search
34+
group: apps
35+
version: v1
36+
path: indexed-search-patch.yaml
37+
- target:
38+
kind: Deployment
39+
name: lsif-server
40+
group: apps
41+
version: v1
42+
path: delete-resources.yaml
43+
- target:
44+
kind: Deployment
45+
name: pgsql
46+
group: apps
47+
version: v1
48+
path: delete-resources-2.yaml
49+
- target:
50+
kind: Deployment
51+
name: prometheus
52+
group: apps
53+
version: v1
54+
path: delete-resources.yaml
55+
- target:
56+
kind: Deployment
57+
name: query-runner
58+
group: apps
59+
version: v1
60+
path: delete-resources.yaml
61+
- target:
62+
kind: Deployment
63+
name: redis-cache
64+
group: apps
65+
version: v1
66+
path: delete-resources-2.yaml
67+
- target:
68+
kind: Deployment
69+
name: redis-store
70+
group: apps
71+
version: v1
72+
path: delete-resources-2.yaml
73+
- target:
74+
kind: Deployment
75+
name: replacer
76+
group: apps
77+
version: v1
78+
path: delete-resources.yaml
79+
- target:
80+
kind: Deployment
81+
name: repo-updater
82+
group: apps
83+
version: v1
84+
path: delete-resources.yaml
85+
- target:
86+
kind: Deployment
87+
name: searcher
88+
group: apps
89+
version: v1
90+
path: delete-resources.yaml
91+
- target:
92+
kind: Deployment
93+
name: symbols
94+
group: apps
95+
version: v1
96+
path: delete-resources.yaml
97+
- target:
98+
kind: Deployment
99+
name: syntect-server
100+
group: apps
101+
version: v1
102+
path: delete-resources.yaml
103+
- target:
104+
kind: PersistentVolumeClaim
105+
name: prometheus
106+
version: v1
107+
path: delete-storageclassname.yaml
108+
- target:
109+
kind: PersistentVolumeClaim
110+
name: lsif-server
111+
version: v1
112+
path: delete-storageclassname.yaml
113+
- target:
114+
kind: PersistentVolumeClaim
115+
name: grafana
116+
version: v1
117+
path: delete-storageclassname.yaml
118+
- target:
119+
kind: PersistentVolumeClaim
120+
name: pgsql
121+
version: v1
122+
path: delete-storageclassname.yaml
123+
- target:
124+
kind: PersistentVolumeClaim
125+
name: redis-cache
126+
version: v1
127+
path: delete-storageclassname.yaml
128+
- target:
129+
kind: PersistentVolumeClaim
130+
name: redis-store
131+
version: v1
132+
path: delete-storageclassname.yaml
133+
134+

0 commit comments

Comments
 (0)