Skip to content

Commit eb5ae53

Browse files
authored
Merge pull request #7211 from oscr/k8s_v125
🌱 Bump controller-runtime to use new Kubernetes Go libraries
2 parents 59afdb6 + 9e55898 commit eb5ae53

File tree

43 files changed

+534
-1390
lines changed

Some content is hidden

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

43 files changed

+534
-1390
lines changed

.golangci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ linters-settings:
6363
alias: apierrors
6464
- pkg: k8s.io/apimachinery/pkg/util/errors
6565
alias: kerrors
66+
- pkg: k8s.io/component-base/logs/api/v1
67+
alias: logsv1
6668
# Controller Runtime
6769
- pkg: sigs.k8s.io/controller-runtime
6870
alias: ctrl

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ SETUP_ENVTEST_BIN := setup-envtest
8585
SETUP_ENVTEST := $(abspath $(TOOLS_BIN_DIR)/$(SETUP_ENVTEST_BIN)-$(SETUP_ENVTEST_VER))
8686
SETUP_ENVTEST_PKG := sigs.k8s.io/controller-runtime/tools/setup-envtest
8787

88-
CONTROLLER_GEN_VER := v0.9.1
88+
CONTROLLER_GEN_VER := v0.9.2
8989
CONTROLLER_GEN_BIN := controller-gen
9090
CONTROLLER_GEN := $(abspath $(TOOLS_BIN_DIR)/$(CONTROLLER_GEN_BIN)-$(CONTROLLER_GEN_VER))
9191
CONTROLLER_GEN_PKG := sigs.k8s.io/controller-tools/cmd/controller-gen

bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigtemplates.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bootstrap/kubeadm/internal/locking/control_plane_init_mutex_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,11 @@ type fakeClient struct {
287287
deleteError error
288288
}
289289

290-
func (fc *fakeClient) Get(ctx context.Context, key client.ObjectKey, obj client.Object) error {
290+
func (fc *fakeClient) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error {
291291
if fc.getError != nil {
292292
return fc.getError
293293
}
294-
return fc.Client.Get(ctx, key, obj)
294+
return fc.Client.Get(ctx, key, obj, opts...)
295295
}
296296

297297
func (fc *fakeClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error {

bootstrap/kubeadm/main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import (
3535
"k8s.io/client-go/tools/leaderelection/resourcelock"
3636
cliflag "k8s.io/component-base/cli/flag"
3737
"k8s.io/component-base/logs"
38+
logsv1 "k8s.io/component-base/logs/api/v1"
3839
_ "k8s.io/component-base/logs/json/register"
3940
"k8s.io/klog/v2"
4041
ctrl "sigs.k8s.io/controller-runtime"
@@ -90,7 +91,7 @@ var (
9091
// InitFlags initializes this manager's flags.
9192
func InitFlags(fs *pflag.FlagSet) {
9293
logs.AddFlags(fs, logs.SkipLoggingConfigurationFlags())
93-
logOptions.AddFlags(fs)
94+
logsv1.AddFlags(logOptions, fs)
9495

9596
fs.StringVar(&metricsBindAddr, "metrics-bind-addr", "localhost:8080",
9697
"The address the metric endpoint binds to.")
@@ -145,7 +146,7 @@ func main() {
145146
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
146147
pflag.Parse()
147148

148-
if err := logOptions.ValidateAndApply(nil); err != nil {
149+
if err := logsv1.ValidateAndApply(logOptions, nil); err != nil {
149150
setupLog.Error(err, "unable to start manager")
150151
os.Exit(1)
151152
}

cmd/clusterctl/client/cluster/internal/dryrun/client.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,12 @@ func NewClient(apiReader client.Reader, objs []client.Object) *Client {
127127
// Get retrieves an object for the given object key from the internal object tracker.
128128
// If the object does not exist in the internal object tracker it tries to fetch the object
129129
// from the Kubernetes Cluster using the apiReader client (if apiReader is not nil).
130-
func (c *Client) Get(ctx context.Context, key client.ObjectKey, obj client.Object) error {
131-
if err := c.fakeClient.Get(ctx, key, obj); err != nil {
130+
func (c *Client) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error {
131+
if err := c.fakeClient.Get(ctx, key, obj, opts...); err != nil {
132132
// If the object is not found by the fake client, get the object
133133
// using the apiReader.
134134
if apierrors.IsNotFound(err) && c.apiReader != nil {
135-
return c.apiReader.Get(ctx, key, obj)
135+
return c.apiReader.Get(ctx, key, obj, opts...)
136136
}
137137
return err
138138
}

cmd/clusterctl/config/crd/bases/clusterctl.cluster.x-k8s.io_metadata.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/clusterctl/config/crd/bases/clusterctl.cluster.x-k8s.io_providers.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/clusterctl/config/manifest/clusterctl-api.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)