k8s

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewK8sClient

func NewK8sClient() scheduler.Scheduler

NewK8sClient - create new scheduler client

func NewWatcher

func NewWatcher(w watch.Interface) scheduler.Interface

NewWatcher - create new k8s watcher

func PodRequestsAndLimits

func PodRequestsAndLimits(pod *v1.Pod) (reqs, limits v1.ResourceList)

PodRequestsAndLimits returns a dictionary of all defined resources summed up for all containers of the pod. If pod overhead is non-nil, the pod overhead is added to the total container resource requests and to the total container limits which have a non-zero quantity.

Types

type APIClient

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

APIClient - api client

type Client

type Client struct {
	APIClient

	ConfigMap             scheduler.ConfigOperator
	Namespace             scheduler.NamespaceOperator
	Service               scheduler.ServiceOperator
	Pod                   scheduler.PodOperator
	Node                  scheduler.NodeOperator
	ReplicationController scheduler.RCOperator
	StatefulSet           scheduler.STSOperator
	DaemonSet             scheduler.DaemonSetOperator
	Deployment            scheduler.DeploymentOperator
	ReplicaSet            scheduler.ReplicaSetOperator
	// contains filtered or unexported fields
}

Client - k8s base client

func (*Client) Close

func (c *Client) Close() error

Close - release resource

func (*Client) GetConfigOperator

func (c *Client) GetConfigOperator() scheduler.ConfigOperator

GetConfigOperator - get config Operator

func (*Client) GetDaemonSetOperator

func (c *Client) GetDaemonSetOperator() scheduler.DaemonSetOperator

GetDaemonSetOperator - get DaemonSet Operator

func (*Client) GetDeploymentOperator

func (c *Client) GetDeploymentOperator() scheduler.DeploymentOperator

GetDeploymentOperator - get Deployment Operator

func (*Client) GetNamespaceOperator

func (c *Client) GetNamespaceOperator() scheduler.NamespaceOperator

GetNamespaceOperator - get namespace Operator

func (*Client) GetNodeOperator

func (c *Client) GetNodeOperator() scheduler.NodeOperator

GetNodeOperator - get node Operator

func (*Client) GetPodOperator

func (c *Client) GetPodOperator() scheduler.PodOperator

GetPodOperator - get pod Operator

func (*Client) GetRCOperator

func (c *Client) GetRCOperator() scheduler.RCOperator

GetRCOperator - get rc Operator

func (*Client) GetReplicaSetOperator

func (c *Client) GetReplicaSetOperator() scheduler.ReplicaSetOperator

GetReplicaSetOperator - get ReplicaSet Operator

func (*Client) GetSTSOperator

func (c *Client) GetSTSOperator() scheduler.STSOperator

GetSTSOperator - get sts Operator

func (*Client) GetServiceOperator

func (c *Client) GetServiceOperator() scheduler.ServiceOperator

GetServiceOperator - get service Operator

func (*Client) StartAndGC

func (c *Client) StartAndGC(config scheduler.Param) error

StartAndGC - init base object

type ClientOpts

type ClientOpts struct {
	URL         string
	Insecure    bool
	Username    string
	Password    string
	BearerToken string
	Data        interface{}
}

ClientOpts - client options

type ConfigMapClient

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

ConfigMapClient - config map client wrap

func (*ConfigMapClient) Create

func (c *ConfigMapClient) Create(ctx context.Context, param *scheduler.Config, options scheduler.Options) error

Create - create new config map

func (*ConfigMapClient) CreateWithYaml

func (c *ConfigMapClient) CreateWithYaml(ctx context.Context, param *scheduler.Config, options scheduler.Options) error

CreateWithYaml - create new config map with yaml

func (*ConfigMapClient) Delete

func (c *ConfigMapClient) Delete(ctx context.Context, param *scheduler.Config, options scheduler.Options) error

Delete - delete config map

func (*ConfigMapClient) Get

