Skip to content

Commit ce2c021

Browse files
Merge pull request #824 from p0lyn0mial/bump-library-go
API-1835: bump library-go
2 parents e3e3ce7 + 219824d commit ce2c021

File tree

44 files changed

+927
-442
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+927
-442
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99
github.com/openshift/api v0.0.0-20241001152557-e415140e5d5f
1010
github.com/openshift/build-machinery-go v0.0.0-20240613134303-8359781da660
1111
github.com/openshift/client-go v0.0.0-20241001162912-da6d55e4611f
12-
github.com/openshift/library-go v0.0.0-20241001171606-756adf2188fc
12+
github.com/openshift/library-go v0.0.0-20241119162247-f466fdd82330
1313
github.com/prometheus/client_golang v1.19.1
1414
github.com/prometheus/common v0.55.0
1515
github.com/spf13/cobra v1.8.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ github.com/openshift/build-machinery-go v0.0.0-20240613134303-8359781da660 h1:F0
164164
github.com/openshift/build-machinery-go v0.0.0-20240613134303-8359781da660/go.mod h1:8jcm8UPtg2mCAsxfqKil1xrmRMI3a+XU2TZ9fF8A7TE=
165165
github.com/openshift/client-go v0.0.0-20241001162912-da6d55e4611f h1:FRc0bVNWprihWS0GqQWzb3dY4dkCwpOP3mDw5NwSoR4=
166166
github.com/openshift/client-go v0.0.0-20241001162912-da6d55e4611f/go.mod h1:KiZi2mJRH1TOJ3FtBDYS6YvUL30s/iIXaGSUrSa36mo=
167-
github.com/openshift/library-go v0.0.0-20241001171606-756adf2188fc h1:QXYkFJn7wLTHAI56l+9DJnLrNynGtXjyOZLgiIglTnE=
168-
github.com/openshift/library-go v0.0.0-20241001171606-756adf2188fc/go.mod h1:9B1MYPoLtP9tqjWxcbUNVpwxy68zOH/3EIP6c31dAM0=
167+
github.com/openshift/library-go v0.0.0-20241119162247-f466fdd82330 h1:nK16PhWNPIjnv7Vux1jBlzEPgA9q/o/CwqsbRpQJrpY=
168+
github.com/openshift/library-go v0.0.0-20241119162247-f466fdd82330/go.mod h1:9B1MYPoLtP9tqjWxcbUNVpwxy68zOH/3EIP6c31dAM0=
169169
github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde/go.mod h1:nZgzbfBr3hhjoZnS66nKrHmduYNpc34ny7RK4z5/HM0=
170170
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
171171
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=

pkg/cmd/operator/cmd.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ import (
66
"github.com/openshift/cluster-kube-controller-manager-operator/pkg/operator"
77
"github.com/openshift/cluster-kube-controller-manager-operator/pkg/version"
88
"github.com/openshift/library-go/pkg/controller/controllercmd"
9+
10+
"k8s.io/utils/clock"
911
)
1012

1113
func NewOperator() *cobra.Command {
1214
cmd := controllercmd.
13-
NewControllerCommandConfig("kube-controller-manager-operator", version.Get(), operator.RunOperator).
15+
NewControllerCommandConfig("kube-controller-manager-operator", version.Get(), operator.RunOperator, clock.RealClock{}).
1416
NewCommand()
1517
cmd.Use = "operator"
1618
cmd.Short = "Start the Cluster kube-controller-manager Operator"

pkg/cmd/recoverycontroller/cmd.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/openshift/library-go/pkg/operator/v1helpers"
1616
"github.com/spf13/cobra"
1717
"k8s.io/client-go/kubernetes"
18+
"k8s.io/utils/clock"
1819
)
1920

