Skip to content

Update to tinkerbell/tinkerbell/api for API definitions; Upgrade controller-runtime, CAPI, Go version, and all direct deps: #468

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
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: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

env:
CGO_ENABLED: 0
GO_VERSION: '1.23'
GO_VERSION: '1.24'
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
GO_VERSION: '1.23'
GO_VERSION: '1.24'

jobs:
manager-image:
Expand Down
217 changes: 92 additions & 125 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,35 @@
# List for enabled linters can be generated for updates using the following command.
# golangci-lint linters | grep -E '^\S+:' | cut -d: -f1 | sort | sed 's/^/ - /g' | grep -v -E "($(grep '^ disable:' -A 100 .golangci.yml | grep -E ' - \S+$' | awk '{print $2}' | tr \\n '|' | sed 's/|$//g'))"
version: "2"
run:
allow-parallel-runners: true
linters:
enable:
- asciicheck
- bodyclose
- copyloopvar
- cyclop
#- depguard
- dogsled
- dupl
- durationcheck
- errcheck
- err113
- errorlint
- exhaustive
# - exhaustivestruct
- copyloopvar
- forbidigo
- forcetypeassert
- funlen
# - gci
- gochecknoglobals
- gochecknoinits
- gocognit
- goconst
- gocritic
- gocyclo
- godot
# - godox
- err113
- gofmt
- gofumpt
- goheader
- goimports
- gomodguard
- goprintffuncname
- gosec
- gosimple
- importas
- ineffassign
# - interfacer
- lll
- makezero
# - maligned
- misspell
- nakedret
- nestif
Expand All @@ -53,124 +42,102 @@ linters:
- predeclared
- revive
- rowserrcheck
# - scopelint
- sqlclosecheck
- staticcheck
- stylecheck
- testpackage
- thelper
- tparallel
- typecheck
- unconvert
- unparam
- unused
- wastedassign
- whitespace
- wrapcheck
- wsl

output:
sort-results: true

- wsl_v5
settings:
exhaustive:
default-signifies-exhaustive: true
gomoddirectives:
replace-allow-list:
- sigs.k8s.io/cluster-api
replace-local: false
exclude-forbidden: false
retract-allow-no-explanation: false
importas:
alias:
- pkg: k8s.io/api/core/v1
alias: corev1
- pkg: k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
alias: apiextensionsv1
- pkg: k8s.io/apimachinery/pkg/apis/meta/v1
alias: metav1
- pkg: k8s.io/apimachinery/pkg/api/errors
alias: apierrors
- pkg: k8s.io/apimachinery/pkg/util/errors
alias: kerrors
- pkg: sigs.k8s.io/controller-runtime
alias: ctrl
no-unaliased: true
nolintlint:
require-explanation: false
require-specific: true
allow-unused: false
staticcheck:
checks:
- all
tagliatelle:
case:
rules:
json: goCamel
unused:
field-writes-are-uses: true
lll:
# Max line length, lines longer will be reported.
# '\t' is counted as 1 character by default, and can be changed with the tab-width option.
# Default: 120.
line-length: 160
exclusions:
generated: lax
rules:
- linters:
- lll
- wsl_v5
source: '^// \+kubebuilder:'
- linters:
- lll
path: controller/*/(.+)_test.go
paths:
- zz_generated.*\.go$
- .*conversion.*\.go$
- third_party$
- builtin$
- examples$
issues:
exclude-use-default: false
max-same-issues: 0
max-issues-per-linter: 0
exclude-rules:
# Ignore long kubebuilder lines as there is no way to break them down.
- linters:
- lll
- wsl
source: "^// \\+kubebuilder:"
- linters:
- lll
path: "controller/*/(.+)_test.go"
exclude-files:
- "zz_generated.*\\.go$"
- ".*conversion.*\\.go$"