func (c *ConfigMapClient) Get(ctx context.Context, namespace string, param *scheduler.Config) (*scheduler.Config, error)

Get - query namespace list

func (*ConfigMapClient) List

func (c *ConfigMapClient) List(ctx context.Context, namespace string, options scheduler.Options) ([]*scheduler.Config, error)

List - query config map list

func (*ConfigMapClient) Update

func (c *ConfigMapClient) Update(ctx context.Context, param *scheduler.Config) error

Update - update config content

func (*ConfigMapClient) Watch

Watch - watch Config change

type DaemonSetClient

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

DaemonSetClient ...

func (*DaemonSetClient) Create

func (c *DaemonSetClient) Create(ctx context.Context, param *scheduler.DaemonSet, options scheduler.Options) error

Create - create new DaemonSets

func (*DaemonSetClient) CreateWithYaml

func (c *DaemonSetClient) CreateWithYaml(ctx context.Context, param *scheduler.DaemonSet, options scheduler.Options) error

CreateWithYaml - create new daemonSet map with yalm

func (*DaemonSetClient) Delete

func (c *DaemonSetClient) Delete(ctx context.Context, param *scheduler.DaemonSet, options scheduler.Options) error

Delete - delete DaemonSets map

func (*DaemonSetClient) Get

func (c *DaemonSetClient) Get(ctx context.Context, namespace string, param *scheduler.DaemonSet) (*scheduler.DaemonSet, error)

Get - query DaemonSets info

func (*DaemonSetClient) List

func (c *DaemonSetClient) List(ctx context.Context, namespace string, options scheduler.Options) ([]*scheduler.DaemonSet, error)

List - query DaemonSets list

func (*DaemonSetClient) Update

func (c *DaemonSetClient) Update(ctx context.Context, param *scheduler.DaemonSet) error

Update - update DaemonSets content

func (*DaemonSetClient) Watch

Watch - watch DaemonSets change

type DeploymentClient

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

DeploymentClient ...

func (*DeploymentClient) Create

func (c *DeploymentClient) Create(ctx context.Context, param *scheduler.Deployment, options scheduler.Options) error

Create - create new Deployments

func (*DeploymentClient) CreateWithYaml

func (c *DeploymentClient) CreateWithYaml(ctx context.Context, param *scheduler.Deployment, options scheduler.Options) error

CreateWithYaml - create new Deployments with yaml

func (*DeploymentClient) Delete

func (c *DeploymentClient) Delete(ctx context.Context, param *scheduler.Deployment, options scheduler.Options) error

Delete - delete Deployments map

func (*DeploymentClient) Get

Get - query Deployments info

func (*DeploymentClient) List

func (c *DeploymentClient) List(ctx context.Context, namespace string, options scheduler.Options) ([]*scheduler.Deployment, error)

List - query Deployments list

func (*DeploymentClient) Update

func (c *DeploymentClient) Update(ctx context.Context, param *scheduler.Deployment) error

Update - update Deployments content

func (*DeploymentClient) Watch

Watch - watch Deployments change

type NameSpaceClient

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

NameSpaceClient - namespace operator client

func (*NameSpaceClient) Create

func (c *NameSpaceClient) Create(ctx context.Context, param *scheduler.Namespace, options scheduler.Options) error

Create - create new namespace

func (*NameSpaceClient) CreateWithYaml

func (c *NameSpaceClient) CreateWithYaml(ctx context.Context, param *scheduler.Namespace, options scheduler.Options) error

CreateWithYaml - create new namespace with yaml

func (*NameSpaceClient) Delete

func (c *NameSpaceClient) Delete(ctx context.Context, param *scheduler.Namespace, options scheduler.Options) error

Delete - delete namespace

func (*NameSpaceClient) Get

Get - query namespace list

func (*NameSpaceClient) List

List - query namespace list

func (*NameSpaceClient) Update

func (c *NameSpaceClient) Update(ctx context.Context, param *scheduler.Namespace) error

Update - update namespace

