diff --git a/plugin/pkg/client/auth/exec/exec_test.go b/plugin/pkg/client/auth/exec/exec_test.go index ea6ef781..291590ec 100644 --- a/plugin/pkg/client/auth/exec/exec_test.go +++ b/plugin/pkg/client/auth/exec/exec_test.go @@ -1085,7 +1085,7 @@ func TestTLSCredentials(t *testing.T) { Status: &clientauthentication.ExecCredentialStatus{ ClientCertificateData: string(cert), ClientKeyData: string(key), - ExpirationTimestamp: &v1.Time{now.Add(time.Hour)}, + ExpirationTimestamp: &v1.Time{Time: now.Add(time.Hour)}, }, } get(t, "valid TLS cert", false) @@ -1097,7 +1097,7 @@ func TestTLSCredentials(t *testing.T) { Status: &clientauthentication.ExecCredentialStatus{ ClientCertificateData: string(nCert), ClientKeyData: string(nKey), - ExpirationTimestamp: &v1.Time{now.Add(time.Hour)}, + ExpirationTimestamp: &v1.Time{Time: now.Add(time.Hour)}, }, } get(t, "untrusted TLS cert", true) @@ -1107,7 +1107,7 @@ func TestTLSCredentials(t *testing.T) { Status: &clientauthentication.ExecCredentialStatus{ ClientCertificateData: string(cert), ClientKeyData: string(key), - ExpirationTimestamp: &v1.Time{now.Add(time.Hour)}, + ExpirationTimestamp: &v1.Time{Time: now.Add(time.Hour)}, }, } get(t, "valid TLS cert again", false) diff --git a/tools/auth/exec/types_test.go b/tools/auth/exec/types_test.go index 4e33b67c..bf08da93 100644 --- a/tools/auth/exec/types_test.go +++ b/tools/auth/exec/types_test.go @@ -35,6 +35,7 @@ func TestClientAuthenticationClusterTypesAreSynced(t *testing.T) { clientauthenticationv1beta1.Cluster{}, clientauthenticationv1.Cluster{}, } { + cluster := cluster t.Run(fmt.Sprintf("%T", cluster), func(t *testing.T) { t.Parallel() testClientAuthenticationClusterTypesAreSynced(t, cluster) diff --git a/tools/events/event_recorder.go b/tools/events/event_recorder.go index 13284374..17d05327 100644 --- a/tools/events/event_recorder.go +++ b/tools/events/event_recorder.go @@ -41,7 +41,7 @@ type recorderImpl struct { } func (recorder *recorderImpl) Eventf(regarding runtime.Object, related runtime.Object, eventtype, reason, action, note string, args ...interface{}) { - timestamp := metav1.MicroTime{time.Now()} + timestamp := metav1.MicroTime{Time: time.Now()} message := fmt.Sprintf(note, args...) refRegarding, err := reference.GetReference(recorder.scheme, regarding) if err != nil { diff --git a/tools/events/eventseries_test.go b/tools/events/eventseries_test.go index b51811c9..401865f8 100644 --- a/tools/events/eventseries_test.go +++ b/tools/events/eventseries_test.go @@ -92,7 +92,7 @@ func TestEventSeriesf(t *testing.T) { Name: "foo", Namespace: "baz", }, - EventTime: metav1.MicroTime{time.Now()}, + EventTime: metav1.MicroTime{Time: time.Now()}, ReportingController: "eventTest", ReportingInstance: "eventTest-" + hostname, Action: "started", @@ -296,7 +296,7 @@ func TestFinishSeries(t *testing.T) { cache := map[eventKey]*eventsv1.Event{} eventBroadcaster := newBroadcaster(&testEvents, 0, cache).(*eventBroadcasterImpl) recorder := eventBroadcaster.NewRecorder(scheme.Scheme, "k8s.io/kube-foo").(*recorderImpl) - cachedEvent := recorder.makeEvent(regarding, related, metav1.MicroTime{time.Now()}, v1.EventTypeNormal, "test", "some verbose message: 1", "eventTest", "eventTest-"+hostname, "started") + cachedEvent := recorder.makeEvent(regarding, related, metav1.MicroTime{Time: time.Now()}, v1.EventTypeNormal, "test", "some verbose message: 1", "eventTest", "eventTest-"+hostname, "started") nonFinishedEvent := cachedEvent.DeepCopy() nonFinishedEvent.ReportingController = "nonFinished-controller" cachedEvent.Series = &eventsv1.EventSeries{ @@ -382,7 +382,7 @@ func TestRefreshExistingEventSeries(t *testing.T) { cache := map[eventKey]*eventsv1.Event{} eventBroadcaster := newBroadcaster(&testEvents, 0, cache).(*eventBroadcasterImpl) recorder := eventBroadcaster.NewRecorder(scheme.Scheme, "k8s.io/kube-foo").(*recorderImpl) - cachedEvent := recorder.makeEvent(regarding, related, metav1.MicroTime{time.Now()}, v1.EventTypeNormal, "test", "some verbose message: 1", "eventTest", "eventTest-"+hostname, "started") + cachedEvent := recorder.makeEvent(regarding, related, metav1.MicroTime{Time: time.Now()}, v1.EventTypeNormal, "test", "some verbose message: 1", "eventTest", "eventTest-"+hostname, "started") cachedEvent.Series = &eventsv1.EventSeries{ Count: 10, LastObservedTime: LastObservedTime, diff --git a/tools/leaderelection/leaderelection_test.go b/tools/leaderelection/leaderelection_test.go index aa0bd61b..ed4e89ae 100644 --- a/tools/leaderelection/leaderelection_test.go +++ b/tools/leaderelection/leaderelection_test.go @@ -20,7 +20,6 @@ import ( "context" "encoding/json" "fmt" - "k8s.io/apimachinery/pkg/util/wait" "sync" "testing" "time" @@ -32,6 +31,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/diff" + "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/kubernetes/fake" fakeclient "k8s.io/client-go/testing" rl "k8s.io/client-go/tools/leaderelection/resourcelock" @@ -362,8 +362,8 @@ func TestLeaseSpecToLeaderElectionRecordRoundTrip(t *testing.T) { oldSpec := coordinationv1.LeaseSpec{ HolderIdentity: &holderIdentity, LeaseDurationSeconds: &leaseDurationSeconds, - AcquireTime: &metav1.MicroTime{time.Now()}, - RenewTime: &metav1.MicroTime{time.Now()}, + AcquireTime: &metav1.MicroTime{Time: time.Now()}, + RenewTime: &metav1.MicroTime{Time: time.Now()}, LeaseTransitions: &leaseTransitions, } diff --git a/tools/leaderelection/resourcelock/leaselock.go b/tools/leaderelection/resourcelock/leaselock.go index 185ef0e5..8a9d7d60 100644 --- a/tools/leaderelection/resourcelock/leaselock.go +++ b/tools/leaderelection/resourcelock/leaselock.go @@ -117,10 +117,10 @@ func LeaseSpecToLeaderElectionRecord(spec *coordinationv1.LeaseSpec) *LeaderElec r.LeaderTransitions = int(*spec.LeaseTransitions) } if spec.AcquireTime != nil { - r.AcquireTime = metav1.Time{spec.AcquireTime.Time} + r.AcquireTime = metav1.Time{Time: spec.AcquireTime.Time} } if spec.RenewTime != nil { - r.RenewTime = metav1.Time{spec.RenewTime.Time} + r.RenewTime = metav1.Time{Time: spec.RenewTime.Time} } return &r @@ -132,8 +132,8 @@ func LeaderElectionRecordToLeaseSpec(ler *LeaderElectionRecord) coordinationv1.L return coordinationv1.LeaseSpec{ HolderIdentity: &ler.HolderIdentity, LeaseDurationSeconds: &leaseDurationSeconds, - AcquireTime: &metav1.MicroTime{ler.AcquireTime.Time}, - RenewTime: &metav1.MicroTime{ler.RenewTime.Time}, + AcquireTime: &metav1.MicroTime{Time: ler.AcquireTime.Time}, + RenewTime: &metav1.MicroTime{Time: ler.RenewTime.Time}, LeaseTransitions: &leaseTransitions, } }