Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from fluxcd-community/flux-e2e-tests
Browse files Browse the repository at this point in the history
Add end-to-end tests
  • Loading branch information
stefanprodan authored Jun 1, 2022
2 parents 9fb2ef9 + eb56c11 commit 30081ad
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 2 deletions.
113 changes: 113 additions & 0 deletions .github/workflows/flux-e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# microservices-demo

[![flux-e2e](https://github.com/fluxcd-community/microservices-demo/workflows/flux-e2e/badge.svg)](https://github.com/fluxcd-community/microservices-demo/actions)
[![license](https://img.shields.io/github/license/fluxcd-community/microservices-demo.svg)](https://github.com/fluxcd-community/microservices-demo/blob/main/LICENSE)

Microservices demo made with
[podinfo](https://github.com/stefanprodan/podinfo),
managed by [flux](https://github.com/fluxcd/flux2)
Expand Down Expand Up @@ -92,7 +95,7 @@ spec:
path: ./deploy
prune: true
wait: true
timeout: 2m
timeout: 3m
serviceAccountName: flux
sourceRef:
kind: GitRepository
Expand All @@ -110,7 +113,8 @@ spec:
```
Note that the above configuration is compatible with Flux
[multi-tenancy lockdown mode](https://fluxcd.io/docs/installation/#multi-tenancy-lockdown).
[multi-tenancy lockdown mode](https://fluxcd.io/docs/installation/#multi-tenancy-lockdown)
and is being tested in GitHub Actions by the [flux-e2e workflow](.github/workflows/flux-e2e.yaml).
To spin up multiple stacks, make a copy the above file, replace `msdemo` with `msdemo1` in
the multi-doc YAML and add it to your repository.
Expand Down

0 comments on commit 30081ad

Please sign in to comment.