karmadactl

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2022 License: Apache-2.0 Imports: 95 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DesiredCordon a flag indicate karmadactl.RunCordonOrUncordon cordon a cluster,
	// cordon prevent new resource scheduler to cordoned cluster.
	DesiredCordon = iota
	// DesiredUnCordon a flag indicate karmadactl.RunCordonOrUncordon uncordon a cluster.
	DesiredUnCordon
)
View Source
const (
	// KarmadaDir is the directory Karmada owns for storing various configuration files
	KarmadaDir = "/etc/karmada"
	// CACertPath defines default location of CA certificate on Linux
	CACertPath = "/etc/karmada/pki/ca.crt"
	// ClusterPermissionPrefix defines the common name of karmada agent certificate
	ClusterPermissionPrefix = "system:node:"
	// ClusterPermissionGroups defines the organization of karmada agent certificate
	ClusterPermissionGroups = "system:nodes"
	// KarmadaAgentBootstrapKubeConfigFileName defines the file name for the kubeconfig that the karmada-agent will use to do
	// the TLS bootstrap to get itself an unique credential
	KarmadaAgentBootstrapKubeConfigFileName = "bootstrap-karmada-agent.conf"
	// KarmadaAgentKubeConfigFileName defines the file name for the kubeconfig that the karmada-agent will use to do
	// the TLS bootstrap to get itself an unique credential
	KarmadaAgentKubeConfigFileName = "karmada-agent.conf"
	// KarmadaKubeconfigName is the name of karmada kubeconfig
	KarmadaKubeconfigName = "karmada-kubeconfig"
	// KarmadaAgentName is the name of karmada-agent
	KarmadaAgentName = "karmada-agent"
	// KarmadaAgentServiceAccountName is the name of karmada-agent serviceaccount
	KarmadaAgentServiceAccountName = "karmada-agent-sa"
	// SignerName defines the signer name for csr, 'kubernetes.io/kube-apiserver-client-kubelet' can sign the csr automatically
	SignerName = "kubernetes.io/kube-apiserver-client-kubelet"
	// BootstrapUserName defines bootstrap user name
	BootstrapUserName = "token-bootstrap-client"
	// DefaultClusterName defines the default cluster name
	DefaultClusterName = "karmada-apiserver"
	// TokenUserName defines token user
	TokenUserName = "tls-bootstrap-token-user"
	// DefaultDiscoveryTimeout specifies the default discovery timeout for register command
	DefaultDiscoveryTimeout = 5 * time.Minute
	// DiscoveryRetryInterval specifies how long register command should wait before retrying to connect to the control-plane when doing discovery
	DiscoveryRetryInterval = 5 * time.Second
	// DefaultCertExpirationSeconds define the expiration time of certificate
	DefaultCertExpirationSeconds int32 = 86400 * 365
)
View Source
const (
	MODIFIED  = "modified"
	TAINTED   = "tainted"
	UNTAINTED = "untainted"
)

Exported taint constant strings to mark the type of the current operation

Variables

View Source
var (

	// ErrEmptyConfig is the error message to be displayed if the configuration info is missing or incomplete
	ErrEmptyConfig = clientcmd.NewEmptyConfigError(
		`Missing or incomplete configuration info.  Please point to an existing, complete config file:
  1. Via the command-line flag --kubeconfig
  2. Via the KUBECONFIG environment variable
  3. In your home directory as ~/.kube/config

To view or setup config directly use the 'config' command.`)
)
View Source
var RBInfo map[string]*OtherPrint

RBInfo resourcebinding info and print info

Functions

func ClientSetFromFile added in v1.3.0

func ClientSetFromFile(path string) (*kubeclient.Clientset, error)

ClientSetFromFile returns a ready-to-use client from a kubeconfig file

func CreateBasic added in v1.3.0

func CreateBasic(serverURL, clusterName, userName string, caCert []byte) *clientcmdapi.Config