func (*NameSpaceClient) Watch

Watch - watch Namespace change

type NodeClient

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

NodeClient ...

func (*NodeClient) Create

func (c *NodeClient) Create(ctx context.Context, param *scheduler.Node, options scheduler.Options) error

Create - create new node

func (*NodeClient) CreateWithYaml

func (c *NodeClient) CreateWithYaml(ctx context.Context, param *scheduler.Node, options scheduler.Options) error

CreateWithYaml - create new node with yaml

func (*NodeClient) Delete

func (c *NodeClient) Delete(ctx context.Context, param *scheduler.Node, options scheduler.Options) error

Delete - delete node map

func (*NodeClient) Describe

func (c *NodeClient) Describe(ctx context.Context, param *scheduler.Node) (*scheduler.NodeDetail, error)

Describe - describe node resource info

func (*NodeClient) Get

func (c *NodeClient) Get(ctx context.Context, param *scheduler.Node) (*scheduler.Node, error)

Get - query node info

func (*NodeClient) List

func (c *NodeClient) List(ctx context.Context, options scheduler.Options) ([]*scheduler.Node, error)

List - query node list

func (*NodeClient) Update

func (c *NodeClient) Update(ctx context.Context, param *scheduler.Node) error

Update - update node content

func (*NodeClient) Watch

func (c *NodeClient) Watch(ctx context.Context, param *scheduler.Node, options scheduler.Options) (scheduler.Interface, error)

Watch - watch Node change

type PodClient

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

PodClient ...

func (*PodClient) Create

func (c *PodClient) Create(ctx context.Context, param *scheduler.Pod, options scheduler.Options) error

Create - create new pod

func (*PodClient) CreateWithYaml

func (c *PodClient) CreateWithYaml(ctx context.Context, param *scheduler.Pod, options scheduler.Options) error

CreateWithYaml - create new pod with yaml

func (*PodClient) Delete

func (c *PodClient) Delete(ctx context.Context, param *scheduler.Pod, options scheduler.Options) error

Delete - delete pod map

func (*PodClient) Get

func (c *PodClient) Get(ctx context.Context, namespace string, param *scheduler.Pod) (*scheduler.Pod, error)

Get - query pod info

func (*PodClient) GetEvents

func (c *PodClient) GetEvents(ctx context.Context, param *scheduler.Pod) ([]*scheduler.Event, error)

GetEvents - query pod event

func (*PodClient) GetLogs

func (c *PodClient) GetLogs(ctx context.Context, namespace, name, container string) ([]byte, error)

GetLogs - get pod logs

func (*PodClient) List

func (c *PodClient) List(ctx context.Context, namespace string, options scheduler.Options) ([]*scheduler.Pod, error)

List - query pod list

func (*PodClient) Update

func (c *PodClient) Update(ctx context.Context, param *scheduler.Pod) error

Update - update pod content

func (*PodClient) Watch

func (c *PodClient) Watch(ctx context.Context, param *scheduler.Pod, options scheduler.Options) (scheduler.Interface, error)

Watch - watch Pod change

type ReplicaSetClient

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

ReplicaSetClient ...

func (*ReplicaSetClient) Create

func (c *ReplicaSetClient) Create(ctx context.Context, param *scheduler.ReplicaSet, options scheduler.Options) error

Create - create new ReplicaSets

func (*ReplicaSetClient) CreateWithYaml

func (c *ReplicaSetClient) CreateWithYaml(ctx context.Context, param *scheduler.ReplicaSet, options scheduler.Options) error

CreateWithYaml - create new ReplicaSet with yaml

func (*ReplicaSetClient) Delete

func (c *ReplicaSetClient) Delete(ctx context.Context, param *scheduler.ReplicaSet, options scheduler.Options) error

Delete - delete ReplicaSets map

func (*ReplicaSetClient) Get

Get - query ReplicaSets info

func (*ReplicaSetClient) List

