Skip to content

Commit

Permalink
Merge pull request #4797 from RishabhSaini/kubeBump
Browse files Browse the repository at this point in the history
MCO-1515: Kube bump to 1.32
  • Loading branch information
openshift-merge-bot[bot] authored Mar 4, 2025
2 parents 07ba85e + 24d9a76 commit 19ba3dd
Show file tree
Hide file tree
Showing 3,277 changed files with 115,544 additions and 102,257 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
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.22-openshift-4.18
tag: rhel-9-release-golang-1.23-openshift-4.19
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Use RHEL 9 as the primary builder base for the Machine Config Operator
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.22-builder-multi-openshift-4.18 AS rhel9-builder
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.23-openshift-4.19 AS rhel9-builder
ARG TAGS=""
WORKDIR /go/src/github.com/openshift/machine-config-operator
COPY . .
Expand All @@ -12,7 +12,7 @@ RUN --mount=type=cache,target=/go/rhel9/.cache,z \
make install DESTDIR=./instroot-rhel9 && tar -C instroot-rhel9 -cf instroot-rhel9.tar .

# Add a RHEL 8 builder to compile the RHEL 8 compatible binaries
FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.22-builder-multi-openshift-4.18 AS rhel8-builder
FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.23-openshift-4.19 AS rhel8-builder
ARG TAGS=""
WORKDIR /go/src/github.com/openshift/machine-config-operator
# Copy the RHEL 8 machine-config-daemon binary and rename
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile.rhel7
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# THIS FILE IS GENERATED FROM Dockerfile DO NOT EDIT
# Use RHEL 9 as the primary builder base for the Machine Config Operator
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.22-builder-multi-openshift-4.18 AS rhel9-builder
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.23-openshift-4.19 AS rhel9-builder
ARG TAGS=""
WORKDIR /go/src/github.com/openshift/machine-config-operator
COPY . .
Expand All @@ -13,7 +13,7 @@ RUN --mount=type=cache,target=/go/rhel9/.cache,z \
make install DESTDIR=./instroot-rhel9 && tar -C instroot-rhel9 -cf instroot-rhel9.tar .

# Add a RHEL 8 builder to compile the RHEL 8 compatible binaries
FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.22-builder-multi-openshift-4.18 AS rhel8-builder
FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.23-openshift-4.19 AS rhel8-builder
ARG TAGS=""
WORKDIR /go/src/github.com/openshift/machine-config-operator
# Copy the RHEL 8 machine-config-daemon binary and rename
Expand All @@ -24,7 +24,7 @@ RUN --mount=type=cache,target=/go/rhel8/.cache,z \
--mount=type=cache,target=/go/rhel8/pkg/mod,z \
make install DESTDIR=./instroot-rhel8 && tar -C instroot-rhel8 -cf instroot-rhel8.tar .

FROM registry.ci.openshift.org/ocp/builder:rhel-9-enterprise-base-multi-openshift-4.18
FROM registry.ci.openshift.org/ocp/4.19:base-rhel9
ARG TAGS=""
COPY install /manifests
RUN --mount=type=cache,target=/var/cache/dnf,z \
Expand Down
243 changes: 124 additions & 119 deletions go.mod

Large diffs are not rendered by default.

575 changes: 276 additions & 299 deletions go.sum

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion pkg/controller/certrotation/certrotation_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
corelisterv1 "k8s.io/client-go/listers/core/v1"
"k8s.io/client-go/tools/cache"
"k8s.io/klog/v2"
"k8s.io/utils/clock"

