Skip to content

Commit

Permalink
Merge pull request #4825 from twz123/backport-4824-to-release-1.27
Browse files Browse the repository at this point in the history
[Backport release-1.27] Bump Go to v1.22.5
  • Loading branch information
jnummelin authored Aug 14, 2024
2 parents 0d8c1e2 + 939a5d7 commit 17f34dc
Show file tree
Hide file tree
Showing 15 changed files with 163 additions and 137 deletions.
13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ TARGET_OS ?= linux
BUILD_UID ?= $(shell id -u)
BUILD_GID ?= $(shell id -g)
BUILD_GO_FLAGS := -tags osusergo
# See https://github.com/mattn/go-sqlite3/issues/1164#issuecomment-1635253695
# Remove when https://github.com/mattn/go-sqlite3/issues/1164 is released
BUILD_CGO_CFLAGS := -D_LARGEFILE64_SOURCE
BUILD_GO_LDFLAGS_EXTRA :=
DEBUG ?= false

Expand Down Expand Up @@ -77,6 +80,7 @@ GO_ENV ?= docker run --rm \
-w /go/src/github.com/k0sproject/k0s \
-e GOOS \
-e CGO_ENABLED \
-e CGO_CFLAGS \
-e GOARCH \
--user $(BUILD_UID):$(BUILD_GID) \
k0sbuild.docker-image.k0s
Expand Down Expand Up @@ -121,8 +125,7 @@ pkg/apis/autopilot.k0sproject.io/v1beta2/.controller-gen.stamp: gen_output_dir =
pkg/apis/%/.controller-gen.stamp: .k0sbuild.docker-image.k0s hack/tools/boilerplate.go.txt hack/tools/Makefile.variables
rm -rf 'static/manifests/$(gen_output_dir)/CustomResourceDefinition'
rm -f -- '$(dir $@)'zz_*.go
CGO_ENABLED=0 $(GO) install sigs.k8s.io/controller-tools/cmd/controller-gen@v$(controller-gen_version)
$(GO_ENV) controller-gen \
CGO_ENABLED=0 $(GO) run sigs.k8s.io/controller-tools/cmd/controller-gen@v$(controller-gen_version) \
crd \
paths="./$(dir $@)..." \
output:crd:artifacts:config=./static/manifests/$(gen_output_dir)/CustomResourceDefinition \
Expand Down Expand Up @@ -198,7 +201,7 @@ k0s.exe: TARGET_OS = windows
k0s.exe: BUILD_GO_CGO_ENABLED = 0