2021
type Options struct {
@@ -23,6 +24,7 @@ type Options struct {
2324

2425
func NewCertRecoveryControllerCommand(ctx context.Context) *cobra.Command {
2526
o := &Options{}
27+
c := clock.RealClock{}
2628

2729
ccc := controllercmd.NewControllerCommandConfig("cert-recovery-controller", version.Get(), func(ctx context.Context, controllerContext *controllercmd.ControllerContext) error {
2830
o.controllerContext = controllerContext
@@ -37,13 +39,13 @@ func NewCertRecoveryControllerCommand(ctx context.Context) *cobra.Command {
3739
return err
3840
}
3941

40-
err = o.Run(ctx)
42+
err = o.Run(ctx, c)
4143
if err != nil {
4244
return err
4345
}
4446

4547
return nil
46-
})
48+
}, c)
4749

4850
// Disable serving for recovery as it introduces a dependency on kube-system::extension-apiserver-authentication
4951
// configmap which prevents it to start as the CA bundle is expired.
@@ -66,7 +68,7 @@ func (o *Options) Complete(ctx context.Context) error {
6668
return nil
6769
}
6870

69-
func (o *Options) Run(ctx context.Context) error {
71+
func (o *Options) Run(ctx context.Context, clock clock.Clock) error {
7072
kubeClient, err := kubernetes.NewForConfig(o.controllerContext.ProtoKubeConfig)
7173
if err != nil {
7274
return fmt.Errorf("can't build kubernetes client: %w", err)
@@ -81,6 +83,7 @@ func (o *Options) Run(ctx context.Context) error {
8183
)
8284

8385
operatorClient, dynamicInformers, err := genericoperatorclient.NewStaticPodOperatorClient(
86+
clock,
8487
o.controllerContext.KubeConfig,
8588
operatorv1.GroupVersion.WithResource("kubecontrollermanagers"),
8689
operatorv1.GroupVersion.WithKind("KubeControllerManager"),

pkg/operator/configobservation/clustername/observeinfraid_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66

77
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
88
"k8s.io/client-go/tools/cache"
9+
"k8s.io/utils/clock"
910

1011
configv1 "github.com/openshift/api/config/v1"
1112
configlistersv1 "github.com/openshift/client-go/config/listers/config/v1"
@@ -97,7 +98,7 @@ func TestObserveInfraID(t *testing.T) {
9798
listers := configobservation.Listers{
9899
InfrastructureLister_: configlistersv1.NewInfrastructureLister(indexer),
99100
}
100-
result, errs := ObserveInfraID(listers, events.NewInMemoryRecorder("infraid"), test.input)
101+
result, errs := ObserveInfraID(listers, events.NewInMemoryRecorder("infraid", clock.RealClock{}), test.input)
101102
if len(errs) > 0 {
102103
t.Fatal(errs)
103104
} else {

pkg/operator/configobservation/network/observe_networking_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66

77
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
88
"k8s.io/client-go/tools/cache"
9+
"k8s.io/utils/clock"
910

1011
configv1 "github.com/openshift/api/config/v1"
1112
configlistersv1 "github.com/openshift/client-go/config/listers/config/v1"
@@ -78,7 +79,7 @@ func TestObserveClusterCIDRs(t *testing.T) {
7879
listers := configobservation.Listers{
7980
NetworkLister: configlistersv1.NewNetworkLister(indexer),
8081
}
81-
result, errs := ObserveClusterCIDRs(listers, events.NewInMemoryRecorder("network"), map[string]interface{}{})
82+
result, errs := ObserveClusterCIDRs(listers, events.NewInMemoryRecorder("network", clock.RealClock{}), map[string]interface{}{})
8283
if len(errs) > 0 && !test.expectedError {
8384
t.Fatal(errs)
8485
} else if len(errs) == 0 {
@@ -101,7 +102,7 @@ func TestObserveServiceClusterIPRanges(t *testing.T) {
101102
listers := configobservation.Listers{
102103
NetworkLister: configlistersv1.NewNetworkLister(indexer),
103104
}
104-
result, errs := ObserveServiceClusterIPRanges(listers, events.NewInMemoryRecorder("network"), map[string]interface{}{})
105+
result, errs := ObserveServiceClusterIPRanges(listers, events.NewInMemoryRecorder("network", clock.RealClock{}), map[string]interface{}{})
105106
if len(errs) > 0 {
106107
t.Fatal(errs)
107108
}

pkg/operator/gcwatchercontroller/gcwatcher_controller_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"k8s.io/client-go/informers"
1818
"k8s.io/client-go/kubernetes/fake"
1919
"k8s.io/client-go/tools/cache"
20+
"k8s.io/utils/clock"
2021

2122
configv1 "github.com/openshift/api/config/v1"
2223
operatorv1 "github.com/openshift/api/operator/v1"
@@ -429,7 +430,7 @@ func TestGarbageCollectorSync(t *testing.T) {
429430
tc.gc.configMapClient = configMapGetter
430431
clusterListers := configlisters.NewClusterOperatorLister(indexer)
431432
tc.gc.clusterLister = clusterListers
432-
eventRecorder := events.NewInMemoryRecorder("dummy")
433+
eventRecorder := events.NewInMemoryRecorder("dummy", clock.RealClock{})
433434
syncContext := factory.NewSyncContext(controllerName, eventRecorder)
434435
syncContext.Queue().Add(invalidateAlertingRulesCacheKey)
435436
err := tc.gc.sync(context.TODO(), syncContext)

pkg/operator/starter.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ func RunOperator(ctx context.Context, cc *controllercmd.ControllerContext) error
6868
)
6969

7070
operatorClient, dynamicInformers, err := genericoperatorclient.NewStaticPodOperatorClient(
71+
cc.Clock,
7172
cc.KubeConfig,
7273
operatorv1.GroupVersion.WithResource("kubecontrollermanagers"),
7374
operatorv1.GroupVersion.WithKind("KubeControllerManager"),
@@ -213,7 +214,7 @@ func RunOperator(ctx context.Context, cc *controllercmd.ControllerContext) error
213214
}
214215
versionRecorder.SetVersion("raw-internal", status.VersionForOperatorFromEnv())
215216

216-
staticPodControllers, err := staticpod.NewBuilder(operatorClient, kubeClient, kubeInformersForNamespaces, configInformers).
217+
staticPodControllers, err := staticpod.NewBuilder(operatorClient, kubeClient, kubeInformersForNamespaces, configInformers, cc.Clock).
217218
WithEvents(cc.EventRecorder).
218219
WithInstaller([]string{"cluster-kube-controller-manager-operator", "installer"}).
219220
WithPruning([]string{"cluster-kube-controller-manager-operator", "prune"}, "kube-controller-manager-pod").

pkg/operator/targetconfigcontroller/targetconfigcontroller_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"k8s.io/client-go/kubernetes/fake"
2323
corev1listers "k8s.io/client-go/listers/core/v1"
2424
"k8s.io/client-go/tools/cache"
25+
"k8s.io/utils/clock"
2526
)
2627

2728
func TestIsRequiredConfigPresent(t *testing.T) {
@@ -305,7 +306,7 @@ func TestManageCSRSigner(t *testing.T) {
305306
t.Fatal(err.Error())
306307
}
307308
lister := corev1listers.NewSecretLister(indexer)
308-
_, delay, changed, err := ManageCSRSigner(context.Background(), lister, client.CoreV1(), events.NewInMemoryRecorder("target-config-controller"))
309+
_, delay, changed, err := ManageCSRSigner(context.Background(), lister, client.CoreV1(), events.NewInMemoryRecorder("target-config-controller", clock.RealClock{}))
309310
// there's a 10s difference we need to account for to avoid flakes
310311
offset := 10 * time.Second
311312
if delay < test.expectedDelay-offset || delay > test.expectedDelay+offset {

vendor/github.com/openshift/library-go/pkg/apiserver/jsonpatch/jsonpatch.go

Lines changed: 87 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)