Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⚠️ Deprecate pkg/config/v1alpha1 types #2149

Merged

Conversation

vincepri
Copy link
Member

This changeset sets deprecations and brings in changes so that settable controller options are now exported in the config.Controller struct. This package has been unmaintained for a while, and the inheritance logic makes it hard to rework the Options structs in the tree of controller runtime components.

Signed-off-by: Vince Prignano vincepri@redhat.com

This changeset sets deprecations and brings in changes so that settable
controller options are now exported in the config.Controller struct.
This package has been unmaintained for a while, and the inheritance
logic makes it hard to rework the Options structs in the tree of
controller runtime components.

Signed-off-by: Vince Prignano <vincepri@redhat.com>
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vincepri

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 27, 2023
Comment on lines +21 to +49
// Controller contains configuration options for a controller.
type Controller struct {
// GroupKindConcurrency is a map from a Kind to the number of concurrent reconciliation
// allowed for that controller.
//
// When a controller is registered within this manager using the builder utilities,
// users have to specify the type the controller reconciles in the For(...) call.
// If the object's kind passed matches one of the keys in this map, the concurrency
// for that controller is set to the number specified.
//
// The key is expected to be consistent in form with GroupKind.String(),
// e.g. ReplicaSet in apps group (regardless of version) would be `ReplicaSet.apps`.
GroupKindConcurrency map[string]int

// MaxConcurrentReconciles is the maximum number of concurrent Reconciles which can be run. Defaults to 1.
MaxConcurrentReconciles int

// CacheSyncTimeout refers to the time limit set to wait for syncing caches.
// Defaults to 2 minutes if not set.
CacheSyncTimeout time.Duration

// RecoverPanic indicates whether the panic caused by reconcile should be recovered.
// Defaults to the Controller.RecoverPanic setting from the Manager if unset.
RecoverPanic *bool

// NeedLeaderElection indicates whether the controller needs to use leader election.
// Defaults to true, which means the controller will use leader election.
NeedLeaderElection *bool
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These options have to live in a different package, otherwise controller <-> manager get into a import cycle

@vincepri
Copy link
Member Author

vincepri commented Jan 27, 2023 via email

@vincepri
Copy link
Member Author

/retest

@christopherhein
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 28, 2023
@sbueringer
Copy link
Member

/retest

Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall lgtm

@@ -37,7 +37,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/cluster"
"sigs.k8s.io/controller-runtime/pkg/config"
"sigs.k8s.io/controller-runtime/pkg/config/v1alpha1"
"sigs.k8s.io/controller-runtime/pkg/config/v1alpha1" //nolint:staticcheck // TODO: remove this import when v1alpha1 is removed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this comment seems redundant, given that the code won't compile anymore once v1alpha1 is removed

configv1alpha1 "sigs.k8s.io/controller-runtime/pkg/config/v1alpha1"
)

var _ = Describe("manager.Options", func() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we keep the tests while the code is still there and only deprecated?
(similar in other cases)

@sbueringer
Copy link
Member

sbueringer commented Jan 30, 2023

/retest

@k8s-ci-robot k8s-ci-robot merged commit 375a05e into kubernetes-sigs:master Jan 30, 2023
@sbueringer
Copy link
Member

sbueringer commented Jan 30, 2023

Didn't realize the restest merges it

@kerthcet
Copy link

Hi, controller-runtime users here, so if I depend on the configurations like ControllerWebhook, which is used to be part of the struct v1alpha1.ControllerManagerConfigurationSpec, once we removed the v1alpha1, what I have to do is implement the ControllerManagerConfigurationSpec myself, anything can help to mitigate this? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants