Skip to content

Commit 583597b

Browse files
committed
add new domain for test
Signed-off-by: Polina Sizintseva <[email protected]>
1 parent feaefe6 commit 583597b

File tree

7 files changed

+64
-67
lines changed

7 files changed

+64
-67
lines changed

.github/workflows/deploy-production-ru.yml

Lines changed: 31 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ on:
1919
options:
2020
- preflight
2121
- deploy
22+
ru_test_host:
23+
description: "Temporary RU host for local testing without public DNS"
24+
required: true
25+
default: ru-test.werf.io
26+
type: string
2227

2328
env:
2429
RUN_MODE: ${{ github.event_name == 'push' && 'deploy' || github.event_name == 'workflow_dispatch' && github.event.inputs.mode || 'preflight' }}
@@ -27,6 +32,7 @@ env:
2732
WERF_STAGES_STORAGE: "ghcr.io/werf/werfio-guides-stages"
2833
WERF_SET_ACTIVE_RELEASE: "global.active_release=2"
2934
WERFIO_GITHUB_TOKEN: "${{ secrets.API_TOKEN }}"
35+
RU_TEST_HOST: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ru_test_host || 'ru-test.werf.io' }}
3036

3137
jobs:
3238
converge-ru:
@@ -90,71 +96,17 @@ jobs:
9096
echo "field=kube.config" >> "$GITHUB_OUTPUT"
9197
echo "kubeconfig_base64=$kubeconfig_base64" >> "$GITHUB_OUTPUT"
9298
93-
- name: Check RU cluster access
94-
env:
95-
WERF_KUBE_CONFIG_BASE64: ${{ steps.ru_kubeconfig.outputs.kubeconfig_base64 }}
96-
run: |
97-
set -euo pipefail
98-
. $(werf ci-env github --as-file)
99-
100-
can_create_namespaces=no
101-
102-
echo "== cluster-info =="
103-
werf kubectl cluster-info
104-
105-
echo "== namespace =="
106-
if werf kubectl get ns werfio-production >/dev/null 2>&1; then
107-
echo "Namespace werfio-production exists"
108-
else
109-
echo "Namespace werfio-production is missing"
110-
echo "Can create namespaces?"
111-
can_create_namespaces="$(werf kubectl auth can-i create namespaces || true)"
112-
echo "$can_create_namespaces"
113-
if [[ "$can_create_namespaces" != "yes" ]]; then
114-
echo "No permission to create namespaces, RU rollout would fail later" >&2
115-
exit 1
116-
fi
117-
fi
118-
119-
echo "== priorityclass =="
120-
if werf kubectl get priorityclass production-medium >/dev/null 2>&1; then
121-
echo "PriorityClass production-medium exists"
122-
else
123-
echo "PriorityClass production-medium is missing"
124-
exit 1
125-
fi
126-
127-
echo "== can-i =="
128-
werf kubectl auth can-i get pods -n werfio-production
129-
werf kubectl auth can-i get ingress -n werfio-production
130-
werf kubectl auth can-i create deployment.apps -n werfio-production
131-
132-
echo "== image pull secret =="
133-
if werf kubectl get ns werfio-production >/dev/null 2>&1; then
134-
if werf kubectl -n werfio-production get secret github-werfio >/dev/null 2>&1; then
135-
echo "Secret github-werfio exists in werfio-production"
136-
else
137-
echo "Secret github-werfio is missing in werfio-production"
138-
if [[ "$RUN_MODE" == "deploy" ]]; then
139-
echo "Deploy mode requires github-werfio to exist in werfio-production" >&2
140-
exit 1
141-
fi
142-
echo "This is acceptable for preflight, but deploy will fail until the secret is created."
143-
fi
144-
145-
echo "== existing resources =="
146-
werf kubectl -n werfio-production get deploy,svc,ingress,pdb || true
147-
else
148-
echo "Skipping namespace-scoped resource checks because namespace is missing"
149-
fi
150-
15199
- name: Render RU manifests
152100
env:
153101
WERF_KUBE_CONFIG_BASE64: ${{ steps.ru_kubeconfig.outputs.kubeconfig_base64 }}
154102
run: |
155103
set -euo pipefail
156104
. $(werf ci-env github --as-file)
157-
werf render --dev --env production --without-images --stub-tags --ignore-secret-key --set global.targetCluster=ru >/tmp/werf-render-ru.yaml
105+
werf render --dev --env production --without-images --stub-tags --ignore-secret-key \
106+
--set global.targetCluster=ru \
107+
--set productionDeploy.ru.hostOverride="$RU_TEST_HOST" \
108+
--set productionDeploy.ru.tlsEnabled=false \
109+
--set productionDeploy.ru.certificateEnabled=false >/tmp/werf-render-ru.yaml
158110
159111
echo "Rendered RU objects summary:"
160112
grep '^kind:' /tmp/werf-render-ru.yaml | sort | uniq -c | cat
@@ -163,7 +115,11 @@ jobs:
163115
if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.mode == 'deploy') }}
164116
run: |
165117
. $(werf ci-env github --as-file)
166-
werf converge --set global.targetCluster=ru
118+
werf converge \
119+
--set global.targetCluster=ru \
120+
--set productionDeploy.ru.hostOverride="$RU_TEST_HOST" \
121+
--set productionDeploy.ru.tlsEnabled=false \
122+
--set productionDeploy.ru.certificateEnabled=false
167123
env:
168124
WERF_NAMESPACE: "werfio-production"
169125
WERF_RELEASE: "werfio-site-production"
@@ -184,10 +140,12 @@ jobs:
184140
- Secret path: projects/data/b454e6aa-39f0-45f4-aa7c-a9465ab154cb/KUBE_CONFIG_RU
185141
- Secret field used: ${{ steps.ru_kubeconfig.outputs.field }}
186142
- Helm switch: global.targetCluster=ru
143+
- Temporary RU host: $RU_TEST_HOST
144+
- TLS for RU test host: disabled
145+
- Certificate for RU test host: disabled
187146
188147
On push to branch `chore/prod-split-ru-eu`, this workflow performs a real RU deploy.
189-
Missing namespace is allowed if the token can create namespaces.
190-
Missing imagePullSecret is allowed only for preflight and blocks deploy.
148+
RU deploy uses a temporary host and does not request a public certificate until DNS cutover.
191149
Current old production cluster was not modified by this workflow.
192150
EOF
193151
@@ -199,4 +157,15 @@ jobs:
199157
200158
201159
160+
161+
162+
163+
164+
165+
166+
167+
168+
169+
170+
202171

.helm/templates/12-backend.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ spec:
2020
labels:
2121
service: backend
2222
spec:
23-
imagePullSecrets:
24-
- name: github-werfio
23+
{{- include "imagePullSecrets" . | indent 6 }}
2524
priorityClassName: {{ pluck .Values.werf.env .Values.priorityClassName | first | default .Values.priorityClassName._default }}
2625
{{- include "clusterPlacement" . | indent 6 }}
2726
containers:

.helm/templates/14-tuf-router.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ spec:
1717
labels:
1818
service: tuf-router
1919
spec:
20-
imagePullSecrets:
21-
- name: github-werfio
20+
{{- include "imagePullSecrets" . | indent 6 }}
2221
priorityClassName: {{ pluck .Values.werf.env .Values.priorityClassName | first | default .Values.priorityClassName._default }}
2322
{{- include "clusterPlacement" . | indent 6 }}
2423
containers:

.helm/templates/20-ingress-tuf-router.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
{{- $host = ( printf "%s.%s" .Values.werf.env (pluck "dev" .Values.host | first | default .Values.host._default ) | lower ) }}
44
{{- end }}
55
{{- $targetCluster := include "targetCluster" . }}
6+
{{- $ruConfig := .Values.productionDeploy.ru }}
67
{{- $ruHost := printf "ru.%s" $host }}
8+
{{- if and (eq .Values.werf.env "production") (eq $targetCluster "ru") }}
9+
{{- $ruHost = $ruConfig.hostOverride | default $ruHost }}
10+
{{- end }}
711