CreateBasic creates a basic, general KubeConfig object that then can be extended

func CreateWithCert added in v1.3.0

func CreateWithCert(serverURL, clusterName, userName string, caCert []byte, cert []byte, key []byte) *clientcmdapi.Config

CreateWithCert creates a KubeConfig object with access to the API server with a cert

func CreateWithToken added in v1.3.0

func CreateWithToken(serverURL, clusterName, userName string, caCert []byte, token string) *clientcmdapi.Config

CreateWithToken creates a KubeConfig object with access to the API server with a token

func Exists added in v0.10.0

func Exists(path string) bool

Exists determine if path exists

func JoinCluster added in v0.8.0

func JoinCluster(controlPlaneRestConfig, clusterConfig *rest.Config, opts CommandJoinOption) (err error)

JoinCluster join the cluster into karmada.

func NewCmdApply added in v1.3.0

func NewCmdApply(karmadaConfig KarmadaConfig, parentCommand string, streams genericclioptions.IOStreams) *cobra.Command

NewCmdApply creates the `apply` command

func NewCmdCordon added in v0.8.0

func NewCmdCordon(karmadaConfig KarmadaConfig, parentCommand string) *cobra.Command

NewCmdCordon defines the `cordon` command that mark cluster as unschedulable.

func NewCmdDeInit added in v1.2.0

func NewCmdDeInit(parentCommand string) *cobra.Command

NewCmdDeInit removes Karmada from Kubernetes

func NewCmdDescribe added in v1.2.0

func NewCmdDescribe(karmadaConfig KarmadaConfig, parentCommand string, streams genericclioptions.IOStreams) *cobra.Command

NewCmdDescribe new describe command.

func NewCmdExec added in v1.2.0

func NewCmdExec(karmadaConfig KarmadaConfig, parentCommand string, streams genericclioptions.IOStreams) *cobra.Command

NewCmdExec new exec command.

func NewCmdGet added in v0.10.0

func NewCmdGet(karmadaConfig KarmadaConfig, parentCommand string, streams genericclioptions.IOStreams) *cobra.Command

NewCmdGet New get command

func NewCmdJoin

func NewCmdJoin(karmadaConfig KarmadaConfig, parentCommand string) *cobra.Command

NewCmdJoin defines the `join` command that registers a cluster.

func NewCmdLogs added in v1.2.0

func NewCmdLogs(karmadaConfig KarmadaConfig, parentCommand string, streams genericclioptions.IOStreams) *cobra.Command

NewCmdLogs new logs command.

func NewCmdPromote added in v1.0.0

func NewCmdPromote(karmadaConfig KarmadaConfig, parentCommand string) *cobra.Command

NewCmdPromote defines the `promote` command that promote resources from legacy clusters

func NewCmdRegister added in v1.3.0

func NewCmdRegister(parentCommand string) *cobra.Command

NewCmdRegister defines the `register` command that registers a cluster.

func NewCmdTaint added in v1.0.0

func NewCmdTaint(karmadaConfig KarmadaConfig, parentCommand string) *cobra.Command

NewCmdTaint defines the `taint` command that mark cluster with taints

func NewCmdToken added in v1.3.0

func NewCmdToken(karmadaConfig KarmadaConfig, parentCommand string, streams genericclioptions.IOStreams) *cobra.Command

NewCmdToken returns cobra.Command for token management

func NewCmdTokenCreate added in v1.3.0

func NewCmdTokenCreate(karmadaConfig KarmadaConfig, out io.Writer, tokenOpts *CommandTokenOptions) *cobra.Command

NewCmdTokenCreate returns cobra.Command to create token

func NewCmdTokenDelete added in v1.3.0

func NewCmdTokenDelete(karmadaConfig KarmadaConfig, out io.Writer, tokenOpts *CommandTokenOptions) *cobra.Command

NewCmdTokenDelete returns cobra.Command to delete tokens

func NewCmdTokenList added in v1.3.0

