diff --git a/.ci/pipeline_definitions b/.ci/pipeline_definitions index c10e2c0b9..340d15de1 100644 --- a/.ci/pipeline_definitions +++ b/.ci/pipeline_definitions @@ -31,11 +31,11 @@ machine-controller-manager: availability_requirement: 'low' steps: check: - image: 'golang:1.22.5' + image: 'golang:1.23.3' test: image: europe-docker.pkg.dev/gardener-project/releases/testmachinery/base-step:stable build: - image: 'golang:1.22.5' + image: 'golang:1.23.3' output_dir: 'binary' jobs: head-update: diff --git a/Dockerfile b/Dockerfile index d8794e81b..a53c79611 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ ############# builder ############# -FROM golang:1.22.5 AS builder +FROM golang:1.23.3 AS builder WORKDIR /go/src/github.com/gardener/machine-controller-manager COPY . . diff --git a/Makefile b/Makefile index b730e015c..174364d72 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 -include .env +TOOLS_DIR := hack/tools include hack/tools.mk IMAGE_REPOSITORY := europe-docker.pkg.dev/gardener-project/public/gardener/machine-controller-manager diff --git a/docs/documents/apis.md b/docs/documents/apis.md index 987a1e3bc..1fd451e11 100644 --- a/docs/documents/apis.md +++ b/docs/documents/apis.md @@ -2607,10 +2607,9 @@ k8s.io/apimachinery/pkg/util/intstr.IntOrString Value can be an absolute number (ex: 5) or a percentage of desired machines (ex: 10%). Absolute number is calculated from percentage by rounding down. This can not be 0 if MaxSurge is 0. -By default, a fixed value of 1 is used. -Example: when this is set to 30%, the old MC can be scaled down to 70% of desired machines -immediately when the rolling update starts. Once new machines are ready, old MC -can be scaled down further, followed by scaling up the new MC, ensuring +Example: when this is set to 30%, the old machine set can be scaled down to 70% of desired machines +immediately when the rolling update starts. Once new machines are ready, old machine set +can be scaled down further, followed by scaling up the new machine set, ensuring that the total number of machines available at all times during the update is at least 70% of desired machines.

@@ -2633,12 +2632,11 @@ machines. Value can be an absolute number (ex: 5) or a percentage of desired machines (ex: 10%). This can not be 0 if MaxUnavailable is 0. Absolute number is calculated from percentage by rounding up. -By default, a value of 1 is used. -Example: when this is set to 30%, the new MC can be scaled up immediately when -the rolling update starts, such that the total number of old and new machines do not exceed +Example: when this is set to 30%, the new machine set can be scaled up immediately when +the rolling update starts, such that the total number of old and new machines does not exceed 130% of desired machines. Once old machines have been killed, -new MC can be scaled up further, ensuring that total number of machines running -at any time during the update is atmost 130% of desired machines.

+new machine set can be scaled up further, ensuring that total number of machines running +at any time during the update is utmost 130% of desired machines.

