Merge pull request #5549 from whitewindmills/remove-params-kcm

Removed deprecated `--bind-address` and `--bind-address` from `karmada-controller-manager`
This commit is contained in:
karmada-bot 2024-09-19 09:33:04 +08:00 committed by GitHub
commit ef7d528a98
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 3 additions and 38 deletions

View File

@ -26,7 +26,6 @@ spec:
command: command:
- /bin/karmada-controller-manager - /bin/karmada-controller-manager
- --kubeconfig=/etc/kubeconfig - --kubeconfig=/etc/kubeconfig
- --bind-address=0.0.0.0
- --metrics-bind-address=:8080 - --metrics-bind-address=:8080
- --cluster-status-update-frequency=10s - --cluster-status-update-frequency=10s
- --failover-eviction-timeout=30s - --failover-eviction-timeout=30s

View File

@ -52,10 +52,10 @@ spec:
command: command:
- /bin/karmada-controller-manager - /bin/karmada-controller-manager
- --kubeconfig=/etc/kubeconfig - --kubeconfig=/etc/kubeconfig
- --bind-address=0.0.0.0
- --cluster-status-update-frequency=10s - --cluster-status-update-frequency=10s
- --secure-port=10357
- --leader-elect-resource-namespace={{ $systemNamespace }} - --leader-elect-resource-namespace={{ $systemNamespace }}
- --health-probe-bind-address=0.0.0.0:10357
- --metrics-bind-address=:8080
- --v=2 - --v=2
{{- if .Values.controllerManager.controllers }} {{- if .Values.controllerManager.controllers }}
- --controllers={{ .Values.controllerManager.controllers }} - --controllers={{ .Values.controllerManager.controllers }}

View File

