Skip to content
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .ci-operator.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
build_root_image:
name: release
namespace: openshift
tag: rhel-9-release-golang-1.23-openshift-4.19
tag: rhel-9-release-golang-1.24-openshift-4.20
1 change: 0 additions & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ linters:
- errname
- errorlint
- exhaustive
- exportloopref
- forcetypeassert
- funlen
- gochecknoglobals
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.23-openshift-4.19 AS builder
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.24-openshift-4.20 AS builder
WORKDIR /go/src/github.com/openshift/cluster-control-plane-machine-set-operator
COPY . .
RUN make build

FROM registry.ci.openshift.org/ocp/4.19:base-rhel9
FROM registry.ci.openshift.org/ocp/4.20:base-rhel9
COPY --from=builder /go/src/github.com/openshift/cluster-control-plane-machine-set-operator/bin/manager .
COPY --from=builder /go/src/github.com/openshift/cluster-control-plane-machine-set-operator/manifests manifests

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.32.1
ENVTEST_K8S_VERSION = 1.33.2

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand All @@ -23,7 +23,7 @@ GOLANGCI_LINT = go run ${PROJECT_DIR}/vendor/github.com/golangci/golangci-lint/c
VERSION ?= $(shell git describe --always --abbrev=7)
MUTABLE_TAG ?= latest
IMAGE ?= cluster-control-plane-machine-set-operator
BUILD_IMAGE ?= registry.ci.openshift.org/openshift/release:golang-1.22
BUILD_IMAGE ?= registry.ci.openshift.org/openshift/release:golang-1.24

ifeq ($(shell command -v podman > /dev/null 2>&1 ; echo $$? ), 0)
ENGINE=podman
Expand Down
249 changes: 129 additions & 120 deletions go.mod

Large diffs are not rendered by default.