func NewCmdTokenList(karmadaConfig KarmadaConfig, out io.Writer, errW io.Writer, tokenOpts *CommandTokenOptions) *cobra.Command

NewCmdTokenList returns cobra.Command to list tokens

func NewCmdUncordon added in v0.8.0

func NewCmdUncordon(karmadaConfig KarmadaConfig, parentCommand string) *cobra.Command

NewCmdUncordon defines the `uncordon` command that mark cluster as schedulable.

func NewCmdUnjoin

func NewCmdUnjoin(karmadaConfig KarmadaConfig, parentCommand string) *cobra.Command

NewCmdUnjoin defines the `unjoin` command that removes registration of a cluster from control plane.

func NewKarmadaCtlCommand

func NewKarmadaCtlCommand(cmdUse, parentCommand string) *cobra.Command

NewKarmadaCtlCommand creates the `karmadactl` command.

func RunCordonOrUncordon added in v0.8.0

func RunCordonOrUncordon(desired int, karmadaConfig KarmadaConfig, opts CommandCordonOption) error

RunCordonOrUncordon exec marks the cluster unschedulable or schedulable according to desired. if true cordon cluster otherwise uncordon cluster.

func RunJoin

func RunJoin(karmadaConfig KarmadaConfig, opts CommandJoinOption) error

RunJoin is the implementation of the 'join' command.

func RunPromote added in v1.0.0

func RunPromote(karmadaConfig KarmadaConfig, opts CommandPromoteOption, args []string) error

RunPromote promote resources from legacy clusters

func RunTaint added in v1.0.0

func RunTaint(karmadaConfig KarmadaConfig, opts CommandTaintOption) error

RunTaint set taints for the clusters

func RunUnjoin

func RunUnjoin(karmadaConfig KarmadaConfig, opts CommandUnjoinOption) error

RunUnjoin is the implementation of the 'unjoin' command.

func ToClientSet added in v1.3.0

func ToClientSet(config *clientcmdapi.Config) (*kubeclient.Clientset, error)

ToClientSet converts a KubeConfig object to a client

func UnJoinCluster added in v0.8.0

func UnJoinCluster(controlPlaneRestConfig, clusterConfig *rest.Config, opts CommandUnjoinOption) (err error)

UnJoinCluster unJoin the cluster from karmada.

func WriteToDisk added in v1.3.0

func WriteToDisk(filename string, kubeconfig *clientcmdapi.Config) error

WriteToDisk writes a KubeConfig object down to disk with mode 0600

Types

type BootstrapTokenDiscovery added in v1.3.0

type BootstrapTokenDiscovery struct {
	// Token is a token used to validate cluster information
	// fetched from the control-plane.
	Token string

	// APIServerEndpoint is an IP or domain name to the API server from which info will be fetched.
	APIServerEndpoint string

	// CACertHashes specifies a set of public key pins to verify
	// when token-based discovery is used. The root CA found during discovery
	// must match one of these values. Specifying an empty set disables root CA
	// pinning, which can be unsafe. Each hash is specified as "<type>:<value>",
	// where the only currently supported type is "sha256". This is a hex-encoded
	// SHA-256 hash of the Subject Public Key Info (SPKI) object in DER-encoded
	// ASN.1. These hashes can be calculated using, for example, OpenSSL.
	CACertHashes []string

	// UnsafeSkipCAVerification allows token-based discovery
	// without CA verification via CACertHashes. This can weaken
	// the security of register command since other clusters can impersonate the control-plane.
	UnsafeSkipCAVerification bool
}

BootstrapTokenDiscovery is used to set the options for bootstrap token based discovery

type ClusterInfo added in v0.10.0

type ClusterInfo struct {
	KubeConfig string
	Context    string

	APIEndpoint     string
	ClusterSyncMode clusterv1alpha1.ClusterSyncMode
}

ClusterInfo Information about the member in the karmada cluster.

type CommandApplyOptions added in v1.3.0

