Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var GetClient = func(cluster provTypes.Cluster) (kubernetes.Interface, error) { config, err := RestConfig(cluster) if err != nil { return nil, err } return kubernetes.NewForConfig(config) }
GetClient func may be overridden in tests
View Source
var GetClientWithRestConfig = func(config *rest.Config) (kubernetes.Interface, error) { return kubernetes.NewForConfig(config) }
View Source
var GetClientset = func(cluster provTypes.Cluster) (apiextensionsclientset.Interface, error) { config, err := RestConfig(cluster) if err != nil { return nil, err } return apiextensionsclientset.NewForConfig(config) }
GetClientset func may be overridden in tests
View Source
var GetTsuruClient = func(cluster provTypes.Cluster) (tsuruv1clientset.Interface, error) { config, err := RestConfig(cluster) if err != nil { return nil, err } return tsuruv1clientset.NewForConfig(config) }
GetTsuruClient func may be overridden in tests
View Source
var GetTsuruClientWithRestConfig = func(config *rest.Config) (tsuruv1clientset.Interface, error) { return tsuruv1clientset.NewForConfig(config) }
View Source
var RestConfig = func(cluster provTypes.Cluster) (*rest.Config, error) { gv, err := schema.ParseGroupVersion("/v1") if err != nil { return nil, err } if cluster.KubeConfig != nil { return getRestConfigByKubeConfig(cluster) } cfg := &rest.Config{ APIPath: "/api", ContentConfig: rest.ContentConfig{ GroupVersion: &gv, NegotiatedSerializer: serializer.WithoutConversionCodecFactory{CodecFactory: scheme.Codecs}, }, Timeout: viper.GetDuration("http.timeout"), } if len(cluster.Addresses) == 0 { return nil, errors.New("no addresses for cluster") } addr := cluster.Addresses[rand.Intn(len(cluster.Addresses))] var token, user, password string if cluster.CustomData != nil { token = cluster.CustomData[tokenClusterKey] user = cluster.CustomData[userClusterKey] password = cluster.CustomData[passwordClusterKey] } cfg.Host = addr cfg.TLSClientConfig = rest.TLSClientConfig{ CAData: cluster.CaCert, CertData: cluster.ClientCert, KeyData: cluster.ClientKey, } if user != "" && password != "" { cfg.Username = user cfg.Password = password } else { cfg.BearerToken = token } cfg.Wrap(external.MetricsRoundTripper) return cfg, nil }
Functions ¶
func DefaultNamespace ¶
func DefaultNamespace() string
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.