Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
.git
.github
.vscode
config/
hack/
docs/
templates/
scripts/
Expand Down
11 changes: 1 addition & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,12 @@ jobs:

- uses: actions/cache@v4
with:
path: hack/tools/bin
path: bin
key: ${{ runner.os }}-tools-bin-${{ matrix.target }}-${{ hashFiles('Makefile') }}
restore-keys: |
${{ runner.os }}-tools-bin-${{ matrix.target }}-
${{ runner.os }}-tools-bin-

- uses: actions/cache@v4
if: ${{ matrix.target == 'test' }}
with:
path: /tmp/kubebuilder-tools-*.tar.gz
key: ${{ runner.os }}-tmp-${{ matrix.target }}-${{ hashFiles('scripts/fetch_ext_bins.sh') }}
restore-keys: |
${{ runner.os }}-tmp-${{ matrix.target }}-
${{ runner.os }}-tmp-

- name: ${{ matrix.target }}
run: make ${{ matrix.target }}

Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,6 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Env
run: |
DOCKER_BUILD_LDFLAGS="$(hack/version.sh)"
echo 'DOCKER_BUILD_LDFLAGS<<EOF' >> $GITHUB_ENV
echo $DOCKER_BUILD_LDFLAGS >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV

- name: Build and push manager image
uses: docker/build-push-action@v6
with:
Expand Down Expand Up @@ -96,7 +89,7 @@ jobs:

- uses: actions/cache@v4
with:
path: hack/tools/bin
path: bin
key: ${{ runner.os }}-tools-bin-release-${{ hashFiles('Makefile') }}
restore-keys: |
${{ runner.os }}-tools-bin-release-
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,3 @@ dist

# development / test / lints
bin/
hack/tools
3 changes: 0 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ linters:
- nakedret
- nestif
- nilerr
- nlreturn
- noctx
- nolintlint
- paralleltest
Expand All @@ -44,15 +43,13 @@ linters:
- rowserrcheck
- sqlclosecheck
- staticcheck
- testpackage
- thelper
- tparallel
- unconvert
- unparam
- wastedassign
- whitespace
- wrapcheck
- wsl_v5
settings:
exhaustive:
default-signifies-exhaustive: true
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ COPY ./ ./
# Build
ARG ARCH
ARG LDFLAGS
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -a -ldflags "${LDFLAGS} -extldflags '-static'" -o manager .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -a -ldflags="${LDFLAGS}" -o manager .

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
Expand Down
65 changes: 15 additions & 50 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ GOPROXY := https://proxy.golang.org
endif
export GOPROXY

# Active module mode, as we use go modules to manage dependencies
export GO111MODULE=on

# Default timeout for starting/stopping the Kubebuilder test control plane
export KUBEBUILDER_CONTROLPLANE_START_TIMEOUT ?=60s
export KUBEBUILDER_CONTROLPLANE_STOP_TIMEOUT ?=60s
Expand All @@ -42,11 +39,7 @@ export DOCKER_CLI_EXPERIMENTAL := enabled
CURL_RETRIES=3

# Directories.
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
TOOLS_DIR := hack/tools
TOOLS_BIN_DIR := $(abspath $(TOOLS_DIR)/bin)
BIN_DIR := $(abspath $(ROOT_DIR)/bin)
GO_INSTALL = ./scripts/go_install.sh
TOOLS_BIN_DIR := $(abspath bin)

# Binaries.
CONTROLLER_GEN := go run sigs.k8s.io/controller-tools/cmd/[email protected]
Expand All @@ -55,28 +48,12 @@ GOLANGCI_LINT_VER := v2.3.0
GOLANGCI_LINT_BIN := golangci-lint
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER)

KUSTOMIZE_VER := v5.7.1
KUSTOMIZE_BIN := kustomize
KUSTOMIZE := $(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)

KUBECTL_VER := v1.33.0
KUBECTL_BIN := kubectl
KUBECTL := $(TOOLS_BIN_DIR)/$(KUBECTL_BIN)-$(KUBECTL_VER)