812
apiVersion: networking.k8s.io/v1
913
kind: Ingress
@@ -12,6 +16,7 @@ metadata:
1216
annotations: {}
1317
spec:
1418
ingressClassName: {{ pluck .Values.werf.env .Values.ingressClassName | first | default .Values.ingressClassName._default }}
19+
{{- if or (ne .Values.werf.env "production") (ne $targetCluster "ru") $ruConfig.tlsEnabled }}
1520
tls:
1621
- hosts:
1722
{{- if eq .Values.werf.env "production" }}
@@ -25,6 +30,7 @@ spec:
2530
- {{ $host }}
2631
- ru-{{ $host }}
2732
secretName: {{ pluck .Values.werf.env .Values.ingressSecretName | first | default .Values.ingressSecretName._default }}
33+
{{- end }}
2834
{{- end }}
2935
rules:
3036
{{- if or (ne .Values.werf.env "production") (eq $targetCluster "eu") }}

.helm/templates/20-ingress.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
{{- $host = ( printf "%s.%s" .Values.werf.env (pluck "dev" .Values.host | first | default .Values.host._default ) | lower ) }}
44
{{- end }}
55
{{- $targetCluster := include "targetCluster" . }}
6+
{{- $ruConfig := .Values.productionDeploy.ru }}
67
{{- $ruHost := printf "ru.%s" $host }}
8+
{{- if and (eq .Values.werf.env "production") (eq $targetCluster "ru") }}
9+
{{- $ruHost = $ruConfig.hostOverride | default $ruHost }}
10+
{{- end }}
711
{{- $wwwHost := printf "www.%s" $host }}
812
{{- if eq .Values.werf.env "production" }}
913
---
@@ -20,6 +24,7 @@ metadata:
2024
nginx.ingress.kubernetes.io/from-to-www-redirect: "true"
2125
spec:
2226
ingressClassName: {{ pluck .Values.werf.env .Values.ingressClassName | first | default .Values.ingressClassName._default }}
27+
{{- if or (eq $targetCluster "eu") $ruConfig.tlsEnabled }}
2328
tls:
2429
- hosts:
2530
{{- if eq $targetCluster "ru" }}
@@ -29,6 +34,7 @@ spec:
2934
- {{ $wwwHost }}
3035
{{- end }}
3136
secretName: tls-{{ $host }}
37+
{{- end }}
3238
rules:
3339
{{- if eq $targetCluster "eu" }}
3440
- host: {{ $host }}
@@ -118,7 +124,7 @@ spec:
118124
name: http
119125
{{- end }}
120126

121-
{{- if and (eq .Values.werf.env "production") (eq $targetCluster "ru") }}
127+
{{- if and (eq .Values.werf.env "production") (eq $targetCluster "ru") $ruConfig.certificateEnabled }}
122128
---
123129
apiVersion: cert-manager.io/v1
124130
kind: Certificate

.helm/templates/_helpers.tpl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ resources:
66
memory: {{ pluck .Values.werf.env .Values.resources.requests.memory | first | default .Values.resources.requests.memory._default }}
77
{{- end }}
88

9+
{{- define "imagePullSecrets" }}
10+
{{- with .Values.imagePullSecrets }}
11+
imagePullSecrets:
12+
{{- range . }}
13+
- name: {{ . | quote }}
14+
{{- end }}
15+
{{- end }}
16+
{{- end }}
17+
918
{{- define "targetCluster" }}
1019
{{- if eq .Values.werf.env "production" }}
1120
{{- $targetCluster := .Values.global.targetCluster | default "" -}}

.helm/values.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
global:
22
targetCluster: ""
33

4+
imagePullSecrets:
5+
- github-werfio
6+
7+
productionDeploy:
8+
ru:
9+
hostOverride: ""
10+
tlsEnabled: true
11+
certificateEnabled: true
12+
413
clusters:
514
eu:
615
placement:

0 commit comments

Comments
 (0)