diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml new file mode 100644 index 000000000..e85476079 --- /dev/null +++ b/.github/workflows/e2e.yaml @@ -0,0 +1,58 @@ +name: E2E tests + +on: + pull_request: + branches: + - master + push: + branches: + - master + +jobs: + test: + name: ${{ matrix.testpath }} + runs-on: ubuntu-latest + strategy: + matrix: + testpath: + - ./tests/e2e/v1beta2/setup + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Build Dockerfile + run: docker build . --file Dockerfile --tag redis-operator:e2e + + - name: Install kuttl + run: | + curl -L https://github.com/kudobuilder/kuttl/releases/download/v0.15.0/kubectl-kuttl_0.15.0_linux_x86_64 -o /usr/local/bin/kuttl + chmod +x /usr/local/bin/kuttl + + - name: Install kubectl + run: | + curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + chmod +x kubectl + sudo mv kubectl /usr/local/bin/ + + - name: Create k8s Kind Cluster + uses: helm/kind-action@v1.5.0 + with: + config: tests/_config/kind-config.yaml + cluster_name: kind + + - name: Load Docker image into Kind + run: | + kubectl cluster-info --context kind-kind + kind load docker-image redis-operator:e2e --name kind + + - name: Install Redis Operator + run: | + make deploy + + - name: Wait for Redis Operator to be ready + run: | + kubectl wait --for=condition=available --timeout=300s deployment/redis-operator-redis-operator -n redis-operator-system + + - name: Run kuttl test + run: kuttl test ${{ matrix.testpath }} --config tests/_config/kuttl-test.yaml diff --git a/Makefile b/Makefile index 2c39a1d2b..24c1d4bf9 100644 --- a/Makefile +++ b/Makefile @@ -92,7 +92,7 @@ controller-gen: # Download kustomize locally if necessary KUSTOMIZE = $(shell pwd)/bin/kustomize kustomize: - $(call go-install-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v3@v3.8.7) + $(call go-install-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v4@v4.5.4) # go-install-tool will 'go install' any package $2 and install it to $1. PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))) diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index ffa9cb596..5a3d95884 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -12,5 +12,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization images: - name: controller - newName: quay.io/opstree/redis-operator - newTag: v0.15.0 + newName: redis-operator + newTag: e2e diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index d240cbabd..b935fa165 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -28,11 +28,15 @@ spec: containers: - command: - /manager + env: + - name: ENABLE_WEBHOOKS + value: "false" args: - --leader-elect - -zap-log-level=info - image: quay.io/opstree/redis-operator:v0.12.0 - imagePullPolicy: Always + - -enable-webhooks=false + image: redis-operator:e2e + imagePullPolicy: IfNotPresent name: manager securityContext: allowPrivilegeEscalation: false