Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var SetVoterElectionWeightToOne = plugin.NewStepBinder("common", "SetVoterElectionWeightToOne", func(rc *xstorev1reconcile.Context, flow control.Flow) (reconcile.Result, error) { pods, err := rc.GetXStorePods() if err != nil { return flow.Error(err, "Unable to get pods.") } voterPods := k8shelper.FilterPodsBy(pods, func(pod *corev1.Pod) bool { return xstoremeta.IsPodRoleVoter(pod) }) if len(voterPods) == 0 { return flow.Pass() } leaderPod, err := rc.TryGetXStoreLeaderPod() if err != nil { return flow.Error(err, "Unable to get leader pod.") } if leaderPod == nil { return flow.Wait("No leader pod found.") } err = setElectionWeightToOne(rc, flow.Logger(), leaderPod, voterPods) if err != nil { return flow.Error(err, "Unable to set election weight to 1.", "leader-pod", leaderPod.Name, "voter-pods", k8shelper.ToObjectNames(voterPods)) } return flow.Pass() }, )
View Source
var UnblockBootstrap = xstorev1reconcile.NewStepBinder("UnblockBootstrap", func(rc *xstorev1reconcile.Context, flow control.Flow) (reconcile.Result, error) { sharedCm, err := rc.GetXStoreConfigMap(convention.ConfigMapTypeShared) if err != nil { return flow.Error(err, "Unable to get shared config map.") } sharedChannel, err := parseChannelFromConfigMap(sharedCm) if err != nil { return flow.Error(err, "Unable to parse shared channel from config map.") } if !sharedChannel.IsBlocked() { return flow.Pass() } sharedChannel.Unblock() pods, err := rc.GetXStorePods() if err != nil { return flow.Error(err, "Unable to get pods.") } if featuregate.EnableXStoreWithHeadlessService.Enabled() { sharedChannel.Nodes = transformPodsIntoNodesWithHeadlessServices(rc.Namespace(), pods) } else { sharedChannel.Nodes = transformPodsIntoNodes(rc.Namespace(), pods) } sharedCm.Data[channel.SharedChannelKey] = sharedChannel.String() err = rc.Client().Update(rc.Context(), sharedCm) if err != nil { return flow.Error(err, "Unable to update shared config map.") } return flow.Continue("Unblock via shared channel.") }, )
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.