|
| 1 | +name: flux-e2e |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: [ '*' ] |
| 7 | + tags-ignore: [ '*' ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + kubernetes: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - name: Checkout |
| 14 | + uses: actions/checkout@v2 |
| 15 | + - name: Setup Flux |
| 16 | + uses: fluxcd/flux2/action@main |
| 17 | + - name: Setup Kubernetes |
| 18 | + |
| 19 | + with: |
| 20 | + version: v0.14.0 |
| 21 | + - name: Install Flux in Kubernetes Kind |
| 22 | + run: flux install |
| 23 | + - name: Setup cluster reconciliation |
| 24 | + run: | |
| 25 | + kubectl apply -f - <<EOF > cat |
| 26 | + --- |
| 27 | + apiVersion: v1 |
| 28 | + kind: Namespace |
| 29 | + metadata: |
| 30 | + name: msdemo |
| 31 | + annotations: |
| 32 | + config.linkerd.io/proxy-await: enabled |
| 33 | + linkerd.io/inject: enabled |
| 34 | + --- |
| 35 | + apiVersion: source.toolkit.fluxcd.io/v1beta2 |
| 36 | + kind: GitRepository |
| 37 | + metadata: |
| 38 | + name: msdemo |
| 39 | + namespace: msdemo |
| 40 | + spec: |
| 41 | + interval: 15m |
| 42 | + ref: |
| 43 | + branch: ${GITHUB_REF#refs/heads/} |
| 44 | + url: ${{ github.event.repository.html_url }} |
| 45 | + ignore: | |
| 46 | + /clusters/**/flux-system/ |
| 47 | + --- |
| 48 | + apiVersion: v1 |
| 49 | + kind: ServiceAccount |
| 50 | + metadata: |
| 51 | + labels: |
| 52 | + toolkit.fluxcd.io/tenant: msdemo |
| 53 | + name: flux |
| 54 | + namespace: msdemo |
| 55 | + --- |
| 56 | + apiVersion: rbac.authorization.k8s.io/v1 |
| 57 | + kind: RoleBinding |
| 58 | + metadata: |
| 59 | + labels: |
| 60 | + toolkit.fluxcd.io/tenant: msdemo |
| 61 | + name: flux |
| 62 | + namespace: msdemo |
| 63 | + roleRef: |
| 64 | + apiGroup: rbac.authorization.k8s.io |
| 65 | + kind: ClusterRole |
| 66 | + name: cluster-admin |
| 67 | + subjects: |
| 68 | + - kind: ServiceAccount |
| 69 | + name: flux |
| 70 | + namespace: msdemo |
| 71 | + --- |
| 72 | + apiVersion: kustomize.toolkit.fluxcd.io/v1beta2 |
| 73 | + kind: Kustomization |
| 74 | + metadata: |
| 75 | + name: msdemo |
| 76 | + namespace: msdemo |
| 77 | + spec: |
| 78 | + targetNamespace: msdemo |
| 79 | + interval: 60m0s |
| 80 | + retryInterval: 1m30s |
| 81 | + path: ./deploy |
| 82 | + prune: true |
| 83 | + wait: true |
| 84 | + timeout: 3m |
| 85 | + serviceAccountName: flux |
| 86 | + sourceRef: |
| 87 | + kind: GitRepository |
| 88 | + name: msdemo |
| 89 | + postBuild: |
| 90 | + substitute: |
| 91 | + app_namespace: msdemo |
| 92 | + patches: |
| 93 | + - target: |
| 94 | + kind: Kustomization |
| 95 | + patch: | |
| 96 | + - op: add |
| 97 | + path: /spec/serviceAccountName |
| 98 | + value: flux |
| 99 | + EOF |
| 100 | + - name: Wait for msdemo reconciliation |
| 101 | + run: | |
| 102 | + kubectl -n msdemo wait gitrepository/msdemo --for=condition=ready --timeout=1m |
| 103 | + kubectl -n msdemo wait kustomization/msdemo --for=condition=ready --timeout=3m |
| 104 | + - name: Flux status |
| 105 | + run: | |
| 106 | + flux -n msdemo get all |
| 107 | + - name: Debug failure |
| 108 | + if: failure() |
| 109 | + run: | |
| 110 | + flux get all --all-namespaces |
| 111 | + kubectl -n msdemo get all |
| 112 | + kubectl -n flux-system logs deploy/source-controller |
| 113 | + kubectl -n flux-system logs deploy/kustomize-controller |
0 commit comments