snapshot

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 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 Option

type Option interface {
	// contains filtered or unexported methods
}

type ResourcesForLoad

type ResourcesForLoad struct {
	Pods            []v1.PodApplyConfiguration                        `json:"pods"`
	Nodes           []v1.NodeApplyConfiguration                       `json:"nodes"`
	Pvs             []v1.PersistentVolumeApplyConfiguration           `json:"pvs"`
	Pvcs            []v1.PersistentVolumeClaimApplyConfiguration      `json:"pvcs"`
	StorageClasses  []confstoragev1.StorageClassApplyConfiguration    `json:"storageClasses"`
	PriorityClasses []schedulingcfgv1.PriorityClassApplyConfiguration `json:"priorityClasses"`
	SchedulerConfig *configv1.KubeSchedulerConfiguration              `json:"schedulerConfig"`
	Namespaces      []v1.NamespaceApplyConfiguration                  `json:"namespaces"`
}

ResourcesForLoad indicates all resources and scheduler configuration to be loaded.

func ConvertResourcesForSnapToResourcesForLoad

func ConvertResourcesForSnapToResourcesForLoad(expRes *ResourcesForSnap) (*ResourcesForLoad, error)

ConvertResourcesForSnapToResourcesForLoad returns ResourcesForLoad based on ResourcesForSnap.

type ResourcesForSnap

type ResourcesForSnap struct {
	Pods            []corev1.Pod                         `json:"pods"`
	Nodes           []corev1.Node                        `json:"nodes"`
	Pvs             []corev1.PersistentVolume            `json:"pvs"`
	Pvcs            []corev1.PersistentVolumeClaim       `json:"pvcs"`
	StorageClasses  []storagev1.StorageClass             `json:"storageClasses"`
	PriorityClasses []schedulingv1.PriorityClass         `json:"priorityClasses"`
	SchedulerConfig *configv1.KubeSchedulerConfiguration `json:"schedulerConfig"`
	Namespaces      []corev1.Namespace                   `json:"namespaces"`
}

ResourcesForSnap indicates all resources and scheduler configuration to be snapped.

type SchedulerService

type SchedulerService interface {
	GetSchedulerConfig() (*configv1.KubeSchedulerConfiguration, error)
	RestartScheduler(cfg *configv1.KubeSchedulerConfiguration) error
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(client clientset.Interface, schedulers SchedulerService) *Service

func (*Service) IgnoreErr

func (s *Service) IgnoreErr() Option

IgnoreErr is the option to literally ignore errors. If it is enabled, the method won't return any errors, but just log errors as error logs.

func (*Service) IgnoreSchedulerConfiguration

func (s *Service) IgnoreSchedulerConfiguration() Option

IgnoreSchedulerConfiguration is the option to ignore the scheduler configuration in the given ResourcesForLoad. Note: this option is only for Load method. If it is enabled, the scheduler will not be restarted in load method.

func (*Service) Load

func (s *Service) Load(ctx context.Context, resources *ResourcesForLoad, opts ...Option) error

Load imports all resources from posted data. (1) Restart scheduler based on the data. (2) Apply each resource.

  • If UID is not nil, an error will occur. (This is because the api-server will try to find that from current resources by UID)

func (*Service) Snap

func (s *Service) Snap(ctx context.Context, opts ...Option) (*ResourcesForSnap, error)

Snap exports all resources as one data.

Directories

Path Synopsis
Package mock_snapshot is a generated GoMock package.
Package mock_snapshot is a generated GoMock package.

Jump to

Keyboard shortcuts

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