This repository has been archived by the owner on Feb 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
113 lines (111 loc) · 3.21 KB
/
flux-e2e.yaml
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
name: flux-e2e
on:
workflow_dispatch:
push:
branches: [ '*' ]
tags-ignore: [ '*' ]
jobs:
kubernetes:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Flux
uses: fluxcd/flux2/action@main
- name: Setup Kubernetes
uses: engineerd/[email protected]
with:
version: v0.14.0
- name: Install Flux in Kubernetes Kind
run: flux install
- name: Setup cluster reconciliation
run: |
kubectl apply -f - <<EOF > cat
---
apiVersion: v1
kind: Namespace
metadata:
name: msdemo
annotations:
config.linkerd.io/proxy-await: enabled
linkerd.io/inject: enabled
---
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: GitRepository
metadata:
name: msdemo
namespace: msdemo
spec:
interval: 15m
ref:
branch: ${GITHUB_REF#refs/heads/}
url: ${{ github.event.repository.html_url }}
ignore: |
/clusters/**/flux-system/
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
toolkit.fluxcd.io/tenant: msdemo
name: flux
namespace: msdemo
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
toolkit.fluxcd.io/tenant: msdemo
name: flux
namespace: msdemo
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: flux
namespace: msdemo
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: msdemo
namespace: msdemo
spec:
targetNamespace: msdemo
interval: 60m0s
retryInterval: 1m30s
path: ./deploy
prune: true
wait: true
timeout: 3m
serviceAccountName: flux
sourceRef:
kind: GitRepository
name: msdemo
postBuild:
substitute:
app_namespace: msdemo
patches:
- target:
kind: Kustomization
patch: |
- op: add
path: /spec/serviceAccountName
value: flux
EOF
- name: Wait for msdemo reconciliation
run: |
kubectl -n msdemo wait gitrepository/msdemo --for=condition=ready --timeout=1m
kubectl -n msdemo wait kustomization/msdemo --for=condition=ready --timeout=3m
- name: Flux status
run: |
flux -n msdemo get all
- name: Debug failure
if: failure()
run: |
flux get all --all-namespaces
kubectl -n msdemo get all
kubectl -n flux-system logs deploy/source-controller
kubectl -n flux-system logs deploy/kustomize-controller