Documentation ¶
Index ¶
- func CreateCluster(controlPlaneClient karmadaclientset.Interface, ...) (*clusterv1alpha1.Cluster, error)
- func CreateClusterObject(controlPlaneClient *karmadaclientset.Clientset, ...) (*clusterv1alpha1.Cluster, error)
- func GetCluster(client karmadaclientset.Interface, name string) (*clusterv1alpha1.Cluster, bool, error)
- func JoinCluster(controlPlaneRestConfig, clusterConfig *rest.Config, ...) (err error)
- func NewCmdCordon(cmdOut io.Writer, karmadaConfig KarmadaConfig) *cobra.Command
- func NewCmdJoin(cmdOut io.Writer, karmadaConfig KarmadaConfig) *cobra.Command
- func NewCmdUncordon(cmdOut io.Writer, karmadaConfig KarmadaConfig) *cobra.Command
- func NewCmdUnjoin(cmdOut io.Writer, karmadaConfig KarmadaConfig) *cobra.Command
- func NewCmdVersion(out io.Writer) *cobra.Command
- func NewKarmadaCtlCommand(out io.Writer) *cobra.Command
- func RunCordonOrUncordon(_ io.Writer, desired int, karmadaConfig KarmadaConfig, ...) error
- func RunJoin(cmdOut io.Writer, karmadaConfig KarmadaConfig, opts CommandJoinOption) error
- func RunUnjoin(cmdOut io.Writer, karmadaConfig KarmadaConfig, opts CommandUnjoinOption) error
- func UnJoinCluster(controlPlaneRestConfig, clusterConfig *rest.Config, ...) (err error)
- type CommandCordonOption
- type CommandJoinOption
- type CommandUnjoinOption
- type CordonHelper
- 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, name string) (*clusterv1alpha1.Cluster, bool, error)
GetCluster tells if a cluster already joined to control plane.
func JoinCluster ¶ added in v0.8.0
func JoinCluster(controlPlaneRestConfig, clusterConfig *rest.Config, clusterNamespace, clusterName string, dryRun bool) (err error)
JoinCluster join the cluster into karmada. Note: ignore the cyclomatic complexity issue to get gocyclo on board. Tracked by: https://github.com/karmada-io/karmada/issues/460
func NewCmdCordon ¶ added in v0.8.0
func NewCmdCordon(cmdOut io.Writer, karmadaConfig KarmadaConfig) *cobra.Command
NewCmdCordon defines the `cordon` command that mark cluster as unschedulable.
func NewCmdJoin ¶
func NewCmdJoin(cmdOut io.Writer, karmadaConfig KarmadaConfig) *cobra.Command
NewCmdJoin defines the `join` command that registers a cluster.
func NewCmdUncordon ¶ added in v0.8.0
func NewCmdUncordon(cmdOut io.Writer, karmadaConfig KarmadaConfig) *cobra.Command
NewCmdUncordon defines the `cordon` command that mark cluster as schedulable.
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 NewCmdVersion ¶ added in v0.6.0
NewCmdVersion prints out the release version info for this command binary.
func NewKarmadaCtlCommand ¶
NewKarmadaCtlCommand creates the `karmadactl` command.
func RunCordonOrUncordon ¶ added in v0.8.0
func RunCordonOrUncordon(_ io.Writer, 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(cmdOut io.Writer, karmadaConfig KarmadaConfig, opts CommandJoinOption) error
RunJoin is the implementation of the 'join' command.
func RunUnjoin ¶
func RunUnjoin(cmdOut io.Writer, karmadaConfig KarmadaConfig, opts CommandUnjoinOption) error
RunUnjoin is the implementation of the 'unjoin' command.
Types ¶
type CommandCordonOption ¶ added in v0.8.0
type CommandCordonOption struct { // KubeConfig holds the control plane KUBECONFIG file path. KubeConfig string // ClusterContext is the name of the cluster context in control plane KUBECONFIG file. // Default value is the current-context. KarmadaContext string // DryRun tells if run the command in dry-run mode, without making any server requests. DryRun bool // ClusterName is the cluster's name that we are going to join with. ClusterName string }
CommandCordonOption holds all command options for cordon and uncordon
func (*CommandCordonOption) AddFlags ¶ added in v0.8.0
func (o *CommandCordonOption) AddFlags(flags *pflag.FlagSet)
AddFlags adds flags to the specified FlagSet.
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.
func (*CommandCordonOption) Validate ¶ added in v0.8.0
func (o *CommandCordonOption) Validate() []error
Validate checks option and return a slice of found errs.
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 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, 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 a second 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 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.