Skip to content

Commit 233533d

Browse files
committed
dev: create a kind cluster for power
Signed-off-by: Paul Bastide <[email protected]>
1 parent 1cda3df commit 233533d

File tree

8 files changed

+40
-109
lines changed

8 files changed

+40
-109
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
bin/*
66
**/power-dra-kubeletplugin*
77

8+
dev-cache/** */
9+
dev-cache/kind
10+
811
!*.go
912
!go.sum
1013
!go.mod

Makefile

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,22 @@ VERSION ?= v0.1.0
1818

1919
GIT_COMMIT ?= $(shell git describe --match="" --dirty --long --always --abbrev=40 2> /dev/null || echo "")
2020

21+
# Kind configuration
22+
KIND_IMAGE?= docker.io/kindest/node:latest
23+
ifeq ((arch),ppc64le)
24+
KIND_IMAGE=quay.io/powercloud/kind-node:v1.33.1
25+
endif
26+
KIND_CLUSTER_NAME:="power-dra-driver-cluster"
27+
KIND_CLUSTER_CONFIG_PATH:="hack/kind-cluster-config.yaml"
28+
KIND_EXPERIMENTAL_PROVIDER:="podman"
29+
2130
########################################################################
2231
# Go Targets
23-
32+
.PHONY: build
2433
build: fmt vet
2534
GOOS=linux GOARCH=$(ARCH) go build -o bin/power-dra-kubeletplugin cmd/power-dra-kubeletplugin/*.go
2635

36+
.PHONY: controller-gen
2737
controller-gen: ## Download controller-gen locally if necessary.
2838
ifeq (, $(shell which controller-gen))
2939
go install sigs.k8s.io/controller-tools/cmd/[email protected]
@@ -32,6 +42,7 @@ else
3242
CONTROLLER_GEN=$(shell which controller-gen)
3343
endif
3444

45+
.PHONY: generate
3546
generate: controller-gen
3647
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
3748

@@ -66,23 +77,39 @@ CLI_VERSION_PACKAGE = $(MODULE)/internal/info
6677
CMDS := $(patsubst ./cmd/%/,%,$(sort $(dir $(wildcard ./cmd/*/))))
6778
CMD_TARGETS := $(patsubst %,cmd-%, $(CMDS))
6879

80+
.PHONY: binaries
6981
binaries: cmds
7082
ifneq ($(PREFIX),)
7183
cmd-%: COMMAND_BUILD_OPTIONS = -o $(PREFIX)/$(*)
7284
endif
85+
86+
.PHONY: cmds
7387
cmds: $(CMD_TARGETS)
7488
$(CMD_TARGETS): cmd-%:
7589
CGO_LDFLAGS_ALLOW='-Wl,--unresolved-symbols=ignore-in-object-files' \
7690
CC=$(CC) CGO_ENABLED=1 GOOS=$(GOOS) GOARCH=$(GOARCH) \
7791
go build -ldflags "-s -w -X $(CLI_VERSION_PACKAGE).gitCommit=$(GIT_COMMIT) -X $(CLI_VERSION_PACKAGE).version=$(VERSION)" $(COMMAND_BUILD_OPTIONS) $(MODULE)/cmd/$(*)
7892

93+
########################################################################
94+
# Testing Targets
95+
96+
.PHONY: dev-install-kind
97+
dev-install-kind:
98+
mkdir -p dev-cache
99+
GOBIN=$(PWD)/dev-cache/ go install sigs.k8s.io/[email protected]
100+
79101
.PHONY: dev-setup
80-
dev-setup:
81-
dev/setup.sh
102+
dev-setup: dev-install-kind
103+
KIND_EXPERIMENTAL_PROVIDER=$(KIND_EXPERIMENTAL_PROVIDER) dev-cache/kind create cluster \
104+
--image $(KIND_IMAGE) \
105+
--name $(KIND_CLUSTER_NAME) \
106+
--config $(KIND_CLUSTER_CONFIG_PATH) \
107+
--wait 5m
82108

83109
.PHONY: dev-clean
84-
dev-clean:
85-
dev/teardown.sh
110+
dev-teardown:
111+
dev-cache/kind delete cluster \
112+
--name $(KIND_CLUSTER_NAME)
86113

87114
########################################################################
88115
# Container Targets

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ You should also be using an OpenShift Container Platform 4.19+.
2121
## Kind cluster
2222

2323
To use the kind cluster in the power arch machine, run the script to create the kind cluster with single worker node.
24+
2425
``` shell
25-
./dev/setup.sh
26+
ARCH=arm64 make dev-setup
2627
```
2728

2829
## Install
@@ -50,7 +51,7 @@ helm uninstall power-dra-driver -n power-dra-driver
5051
To delete the kind cluster created , run the script to delete it.
5152

5253
``` shell
53-
./dev/teardown.sh
54+
ARCH=arm64 make dev-teardown
5455
```
5556

5657
## License

dev-cache/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!/.gitignore

dev/common.sh

Lines changed: 0 additions & 44 deletions
This file was deleted.

dev/setup.sh

Lines changed: 0 additions & 27 deletions
This file was deleted.

dev/teardown.sh

Lines changed: 0 additions & 31 deletions
This file was deleted.

dev/kind-cluster-config.yaml renamed to hack/kind-cluster-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Original Source is from dra-example-driver
12
kind: Cluster
23
apiVersion: kind.x-k8s.io/v1alpha4
34
featureGates:

0 commit comments

Comments
 (0)