Skip to content

Commit

Permalink
Reduce duplication and maintenance effort for kind Cluster specific…
Browse files Browse the repository at this point in the history
…ation and `make` targets (gardener#6976)

* Add Helm chart for kind `Cluster` templating

* Drop duplicate `cluster-*.yaml` in favor or chart `values.yaml`

* `hack` scripts for `kind-{up,down}`

* `hack` script for `gardener-down`
  • Loading branch information
rfranzke authored Nov 14, 2022
1 parent 46d9687 commit c224457
Show file tree
Hide file tree
Showing 34 changed files with 389 additions and 766 deletions.
168 changes: 35 additions & 133 deletions Makefile

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/deployment/content/remote-local-setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ spec:
echo 'source ~/.bashrc' > ~/.bash_profile
cat > ~/.bashrc <<"EOF"
export PATH=$PATH:/usr/local/go/bin
export KUBECONFIG=~/gardener/example/gardener-local/kind/kubeconfig:/tmp/kubeconfig-shoot-local.yaml
export KUBECONFIG=~/gardener/example/gardener-local/kind/local/kubeconfig:/tmp/kubeconfig-shoot-local.yaml
source <(kubectl completion bash)
alias k=kubectl
complete -o default -F __start_kubectl k
Expand Down
10 changes: 5 additions & 5 deletions docs/deployment/getting_started_locally.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ Based on [Skaffold](https://skaffold.dev/), the container images for all require
make kind-up
```

This command sets up a new KinD cluster named `gardener-local` and stores the kubeconfig in the `./example/gardener-local/kind/kubeconfig` file.
This command sets up a new KinD cluster named `gardener-local` and stores the kubeconfig in the `./example/gardener-local/kind/local/kubeconfig` file.

> It might be helpful to copy this file to `$HOME/.kube/config` since you will need to target this KinD cluster multiple times.
Alternatively, make sure to set your `KUBECONFIG` environment variable to `./example/gardener-local/kind/kubeconfig` for all future steps via `export KUBECONFIG=example/gardener-local/kind/kubeconfig`.
Alternatively, make sure to set your `KUBECONFIG` environment variable to `./example/gardener-local/kind/local/kubeconfig` for all future steps via `export KUBECONFIG=example/gardener-local/kind/local/kubeconfig`.

All following steps assume that you are using this kubeconfig.

Expand Down Expand Up @@ -90,7 +90,7 @@ local local local local 1.21.0 Awake Create Pr
(Optional): You could also execute a simple e2e test (creating and deleting a shoot) by running

```shell
make test-e2e-local-simple KUBECONFIG="$PWD/example/gardener-local/kind/kubeconfig"
make test-e2e-local-simple KUBECONFIG="$PWD/example/gardener-local/kind/local/kubeconfig"
```

### Accessing the `Shoot` cluster
Expand Down Expand Up @@ -140,15 +140,15 @@ There are cases where you would want to create a second cluster seed in your loc
make kind2-up
```

This command sets up a new KinD cluster named `gardener-local2` and stores its kubeconfig in the `./example/gardener-local/kind2/kubeconfig` file.
This command sets up a new KinD cluster named `gardener-local2` and stores its kubeconfig in the `./example/gardener-local/kind/local2/kubeconfig` file.

In order to deploy required resources in the KinD cluster that you just created, run:

```bash
make gardenlet-kind2-up
```

The following steps assume that you are using the kubeconfig that points to the `gardener-local` cluster (first KinD cluster): `export KUBECONFIG=example/gardener-local/kind/kubeconfig`.
The following steps assume that you are using the kubeconfig that points to the `gardener-local` cluster (first KinD cluster): `export KUBECONFIG=example/gardener-local/kind/local/kubeconfig`.

You can wait for the `local2` `Seed` to be ready by running:

Expand Down
2 changes: 1 addition & 1 deletion docs/development/content/remote-local-setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
cat > ~/.bashrc <<"EOF"
export GOPATH=~/go
export PATH=$PATH:/usr/local/go/bin
export KUBECONFIG=~/gardener/example/gardener-local/kind/kubeconfig:/tmp/kubeconfig-shoot-local.yaml
export KUBECONFIG=~/gardener/example/gardener-local/kind/local/kubeconfig:/tmp/kubeconfig-shoot-local.yaml
source <(kubectl completion bash)
alias k=kubectl
complete -o default -F __start_kubectl k
Expand Down
10 changes: 5 additions & 5 deletions docs/development/getting_started_locally.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ The Gardener components, however, will be run as regular processes on your machi
make kind-up KIND_ENV=local
```

This command sets up a new KinD cluster named `gardener-local` and stores the kubeconfig in the `./example/gardener-local/kind/kubeconfig` file.
This command sets up a new KinD cluster named `gardener-local` and stores the kubeconfig in the `./example/gardener-local/kind/local/kubeconfig` file.

> It might be helpful to copy this file to `$HOME/.kube/config` since you will need to target this KinD cluster multiple times.
Alternatively, make sure to set your `KUBECONFIG` environment variable to `./example/gardener-local/kind/kubeconfig` for all future steps via `export KUBECONFIG=example/gardener-local/kind/kubeconfig`.
Alternatively, make sure to set your `KUBECONFIG` environment variable to `./example/gardener-local/kind/local/kubeconfig` for all future steps via `export KUBECONFIG=example/gardener-local/kind/local/kubeconfig`.

All following steps assume that you are using this kubeconfig.

Expand Down Expand Up @@ -135,7 +135,7 @@ local local local local 1.21.0 Awake Create Pr
(Optional): You could also execute a simple e2e test (creating and deleting a shoot) by running

```shell
make test-e2e-local-simple KUBECONFIG="$PWD/example/gardener-local/kind/kubeconfig"
make test-e2e-local-simple KUBECONFIG="$PWD/example/gardener-local/kind/local/kubeconfig"
```

When the shoot got successfully created you can access it as follows:
Expand All @@ -161,7 +161,7 @@ Next, setup the second KinD cluster:
make kind2-up KIND_ENV=local
```

This command sets up a new KinD cluster named `gardener-local2` and stores its kubeconfig in the `./example/gardener-local/kind2/kubeconfig` file. You will need this file when starting the `provider-local` extension controller for the second seed cluster.
This command sets up a new KinD cluster named `gardener-local2` and stores its kubeconfig in the `./example/gardener-local/kind/local2/kubeconfig` file. You will need this file when starting the `provider-local` extension controller for the second seed cluster.

```bash
make register-kind2-env # registering the local2 seed
Expand All @@ -171,7 +171,7 @@ make start-gardenlet SEED_NAME=local2 # starting gar
In a new terminal pane, run

```bash
export KUBECONFIG=./example/gardener-local/kind2/kubeconfig # setting KUBECONFIG to point to second kind cluster
export KUBECONFIG=./example/gardener-local/kind/local2/kubeconfig # setting KUBECONFIG to point to second kind cluster
make start-extension-provider-local \
WEBHOOK_SERVER_PORT=9444 \
WEBHOOK_CERT_DIR=/tmp/gardener-extension-provider-local2 \
Expand Down
10 changes: 5 additions & 5 deletions docs/development/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ Run an `envtest` suite (not using `gardener-apiserver`) against an existing clus

```bash
make kind-up
export KUBECONFIG=$PWD/example/gardener-local/kind/kubeconfig
export KUBECONFIG=$PWD/example/gardener-local/kind/local/kubeconfig
export USE_EXISTING_CLUSTER=true
# run test with verbose output
Expand All @@ -242,7 +242,7 @@ Run a `gardenerenvtest` suite (using `gardener-apiserver`) against an existing g

```bash
make kind-up
export KUBECONFIG=$PWD/example/gardener-local/kind/kubeconfig
export KUBECONFIG=$PWD/example/gardener-local/kind/local/kubeconfig
make dev-setup
# you might need to disable some admission plugins in hack/local-development/start-apiserver
# via --disable-admission-plugins depending on the test suite
Expand All @@ -268,7 +268,7 @@ ginkgo build ./test/integration/resourcemanager/health
# prepare a cluster to run the test against
make kind-up
export KUBECONFIG=$PWD/example/gardener-local/kind/kubeconfig
export KUBECONFIG=$PWD/example/gardener-local/kind/local/kubeconfig
export USE_EXISTING_CLUSTER=true
# use same timeout settings like in CI
Expand All @@ -287,7 +287,7 @@ ginkgo build ./test/integration/controllermanager/bastion
# prepare a cluster including gardener-apiserver to run the test against
make kind-up
export KUBECONFIG=$PWD/example/gardener-local/kind/kubeconfig
export KUBECONFIG=$PWD/example/gardener-local/kind/local/kubeconfig
make dev-setup
# you might need to disable some admission plugins in hack/local-development/start-apiserver
# via --disable-admission-plugins depending on the test suite
Expand Down Expand Up @@ -374,7 +374,7 @@ You can also run these tests on your development machine, using the following co

```bash
make kind-up
export KUBECONFIG=$PWD/example/gardener-local/kind/kubeconfig
export KUBECONFIG=$PWD/example/gardener-local/kind/local/kubeconfig
make gardener-up
make test-e2e-local # alternatively: make test-e2e-local-simple
```
Expand Down
94 changes: 0 additions & 94 deletions example/gardener-local/kind-ha-multi-zone/cluster-local.yaml

This file was deleted.

95 changes: 0 additions & 95 deletions example/gardener-local/kind-ha-multi-zone/cluster-skaffold.yaml

This file was deleted.

Loading

0 comments on commit c224457

Please sign in to comment.