553 changes: 290 additions & 263 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pkg/controllers/controlplanemachineset/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ func machineInfosByIndex(cpms *machinev1.ControlPlaneMachineSet, machineInfos []
// If for any reason there aren't enough indexes to meet the replica count,
// populate empty indexes starting from index 0 until we have the correct
// number of indexes.
for i := int32(0); int32(len(out)) < *cpms.Spec.Replicas; i++ {
for i := int32(0); int32(len(out)) < *cpms.Spec.Replicas; i++ { //nolint:gosec
if _, ok := out[i]; !ok {
out[i] = []machineproviders.MachineInfo{}
}
Expand Down Expand Up @@ -738,7 +738,7 @@ func (r *ControlPlaneMachineSetReconciler) checkReadyControlPlaneMachineExists(l

// checkCorrectNumberOfIndexes checks that the number of control plane machine set indexes found in the cluster is valid.
func (r *ControlPlaneMachineSetReconciler) checkCorrectNumberOfIndexes(logger logr.Logger, cpms *machinev1.ControlPlaneMachineSet, sortedIndexedMs []indexToMachineInfos) bool {
currentIndexesCount := int32(len(sortedIndexedMs))
currentIndexesCount := int32(len(sortedIndexedMs)) //nolint:gosec

switch {
case currentIndexesCount == *cpms.Spec.Replicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ func (r *ControlPlaneMachineSetGeneratorReconciler) reconcile(ctx context.Contex

// generateControlPlaneMachineSet generates a control plane machine set based on the current cluster state.
//
//nolint:cyclop,funlen
//nolint:cyclop
func (r *ControlPlaneMachineSetGeneratorReconciler) generateControlPlaneMachineSet(logger logr.Logger, infrastructure *configv1.Infrastructure, machines []machinev1beta1.Machine, machineSets []machinev1beta1.MachineSet) (*machinev1.ControlPlaneMachineSet, error) {
var (
cpmsSpecApplyConfig machinev1builder.ControlPlaneMachineSetSpecApplyConfiguration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func createBaseFailureDomainMapping(replicas int32, failureDomains []failuredoma

// Create a base mapping which account for the larger of the number of machines or
// the desired replica count.
if replicas > int32(machineIndexCount) {
if replicas > int32(machineIndexCount) { //nolint:gosec
machineIndexCount = int(replicas)
}

Expand All @@ -121,8 +121,8 @@ func createBaseFailureDomainMapping(replicas int32, failureDomains []failuredoma
return machineFailureDomains.Has(comparableFailureDomains[i]) && !machineFailureDomains.Has(comparableFailureDomains[j])
})

for i := int32(0); i < int32(machineIndexCount); i++ {
out[i] = comparableFailureDomains[i%int32(len(comparableFailureDomains))]
for i := int32(0); i < int32(machineIndexCount); i++ { //nolint:gosec
out[i] = comparableFailureDomains[i%int32(len(comparableFailureDomains))] //nolint:gosec
}

return out, nil
Expand Down Expand Up @@ -167,8 +167,8 @@ func mapIndexesToFailureDomainsForMachines(logger logr.Logger, machines []machin
continue
}

if fd, ok := out[int32(machineNameIndex)]; ok && fd.String() != failureDomain.String() {
oldMachine := indexToMachine[int32(machineNameIndex)]
if fd, ok := out[int32(machineNameIndex)]; ok && fd.String() != failureDomain.String() { //nolint:gosec
oldMachine := indexToMachine[int32(machineNameIndex)] //nolint:gosec

if oldMachine.CreationTimestamp.After(machine.CreationTimestamp.Time) {
continue
Expand All @@ -188,9 +188,9 @@ func mapIndexesToFailureDomainsForMachines(logger logr.Logger, machines []machin
)
}

out[int32(machineNameIndex)] = failureDomain
out[int32(machineNameIndex)] = failureDomain //nolint:gosec

indexToMachine[int32(machineNameIndex)] = machine
indexToMachine[int32(machineNameIndex)] = machine //nolint:gosec
}

return out, nil
Expand All @@ -209,7 +209,7 @@ func listDeletingIndexes(machines []machinev1beta1.Machine) sets.Set[int32] {
continue
}

indexes.Insert(int32(index))
indexes.Insert(int32(index)) //nolint:gosec
}
}

Expand All @@ -221,7 +221,7 @@ func listDeletingIndexes(machines []machinev1beta1.Machine) sets.Set[int32] {
continue
}

indexes.Delete(int32(index))
indexes.Delete(int32(index)) //nolint:gosec
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (v VSphereProviderConfig) InjectFailureDomain(fd machinev1.VSphereFailureDo
}

// ExtractFailureDomain is used to extract a failure domain from the ProviderConfig.
func (v VSphereProviderConfig) ExtractFailureDomain() machinev1.VSphereFailureDomain {
func (v VSphereProviderConfig) ExtractFailureDomain() machinev1.VSphereFailureDomain { //nolint:cyclop
workspace := v.providerConfig.Workspace

if v.infrastructure.Spec.PlatformSpec.Type != configv1.VSpherePlatformType {
Expand Down
3 changes: 1 addition & 2 deletions pkg/webhooks/controlplanemachineset/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ var _ = BeforeSuite(func() {
Expect(cfg).NotTo(BeNil())

// Tweak the warnings behaviour at a config level.
cfg.WarningHandler = logf.NewKubeAPIWarningLogger(
logf.Log.WithName("KubeAPIWarningLogger"),
cfg.WarningHandlerWithContext = logf.NewKubeAPIWarningLogger(
logf.KubeAPIWarningLoggerOptions{
Deduplicate: false,
},
Expand Down
4 changes: 3 additions & 1 deletion pkg/webhooks/controlplanemachineset/webhooks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,9 @@ var _ = Describe("Webhooks", Ordered, func() {
It("with no machine template", func() {
cpms := builder.WithMachineTemplateBuilder(nil).Build()

Expect(k8sClient.Create(ctx, cpms)).To(MatchError(ContainSubstring("spec.template.machineType: Required value")))
Expect(k8sClient.Create(ctx, cpms)).To(MatchError(ContainSubstring(
"ControlPlaneMachineSet.machine.openshift.io \"cluster\" is invalid: [spec.template.machineType: Unsupported value: \"\": supported values: \"machines_v1beta1_machine_openshift_io\", <nil>: Invalid value: \"null\": some validation rules were not checked because the object was invalid; correct the existing errors to complete validation]",
)))
})

It("with no machine template value", func() {
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/framework/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var _ = Describe("Async utils", func() {

errs := []error{}
fail := func(message string, callerSkip ...int) {
errs = append(errs, fmt.Errorf(message)) //nolint:err113
errs = append(errs, fmt.Errorf("%s", message)) //nolint:err113
}

// Register a temporary fail handler so we can check what failures occur
Expand Down Expand Up @@ -67,7 +67,7 @@ var _ = Describe("Async utils", func() {

errs := []error{}
fail := func(message string, callerSkip ...int) {
errs = append(errs, fmt.Errorf(message)) //nolint:err113
errs = append(errs, fmt.Errorf("%s", message)) //nolint:err113
}

// Register a temporary fail handler so we can check what failures occur
Expand Down Expand Up @@ -104,7 +104,7 @@ var _ = Describe("Async utils", func() {

errs := []error{}
fail := func(message string, callerSkip ...int) {
errs = append(errs, fmt.Errorf(message)) //nolint:err113
errs = append(errs, fmt.Errorf("%s", message)) //nolint:err113
}

// Register a temporary fail handler so we can check what failures occur
Expand Down Expand Up @@ -142,7 +142,7 @@ var _ = Describe("Async utils", func() {

errs := []error{}
fail := func(message string, callerSkip ...int) {
errs = append(errs, fmt.Errorf(message)) //nolint:err113
errs = append(errs, fmt.Errorf("%s", message)) //nolint:err113
}

// Register a temporary fail handler so we can check what failures occur
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/helpers/controlplanemachineset.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func WaitForControlPlaneMachineSetRemovedOrRecreated(ctx context.Context, testFr
Expect(testFramework).ToNot(BeNil(), "test framework should not be nil")
k8sClient := testFramework.GetClient()

if ok := Eventually(func() error {
if ok := Eventually(func() error { //nolint:contextcheck
newCPMS := &machinev1.ControlPlaneMachineSet{}
if err := k8sClient.Get(testFramework.GetContext(), testFramework.ControlPlaneMachineSetKey(), newCPMS); err != nil {
return fmt.Errorf("error getting control plane machine set: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion test/integration/machine_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (r *integrationMachineManager) Reconcile(ctx context.Context, req reconcile
}

// addFinalizer sets the finalizer on the machine.
func (r *integrationMachineManager) addFinalizer(ctx context.Context, logger logr.Logger, req reconcile.Request, machine *machinev1beta1.Machine) (reconcile.Result, error) {
func (r *integrationMachineManager) addFinalizer(ctx context.Context, logger logr.Logger, req reconcile.Request, machine *machinev1beta1.Machine) (reconcile.Result, error) { //nolint:unparam
machine.SetFinalizers([]string{machineFinalizer})

logger.Info("Adding Finalizer")
Expand Down

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.

1 change: 1 addition & 0 deletions vendor/github.com/4meepo/tagalign/.gitignore

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

4 changes: 2 additions & 2 deletions vendor/github.com/4meepo/tagalign/.goreleaser.yml

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

7 changes: 0 additions & 7 deletions vendor/github.com/4meepo/tagalign/options.go

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

Loading