client

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2020 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Overview

Package client ships helper functions for building and using Kubernetes client.

Index

Constants

View Source
const (
	// PollInterval defines how long we wait before next attempt while waiting for the objects.
	PollInterval = 5 * time.Second
	// RetryTimeout defines how long we wait before timing out waiting for the objects.
	RetryTimeout = 5 * time.Minute
)

Variables

This section is empty.

Functions

func NewClientset

func NewClientset(data []byte) (*kubernetes.Clientset, error)

NewClientset returns Kubernetes clientset object from kubeconfig string.

Types

type Client

type Client interface {
	CheckNodeExists(name string) func() (bool, error)
	WaitForNode(name string) error
	LabelNode(name string, labels map[string]string) error
	PingWait() error
}

Client defines exported capabilities of flexkube k8s client.

func NewClient

func NewClient(kubeconfig []byte) (Client, error)

NewClient takes content of kubeconfig file as an argument and returns flexkube kubernetes client, which implements bunch of helper methods for Kubernetes API.

type Config

type Config struct {
	Server            string            `json:"server"`
	CACertificate     types.Certificate `json:"caCertificate"`
	ClientCertificate types.Certificate `json:"clientCertificate"`
	ClientKey         types.PrivateKey  `json:"clientKey"`
}

Config is a simplified version of kubeconfig.

func (*Config) ToYAMLString

func (c *Config) ToYAMLString() (string, error)

ToYAMLString converts given configuration to kubeconfig format as YAML text

func (*Config) Validate

func (c *Config) Validate() error

Validate validates Config struct.

type Getter

type Getter struct {
	// contains filtered or unexported fields
}

Getter implements k8s.io/cli-runtime/pkg/genericclioptions.RESTClientGetter interface

func NewGetter

func NewGetter(data []byte) (*Getter, error)

NewGetter takes content of kubeconfig file as an argument and returns implementation of RESTClientGetter k8s interface.

func (*Getter) ToDiscoveryClient

func (c *Getter) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)

ToDiscoveryClient is part of k8s.io/cli-runtime/pkg/genericclioptions.RESTClientGetter interface

func (*Getter) ToRESTConfig

func (c *Getter) ToRESTConfig() (*rest.Config, error)

ToRESTConfig is part of k8s.io/cli-runtime/pkg/genericclioptions.RESTClientGetter interface

func (*Getter) ToRESTMapper

func (c *Getter) ToRESTMapper() (meta.RESTMapper, error)

ToRESTMapper is part of k8s.io/cli-runtime/pkg/genericclioptions.RESTClientGetter interface

func (*Getter) ToRawKubeConfigLoader

func (c *Getter) ToRawKubeConfigLoader() clientcmd.ClientConfig

ToRawKubeConfigLoader is part of k8s.io/cli-runtime/pkg/genericclioptions.RESTClientGetter interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