configv1 "github.com/openshift/api/config/v1"
configclientset "github.com/openshift/client-go/config/clientset/versioned"
Expand Down Expand Up @@ -75,7 +76,7 @@ func New(
mcoConfigMapInfomer coreinformersv1.ConfigMapInformer,
) (*CertRotationController, error) {

recorder := events.NewLoggingEventRecorder(componentName)
recorder := events.NewLoggingEventRecorder(componentName, clock.RealClock{})

c := &CertRotationController{
kubeClient: kubeClient,
Expand Down
3 changes: 2 additions & 1 deletion pkg/controller/common/controller_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/informers"
"k8s.io/klog/v2"
"k8s.io/utils/clock"
)

const (
Expand Down Expand Up @@ -120,7 +121,7 @@ func CreateControllerContext(ctx context.Context, cb *clients.Builder) *Controll
klog.Warningf("unable to get owner reference (falling back to namespace): %v", err)
}

recorder := events.NewKubeRecorder(kubeClient.CoreV1().Events(MCONamespace), "machine-config-operator", controllerRef)
recorder := events.NewKubeRecorder(kubeClient.CoreV1().Events(MCONamespace), "machine-config-operator", controllerRef, clock.RealClock{})

// By default, this will exit(0) the process if the featuregates ever change to a different set of values.
featureGateAccessor := featuregates.NewFeatureGateAccess(
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/common/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ func ValidateIgnition(ignconfig interface{}) error {
// https://bugzilla.redhat.com/show_bug.cgi?id=2038240
func validateIgn2FileModes(cfg ign2types.Config) error {
for _, file := range cfg.Storage.Files {
if file.Mode != nil && os.FileMode(*file.Mode) > os.ModePerm {
if file.Mode != nil && os.FileMode(*file.Mode) > os.ModePerm { //nolint:gosec
return fmt.Errorf("invalid mode %#o for %s, cannot exceed %#o", *file.Mode, file.Path, os.ModePerm)
}
}
Expand All @@ -541,7 +541,7 @@ func validateIgn2FileModes(cfg ign2types.Config) error {
// https://bugzilla.redhat.com/show_bug.cgi?id=2038240
func validateIgn3FileModes(cfg ign3types.Config) error {
for _, file := range cfg.Storage.Files {
if file.Mode != nil && os.FileMode(*file.Mode) > os.ModePerm {
if file.Mode != nil && os.FileMode(*file.Mode) > os.ModePerm { //nolint:gosec
return fmt.Errorf("invalid mode %#o for %s, cannot exceed %#o", *file.Mode, file.Path, os.ModePerm)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,11 @@ func (ctrl *Controller) Run(workers int, stopCh <-chan struct{}) {
<-stopCh
}

func ctrConfigTriggerObjectChange(old, new *mcfgv1.ContainerRuntimeConfig) bool {
if old.DeletionTimestamp != new.DeletionTimestamp {
func ctrConfigTriggerObjectChange(old, newCRC *mcfgv1.ContainerRuntimeConfig) bool {
if old.DeletionTimestamp != newCRC.DeletionTimestamp {
return true
}
if !reflect.DeepEqual(old.Spec, new.Spec) {
if !reflect.DeepEqual(old.Spec, newCRC.Spec) {
return true
}
return false
Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/kubelet-config/kubelet_config_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,11 @@ func (ctrl *Controller) deleteAPIServer(obj interface{}) {
ctrl.filterAPIServer(apiServer)
}

func kubeletConfigTriggerObjectChange(old, new *mcfgv1.KubeletConfig) bool {
if old.DeletionTimestamp != new.DeletionTimestamp {
func kubeletConfigTriggerObjectChange(old, newKubeletConfig *mcfgv1.KubeletConfig) bool {
if old.DeletionTimestamp != newKubeletConfig.DeletionTimestamp {
return true
}
if !reflect.DeepEqual(old.Spec, new.Spec) {
if !reflect.DeepEqual(old.Spec, newKubeletConfig.Spec) {
return true
}
return false
Expand Down
4 changes: 4 additions & 0 deletions pkg/controller/node/node_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1273,6 +1273,10 @@ func getAllCandidateMachines(layered bool, config *mcfgv1.MachineOSConfig, build
return nil, 0
}
capacity -= failingThisConfig

if capacity < 0 {
return nil, 0
}
return nodes, uint(capacity)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/node/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (ctrl *Controller) syncStatusOnly(pool *mcfgv1.MachineConfigPool) error {
return err
}

//nolint:gocyclo
//nolint:gocyclo,gosec
func (ctrl *Controller) calculateStatus(fg featuregates.FeatureGate, mcs []*mcfgv1alpha1.MachineConfigNode, cconfig *mcfgv1.ControllerConfig, pool *mcfgv1.MachineConfigPool, nodes []*corev1.Node, mosc *mcfgv1.MachineOSConfig, mosb *mcfgv1.MachineOSBuild) mcfgv1.MachineConfigPoolStatus {
certExpirys := []mcfgv1.CertExpiry{}
if cconfig != nil {
Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/pinnedimageset/pinned_image_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,11 @@ func (ctrl *Controller) updatePinnedImageSet(old, cur interface{}) {
}
}

func triggerPinnedImageSetChange(old, new *mcfgv1alpha1.PinnedImageSet) bool {
if old.DeletionTimestamp != new.DeletionTimestamp {
func triggerPinnedImageSetChange(old, newPinnedImageSet *mcfgv1alpha1.PinnedImageSet) bool {
if old.DeletionTimestamp != newPinnedImageSet.DeletionTimestamp {
return true
}
if !reflect.DeepEqual(old, new) {
if !reflect.DeepEqual(old, newPinnedImageSet) {
return true
}
return false
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/template/template_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ func (ctrl *Controller) addSecret(obj interface{}) {
ctrl.filterSecret(secret)
}

func (ctrl *Controller) updateSecret(_, new interface{}) {
secret := new.(*corev1.Secret)
func (ctrl *Controller) updateSecret(_, newSecret interface{}) {
secret := newSecret.(*corev1.Secret)
klog.V(4).Infof("Update Secret %v", secret)
ctrl.filterSecret(secret)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/daemon/file_writers.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func writeFiles(files []ign3types.File, skipCertificateWrite bool) error {

mode := defaultFilePermissions
if file.Mode != nil {
mode = os.FileMode(*file.Mode)
mode = os.FileMode(*file.Mode) //nolint:gosec
}

// set chown if file information is provided
Expand Down
4 changes: 2 additions & 2 deletions pkg/daemon/on_disk_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func checkV3Files(files []ign3types.File) error {
}
mode := defaultFilePermissions
if f.Mode != nil {
mode = os.FileMode(*f.Mode)
mode = os.FileMode(*f.Mode) //nolint:gosec
}
contents, err := ctrlcommon.DecodeIgnitionFileContents(f.Contents.Source, f.Contents.Compression)
if err != nil {
Expand All @@ -217,7 +217,7 @@ func checkV2Files(files []ign2types.File) error {
}
mode := defaultFilePermissions
if f.Mode != nil {
mode = os.FileMode(*f.Mode)
mode = os.FileMode(*f.Mode) //nolint:gosec
}
contents, err := ctrlcommon.DecodeIgnitionFileContents(&f.Contents.Source, &f.Contents.Compression)
if err != nil {
Expand Down
13 changes: 7 additions & 6 deletions pkg/daemon/pinned_image_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,7 @@ func (p *PinnedImageSetManager) getPinnedImageSetApplyConfigsForPools(pools []*m
return applyConfigs, nil
}

//nolint:gosec
func (p *PinnedImageSetManager) createApplyConfigForImageSet(imageSet *mcfgv1alpha1.PinnedImageSet, isCompleted bool, statusErr error) *machineconfigurationalphav1.MachineConfigNodeStatusPinnedImageSetApplyConfiguration {
imageSetConfig := machineconfigurationalphav1.MachineConfigNodeStatusPinnedImageSet().
WithName(imageSet.Name).
Expand Down Expand Up @@ -1372,21 +1373,21 @@ type imageInfo struct {
Pulled bool
}

func triggerPinnedImageSetChange(old, new *mcfgv1alpha1.PinnedImageSet) bool {
if old.DeletionTimestamp != new.DeletionTimestamp {
func triggerPinnedImageSetChange(old, newPinnedImageSet *mcfgv1alpha1.PinnedImageSet) bool {
if old.DeletionTimestamp != newPinnedImageSet.DeletionTimestamp {
return true
}
if !reflect.DeepEqual(old.Spec, new.Spec) {
if !reflect.DeepEqual(old.Spec, newPinnedImageSet.Spec) {
return true
}
return false
}

func triggerMachineConfigPoolChange(old, new *mcfgv1.MachineConfigPool) bool {
if old.DeletionTimestamp != new.DeletionTimestamp {
func triggerMachineConfigPoolChange(old, newMCP *mcfgv1.MachineConfigPool) bool {
if old.DeletionTimestamp != newMCP.DeletionTimestamp {
return true
}
if !reflect.DeepEqual(old.Spec.PinnedImageSets, new.Spec.PinnedImageSets) {
if !reflect.DeepEqual(old.Spec.PinnedImageSets, newMCP.Spec.PinnedImageSets) {
return true
}
return false
Expand Down
7 changes: 4 additions & 3 deletions pkg/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/openshift/library-go/pkg/operator/configobserver/featuregates"

"k8s.io/klog/v2"
"k8s.io/utils/clock"

configclientset "github.com/openshift/client-go/config/clientset/versioned"
ctrlcommon "github.com/openshift/machine-config-operator/pkg/controller/common"
Expand Down Expand Up @@ -212,7 +213,7 @@ func New(
Name: "machine-config-operator",
Namespace: ctrlcommon.MCONamespace,
APIVersion: "apps/v1",
}),
}, clock.RealClock{}),
queue: workqueue.NewTypedRateLimitingQueueWithConfig(
workqueue.DefaultTypedControllerRateLimiter[string](),
workqueue.TypedRateLimitingQueueConfig[string]{Name: "machineconfigoperator"}),
Expand Down Expand Up @@ -439,8 +440,8 @@ func (optr *Operator) eventHandler() cache.ResourceEventHandler {
AddFunc: func(obj interface{}) {
optr.enqueue(obj)
},
UpdateFunc: func(_, new interface{}) {
optr.enqueue(new)
UpdateFunc: func(_, newObj interface{}) {
optr.enqueue(newObj)
},
DeleteFunc: func(obj interface{}) {
optr.enqueue(obj)
Expand Down
33 changes: 17 additions & 16 deletions pkg/operator/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/klog/v2"
"k8s.io/utils/clock"

"github.com/openshift/machine-config-operator/pkg/apihelpers"
ctrlcommon "github.com/openshift/machine-config-operator/pkg/controller/common"
Expand Down Expand Up @@ -97,7 +98,7 @@ func (optr *Operator) syncAvailableStatus(co *configv1.ClusterOperator) {
Reason: asExpectedReason,
}

cov1helpers.SetStatusCondition(&co.Status.Conditions, coStatusCondition)
cov1helpers.SetStatusCondition(&co.Status.Conditions, coStatusCondition, clock.RealClock{})
}

// syncProgressingStatus applies the new condition to the mco's ClusterOperator object.
Expand Down Expand Up @@ -134,7 +135,7 @@ func (optr *Operator) syncProgressingStatus(co *configv1.ClusterOperator) {
coStatusCondition.Status = configv1.ConditionTrue
}

cov1helpers.SetStatusCondition(&co.Status.Conditions, coStatusCondition)
cov1helpers.SetStatusCondition(&co.Status.Conditions, coStatusCondition, clock.RealClock{})
}

// This function updates the Cluster Operator's status via an API call only if there is an actual
Expand Down Expand Up @@ -220,13 +221,13 @@ func (optr *Operator) syncDegradedStatus(co *configv1.ClusterOperator, ierr sync
Type: configv1.OperatorProgressing,
Status: configv1.ConditionTrue,
Message: fmt.Sprintf("Unable to apply %s", optrVersion),
})
}, clock.RealClock{})
} else {
cov1helpers.SetStatusCondition(&co.Status.Conditions, configv1.ClusterOperatorStatusCondition{
Type: configv1.OperatorProgressing,
Status: configv1.ConditionFalse,
Message: fmt.Sprintf("Error while reconciling %s", optrVersion),
})
}, clock.RealClock{})
}
}

Expand All @@ -251,7 +252,7 @@ func (optr *Operator) syncDegradedStatus(co *configv1.ClusterOperator, ierr sync
optr.eventRecorder.Eventf(mcoObjectRef, corev1.EventTypeWarning, degradedReason, message)

}
cov1helpers.SetStatusCondition(&co.Status.Conditions, coDegradedCondition)
cov1helpers.SetStatusCondition(&co.Status.Conditions, coDegradedCondition, clock.RealClock{})
}

const (
Expand Down Expand Up @@ -312,13 +313,13 @@ func (optr *Operator) syncUpgradeableStatus(co *configv1.ClusterOperator) error
klog.Errorf("Error checking version skew: %v, kubelet skew status: %v, status reason: %v, status message: %v", err, skewStatus, status.Reason, status.Message)
coStatusCondition.Reason = status.Reason
coStatusCondition.Message = status.Message
cov1helpers.SetStatusCondition(&co.Status.Conditions, coStatusCondition)
cov1helpers.SetStatusCondition(&co.Status.Conditions, coStatusCondition, clock.RealClock{})
}
switch skewStatus {
case skewUnchecked:
coStatusCondition.Reason = status.Reason
coStatusCondition.Message = status.Message
cov1helpers.SetStatusCondition(&co.Status.Conditions, coStatusCondition)
cov1helpers.SetStatusCondition(&co.Status.Conditions, coStatusCondition, clock.RealClock{})
case skewUnsupported:
coStatusCondition.Reason = status.Reason
coStatusCondition.Message = status.Message
Expand All @@ -330,15 +331,15 @@ func (optr *Operator) syncUpgradeableStatus(co *configv1.ClusterOperator) error
}
klog.Infof("kubelet skew status: %v, status reason: %v", skewStatus, status.Reason)
optr.eventRecorder.Eventf(mcoObjectRef, corev1.EventTypeWarning, coStatusCondition.Reason, coStatusCondition.Message)
cov1helpers.SetStatusCondition(&co.Status.Conditions, coStatusCondition)
cov1helpers.SetStatusCondition(&co.Status.Conditions, coStatusCondition, clock.RealClock{})
case skewPresent:
coStatusCondition.Reason = status.Reason
coStatusCondition.Message = status.Message
klog.Infof("kubelet skew status: %v, status reason: %v", skewStatus, status.Reason)
cov1helpers.SetStatusCondition(&co.Status.Conditions, coStatusCondition)
cov1helpers.SetStatusCondition(&co.Status.Conditions, coStatusCondition, clock.RealClock{})
}
}
cov1helpers.SetStatusCondition(&co.Status.Conditions, coStatusCondition)
cov1helpers.SetStatusCondition(&co.Status.Conditions, coStatusCondition, clock.RealClock{})
return nil
}

Expand Down Expand Up @@ -404,7 +405,7 @@ func (optr *Operator) syncClusterFleetEvaluation(co *configv1.ClusterOperator) e
Reason: reason,
}

cov1helpers.SetStatusCondition(&co.Status.Conditions, coStatusCondition)
cov1helpers.SetStatusCondition(&co.Status.Conditions, coStatusCondition, clock.RealClock{})
return nil
}

Expand Down Expand Up @@ -666,19 +667,19 @@ func (optr *Operator) initializeClusterOperator() (*configv1.ClusterOperator, er
}
cov1helpers.SetStatusCondition(&co.Status.Conditions, configv1.ClusterOperatorStatusCondition{
Type: configv1.OperatorAvailable, Status: configv1.ConditionFalse,
})
}, clock.RealClock{})
cov1helpers.SetStatusCondition(&co.Status.Conditions, configv1.ClusterOperatorStatusCondition{
Type: configv1.OperatorProgressing, Status: configv1.ConditionFalse,
})
}, clock.RealClock{})
cov1helpers.SetStatusCondition(&co.Status.Conditions, configv1.ClusterOperatorStatusCondition{
Type: configv1.OperatorDegraded, Status: configv1.ConditionFalse,
})
}, clock.RealClock{})
cov1helpers.SetStatusCondition(&co.Status.Conditions, configv1.ClusterOperatorStatusCondition{
Type: configv1.OperatorUpgradeable, Status: configv1.ConditionUnknown, Reason: "NoData",
})
}, clock.RealClock{})
cov1helpers.SetStatusCondition(&co.Status.Conditions, configv1.ClusterOperatorStatusCondition{
Type: configv1.EvaluationConditionsDetected, Status: configv1.ConditionFalse, Reason: asExpectedReason,
})
}, clock.RealClock{})

// RelatedObjects are consumed by https://github.com/openshift/must-gather
co.Status.RelatedObjects = []configv1.ObjectReference{
Expand Down
Loading

0 comments on commit 19ba3dd

Please sign in to comment.