KIND_VER := v0.29.0
KIND_BIN := kind
KIND := $(TOOLS_BIN_DIR)/$(KIND_BIN)-$(KIND_VER)

toolsBins := $(addprefix ${TOOLS_BIN_DIR}/,$(notdir $(shell awk -F'"' '/^\s*_/ {print $$2}' tools.go | sed 's|/v[[:digit:]]\+||')))

# installs cli tools defined in tools.go
$(toolsBins): go.mod go.sum tools.go
$(toolsBins): CMD=$(shell grep -w '$(@F)' tools.go | awk -F'"' '{print $$2}')
$(toolsBins):
echo "Installing $(CMD)"
GOBIN=$(TOOLS_BIN_DIR) go install $(CMD)
KUSTOMIZE := $(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)-$(KUSTOMIZE_VER)

.PHONY: tools
tools: ${toolsBins} ## Build Go based build tools
tools: $(KUSTOMIZE) $(GOLANGCI_LINT) ## Install build tools

TIMEOUT := $(shell command -v timeout || command -v gtimeout)

Expand Down Expand Up @@ -105,7 +82,7 @@ ifeq ($(SELINUX_ENABLED),1)
endif

# Build time versioning details.
LDFLAGS := $(shell hack/version.sh)
LDFLAGS := "-s -w"

GOLANG_VERSION := 1.24

Expand All @@ -122,7 +99,7 @@ help: ## Display this help

.PHONY: test
test: ## Run tests
source ./scripts/fetch_ext_bins.sh; fetch_tools; setup_envs; go test -v ./... -coverprofile cover.out
go test -v ./... -coverprofile cover.out

## --------------------------------------
## Tooling Binaries
Expand All @@ -142,6 +119,11 @@ $(KIND): ## Build kind
ln -sf "$(KIND)" "$(TOOLS_BIN_DIR)/$(KIND_BIN)"
chmod +x "$(TOOLS_BIN_DIR)/$(KIND_BIN)" "$(KIND)"

$(KUSTOMIZE): ## Install kustomize
mkdir -p $(TOOLS_BIN_DIR)
GOBIN=$(TOOLS_BIN_DIR) go install sigs.k8s.io/kustomize/kustomize/v5@${KUSTOMIZE_VER}
@mv $(TOOLS_BIN_DIR)/kustomize $(KUSTOMIZE)

## --------------------------------------
## Linting
## --------------------------------------
Expand Down Expand Up @@ -192,19 +174,12 @@ modules: ## Runs go mod to ensure proper vendoring.
generate: ## Generate code
$(MAKE) generate-go
$(MAKE) generate-manifests
# $(MAKE) generate-templates

# .PHONY: generate-templates
# generate-templates: tools ## Generate cluster templates
# $(KUSTOMIZE) build templates/no-cloud-provider --load_restrictor none > templates/cluster-template-no-cloud-provider.yaml
# $(KUSTOMIZE) build templates/legacy --load_restrictor none > templates/cluster-template-legacy.yaml
# $(KUSTOMIZE) build templates/crs-cni-cpem --load_restrictor none > templates/cluster-template.yaml

.PHONY: generate-go
generate-go: tools ## Runs Go related generate targets
$(CONTROLLER_GEN) \
paths=./api/... \
object:headerFile=./hack/boilerplate.go.txt
object:headerFile=./config/boilerplate.go.txt
go generate ./...

.PHONY: generate-manifests
Expand All @@ -227,7 +202,7 @@ generate-manifests: tools ## Generate manifests e.g. CRD, RBAC etc.

.PHONY: docker-build
docker-build: ## Build the docker image for controller-manager
docker build --no-cache --pull --build-arg goproxy=$(GOPROXY) --build-arg ARCH=$(ARCH) --build-arg LDFLAGS="$(LDFLAGS)" . -t $(CONTROLLER_IMG)-$(ARCH):$(TAG)
docker build --no-cache --pull --build-arg goproxy=$(GOPROXY) --build-arg ARCH=$(ARCH) --build-arg LDFLAGS=$(LDFLAGS) . -t $(CONTROLLER_IMG)-$(ARCH):$(TAG)
MANIFEST_IMG=$(CONTROLLER_IMG)-$(ARCH) MANIFEST_TAG=$(TAG) $(MAKE) set-manifest-image
$(MAKE) set-manifest-pull-policy

