Documentation ¶
Index ¶
- func CreateCluster(controlPlaneClient karmadaclientset.Interface, ...) (*clusterv1alpha1.Cluster, error)
- func CreateClusterObject(controlPlaneClient *karmadaclientset.Clientset, ...) (*clusterv1alpha1.Cluster, error)
- func GetCluster(client karmadaclientset.Interface, namespace string, name string) (*clusterv1alpha1.Cluster, bool, error)
- func NewCmdJoin(cmdOut io.Writer, karmadaConfig KarmadaConfig) *cobra.Command
- func NewCmdUnjoin(cmdOut io.Writer, karmadaConfig KarmadaConfig) *cobra.Command
- func NewKarmadaCtlCommand(out io.Writer) *cobra.Command
- func RunJoin(cmdOut io.Writer, karmadaConfig KarmadaConfig, opts CommandJoinOption) error
- func RunUnjoin(cmdOut io.Writer, karmadaConfig KarmadaConfig, opts CommandUnjoinOption) error
- type CommandJoinOption
- type CommandUnjoinOption
- type KarmadaConfig
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 ¶
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.