Skip to content

Commit

Permalink
Use helm/kind-action to install kind
Browse files Browse the repository at this point in the history
Signed-off-by: Loic Devulder <[email protected]>
  • Loading branch information
ldevulder committed Oct 9, 2023
1 parent c4d2be4 commit 908f70d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 21 deletions.
13 changes: 4 additions & 9 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ jobs:
name: k8s ${{ matrix.kubernetes }} - Rancher ${{ matrix.rancherVersion }} - ${{ matrix.replicas }} replicas
env:
CHART: ${{ github.workspace }}/build/${{ needs.prepare-build.outputs.chart_name }}
KUBE_VERSION: ${{ matrix.kubernetes }}
OPERATOR_REPLICAS: ${{ matrix.replicas }}
RANCHER_VERSION: ${{ matrix.rancherVersion }}
steps:
Expand All @@ -119,15 +118,11 @@ jobs:
key: ${{ runner.os }}-test-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-test-go-${{ hashFiles('**/go.sum') }}
- name: Install KinD
uses: jaxxstorm/action-install-gh-release@v1.9.0
- name: Install kind
uses: helm/kind-action@v1
with:
repo: kubernetes-sigs/kind
tag: v0.16.0
extension-matching: disable
rename-to: kind
chmod: 0755
cache: enable
cluster_name: operator-e2e
node_image: kindest/node:${{ matrix.kubernetes }}
- name: e2e tests
run: make e2e-tests
- name: Archive artifacts
Expand Down
19 changes: 7 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ chart:

.PHONY: migration-chart
migration-chart:
mkdir -p $(ROOT_DIR)/build
mkdir -p $(ROOT_DIR)/build
cp -rf $(ROOT_DIR)/charts/crds-migration $(ROOT_DIR)/build/crds-migration
helm package -d $(ROOT_DIR)/build/ $(ROOT_DIR)/build/crds-migration
rm -Rf $(ROOT_DIR)/build/crds-migration
Expand All @@ -146,16 +146,16 @@ validate:
unit-tests: $(SETUP_ENVTEST) $(GINKGO)
KUBEBUILDER_ASSETS="$(KUBEBUILDER_ASSETS)" $(GINKGO) -v -r --trace --race --covermode=atomic --coverprofile=coverage.out --coverpkg=github.com/rancher/elemental-operator/... ./pkg/... ./controllers/... ./cmd/...

e2e-tests: $(GINKGO) setup-kind
export EXTERNAL_IP=`kubectl get nodes -o jsonpath='{.items[].status.addresses[?(@.type == "InternalIP")].address}'` && \
e2e-tests: $(GINKGO)
kubectl cluster-info --context kind-$(CLUSTER_NAME)
kubectl label nodes --all --overwrite ingress-ready=true
kubectl label nodes --all --overwrite node-role.kubernetes.io/master=
kubectl get nodes -o wide
export EXTERNAL_IP=$$(kubectl get nodes -o jsonpath='{.items[].status.addresses[?(@.type == "InternalIP")].address}') && \
export BRIDGE_IP="172.18.0.1" && \
export CONFIG_PATH=$(E2E_CONF_FILE) && \
cd $(ROOT_DIR)/tests && $(GINKGO) -r -v ./e2e

# Only setups the kind cluster
setup-kind:
KUBE_VERSION=${KUBE_VERSION} $(ROOT_DIR)/scripts/setup-kind-cluster.sh

# setup the cluster but not run any test!
# This will build the image locally, the chart with that image,
# setup kind, load the local built image into the cluster,
Expand All @@ -171,11 +171,6 @@ setup-full-cluster: build-docker-operator build-docker-seedimage-builder chart s
kind load docker-image --name $(CLUSTER_NAME) ${REGISTRY_HEADER}${REPO_SEEDIMAGE}:${TAG_SEEDIMAGE} && \
cd $(ROOT_DIR)/tests && $(GINKGO) -r -v --label-filter="do-nothing" ./e2e

kind-e2e-tests: build-docker-operator chart setup-kind
export CONFIG_PATH=$(E2E_CONF_FILE) && \
kind load docker-image --name $(CLUSTER_NAME) ${REGISTRY_HEADER}${REPO}:${CHART_VERSION}
$(MAKE) e2e-tests

# This builds the docker image, generates the chart, loads the image into the kind cluster and upgrades the chart to latest
# useful to test changes into the operator with a running system, without clearing the operator namespace
# thus losing any registration/inventories/os CRDs already created
Expand Down

0 comments on commit 908f70d

Please sign in to comment.