options

package
v0.17.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ClusterRegistrationURL flag denotes the url of parent cluster
	ClusterRegistrationURL = "cluster-reg-parent-url"

	// ClusterRegistrationToken flag is the token used to temporarily authenticate with parent cluster
	// while registering as a child cluster.
	ClusterRegistrationToken = "cluster-reg-token"

	// ClusterRegistrationName flag specifies the cluster registration name
	ClusterRegistrationName = "cluster-reg-name"

	// ClusterRegistrationNamePrefix is a prefix for cluster registration name
	ClusterRegistrationNamePrefix = "cluster-reg-name-prefix"

	// ClusterRegistrationNamespace flag specifies the cluster registration namespace
	ClusterRegistrationNamespace = "cluster-reg-namespace"

	// ClusterRegistrationType flag specifies the cluster type
	ClusterRegistrationType = "cluster-reg-type"

	// ClusterSyncMode flag specifies the sync mode between parent cluster and child cluster
	ClusterSyncMode = "cluster-sync-mode"

	// ClusterLabels flag specifies the labels for the cluster
	ClusterLabels = "cluster-labels"

	// ClusterStatusReportFrequency flag specifies the child cluster status updating frequency
	ClusterStatusReportFrequency = "cluster-status-update-frequency"

	// ClusterStatusCollectFrequency flag specifies the cluster status collecting frequency
	ClusterStatusCollectFrequency = "cluster-status-collect-frequency"

	// UseMetricsServer flag specifies whether to collect metrics from metrics server running in the cluster
	UseMetricsServer = "use-metrics-server"

	// PredictorAddress flag specifies the address of external predictor
	PredictorAddress = "predictor-addr"

	// PredictorDirectAccess flag indicates whether the predictor can be accessed directly by clusternet-scheduler
	PredictorDirectAccess = "predictor-direct-access"

	// PredictorPort flag specifies the port on which to serve built-in predictor
	PredictorPort = "predictor-port"

	// LabelAggregateThreshold flag specifies the threshold of common node labels that will be aggregated
	// to ManagedCluster object in parent cluster.
	LabelAggregateThreshold = "labels-aggregate-threshold"

	// LabelAggregatePrefix flag specifies the label prefix to be aggregated
	LabelAggregatePrefix = "labels-aggregate-prefix"
)

flags

View Source
const (
	ParentClusterSecretName = "parent-cluster"

	// RegistrationNamePrefix is a prefix name for cluster registration
	RegistrationNamePrefix = "clusternet-cluster"

	// ClusterNameMaxLength is the max length for clustername
	ClusterNameMaxLength = 60

	// ClusterNamespaceMaxLength is the max length for clusternamespace
	ClusterNamespaceMaxLength = 63

	DefaultClusterStatusCollectFrequency = 20 * time.Second
	DefaultClusterStatusReportFrequency  = 3 * time.Minute
)

default values

View Source
const (
	// DefaultClusternetAgentPort is the default port for the clusternet-agent running in each child cluster.
	// May be overridden by a flag at startup.
	DefaultClusternetAgentPort = 10650
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentOptions

type AgentOptions struct {
	SecureServing *apiserveroptions.SecureServingOptionsWithLoopback

	// DebuggingOptions holds the Debugging options.
	DebuggingOptions *controllermanageroptions.DebuggingOptions

	*ClusterRegistrationOptions
	*utils.ControllerOptions
	Metrics *metrics.Options

	// PredictorAddress specifies the address of predictor
	PredictorAddress string
	// PredictorDirectAccess indicates whether the predictor can be accessed directly by clusternet-scheduler
	PredictorDirectAccess bool
	// PredictorPort specifies the port on which to serve built-in predictor
	PredictorPort int
	// ServeInternalPredictor indicates whether to serve built-in predictor. It is not a flag.
	ServeInternalPredictor bool

	// No tunnel logging by default
	TunnelLogging bool

	// Flags hold the parsed CLI flags.
	Flags *cliflag.NamedFlagSets
}

AgentOptions holds the command-line options for command

func NewOptions

func NewOptions() (*AgentOptions, error)

NewOptions creates a new *options with sane defaults

func (*AgentOptions) Complete

func (opts *AgentOptions) Complete() error

Complete completes all the required options.

func (*AgentOptions) Config

func (opts *AgentOptions) Config() error

func (*AgentOptions) Validate

func (opts *AgentOptions) Validate() error

Validate validates all the required options.

type ClusterRegistrationOptions

type ClusterRegistrationOptions struct {
	// ClusterName denotes the cluster name you want to register/display in parent cluster
	ClusterName string
	// ClusterNamePrefix specifies the cluster name prefix for registration
	ClusterNamePrefix string
	// ClusterNamespace denotes the cluster namespace you want to register/display in parent cluster
	ClusterNamespace string
	// ClusterType denotes the cluster type
	ClusterType string
	// ClusterSyncMode specifies the sync mode between parent cluster and child cluster
	ClusterSyncMode string
	// ClusterLabels specifies the labels for the cluster
	ClusterLabels string

	// ClusterStatusReportFrequency is the frequency at which the agent reports current cluster's status
	ClusterStatusReportFrequency metav1.Duration
	// ClusterStatusCollectFrequency is the frequency at which the agent updates current cluster's status
	ClusterStatusCollectFrequency metav1.Duration

	ParentURL      string
	BootstrapToken string

	// UseMetricsServer specifies whether to collect metrics from metrics server
	UseMetricsServer bool

	// LabelAggregateThreshold specifies the threshold of common node labels that will be aggregated to ManagedCluster
	// object in parent cluster. e.g. LabelAggregateThreshold 0.8 means if >=80% nodes in current child cluster have
	// such common labels, then these labels will be labeled to ManagedCluster object.
	LabelAggregateThreshold float32

	// LabelAggregatePrefix specifies the prefixes of node labels that should be aggregated
	LabelAggregatePrefix []string
}

ClusterRegistrationOptions holds the command-line options about cluster registration

func NewClusterRegistrationOptions

func NewClusterRegistrationOptions() *ClusterRegistrationOptions

NewClusterRegistrationOptions creates a new *ClusterRegistrationOptions with sane defaults

func (*ClusterRegistrationOptions) AddFlagSets

func (opts *ClusterRegistrationOptions) AddFlagSets(fss *cliflag.NamedFlagSets)

AddFlagSets adds the flags to the flagsets.

func (*ClusterRegistrationOptions) Complete

func (opts *ClusterRegistrationOptions) Complete() []error

Complete completes all the required options.

func (*ClusterRegistrationOptions) Validate

func (opts *ClusterRegistrationOptions) Validate() []error

Validate validates all the required options.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL