Skip to content

Commit

Permalink
Remove deprecated --bind-address and --secure-port from karmada-desch…
Browse files Browse the repository at this point in the history
…eduler

Signed-off-by: chaosi-zju <[email protected]>
  • Loading branch information
chaosi-zju committed Sep 14, 2024
1 parent ba360c9 commit a7ff6d0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 36 deletions.
5 changes: 0 additions & 5 deletions cmd/descheduler/app/descheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@ func NewDeschedulerCommand(stopChan <-chan struct{}) *cobra.Command {
if they are failed to be scheduled for a period of time. It relies on
karmada-scheduler-estimator to get replica status.`,
RunE: func(_ *cobra.Command, _ []string) error {
// complete options
if err := opts.Complete(); err != nil {
return err
}

// validate options
if errs := opts.Validate(); len(errs) != 0 {
return errs.ToAggregate()
Expand Down
31 changes: 2 additions & 29 deletions cmd/descheduler/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ limitations under the License.
package options

import (
"net"
"strconv"
"time"

"github.com/spf13/pflag"
Expand All @@ -31,8 +29,6 @@ import (
)

const (
defaultBindAddress = "0.0.0.0"
defaultPort = 10358
defaultEstimatorPort = 10352
defaultDeschedulingInterval = 2 * time.Minute
defaultUnschedulableThreshold = 5 * time.Minute
Expand All @@ -49,12 +45,6 @@ type Options struct {
LeaderElection componentbaseconfig.LeaderElectionConfiguration
KubeConfig string
Master string
// BindAddress is the IP address on which to listen for the --secure-port port.
// Deprecated: To specify the TCP address for serving health probes, use HealthProbeBindAddress instead. To specify the TCP address for serving prometheus metrics, use MetricsBindAddress instead. This will be removed in release 1.12+.
BindAddress string
// SecurePort is the port that the server serves at.
// Deprecated: To specify the TCP address for serving health probes, use HealthProbeBindAddress instead. To specify the TCP address for serving prometheus metrics, use MetricsBindAddress instead. This will be removed in release 1.12+.
SecurePort int

KubeAPIQPS float32
// KubeAPIBurst is the burst to allow while talking with karmada-apiserver.
Expand Down Expand Up @@ -117,12 +107,6 @@ func (o *Options) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&o.LeaderElection.ResourceNamespace, "leader-elect-resource-namespace", util.NamespaceKarmadaSystem, "The namespace of resource object that is used for locking during leader election.")
fs.StringVar(&o.KubeConfig, "kubeconfig", o.KubeConfig, "Path to karmada control plane kubeconfig file.")
fs.StringVar(&o.Master, "master", o.Master, "The address of the Kubernetes API server. Overrides any value in KubeConfig. Only required if out-of-cluster.")
fs.StringVar(&o.BindAddress, "bind-address", defaultBindAddress, "The IP address on which to listen for the --secure-port port.")
fs.IntVar(&o.SecurePort, "secure-port", defaultPort, "The secure port on which to serve HTTPS.")
// nolint: errcheck
fs.MarkDeprecated("bind-address", "This flag is deprecated and will be removed in release 1.12+. Use --health-probe-bind-address and --metrics-bind-address instead. Note: In release 1.12+, these two addresses cannot be the same.")
// nolint: errcheck
fs.MarkDeprecated("secure-port", "This flag is deprecated and will be removed in release 1.12+. Use --health-probe-bind-address and --metrics-bind-address instead. Note: In release 1.12+, these two addresses cannot be the same.")
fs.Float32Var(&o.KubeAPIQPS, "kube-api-qps", 40.0, "QPS to use while talking with karmada-apiserver.")
fs.IntVar(&o.KubeAPIBurst, "kube-api-burst", 60, "Burst to use while talking with karmada-apiserver.")
fs.DurationVar(&o.SchedulerEstimatorTimeout.Duration, "scheduler-estimator-timeout", 3*time.Second, "Specifies the timeout period of calling the scheduler estimator service.")
Expand All @@ -135,18 +119,7 @@ func (o *Options) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&o.SchedulerEstimatorServicePrefix, "scheduler-estimator-service-prefix", "karmada-scheduler-estimator", "The prefix of scheduler estimator service name")
fs.DurationVar(&o.DeschedulingInterval.Duration, "descheduling-interval", defaultDeschedulingInterval, "Time interval between two consecutive descheduler executions. Setting this value instructs the descheduler to run in a continuous loop at the interval specified.")
fs.DurationVar(&o.UnschedulableThreshold.Duration, "unschedulable-threshold", defaultUnschedulableThreshold, "The period of pod unschedulable condition. This value is considered as a classification standard of unschedulable replicas.")
fs.StringVar(&o.MetricsBindAddress, "metrics-bind-address", "", "The TCP address that the server should bind to for serving prometheus metrics(e.g. 127.0.0.1:10358, :10358). It can be set to \"0\" to disable the metrics serving. Defaults to 0.0.0.0:10358.")
fs.StringVar(&o.HealthProbeBindAddress, "health-probe-bind-address", "", "The TCP address that the server should bind to for serving health probes(e.g. 127.0.0.1:10358, :10358). It can be set to \"0\" to disable serving the health probe. Defaults to 0.0.0.0:10358.")
fs.StringVar(&o.MetricsBindAddress, "metrics-bind-address", ":10358", "The TCP address that the server should bind to for serving prometheus metrics(e.g. 127.0.0.1:10358, :10358). It can be set to \"0\" to disable the metrics serving. Defaults to 0.0.0.0:10358.")
fs.StringVar(&o.HealthProbeBindAddress, "health-probe-bind-address", ":10358", "The TCP address that the server should bind to for serving health probes(e.g. 127.0.0.1:10358, :10358). It can be set to \"0\" to disable serving the health probe. Defaults to 0.0.0.0:10358.")
o.ProfileOpts.AddFlags(fs)
}

// Complete ensures that options are valid and marshals them if necessary.
func (o *Options) Complete() error {
if len(o.HealthProbeBindAddress) == 0 {
o.HealthProbeBindAddress = net.JoinHostPort(o.BindAddress, strconv.Itoa(o.SecurePort))
}
if len(o.MetricsBindAddress) == 0 {
o.MetricsBindAddress = net.JoinHostPort(o.BindAddress, strconv.Itoa(o.SecurePort))
}
return nil
}
2 changes: 0 additions & 2 deletions cmd/descheduler/app/options/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ func TestValidateKarmadaDescheduler(t *testing.T) {
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
LeaderElect: false,
},
BindAddress: "127.0.0.1",
SecurePort: 9000,
KubeAPIQPS: 40,
KubeAPIBurst: 30,
}}
Expand Down

0 comments on commit a7ff6d0

Please sign in to comment.