k8s

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2021 License: MPL-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Code generated for package k8s by go-bindata DO NOT EDIT. (@generated) sources: resources/config-map.template resources/crd-cluster.json resources/crd-resource.json resources/crd.template resources/generic.template resources/headless-service.template resources/kind-cluster.template resources/kind-resource.template resources/mock-crd.template resources/mock.template resources/pod.template resources/srv-cluster-role-binding.json resources/srv-cluster-role.json resources/srv-deployment.json.template resources/srv-service-account.json

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func GetDefaultKubeConfigPath

func GetDefaultKubeConfigPath() (string, error)

GetDefaultKubeConfigPath returns the default location for the kube path

func InCluster

func InCluster() bool

InCluster returns whether we are running inside a Kubernetes pod

func MarshalPod

func MarshalPod(p *Pod) ([]byte, error)

MarshalPod marshals a pod

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

func RunTmpl

func RunTmpl(tmpl string, obj interface{}) ([]byte, error)

func RunTmpl2

func RunTmpl2(name string, obj interface{}) ([]byte, error)

Types

type Config

type Config struct {
	Host        string
	TLSConfig   *tls.Config
	BearerToken string
}

Config is the configuration for KubeClient

func GetConfig

func GetConfig() (*Config, error)

func InClusterConfig

func InClusterConfig() (*Config, error)

InClusterConfig returns the auth from inside the pod

type Item

type Item struct {
	Metadata *Metadata
	Kind     string
	Spec     map[string]interface{}
	Data     map[string]interface{}
}

type KubeClient

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

KubeClient is a kubernetes client

func NewKubeClient

func NewKubeClient(config *Config) *KubeClient

NewKubeClient creates a new KubeClient

func (*KubeClient) Delete

func (c *KubeClient) Delete(path string, obj []byte) ([]byte, error)

func (*KubeClient) Exec

func (c *KubeClient) Exec(pod, container string, path string, cmdArgs ...string) ([]byte, error)

func (*KubeClient) Get

func (c *KubeClient) Get(path string) ([]byte, error)

func (*KubeClient) HTTPReq

func (c *KubeClient) HTTPReq(method string, path string, obj []byte) ([]byte, error)

func (*KubeClient) HTTPReqWithResponse

func (c *KubeClient) HTTPReqWithResponse(method string, path string, obj []byte) (*http.Response, error)

HTTPReqWithResponse is a generic method to make http requests that returns the response object

func (*KubeClient) Post

func (c *KubeClient) Post(path string, obj []byte) ([]byte, error)

func (*KubeClient) Put

func (c *KubeClient) Put(path string, obj []byte) ([]byte, error)

type KubeConfig

type KubeConfig struct {
	Host     string
	CertFile string
	KeyFile  string
	CAFile   string
}

KubeConfig is the kubeconfig to connect with the K8s apiserver

func NewKubeConfig

func NewKubeConfig(path string, context string) (*KubeConfig, error)

NewKubeConfig loads the kube config from a given path

func (*KubeConfig) GetTLSConfig

func (k *KubeConfig) GetTLSConfig() (*tls.Config, error)

GetTLSConfig returns the tls.Config for this kubeconfig

func (*KubeConfig) ToConfig

func (k *KubeConfig) ToConfig() (*Config, error)

type ListMetadata

type ListMetadata struct {
	Continue        string
	ResourceVersion string
}

type ListOpts

type ListOpts struct {
	Continue string
	Limit    int
}

type ListResponse

type ListResponse struct {
	Items    []*Item
	Metadata ListMetadata
}

type Metadata

type Metadata struct {
	Name            string
	ResourceVersion string            `json:"resourceVersion"`
	UID             string            `json:"uid"`
	Labels          map[string]string `json:"labels"`
	Generation      int               `json:"generation"`
	Annotations     map[string]string `json:"annotations"`
	SelfLink        string            `json:"selfLink"`
}

type Pod

type Pod struct {
	Name     string
	Ensemble string
	Builder  *proto.Node_NodeSpec
}

Pod is a type to create a k8s pod

type Provider

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

Provider is a Provider implementation for kubernetes.

func K8sFactory

func K8sFactory(logger hclog.Logger, c map[string]interface{}) (*Provider, error)

func (*Provider) CreateResource

func (p *Provider) CreateResource(node *proto.Node) (*proto.Node, error)

CreateResource implements the Provider interface

func (*Provider) DeleteResource

func (p *Provider) DeleteResource(node *proto.Node) (*proto.Node, error)

DeleteResource implements the Provider interface

func (*Provider) Exec

func (p *Provider) Exec(handler string, path string, cmdArgs ...string) error

func (*Provider) Setup

func (p *Provider) Setup() error

func (*Provider) Start

func (p *Provider) Start() error

Start starts the kubernetes provider

func (*Provider) Stop

func (p *Provider) Stop()

Stop stops the kubernetes provider

func (*Provider) WatchUpdates added in v0.1.2

func (p *Provider) WatchUpdates() chan *operator.NodeUpdate

type WatchEvent added in v0.1.1

type WatchEvent struct {
	Type   string
	Object *Item
}

type Watcher added in v0.1.1

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

func (*Watcher) Start added in v0.1.1

func (w *Watcher) Start()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL