Skip to content

Commit

Permalink
Merge pull request #4824 from twz123/backport-4823-to-release-1.28
Browse files Browse the repository at this point in the history
[Backport release-1.28] Bump Go to v1.22.5
  • Loading branch information
twz123 authored Aug 5, 2024
2 parents 286952f + 28b3910 commit 36a9a6f
Show file tree
Hide file tree
Showing 12 changed files with 163 additions and 129 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 @@ -79,6 +82,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) \
-- '$(shell cat .k0sbuild.docker-image.k0s)'
Expand Down Expand Up @@ -128,8 +132,7 @@ pkg/apis/autopilot/v1beta2/.controller-gen.stamp: gen_output_dir = autopilot
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 @@ -190,7 +193,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 @@ -215,7 +218,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 @@ -249,7 +252,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 @@ -82,7 +82,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.18
alpine_patch_version = $(alpine_version).4
golang_buildimage=docker.io/library/golang:$(go_version)-alpine$(alpine_version)
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.10.3
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.10.3/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.10.3/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.19.0
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.13.0
controller-gen_version = 0.14.0
go-bindata_version = 3.23.0+incompatible
golangci-lint_version = 1.57.1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.13.0
controller-gen.kubebuilder.io/version: v0.14.0
name: controlnodes.autopilot.k0sproject.io
spec:
group: autopilot.k0sproject.io
Expand All @@ -17,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,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.13.0
controller-gen.kubebuilder.io/version: v0.14.0
name: plans.autopilot.k0sproject.io
spec:
group: autopilot.k0sproject.io
Expand All @@ -24,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 @@ -66,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 @@ -115,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 @@ -151,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 @@ -201,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 @@ -252,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 @@ -288,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 @@ -394,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 36a9a6f

Please sign in to comment.