Skip to content

Commit

Permalink
Merge pull request #5555 from seanlaii/remove-parameter-scheduler-est…
Browse files Browse the repository at this point in the history
…imator

Remove deprecated `--bind-address` and `--bind-address` from `karmada-scheduler-estimator`
  • Loading branch information
karmada-bot committed Sep 19, 2024
2 parents ef7d528 + a72b72b commit e97f2bb
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 44 deletions.
4 changes: 2 additions & 2 deletions artifacts/deploy/karmada-scheduler-estimator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
- --grpc-auth-cert-file=/etc/karmada/pki/karmada.crt
- --grpc-auth-key-file=/etc/karmada/pki/karmada.key
- --grpc-client-ca-file=/etc/karmada/pki/ca.crt
- --metrics-bind-address=0.0.0.0:10351
- --metrics-bind-address=0.0.0.0:8080
- --health-probe-bind-address=0.0.0.0:10351
livenessProbe:
httpGet:
Expand All @@ -42,7 +42,7 @@ spec:
periodSeconds: 15
timeoutSeconds: 5
ports:
- containerPort: 10351
- containerPort: 8080
name: metrics
protocol: TCP
volumeMounts:
Expand Down
4 changes: 2 additions & 2 deletions charts/karmada/templates/karmada-scheduler-estimator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ spec:
- --grpc-auth-cert-file=/etc/karmada/pki/karmada.crt
- --grpc-auth-key-file=/etc/karmada/pki/karmada.key
- --grpc-client-ca-file=/etc/karmada/pki/server-ca.crt
- --metrics-bind-address=0.0.0.0:10351
- --metrics-bind-address=0.0.0.0:8080
- --health-probe-bind-address=0.0.0.0:10351
{{- with (include "karmada.schedulerEstimator.featureGates" (dict "featureGatesArg" $.Values.schedulerEstimator.featureGates)) }}
- {{ . }}
Expand All @@ -66,7 +66,7 @@ spec:
periodSeconds: 15
timeoutSeconds: 5
ports:
- containerPort: 10351
- containerPort: 8080
name: metrics
protocol: TCP
volumeMounts:
Expand Down
36 changes: 4 additions & 32 deletions cmd/scheduler-estimator/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,21 @@ limitations under the License.
package options

import (
"net"
"strconv"

"github.com/spf13/pflag"

"github.com/karmada-io/karmada/pkg/features"
"github.com/karmada-io/karmada/pkg/sharedcli/profileflag"
)

const (
defaultBindAddress = "0.0.0.0"
defaultServerPort = 10352
defaultHealthzPort = 10351
defaultServerPort = 10352
)

