k8sutil

package
v0.0.0-...-2a28ce9 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2018 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ZookeeperClientPort is the client port on client service and zookeeper nodes.
	ZookeeperClientPort = 2181

	// AnnotationScope annotation name for defining instance scope. Used for specifing cluster wide clusters.
	AnnotationScope = "zookeeper.database.apache.com/scope"
	//AnnotationClusterWide annotation value for cluster wide clusters.
	AnnotationClusterWide = "clusterwide"
)
View Source
const TolerateUnreadyEndpointsAnnotation = "service.alpha.kubernetes.io/tolerate-unready-endpoints"

Variables

This section is empty.

Functions

func AddZookeeperVolumeToPod

func AddZookeeperVolumeToPod(pod *v1.Pod, pvc *v1.PersistentVolumeClaim)

AddZookeeperVolumeToPod abstract the process of appending volume spec to pod spec

func CascadeDeleteOptions

func CascadeDeleteOptions(gracePeriodSeconds int64) *metav1.DeleteOptions

func ClientServiceName

func ClientServiceName(clusterName string) string

func ClusterListOpt

func ClusterListOpt(clusterName string) metav1.ListOptions

We are using internal api types for cluster related.

func CreateAndWaitPod

func CreateAndWaitPod(kubecli kubernetes.Interface, ns string, pod *v1.Pod, timeout time.Duration) (*v1.Pod, error)

CreateAndWaitPod creates a pod and waits until it is running

func CreateCRD

func CreateCRD(clientset apiextensionsclient.Interface, crdName, rkind, rplural, shortName string) error

func CreateClientService

func CreateClientService(kubecli kubernetes.Interface, clusterName, ns string, owner metav1.OwnerReference) error

func CreatePatch

func CreatePatch(o, n, datastruct interface{}) ([]byte, error)

func CreatePeerService

func CreatePeerService(kubecli kubernetes.Interface, clusterName, ns string, owner metav1.OwnerReference) error

func GetClusterList

func GetClusterList(restcli rest.Interface, ns string) (*api.ZookeeperClusterList, error)

func GetPodNames

func GetPodNames(pods []*v1.Pod) []string

func GetZookeeperVersion

func GetZookeeperVersion(pod *v1.Pod) string

func ImageName

func ImageName(repo, version string) string

func InClusterConfig

func InClusterConfig() (*rest.Config, error)

func IsKubernetesResourceAlreadyExistError

func IsKubernetesResourceAlreadyExistError(err error) bool

func IsKubernetesResourceNotFoundError

func IsKubernetesResourceNotFoundError(err error) bool

func IsNodeReady

func IsNodeReady(n v1.Node) bool

IsNodeReady checks if the Node condition is ready.

func IsPodReady

func IsPodReady(pod *v1.Pod) bool

IsPodReady returns false if the Pod Status is nil

func LabelsForCluster

func LabelsForCluster(clusterName string) map[string]string

func MemberRemoveEvent

func MemberRemoveEvent(memberName string, cl *api.ZookeeperCluster) *v1.Event

func MemberUpgradedEvent

func MemberUpgradedEvent(memberName, oldVersion, newVersion string, cl *api.ZookeeperCluster) *v1.Event

func MustNewKubeClient

func MustNewKubeClient() kubernetes.Interface

func MustNewKubeExtClient

func MustNewKubeExtClient() apiextensionsclient.Interface

func NewMemberAddEvent

func NewMemberAddEvent(memberName string, cl *api.ZookeeperCluster) *v1.Event

func NewZookeeperPod

func NewZookeeperPod(m *zookeeperutil.Member, existingCluster []string, clusterName, state string, cs api.ClusterSpec, owner metav1.OwnerReference) *v1.Pod

func PVCNameFromMember

func PVCNameFromMember(memberName string) string

PVCNameFromMember the way we get PVC name from the member name

func PatchDeployment

func PatchDeployment(kubecli kubernetes.Interface, namespace, name string, updateFunc func(*appsv1beta1.Deployment)) error

func PodSpecToPrettyJSON

func PodSpecToPrettyJSON(pod *v1.Pod) (string, error)

func PodWithNodeSelector

func PodWithNodeSelector(p *v1.Pod, ns map[string]string) *v1.Pod

func ReplacingDeadMemberEvent

func ReplacingDeadMemberEvent(memberName string, cl *api.ZookeeperCluster) *v1.Event

func SetZookeeperVersion

func SetZookeeperVersion(pod *v1.Pod, version string)

func UniqueMemberName

func UniqueMemberName(clusterName string) string

func WaitCRDReady

func WaitCRDReady(clientset apiextensionsclient.Interface, crdName string) error

Types

type ZookeeperClusterCRUpdateFunc

type ZookeeperClusterCRUpdateFunc func(*api.ZookeeperCluster)

ZookeeperClusterCRUpdateFunc is a function to be used when atomically updating a Cluster CR.

Jump to

Keyboard shortcuts

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