From a522b7327456fa9dae55ac732b15d696d2ee070b Mon Sep 17 00:00:00 2001 From: Abu Kashem Date: Mon, 13 Jan 2025 07:33:20 -0500 Subject: [PATCH] bump(library-go) --- go.mod | 3 +++ go.sum | 4 +-- .../controller/guard/guard_controller.go | 15 ++++++----- .../installer/installer_controller.go | 9 ++++++- .../controller/node/node_controller.go | 27 +++++++------------ vendor/modules.txt | 3 ++- 6 files changed, 32 insertions(+), 29 deletions(-) diff --git a/go.mod b/go.mod index 4f5c18aab..ec6855d32 100644 --- a/go.mod +++ b/go.mod @@ -141,5 +141,8 @@ require ( replace ( github.com/gogo/protobuf => github.com/gogo/protobuf v1.3.2 + + // remove + github.com/openshift/library-go => github.com/tkashem/library-go v0.0.0-20250113122828-acaa152f13b3 vbom.ml/util => github.com/fvbommel/util v0.0.0-20180919145318-efcd4e0f9787 ) diff --git a/go.sum b/go.sum index 629565d64..7c7332146 100644 --- a/go.sum +++ b/go.sum @@ -321,8 +321,6 @@ github.com/openshift/build-machinery-go v0.0.0-20240613134303-8359781da660 h1:F0 github.com/openshift/build-machinery-go v0.0.0-20240613134303-8359781da660/go.mod h1:8jcm8UPtg2mCAsxfqKil1xrmRMI3a+XU2TZ9fF8A7TE= github.com/openshift/client-go v0.0.0-20241203091221-452dfb8fa071 h1:l0++HnGVKBcs8kXFL/1yeozxioxPGNpp0PYe3Y+0sq4= github.com/openshift/client-go v0.0.0-20241203091221-452dfb8fa071/go.mod h1:gL0laCCiIaNTNw1ZsMQZXBVu2NeQFpNWm9bLtYO9+ZU= -github.com/openshift/library-go v0.0.0-20241213140326-389618b826f5 h1:TlKl01ZwP3Hyq5pU0e1RfmW6yO/VtDt+EmL9+pqyWvQ= -github.com/openshift/library-go v0.0.0-20241213140326-389618b826f5/go.mod h1:eGSI6tp7yUVr4V2d0WrVt2l5s3iCwAh8Hi0RC9Fo16U= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde/go.mod h1:nZgzbfBr3hhjoZnS66nKrHmduYNpc34ny7RK4z5/HM0= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= @@ -422,6 +420,8 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/tkashem/library-go v0.0.0-20250113122828-acaa152f13b3 h1:R/eXkPXPBDXILMnpWJ0NlaUgg0pru3WMLUmkSXYlIO8= +github.com/tkashem/library-go v0.0.0-20250113122828-acaa152f13b3/go.mod h1:eGSI6tp7yUVr4V2d0WrVt2l5s3iCwAh8Hi0RC9Fo16U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75 h1:6fotK7otjonDflCTK0BCfls4SPy3NcCVb5dqqmbRknE= diff --git a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/guard/guard_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/guard/guard_controller.go index 34cc973c4..5b34749e2 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/guard/guard_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/guard/guard_controller.go @@ -16,7 +16,6 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" - "k8s.io/apimachinery/pkg/selection" utilerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/client-go/informers" @@ -54,7 +53,8 @@ type GuardController struct { installerPodImageFn func() string createConditionalFunc func() (bool, bool, error) - extraNodeSelector labels.Selector + extraNodeSelector labels.Selector + masterNodesSelector labels.Selector } func NewGuardController( @@ -106,6 +106,11 @@ func NewGuardController( createConditionalFunc: createConditionalFunc, extraNodeSelector: extraNodeSelector, } + masterNodesSelector, err := labels.Parse("node-role.kubernetes.io/master=") + if err != nil { + panic(err) + } + c.masterNodesSelector = masterNodesSelector return factory.New(). WithInformers( @@ -228,11 +233,7 @@ func (c *GuardController) sync(ctx context.Context, syncCtx factory.SyncContext) } } } else { - selector, err := labels.NewRequirement("node-role.kubernetes.io/master", selection.Equals, []string{""}) - if err != nil { - panic(err) - } - nodes, err := c.nodeLister.List(labels.NewSelector().Add(*selector)) + nodes, err := c.nodeLister.List(c.masterNodesSelector) if err != nil { return err } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/installer/installer_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/installer/installer_controller.go index 778426da9..4862e7cbc 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/installer/installer_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/installer/installer_controller.go @@ -264,7 +264,7 @@ func (c *InstallerController) getStaticPodState(ctx context.Context, nodeName st } switch pod.Status.Phase { - case corev1.PodRunning, corev1.PodSucceeded: + case corev1.PodRunning: for _, c := range pod.Status.Conditions { if c.Type == corev1.PodReady { if c.Status == corev1.ConditionTrue { @@ -273,11 +273,18 @@ func (c *InstallerController) getStaticPodState(ctx context.Context, nodeName st return staticPodStatePending, revision, "static pod is not ready", nil, c.LastTransitionTime.Time, nil } } + ts := pod.CreationTimestamp.Time if pod.Status.StartTime != nil { ts = pod.Status.StartTime.Time } return staticPodStatePending, revision, "static pod is not ready", nil, ts, nil + case corev1.PodSucceeded: + ts := pod.CreationTimestamp.Time + if pod.Status.StartTime != nil { + ts = pod.Status.StartTime.Time + } + return staticPodStatePending, revision, "static pod has completed", nil, ts, nil case corev1.PodFailed: // we need a definitive timestamp here that does not change again. Because PodFail is a terminal state, we can assume // the containers don't change anymore. So we use the latest container termination state. diff --git a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/node/node_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/node/node_controller.go index 11c3d778c..0f2cbec4f 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/node/node_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/node/node_controller.go @@ -7,7 +7,6 @@ import ( coreapiv1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/labels" - "k8s.io/apimachinery/pkg/selection" "k8s.io/client-go/informers" corelisterv1 "k8s.io/client-go/listers/core/v1" @@ -26,6 +25,7 @@ type NodeController struct { operatorClient v1helpers.StaticPodOperatorClient nodeLister corelisterv1.NodeLister extraNodeSelector labels.Selector + masterNodesSelector labels.Selector } // NewNodeController creates a new node controller. @@ -43,6 +43,12 @@ func NewNodeController( extraNodeSelector: extraNodeSelector, } + masterNodesSelector, err := labels.Parse("node-role.kubernetes.io/master=") + if err != nil { + panic(err) + } + c.masterNodesSelector = masterNodesSelector + return factory.New(). WithInformers( operatorClient.Informer(), @@ -62,11 +68,7 @@ func (c *NodeController) sync(ctx context.Context, syncCtx factory.SyncContext) return err } - selector, err := labels.NewRequirement("node-role.kubernetes.io/master", selection.Equals, []string{""}) - if err != nil { - panic(err) - } - nodes, err := c.nodeLister.List(labels.NewSelector().Add(*selector)) + nodes, err := c.nodeLister.List(c.masterNodesSelector) if err != nil { return err } @@ -94,18 +96,7 @@ func (c *NodeController) sync(ctx context.Context, syncCtx factory.SyncContext) } } if found { - newTargetNodeState := applyoperatorv1.NodeStatus(). - WithNodeName(originalOperatorStatus.NodeStatuses[i].NodeName). - WithCurrentRevision(originalOperatorStatus.NodeStatuses[i].CurrentRevision). - WithTargetRevision(originalOperatorStatus.NodeStatuses[i].TargetRevision). - WithLastFailedRevision(originalOperatorStatus.NodeStatuses[i].LastFailedRevision). - WithLastFailedReason(originalOperatorStatus.NodeStatuses[i].LastFailedReason). - WithLastFailedCount(originalOperatorStatus.NodeStatuses[i].LastFailedCount). - WithLastFallbackCount(originalOperatorStatus.NodeStatuses[i].LastFallbackCount). - WithLastFailedRevisionErrors(originalOperatorStatus.NodeStatuses[i].LastFailedRevisionErrors...) - if originalOperatorStatus.NodeStatuses[i].LastFailedTime != nil { - newTargetNodeState = newTargetNodeState.WithLastFailedTime(*originalOperatorStatus.NodeStatuses[i].LastFailedTime) - } + newTargetNodeState := applyoperatorv1.NodeStatus().WithNodeName(originalOperatorStatus.NodeStatuses[i].NodeName) newTargetNodeStates = append(newTargetNodeStates, newTargetNodeState) } else { syncCtx.Recorder().Warningf("MasterNodeRemoved", "Observed removal of master node %s", nodeState.NodeName) diff --git a/vendor/modules.txt b/vendor/modules.txt index 7eaa7b165..cd854df2f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -334,7 +334,7 @@ github.com/openshift/client-go/operator/informers/externalversions/operator/v1 github.com/openshift/client-go/operator/informers/externalversions/operator/v1alpha1 github.com/openshift/client-go/operator/listers/operator/v1 github.com/openshift/client-go/operator/listers/operator/v1alpha1 -# github.com/openshift/library-go v0.0.0-20241213140326-389618b826f5 +# github.com/openshift/library-go v0.0.0-20241213140326-389618b826f5 => github.com/tkashem/library-go v0.0.0-20250113122828-acaa152f13b3 ## explicit; go 1.22.0 github.com/openshift/library-go/pkg/apiserver/jsonpatch github.com/openshift/library-go/pkg/assets @@ -1581,4 +1581,5 @@ sigs.k8s.io/structured-merge-diff/v4/value sigs.k8s.io/yaml sigs.k8s.io/yaml/goyaml.v2 # github.com/gogo/protobuf => github.com/gogo/protobuf v1.3.2 +# github.com/openshift/library-go => github.com/tkashem/library-go v0.0.0-20250113122828-acaa152f13b3 # vbom.ml/util => github.com/fvbommel/util v0.0.0-20180919145318-efcd4e0f9787