// Options contains everything necessary to create and run scheduler-estimator.
type Options struct {
KubeConfig string
Master string
ClusterName 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
// ServerPort is the port that the server gRPC serves at.
ServerPort int
// InsecureSkipGrpcClientVerify controls whether verifies the grpc client's certificate chain and host name.
Expand All @@ -63,7 +52,7 @@ type Options struct {
// MetricsBindAddress is the TCP address that the server should bind to
// for serving prometheus metrics.
// It can be set to "0" to disable the metrics serving.
// Defaults to ":10351".
// Defaults to ":8080".
MetricsBindAddress string
// HealthProbeBindAddress is the TCP address that the server should bind to
// for serving health probes
Expand All @@ -85,34 +74,17 @@ func (o *Options) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&o.KubeConfig, "kubeconfig", o.KubeConfig, "Path to member cluster's kubeconfig file.")
fs.StringVar(&o.Master, "master", o.Master, "The address of the member Kubernetes API server. Overrides any value in KubeConfig. Only required if out-of-cluster.")
fs.StringVar(&o.ClusterName, "cluster-name", o.ClusterName, "Name of member cluster that the estimator serves for.")
fs.StringVar(&o.BindAddress, "bind-address", defaultBindAddress, "The IP address on which to listen for the --secure-port port.")
fs.IntVar(&o.ServerPort, "server-port", defaultServerPort, "The secure port on which to serve gRPC.")
fs.StringVar(&o.GrpcAuthCertFile, "grpc-auth-cert-file", "", "SSL certification file used for grpc SSL/TLS connections.")
fs.StringVar(&o.GrpcAuthKeyFile, "grpc-auth-key-file", "", "SSL key file used for grpc SSL/TLS connections.")
fs.BoolVar(&o.InsecureSkipGrpcClientVerify, "insecure-skip-grpc-client-verify", false, "If set to true, the estimator will not verify the grpc client's certificate chain and host name. When the relevant certificates are not configured, it will not take effect.")
fs.StringVar(&o.GrpcClientCaFile, "grpc-client-ca-file", "", "SSL Certificate Authority file used to verify grpc client certificates on incoming requests.")
fs.IntVar(&o.SecurePort, "secure-port", defaultHealthzPort, "The secure port on which to serve HTTPS.")
fs.Float32Var(&o.ClusterAPIQPS, "kube-api-qps", 20.0, "QPS to use while talking with apiserver.")
fs.IntVar(&o.ClusterAPIBurst, "kube-api-burst", 30, "Burst to use while talking with apiserver.")
fs.IntVar(&o.Parallelism, "parallelism", o.Parallelism, "Parallelism defines the amount of parallelism in algorithms for estimating. Must be greater than 0. Defaults to 16.")
// 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.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:10351, :10351). It can be set to \"0\" to disable the metrics serving. Defaults to 0.0.0.0:10351.")
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:10351, :10351). It can be set to \"0\" to disable serving the health probe. Defaults to 0.0.0.0:10351.")
fs.StringVar(&o.MetricsBindAddress, "metrics-bind-address", ":8080", "The TCP address that the server should bind to for serving prometheus metrics(e.g. 127.0.0.1:8080, :8080). It can be set to \"0\" to disable the metrics serving. Defaults to 0.0.0.0:8080.")
fs.StringVar(&o.HealthProbeBindAddress, "health-probe-bind-address", ":10351", "The TCP address that the server should bind to for serving health probes(e.g. 127.0.0.1:10351, :10351). It can be set to \"0\" to disable serving the health probe. Defaults to 0.0.0.0:10351.")
features.FeatureGate.AddFlag(fs)

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
}
5 changes: 0 additions & 5 deletions cmd/scheduler-estimator/app/scheduler-estimator.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ func NewSchedulerEstimatorCommand(ctx context.Context) *cobra.Command {
Long: `The karmada-scheduler-estimator runs an accurate scheduler estimator of a cluster. It
provides the scheduler with more accurate cluster resource information.`,
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
4 changes: 2 additions & 2 deletions pkg/karmadactl/addons/estimator/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ spec:
- --grpc-auth-cert-file=/etc/karmada/pki/karmada.crt
- --grpc-auth-key-file=/etc/karmada/pki/karmada.key
- --grpc-client-ca-file=/etc/karmada/pki/ca.crt
- --metrics-bind-address=0.0.0.0:10351
- --metrics-bind-address=0.0.0.0:8080
- --health-probe-bind-address=0.0.0.0:10351
livenessProbe:
httpGet:
Expand All @@ -63,7 +63,7 @@ spec:
periodSeconds: 15
timeoutSeconds: 5
ports:
- containerPort: 10351
- containerPort: 8080
name: metrics
protocol: TCP
volumeMounts:
Expand Down
2 changes: 1 addition & 1 deletion pkg/karmadactl/cmdinit/utils/examples.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ spec:
- /bin/karmada-scheduler-estimator
- --kubeconfig=/etc/{{member_cluster_name}}-kubeconfig
- --cluster-name={{member_cluster_name}}
- --metrics-bind-address=0.0.0.0:10351
- --metrics-bind-address=0.0.0.0:8080
- --health-probe-bind-address=0.0.0.0:10351
volumeMounts:
- name: member-kubeconfig
Expand Down

0 comments on commit e97f2bb

Please sign in to comment.