type CommandApplyOptions struct {
	// global flags
	options.GlobalCommandOptions
	// apply flags
	KubectlApplyFlags *kubectlapply.ApplyFlags
	Namespace         string
	AllClusters       bool
	Clusters          []string
	// contains filtered or unexported fields
}

CommandApplyOptions contains the input to the apply command.

func (*CommandApplyOptions) Complete added in v1.3.0

func (o *CommandApplyOptions) Complete(karmadaConfig KarmadaConfig, cmd *cobra.Command, parentCommand string, args []string) error

Complete completes all the required options

func (*CommandApplyOptions) Run added in v1.3.0

func (o *CommandApplyOptions) Run() error

Run executes the `apply` command.

func (*CommandApplyOptions) Validate added in v1.3.0

func (o *CommandApplyOptions) Validate(cmd *cobra.Command, args []string) error

Validate verifies if CommandApplyOptions are valid and without conflicts.

type CommandCordonOption added in v0.8.0

type CommandCordonOption struct {
	// global flags
	options.GlobalCommandOptions

	// ClusterName is the cluster's name that we are going to join with.
	ClusterName string

	// DryRun tells if run the command in dry-run mode, without making any server requests.
	DryRun bool
}

CommandCordonOption holds all command options for cordon and uncordon

func (*CommandCordonOption) Complete added in v0.8.0

func (o *CommandCordonOption) Complete(args []string) error

Complete ensures that options are valid and marshals them if necessary.

type CommandDeInitOption added in v1.2.0

type CommandDeInitOption struct {
	// KubeConfig holds host cluster KUBECONFIG file path.
	KubeConfig string
	Context    string
	Namespace  string

	// DryRun tells if run the command in dry-run mode, without making any server requests.
	DryRun bool
	Force  bool

	KubeClientSet *kubernetes.Clientset
}

CommandDeInitOption options for deinit.

func (*CommandDeInitOption) Complete added in v1.2.0

func (o *CommandDeInitOption) Complete() error

Complete the conditions required to be able to run deinit.

func (*CommandDeInitOption) Run added in v1.2.0

func (o *CommandDeInitOption) Run() error

Run start delete

type CommandGetOptions added in v0.10.0

type CommandGetOptions struct {
	// global flags
	options.GlobalCommandOptions

	Clusters []string

	PrintFlags             *get.PrintFlags
	ToPrinter              func(*meta.RESTMapping, *bool, bool, bool) (printers.ResourcePrinterFunc, error)
	IsHumanReadablePrinter bool

	CmdParent string

	resource.FilenameOptions

	Watch     bool
	WatchOnly bool
	ChunkSize int64

	OutputWatchEvents bool

	LabelSelector     string
	FieldSelector     string
	AllNamespaces     bool
	Namespace         string
	ExplicitNamespace bool

	ServerPrint bool

	NoHeaders      bool
	Sort           bool
	IgnoreNotFound bool
	Export         bool

	genericclioptions.IOStreams
}

CommandGetOptions contains the input to the get command.

func NewCommandGetOptions added in v0.10.0

func NewCommandGetOptions(streams genericclioptions.IOStreams) *CommandGetOptions

NewCommandGetOptions returns a GetOptions with default chunk size 500.

func (*CommandGetOptions) Complete added in v0.10.0

func (g *CommandGetOptions) Complete(karmadaConfig KarmadaConfig) error

Complete takes the command arguments and infers any remaining options.

func (*CommandGetOptions) Run added in v0.10.0

func (g *CommandGetOptions) Run(karmadaConfig KarmadaConfig, cmd *cobra.Command, args []string) error

Run performs the get operation.

func (*CommandGetOptions) Validate added in v1.2.0

func (g *CommandGetOptions) Validate(cmd *cobra.Command) error

Validate checks the set of flags provided by the user.

type CommandJoinOption

