Documentation ¶
Overview ¶
Package kubecm implements gcfg.Adapter using kubernetes configmap.
Index ¶
- func Namespace() string
- func New(ctx context.Context, config Config) (adapter gcfg.Adapter, err error)
- func NewDefaultKubeClient(ctx context.Context) (*kubernetes.Clientset, error)
- func NewDefaultKubeConfig(ctx context.Context) (*rest.Config, error)
- func NewKubeClientFromConfig(ctx context.Context, config *rest.Config) (*kubernetes.Clientset, error)
- func NewKubeClientFromPath(ctx context.Context, kubeConfigFilePath string) (*kubernetes.Clientset, error)
- func NewKubeConfigFromPath(ctx context.Context, kubeConfigFilePath string) (*rest.Config, error)
- type Client
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Namespace ¶
func Namespace() string
Namespace retrieves and returns the namespace of current pod. Note that this function should be called in kubernetes pod.
func NewDefaultKubeClient ¶
func NewDefaultKubeClient(ctx context.Context) (*kubernetes.Clientset, error)
NewDefaultKubeClient creates and returns a default kubernetes client. It is commonly used when the service is running inside kubernetes cluster.
func NewDefaultKubeConfig ¶
NewDefaultKubeConfig creates and returns a default kubernetes config. It is commonly used when the service is running inside kubernetes cluster.
func NewKubeClientFromConfig ¶
func NewKubeClientFromConfig(ctx context.Context, config *rest.Config) (*kubernetes.Clientset, error)
NewKubeClientFromConfig creates and returns client by given `rest.Config`.
func NewKubeClientFromPath ¶
func NewKubeClientFromPath(ctx context.Context, kubeConfigFilePath string) (*kubernetes.Clientset, error)
NewKubeClientFromPath creates and returns a kubernetes REST client by given `kubeConfigFilePath`.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements gcfg.Adapter.
func (*Client) Available ¶
Available checks and returns the backend configuration service is available. The optional parameter `resource` specifies certain configuration resource.
Note that this function does not return error as it just does simply check for backend configuration service.
type Config ¶
type Config struct { ConfigMap string `v:"required"` // ConfigMap name. DataItem string `v:"required"` // DataItem is the key item in Configmap data. Namespace string // Specify the namespace for configmap. RestConfig *rest.Config // Custom rest config for kube client. KubeClient *kubernetes.Clientset // Custom kube client. Watch bool // Watch watches remote configuration updates, which updates local configuration in memory immediately when remote configuration changes. }
Config for Client.