etcd

package
v0.0.0-...-93e0f47 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LockserverLabel is the label that should be added to Pods to identify
	// which lockserver cluster they belong to.
	LockserverLabel = "etcd.planetscale.com/lockserver"
	// IndexLabel is the label used to identify the index of a member.
	IndexLabel = "etcd.planetscale.com/index"

	// NumReplicas is the number of members per etcd cluster.
	//
	// This is currently hard-coded because it doesn't really make sense to
	// allow it to be customized. Anything less than 3 cannot maintain quorum
	// if a single member becomes unavailable. Anything more than 3 adds latency
	// without providing significant benefit to Vitess.
	//
	// WARNING: DO NOT change this value. That would break all existing EtcdLockservers.
	//          The only way to change this is to implement a new feature to support
	//          having different sizes for different EtcdLockserver objects.
	NumReplicas = 3
)
View Source
const (
	ClientPortName   = "client"
	ClientPortNumber = 2379

	PeerPortName   = "peer"
	PeerPortNumber = 2380
)
View Source
const (
	// QuorumSize is the number of replicas that must be available for the etcd
	// lockserver to respond to queries.
	QuorumSize = NumReplicas/2 + 1
)

Variables

This section is empty.

Functions

func ClientServiceName

func ClientServiceName(lockserverName string) string

ClientServiceName returns the name of the etcd client Service.

func NewClientService

func NewClientService(key client.ObjectKey, labels map[string]string) *corev1.Service

NewClientService creates a new client Service.

func NewPDB

func NewPDB(key client.ObjectKey, labels map[string]string) *policyv1.PodDisruptionBudget

NewPDB creates a new PDB.

func NewPVC

func NewPVC(key client.ObjectKey, spec *Spec) *corev1.PersistentVolumeClaim

NewPVC creates a new PVC.

func NewPeerService

func NewPeerService(key client.ObjectKey, labels map[string]string) *corev1.Service

NewPeerService creates a new client Service.

func NewPod

func NewPod(key client.ObjectKey, spec *Spec) *corev1.Pod

NewPod creates a new etcd Pod.

func PDBName

func PDBName(lockserverName string) string

PDBName returns the name of the PDB for an EtcdLockserver.

func PeerServiceName

func PeerServiceName(lockserverName string) string

PeerServiceName returns the name of the etcd peer headless Service.

func PodName

func PodName(lockserverName string, index int) string

PodName returns the name of the Pod for a given etcd member.

func UpdateClientService

func UpdateClientService(svc *corev1.Service, labels map[string]string)

UpdateClientService updates the mutable parts of the client Service.

func UpdatePDBInPlace

func UpdatePDBInPlace(obj *policyv1.PodDisruptionBudget, labels map[string]string)

UpdatePDBInPlace updates an existing PDB in-place.

func UpdatePVCInPlace

func UpdatePVCInPlace(obj *corev1.PersistentVolumeClaim, spec *Spec)

UpdatePVCInPlace updates an existing PVC in-place.

func UpdatePeerService

func UpdatePeerService(svc *corev1.Service, labels map[string]string)

UpdatePeerService updates the mutable parts of the client Service.

func UpdatePod

func UpdatePod(obj *corev1.Pod, spec *Spec)

UpdatePod updates all parts of an etcd Pod to match the desired state, including parts that are immutable. If anything actually changes, the Pod must be deleted and recreated as part of a rolling update in order to converge to the desired state.

func UpdatePodInPlace

func UpdatePodInPlace(obj *corev1.Pod, spec *Spec)

UpdatePodInPlace updates only the parts of an etcd Pod that can be changed immediately by an in-place update.

Types

type Spec

type Spec struct {
	LockserverName    string
	Image             string
	ImagePullPolicy   corev1.PullPolicy
	ImagePullSecrets  []corev1.LocalObjectReference
	Resources         corev1.ResourceRequirements
	Labels            map[string]string
	Zone              string
	Index             int
	DataVolumePVCName string
	DataVolumePVCSpec *corev1.PersistentVolumeClaimSpec
	ExtraFlags        map[string]string
	ExtraEnv          []corev1.EnvVar
	ExtraVolumes      []corev1.Volume
	ExtraVolumeMounts []corev1.VolumeMount
	InitContainers    []corev1.Container
	SidecarContainers []corev1.Container
	Affinity          *corev1.Affinity
	Annotations       map[string]string
	ExtraLabels       map[string]string
	AdvertisePeerURLs []string
	Tolerations       []corev1.Toleration
}

Spec specifies all the internal parameters needed to deploy an etcd instance.

func (*Spec) Args

func (spec *Spec) Args() []string

Args returns the etcd args.

Jump to

Keyboard shortcuts

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