type CommandJoinOption struct {
	options.GlobalCommandOptions

	// ClusterNamespace holds the namespace name where the member cluster secrets are stored.
	ClusterNamespace string

	// ClusterName is the cluster's name that we are going to join with.
	ClusterName string

	// ClusterContext is the cluster's context that we are going to join with.
	ClusterContext string

	// ClusterKubeConfig is the cluster's kubeconfig path.
	ClusterKubeConfig string

	// ClusterProvider is the cluster's provider.
	ClusterProvider string

	// ClusterRegion represents the region of the cluster locate in.
	ClusterRegion string

	// ClusterZone represents the zone of the cluster locate in.
	ClusterZone string

	// DryRun tells if run the command in dry-run mode, without making any server requests.
	DryRun bool
}

CommandJoinOption holds all command options.

func (*CommandJoinOption) AddFlags

func (j *CommandJoinOption) AddFlags(flags *pflag.FlagSet)

AddFlags adds flags to the specified FlagSet.

func (*CommandJoinOption) Complete

func (j *CommandJoinOption) Complete(args []string) error

Complete ensures that options are valid and marshals them if necessary.

func (*CommandJoinOption) Validate added in v0.3.0

func (j *CommandJoinOption) Validate(args []string) error

Validate checks option and return a slice of found errs.

type CommandPromoteOption added in v1.0.0

type CommandPromoteOption struct {
	options.GlobalCommandOptions

	// Cluster is the name of legacy cluster
	Cluster string

	// Namespace is the namespace of legacy resource
	Namespace string

	// ClusterContext is the cluster's context that we are going to join with.
	ClusterContext string

	// ClusterKubeConfig is the cluster's kubeconfig path.
	ClusterKubeConfig string

	// DryRun tells if run the command in dry-run mode, without making any server requests.
	DryRun bool

	resource.FilenameOptions

	JSONYamlPrintFlags *genericclioptions.JSONYamlPrintFlags
	OutputFormat       string
	Printer            func(*meta.RESTMapping, *bool, bool, bool) (printers.ResourcePrinterFunc, error)
	TemplateFlags      *genericclioptions.KubeTemplatePrintFlags
	// contains filtered or unexported fields
}

CommandPromoteOption holds all command options for promote

func (*CommandPromoteOption) AddFlags added in v1.0.0

func (o *CommandPromoteOption) AddFlags(flags *pflag.FlagSet)

AddFlags adds flags to the specified FlagSet.

func (*CommandPromoteOption) Complete added in v1.0.0

func (o *CommandPromoteOption) Complete(args []string) error

Complete ensures that options are valid and marshals them if necessary

func (*CommandPromoteOption) Validate added in v1.0.0

func (o *CommandPromoteOption) Validate() error

Validate checks to the PromoteOptions to see if there is sufficient information run the command

type CommandRegisterOption added in v1.3.0

type CommandRegisterOption struct {
	// KubeConfig holds the KUBECONFIG file path.
	KubeConfig string

	// Context is the name of the cluster context in KUBECONFIG file.
	// Default value is the current-context.
	Context string

	// Namespace is the namespace that karmada-agent component deployed.
	Namespace string

	// ClusterNamespace holds the namespace name where the member cluster secrets are stored.
	ClusterNamespace string

	// ClusterName is the cluster's name that we are going to join with.
	ClusterName string

	// ClusterProvider is the cluster's provider.
	ClusterProvider string

	// ClusterRegion represents the region of the cluster locate in.
	ClusterRegion string

	// CACertPath is the path to the SSL certificate authority used to
	// secure comunications between member cluster and karmada-control-plane.
	// Defaults to "/etc/karmada/pki/ca.crt".
	CACertPath string

	// BootstrapToken is used to set the options for bootstrap token based discovery
	BootstrapToken *BootstrapTokenDiscovery

	// Timeout is the max discovery time
	Timeout time.Duration

	// CertExpirationSeconds define the expiration time of certificate
	CertExpirationSeconds int32

	// KarmadaSchedulerImage is the image of karmada agent.
	KarmadaAgentImage string

	// KarmadaAgentReplicas is the number of karmada agent.
	KarmadaAgentReplicas int32

	// DryRun tells if run the command in dry-run mode, without making any server requests.
	DryRun bool
	// contains filtered or unexported fields
}

