Skip to content

OCPBUGS-45051: [4.18] bump library-go to bring in workload-conditions fix #743

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ require (
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
github.com/ghodss/yaml v1.0.0
github.com/google/go-cmp v0.6.0
github.com/openshift/api v0.0.0-20241001152557-e415140e5d5f
github.com/openshift/api v0.0.0-20241101202457-04eb3fd119d2
github.com/openshift/build-machinery-go v0.0.0-20241031155326-6ae126a9cb72
github.com/openshift/client-go v0.0.0-20241001162912-da6d55e4611f
github.com/openshift/library-go v0.0.0-20241106000323-9fcf3125a28e
github.com/openshift/multi-operator-manager v0.0.0-20241101153049-fcf403de1051
github.com/openshift/library-go v0.0.0-20241126120118-cc54dd38ae04
github.com/openshift/multi-operator-manager v0.0.0-20241121231342-ecea9d7ffa35
github.com/spf13/cobra v1.8.1
github.com/stretchr/testify v1.9.0
go.etcd.io/etcd/client/v3 v3.5.14
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,16 @@ github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA
github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To=
github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk=
github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0=
github.com/openshift/api v0.0.0-20241001152557-e415140e5d5f h1:ya1OmyZm3LIIxI3U9VE9Nyx3ehCHgBwxyFUPflYPWls=
github.com/openshift/api v0.0.0-20241001152557-e415140e5d5f/go.mod h1:Shkl4HanLwDiiBzakv+con/aMGnVE2MAGvoKp5oyYUo=
github.com/openshift/api v0.0.0-20241101202457-04eb3fd119d2 h1:CguNy+2KzhJ3a3i7e4Bgm/ByfQpSSSPYmF9NLZskoUs=
github.com/openshift/api v0.0.0-20241101202457-04eb3fd119d2/go.mod h1:Shkl4HanLwDiiBzakv+con/aMGnVE2MAGvoKp5oyYUo=
github.com/openshift/build-machinery-go v0.0.0-20241031155326-6ae126a9cb72 h1:kMM+Ea3YFrcoYS76RhhBA7uELy97JM0gwqnyoy7fxco=
github.com/openshift/build-machinery-go v0.0.0-20241031155326-6ae126a9cb72/go.mod h1:8jcm8UPtg2mCAsxfqKil1xrmRMI3a+XU2TZ9fF8A7TE=
github.com/openshift/client-go v0.0.0-20241001162912-da6d55e4611f h1:FRc0bVNWprihWS0GqQWzb3dY4dkCwpOP3mDw5NwSoR4=
github.com/openshift/client-go v0.0.0-20241001162912-da6d55e4611f/go.mod h1:KiZi2mJRH1TOJ3FtBDYS6YvUL30s/iIXaGSUrSa36mo=
github.com/openshift/library-go v0.0.0-20241106000323-9fcf3125a28e h1:ZPAUe9p5nfbzJzb23s+rdFqDrl3U58hC4Y0merEkoSE=
github.com/openshift/library-go v0.0.0-20241106000323-9fcf3125a28e/go.mod h1:9B1MYPoLtP9tqjWxcbUNVpwxy68zOH/3EIP6c31dAM0=
github.com/openshift/multi-operator-manager v0.0.0-20241101153049-fcf403de1051 h1:2Rsvg5O5xvQfLAxsiOwlAEJepNtLPTLXIFHB46RS3Mo=
github.com/openshift/multi-operator-manager v0.0.0-20241101153049-fcf403de1051/go.mod h1:UBAANHcEhysEeyhtIoLZS5dFYOjjZrv9lUgtHt3cFLk=
github.com/openshift/library-go v0.0.0-20241126120118-cc54dd38ae04 h1:G/WKwNS4LDxxYm0bm3BFHV/LQoSfq48aYa76lXuhFw8=
github.com/openshift/library-go v0.0.0-20241126120118-cc54dd38ae04/go.mod h1:l/3SegTa9x+ry2J213bh7+DBofXOOvdrqU4JC9ktJa0=
github.com/openshift/multi-operator-manager v0.0.0-20241121231342-ecea9d7ffa35 h1:UdM0DernMOKB5FwiCzyRx/viWeMowq3TNDbgP5zwpVk=
github.com/openshift/multi-operator-manager v0.0.0-20241121231342-ecea9d7ffa35/go.mod h1:J/kijVY/wCcr2yVGe23wTW4wRNQrsTngWUQOFd2sQsM=
github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde/go.mod h1:nZgzbfBr3hhjoZnS66nKrHmduYNpc34ny7RK4z5/HM0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
Expand Down
4 changes: 3 additions & 1 deletion pkg/cmd/operator/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package operator
import (
"github.com/spf13/cobra"

"k8s.io/utils/clock"

"github.com/openshift/cluster-authentication-operator/pkg/operator"
"github.com/openshift/cluster-authentication-operator/pkg/version"
"github.com/openshift/library-go/pkg/controller/controllercmd"
Expand All @@ -11,7 +13,7 @@ import (
const componentName = "cluster-authentication-operator"

func NewOperator() *cobra.Command {
cmd := controllercmd.NewControllerCommandConfig(componentName, version.Get(), operator.RunOperator).NewCommand()
cmd := controllercmd.NewControllerCommandConfig(componentName, version.Get(), operator.RunOperator, clock.RealClock{}).NewCommand()
cmd.Use = "operator"
cmd.Short = "Start the Authentication Operator"
return cmd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import (
"reflect"
"strings"
"testing"
"time"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/tools/cache"
clocktesting "k8s.io/utils/clock/testing"

configv1 "github.com/openshift/api/config/v1"
configlistersv1 "github.com/openshift/client-go/config/listers/config/v1"
Expand Down Expand Up @@ -111,7 +113,7 @@ func TestObserveConsoleURL(t *testing.T) {
ClusterVersionLister: configlistersv1.NewClusterVersionLister(clusterVersionIndexer),
}

eventRecorder := events.NewInMemoryRecorder(tt.name)
eventRecorder := events.NewInMemoryRecorder(tt.name, clocktesting.NewFakePassiveClock(time.Now()))
gotConfig, errs := ObserveConsoleURL(listers, eventRecorder, tt.existingConfig)
if !reflect.DeepEqual(gotConfig, tt.expectedConfig) {
t.Errorf("ObserveConsoleURL() gotConfig = %v, want %v", gotConfig, tt.expectedConfig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import (
"reflect"
"strings"
"testing"
"time"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/tools/cache"
clocktesting "k8s.io/utils/clock/testing"

configv1 "github.com/openshift/api/config/v1"
configlistersv1 "github.com/openshift/client-go/config/listers/config/v1"
Expand Down Expand Up @@ -73,7 +75,7 @@ func TestObserveAPIServerURL(t *testing.T) {
InfrastructureLister: configlistersv1.NewInfrastructureLister(indexer),
}

eventRecorder := events.NewInMemoryRecorder(tt.name)
eventRecorder := events.NewInMemoryRecorder(tt.name, clocktesting.NewFakePassiveClock(time.Now()))
gotConfig, errs := ObserveAPIServerURL(listers, eventRecorder, tt.existingConfig)
if !reflect.DeepEqual(gotConfig, tt.expectedConfig) {
t.Errorf("ObserveAPIServerURL() gotConfig = %v, want %v", gotConfig, tt.expectedConfig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ package oauth_test

import (
"testing"
"time"

"github.com/google/go-cmp/cmp"

"k8s.io/apimachinery/pkg/api/equality"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/tools/cache"
clocktesting "k8s.io/utils/clock/testing"

configv1 "github.com/openshift/api/config/v1"
configlistersv1 "github.com/openshift/client-go/config/listers/config/v1"
Expand Down Expand Up @@ -120,7 +122,7 @@ func TestAuditProfile(t *testing.T) {
APIServerLister_: configlistersv1.NewAPIServerLister(indexer),
}

have, errs := oauth.ObserveAudit(listers, events.NewInMemoryRecorder(t.Name()), tt.previouslyObservedConfig)
have, errs := oauth.ObserveAudit(listers, events.NewInMemoryRecorder(t.Name(), clocktesting.NewFakePassiveClock(time.Now())), tt.previouslyObservedConfig)
if len(errs) > 0 {
t.Errorf("Expected 0 errors, have %v.", len(errs))
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/controllers/configobservation/oauth/observe_idps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package oauth
import (
"fmt"
"testing"
"time"

"github.com/google/go-cmp/cmp"

Expand All @@ -11,6 +12,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
corelistersv1 "k8s.io/client-go/listers/core/v1"
"k8s.io/client-go/tools/cache"
clocktesting "k8s.io/utils/clock/testing"

configv1 "github.com/openshift/api/config/v1"
configlistersv1 "github.com/openshift/client-go/config/listers/config/v1"
Expand Down Expand Up @@ -199,7 +201,7 @@ func TestObserveIdentityProviders(t *testing.T) {
OAuthLister_: configlistersv1.NewOAuthLister(indexer),
ResourceSync: &mockResourceSyncer{t: t, synced: syncerData},
}
eventsRecorder := events.NewInMemoryRecorder(t.Name())
eventsRecorder := events.NewInMemoryRecorder(t.Name(), clocktesting.NewFakePassiveClock(time.Now()))

got, errs := ObserveIdentityProviders(listers, eventsRecorder, tt.previouslyObservedConfig)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ package oauth

import (
"testing"
"time"

"github.com/google/go-cmp/cmp"

"k8s.io/apimachinery/pkg/api/equality"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
corelistersv1 "k8s.io/client-go/listers/core/v1"
"k8s.io/client-go/tools/cache"
clocktesting "k8s.io/utils/clock/testing"

configv1 "github.com/openshift/api/config/v1"
configlistersv1 "github.com/openshift/client-go/config/listers/config/v1"
Expand Down Expand Up @@ -88,7 +90,7 @@ func TestObserveTemplates(t *testing.T) {
ConfigMapLister: corelistersv1.NewConfigMapLister(indexer),
ResourceSync: &mockResourceSyncer{t: t, synced: syncerData},
}
got, errs := ObserveTemplates(listers, events.NewInMemoryRecorder(t.Name()), tt.previouslyObservedConfig)
got, errs := ObserveTemplates(listers, events.NewInMemoryRecorder(t.Name(), clocktesting.NewFakePassiveClock(time.Now())), tt.previouslyObservedConfig)
if len(errs) > 0 {
t.Errorf("Expected 0 errors, got %v.", len(errs))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ package oauth

import (
"testing"
"time"

"github.com/google/go-cmp/cmp"

"k8s.io/apimachinery/pkg/api/equality"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/tools/cache"
clocktesting "k8s.io/utils/clock/testing"

configv1 "github.com/openshift/api/config/v1"
configlistersv1 "github.com/openshift/client-go/config/listers/config/v1"
Expand Down Expand Up @@ -119,7 +121,7 @@ func TestObserveTokenConfig(t *testing.T) {
listers := configobservation.Listers{
OAuthLister_: configlistersv1.NewOAuthLister(indexer),
}
got, errs := ObserveTokenConfig(listers, events.NewInMemoryRecorder(t.Name()), tt.previouslyObservedConfig)
got, errs := ObserveTokenConfig(listers, events.NewInMemoryRecorder(t.Name(), clocktesting.NewFakePassiveClock(time.Now())), tt.previouslyObservedConfig)
if len(errs) > 0 {
t.Errorf("Expected 0 errors, got %v.", len(errs))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ package routersecret
import (
"reflect"
"testing"
"time"

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
corev1listers "k8s.io/client-go/listers/core/v1"
"k8s.io/client-go/tools/cache"
clocktesting "k8s.io/utils/clock/testing"

configv1 "github.com/openshift/api/config/v1"
configlistersv1 "github.com/openshift/client-go/config/listers/config/v1"
Expand Down Expand Up @@ -180,7 +182,7 @@ func TestObserveRouterSecret(t *testing.T) {
IngressLister: configlistersv1.NewIngressLister(indexer),
}

eventRecorder := events.NewInMemoryRecorder(tt.name)
eventRecorder := events.NewInMemoryRecorder(tt.name, clocktesting.NewFakePassiveClock(time.Now()))
gotConfig, errs := ObserveRouterSecret(listers, eventRecorder, tt.existingConfig)
if !reflect.DeepEqual(gotConfig, tt.expectedConfig) {
t.Errorf("ObserveRouterSecret() gotConfig = %v, want %v", gotConfig, tt.expectedConfig)
Expand Down
3 changes: 2 additions & 1 deletion pkg/controllers/routercerts/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"k8s.io/client-go/kubernetes/fake"
corev1listers "k8s.io/client-go/listers/core/v1"
"k8s.io/client-go/tools/cache"
clocktesting "k8s.io/utils/clock/testing"

configv1 "github.com/openshift/api/config/v1"
operatorv1 "github.com/openshift/api/operator/v1"
Expand Down Expand Up @@ -249,7 +250,7 @@ func TestValidateRouterCertificates(t *testing.T) {
systemCertPool: tc.systemCertPool,
secretsClient: secretsClient.CoreV1(),
}
err = controller.sync(context.TODO(), factory.NewSyncContext("testctx", events.NewInMemoryRecorder("test-recorder")))
err = controller.sync(context.TODO(), factory.NewSyncContext("testctx", events.NewInMemoryRecorder("test-recorder", clocktesting.NewFakePassiveClock(time.Now()))))
require.NoError(t, err)
_, s, _, _ := operatorClient.GetOperatorState()
require.Len(t, s.Conditions, 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import (
"context"
"fmt"
"testing"
"time"

clocktesting "k8s.io/utils/clock/testing"

operatorv1 "github.com/openshift/api/operator/v1"
"github.com/openshift/library-go/pkg/operator/v1helpers"
Expand Down Expand Up @@ -52,7 +55,7 @@ func Test_endpointAccessibleController_sync(t *testing.T) {
operatorClient: v1helpers.NewFakeOperatorClient(&operatorv1.OperatorSpec{}, &operatorv1.OperatorStatus{}, nil),
endpointListFn: tt.endpointListFn,
}
if err := c.sync(context.Background(), factory.NewSyncContext(tt.name, events.NewInMemoryRecorder(tt.name))); (err != nil) != tt.wantErr {
if err := c.sync(context.Background(), factory.NewSyncContext(tt.name, events.NewInMemoryRecorder(tt.name, clocktesting.NewFakePassiveClock(time.Now())))); (err != nil) != tt.wantErr {
t.Errorf("sync() error = %v, wantErr %v", err, tt.wantErr)
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ package auth

import (
"testing"
"time"

"github.com/stretchr/testify/require"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/tools/cache"
clocktesting "k8s.io/utils/clock/testing"

configv1 "github.com/openshift/api/config/v1"
configlistersv1 "github.com/openshift/client-go/config/listers/config/v1"
Expand Down Expand Up @@ -82,7 +84,7 @@ func TestObservedConfig(t *testing.T) {
require.NoError(t, err)
}

testRecorder := events.NewInMemoryRecorder("APIAudiencesTest")
testRecorder := events.NewInMemoryRecorder("APIAudiencesTest", clocktesting.NewFakePassiveClock(time.Now()))
listers := configobservation.Listers{
AuthConfigLister_: configlistersv1.NewAuthenticationLister(indexer),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"k8s.io/apimachinery/pkg/api/equality"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/tools/cache"
clocktesting "k8s.io/utils/clock/testing"

configv1 "github.com/openshift/api/config/v1"
configlistersv1 "github.com/openshift/client-go/config/listers/config/v1"
Expand Down Expand Up @@ -181,7 +182,7 @@ func TestObserveAccessTokenInactivityTimeout(t *testing.T) {

lister := testLister{lister: configlistersv1.NewOAuthLister(indexer)}

got, errs := ObserveAccessTokenInactivityTimeout(lister, events.NewInMemoryRecorder(t.Name()), tt.previouslyObservedConfig)
got, errs := ObserveAccessTokenInactivityTimeout(lister, events.NewInMemoryRecorder(t.Name(), clocktesting.NewFakePassiveClock(time.Now())), tt.previouslyObservedConfig)
if len(errs) != len(tt.errors) {
t.Errorf("Expected %d errors, got %d.", len(tt.errors), errs)
}
Expand All @@ -197,7 +198,7 @@ func TestObserveAccessTokenInactivityTimeout(t *testing.T) {
},
}

got, errs := ObserveAccessTokenInactivityTimeout(invalidLister{}, events.NewInMemoryRecorder("fakeRecorder"), existingConfig)
got, errs := ObserveAccessTokenInactivityTimeout(invalidLister{}, events.NewInMemoryRecorder("fakeRecorder", clocktesting.NewFakePassiveClock(time.Now())), existingConfig)

// There must be only one kind of error asserting the lister type.
if len(errs) != 1 {
Expand Down
6 changes: 3 additions & 3 deletions pkg/operator/replacement_starter.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import (
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/utils/clock"
)

type authenticationOperatorInput struct {
Expand Down Expand Up @@ -118,7 +117,7 @@ func CreateOperatorInputFromMOM(ctx context.Context, momInput libraryapplyconfig
Kind: "Deployment",
Namespace: "openshift-authentication-operator",
Name: "authentication-operator",
})
}, momInput.Clock)

return &authenticationOperatorInput{
kubeClient: kubeClient,
Expand Down Expand Up @@ -167,7 +166,7 @@ func CreateControllerInputFromControllerContext(ctx context.Context, controllerC
}

authenticationOperatorClient, dynamicInformers, err := genericoperatorclient.NewClusterScopedOperatorClient(
clock.RealClock{},
controllerContext.Clock,
controllerContext.KubeConfig,
operatorv1.GroupVersion.WithResource("authentications"),
operatorv1.GroupVersion.WithKind("Authentication"),
Expand All @@ -187,6 +186,7 @@ func CreateControllerInputFromControllerContext(ctx context.Context, controllerC
Namespace: "openshift-authentication-operator",
Name: "authentication-operator",
},
controllerContext.Clock,
)

return &authenticationOperatorInput{
Expand Down
4 changes: 3 additions & 1 deletion pkg/operator/workload/sync_openshift_oauth_apiserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io/ioutil"
"os"
"testing"
"time"

"github.com/google/go-cmp/cmp"

Expand All @@ -19,6 +20,7 @@ import (
"k8s.io/client-go/kubernetes/fake"
"k8s.io/client-go/kubernetes/scheme"
clientgotesting "k8s.io/client-go/testing"
clocktesting "k8s.io/utils/clock/testing"
)

var codec = scheme.Codecs.LegacyCodec(scheme.Scheme.PrioritizedVersionsAllGroups()...)
Expand Down Expand Up @@ -136,7 +138,7 @@ func TestSyncOAuthAPIServerDeployment(t *testing.T) {

for _, scenario := range scenarios {
t.Run(scenario.name, func(t *testing.T) {
eventRecorder := events.NewInMemoryRecorder("")
eventRecorder := events.NewInMemoryRecorder("", clocktesting.NewFakePassiveClock(time.Now()))
fakeKubeClient := fake.NewSimpleClientset()

target := &OAuthAPIServerWorkload{
Expand Down
Loading