Skip to content

Commit

Permalink
adds CRD create test against kind running on the same kube version as…
Browse files Browse the repository at this point in the history
… client-go

Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>
  • Loading branch information
Per Goncalves da Silva committed May 22, 2024
1 parent f5249c3 commit ef27bf0
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 6 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,23 @@ jobs:
run: |
export GOPATH=$(go env GOPATH)
make verify
kind:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Deploy Kind
# 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.)
# The KIND_NODE_VERSION is set by getting the version of the k8s.io/client-go dependency from the go.mod
# and sets major version to "1" and the patch version to "0". For example, a client-go version of v0.28.5
# will map to a KIND_NODE_VERSION of 1.28.0
run: make kind-cluster
- name: Apply CRDs
run: |
set -e
for crd in $(ls crds/*.yaml); do
kubectl create -f $crd
done
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ REPO = github.com/operator-framework/api
BUILD_PATH = $(REPO)/cmd/operator-verify
PKGS = $(shell go list ./... | grep -v /vendor/)

# 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.)
# The KIND_NODE_VERSION is set by getting the version of the k8s.io/client-go dependency from the go.mod
# and sets major version to "1" and the patch version to "0". For example, a client-go version of v0.28.5
# will map to a KIND_NODE_VERSION of 1.28.0
KIND_VERSION := $(shell go list -m k8s.io/client-go | cut -d" " -f2 | sed 's/^v0\.\([[:digit:]]\{1,\}\)\.[[:digit:]]\{1,\}$$/1.\1.0/')

.PHONY: help
help: ## Show this help screen
@echo 'Usage: make <OPTIONS> ... <TARGETS>'
Expand Down Expand Up @@ -113,3 +119,13 @@ $(CONTROLLER_GEN): $(LOCALBIN)
yq: $(YQ) ## Download yq locally if necessary.
$(YQ): $(LOCALBIN)
GOBIN=$(LOCALBIN) go install $(GO_INSTALL_OPTS) github.com/mikefarah/yq/v4@$(YQ_VERSION)

.PHONY: kind
kind: $(KIND) ## Download yq locally if necessary.
$(KIND): $(LOCALBIN)
GOBIN=$(LOCALBIN) go install $(GO_INSTALL_OPTS) sigs.k8s.io/kind@$(KIND_VERSION)

.PHONY: kind-cluster
kind-cluster: kind ## Create a kind cluster
$(KIND) create cluster --name olmv0
$(KIND) export kubeconfig --name olmv0
14 changes: 8 additions & 6 deletions crds/zz_defs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ef27bf0

Please sign in to comment.