Skip to content

Commit 3dc9410

Browse files
committed
bump(k8s): fitting
1 parent 876a62b commit 3dc9410

File tree

16 files changed

+57
-33
lines changed

16 files changed

+57
-33
lines changed

pkg/config/serving/server.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ import (
1414
"k8s.io/apimachinery/pkg/version"
1515
genericapiserver "k8s.io/apiserver/pkg/server"
1616
genericapiserveroptions "k8s.io/apiserver/pkg/server/options"
17+
"k8s.io/apiserver/pkg/util/compatibility"
1718
"k8s.io/client-go/kubernetes"
18-
kasversion "k8s.io/component-base/version"
19+
basecompatibility "k8s.io/component-base/compatibility"
1920
"k8s.io/klog/v2"
2021

2122
configv1 "github.com/openshift/api/config/v1"
@@ -110,13 +111,13 @@ func assertAPIConnection(ctx context.Context, kubeClient *kubernetes.Clientset,
110111
// DefaultBuildEffectiveVersion returns the MutableEffectiveVersion based on the
111112
// current build information.
112113
// Similar to version.DefaultBuildEffectiveVersion
113-
func defaultBuildEffectiveVersion(versionInfo *version.Info) kasversion.MutableEffectiveVersion {
114+
func defaultBuildEffectiveVersion(versionInfo *version.Info) basecompatibility.MutableEffectiveVersion {
114115
if versionInfo != nil {
115116
// major.minor passed through gitVersion
116117
parsedVersion, err := utilversion.Parse(versionInfo.String())
117118
if err == nil && (parsedVersion.Major() != 0 || parsedVersion.Minor() != 0) {
118-
return kasversion.NewEffectiveVersion(versionInfo.String())
119+
return basecompatibility.NewEffectiveVersionFromString(versionInfo.String(), "", "")
119120
}
120121
}
121-
return kasversion.DefaultKubeEffectiveVersion()
122+
return compatibility.DefaultBuildEffectiveVersion()
122123
}

pkg/manifestclient/list_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func TestFilterByLabelSelector(t *testing.T) {
7171
}
7272

7373
if !equality.Semantic.DeepEqual(result, tc.expectedOutput) {
74-
t.Errorf(diff.ObjectDiff(tc.expectedOutput, result))
74+
t.Errorf("%s", diff.ObjectDiff(tc.expectedOutput, result))
7575
}
7676
})
7777
}

pkg/markdown/markdown.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ func (m *Markdown) Bytes() []byte {
3232
fmt.Fprint(ret, m.tableOfContents.String())
3333
fmt.Fprintln(ret, "")
3434
fmt.Fprintln(ret, "")
35-
fmt.Fprintf(ret, m.body.String())
35+
fmt.Fprintf(ret, "%s", m.body.String())
3636
return ret.Bytes()
3737
}
3838

3939
// ExactBytes returns markdown with table of contents or title. Useful for embedding.
4040
func (m *Markdown) ExactBytes() []byte {
4141
ret := &bytes.Buffer{}
42-
fmt.Fprintf(ret, m.body.String())
42+
fmt.Fprintf(ret, "%s", m.body.String())
4343
return ret.Bytes()
4444
}
4545

pkg/operator/apiserver/controller/apiservice/apiservice_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ func (c *APIServiceController) syncEnabledAPIServices(ctx context.Context, enabl
246246
}
247247
if len(availableConditionMessages) > 0 {
248248
sort.Sort(sort.StringSlice(availableConditionMessages))
249-
return fmt.Errorf(strings.Join(availableConditionMessages, "\n"))
249+
return fmt.Errorf("%s", strings.Join(availableConditionMessages, "\n"))
250250
}
251251

