staggerrestarts

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component struct {
	CRName               string
	Reason               string
	CheckUntilTimestamp  string
	LastCheckedTimestamp string
	Status               Status
	PodName              string
}

type Instance

type Instance interface {
	v1.Object
	GetMSPID() string
}

type RestartConfig

type RestartConfig struct {
	// key is mspid
	Queues map[string][]*Component
	// key is instance name
	Log map[string][]*Component
}

RestartConfig defines <ca/peer/orderer>-restart-config.Data["restart-config.yaml"]

func (*RestartConfig) AddToLog

func (r *RestartConfig) AddToLog(component *Component)

func (*RestartConfig) AddToQueue

func (r *RestartConfig) AddToQueue(mspid string, component *Component)

func (*RestartConfig) PopFromQueue

func (r *RestartConfig) PopFromQueue(mspid string)

type StaggerRestartsService

type StaggerRestartsService struct {
	Client           k8sclient.Client
	ConfigMapManager *configmap.Manager
	Timeout          time.Duration
}

func New

func New(client k8sclient.Client, timeout time.Duration) *StaggerRestartsService

func (*StaggerRestartsService) AddToQueue

func (s *StaggerRestartsService) AddToQueue(instance Instance, reason string) error

AddToQueue is called by the restart manager and handles adding the restart request to the queue associated with the instance's MSPID in the <ca/peer/orderer>-restart-config CM.

func (*StaggerRestartsService) GetConfig

func (s *StaggerRestartsService) GetConfig(componentType, namespace string) (*RestartConfig, error)

func (*StaggerRestartsService) GetRunningPods

func (s *StaggerRestartsService) GetRunningPods(name, namespace string) ([]corev1.Pod, error)

func (*StaggerRestartsService) Reconcile

func (s *StaggerRestartsService) Reconcile(componentType, namespace string) (bool, error)

Reconcile is called by the ca/peer/orderer reconcile loops via the restart manager when an update to the <ca/peer/orderer>-restart-config CM is detected and handles the different states of the first component of each queue.

Returns true if the controller needs to requeue the request to reconcile the restart manager.

func (*StaggerRestartsService) Restart

func (s *StaggerRestartsService) Restart(instance Instance, reason string) error

Restart is called by the restart manager. For CA/Peer/Orderer: adds component to the queue for restart. For Console: restarts the component directly as there is only one ibpconsole

instance per network. We bypass the queue logic for ibpconsoles.

func (*StaggerRestartsService) RestartDeployment

func (s *StaggerRestartsService) RestartDeployment(name, namespace string) error

func (*StaggerRestartsService) RestartImmediately

func (s *StaggerRestartsService) RestartImmediately(componentType string, instance Instance, reason string) error

func (*StaggerRestartsService) UpdateConfig

func (s *StaggerRestartsService) UpdateConfig(componentType, namespace string, cfg *RestartConfig) error

type Status

type Status string
const (
	Pending   Status = "pending"
	Waiting   Status = "waiting"
	Completed Status = "completed"
	Expired   Status = "expired"

	Restarted Status = "restarted"
)

Jump to

Keyboard shortcuts

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