a742dade by Adam Heath

Add basic registry service, exposed on a NodePort.

1 parent 9bf694f2
1 ---
2 apiVersion: v1
3 kind: ConfigMap
4 metadata:
5 name: registry-config
6 data:
7 ---
8 apiVersion: v1
9 kind: Secret
10 metadata:
11 name: registry-secret
12 stringData:
13 ---
14 apiVersion: v1
15 kind: PersistentVolumeClaim
16 metadata:
17 name: registry-data
18 spec:
19 accessModes:
20 - ReadWriteOnce
21 resources:
22 requests:
23 storage: 10Gi
24 ---
25
26
1 environments:
2 default:
3 values:
4 - namespace: registry
5 namePrefix: "test-"
6 restoreFromEmpty:
7 enabled: true
8 registry:
9 jsonPatches: []
10 strategicMergePatches: []
11 service:
12 registry:
13 nodePort: 32123
14 images:
15 debian: "debian:bullseye-20211220"
16 registry: "registry:2"
17
18 ---
19 releases:
20
21 - name: {{ .Values.namePrefix }}registry
22 namespace: {{ .Values.namespace }}
23 chart: .
24 values:
25 - set-common-values.yaml.gotmpl
26 jsonPatches:
27 - target:
28 kind: Service
29 name: {{ .Values.namePrefix }}registry
30 namespace: {{ .Values.namespace }}
31 version: v1
32 patch:
33 - op: replace
34 path: /spec/selector/app
35 value: {{ .Values.namePrefix }}registry
36 - op: replace
37 path: /spec/ports/0/nodePort
38 value: {{ .Values.registry.service.registry.nodePort }}
39 {{- if not (empty (.Values.registry.jsonPatches)) }}
40 {{- .Values.registry.jsonPatches | toYaml | indent 6 }}
41 {{- end }}
42 strategicMergePatches:
43 - apiVersion: apps/v1
44 kind: Deployment
45 metadata:
46 name: {{ .Values.namePrefix }}registry
47 namespace: {{ .Values.namespace }}
48 spec:
49 selector:
50 matchLabels:
51 app: {{ .Values.namePrefix }}registry
52 template:
53 metadata:
54 labels:
55 app: {{ .Values.namePrefix }}registry
56 spec:
57 volumes:
58 - name: registry-data
59 persistentVolumeClaim:
60 claimName: {{ .Values.namePrefix }}registry-data
61 - name: registry-config
62 configMap:
63 name: {{ .Values.namePrefix }}registry-config
64 - name: registry-secret
65 secret:
66 secretName: {{ .Values.namePrefix }}registry-secret
67 - apiVersion: v1
68 kind: ConfigMap
69 metadata:
70 name: {{ .Values.namePrefix }}registry-config
71 namespace: {{ .Values.namespace }}
72 data:
73 - apiVersion: v1
74 kind: Secret
75 metadata:
76 name: {{ .Values.namePrefix }}registry-secret
77 namespace: {{ .Values.namespace }}
78 stringData:
79 {{- if not (empty (.Values.registry.strategicMergePatches)) }}
80 {{- .Values.registry.strategicMergePatches | toYaml | indent 6 }}
81 {{- end }}
82
1 apiVersion: kustomize.config.k8s.io/v1beta1
2 kind: Kustomization
3
4 resources:
5 - ./config.yaml
6 - ./registry.yaml
7
1 ---
2 apiVersion: v1
3 kind: Service
4 metadata:
5 name: registry
6 spec:
7 type: NodePort
8 selector:
9 app: registry
10 ports:
11 - name: registry
12 protocol: TCP
13 port: 5000
14 targetPort: 5000
15 nodePort: 5000
16 ---
17 apiVersion: apps/v1
18 kind: Deployment
19 metadata:
20 name: registry
21 labels:
22 app: registry
23 spec:
24 selector:
25 matchLabels:
26 app: registry
27 template:
28 metadata:
29 labels:
30 app: registry
31 spec:
32 restartPolicy: Always
33 securityContext:
34 runAsUser: 0
35 runAsGroup: 0
36
37 volumes:
38 - name: registry-data
39 persistentVolumeClaim:
40 claimName: registry-data
41 - name: registry-config
42 configMap:
43 name: registry-config
44 - name: registry-secret
45 secret:
46 secretName: registry-secret
47
48 containers:
49 - name: registry
50 image: registry:2
51 volumeMounts:
52 - name: registry-data
53 mountPath: /var/lib/registry
54
1 namePrefix: {{ .Values.namePrefix }}
2 namespace: {{ .Values.namespace }}
3 images:
4 - name: debian
5 newName: {{ .Values.images.debian }}
6 - name: registry
7 newName: {{ .Values.images.registry }}
8