252252
// if the apiservices themselves check out ok, try to actually hit the discovery endpoints. We have a history in clusterup
@@ -258,7 +258,7 @@ func (c *APIServiceController) syncEnabledAPIServices(ctx context.Context, enabl
258258

259259
if len(availableConditionMessages) > 0 {
260260
sort.Sort(sort.StringSlice(availableConditionMessages))
261-
return fmt.Errorf(strings.Join(availableConditionMessages, "\n"))
261+
return fmt.Errorf("%s", strings.Join(availableConditionMessages, "\n"))
262262
}
263263

264264
return nil

pkg/operator/encryption/controllers/key_controller_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ import (
55
"encoding/base64"
66
"errors"
77
"fmt"
8-
clocktesting "k8s.io/utils/clock/testing"
98
"testing"
109
"time"
1110

11+
clocktesting "k8s.io/utils/clock/testing"
12+
1213
corev1 "k8s.io/api/core/v1"
1314
"k8s.io/apimachinery/pkg/api/equality"
1415
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -114,7 +115,7 @@ func TestKeyController(t *testing.T) {
114115
expectedSecret := encryptiontesting.CreateEncryptionKeySecretWithKeyFromExistingSecret(targetNamespace, []schema.GroupResource{}, 1, actualSecret)
115116
expectedSecret.Annotations["encryption.apiserver.operator.openshift.io/internal-reason"] = "secrets-key-does-not-exist" // TODO: Fix this
116117
if !equality.Semantic.DeepEqual(actualSecret, expectedSecret) {
117-
ts.Errorf(diff.ObjectDiff(expectedSecret, actualSecret))
118+
ts.Errorf("%s", diff.ObjectDiff(expectedSecret, actualSecret))
118119
}
119120
if err := encryptiontesting.ValidateEncryptionKey(actualSecret); err != nil {
120121
ts.Error(err)
@@ -192,7 +193,7 @@ func TestKeyController(t *testing.T) {
192193
expectedSecret := encryptiontesting.CreateEncryptionKeySecretWithKeyFromExistingSecret(targetNamespace, []schema.GroupResource{}, 6, actualSecret)
193194
expectedSecret.Annotations["encryption.apiserver.operator.openshift.io/internal-reason"] = "secrets-rotation-interval-has-passed"
194195
if !equality.Semantic.DeepEqual(actualSecret, expectedSecret) {
195-
ts.Errorf(diff.ObjectDiff(expectedSecret, actualSecret))
196+
ts.Errorf("%s", diff.ObjectDiff(expectedSecret, actualSecret))
196197
}
197198
if err := encryptiontesting.ValidateEncryptionKey(actualSecret); err != nil {
198199
ts.Error(err)
@@ -309,7 +310,7 @@ func TestKeyController(t *testing.T) {
309310
expectedSecret := encryptiontesting.CreateEncryptionKeySecretWithKeyFromExistingSecretWithMode(targetNamespace, []schema.GroupResource{}, 6, actualSecret, "aesgcm")
310311
expectedSecret.Annotations["encryption.apiserver.operator.openshift.io/internal-reason"] = "secrets-encryption-mode-changed"
311312
if !equality.Semantic.DeepEqual(actualSecret, expectedSecret) {
312-
ts.Errorf(diff.ObjectDiff(expectedSecret, actualSecret))
313+
ts.Errorf("%s", diff.ObjectDiff(expectedSecret, actualSecret))
313314
}
314315
if err := encryptiontesting.ValidateEncryptionKey(actualSecret); err != nil {
315316
ts.Error(err)

pkg/operator/encryption/statemachine/transition.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ func getDesiredEncryptionState(oldEncryptionConfig *apiserverconfigv1.Encryption
196196
// Note: because read-keys are consistent, currentlyEncryptedGRs equals toBeEncryptedGRs
197197
allMigrated, _, reason := state.MigratedFor(currentlyEncryptedGRs, writeKey)
198198
if !allMigrated {
199-
klog.V(4).Infof(reason)
199+
klog.V(4).Infof("%s", reason)
200200
return desiredEncryptionState
201201
}
202202
for gr := range desiredEncryptionState {

pkg/operator/genericoperatorclient/dynamic_operator_client_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func TestSetOperatorSpecFromUnstructured(t *testing.T) {
104104
t.Fatal(err)
105105
}
106106
if !reflect.DeepEqual(test.in, test.expected) {
107-
t.Errorf(diff.ObjectDiff(test.in, test.expected))
107+
t.Errorf("%s", diff.ObjectDiff(test.in, test.expected))
108108
}
109109
})
110110
}
@@ -208,7 +208,7 @@ func TestSetOperatorStatusFromUnstructured(t *testing.T) {
208208
t.Fatal(err)
209209
}
210210
if !reflect.DeepEqual(test.in, test.expected) {
211-
t.Errorf(diff.ObjectGoPrintDiff(test.in, test.expected))
211+
t.Errorf("%s", diff.ObjectGoPrintDiff(test.in, test.expected))
212212
}
213213
})
214214
}

pkg/operator/latencyprofilecontroller/controller.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ package latencyprofilecontroller
33
import (
44
"context"
55
"fmt"
6-
applyoperatorv1 "github.com/openshift/client-go/operator/applyconfigurations/operator/v1"
76
"time"
87

8+
applyoperatorv1 "github.com/openshift/client-go/operator/applyconfigurations/operator/v1"
9+
910
apierrors "k8s.io/apimachinery/pkg/api/errors"
1011

1112
configv1 "github.com/openshift/api/config/v1"
@@ -147,7 +148,7 @@ func (c *LatencyProfileController) sync(ctx context.Context, syncCtx factory.Syn
147148
if err != nil {
148149
return err
149150
}
150-
return fmt.Errorf(rejectMsg)
151+
return fmt.Errorf("%s", rejectMsg)
151152
}
152153
}
153154

pkg/operator/staticpod/controller/guard/guard_controller_test.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ func (f FakeInfrastructureInformer) Lister() configlistersv1.InfrastructureListe
4343

4444
var _ configv1informers.InfrastructureInformer = &FakeInfrastructureInformer{}
4545

46+
var _ cache.SharedIndexInformer = FakeInfrastructureSharedInformer{}
47+
4648
type FakeInfrastructureLister struct {
4749
InfrastructureLister_ configlistersv1.InfrastructureLister
4850
}
@@ -74,17 +76,24 @@ func (i FakeInfrastructureSharedInformer) GetIndexer() cache.Indexer
7476
func (i FakeInfrastructureSharedInformer) AddEventHandler(handler cache.ResourceEventHandler) (cache.ResourceEventHandlerRegistration, error) {
7577
return nil, nil
7678
}
79+
func (i FakeInfrastructureSharedInformer) AddEventHandlerWithOptions(handler cache.ResourceEventHandler, options cache.HandlerOptions) (cache.ResourceEventHandlerRegistration, error) {
80+
return nil, nil
81+
}
7782
func (i FakeInfrastructureSharedInformer) AddEventHandlerWithResyncPeriod(handler cache.ResourceEventHandler, resyncPeriod time.Duration) (cache.ResourceEventHandlerRegistration, error) {
7883
return nil, nil
7984
}
80-
func (i FakeInfrastructureSharedInformer) GetStore() cache.Store { return nil }
81-
func (i FakeInfrastructureSharedInformer) GetController() cache.Controller { return nil }
82-
func (i FakeInfrastructureSharedInformer) Run(stopCh <-chan struct{}) {}
83-
func (i FakeInfrastructureSharedInformer) HasSynced() bool { return i.HasSynced_ }
84-
func (i FakeInfrastructureSharedInformer) LastSyncResourceVersion() string { return "" }
85+
func (i FakeInfrastructureSharedInformer) GetStore() cache.Store { return nil }
86+
func (i FakeInfrastructureSharedInformer) GetController() cache.Controller { return nil }
87+
func (i FakeInfrastructureSharedInformer) Run(stopCh <-chan struct{}) {}
88+
func (i FakeInfrastructureSharedInformer) RunWithContext(ctx context.Context) {}
89+
func (i FakeInfrastructureSharedInformer) HasSynced() bool { return i.HasSynced_ }
90+
func (i FakeInfrastructureSharedInformer) LastSyncResourceVersion() string { return "" }
8591
func (i FakeInfrastructureSharedInformer) SetWatchErrorHandler(handler cache.WatchErrorHandler) error {
8692
return nil
8793
}
94+
func (i FakeInfrastructureSharedInformer) SetWatchErrorHandlerWithContext(ctx cache.WatchErrorHandlerWithContext) error {
95+
return nil
96+
}
8897
func (i FakeInfrastructureSharedInformer) SetTransform(f cache.TransformFunc) error {
8998
return nil
9099
}

pkg/operator/staticpod/controller/missingstaticpod/missing_static_pod_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ func (c *missingStaticPodController) sync(ctx context.Context, syncCtx factory.S
178178
}
179179

180180
if len(errors) > 0 {
181-
return fmt.Errorf(strings.Join(errors, "\n"))
181+
return fmt.Errorf("%s", strings.Join(errors, "\n"))
182182
}
183183

184184
return nil

0 commit comments

Comments
 (0)