Merge pull request #595 from rancher/dependabot/go_modules/golang.org/x/net-0.36.0
chore(deps): Bump golang.org/x/net from 0.33.0 to 0.36.0
This commit is contained in:
commit
d6992a93ef
|
|
@ -7,7 +7,7 @@
|
|||
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/go:1": {
|
||||
"version": "1.22"
|
||||
"version": "1.23"
|
||||
},
|
||||
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
|
||||
"ghcr.io/mpriscella/features/kind:1": {},
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ jobs:
|
|||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.22'
|
||||
go-version: '1.23'
|
||||
check-latest: true
|
||||
cache: true
|
||||
- name: Verify
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ jobs:
|
|||
- name: Install Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.22.x
|
||||
go-version: 1.23.x
|
||||
- name: Build e2e image
|
||||
run: make e2e-image
|
||||
- uses: actions/cache@v4.2.2
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ jobs:
|
|||
- name: Install Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.22.x
|
||||
go-version: 1.23.x
|
||||
- name: Setup kind
|
||||
uses: helm/kind-action@v1.12.0
|
||||
with:
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ jobs:
|
|||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.22.8
|
||||
go-version: 1.23.0
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v6.5.1
|
||||
with:
|
||||
version: v1.55.1
|
||||
version: v1.64.8
|
||||
working-directory: ${{matrix.working-directory}}
|
||||
args: --timeout=5m0s
|
||||
skip-cache: true
|
||||
|
|
@ -16,6 +16,6 @@ jobs:
|
|||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.22.8
|
||||
go-version: 1.23.0
|
||||
- name: Lint
|
||||
run: make lint
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ jobs:
|
|||
- name: setupGo
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '=1.22.8'
|
||||
go-version: '=1.23.0'
|
||||
- name: Docker login ghcr.io
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
|
|
@ -62,7 +62,7 @@ jobs:
|
|||
- name: setupGo
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '=1.22.8'
|
||||
go-version: '=1.23.0'
|
||||
- name: Update manifests
|
||||
run: |
|
||||
make release RELEASE_TAG=${{ env.TAG }} REGISTRY=${{ env.GHCR_REGISTRY }}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
# Options for analysis running.
|
||||
run:
|
||||
go: "1.22"
|
||||
skip-files:
|
||||
go: "1.23"
|
||||
allow-parallel-runners: true
|
||||
issues:
|
||||
exclude-files:
|
||||
- "zz_generated.*\\.go$"
|
||||
- "conversion\\.go"
|
||||
- "vendored_openapi\\.go$"
|
||||
- ".*_test\\.go$"
|
||||
allow-parallel-runners: true
|
||||
issues:
|
||||
include:
|
||||
- EXC0012
|
||||
- EXC0014
|
||||
|
|
@ -43,14 +43,16 @@ issues:
|
|||
path: pkg/rke2
|
||||
linters:
|
||||
- revive
|
||||
linters-settings:
|
||||
linters-settings:
|
||||
funlen:
|
||||
lines: 110
|
||||
statements: 60
|
||||
lll:
|
||||
line-length: 150
|
||||
gomnd:
|
||||
mnd:
|
||||
ignored-numbers:
|
||||
- "30"
|
||||
- "20"
|
||||
- "5"
|
||||
- "4"
|
||||
- "3"
|
||||
|
|
@ -66,8 +68,8 @@ linters-settings:
|
|||
- "default"
|
||||
- "prefix(sigs.k8s.io/cluster-api)"
|
||||
- "prefix(github.com/rancher/cluster-api-provider-rke2)"
|
||||
wsl:
|
||||
force-err-cuddling: false
|
||||
wsl:
|
||||
force-err-cuddling: false
|
||||
revive:
|
||||
rules:
|
||||
# The following rules are recommended https://github.com/mgechev/revive#recommended-configuration
|
||||
|
|
|
|||
4
Makefile
4
Makefile
|
|
@ -13,7 +13,7 @@ SHELL = /usr/bin/env bash -o pipefail
|
|||
#
|
||||
# Go.
|
||||
#
|
||||
GO_VERSION ?= 1.22.8
|
||||
GO_VERSION ?= 1.23.0
|
||||
GO_CONTAINER_IMAGE ?= docker.io/library/golang:$(GO_VERSION)
|
||||
|
||||
# Use GOPROXY environment variable if set
|
||||
|
|
@ -101,7 +101,7 @@ GO_APIDIFF_PKG := github.com/joelanford/go-apidiff
|
|||
HADOLINT_VER := v2.10.0
|
||||
HADOLINT_FAILURE_THRESHOLD = warning
|
||||
|
||||
GOLANGCI_LINT_VER := v1.55.1
|
||||
GOLANGCI_LINT_VER := v1.64.8
|
||||
GOLANGCI_LINT_BIN := golangci-lint
|
||||
GOLANGCI_LINT := $(abspath $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN))
|
||||
|
||||
|
|
|
|||
|
|
@ -161,9 +161,9 @@ func (s *RKE2ConfigSpec) validateRegistries(pathPrefix *field.Path) field.ErrorL
|
|||
allErrs = append(
|
||||
allErrs,
|
||||
field.Invalid(
|
||||
pathPrefix.Child(fmt.Sprintf("privateRegistriesConfig.configs.%s", regName)),
|
||||
pathPrefix.Child("privateRegistriesConfig.configs."+regName),
|
||||
regConfig,
|
||||
fmt.Sprintf("need either credentials, tls settings or both for registry: %s", regName)),
|
||||
"need either credentials, tls settings or both for registry: "+regName),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ func cleanupArbitraryData(arbitraryData map[string]string) error {
|
|||
return fmt.Errorf("invalid list value provided: '%s', error: %w", v, err)
|
||||
}
|
||||
|
||||
arbitraryData[k] = fmt.Sprintf("\n%s", b.String())
|
||||
arbitraryData[k] = "\n" + b.String()
|
||||
|
||||
continue
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,11 +189,11 @@ func (r *RKE2ConfigReconciler) Reconcile(ctx context.Context, req ctrl.Request)
|
|||
// It's a worker join
|
||||
// GetTheControlPlane for the worker
|
||||
wkControlPlane := controlplanev1.RKE2ControlPlane{}
|
||||
|
||||
err = r.Client.Get(ctx, types.NamespacedName{
|
||||
Namespace: scope.Cluster.Spec.ControlPlaneRef.Namespace,
|
||||
Name: scope.Cluster.Spec.ControlPlaneRef.Name,
|
||||
}, &wkControlPlane)
|
||||
|
||||
if err != nil {
|
||||
scope.Logger.Info("Unable to find control plane object for owning Cluster", "error", err)
|
||||
|
||||
|
|
@ -990,7 +990,6 @@ func generateFilesFromManifestConfig(
|
|||
Namespace: manifestConfigMap.Namespace,
|
||||
Name: manifestConfigMap.Name,
|
||||
}, manifestSec)
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ limitations under the License.
|
|||
package ignition
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
bootstrapv1 "github.com/rancher/cluster-api-provider-rke2/bootstrap/api/v1beta1"
|
||||
|
|
@ -73,11 +74,11 @@ type ControlPlaneInput struct {
|
|||
// NewJoinWorker returns Ignition configuration for new worker node joining the cluster.
|
||||
func NewJoinWorker(input *JoinWorkerInput) ([]byte, error) {
|
||||
if input == nil {
|
||||
return nil, fmt.Errorf("input can't be nil")
|
||||
return nil, errors.New("input can't be nil")
|
||||
}
|
||||
|
||||
if input.BaseUserData == nil {
|
||||
return nil, fmt.Errorf("base userdata can't be nil")
|
||||
return nil, errors.New("base userdata can't be nil")
|
||||
}
|
||||
|
||||
deployRKE2Command, err := getWorkerRKE2Commands(input.BaseUserData)
|
||||
|
|
@ -113,11 +114,11 @@ func NewInitControlPlane(input *ControlPlaneInput) ([]byte, error) {
|
|||
|
||||
func controlPlaneConfigInput(input *ControlPlaneInput) (*ControlPlaneInput, error) {
|
||||
if input == nil {
|
||||
return nil, fmt.Errorf("input can't be nil")
|
||||
return nil, errors.New("input can't be nil")
|
||||
}
|
||||
|
||||
if input.ControlPlaneInput == nil {
|
||||
return nil, fmt.Errorf("controlplane input can't be nil")
|
||||
return nil, errors.New("controlplane input can't be nil")
|
||||
}
|
||||
|
||||
deployRKE2Command, err := getControlPlaneRKE2Commands(&input.BaseUserData)
|
||||
|
|
@ -151,11 +152,11 @@ func getWorkerRKE2Commands(baseUserData *cloudinit.BaseUserData) ([]string, erro
|
|||
|
||||
func getRKE2Commands(baseUserData *cloudinit.BaseUserData, command, airgappedCommand string, systemdServices []string) ([]string, error) {
|
||||
if baseUserData == nil {
|
||||
return nil, fmt.Errorf("base user data can't be nil")
|
||||
return nil, errors.New("base user data can't be nil")
|
||||
}
|
||||
|
||||
if baseUserData.RKE2Version == "" {
|
||||
return nil, fmt.Errorf("rke2 version can't be empty")
|
||||
return nil, errors.New("rke2 version can't be empty")
|
||||
}
|
||||
|
||||
rke2Commands := []string{}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import (
|
|||
"k8s.io/apimachinery/pkg/runtime"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
|
||||
"k8s.io/klog/v2"
|
||||
klog "k8s.io/klog/v2"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
"sigs.k8s.io/controller-runtime/pkg/cache"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ import (
|
|||
"github.com/rancher/cluster-api-provider-rke2/pkg/registration"
|
||||
"github.com/rancher/cluster-api-provider-rke2/pkg/rke2"
|
||||
"github.com/rancher/cluster-api-provider-rke2/pkg/secret"
|
||||
rke2util "github.com/rancher/cluster-api-provider-rke2/pkg/util"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -317,8 +318,8 @@ func (r *RKE2ControlPlaneReconciler) updateStatus(ctx context.Context, rcp *cont
|
|||
return err
|
||||
}
|
||||
|
||||
rcp.Status.UpdatedReplicas = int32(len(controlPlane.UpToDateMachines()))
|
||||
replicas := int32(len(ownedMachines))
|
||||
rcp.Status.UpdatedReplicas = rke2util.SafeInt32(len(controlPlane.UpToDateMachines()))
|
||||
replicas := rke2util.SafeInt32(len(ownedMachines))
|
||||
desiredReplicas := *rcp.Spec.Replicas
|
||||
|
||||
// set basic data that does not require interacting with the workload cluster
|
||||
|
|
@ -360,17 +361,17 @@ func (r *RKE2ControlPlaneReconciler) updateStatus(ctx context.Context, rcp *cont
|
|||
// make sure last resize operation is marked as completed.
|
||||
// NOTE: we are checking the number of machines ready so we report resize completed only when the machines
|
||||
// are actually provisioned (vs reporting completed immediately after the last machine object is created).
|
||||
if int32(len(readyMachines)) == replicas {
|
||||
if rke2util.SafeInt32(len(readyMachines)) == replicas {
|
||||
conditions.MarkTrue(rcp, controlplanev1.ResizedCondition)
|
||||
}
|
||||
}
|
||||
|
||||
kubeconfigSecret := corev1.Secret{}
|
||||
|
||||
err = r.Client.Get(ctx, types.NamespacedName{
|
||||
Namespace: cluster.Namespace,
|
||||
Name: secret.Name(cluster.Name, secret.Kubeconfig),
|
||||
}, &kubeconfigSecret)
|
||||
|
||||
if err != nil {
|
||||
r.Log.Info("Kubeconfig secret does not yet exist")
|
||||
|
||||
|
|
@ -379,10 +380,10 @@ func (r *RKE2ControlPlaneReconciler) updateStatus(ctx context.Context, rcp *cont
|
|||
|
||||
kubeConfig := kubeconfigSecret.Data[secret.KubeconfigDataName]
|
||||
if kubeConfig == nil {
|
||||
return fmt.Errorf("unable to find a value entry in the kubeconfig secret")
|
||||
return errors.New("unable to find a value entry in the kubeconfig secret")
|
||||
}
|
||||
|
||||
rcp.Status.ReadyReplicas = int32(len(readyMachines))
|
||||
rcp.Status.ReadyReplicas = rke2util.SafeInt32(len(readyMachines))
|
||||
rcp.Status.UnavailableReplicas = replicas - rcp.Status.ReadyReplicas
|
||||
|
||||
workloadCluster, err := r.getWorkloadCluster(ctx, util.ObjectKey(cluster))
|
||||
|
|
@ -424,7 +425,7 @@ func (r *RKE2ControlPlaneReconciler) updateStatus(ctx context.Context, rcp *cont
|
|||
|
||||
rcp.Status.AvailableServerIPs = validIPAddresses
|
||||
if len(rcp.Status.AvailableServerIPs) == 0 {
|
||||
return fmt.Errorf("some Control Plane machines exist and are ready but they have no IP Address available")
|
||||
return errors.New("some Control Plane machines exist and are ready but they have no IP Address available")
|
||||
}
|
||||
|
||||
if len(readyMachines) == len(ownedMachines) {
|
||||
|
|
@ -939,8 +940,8 @@ func (r *RKE2ControlPlaneReconciler) upgradeControlPlane(
|
|||
maxSurge = *rcp.Spec.RolloutStrategy.RollingUpdate.MaxSurge
|
||||
}
|
||||
|
||||
maxNodes := *rcp.Spec.Replicas + int32(maxSurge.IntValue())
|
||||
if int32(controlPlane.Machines.Len()) < maxNodes {
|
||||
maxNodes := *rcp.Spec.Replicas + rke2util.SafeInt32(maxSurge.IntValue())
|
||||
if rke2util.SafeInt32(controlPlane.Machines.Len()) < maxNodes {
|
||||
// scaleUpControlPlane ensures that we don't continue scaling up while waiting for Machines to have NodeRefs
|
||||
return r.scaleUpControlPlane(ctx, cluster, rcp, controlPlane)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ import (
|
|||
"os"
|
||||
"time"
|
||||
|
||||
_ "k8s.io/client-go/plugin/pkg/client/auth"
|
||||
|
||||
// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
|
||||
// to ensure that exec-entrypoint and run can make use of them.
|
||||
"github.com/spf13/pflag"
|
||||
|
|
@ -30,8 +32,7 @@ import (
|
|||
"k8s.io/apimachinery/pkg/runtime"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
|
||||
_ "k8s.io/client-go/plugin/pkg/client/auth"
|
||||
"k8s.io/klog/v2"
|
||||
klog "k8s.io/klog/v2"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
"sigs.k8s.io/controller-runtime/pkg/cache"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
|
@ -112,7 +113,8 @@ func InitFlags(fs *pflag.FlagSet) {
|
|||
"Maximum queries per second from the cluster cache tracker clients to the Kubernetes API server of workload clusters.")
|
||||
|
||||
fs.IntVar(&clusterCacheTrackerClientBurst, "clustercachetracker-client-burst", 30,
|
||||
"Maximum number of queries that should be allowed in one burst from the cluster cache tracker clients to the Kubernetes API server of workload clusters.")
|
||||
"Maximum number of queries allowed in one burst from cluster cache tracker clients "+
|
||||
"to the Kubernetes API server of workload clusters.")
|
||||
|
||||
fs.StringVar(&watchNamespace, "namespace", "",
|
||||
"Namespace that the controller watches to reconcile cluster-api objects. If unspecified, the controller watches for cluster-api objects across all namespaces.") //nolint:lll
|
||||
|
|
|
|||
20
go.mod
20
go.mod
|
|
@ -1,8 +1,6 @@
|
|||
module github.com/rancher/cluster-api-provider-rke2
|
||||
|
||||
go 1.22.0
|
||||
|
||||
toolchain go1.22.8
|
||||
go 1.23.0
|
||||
|
||||
require (
|
||||
github.com/blang/semver/v4 v4.0.0
|
||||
|
|
@ -137,16 +135,16 @@ require (
|
|||
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.uber.org/zap v1.27.0 // indirect
|
||||
golang.org/x/crypto v0.31.0 // indirect
|
||||
golang.org/x/crypto v0.36.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
|
||||
golang.org/x/net v0.33.0 // indirect
|
||||
golang.org/x/net v0.37.0 // indirect
|
||||
golang.org/x/oauth2 v0.24.0 // indirect
|
||||
golang.org/x/sync v0.10.0 // indirect
|
||||
golang.org/x/sys v0.28.0 // indirect
|
||||
golang.org/x/term v0.27.0 // indirect
|
||||
golang.org/x/text v0.21.0 // indirect
|
||||
golang.org/x/time v0.5.0 // indirect
|
||||
golang.org/x/tools v0.28.0 // indirect
|
||||
golang.org/x/sync v0.12.0 // indirect
|
||||
golang.org/x/sys v0.31.0 // indirect
|
||||
golang.org/x/term v0.30.0 // indirect
|
||||
golang.org/x/text v0.23.0 // indirect
|
||||
golang.org/x/time v0.8.0 // indirect
|
||||
golang.org/x/tools v0.30.0 // indirect
|
||||
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
|
||||
|
|
|
|||
32
go.sum
32
go.sum
|
|
@ -334,8 +334,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
|
|||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
|
||||
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
|
||||
golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
|
||||
golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
|
||||
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8=
|
||||
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
|
||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
|
|
@ -345,15 +345,15 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
|
|||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
|
||||
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
|
||||
golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c=
|
||||
golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
|
||||
golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE=
|
||||
golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
|
||||
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=
|
||||
golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
|
|
@ -363,23 +363,23 @@ golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
|
||||
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
|
||||
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q=
|
||||
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
|
||||
golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y=
|
||||
golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
|
||||
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
||||
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
|
||||
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
|
||||
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
|
||||
golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg=
|
||||
golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8=
|
||||
golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw=
|
||||
golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY=
|
||||
golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
module github.com/rancher/cluster-api-provider-rke2/hack/tools
|
||||
|
||||
go 1.22.8
|
||||
go 1.23.0
|
||||
|
||||
require sigs.k8s.io/cluster-api/hack/tools v0.0.0-20240820112706-3abe3058a6a8
|
||||
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ func New(
|
|||
return nil, errors.Wrap(err, "unable to sign certificate")
|
||||
}
|
||||
|
||||
userName := fmt.Sprintf("%s-admin", clusterName)
|
||||
userName := clusterName + "-admin"
|
||||
contextName := fmt.Sprintf("%s@%s", userName, clusterName)
|
||||
|
||||
return &api.Config{
|
||||
|
|
@ -156,7 +156,7 @@ func CreateSecret(ctx context.Context, c client.Client, cluster *clusterv1.Clust
|
|||
|
||||
// CreateSecretWithOwner creates the Kubeconfig secret for the given cluster name, namespace, endpoint, and owner reference.
|
||||
func CreateSecretWithOwner(ctx context.Context, c client.Client, clusterName client.ObjectKey, endpoint string, owner metav1.OwnerReference) error {
|
||||
server := fmt.Sprintf("https://%s", endpoint)
|
||||
server := "https://" + endpoint
|
||||
|
||||
out, err := generateKubeconfig(ctx, c, clusterName, server)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -168,10 +168,10 @@ func newSemaphore() *semaphore {
|
|||
}
|
||||
|
||||
func configMapName(clusterName string) string {
|
||||
return fmt.Sprintf("%s-lock", clusterName)
|
||||
return clusterName + "-lock"
|
||||
}
|
||||
|
||||
func (s semaphore) information() (*information, error) {
|
||||
func (s *semaphore) information() (*information, error) {
|
||||
li := &information{}
|
||||
if err := json.Unmarshal([]byte(s.Data[semaphoreInformationKey]), li); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal semaphore information")
|
||||
|
|
@ -180,7 +180,7 @@ func (s semaphore) information() (*information, error) {
|
|||
return li, nil
|
||||
}
|
||||
|
||||
func (s semaphore) setInformation(information *information) error {
|
||||
func (s *semaphore) setInformation(information *information) error {
|
||||
b, err := json.Marshal(information)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to marshal semaphore information")
|
||||
|
|
|
|||
|
|
@ -238,7 +238,8 @@ func TestControlPlaneInitMutex_LockWithMachineDeletion(t *testing.T) {
|
|||
Namespace: cluster.Namespace,
|
||||
}, cm)).To(Succeed())
|
||||
|
||||
info, err := semaphore{cm}.information()
|
||||
s := &semaphore{cm}
|
||||
info, err := s.information()
|
||||
g.Expect(err).To(BeNil())
|
||||
|
||||
g.Expect(info.MachineName).To(Equal(tc.expectedMachineName))
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ func NewRegistrationMethod(method string) (GetRegistrationAddresses, error) {
|
|||
}
|
||||
|
||||
func registrationMethodWithFilter(filter addressFilter) GetRegistrationAddresses {
|
||||
return func(_ *clusterv1.Cluster, rcp *controlplanev1.RKE2ControlPlane, availableMachines collections.Machines) ([]string, error) {
|
||||
return func(_ *clusterv1.Cluster, _ *controlplanev1.RKE2ControlPlane, availableMachines collections.Machines) ([]string, error) {
|
||||
validIPAddresses := []string{}
|
||||
|
||||
for _, availableMachine := range availableMachines {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
|
@ -181,7 +182,7 @@ func newRKE2ServerConfig(opts ServerConfigOpts) (*ServerConfig, []bootstrapv1.Fi
|
|||
|
||||
auditPolicy, ok := auditPolicySecret.Data["audit-policy.yaml"]
|
||||
if !ok {
|
||||
return nil, nil, fmt.Errorf("audit policy secret is missing audit-policy.yaml key")
|
||||
return nil, nil, errors.New("audit policy secret is missing audit-policy.yaml key")
|
||||
}
|
||||
|
||||
rke2ServerConfig.AuditPolicyFile = "/etc/rancher/rke2/audit-policy.yaml"
|
||||
|
|
@ -227,7 +228,7 @@ func newRKE2ServerConfig(opts ServerConfigOpts) (*ServerConfig, []bootstrapv1.Fi
|
|||
|
||||
cloudProviderConfig, ok := cloudProviderConfigMap.Data["cloud-config"]
|
||||
if !ok {
|
||||
return nil, nil, fmt.Errorf("cloud provider config map is missing cloud-config key")
|
||||
return nil, nil, errors.New("cloud provider config map is missing cloud-config key")
|
||||
}
|
||||
|
||||
rke2ServerConfig.CloudProviderConfig = "/etc/rancher/rke2/cloud-provider-config"
|
||||
|
|
@ -281,13 +282,13 @@ func newRKE2ServerConfig(opts ServerConfigOpts) (*ServerConfig, []bootstrapv1.Fi
|
|||
accessKeyID, ok = awsCredentialsSecret.Data["aws_access_key_id"]
|
||||
|
||||
if !ok {
|
||||
return nil, nil, fmt.Errorf("aws credentials secret is missing aws_access_key_id")
|
||||
return nil, nil, errors.New("aws credentials secret is missing aws_access_key_id")
|
||||
}
|
||||
|
||||
secretAccessKey, ok = awsCredentialsSecret.Data["aws_secret_access_key"]
|
||||
|
||||
if !ok {
|
||||
return nil, nil, fmt.Errorf("aws credentials secret is missing aws_secret_access_key")
|
||||
return nil, nil, errors.New("aws credentials secret is missing aws_secret_access_key")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -309,7 +310,7 @@ func newRKE2ServerConfig(opts ServerConfigOpts) (*ServerConfig, []bootstrapv1.Fi
|
|||
|
||||
caCert, ok := endpointCAsecret.Data["ca.pem"]
|
||||
if !ok {
|
||||
return nil, nil, fmt.Errorf("endpoint CA secret is missing ca.pem")
|
||||
return nil, nil, errors.New("endpoint CA secret is missing ca.pem")
|
||||
}
|
||||
|
||||
rke2ServerConfig.EtcdS3EndpointCA = "/etc/rancher/rke2/etcd-s3-ca.crt"
|
||||
|
|
@ -449,7 +450,7 @@ func newRKE2AgentConfig(opts AgentConfigOpts) (*rke2AgentConfig, []bootstrapv1.F
|
|||
cloudProviderConfig, ok := cloudProviderConfigMap.Data["cloud-config"]
|
||||
|
||||
if !ok {
|
||||
return nil, nil, fmt.Errorf("cloud provider config map is missing cloud-config key")
|
||||
return nil, nil, errors.New("cloud provider config map is missing cloud-config key")
|
||||
}
|
||||
|
||||
rke2AgentConfig.CloudProviderConfig = DefaultRKE2CloudProviderConfigLocation
|
||||
|
|
@ -477,12 +478,12 @@ func newRKE2AgentConfig(opts AgentConfigOpts) (*rke2AgentConfig, []bootstrapv1.F
|
|||
credentialConfig, ok := imageCredentialProviderCM.Data["credential-config.yaml"]
|
||||
|
||||
if !ok {
|
||||
return nil, nil, fmt.Errorf("image credential provider config map is missing config.yaml")
|
||||
return nil, nil, errors.New("image credential provider config map is missing config.yaml")
|
||||
}
|
||||
|
||||
credentialProviderBinaries, ok := imageCredentialProviderCM.Data["credential-provider-binaries"]
|
||||
if !ok {
|
||||
return nil, nil, fmt.Errorf("image credential provider config map is missing credential-provider-binaries")
|
||||
return nil, nil, errors.New("image credential provider config map is missing credential-provider-binaries")
|
||||
}
|
||||
|
||||
rke2AgentConfig.ImageCredentialProviderBinDir = credentialProviderBinaries
|
||||
|
|
@ -518,7 +519,7 @@ func newRKE2AgentConfig(opts AgentConfigOpts) (*rke2AgentConfig, []bootstrapv1.F
|
|||
|
||||
resolvConf, ok := resolvConfCM.Data["resolv.conf"]
|
||||
if !ok {
|
||||
return nil, nil, fmt.Errorf("resolv conf config map is missing resolv.conf")
|
||||
return nil, nil, errors.New("resolv conf config map is missing resolv.conf")
|
||||
}
|
||||
|
||||
rke2AgentConfig.ResolvConf = "/etc/rancher/rke2/resolv.conf"
|
||||
|
|
@ -551,7 +552,7 @@ func newRKE2AgentConfig(opts AgentConfigOpts) (*rke2AgentConfig, []bootstrapv1.F
|
|||
// GenerateInitControlPlaneConfig generates the rke2 server and agent config for the init control plane node.
|
||||
func GenerateInitControlPlaneConfig(opts ServerConfigOpts) (*ServerConfig, []bootstrapv1.File, error) {
|
||||
if opts.Token == "" {
|
||||
return nil, nil, fmt.Errorf("token is required")
|
||||
return nil, nil, errors.New("token is required")
|
||||
}
|
||||
|
||||
rke2ServerConfig, serverFiles, err := newRKE2ServerConfig(opts)
|
||||
|
|
@ -580,11 +581,11 @@ func GenerateInitControlPlaneConfig(opts ServerConfigOpts) (*ServerConfig, []boo
|
|||
// GenerateJoinControlPlaneConfig generates the rke2 agent config for joining a control plane node.
|
||||
func GenerateJoinControlPlaneConfig(opts ServerConfigOpts) (*ServerConfig, []bootstrapv1.File, error) {
|
||||
if opts.ServerURL == "" {
|
||||
return nil, nil, fmt.Errorf("server url is required")
|
||||
return nil, nil, errors.New("server url is required")
|
||||
}
|
||||
|
||||
if opts.Token == "" {
|
||||
return nil, nil, fmt.Errorf("token is required")
|
||||
return nil, nil, errors.New("token is required")
|
||||
}
|
||||
|
||||
rke2ServerConfig, serverFiles, err := newRKE2ServerConfig(opts)
|
||||
|
|
@ -614,11 +615,11 @@ func GenerateJoinControlPlaneConfig(opts ServerConfigOpts) (*ServerConfig, []boo
|
|||
// GenerateWorkerConfig generates the rke2 agent config and files.
|
||||
func GenerateWorkerConfig(opts AgentConfigOpts) (*rke2AgentConfig, []bootstrapv1.File, error) {
|
||||
if opts.ServerURL == "" {
|
||||
return nil, nil, fmt.Errorf("server url is required")
|
||||
return nil, nil, errors.New("server url is required")
|
||||
}
|
||||
|
||||
if opts.Token == "" {
|
||||
return nil, nil, fmt.Errorf("token is required")
|
||||
return nil, nil, errors.New("token is required")
|
||||
}
|
||||
|
||||
rke2AgentConfig, agentFiles, err := newRKE2AgentConfig(opts)
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ func (m *Management) NewWorkload(
|
|||
}
|
||||
|
||||
if clientKey == nil {
|
||||
return nil, fmt.Errorf("client key is not populated yet, requeuing")
|
||||
return nil, errors.New("client key is not populated yet, requeuing")
|
||||
}
|
||||
|
||||
clientCert, err = generateClientCert(etcdKeyPair.Cert, etcdKeyPair.Key, clientKey)
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ func (w *Workload) removeMemberForNode(ctx context.Context, name string) error {
|
|||
return errors.Wrap(err, "failed to remove member from etcd")
|
||||
}
|
||||
|
||||
log.FromContext(ctx).Info(fmt.Sprintf("Removed member: %s", member.Name))
|
||||
log.FromContext(ctx).Info("Removed member: " + member.Name)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ import (
|
|||
"context"
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"errors"
|
||||
"math"
|
||||
"regexp"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
|
@ -40,7 +41,7 @@ const (
|
|||
)
|
||||
|
||||
// ErrControlPlaneNotFound is returned when a control plane is not found.
|
||||
var ErrControlPlaneNotFound = fmt.Errorf("control plane not found")
|
||||
var ErrControlPlaneNotFound = errors.New("control plane not found")
|
||||
|
||||
// GetOwnerControlPlane returns the RKE2ControlPlane object that owns the object passed as parameter.
|
||||
func GetOwnerControlPlane(ctx context.Context, c client.Client, obj metav1.ObjectMeta) (*controlplanev1.RKE2ControlPlane, error) {
|
||||
|
|
@ -109,7 +110,7 @@ func Random(size int) (string, error) {
|
|||
|
||||
// TokenName returns a token name from the cluster name.
|
||||
func TokenName(clusterName string) string {
|
||||
return fmt.Sprintf("%s-token", clusterName)
|
||||
return clusterName + "-token"
|
||||
}
|
||||
|
||||
// Rke2ToKubeVersion converts an RKE2 version to a Kubernetes version.
|
||||
|
|
@ -213,3 +214,12 @@ func ProfileCompliant(profile bootstrapv1.CISProfile, version string) bool {
|
|||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// SafeInt32 returns the int32 value of an int, ensuring it does not exceed the maximum int32 value.
|
||||
func SafeInt32(n int) int32 {
|
||||
if n > math.MaxInt32 {
|
||||
return math.MaxInt32
|
||||
}
|
||||
|
||||
return int32(n) //nolint:gosec
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package helpers
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"go/build"
|
||||
"os"
|
||||
"path"
|
||||
|
|
@ -21,7 +20,7 @@ import (
|
|||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
"k8s.io/client-go/rest"
|
||||
"k8s.io/klog/v2"
|
||||
klog "k8s.io/klog/v2"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/envtest"
|
||||
|
|
@ -89,7 +88,7 @@ func (t *TestEnvironment) Cleanup(ctx context.Context, objs ...client.Object) er
|
|||
func (t *TestEnvironment) CreateNamespace(ctx context.Context, generateName string) (*corev1.Namespace, error) {
|
||||
ns := &corev1.Namespace{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
GenerateName: fmt.Sprintf("%s-", generateName),
|
||||
GenerateName: generateName + "-",
|
||||
Labels: map[string]string{
|
||||
"testenv/original-name": generateName,
|
||||
},
|
||||
|
|
@ -186,7 +185,7 @@ func getFilePathToCAPICRDs(root string) string {
|
|||
|
||||
gopath := envOr("GOPATH", build.Default.GOPATH)
|
||||
|
||||
return filepath.Join(gopath, "pkg", "mod", "sigs.k8s.io", fmt.Sprintf("cluster-api@v%s", clusterAPIVersion), "config", "crd", "bases")
|
||||
return filepath.Join(gopath, "pkg", "mod", "sigs.k8s.io", "cluster-api@v"+clusterAPIVersion, "config", "crd", "bases")
|
||||
}
|
||||
|
||||
func envOr(envKey, defaultValue string) string {
|
||||
|
|
|
|||
Loading…
Reference in New Issue