k8s

package
v0.0.0-...-d5049b0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPulsarNamespace is the default pulsar namespace in the cluster
	DefaultPulsarNamespace = "pulsar"

	// ZookeeperSts is zookeeper sts name
	ZookeeperSts = "zookeeper"

	// BookkeeperSts is bookkeeper sts name
	BookkeeperSts = "bookkeeper"

	// BrokerDeployment is the broker deployment name
	BrokerDeployment = "broker"

	// BrokerSts is the broker deployment name
	BrokerSts = "brokersts"

	// ProxyDeployment is the proxy deployment name
	ProxyDeployment = "proxy"

	// FunctionWorkerDeployment is the function worker deployment name
	FunctionWorkerDeployment = "functionWorker"
)

Variables

This section is empty.

Functions

func GetObjectMetaData

func GetObjectMetaData(obj interface{}) meta_v1.ObjectMeta

GetObjectMetaData returns metadata of a given k8s object

Types

type Client

type Client struct {
	Clientset        *kubernetes.Clientset
	Metrics          *metrics.Clientset
	ClusterName      string
	DefaultNamespace string
	Status           ClusterStatusCode
	Zookeeper        StatefulSet
	Bookkeeper       StatefulSet
	BrokerSts        StatefulSet
	Broker           Deployment
	Proxy            Deployment
	FunctionWorker   StatefulSet
}

Client is the k8s client object

func GetK8sClient

func GetK8sClient(pulsarNamespace string) (*Client, error)

GetK8sClient gets k8s clientset

func (*Client) EvalHealth

func (c *Client) EvalHealth() (string, ClusterStatus)

EvalHealth evaluate the health of cluster status

func (*Client) GetNodeResource

func (c *Client) GetNodeResource()

GetNodeResource gets the node total available memory

func (*Client) UpdateReplicas

func (c *Client) UpdateReplicas(namespace string) error

UpdateReplicas updates the replicas for deployments and sts

func (*Client) WatchPodResource

func (c *Client) WatchPodResource(namespace, component string) error

WatchPodResource watches pod's resource

func (*Client) WatchPods

func (c *Client) WatchPods(namespace string) error

WatchPods watches the running pods vs intended replicas

type ClusterStatus

type ClusterStatus struct {
	ZookeeperOfflineInstances  int
	BookkeeperOfflineInstances int
	BrokerOfflineInstances     int
	BrokerStsOfflineInstances  int
	ProxyOfflineInstances      int
	Status                     ClusterStatusCode
}

ClusterStatus is the health status of the cluster and its components

type ClusterStatusCode

type ClusterStatusCode int

ClusterStatusCode is the high level health of cluster status

const (
	// TotalDown is the initial status
	TotalDown ClusterStatusCode = iota

	// OK is the healthy status
	OK

	// PartialReady is some parts of system are ok
	PartialReady
)

type Deployment

type Deployment struct {
	Name      string
	Replicas  int32
	Instances int32
}

Deployment is the k8s deployment

type StatefulSet

type StatefulSet struct {
	Name      string
	Replicas  int32
	Instances int32
}

StatefulSet is the k8s sts

Jump to

Keyboard shortcuts

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