Skip to content

Commit

Permalink
Merge pull request #739 from atiratree/workload-conditions-bump
Browse files Browse the repository at this point in the history
OCPBUGS-23435: bump library-go to bring in workload-conditions fix
  • Loading branch information
openshift-merge-bot[bot] authored Nov 25, 2024
2 parents deb922d + 32069a6 commit 75c7842
Show file tree
Hide file tree
Showing 50 changed files with 747 additions and 223 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ require (
github.com/openshift/api v0.0.0-20241001152557-e415140e5d5f
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-20241120135057-fc703a7407c9
github.com/openshift/multi-operator-manager v0.0.0-20241119235446-3c965870ef94
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
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ github.com/openshift/build-machinery-go v0.0.0-20241031155326-6ae126a9cb72 h1:kM
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-20241120135057-fc703a7407c9 h1:bwIqO3LDkumwfDKTMRzixNHKUqU7yaKTTAKwENi6JOY=
github.com/openshift/library-go v0.0.0-20241120135057-fc703a7407c9/go.mod h1:9B1MYPoLtP9tqjWxcbUNVpwxy68zOH/3EIP6c31dAM0=
github.com/openshift/multi-operator-manager v0.0.0-20241119235446-3c965870ef94 h1:9Z5HQo1KSQogIpQ2tDzrCk4+sDjL/xF+YXBrDP4R36k=
github.com/openshift/multi-operator-manager v0.0.0-20241119235446-3c965870ef94/go.mod h1:Fn/rmcwj4bCuS11UT5TZvzONt7qTjzcd9BCSQkIwQOI=
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

0 comments on commit 75c7842

Please sign in to comment.