CommandRegisterOption holds all command options.

func (*CommandRegisterOption) Complete added in v1.3.0

func (o *CommandRegisterOption) Complete(args []string) error

Complete ensures that options are valid and marshals them if necessary.

func (*CommandRegisterOption) Run added in v1.3.0

func (o *CommandRegisterOption) Run(parentCommand string) error

Run is the implementation of the 'register' command.

func (*CommandRegisterOption) Validate added in v1.3.0

func (o *CommandRegisterOption) Validate() error

Validate checks option and return a slice of found errs.

type CommandTaintOption added in v1.0.0

type CommandTaintOption struct {
	options.GlobalCommandOptions

	// DryRun tells if run the command in dry-run mode, without making any server requests.
	DryRun bool
	// contains filtered or unexported fields
}

CommandTaintOption holds all command options for taint

func (*CommandTaintOption) AddFlags added in v1.0.0

func (o *CommandTaintOption) AddFlags(flags *pflag.FlagSet)

AddFlags adds flags to the specified FlagSet.

func (*CommandTaintOption) Complete added in v1.0.0

func (o *CommandTaintOption) Complete(args []string) error

Complete ensures that options are valid and marshals them if necessary

func (*CommandTaintOption) Validate added in v1.0.0

func (o *CommandTaintOption) Validate() error

Validate checks to the TaintOptions to see if there is sufficient information run the command

type CommandTokenOptions added in v1.3.0

type CommandTokenOptions struct {
	// global flags
	options.GlobalCommandOptions

	TTL         *metav1.Duration
	Description string
	Groups      []string
	Usages      []string

	PrintRegisterCommand bool
	// contains filtered or unexported fields
}

CommandTokenOptions holds all command options for token

type CommandUnjoinOption

type CommandUnjoinOption struct {
	options.GlobalCommandOptions

	// ClusterNamespace holds namespace where the member cluster secrets are stored
	ClusterNamespace string

	// ClusterName is the cluster's name that we are going to join with.
	ClusterName string

	// ClusterContext is the cluster's context that we are going to join with.
	ClusterContext string

	// ClusterKubeConfig is the cluster's kubeconfig path.
	ClusterKubeConfig string

	// DryRun tells if run the command in dry-run mode, without making any server requests.
	DryRun bool

	// Wait tells maximum command execution time
	Wait time.Duration
	// contains filtered or unexported fields
}

CommandUnjoinOption holds all command options.

func (*CommandUnjoinOption) AddFlags

func (j *CommandUnjoinOption) AddFlags(flags *pflag.FlagSet)

AddFlags adds flags to the specified FlagSet.

func (*CommandUnjoinOption) Complete

func (j *CommandUnjoinOption) Complete(args []string) error

Complete ensures that options are valid and marshals them if necessary.

func (*CommandUnjoinOption) Validate added in v0.10.0

func (j *CommandUnjoinOption) Validate(args []string) error

Validate ensures that command unjoin options are valid.

type ConfigFlags added in v0.10.0

type ConfigFlags struct {
	CaBundle *string

	// Default cache director
	CacheDir *string
	// Path to the kubeconfig file to use for CLI requests.
	KubeConfig *string

	// The name of the kubeconfig cluster to use
	ClusterName *string
	// The name of the kubeconfig user to use
	AuthInfoName *string
	// The name of the kubeconfig context to use
	Context *string
	// If present, the namespace scope for this CLI request
	Namespace *string
	// The address and port of the Kubernetes API server
	APIServer *string
	// Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
	TLSServerName *string
	// If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
	Insecure *bool
	// Path to a client certificate file for TLS
	CertFile *string
	// Path to a client key file for TLS
	KeyFile *string
	// Path to a cert file for the certificate authority
	CAFile *string
	// Bearer token for authentication to the API server
	BearerToken      *string
	Impersonate      *string
	ImpersonateGroup *[]string
	Username         *string
	Password         *string
	// The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
	Timeout *string
	// If non-nil, wrap config function can transform the Config
	// before it is returned in ToRESTConfig function.
	WrapConfigFn func(*rest.Config) *rest.Config
	// contains filtered or unexported fields
}

