helmfile.yaml
5.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
bases:
- ../common/environments.yaml
---
helmfiles:
- path: ../redis/helmfile.yaml
values:
- namespace: {{ .Values.namespace }}
namePrefix: {{ .Values.namePrefix }}registry-
#images:
# redis: {{ .Values.images.redis }}
releases:
- name: {{ .Values.namePrefix }}registry
namespace: {{ .Values.namespace }}
chart: charts/registry
values:
- set-common-values.yaml.gotmpl
jsonPatches:
- target:
kind: Service
name: {{ .Values.namePrefix }}registry
namespace: {{ .Values.namespace }}
version: v1
patch:
- op: replace
path: /spec/selector/app
value: {{ .Values.namePrefix }}registry
- op: replace
path: /spec/type
value: {{ .Values.registry.service.registry.type }}
{{- if .Values.registry.service.registry.clusterIP }}
- op: add
path: /spec/clusterIP
value: {{ .Values.registry.service.registry.clusterIP }}
{{- end }}
{{- if eq .Values.registry.service.registry.type "ClusterIP" }}
- op: remove
path: /spec/ports/0/nodePort
{{- else if eq .Values.registry.service.registry.type "LoadBalancer" }}
- op: remove
path: /spec/ports/0/nodePort
{{- else }}
{{- if .Values.registry.service.registry.nodePort }}
- op: replace
path: /spec/ports/0/nodePort
value: {{ .Values.registry.service.registry.nodePort }}
{{- end }}
{{- end }}
{{- if .Values.istioVirtualService.enabled }}
- target:
kind: VirtualService
name: {{ .Values.namePrefix }}registry
namespace: {{ .Values.namespace }}
version: v1beta1
group: networking.istio.io
patch:
- op: replace
path: /spec/http/0/route/0/destination/host
value: {{ .Values.namePrefix }}registry
- target:
kind: DestinationRule
name: {{ .Values.namePrefix }}registry-originate-tls
namespace: {{ .Values.namespace }}
version: v1beta1
group: networking.istio.io
patch:
- op: replace
path: /spec/host
value: {{ .Values.namePrefix }}registry
{{- end }}
{{- if not (empty (.Values.registry.jsonPatches)) }}
{{- .Values.registry.jsonPatches | toYaml | indent 6 }}
{{- end }}
strategicMergePatches:
- apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: {{ .Values.namePrefix }}registry
namespace: {{ .Values.namespace }}
{{- if .Values.istioVirtualService.enabled }}
spec:
hosts:
{{- range $vhost_index, $vhost := .Values.istioVirtualService.vhosts }}
- {{ $vhost | quote }}
{{- end }}
gateways:
{{- range $gateway_index, $gateway := .Values.istioVirtualService.gateways }}
- {{ $gateway | quote }}
{{- end }}
{{- else }}
$patch: delete
{{- end }}
- apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: {{ .Values.namePrefix }}registry-crt
namespace: {{ .Values.namespace }}
spec:
dnsNames:
{{- range $hostName_index, $hostName := .Values.certificate.hostNames }}
- {{ $hostName | quote }}
{{- end }}
issuerRef:
name: {{ .Values.certificate.issuerRef }}
- apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.namePrefix }}registry
namespace: {{ .Values.namespace }}
spec:
selector:
matchLabels:
app: {{ .Values.namePrefix }}registry
template:
metadata:
labels:
app: {{ .Values.namePrefix }}registry
spec:
volumes:
- name: registry-data
persistentVolumeClaim:
claimName: {{ .Values.namePrefix }}registry-data
containers:
- name: registry
envFrom:
- configMapRef:
name: {{ .Values.namePrefix }}registry-config
- secretRef:
name: {{ .Values.namePrefix }}registry-secret
- apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.namePrefix }}registry-config
namespace: {{ .Values.namespace }}
data:
REGISTRY_REDIS_ADDR: {{ .Values.namePrefix }}registry-redis.{{ .Values.namespace }}.svc.cluster.local
REGISTRY_STORAGE_CACHE_BLOBDESCRIPTOR: redis
- apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.namePrefix }}registry-secret
namespace: {{ .Values.namespace }}
stringData:
{{- if not (empty (.Values.registry.strategicMergePatches)) }}
{{- .Values.registry.strategicMergePatches | toYaml | indent 6 }}
{{- end }}