@ -100,10 +100,6 @@ func NewControllerManagerCommand(ctx context.Context) *cobra.Command {
The controllers watch Karmada objects and then talk to the underlying clusters' API servers The controllers watch Karmada objects and then talk to the underlying clusters' API servers
to create regular Kubernetes resources.`, to create regular Kubernetes resources.`,
RunE: func(_ *cobra.Command, _ []string) error { RunE: func(_ *cobra.Command, _ []string) error {
// complete options
if err := opts.Complete(); err != nil {
return err
}
// validate options // validate options
if errs := opts.Validate(); len(errs) != 0 { if errs := opts.Validate(); len(errs) != 0 {
return errs.ToAggregate() return errs.ToAggregate()

View File

@ -18,9 +18,7 @@ package options
import ( import (
"fmt" "fmt"
"net"
"regexp" "regexp"
"strconv"
"strings" "strings"
"time" "time"
@ -36,11 +34,6 @@ import (
"github.com/karmada-io/karmada/pkg/util" "github.com/karmada-io/karmada/pkg/util"
) )
const (
defaultBindAddress = "0.0.0.0"
defaultPort = 10357
)
var ( var (
defaultElectionLeaseDuration = metav1.Duration{Duration: 15 * time.Second} defaultElectionLeaseDuration = metav1.Duration{Duration: 15 * time.Second}
defaultElectionRenewDeadline = metav1.Duration{Duration: 10 * time.Second} defaultElectionRenewDeadline = metav1.Duration{Duration: 10 * time.Second}
@ -57,13 +50,6 @@ type Options struct {
Controllers []string Controllers []string
// LeaderElection defines the configuration of leader election client. // LeaderElection defines the configuration of leader election client.
LeaderElection componentbaseconfig.LeaderElectionConfiguration LeaderElection componentbaseconfig.LeaderElectionConfiguration
// BindAddress is the IP address on which to listen for the --secure-port port.
// Deprecated: Use HealthProbeBindAddress instead. This will be removed in release 1.12+.
BindAddress string
// SecurePort is the port that the the server serves at.
// Note: We hope support https in the future once controller-runtime provides the functionality.
// Deprecated: Use HealthProbeBindAddress instead. This will be removed in release 1.12+.
SecurePort int
// ClusterStatusUpdateFrequency is the frequency that controller computes and report cluster status. // ClusterStatusUpdateFrequency is the frequency that controller computes and report cluster status.
// It must work with ClusterMonitorGracePeriod(--cluster-monitor-grace-period) in karmada-controller-manager. // It must work with ClusterMonitorGracePeriod(--cluster-monitor-grace-period) in karmada-controller-manager.
ClusterStatusUpdateFrequency metav1.Duration ClusterStatusUpdateFrequency metav1.Duration
@ -177,14 +163,6 @@ func (o *Options) AddFlags(flags *pflag.FlagSet, allControllers, disabledByDefau
"A list of controllers to enable. '*' enables all on-by-default controllers, 'foo' enables the controller named 'foo', '-foo' disables the controller named 'foo'. \nAll controllers: %s.\nDisabled-by-default controllers: %s", "A list of controllers to enable. '*' enables all on-by-default controllers, 'foo' enables the controller named 'foo', '-foo' disables the controller named 'foo'. \nAll controllers: %s.\nDisabled-by-default controllers: %s",
strings.Join(allControllers, ", "), strings.Join(disabledByDefaultControllers, ", "), strings.Join(allControllers, ", "), strings.Join(disabledByDefaultControllers, ", "),
)) ))
flags.StringVar(&o.BindAddress, "bind-address", defaultBindAddress,
"The IP address on which to listen for the --secure-port port.")
flags.IntVar(&o.SecurePort, "secure-port", defaultPort,
"The secure port on which to serve HTTPS.")
// nolint: errcheck
flags.MarkDeprecated("bind-address", "This flag is deprecated and will be removed in release 1.12+. Use --health-probe-bind-address instead.")
// nolint: errcheck
flags.MarkDeprecated("secure-port", "This flag is deprecated and will be removed in release 1.12+. Use --health-probe-bind-address instead.")
flags.DurationVar(&o.ClusterStatusUpdateFrequency.Duration, "cluster-status-update-frequency", 10*time.Second, flags.DurationVar(&o.ClusterStatusUpdateFrequency.Duration, "cluster-status-update-frequency", 10*time.Second,
"Specifies how often karmada-controller-manager posts cluster status to karmada-apiserver.") "Specifies how often karmada-controller-manager posts cluster status to karmada-apiserver.")
flags.BoolVar(&o.LeaderElection.LeaderElect, "leader-elect", true, "Start a leader election client and gain leadership before executing the main loop. Enable this when running replicated components for high availability.") flags.BoolVar(&o.LeaderElection.LeaderElect, "leader-elect", true, "Start a leader election client and gain leadership before executing the main loop. Enable this when running replicated components for high availability.")
@ -232,7 +210,7 @@ func (o *Options) AddFlags(flags *pflag.FlagSet, allControllers, disabledByDefau
flags.DurationVar(&o.ClusterCacheSyncTimeout.Duration, "cluster-cache-sync-timeout", util.CacheSyncTimeout, "Timeout period waiting for cluster cache to sync.") flags.DurationVar(&o.ClusterCacheSyncTimeout.Duration, "cluster-cache-sync-timeout", util.CacheSyncTimeout, "Timeout period waiting for cluster cache to sync.")
flags.DurationVar(&o.ResyncPeriod.Duration, "resync-period", 0, "Base frequency the informers are resynced.") flags.DurationVar(&o.ResyncPeriod.Duration, "resync-period", 0, "Base frequency the informers are resynced.")
flags.StringVar(&o.MetricsBindAddress, "metrics-bind-address", ":8080", "The TCP address that the controller 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.") flags.StringVar(&o.MetricsBindAddress, "metrics-bind-address", ":8080", "The TCP address that the controller 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.")
flags.StringVar(&o.HealthProbeBindAddress, "health-probe-bind-address", "", "The TCP address that the controller should bind to for serving health probes(e.g. 127.0.0.1:10357, :10357). It can be set to \"0\" to disable serving the health probe. Defaults to 0.0.0.0:10357.") flags.StringVar(&o.HealthProbeBindAddress, "health-probe-bind-address", ":10357", "The TCP address that the controller should bind to for serving health probes(e.g. 127.0.0.1:10357, :10357). It can be set to \"0\" to disable serving the health probe. Defaults to 0.0.0.0:10357.")
flags.IntVar(&o.ConcurrentClusterSyncs, "concurrent-cluster-syncs", 5, "The number of Clusters that are allowed to sync concurrently.") flags.IntVar(&o.ConcurrentClusterSyncs, "concurrent-cluster-syncs", 5, "The number of Clusters that are allowed to sync concurrently.")
flags.IntVar(&o.ConcurrentClusterResourceBindingSyncs, "concurrent-clusterresourcebinding-syncs", 5, "The number of ClusterResourceBindings that are allowed to sync concurrently.") flags.IntVar(&o.ConcurrentClusterResourceBindingSyncs, "concurrent-clusterresourcebinding-syncs", 5, "The number of ClusterResourceBindings that are allowed to sync concurrently.")
flags.IntVar(&o.ConcurrentResourceBindingSyncs, "concurrent-resourcebinding-syncs", 5, "The number of ResourceBindings that are allowed to sync concurrently.") flags.IntVar(&o.ConcurrentResourceBindingSyncs, "concurrent-resourcebinding-syncs", 5, "The number of ResourceBindings that are allowed to sync concurrently.")
@ -261,11 +239,3 @@ func (o *Options) SkippedNamespacesRegexps() []*regexp.Regexp {
} }
return skippedPropagatingNamespaces return skippedPropagatingNamespaces
} }
// 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))
}
return nil
}