Skip to content

Commit

Permalink
Bump controller-runtime to use new Kubernetes Go libraries
Browse files Browse the repository at this point in the history
Co-authored-by: Mike Fedosin <mfedosin@redhat.com>
Co-authored-by: Oscar Utbult <oscar.utbult@gmail.com>
  • Loading branch information
oscr and Fedosin committed Sep 12, 2022
1 parent 59afdb6 commit ea50ce4
Show file tree
Hide file tree
Showing 46 changed files with 2,508 additions and 730 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ SETUP_ENVTEST_BIN := setup-envtest
SETUP_ENVTEST := $(abspath $(TOOLS_BIN_DIR)/$(SETUP_ENVTEST_BIN)-$(SETUP_ENVTEST_VER))
SETUP_ENVTEST_PKG := sigs.k8s.io/controller-runtime/tools/setup-envtest

CONTROLLER_GEN_VER := v0.9.1
CONTROLLER_GEN_VER := v0.9.2
CONTROLLER_GEN_BIN := controller-gen
CONTROLLER_GEN := $(abspath $(TOOLS_BIN_DIR)/$(CONTROLLER_GEN_BIN)-$(CONTROLLER_GEN_VER))
CONTROLLER_GEN_PKG := sigs.k8s.io/controller-tools/cmd/controller-gen
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ type fakeClient struct {
deleteError error
}

func (fc *fakeClient) Get(ctx context.Context, key client.ObjectKey, obj client.Object) error {
func (fc *fakeClient) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error {
if fc.getError != nil {
return fc.getError
}
Expand Down
5 changes: 3 additions & 2 deletions bootstrap/kubeadm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"k8s.io/client-go/tools/leaderelection/resourcelock"
cliflag "k8s.io/component-base/cli/flag"
"k8s.io/component-base/logs"
logapiv1 "k8s.io/component-base/logs/api/v1"
_ "k8s.io/component-base/logs/json/register"
"k8s.io/klog/v2"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down Expand Up @@ -90,7 +91,7 @@ var (
// InitFlags initializes this manager's flags.
func InitFlags(fs *pflag.FlagSet) {
logs.AddFlags(fs, logs.SkipLoggingConfigurationFlags())
logOptions.AddFlags(fs)
logapiv1.AddFlags(logOptions, fs)

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

if err := logOptions.ValidateAndApply(nil); err != nil {
if err := logapiv1.ValidateAndApply(logOptions, nil); err != nil {
setupLog.Error(err, "unable to start manager")
os.Exit(1)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/clusterctl/client/cluster/internal/dryrun/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func NewClient(apiReader client.Reader, objs []client.Object) *Client {
// Get retrieves an object for the given object key from the internal object tracker.
// If the object does not exist in the internal object tracker it tries to fetch the object
// from the Kubernetes Cluster using the apiReader client (if apiReader is not nil).
func (c *Client) Get(ctx context.Context, key client.ObjectKey, obj client.Object) error {
func (c *Client) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error {
if err := c.fakeClient.Get(ctx, key, obj); err != nil {
// If the object is not found by the fake client, get the object
// using the apiReader.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cmd/clusterctl/config/manifest/clusterctl-api.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config/crd/bases/cluster.x-k8s.io_clusterclasses.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config/crd/bases/cluster.x-k8s.io_clusters.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config/crd/bases/cluster.x-k8s.io_machinedeployments.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config/crd/bases/cluster.x-k8s.io_machinehealthchecks.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 25 additions & 25 deletions config/crd/bases/cluster.x-k8s.io_machinepools.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config/crd/bases/cluster.x-k8s.io_machines.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config/crd/bases/cluster.x-k8s.io_machinesets.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config/crd/bases/ipam.cluster.x-k8s.io_ipaddresses.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion controlplane/kubeadm/internal/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (e *RemoteClusterConnectionError) Error() string { return e.Name + ": " + e
func (e *RemoteClusterConnectionError) Unwrap() error { return e.Err }

// Get implements client.Reader.
func (m *Management) Get(ctx context.Context, key client.ObjectKey, obj client.Object) error {
func (m *Management) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error {
return m.Client.Get(ctx, key, obj)
}

Expand Down
2 changes: 1 addition & 1 deletion controlplane/kubeadm/internal/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ type fakeClient struct {
listErr error
}

func (f *fakeClient) Get(_ context.Context, key client.ObjectKey, obj client.Object) error {
func (f *fakeClient) Get(_ context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error {
f.getCalled = true
if f.getErr != nil {
return f.getErr
Expand Down
2 changes: 1 addition & 1 deletion controlplane/kubeadm/internal/controllers/fakes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type fakeManagementCluster struct {
Reader client.Reader
}

func (f *fakeManagementCluster) Get(ctx context.Context, key client.ObjectKey, obj client.Object) error {
func (f *fakeManagementCluster) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error {
return f.Reader.Get(ctx, key, obj)
}

Expand Down
5 changes: 3 additions & 2 deletions controlplane/kubeadm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (
"k8s.io/client-go/tools/leaderelection/resourcelock"
cliflag "k8s.io/component-base/cli/flag"
"k8s.io/component-base/logs"
logapiv1 "k8s.io/component-base/logs/api/v1"
_ "k8s.io/component-base/logs/json/register"
"k8s.io/klog/v2"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down Expand Up @@ -94,7 +95,7 @@ var (
// InitFlags initializes the flags.
func InitFlags(fs *pflag.FlagSet) {
logs.AddFlags(fs, logs.SkipLoggingConfigurationFlags())
logOptions.AddFlags(fs)
logapiv1.AddFlags(logOptions, fs)

fs.StringVar(&metricsBindAddr, "metrics-bind-addr", "localhost:8080",
"The address the metric endpoint binds to.")
Expand Down Expand Up @@ -148,7 +149,7 @@ func main() {
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
pflag.Parse()

if err := logOptions.ValidateAndApply(nil); err != nil {
if err := logapiv1.ValidateAndApply(logOptions, nil); err != nil {
setupLog.Error(err, "unable to start manager")
os.Exit(1)
}
Expand Down

0 comments on commit ea50ce4

Please sign in to comment.