Documentation ¶
Index ¶
- Constants
- func AddConfigMapDigestSuffix(cm *corev1.ConfigMap) error
- func DeleteStatefulSetWithOrphan(ctx context.Context, setCtl controller.StatefulSetControlInterface, ...) error
- func FindConfigMapNameFromTCAnno(ctx context.Context, cmLister corelisters.ConfigMapLister, ...) (cmName string, _ error)
- func FindConfigMapVolume(podSpec *corev1.PodSpec, pred func(string) bool) string
- func SetStatefulSetLastAppliedConfigAnnotation(set *apps.StatefulSet) error
- func SetUpgradePartition(set *apps.StatefulSet, upgradeOrdinal int32)
- func Sha256Sum(v interface{}) (string, error)
- func StatefulSetIsUpgrading(set *apps.StatefulSet) bool
- func UpdateConfigMapIfNeed(cmLister corelisters.ConfigMapLister, ...) error
- func UpdateStatefulSet(setCtl controller.StatefulSetControlInterface, object runtime.Object, ...) error
- func UpdateStatefulSetWithPrecheck(deps *controller.Dependencies, tc *v1alpha1.TidbCluster, reason string, ...) error
- type ContainerBuilder
- func (cb *ContainerBuilder) AddEnvFroms(envFroms ...corev1.EnvFromSource)
- func (cb *ContainerBuilder) AddEnvs(envs ...corev1.EnvVar)
- func (cb *ContainerBuilder) AddVolumeMounts(mounts ...corev1.VolumeMount)
- func (cb *ContainerBuilder) Clone() *corev1.Container
- func (cb *ContainerBuilder) Get() *corev1.Container
- type PodTemplateSpecBuilder
- func (b *PodTemplateSpecBuilder) AddAnnotations(annos map[string]string)
- func (pb *PodTemplateSpecBuilder) AddContainers(containers ...corev1.Container)
- func (b *PodTemplateSpecBuilder) AddLabels(labels map[string]string)
- func (b *PodTemplateSpecBuilder) AddVolumes(volumes ...corev1.Volume)
- func (pb *PodTemplateSpecBuilder) Clone() *corev1.PodTemplateSpec
- func (pb *PodTemplateSpecBuilder) ContainerBuilder(name string) *ContainerBuilder
- func (pb *PodTemplateSpecBuilder) Get() *corev1.PodTemplateSpec
- type StatefulSetBuilder
Constants ¶
const (
// LastAppliedConfigAnnotation is annotation key of last applied configuration
LastAppliedConfigAnnotation = "pingcap.com/last-applied-configuration"
)
Variables ¶
This section is empty.
Functions ¶
func DeleteStatefulSetWithOrphan ¶ added in v1.5.3
func DeleteStatefulSetWithOrphan( ctx context.Context, setCtl controller.StatefulSetControlInterface, tcCtl controller.TidbClusterControlInterface, tc *v1alpha1.TidbCluster, sts *apps.StatefulSet) error
func FindConfigMapNameFromTCAnno ¶ added in v1.5.3
func FindConfigMapNameFromTCAnno(ctx context.Context, cmLister corelisters.ConfigMapLister, tc *v1alpha1.TidbCluster, componentType v1alpha1.MemberType, newCm *corev1.ConfigMap) (cmName string, _ error)
FindConfigMapNameFromTCAnno is used to find ConfigMap name from tc.annotations which is saved before deleting STS. If the data of ConfigMap referenced in anno matches the newCm's data return the name in anno otherwise newCm's name.
In some cases, we may need to delete and recreate STS for updating some immutable fields and are expected to keep the name of ConfigMap unchanged to ensure no accidentally restart of pod. For example: Updating storage size, iops or throughput of PVC using by TiKV. Now, the annotation is set by pvc_resizer(not supported yet), pvc_modifier or pvc_replacer, See pkg/manager/utils/statefulset.go:DeleteStatefulSetWithOrphan.
func FindConfigMapVolume ¶
FindConfigMapVolume returns the configmap which's name matches the predicate in a PodSpec, empty indicates not found
func SetStatefulSetLastAppliedConfigAnnotation ¶
func SetStatefulSetLastAppliedConfigAnnotation(set *apps.StatefulSet) error
SetStatefulSetLastAppliedConfigAnnotation set last applied config to Statefulset's annotation
func SetUpgradePartition ¶
func SetUpgradePartition(set *apps.StatefulSet, upgradeOrdinal int32)
SetUpgradePartition set statefulSet's rolling update partition
func StatefulSetIsUpgrading ¶
func StatefulSetIsUpgrading(set *apps.StatefulSet) bool
StatefulSetIsUpgrading confirms whether the statefulSet is upgrading phase
func UpdateConfigMapIfNeed ¶
func UpdateConfigMapIfNeed( cmLister corelisters.ConfigMapLister, configUpdateStrategy v1alpha1.ConfigUpdateStrategy, inUseName string, desired *corev1.ConfigMap, ) error
UpdateConfigMapIfNeed set the toml field as the old one if they are logically equal.
func UpdateStatefulSet ¶
func UpdateStatefulSet(setCtl controller.StatefulSetControlInterface, object runtime.Object, newSet, oldSet *apps.StatefulSet) error
UpdateStatefulSet is a template function to update the statefulset of components
func UpdateStatefulSetWithPrecheck ¶
func UpdateStatefulSetWithPrecheck( deps *controller.Dependencies, tc *v1alpha1.TidbCluster, reason string, newTiDBSet *apps.StatefulSet, oldTiDBSet *apps.StatefulSet, ) error
Types ¶
type ContainerBuilder ¶
type ContainerBuilder struct {
// contains filtered or unexported fields
}
func NewContainerBuilder ¶
func NewContainerBuilder(container *corev1.Container) *ContainerBuilder
func (*ContainerBuilder) AddEnvFroms ¶ added in v1.3.5
func (cb *ContainerBuilder) AddEnvFroms(envFroms ...corev1.EnvFromSource)
func (*ContainerBuilder) AddEnvs ¶
func (cb *ContainerBuilder) AddEnvs(envs ...corev1.EnvVar)
func (*ContainerBuilder) AddVolumeMounts ¶
func (cb *ContainerBuilder) AddVolumeMounts(mounts ...corev1.VolumeMount)
func (*ContainerBuilder) Clone ¶
func (cb *ContainerBuilder) Clone() *corev1.Container
func (*ContainerBuilder) Get ¶
func (cb *ContainerBuilder) Get() *corev1.Container
type PodTemplateSpecBuilder ¶
type PodTemplateSpecBuilder struct {
// contains filtered or unexported fields
}
func NewPodTemplateSpecBuilder ¶
func NewPodTemplateSpecBuilder(podTemplate *corev1.PodTemplateSpec) *PodTemplateSpecBuilder
func (*PodTemplateSpecBuilder) AddAnnotations ¶
func (b *PodTemplateSpecBuilder) AddAnnotations(annos map[string]string)
func (*PodTemplateSpecBuilder) AddContainers ¶
func (pb *PodTemplateSpecBuilder) AddContainers(containers ...corev1.Container)
AddContainers add container to pod's spec
NOTE: if container slice expand, old ContainerBuilder reference will be outdated.
func (*PodTemplateSpecBuilder) AddLabels ¶
func (b *PodTemplateSpecBuilder) AddLabels(labels map[string]string)
func (*PodTemplateSpecBuilder) AddVolumes ¶
func (b *PodTemplateSpecBuilder) AddVolumes(volumes ...corev1.Volume)
func (*PodTemplateSpecBuilder) Clone ¶
func (pb *PodTemplateSpecBuilder) Clone() *corev1.PodTemplateSpec
func (*PodTemplateSpecBuilder) ContainerBuilder ¶
func (pb *PodTemplateSpecBuilder) ContainerBuilder(name string) *ContainerBuilder
ContainerBuilder return the specified container builder
NOTE: don't save the builder, it will be outdated if container slice expand
func (*PodTemplateSpecBuilder) Get ¶
func (pb *PodTemplateSpecBuilder) Get() *corev1.PodTemplateSpec
type StatefulSetBuilder ¶
type StatefulSetBuilder struct {
// contains filtered or unexported fields
}
func NewStatefulSetBuilder ¶
func NewStatefulSetBuilder(sts *apps.StatefulSet) *StatefulSetBuilder
func (*StatefulSetBuilder) AddVolumeClaims ¶
func (sb *StatefulSetBuilder) AddVolumeClaims(pvcs ...corev1.PersistentVolumeClaim)
func (*StatefulSetBuilder) Clone ¶
func (sb *StatefulSetBuilder) Clone() *apps.StatefulSet
func (*StatefulSetBuilder) Get ¶
func (sb *StatefulSetBuilder) Get() *apps.StatefulSet
func (*StatefulSetBuilder) PodTemplateSpecBuilder ¶
func (sb *StatefulSetBuilder) PodTemplateSpecBuilder() *PodTemplateSpecBuilder