ConfigFlags composes the set of values necessary for obtaining a REST client config

func NewConfigFlags added in v0.10.0

func NewConfigFlags(usePersistentConfig bool) *ConfigFlags

NewConfigFlags returns ConfigFlags with default values set

func (*ConfigFlags) ToDiscoveryClient added in v0.10.0

func (f *ConfigFlags) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)

ToDiscoveryClient implements RESTClientGetter. Expects the AddFlags method to have been called. Returns a CachedDiscoveryInterface using a computed RESTConfig.

func (*ConfigFlags) ToRESTConfig added in v0.10.0

func (f *ConfigFlags) ToRESTConfig() (*rest.Config, error)

ToRESTConfig implements RESTClientGetter. Returns a REST client configuration based on a provided path to a .kubeconfig file, loading rules, and config flag overrides. Expects the AddFlags method to have been called. If WrapConfigFn is non-nil this function can transform config before return.

func (*ConfigFlags) ToRESTMapper added in v0.10.0

func (f *ConfigFlags) ToRESTMapper() (meta.RESTMapper, error)

ToRESTMapper returns a mapper.

func (*ConfigFlags) ToRawKubeConfigLoader added in v0.10.0

func (f *ConfigFlags) ToRawKubeConfigLoader() clientcmd.ClientConfig

ToRawKubeConfigLoader binds config flag values to config overrides Returns an interactive clientConfig if the password flag is enabled, or a non-interactive clientConfig otherwise.

func (*ConfigFlags) WithDeprecatedPasswordFlag added in v0.10.0

func (f *ConfigFlags) WithDeprecatedPasswordFlag() *ConfigFlags

WithDeprecatedPasswordFlag enables the username and password config flags

func (*ConfigFlags) WithDiscoveryBurst added in v0.10.0

func (f *ConfigFlags) WithDiscoveryBurst(discoveryBurst int) *ConfigFlags

WithDiscoveryBurst sets the RESTClient burst for discovery.

type CordonHelper added in v0.8.0

type CordonHelper struct {
	// contains filtered or unexported fields
}

CordonHelper wraps functionality to cordon/uncordon cluster

func NewCordonHelper added in v0.8.0

func NewCordonHelper(cluster *clusterv1alpha1.Cluster) *CordonHelper

NewCordonHelper returns a new CordonHelper that help execute the cordon and uncordon commands

func (*CordonHelper) PatchOrReplace added in v0.8.0

func (c *CordonHelper) PatchOrReplace(controlPlaneClient *karmadaclientset.Clientset) error

PatchOrReplace uses given karmada clientset to update the cluster unschedulable scheduler, either by patching or updating the given cluster object; it may return error if the object cannot be encoded as JSON, or if either patch or update calls fail; it will also return error whenever creating a patch has failed

func (*CordonHelper) UpdateIfRequired added in v0.8.0

func (c *CordonHelper) UpdateIfRequired(desired int) bool

UpdateIfRequired returns true if unscheduler taint isn't already set, or false when no change is needed

type DescribeOptions added in v1.3.0

type DescribeOptions struct {
	// global flags
	options.GlobalCommandOptions
	// flags specific to describe
	KubectlDescribeOptions *kubectldescribe.DescribeOptions
	Namespace              string
	Cluster                string
}

DescribeOptions contains the input to the describe command.

func (*DescribeOptions) Complete added in v1.3.0

