File tree 2 files changed +38
-0
lines changed
2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 20
20
run : |
21
21
export GOPATH=$(go env GOPATH)
22
22
make verify
23
+
24
+ kind :
25
+ runs-on : ubuntu-latest
26
+ steps :
27
+ - uses : actions/checkout@v3
28
+ - uses : actions/setup-go@v4
29
+ with :
30
+ go-version-file : go.mod
31
+ - name : Deploy Kind
32
+ # Not guaranteed to have patch releases available and node image tags are full versions (i.e v1.28.0 - no v1.28, v1.29, etc.)
33
+ # The KIND_NODE_VERSION is set by getting the version of the k8s.io/client-go dependency from the go.mod
34
+ # and sets major version to "1" and the patch version to "0". For example, a client-go version of v0.28.5
35
+ # will map to a KIND_NODE_VERSION of 1.28.0
36
+ run : make kind-cluster
37
+ - name : Apply CRDs
38
+ run : |
39
+ set -e
40
+ for crd in $(ls crds/*.yaml); do
41
+ kubectl create -f $crd
42
+ done
Original file line number Diff line number Diff line change @@ -101,11 +101,19 @@ $(LOCALBIN):
101
101
# # Tool Binaries
102
102
CONTROLLER_GEN ?= $(LOCALBIN ) /controller-gen
103
103
YQ ?= $(LOCALBIN ) /yq
104
+ KIND ?= $(LOCALBIN ) /kind
104
105
105
106
# # Tool Versions
106
107
CONTROLLER_TOOLS_VERSION ?= v0.15.0
107
108
YQ_VERSION ?= v4.28.1
108
109
110
+ # Not guaranteed to have patch releases available and node image tags are full versions (i.e v1.28.0 - no v1.28, v1.29, etc.)
111
+ # The KIND_NODE_VERSION is set by getting the version of the k8s.io/client-go dependency from the go.mod
112
+ # and sets major version to "1" and the patch version to "0". For example, a client-go version of v0.28.5
113
+ # will map to a KIND_NODE_VERSION of 1.28.0
114
+ KIND_NODE_VERSION := $(shell go list -m k8s.io/client-go | cut -d" " -f2 | sed 's/^v0\.\([[:digit:]]\{1,\}\) \.[[:digit:]]\{1,\}$$/1.\1.0/')
115
+ KIND_CLUSTER_IMAGE := kindest/node:v$(KIND_NODE_VERSION )
116
+
109
117
.PHONY : controller-gen
110
118
controller-gen : $(CONTROLLER_GEN ) # # Download controller-gen locally if necessary.
111
119
$(CONTROLLER_GEN ) : $(LOCALBIN )
@@ -115,3 +123,13 @@ $(CONTROLLER_GEN): $(LOCALBIN)
115
123
yq : $(YQ ) # # Download yq locally if necessary.
116
124
$(YQ ) : $(LOCALBIN )
117
125
GOBIN=$(LOCALBIN ) go install $(GO_INSTALL_OPTS ) github.com/mikefarah/yq/v4@$(YQ_VERSION )
126
+
127
+ .PHONY : kind
128
+ kind : $(KIND ) # # Download yq locally if necessary.
129
+ $(KIND ) : $(LOCALBIN )
130
+ GOBIN=$(LOCALBIN ) go install $(GO_INSTALL_OPTS ) sigs.k8s.io/kind@latest
131
+
132
+ .PHONY : kind-cluster
133
+ kind-cluster : kind # # Create a kind cluster
134
+ $(KIND ) create cluster --name olmv0 --image $(KIND_CLUSTER_IMAGE )
135
+ $(KIND ) export kubeconfig --name olmv0
You can’t perform that action at this time.
0 commit comments