karmadactl

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCluster added in v0.3.0

func CreateCluster(controlPlaneClient karmadaclientset.Interface, cluster *clusterv1alpha1.Cluster) (*clusterv1alpha1.Cluster, error)

CreateCluster creates a new cluster object in control plane.

func CreateClusterObject added in v0.5.0

func CreateClusterObject(controlPlaneClient *karmadaclientset.Clientset, clusterObj *clusterv1alpha1.Cluster, errorOnExisting bool) (*clusterv1alpha1.Cluster, error)

CreateClusterObject create cluster object in karmada control plane

func GetCluster added in v0.3.0

func GetCluster(client karmadaclientset.Interface, namespace string, name string) (*clusterv1alpha1.Cluster, bool, error)

GetCluster tells if a cluster (namespace/name) already joined to control plane.

func NewCmdJoin

func NewCmdJoin(cmdOut io.Writer, karmadaConfig KarmadaConfig) *cobra.Command

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

func NewCmdUnjoin

func NewCmdUnjoin(cmdOut io.Writer, karmadaConfig KarmadaConfig) *cobra.Command

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

func NewKarmadaCtlCommand

func NewKarmadaCtlCommand(out io.Writer) *cobra.Command

NewKarmadaCtlCommand creates the `karmadactl` command.

func RunJoin

func RunJoin(cmdOut io.Writer, karmadaConfig KarmadaConfig, opts CommandJoinOption) error

RunJoin is the implementation of the 'join' command. TODO(RainbowMango): consider to remove the 'KarmadaConfig'.

func RunUnjoin

func RunUnjoin(cmdOut io.Writer, karmadaConfig KarmadaConfig, opts CommandUnjoinOption) error

RunUnjoin is the implementation of the 'unjoin' command. TODO(RainbowMango): consider to remove the 'KarmadaConfig'.

Types

type CommandJoinOption

type CommandJoinOption struct {
	options.GlobalCommandOptions

	// 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
}

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() []error

Validate checks option and return a slice of found errs.

type CommandUnjoinOption

type CommandUnjoinOption struct {
	options.GlobalCommandOptions

	// 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
	// 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.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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