k8sutil

package
v0.0.0-...-6c4e8d0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EtcdClientPort is the client port on client service and etcd nodes.
	EtcdClientPort                     = 2379
	TolerateUnreadyEndpointsAnnotation = "service.alpha.kubernetes.io/tolerate-unready-endpoints"

	// k8s object name has a maximum length
	MaxNameLength = 63 - randomSuffixLength - 1

	// AnnotationScope annotation name for defining instance scope. Used for specifying cluster wide clusters.
	AnnotationScope = "etcd.database.coreos.com/scope"
	//AnnotationClusterWide annotation value for cluster wide clusters.
	AnnotationClusterWide = "clusterwide"
)

Variables

This section is empty.

Functions

func AddEtcdVolumeToPod

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

AddEtcdVolumeToPod abstract the process of appending volume spec to pod spec

func ClusterListOpt

func ClusterListOpt(clusterName string) metav1.ListOptions

We are using internal api types for cluster related.

func CreatePatch

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

func GetEtcdVersion

func GetEtcdVersion(pod *v1.Pod) string

func GetPodNames

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

func GetReadyMasterNodes

func GetReadyMasterNodes(lister corelisters.NodeLister) ([]*v1.Node, error)

func ImageName

func ImageName(repo, version string) string

func InitClusterVersion

func InitClusterVersion(cli kubernetes.Interface) error

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 NewEtcdPod

func NewEtcdPod(m *etcdutil.Member, initialCluster []string, clusterName, state, token string, cs api.EtcdClusterSpec, owner metav1.OwnerReference) *v1.Pod

func NewEtcdPodPVC

func NewEtcdPodPVC(m *etcdutil.Member, pvcSpec v1.PersistentVolumeClaimSpec, clusterName, namespace string, owner metav1.OwnerReference) *v1.PersistentVolumeClaim

NewEtcdPodPVC create PVC object from etcd pod's PVC spec

func NewSeedMemberPod

func NewSeedMemberPod(clusterName string, ms etcdutil.MemberSet, m *etcdutil.Member, cs api.EtcdClusterSpec, owner metav1.OwnerReference, backupURL *url.URL) *v1.Pod

NewSeedMemberPod returns a Pod manifest for a seed member. It's special that it has new token, and might need recovery init containers

func PVCNameFromMember

func PVCNameFromMember(memberName string) string

PVCNameFromMember the way we get PVC name from the member name

func PodSpecToPrettyJSON

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

func PodWithNodeSelector

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

func SetEtcdVersion

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

func UniqueMemberName

func UniqueMemberName(clusterName string) string

Types

type ClusterVersion

type ClusterVersion interface {
	GetRawVersion() string
	GetSemVerion() *semver.Version
	IsLessThan(iv string) bool
	IsGreatOrEqualThan(iv string) bool
	IsGreatOrEqualThanV120() bool
	GetIngressGVR() schema.GroupVersionResource
}

func GetClusterVersion

func GetClusterVersion() ClusterVersion

type TLSData

type TLSData struct {
	CertData []byte
	KeyData  []byte
	CAData   []byte
}

func GetTLSDataFromSecret

func GetTLSDataFromSecret(kubecli kubernetes.Interface, ns, se string) (*TLSData, error)

GetTLSDataFromSecret retrives the kubernete secret that contain etcd tls certs and put them into TLSData.

Jump to

Keyboard shortcuts

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