Skip to content

Commit 74dab4b

Browse files
committed
remove deprecated flags in controller manager options
Signed-off-by: dahuo98 <sxdahuo@gmail.com>
1 parent 105c6ef commit 74dab4b

File tree

3 files changed

+5
-37
lines changed

3 files changed

+5
-37
lines changed

cmd/controller-manager/app/options/options.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,6 @@ func (o *Options) AddFlags(flags *pflag.FlagSet, allControllers, disabledByDefau
185185
flags.DurationVar(&o.LeaderElection.RetryPeriod.Duration, "leader-elect-retry-period", defaultElectionRetryPeriod.Duration, ""+
186186
"The duration the clients should wait between attempting acquisition and renewal "+
187187
"of a leadership. This is only applicable if leader election is enabled.")
188-
flags.DurationVar(&o.ClusterLeaseDuration.Duration, "cluster-lease-duration", 40*time.Second,
189-
"Specifies the expiration period of a cluster lease.")
190-
_ = flags.MarkDeprecated("cluster-lease-duration", "The flag --cluster-lease-duration has been marked deprecated because it has never been used, and will be removed in a future release.")
191-
flags.Float64Var(&o.ClusterLeaseRenewIntervalFraction, "cluster-lease-renew-interval-fraction", 0.25,
192-
"Specifies the cluster lease renew interval fraction.")
193-
_ = flags.MarkDeprecated("cluster-lease-renew-interval-fraction", "The flag --cluster-lease-renew-interval-fraction has been marked deprecated because it has never been used, and will be removed in a future release.")
194188
flags.DurationVar(&o.ClusterSuccessThreshold.Duration, "cluster-success-threshold", 30*time.Second, "The duration of successes for the cluster to be considered healthy after recovery.")
195189
flags.DurationVar(&o.ClusterFailureThreshold.Duration, "cluster-failure-threshold", 30*time.Second, "The duration of failure for the cluster to be considered unhealthy.")
196190
flags.DurationVar(&o.ClusterMonitorPeriod.Duration, "cluster-monitor-period", 5*time.Second,

cmd/controller-manager/app/options/validation.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ func (o *Options) Validate() field.ErrorList {
3737
if o.ClusterStatusUpdateFrequency.Duration <= 0 {
3838
errs = append(errs, field.Invalid(newPath.Child("ClusterStatusUpdateFrequency"), o.ClusterStatusUpdateFrequency, "must be greater than 0"))
3939
}
40-
if o.ClusterLeaseDuration.Duration <= 0 {
41-
errs = append(errs, field.Invalid(newPath.Child("ClusterLeaseDuration"), o.ClusterLeaseDuration, "must be greater than 0"))
42-
}
43-
if o.ClusterLeaseRenewIntervalFraction <= 0 || o.ClusterLeaseRenewIntervalFraction >= 1 {
44-
errs = append(errs, field.Invalid(newPath.Child("ClusterLeaseRenewIntervalFraction"), o.ClusterLeaseRenewIntervalFraction, "must be greater than 0 and less than 1"))
45-
}
4640
if o.ClusterMonitorPeriod.Duration <= 0 {
4741
errs = append(errs, field.Invalid(newPath.Child("ClusterMonitorPeriod"), o.ClusterMonitorPeriod, "must be greater than 0"))
4842
}

cmd/controller-manager/app/options/validation_test.go

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,11 @@ type ModifyOptions func(option *Options)
3030
// New an Options with default parameters
3131
func New(modifyOptions ModifyOptions) Options {
3232
option := Options{
33-
SkippedPropagatingAPIs: "cluster.karmada.io;policy.karmada.io;work.karmada.io",
34-
ClusterStatusUpdateFrequency: metav1.Duration{Duration: 10 * time.Second},
35-
ClusterLeaseDuration: metav1.Duration{Duration: 10 * time.Second},
36-
ClusterMonitorPeriod: metav1.Duration{Duration: 10 * time.Second},
37-
ClusterMonitorGracePeriod: metav1.Duration{Duration: 10 * time.Second},
38-
ClusterStartupGracePeriod: metav1.Duration{Duration: 10 * time.Second},
39-
ClusterLeaseRenewIntervalFraction: 0.25,
33+
SkippedPropagatingAPIs: "cluster.karmada.io;policy.karmada.io;work.karmada.io",
34+
ClusterStatusUpdateFrequency: metav1.Duration{Duration: 10 * time.Second},
35+
ClusterMonitorPeriod: metav1.Duration{Duration: 10 * time.Second},
36+
ClusterMonitorGracePeriod: metav1.Duration{Duration: 10 * time.Second},
37+
ClusterStartupGracePeriod: metav1.Duration{Duration: 10 * time.Second},
4038
FederatedResourceQuotaOptions: FederatedResourceQuotaOptions{
4139
ResourceQuotaSyncPeriod: metav1.Duration{
4240
Duration: 10 * time.Second,
@@ -78,24 +76,6 @@ func TestValidateControllerManagerConfiguration(t *testing.T) {
7876
}),
7977
expectedErrs: field.ErrorList{field.Invalid(newPath.Child("ClusterStatusUpdateFrequency"), metav1.Duration{Duration: -10 * time.Second}, "must be greater than 0")},
8078
},
81-
"invalid ClusterLeaseDuration": {
82-
opt: New(func(options *Options) {
83-
options.ClusterLeaseDuration.Duration = -40 * time.Second
84-
}),
85-
expectedErrs: field.ErrorList{field.Invalid(newPath.Child("ClusterLeaseDuration"), metav1.Duration{Duration: -40 * time.Second}, "must be greater than 0")},
86-
},
87-
"invalid ClusterLeaseRenewIntervalFraction": {
88-
opt: New(func(options *Options) {
89-
options.ClusterLeaseRenewIntervalFraction = 1.2
90-
}),
91-
expectedErrs: field.ErrorList{field.Invalid(newPath.Child("ClusterLeaseRenewIntervalFraction"), float64(1.2), "must be greater than 0 and less than 1")},
92-
},
93-
"invalid ClusterLeaseRenewIntervalFraction (negative)": {
94-
opt: New(func(options *Options) {
95-
options.ClusterLeaseRenewIntervalFraction = -0.1
96-
}),
97-
expectedErrs: field.ErrorList{field.Invalid(newPath.Child("ClusterLeaseRenewIntervalFraction"), float64(-0.1), "must be greater than 0 and less than 1")},
98-
},
9979
"invalid ClusterMonitorPeriod": {
10080
opt: New(func(options *Options) {
10181
options.ClusterMonitorPeriod.Duration = -40 * time.Second

0 commit comments

Comments
 (0)