Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #24 from vshn/arch
Browse files Browse the repository at this point in the history
Improve kind builds for different CPU architectures
  • Loading branch information
ccremer committed Apr 19, 2022
2 parents bf8b56c + c52faf6 commit 3f97a48
Show file tree
Hide file tree
Showing 8 changed files with 642 additions and 556 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,4 @@ generate: ## Generate additional code and artifacts
.PHONY: clean
clean: ## Cleans local build artifacts
rm -rf docs/node_modules $(docs_out_dir) dist .cache
docker rmi $(CONTAINER_IMG) || true
12 changes: 0 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,18 @@ require (
github.com/stretchr/testify v1.7.1
github.com/urfave/cli/v2 v2.4.0
go.uber.org/zap v1.21.0
sigs.k8s.io/kind v0.12.0
)

require (
github.com/BurntSushi/toml v0.4.1 // indirect
github.com/alessio/shellescape v1.4.1 // indirect
github.com/benbjohnson/clock v1.1.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/kr/pretty v0.2.0 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/spf13/cobra v1.2.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
537 changes: 0 additions & 537 deletions go.sum

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions kind/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module kind

go 1.17

require sigs.k8s.io/kind v0.12.0

require (
github.com/BurntSushi/toml v0.4.1 // indirect
github.com/alessio/shellescape v1.4.1 // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/spf13/cobra v1.2.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
591 changes: 591 additions & 0 deletions kind/go.sum

Large diffs are not rendered by default.

22 changes: 17 additions & 5 deletions kind/kind.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
kind_dir ?= .kind
kind_dir ?= $(PWD)/.kind
kind_bin = $(kind_dir)/kind

# Prepare kind binary
# We need to set the Go arch since the binary is meant for the user's OS.
$(kind_bin): export GOOS = $(shell go env GOOS)
$(kind_bin): export GOARCH = $(shell go env GOARCH)
$(kind_bin):
@mkdir -p $(kind_dir)
cd kind && go build -o $@ sigs.k8s.io/kind

.PHONY: kind
kind: export KUBECONFIG = $(KIND_KUBECONFIG)
Expand All @@ -14,18 +23,21 @@ kind-setup-ingress: kind-setup ## Install NGINX as ingress controller onto kind
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml

.PHONY: kind-load-image
# We fix the arch to linux/amd64 since kind runs in amd64 even on Mac/arm.
kind-load-image: export GOOS = linux
kind-load-image: export GOARCH = amd64
kind-load-image: kind-setup build-docker ## Load the container image onto kind cluster
@$(KIND) load docker-image --name $(KIND_CLUSTER) $(CONTAINER_IMG)
@$(kind_bin) load docker-image --name $(KIND_CLUSTER) $(CONTAINER_IMG)

.PHONY: kind-clean
kind-clean: export KUBECONFIG = $(KIND_KUBECONFIG)
kind-clean: ## Removes the kind Cluster
@$(KIND) delete cluster --name $(KIND_CLUSTER) || true
@$(kind_bin) delete cluster --name $(KIND_CLUSTER) || true
@rm -rf $(kind_dir)

$(KIND_KUBECONFIG): export KUBECONFIG = $(KIND_KUBECONFIG)
$(KIND_KUBECONFIG):
$(KIND) create cluster \
$(KIND_KUBECONFIG): $(kind_bin)
$(kind_bin) create cluster \
--name $(KIND_CLUSTER) \
--image $(KIND_IMAGE) \
--config kind/config.yaml
Expand Down
11 changes: 11 additions & 0 deletions kind/tools.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//go:build tools
// +build tools

// Package tools is a place to put any tooling dependencies as imports.
// Go modules will be forced to download and install them.
package tools

import (
// To have kind updated via Renovate.
_ "sigs.k8s.io/kind"
)
3 changes: 1 addition & 2 deletions tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
package tools

import (
// To have kind updated via Renovate.
_ "sigs.k8s.io/kind"
// Add any build-time dependencies here with blank imports like `_ "package"`
)

0 comments on commit 3f97a48

Please sign in to comment.