k0s.exe k0s: $(GO_SRCS) $(codegen_targets) go.sum
CGO_ENABLED=$(BUILD_GO_CGO_ENABLED) GOOS=$(TARGET_OS) $(GO) build $(BUILD_GO_FLAGS) -ldflags='$(LD_FLAGS)' -o $@.code main.go
CGO_ENABLED=$(BUILD_GO_CGO_ENABLED) CGO_CFLAGS='$(BUILD_CGO_CFLAGS)' GOOS=$(TARGET_OS) $(GO) build $(BUILD_GO_FLAGS) -ldflags='$(LD_FLAGS)' -o $@.code main.go
cat $@.code bindata_$(TARGET_OS) > $@.tmp \
&& rm -f $@.code \
&& chmod +x $@.tmp \
Expand All @@ -223,7 +226,7 @@ lint-copyright:
lint-go: GOLANGCI_LINT_FLAGS ?=
lint-go: .k0sbuild.docker-image.k0s go.sum codegen
CGO_ENABLED=0 $(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v$(golangci-lint_version)
$(GO_ENV) golangci-lint run --verbose $(GOLANGCI_LINT_FLAGS) $(GO_LINT_DIRS)
CGO_CFLAGS='$(BUILD_CGO_CFLAGS)' $(GO_ENV) golangci-lint run --verbose $(GOLANGCI_LINT_FLAGS) $(GO_LINT_DIRS)

.PHONY: lint
lint: lint-copyright lint-go
Expand Down Expand Up @@ -265,7 +268,7 @@ smoketests: $(smoketests)
.PHONY: check-unit
check-unit: GO_TEST_RACE ?= -race
check-unit: go.sum codegen
$(GO) test -tags=hack $(GO_TEST_RACE) -ldflags='$(LD_FLAGS)' `$(GO) list -tags=hack $(GO_CHECK_UNIT_DIRS)`
CGO_CFLAGS='$(BUILD_CGO_CFLAGS)' $(GO) test -tags=hack $(GO_TEST_RACE) -ldflags='$(LD_FLAGS)' `$(GO) list -tags=hack $(GO_CHECK_UNIT_DIRS)`

.PHONY: check-image-validity
check-image-validity: go.sum
Expand Down
2 changes: 1 addition & 1 deletion embedded-bins/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ build_docker_image = \
--build-arg BUILDIMAGE=$($(patsubst %/Dockerfile,%,$<)_buildimage) \
--build-arg BUILD_GO_TAGS=$($(patsubst %/Dockerfile,%,$<)_build_go_tags) \
--build-arg BUILD_GO_CGO_ENABLED=$($(patsubst %/Dockerfile,%,$<)_build_go_cgo_enabled) \
--build-arg BUILD_GO_CGO_CFLAGS=$($(patsubst %/Dockerfile,%,$<)_build_go_cgo_cflags) \
--build-arg BUILD_GO_CGO_CFLAGS='$($(patsubst %/Dockerfile,%,$<)_build_go_cgo_cflags)' \
--build-arg BUILD_SHIM_GO_CGO_ENABLED=$($(patsubst %/Dockerfile,%,$<)_build_shim_go_cgo_enabled) \
--build-arg BUILD_GO_FLAGS=$($(patsubst %/Dockerfile,%,$<)_build_go_flags) \
--build-arg BUILD_GO_LDFLAGS=$($(patsubst %/Dockerfile,%,$<)_build_go_ldflags) \
Expand Down
10 changes: 7 additions & 3 deletions embedded-bins/Makefile.variables
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
alpine_version = 3.17
alpine_patch_version = $(alpine_version).4
golang_buildimage=docker.io/library/golang:$(go_version)-alpine3.18
go_version = 1.21.10
golang_buildimage=docker.io/library/golang:$(go_version)-alpine3.19
go_version = 1.22.5

runc_version = 1.1.13
runc_buildimage = $(golang_buildimage)
Expand Down Expand Up @@ -36,7 +36,11 @@ kine_version = 0.9.9
kine_buildimage = $(golang_buildimage)
#kine_build_go_tags =
#kine_build_go_cgo_enabled =
kine_build_go_cgo_cflags = "-DSQLITE_ENABLE_DBSTAT_VTAB=1 -DSQLITE_USE_ALLOCA=1" # Flags taken from https://github.com/k3s-io/kine/blob/v0.9.9/scripts/build#L22
kine_build_go_cgo_cflags = -DSQLITE_ENABLE_DBSTAT_VTAB=1 -DSQLITE_USE_ALLOCA=1 # Flags taken from https://github.com/k3s-io/kine/blob/v0.9.9/scripts/build#L22
# See https://github.com/mattn/go-sqlite3/issues/1164#issuecomment-1635253695
# Remove when https://github.com/mattn/go-sqlite3/issues/1164 is released
kine_build_go_cgo_cflags += -D_LARGEFILE64_SOURCE

#kine_build_go_flags =
kine_build_go_ldflags = "-w -s"
kine_build_go_ldflags_extra = "-extldflags=-static"
Expand Down
2 changes: 1 addition & 1 deletion embedded-bins/kine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ARG TARGET_OS \
BUILD_GO_LDFLAGS_EXTRA

RUN CGO_ENABLED=${BUILD_GO_CGO_ENABLED} \
CGO_CFLAGS=${BUILD_GO_CGO_CFLAGS} go build \
CGO_CFLAGS="${BUILD_GO_CGO_CFLAGS}" go build \
${BUILD_GO_FLAGS} \
-tags="${BUILD_GO_TAGS}" \
-ldflags="${BUILD_GO_LDFLAGS} ${BUILD_GO_LDFLAGS_EXTRA} -X github.com/k3s-io/kine/pkg/version.Version=v$VERSION -X github.com/k3s-io/kine/pkg/version.GitCommit=$(git rev-parse --short HEAD)" \
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/k0sproject/k0s

go 1.21.0
go 1.22

// k0s
require (
Expand Down
2 changes: 1 addition & 1 deletion hack/tool/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module tool

go 1.21.0
go 1.22

require (
github.com/hashicorp/terraform-exec v0.18.1
Expand Down
2 changes: 1 addition & 1 deletion hack/tools/Makefile.variables
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
controller-gen_version = 0.11.3
controller-gen_version = 0.14.0
go-bindata_version = 3.23.0+incompatible
golangci-lint_version = 1.57.1

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

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.14.0
name: controlnodes.autopilot.k0sproject.io
spec:
group: autopilot.k0sproject.io
Expand All @@ -18,18 +17,24 @@ spec:
- name: v1beta2
schema:
openAPIV3Schema:
description: ControlNode is a node which behaves as a controller, able to
receive autopilot signaling updates.
description: |-
ControlNode is a node which behaves as a controller, able to receive autopilot
signaling updates.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.14.0
name: plans.autopilot.k0sproject.io
spec:
group: autopilot.k0sproject.io
Expand All @@ -25,27 +24,34 @@ spec:
name: v1beta2
schema:
openAPIV3Schema:
description: Plan provides all details of what to execute as a part of the
plan, and the current status of its execution.
description: |-
Plan provides all details of what to execute as a part of the plan, and
the current status of its execution.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: Spec defines how the plan behaves.
properties:
commands:
description: Commands are a collection of all of the commands that
need to be executed in order for this plan to transition to Completed.
description: |-
Commands are a collection of all of the commands that need to be executed
in order for this plan to transition to Completed.
items:
description: PlanCommand is a command that can be run within a `Plan`
properties:
Expand All @@ -67,9 +73,9 @@ spec:
required:
- url
type: object
description: Platforms is a map of PlanResourceUrls to platform
identifiers, allowing a single k0s airgap version to have
multiple Url resources based on platform.
description: |-
Platforms is a map of PlanResourceUrls to platform identifiers, allowing a single k0s airgap
version to have multiple Url resources based on platform.
type: object
version:
description: Version is the version that `AirgapUpdate`
Expand Down Expand Up @@ -116,10 +122,9 @@ spec:
properties:
concurrent:
default: 1
description: Concurrent specifies the number of
concurrent target executions that can be performed
within this target. (ie. '2' == at most have 2
execute at the same time)
description: |-
Concurrent specifies the number of concurrent target executions that can be performed
within this target. (ie. '2' == at most have 2 execute at the same time)
type: integer
type: object
required:
Expand Down Expand Up @@ -152,9 +157,9 @@ spec:
required:
- url
type: object
description: Platforms is a map of PlanResourceUrls to platform
identifiers, allowing a single k0s version to have multiple
URL resources based on platform.
description: |-
Platforms is a map of PlanResourceUrls to platform identifiers, allowing a single k0s version
to have multiple URL resources based on platform.
type: object
targets:
description: Targets defines how the controllers/workers
Expand Down Expand Up @@ -202,10 +207,9 @@ spec:
properties:
concurrent:
default: 1
description: Concurrent specifies the number
of concurrent target executions that can be
performed within this target. (ie. '2' ==
at most have 2 execute at the same time)
description: |-
Concurrent specifies the number of concurrent target executions that can be performed
within this target. (ie. '2' == at most have 2 execute at the same time)
type: integer
type: object
required:
Expand Down Expand Up @@ -253,10 +257,9 @@ spec:
properties:
concurrent:
default: 1
description: Concurrent specifies the number
of concurrent target executions that can be
performed within this target. (ie. '2' ==
at most have 2 execute at the same time)
description: |-
Concurrent specifies the number of concurrent target executions that can be performed
within this target. (ie. '2' == at most have 2 execute at the same time)
type: integer
type: object
required:
Expand Down Expand Up @@ -289,8 +292,9 @@ spec:
description: Status is the most recently observed status of the plan.
properties:
commands:
description: Commands are a collection of status's for each of the
commands defined in the plan, maintained in their index order.
description: |-
Commands are a collection of status's for each of the commands defined in the plan,
maintained in their index order.
items:
description: PlanCommandStatus is the status of a known command.
properties:
Expand Down Expand Up @@ -395,9 +399,10 @@ spec:
type: object
type: array
state:
description: State is the current state of the plan. This value typically
mirrors the status of the current command execution to allow for
querying a single field to determine the plan status.
description: |-
State is the current state of the plan. This value typically mirrors the status
of the current command execution to allow for querying a single field to determine
the plan status.
type: string
required:
- commands
Expand Down
Loading

0 comments on commit 17f34dc

Please sign in to comment.