Skip to content

Commit 8e8cf93

Browse files
authored
Merge pull request kubernetes-sigs#10467 from cahillsf/improve-tilt-doc
🌱 improve tilt setup for local e2e
2 parents 2fbed5b + 6658b9d commit 8e8cf93

File tree

7 files changed

+59
-7
lines changed

7 files changed

+59
-7
lines changed

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,11 +642,11 @@ lint: $(GOLANGCI_LINT) ## Lint the codebase
642642
$(GOLANGCI_LINT) run -v $(GOLANGCI_LINT_EXTRA_ARGS)
643643
cd $(TEST_DIR); $(GOLANGCI_LINT) run --path-prefix $(TEST_DIR) --config $(ROOT_DIR)/.golangci.yml -v $(GOLANGCI_LINT_EXTRA_ARGS)
644644
cd $(TOOLS_DIR); $(GOLANGCI_LINT) run --path-prefix $(TOOLS_DIR) --config $(ROOT_DIR)/.golangci.yml -v $(GOLANGCI_LINT_EXTRA_ARGS)
645-
./scripts/ci-lint-dockerfiles.sh $(HADOLINT_VER) $(HADOLINT_FAILURE_THRESHOLD)
645+
./scripts/lint-dockerfiles.sh $(HADOLINT_VER) $(HADOLINT_FAILURE_THRESHOLD)
646646

647647
.PHONY: lint-dockerfiles
648648
lint-dockerfiles:
649-
./scripts/ci-lint-dockerfiles.sh $(HADOLINT_VER) $(HADOLINT_FAILURE_THRESHOLD)
649+
./scripts/lint-dockerfiles.sh $(HADOLINT_VER) $(HADOLINT_FAILURE_THRESHOLD)
650650

651651
.PHONY: lint-fix
652652
lint-fix: $(GOLANGCI_LINT) ## Lint the codebase and run auto-fixers if supported by the linter
@@ -961,6 +961,11 @@ test-e2e: $(GINKGO) generate-e2e-templates ## Run the end-to-end tests
961961
kind-cluster: ## Create a new kind cluster designed for development with Tilt
962962
hack/kind-install-for-capd.sh
963963

964+
.PHONY: tilt-e2e-prerequisites
965+
tilt-e2e-prerequisites: ## Build the corresponding kindest/node images required for e2e testing and generate the e2e templates
966+
scripts/build-kind.sh
967+
$(MAKE) generate-e2e-templates
968+
964969
.PHONY: tilt-up
965970
tilt-up: kind-cluster ## Start tilt and build kind cluster if needed.
966971
tilt up

docs/book/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
1717
TOOLS_DIR := $(realpath ../../hack/tools)
1818
TOOLS_BIN_DIR := $(TOOLS_DIR)/bin
1919
BIN_DIR := bin
20-
MDBOOK_INSTALL := $(realpath ../../scripts/ci-install-mdbook.sh)
20+
MDBOOK_INSTALL := $(realpath ../../scripts/install-mdbook.sh)
2121

2222
export PATH := $(TOOLS_BIN_DIR):$(PATH)
2323

docs/book/src/developer/testing.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,12 @@ Execute the run configuration with `Debug`.
246246
The e2e tests create a new management cluster with kind on each run. To avoid this and speed up the test execution the tests can
247247
also be run against a management cluster created by [tilt](./tilt.md):
248248
```bash
249-
# Create a kind cluster
250-
./hack/kind-install-for-capd.sh
251-
# Set up the management cluster via tilt
252-
tilt up
249+
# Prereqs for e2e testing with tilt
250+
make tilt-e2e-prerequisites
251+
# Create a kind cluster and start tilt
252+
make tilt-up
253253
```
254+
254255
Now you can start the e2e test via IDE as described above but with the additional `-e2e.use-existing-cluster=true` flag.
255256

256257
**Note**: This can also be used to debug controllers during e2e tests as described in [Developing Cluster API with Tilt](./tilt.md#wiring-up-debuggers).

scripts/build-kind.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2018 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -o errexit
18+
set -o pipefail
19+
20+
REPO_ROOT=$(git rev-parse --show-toplevel)
21+
cd "${REPO_ROOT}" || exit 1
22+
23+
# shellcheck source=./scripts/ci-e2e-lib.sh
24+
source "${REPO_ROOT}/scripts/ci-e2e-lib.sh"
25+
26+
# Conf file is parsed to populate variables
27+
export E2E_CONF_FILE="${REPO_ROOT}/test/e2e/config/docker.yaml"
28+
29+
# Prepare kindest/node images for all the required Kubernetes version; this implies
30+
# 1. Kubernetes version labels (e.g. latest) to the corresponding version numbers.
31+
# 2. Pre-pulling the corresponding kindest/node image if available; if not, building the image locally.
32+
# Following variables are currently checked (if defined):
33+
# - KUBERNETES_VERSION
34+
# - KUBERNETES_VERSION_UPGRADE_TO
35+
# - KUBERNETES_VERSION_UPGRADE_FROM
36+
# - KUBERNETES_VERSION_LATEST_CI
37+
# - KUBERNETES_VERSION_MANAGEMENT
38+
39+
k8s::prepareKindestImagesVariables
40+
k8s::prepareKindestImages
41+
42+
# pre-pull all the images that will be used in the e2e, thus making the actual test run
43+
# less sensible to the network speed. This includes:
44+
# - cert-manager images
45+
kind:prepullAdditionalImages

scripts/ci-e2e.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export USE_EXISTING_CLUSTER=false
5454
# - KUBERNETES_VERSION_UPGRADE_TO
5555
# - KUBERNETES_VERSION_UPGRADE_FROM
5656
# - KUBERNETES_VERSION_LATEST_CI
57+
# - KUBERNETES_VERSION_MANAGEMENT
5758
k8s::prepareKindestImagesVariables
5859
k8s::prepareKindestImages
5960

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)