Expand Down Expand Up @@ -309,17 +284,11 @@ release-local: ## Builds the manifests for use in local development
## --------------------------------------

.PHONY: clean
clean: clean-bin clean-temporary clean-release ## Remove all generated files
clean: clean-bin clean-release ## Remove all generated files

.PHONY: clean-bin
clean-bin: ## Remove all generated binaries
rm -rf bin
rm -rf hack/tools/bin

.PHONY: clean-temporary
clean-temporary: ## Remove all temporary files and folders
rm -f minikube.kubeconfig
rm -f kubeconfig

.PHONY: clean-release
clean-release: ## Remove the release folder
Expand All @@ -328,13 +297,9 @@ clean-release: ## Remove the release folder
.PHONY: verify
verify: verify-modules verify-gen

.PHONY: verify-boilerplate
verify-boilerplate:
./hack/verify-boilerplate.sh

.PHONY: verify-modules
verify-modules: modules
@if !(git diff --quiet HEAD -- go.sum go.mod hack/tools/go.mod hack/tools/go.sum); then \
@if !(git diff --quiet HEAD -- go.sum go.mod); then \
echo "go module files are out of date"; exit 1; \
fi

Expand Down
File renamed without changes.
18 changes: 1 addition & 17 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,17 @@ require (
github.com/go-logr/zerologr v1.2.3
github.com/google/go-cmp v0.7.0
github.com/google/uuid v1.6.0
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.38.0
github.com/rs/zerolog v1.34.0
github.com/spf13/pflag v1.0.7
github.com/tinkerbell/tinkerbell/api v0.19.3
k8s.io/api v0.33.3
k8s.io/apimachinery v0.33.3
k8s.io/client-go v0.33.3
k8s.io/component-base v0.33.3
k8s.io/klog/v2 v2.130.1
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397
sigs.k8s.io/cluster-api v1.10.4
sigs.k8s.io/controller-runtime v0.21.0
sigs.k8s.io/kustomize/kustomize/v5 v5.7.1
sigs.k8s.io/yaml v1.6.0
)

Expand All @@ -36,42 +33,33 @@ require (
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-errors/errors v1.5.1 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/swag v0.23.1 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/gobuffalo/flect v1.0.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/btree v1.1.3 // indirect
github.com/google/gnostic-models v0.6.9 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.9.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/nxadm/tail v1.4.11 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.22.0 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.62.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
github.com/spf13/cobra v1.9.1 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xlab/treeprint v1.2.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 // indirect
go.opentelemetry.io/otel v1.36.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.36.0 // indirect
go.opentelemetry.io/otel/sdk v1.36.0 // indirect
go.opentelemetry.io/otel/trace v1.36.0 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect
go.yaml.in/yaml/v3 v3.0.3 // indirect
golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 // indirect
golang.org/x/net v0.41.0 // indirect
golang.org/x/oauth2 v0.29.0 // indirect
Expand All @@ -80,23 +68,19 @@ require (
golang.org/x/term v0.32.0 // indirect
golang.org/x/text v0.26.0 // indirect
golang.org/x/time v0.9.0 // indirect
golang.org/x/tools v0.33.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250519155744-55703ea1f237 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250519155744-55703ea1f237 // indirect
google.golang.org/grpc v1.72.2 // indirect
google.golang.org/protobuf v1.36.6 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.33.0 // indirect
k8s.io/cluster-bootstrap v0.32.3 // indirect
k8s.io/component-base v0.33.3 // indirect
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
sigs.k8s.io/kustomize/api v0.20.1 // indirect
sigs.k8s.io/kustomize/cmd/config v0.20.1 // indirect
sigs.k8s.io/kustomize/kyaml v0.20.1 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect
)
Loading