Documentation ¶
Overview ¶
Package config wraps kubectl config (namely, ~/.kube/config by default) and incorporate tidb cluster specific configurations setted by 'tkc use'. This helps commands to find and access target tidb cluster and related resources.
Index ¶
- type TidbClusterConfig
- type TkcClientConfig
- type TkcContext
- func (c *TkcContext) KubeBuilder() *resource.Builder
- func (c *TkcContext) SwitchTidbCluster(context, namespace, clusterName string) error
- func (c *TkcContext) TkcBuilder() *resource.Builder
- func (c *TkcContext) ToKubectlRestConfig() (*rest.Config, error)
- func (c *TkcContext) ToRESTConfig() (*rest.Config, error)
- func (c *TkcContext) ToTkcClientConfig() (*TkcClientConfig, error)
- type TkcOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TidbClusterConfig ¶
type TidbClusterConfig struct { KubeContext string `json:"context,omitempty"` Namespace string `json:"namespace,omitempty"` ClusterName string `json:"clusterName,omitempty"` }
TidbClusterConfig indicates which tidb cluster to use.
func Load ¶
func Load(s string) (*TidbClusterConfig, error)
func LoadFile ¶
func LoadFile(filename string) (*TidbClusterConfig, error)
type TkcClientConfig ¶
type TkcClientConfig struct { TidbClusterConfig *TidbClusterConfig // contains filtered or unexported fields }
TkcClientConfig is loaded client configuration that ready to use
func (*TkcClientConfig) Namespace ¶
func (c *TkcClientConfig) Namespace() (string, bool, error)
Namespace returns
func (*TkcClientConfig) RestConfig ¶
func (c *TkcClientConfig) RestConfig() (*restclient.Config, error)
func (*TkcClientConfig) TidbClusterName ¶
func (c *TkcClientConfig) TidbClusterName() (string, bool)
TidbClusterName returns the tidb cluster name and whether tidb cluster has been set
type TkcContext ¶
type TkcContext struct { *genericclioptions.ConfigFlags TidbClusterConfig *TidbClusterConfig TkcOptions *TkcOptions // contains filtered or unexported fields }
TkcContext wraps the configuration and credential for tidb cluster accessing.
func NewTkcContext ¶
func NewTkcContext(kubeFlags *genericclioptions.ConfigFlags, tkcOptions *TkcOptions) *TkcContext
NewTkcContext create a TkcContext
func (*TkcContext) KubeBuilder ¶
func (c *TkcContext) KubeBuilder() *resource.Builder
KubeBuilder returns a builder that operates on generic objects under original kubectl context
func (*TkcContext) SwitchTidbCluster ¶
func (c *TkcContext) SwitchTidbCluster(context, namespace, clusterName string) error
SwitchTidbCluster store current tidb cluster configuration to local file, this action will not affect the configured context and namespace.
func (*TkcContext) TkcBuilder ¶
func (c *TkcContext) TkcBuilder() *resource.Builder
TkcBuilder returns a builder that operates on generic objects under tkc context
func (*TkcContext) ToKubectlRestConfig ¶
func (c *TkcContext) ToKubectlRestConfig() (*rest.Config, error)
ToKubectlRestConfig returns the rest config under kubectl context
func (*TkcContext) ToRESTConfig ¶
func (c *TkcContext) ToRESTConfig() (*rest.Config, error)
ToRestConfig overrides ConfigFlags.ToRestConfig()
func (*TkcContext) ToTkcClientConfig ¶
func (c *TkcContext) ToTkcClientConfig() (*TkcClientConfig, error)
ToTkcConfigLoader create the tkc client config for tidb cluster which overrides the tidb cluster context and namespace to the raw kubectl config
type TkcOptions ¶
type TkcOptions struct {
TidbClusterName string
}
TkcOptions stores persistent flags (global flags) for all tkc subcommands