linters-settings:
importas:
no-unaliased: true
alias:
# Kubernetes
- pkg: k8s.io/api/core/v1
alias: corev1
- pkg: k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
alias: apiextensionsv1
- pkg: k8s.io/apimachinery/pkg/apis/meta/v1
alias: metav1
- pkg: k8s.io/apimachinery/pkg/api/errors
alias: apierrors
- pkg: k8s.io/apimachinery/pkg/util/errors
alias: kerrors
# Controller Runtime
- pkg: sigs.k8s.io/controller-runtime
alias: ctrl
gosimple:
checks: ["all"]
staticcheck:
checks: ["all"]
stylecheck:
checks: ["all"]
unused:
# Mark all struct fields that have been written to as used.
# Default: true
field-writes-are-uses: true
tagliatelle:
case:
# use-field-name: true
rules:
json: goCamel
gomoddirectives:
# Allow local `replace` directives. Default is false.
replace-local: false
# List of allowed `replace` directives. Default is empty.
replace-allow-list:
- sigs.k8s.io/cluster-api
# Allow to not explain why the version has been retracted in the `retract` directives. Default is false.
retract-allow-no-explanation: false
# Forbid the use of the `exclude` directives. Default is false.
exclude-forbidden: false
gci:
# Section configuration to compare against.
# Section names are case-insensitive and may contain parameters in ().
# The default order of sections is `standard > default > custom > blank > dot > alias > localmodule`,
# If `custom-order` is `true`, it follows the order of `sections` option.
# Default: ["standard", "default"]
sections:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- prefix(github.com/tinkerbell/cluster-api-provider-tinkerbell) # Custom section: groups all imports with the specified Prefix.
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
- alias # Alias section: contains all alias imports. This section is not present unless explicitly enabled.
- localmodule # Local module section: contains all local packages. This section is not present unless explicitly enabled.
# Skip generated files.
# Default: true
skip-generated: false
# Enable custom order of sections.
# If `true`, make the section order the same as the order of `sections`.
# Default: false
custom-order: true
goimports:
# put imports beginning with prefix after 3rd-party packages;
# it's a comma-separated list of prefixes
local-prefixes: github.com/tinkerbell/cluster-api-provider-tinkerbell
nolintlint:
# Enable to ensure that nolint directives are all used. Default is true.
allow-unused: false
# Disable to ensure that nolint directives don't have a leading space. Default is true.
allow-leading-space: true
# Exclude following linters from requiring an explanation. Default is [].
allow-no-explanation: []
# Enable to require an explanation of nonzero length after each nolint directive. Default is false.
require-explanation: false
# Enable to require nolint directives to mention the specific linter being suppressed. Default is false.
require-specific: true
exhaustive:
default-signifies-exhaustive: true

run:
timeout: 10m
allow-parallel-runners: true
max-same-issues: 0
formatters:
enable:
- gofmt
- gofumpt
- goimports
settings:
gci:
sections:
- standard
- default
- prefix(github.com/tinkerbell/cluster-api-provider-tinkerbell)
- blank
- dot
- alias
- localmodule
custom-order: true
goimports:
local-prefixes:
- github.com/tinkerbell/cluster-api-provider-tinkerbell
exclusions:
generated: lax
paths:
- zz_generated.*\.go$
- .*conversion.*\.go$
- third_party$
- builtin$
- examples$
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

# Build the manager binary
ARG GOVER=1.23
ARG GOVER=1.24
FROM golang:${GOVER} AS builder

WORKDIR /workspace
Expand All @@ -35,9 +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} -extldflags '-static'" -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
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,20 @@ BIN_DIR := $(abspath $(ROOT_DIR)/bin)
GO_INSTALL = ./scripts/go_install.sh

# Binaries.
CONTROLLER_GEN := go run sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.2
CONTROLLER_GEN := go run sigs.k8s.io/controller-tools/cmd/controller-gen@v0.18.0

GOLANGCI_LINT_VER := v1.63.4
GOLANGCI_LINT_VER := v2.3.0
GOLANGCI_LINT_BIN := golangci-lint
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER)

KUSTOMIZE_BIN := kustomize
KUSTOMIZE := $(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)

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

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

Expand Down Expand Up @@ -107,7 +107,7 @@ endif
# Build time versioning details.
LDFLAGS := $(shell hack/version.sh)

GOLANG_VERSION := 1.23
GOLANG_VERSION := 1.24

## --------------------------------------
## Help
Expand Down Expand Up @@ -166,7 +166,7 @@ $(GOLANGCI_LINT):

LINTERS += golangci-lint-lint
golangci-lint-lint: $(GOLANGCI_LINT)
find . -name go.mod -execdir "$(GOLANGCI_LINT)" run -c "$(GOLANGCI_LINT_CONFIG)" \;
find . -name go.mod -execdir sh -c '"$(GOLANGCI_LINT)" run -c "$(GOLANGCI_LINT_CONFIG)"' '{}' '+'

FIXERS += golangci-lint-fix
golangci-lint-fix: $(GOLANGCI_LINT)
Expand Down
Loading