diff --git a/go.mod b/go.mod index b29fbda41..a6969079b 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,6 @@ module github.com/gardener/machine-controller-manager -go 1.22.0 - -toolchain go1.23.0 +go 1.23.0 require ( github.com/Masterminds/semver/v3 v3.2.1 diff --git a/hack/tools.mk b/hack/tools.mk index 30eaef29c..a6208e414 100644 --- a/hack/tools.mk +++ b/hack/tools.mk @@ -2,7 +2,14 @@ # # SPDX-License-Identifier: Apache-2.0 -TOOLS_DIR := hack/tools +ifeq ($(strip $(shell go list -m 2>/dev/null)),github.com/gardener/machine-controller-manager) +TOOLS_PKG_PATH := ./hack/tools +else +# dependency on github.com/gardener/machine-controller-manager/hack/tools is optional and only needed if other projects want to reuse +# install-gosec.sh. If they don't use it and the project doesn't depend on the package, +# silence the error to minimize confusion. +TOOLS_PKG_PATH := $(shell go list -tags tools -f '{{ .Dir }}' github.com/gardener/machine-controller-manager/hack/tools 2>/dev/null) +endif TOOLS_BIN_DIR := $(TOOLS_DIR)/bin ## Tool Binaries @@ -13,7 +20,7 @@ CONVERSION_GEN ?= $(TOOLS_BIN_DIR)/conversion-gen OPENAPI_GEN ?= $(TOOLS_BIN_DIR)/openapi-gen VGOPATH ?= $(TOOLS_BIN_DIR)/vgopath GEN_CRD_API_REFERENCE_DOCS ?= $(TOOLS_BIN_DIR)/gen-crd-api-reference-docs -ADDLICENSE ?= $(TOOLS_BIN_DIR)/addlicense +GO_ADD_LICENSE ?= $(TOOLS_BIN_DIR)/addlicense GOIMPORTS ?= $(TOOLS_BIN_DIR)/goimports GOLANGCI_LINT ?= $(TOOLS_BIN_DIR)/golangci-lint GOSEC ?= $(TOOLS_BIN_DIR)/gosec @@ -74,4 +81,4 @@ $(GOLANGCI_LINT): $(TOOLS_BIN_DIR) GOBIN=$(abspath $(TOOLS_BIN_DIR)) go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) $(GOSEC): - GOSEC_VERSION=$(GOSEC_VERSION) bash $(abspath $(TOOLS_DIR))/install-gosec.sh \ No newline at end of file + GOSEC_VERSION=$(GOSEC_VERSION) bash $(TOOLS_PKG_PATH)/install-gosec.sh \ No newline at end of file diff --git a/hack/tools/bin/.gitkeep b/hack/tools/bin/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/hack/tools/bin/addlicense b/hack/tools/bin/addlicense deleted file mode 100755 index 8f7ae94ff..000000000 Binary files a/hack/tools/bin/addlicense and /dev/null differ diff --git a/hack/tools/doc.go b/hack/tools/doc.go new file mode 100644 index 000000000..d4441575f --- /dev/null +++ b/hack/tools/doc.go @@ -0,0 +1,6 @@ +// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors +// +// SPDX-License-Identifier: Apache-2.0 + +// Package tools allows importing scripts in this directory in other projects via go mod dependencies. +package tools diff --git a/hack/tools/install-gosec.sh b/hack/tools/install-gosec.sh old mode 100644 new mode 100755 index 92696cffb..cefdb5755 --- a/hack/tools/install-gosec.sh +++ b/hack/tools/install-gosec.sh @@ -12,7 +12,6 @@ TOOLS_BIN_DIR=${TOOLS_BIN_DIR:-$(dirname $0)/bin} platform=$(uname -s | tr '[:upper:]' '[:lower:]') version=$GOSEC_VERSION -echo "gosec version:$GOSEC_VERSION" case $(uname -m) in aarch64 | arm64) arch="arm64" @@ -34,10 +33,8 @@ function cleanup { rm -rf "${temp_dir}" } trap cleanup EXIT ERR INT TERM -echo "Downloading from: https://github.com/securego/gosec/releases/download/${version}/${file_name}" curl -L -o ${temp_dir}/${file_name} "https://github.com/securego/gosec/releases/download/${version}/${file_name}" - tar -xzm -C "${temp_dir}" -f "${temp_dir}/${file_name}" mv "${temp_dir}/gosec" $TOOLS_BIN_DIR -chmod +x $TOOLS_BIN_DIR/gosec +chmod +x $TOOLS_BIN_DIR/gosec \ No newline at end of file diff --git a/kubernetes/crds/machine.sapcloud.io_machinedeployments.yaml b/kubernetes/crds/machine.sapcloud.io_machinedeployments.yaml index 2ee77e634..2e451624a 100644 --- a/kubernetes/crds/machine.sapcloud.io_machinedeployments.yaml +++ b/kubernetes/crds/machine.sapcloud.io_machinedeployments.yaml @@ -179,12 +179,11 @@ spec: Value can be an absolute number (ex: 5) or a percentage of desired machines (ex: 10%). This can not be 0 if MaxUnavailable is 0. Absolute number is calculated from percentage by rounding up. - By default, a value of 1 is used. - Example: when this is set to 30%, the new MC can be scaled up immediately when - the rolling update starts, such that the total number of old and new machines do not exceed + Example: when this is set to 30%, the new machine set can be scaled up immediately when + the rolling update starts, such that the total number of old and new machines does not exceed 130% of desired machines. Once old machines have been killed, - new MC can be scaled up further, ensuring that total number of machines running - at any time during the update is atmost 130% of desired machines. + new machine set can be scaled up further, ensuring that total number of machines running + at any time during the update is utmost 130% of desired machines. x-kubernetes-int-or-string: true maxUnavailable: anyOf: @@ -195,10 +194,9 @@ spec: Value can be an absolute number (ex: 5) or a percentage of desired machines (ex: 10%). Absolute number is calculated from percentage by rounding down. This can not be 0 if MaxSurge is 0. - By default, a fixed value of 1 is used. - Example: when this is set to 30%, the old MC can be scaled down to 70% of desired machines - immediately when the rolling update starts. Once new machines are ready, old MC - can be scaled down further, followed by scaling up the new MC, ensuring + Example: when this is set to 30%, the old machine set can be scaled down to 70% of desired machines + immediately when the rolling update starts. Once new machines are ready, old machine set + can be scaled down further, followed by scaling up the new machine set, ensuring that the total number of machines available at all times during the update is at least 70% of desired machines. x-kubernetes-int-or-string: true diff --git a/pkg/openapi/openapi_generated.go b/pkg/openapi/openapi_generated.go index e99e50701..3db8d394b 100644 --- a/pkg/openapi/openapi_generated.go +++ b/pkg/openapi/openapi_generated.go @@ -1663,13 +1663,13 @@ func schema_pkg_apis_machine_v1alpha1_RollingUpdateMachineDeployment(ref common. Properties: map[string]spec.Schema{ "maxUnavailable": { SchemaProps: spec.SchemaProps{ - Description: "The maximum number of machines that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of desired machines (ex: 10%). Absolute number is calculated from percentage by rounding down. This can not be 0 if MaxSurge is 0. By default, a fixed value of 1 is used. Example: when this is set to 30%, the old MC can be scaled down to 70% of desired machines immediately when the rolling update starts. Once new machines are ready, old MC can be scaled down further, followed by scaling up the new MC, ensuring that the total number of machines available at all times during the update is at least 70% of desired machines.", + Description: "The maximum number of machines that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of desired machines (ex: 10%). Absolute number is calculated from percentage by rounding down. This can not be 0 if MaxSurge is 0. Example: when this is set to 30%, the old machine set can be scaled down to 70% of desired machines immediately when the rolling update starts. Once new machines are ready, old machine set can be scaled down further, followed by scaling up the new machine set, ensuring that the total number of machines available at all times during the update is at least 70% of desired machines.", Ref: ref("k8s.io/apimachinery/pkg/util/intstr.IntOrString"), }, }, "maxSurge": { SchemaProps: spec.SchemaProps{ - Description: "The maximum number of machines that can be scheduled above the desired number of machines. Value can be an absolute number (ex: 5) or a percentage of desired machines (ex: 10%). This can not be 0 if MaxUnavailable is 0. Absolute number is calculated from percentage by rounding up. By default, a value of 1 is used. Example: when this is set to 30%, the new MC can be scaled up immediately when the rolling update starts, such that the total number of old and new machines do not exceed 130% of desired machines. Once old machines have been killed, new MC can be scaled up further, ensuring that total number of machines running at any time during the update is atmost 130% of desired machines.", + Description: "The maximum number of machines that can be scheduled above the desired number of machines. Value can be an absolute number (ex: 5) or a percentage of desired machines (ex: 10%). This can not be 0 if MaxUnavailable is 0. Absolute number is calculated from percentage by rounding up. Example: when this is set to 30%, the new machine set can be scaled up immediately when the rolling update starts, such that the total number of old and new machines does not exceed 130% of desired machines. Once old machines have been killed, new machine set can be scaled up further, ensuring that total number of machines running at any time during the update is utmost 130% of desired machines.", Ref: ref("k8s.io/apimachinery/pkg/util/intstr.IntOrString"), }, }, diff --git a/pkg/util/provider/machinecontroller/userdata_test.go b/pkg/util/provider/machinecontroller/userdata_test.go index 50f6b8b40..933c79db8 100644 --- a/pkg/util/provider/machinecontroller/userdata_test.go +++ b/pkg/util/provider/machinecontroller/userdata_test.go @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: SAP SE or an SAP affiliate company and Gardener contributors +// +// SPDX-License-Identifier: Apache-2.0 + package controller import (