func (c *ReplicaSetClient) List(ctx context.Context, namespace string, options scheduler.Options) ([]*scheduler.ReplicaSet, error)

List - query ReplicaSets list

func (*ReplicaSetClient) Update

func (c *ReplicaSetClient) Update(ctx context.Context, param *scheduler.ReplicaSet) error

Update - update ReplicaSets content

func (*ReplicaSetClient) Watch

Watch - watch ReplicaSet change

type ReplicationControllerClient

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

ReplicationControllerClient replication controller client

func (*ReplicationControllerClient) Create

Create - create new ReplicationControllers

func (*ReplicationControllerClient) CreateWithYaml

func (c *ReplicationControllerClient) CreateWithYaml(ctx context.Context, param *scheduler.RC, options scheduler.Options) error

CreateWithYaml - create new ReplicationControllers with yaml

func (*ReplicationControllerClient) Delete

Delete - delete ReplicationControllers map

func (*ReplicationControllerClient) Get

func (c *ReplicationControllerClient) Get(ctx context.Context, namespace string, param *scheduler.RC) (*scheduler.RC, error)

Get - query ReplicationControllers info

func (*ReplicationControllerClient) List

func (c *ReplicationControllerClient) List(ctx context.Context, namespace string, options scheduler.Options) ([]*scheduler.RC, error)

List - query ReplicationControllers list

func (*ReplicationControllerClient) Update

Update - update ReplicationControllers content

func (*ReplicationControllerClient) Watch

Watch - watch RC change

type ServiceClient

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

ServiceClient ...

func (*ServiceClient) Create

func (c *ServiceClient) Create(ctx context.Context, param *scheduler.Service, options scheduler.Options) error

Create - create new service map

func (*ServiceClient) CreateWithYaml

func (c *ServiceClient) CreateWithYaml(ctx context.Context, param *scheduler.Service, options scheduler.Options) error

CreateWithYaml - create new service with yaml

func (*ServiceClient) Delete

func (c *ServiceClient) Delete(ctx context.Context, param *scheduler.Service, options scheduler.Options) error

Delete - delete service map

func (*ServiceClient) Get

func (c *ServiceClient) Get(ctx context.Context, namespace string, param *scheduler.Service) (*scheduler.Service, error)

Get - query service list

func (*ServiceClient) List

func (c *ServiceClient) List(ctx context.Context, namespace string, options scheduler.Options) ([]*scheduler.Service, error)

List - query service map list

func (*ServiceClient) Update

func (c *ServiceClient) Update(ctx context.Context, param *scheduler.Service) error

Update - update service content

func (*ServiceClient) Watch

Watch - watch Service change

type StatefulSetClient

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

StatefulSetClient ...

func (*StatefulSetClient) Create

func (c *StatefulSetClient) Create(ctx context.Context, param *scheduler.STS, options scheduler.Options) error

Create - create new StatefulSets

func (*StatefulSetClient) CreateWithYaml

func (c *StatefulSetClient) CreateWithYaml(ctx context.Context, param *scheduler.STS, options scheduler.Options) error

CreateWithYaml - create new StatefulSet with yaml

func (*StatefulSetClient) Delete

func (c *StatefulSetClient) Delete(ctx context.Context, param *scheduler.STS, options scheduler.Options) error

Delete - delete StatefulSets map

func (*StatefulSetClient) Get

func (c *StatefulSetClient) Get(ctx context.Context, namespace string, param *scheduler.STS) (*scheduler.STS, error)

Get - query StatefulSets info

func (*StatefulSetClient) List

func (c *StatefulSetClient) List(ctx context.Context, namespace string, options scheduler.Options) ([]*scheduler.STS, error)

List - query StatefulSets list

func (*StatefulSetClient) Update

func (c *StatefulSetClient) Update(ctx context.Context, param *scheduler.STS) error

Update - update StatefulSets content

func (*StatefulSetClient) Watch

Watch - watch StatefulSets change

Jump to

Keyboard shortcuts

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