Skip to content

Commit 178e4ba

Browse files
authored
Merge pull request #358 from nader-ziada/kind06
Change kind min version to 0.6.1
2 parents 90e00da + a77f0ab commit 178e4ba

File tree

5 files changed

+11
-19
lines changed

5 files changed

+11
-19
lines changed

Makefile

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -297,22 +297,18 @@ create-cluster: ## Create a development Kubernetes cluster on Azure in a KIND ma
297297
kind create cluster --name=clusterapi
298298
# Apply provider-components.
299299
kubectl \
300-
--kubeconfig=$$(kind get kubeconfig-path --name="clusterapi") \
301300
create -f examples/_out/provider-components.yaml
302301
# Create Cluster.
303302
kubectl \
304-
--kubeconfig=$$(kind get kubeconfig-path --name="clusterapi") \
305303
create -f examples/_out/cluster.yaml
306304
# Create control plane machines.
307305
kubectl \
308-
--kubeconfig=$$(kind get kubeconfig-path --name="clusterapi") \
309306
create -f examples/_out/controlplane.yaml
310307
# wait for the first control plane machine to be ready
311308
./examples/wait-for-ready.sh
312309
# Fetch the Kubeconfig for the target cluster
313310
source ./examples/_out/.env; \
314311
kubectl \
315-
--kubeconfig=$$(kind get kubeconfig-path --name="clusterapi") \
316312
--namespace=default get secret/$$CLUSTER_NAME-kubeconfig -o json \
317313
| jq -r .data.value \
318314
| base64 --decode > ./examples/_out/clusterapi.kubeconfig
@@ -322,18 +318,16 @@ create-cluster: ## Create a development Kubernetes cluster on Azure in a KIND ma
322318
apply -f https://docs.projectcalico.org/v3.8/manifests/calico.yaml
323319
# Create 2 worker nodes with MachineDeployment.
324320
kubectl \
325-
--kubeconfig=$$(kind get kubeconfig-path --name="clusterapi") \
326321
create -f examples/_out/machinedeployment.yaml
327322

328-
@echo 'run "kubectl --kubeconfig=$$(kind get kubeconfig-path --name="clusterapi") ..." to work with the kind cluster'
323+
@echo 'Set kubectl context to the kind management cluster by running "kubectl config set-context kind-clusterapi"'
329324
@echo 'run "kubectl --kubeconfig=./examples/_out/clusterapi.kubeconfig ..." to work with the new target cluster'
330325

331326
.PHONY: delete-cluster
332327
delete-cluster: $(CLUSTERCTL) ## Deletes the example Kubernetes Cluster "clusterapi"
333328
# Fetch the Kubeconfig for the target cluster
334329
source ./examples/_out/.env; \
335330
kubectl \
336-
--kubeconfig=$$(kind get kubeconfig-path --name="clusterapi") \
337331
delete cluster $$CLUSTER_NAME
338332

339333
kind delete cluster --name=clusterapi

docs/development.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,6 @@ Launch a bootstrap cluster and then run the generated manifests creating a targe
177177
While cluster build out is running, you can optionally follow the controller logs in a separate window as follows:
178178

179179
```bash
180-
export KUBECONFIG="$(kind get kubeconfig-path --name="clusterapi")" # Export the kind kubeconfig
181-
182180
time kubectl get po -o wide --all-namespaces -w # Watch pod creation until azure-provider-controller-manager-0 is available
183181

184182
kubectl logs azure-provider-controller-manager-0 -n azure-provider-system -f # Follow the controller logs

docs/getting-started.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@
4343
- [Go]
4444

4545
[brew]: https://brew.sh/
46-
[Go]: https://golang.org/dl/
46+
[go]: https://golang.org/dl/
4747
[jq]: https://stedolan.github.io/jq/download/
48-
[KIND]: https://sigs.k8s.io/kind
48+
[kind]: https://sigs.k8s.io/kind
4949
[kubectl]: https://kubernetes.io/docs/tasks/tools/install-kubectl/
5050
[kustomize]: https://github.com/kubernetes-sigs/kustomize
5151

@@ -66,6 +66,7 @@ If you're interested in developing cluster-api-provider-azure and getting the la
6666
An Azure Service Principal is needed for usage by the `clusterctl` tool and for populating the controller manifests. This utilizes [environment-based authentication](https://docs.microsoft.com/en-us/go/azure/azure-sdk-go-authorization#use-environment-based-authentication).
6767

6868
The following environment variables should be set:
69+
6970
- `AZURE_SUBSCRIPTION_ID`
7071
- `AZURE_TENANT_ID`
7172
- `AZURE_CLIENT_ID`
@@ -86,6 +87,7 @@ tar -xvf cluster-api-provider-azure-examples.tar
8687
A set of sane defaults are utilized when generating manifests via `./azure/generate-yaml.sh`, but these can be overridden by exporting environment variables.
8788

8889
Here is a list of commonly overriden configuration parameters (the full list is available in `./azure/generate-yaml.sh`):
90+
8991
```bash
9092
# Azure settings.
9193
export AZURE_LOCATION="eastus"
@@ -162,7 +164,6 @@ I0324 23:23:58.081879 27739 kind.go:72] Ran: kind [create cluster --name=clust
162164
✓ [control-plane] Starting Kubernetes (this may take a minute) ☸
163165
Cluster creation complete. You can now use the cluster with:
164166
165-
export KUBECONFIG="$(kind get kubeconfig-path --name="clusterapi")"
166167
kubectl cluster-info
167168
I0324 23:23:58.081925 27739 kind.go:69] Running: kind [get kubeconfig-path --name=clusterapi]
168169
I0324 23:23:58.149609 27739 kind.go:72] Ran: kind [get kubeconfig-path --name=clusterapi] Output: /home/fakeuser/.kube/kind-config-clusterapi
@@ -234,9 +235,10 @@ I0324 23:53:58.997892 27739 createbootstrapcluster.go:36] Cleaning up bootstra
234235
I0324 23:53:58.997937 27739 kind.go:69] Running: kind [delete cluster --name=clusterapi]
235236
I0324 23:54:00.260254 27739 kind.go:72] Ran: kind [delete cluster --name=clusterapi] Output: Deleting cluster "clusterapi" ...
236237
```
238+
237239
</details>
238240

239-
The created KIND cluster is ephemeral and is cleaned up automatically when done. During the cluster creation, the KIND configuration is written to a local directory and can be retrieved using `kind get kubeconfig-path --name="clusterapi"`.
241+
The created KIND cluster is ephemeral and is cleaned up automatically when done. During the cluster creation, the kubectl context is set to "kind-clusterapi" and can be retrieved using `kubectl cluster-info --context kind-clusterapi`.
240242

241243
For a more in-depth look into what `clusterctl` is doing during this create step, please see the [clusterctl document](/docs/clusterctl.md).
242244

@@ -245,21 +247,20 @@ For a more in-depth look into what `clusterctl` is doing during this create step
245247
The kubeconfig for the new cluster is created in the directory from where the above `clusterctl create` was run.
246248

247249
Run the following command to point `kubectl` to the kubeconfig of the new cluster:
250+
248251
```bash
249252
export KUBECONFIG=$(pwd)/kubeconfig
250253
```
251254

252255
Alternatively, move the kubeconfig file to a desired location and set the `KUBECONFIG` environment variable accordingly.
253256

254-
255257
## Troubleshooting
256258

257259
### Bootstrap running, but resources aren't being created
258260

259261
Logs can be tailed using [`kubectl`][kubectl]:
260262

261263
```bash
262-
export KUBECONFIG=$(kind get kubeconfig-path --name="clusterapi")
263264
kubectl logs azure-provider-controller-manager-0 -n azure-provider-system -f
264265
```
265266

examples/wait-for-ready.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ ENV_GENERATED_FILE=${OUTPUT_DIR}/.env
2323
source "${ENV_GENERATED_FILE}"
2424

2525
ready="false"
26-
kubeconfigPath=$(kind get kubeconfig-path --name="clusterapi")
2726
echo "Waiting for any machine in cluster ${CLUSTER_NAME} to be in running state..."
2827
while [ $ready == "false" ]; do
29-
output=$(kubectl --kubeconfig="$kubeconfigPath" get machines -o json)
28+
output=$(kubectl get machines -o json)
3029
ready=$(echo "$output" | jq -r 'any(.items[]; .status.phase=="running")')
3130
[ "$ready" == "false" ] && echo "Waiting..." && sleep 30
3231
done

hack/ensure-kind.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ set -o nounset
1919
set -o pipefail
2020

2121
GOPATH_BIN="$(go env GOPATH)/bin/"
22-
MINIMUM_KIND_VERSION=v0.5.1
22+
MINIMUM_KIND_VERSION=v0.6.1
2323

2424
# Ensure the kind tool exists and is a viable version, or installs it
2525
verify_kind_version() {
@@ -41,7 +41,7 @@ verify_kind_version() {
4141

4242
local kind_version
4343
kind_version=$(kind version)
44-
if [[ "${MINIMUM_KIND_VERSION}" != $(echo -e "${MINIMUM_KIND_VERSION}\n${kind_version}" | sort -s -t. -k 1,1 -k 2,2n -k 3,3n | head -n1) ]]; then
44+
if ! [[ "${kind_version}" =~ ${MINIMUM_KIND_VERSION} ]]; then
4545
cat <<EOF
4646
Detected kind version: ${kind_version}.
4747
Requires ${MINIMUM_KIND_VERSION} or greater.

0 commit comments

Comments
 (0)