func (o *DescribeOptions) Complete(karmadaConfig KarmadaConfig, cmd *cobra.Command, args []string) error

Complete ensures that options are valid and marshals them if necessary

func (*DescribeOptions) Run added in v1.3.0

func (o *DescribeOptions) Run() error

Run describe information of resources

type ExecOptions added in v1.2.0

type ExecOptions struct {
	// global flags
	options.GlobalCommandOptions
	// flags specific to exec
	KubectlExecOptions *kubectlexec.ExecOptions
	Namespace          string
	Cluster            string
}

ExecOptions declare the arguments accepted by the Exec command

func (*ExecOptions) Complete added in v1.2.0

func (o *ExecOptions) Complete(karmadaConfig KarmadaConfig, cmd *cobra.Command, argsIn []string, argsLenAtDash int) error

Complete verifies command line arguments and loads data from the command environment

func (*ExecOptions) Run added in v1.2.0

func (o *ExecOptions) Run() error

Run executes a validated remote execution against a pod.

func (*ExecOptions) Validate added in v1.2.0

func (o *ExecOptions) Validate() error

Validate checks that the provided exec options are specified.

type KarmadaConfig

type KarmadaConfig interface {
	// GetRestConfig used to get a cluster's rest config.
	GetRestConfig(context, kubeconfigPath string) (*rest.Config, error)

	// GetClientConfig returns a ClientConfig from kubeconfigPath.
	// If kubeconfigPath is empty, will search KUBECONFIG from default path.
	// If context is not empty, the returned ClientConfig's current-context is the input context.
	GetClientConfig(context, kubeconfigPath string) clientcmd.ClientConfig
}

KarmadaConfig provides a rest config based on the filesystem kubeconfig (via pathOptions) and context in order to talk to the control plane and the joining kubernetes cluster.

func NewKarmadaConfig

func NewKarmadaConfig(pathOptions *clientcmd.PathOptions) KarmadaConfig

NewKarmadaConfig creates a karmadaConfig for `karmadactl` commands.

type LogsOptions added in v1.3.0

type LogsOptions struct {
	// global flags
	options.GlobalCommandOptions
	// flags specific to logs
	KubectlLogsOptions *kubectllogs.LogsOptions
	Namespace          string
	Cluster            string
}

LogsOptions contains the input to the logs command.

func (*LogsOptions) Complete added in v1.3.0

func (o *LogsOptions) Complete(karmadaConfig KarmadaConfig, cmd *cobra.Command, args []string) error

Complete ensures that options are valid and marshals them if necessary

func (*LogsOptions) Run added in v1.3.0

func (o *LogsOptions) Run() error

Run retrieves a pod log

func (*LogsOptions) Validate added in v1.3.0

func (o *LogsOptions) Validate() error

Validate checks to the LogsOptions to see if there is sufficient information run the command

type Obj added in v0.10.0

type Obj struct {
	Cluster string
	Info    *resource.Info
}

Obj cluster info

type OtherPrint added in v0.10.0

type OtherPrint struct {
	Applied interface{}
}

OtherPrint applied is used in the display column

type RESTClientGetter added in v0.10.0

type RESTClientGetter interface {
	// ToRESTConfig returns restconfig
	ToRESTConfig() (*rest.Config, error)
	// ToDiscoveryClient returns discovery client
	ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)
	// ToRESTMapper returns a restmapper
	ToRESTMapper() (meta.RESTMapper, error)
	// ToRawKubeConfigLoader return kubeconfig loader as-is
	ToRawKubeConfigLoader() clientcmd.ClientConfig
}

RESTClientGetter is an interface that the ConfigFlags describe to provide an easier way to mock for commands and eliminate the direct coupling to a struct type. Users may wish to duplicate this type in their own packages as per the golang type overlapping.

type WatchObj added in v1.2.0

type WatchObj struct {
	Cluster string
	// contains filtered or unexported fields
}

WatchObj is a obj that is watched

Jump to

Keyboard shortcuts

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