Skip to content

Commit 051c1d5

Browse files
committed
Migrate Istio to Flux managed Helm releases
- replace Istio operator with Flux managed Helm releases - install Istio in stages using Flux dependencies between istio-base, istiod and istio-gateway charts - use Flux variable substitutions to set the version for Istio control plane upgrades - replace Istio Prometheus manifests with Flagger Prometheus - adapt the e2e tests and set the Istio Gateway to NodePort, so it can run in Kubernetes Kind Signed-off-by: Stefan Prodan <[email protected]>
1 parent 992d192 commit 051c1d5

File tree

16 files changed

+136
-855
lines changed

16 files changed

+136
-855
lines changed

.github/workflows/e2e.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ jobs:
2020
version: v0.11.1
2121
- name: Install Flux in Kubernetes Kind
2222
run: flux install
23+
- name: Set Istio Gateway service type
24+
run: |
25+
kubectl -n flux-system create cm istio-version --from-literal=service=NodePort
2326
- name: Setup cluster reconciliation
2427
run: |
2528
flux create source git flux-system \
@@ -30,8 +33,8 @@ jobs:
3033
--path=./clusters/my-cluster
3134
- name: Verify cluster reconciliation
3235
run: |
33-
kubectl -n flux-system wait kustomization/istio-operator --for=condition=ready --timeout=2m
3436
kubectl -n flux-system wait kustomization/istio-system --for=condition=ready --timeout=2m
37+
kubectl -n flux-system wait kustomization/istio-gateway --for=condition=ready --timeout=2m
3538
kubectl -n flux-system wait kustomization/apps --for=condition=ready --timeout=2m
3639
kubectl -n prod wait canary/frontend --for=condition=promoted --timeout=1m
3740
kubectl -n prod rollout status deployment/frontend --timeout=1m

apps/backend/hpa.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ spec:
88
apiVersion: apps/v1
99
kind: Deployment
1010
name: backend
11-
minReplicas: 2
11+
minReplicas: 1
1212
maxReplicas: 4
1313
metrics:
1414
- type: Resource

apps/frontend/canary.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ spec:
2222
port: 9898
2323
# Istio gateways (optional)
2424
gateways:
25-
- istio-system/public-gateway
25+
- istio-system/public-gateway
2626
# Istio virtual service host names (optional)
2727
hosts:
28-
- "*"
28+
- "*"
2929
analysis:
3030
# schedule interval (default 60s)
3131
interval: 15s
@@ -72,4 +72,4 @@ spec:
7272
timeout: 15s
7373
url: http://flagger-loadtester.prod/
7474
metadata:
75-
cmd: "hey -z 1m -q 10 -c 2 -H 'Cookie: type=insider' http://frontend.prod:9898/"
75+
cmd: "hey -z 1m -q 10 -c 2 -H 'Cookie: type=insider' http://istio-gateway.istio-system/"

apps/frontend/deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,5 @@ spec:
6363
cpu: 2000m
6464
memory: 512Mi
6565
requests:
66-
cpu: 100m
67-
memory: 64Mi
66+
cpu: 10m
67+
memory: 16Mi

apps/frontend/hpa.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ spec:
88
apiVersion: apps/v1
99
kind: Deployment
1010
name: frontend
11-
minReplicas: 2
11+
minReplicas: 1
1212
maxReplicas: 4
1313
metrics:
1414
- type: Resource

apps/loadtest/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ spec:
1919
spec:
2020
containers:
2121
- name: loadtester
22-
image: weaveworks/flagger-loadtester:0.13.0
22+
image: ghcr.io/fluxcd/flagger-loadtester:0.22.0
2323
imagePullPolicy: IfNotPresent
2424
ports:
2525
- name: http
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: istio-version
5+
namespace: flux-system
6+
annotations:
7+
kustomize.toolkit.fluxcd.io/ssa: merge
8+
data:
9+
version: 1.13.3

clusters/my-cluster/istio.yaml

Lines changed: 12 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,22 @@
1-
apiVersion: kustomize.toolkit.fluxcd.io/v1beta1
2-
kind: Kustomization
3-
metadata:
4-
name: istio-operator
5-
namespace: flux-system
6-
spec:
7-
interval: 10m0s
8-
sourceRef:
9-
kind: GitRepository
10-
name: flux-system
11-
path: ./istio/operator
12-
prune: true
13-
validation: client
14-
healthChecks:
15-
- apiVersion: apps/v1
16-
kind: Deployment
17-
name: istio-operator
18-
namespace: istio-operator
19-
---
20-
apiVersion: kustomize.toolkit.fluxcd.io/v1beta1
1+
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
212
kind: Kustomization
223
metadata:
234
name: istio-system
245
namespace: flux-system
256
spec:
26-
dependsOn:
27-
- name: istio-operator
287
interval: 10m0s
8+
path: ./istio/system
9+
prune: true
10+
wait: true
2911
sourceRef:
3012
kind: GitRepository
3113
name: flux-system
32-
path: ./istio/system
33-
prune: true
34-
validation: client
35-
healthChecks:
36-
- apiVersion: apps/v1
37-
kind: Deployment
38-
name: istiod
39-
namespace: istio-system
40-
- apiVersion: apps/v1
41-
kind: Deployment
42-
name: prometheus
43-
namespace: istio-system
44-
- apiVersion: apps/v1
45-
kind: Deployment
46-
name: flagger
47-
namespace: istio-system
14+
postBuild:
15+
substituteFrom:
16+
- kind: ConfigMap
17+
name: istio-version
4818
---
49-
apiVersion: kustomize.toolkit.fluxcd.io/v1beta1
19+
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
5020
kind: Kustomization
5121
metadata:
5222
name: istio-gateway
@@ -55,9 +25,9 @@ spec:
5525
dependsOn:
5626
- name: istio-system
5727
interval: 10m0s
28+
path: ./istio/gateway
29+
prune: true
30+
wait: true
5831
sourceRef:
5932
kind: GitRepository
6033
name: flux-system
61-
path: ./istio/gateway
62-
prune: true
63-
validation: client

istio/gateway/flagger-metrics.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ metadata:
66
spec:
77
provider:
88
type: prometheus
9-
address: http://prometheus.istio-system:9090
9+
address: http://flagger-prometheus.istio-system:9090
1010
query: |
1111
100 - sum(
1212
rate(
@@ -38,7 +38,7 @@ metadata:
3838
spec:
3939
provider:
4040
type: prometheus
41-
address: http://prometheus.istio-system:9090
41+
address: http://flagger-prometheus.istio-system:9090
4242
query: |
4343
histogram_quantile(
4444
0.99,

istio/gateway/public-gateway.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
apiVersion: networking.istio.io/v1alpha3
1+
apiVersion: networking.istio.io/v1beta1
22
kind: Gateway
33
metadata:
44
name: public-gateway
55
namespace: istio-system
66
spec:
77
selector:
8-
istio: ingressgateway
8+
istio: gateway
99
servers:
1010
- port:
1111
number: 80

0 commit comments

Comments
 (0)