annotationscale

package module
v0.0.0-...-e0e7a83 Latest Latest
Warning

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

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

README

Annotation Scale

Use Annotation for precise scaling and canary releases without install CRD.

See for use case in example.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorScaleAnnotationParseSteps            error = errors.New("not include steps")
	ErrorScaleAnnotationParseCurrentStepIndex error = errors.New("not include current_step_index")
	ErrorScaleAnnotationParseCurrentStepState error = errors.New("not include current_step_state")
)

Functions

func SetDeploymentScaleAnnotation

func SetDeploymentScaleAnnotation(deployment *appsv1.Deployment, scaleAnnotation *ScaleAnnotation) error

func SetScaleAnnotation

func SetScaleAnnotation(annotations map[string]string, scaleAnnotation *ScaleAnnotation) (map[string]string, error)

Types

type AnnotationScaleManager

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

func NewAnnotationScaleManager

func NewAnnotationScaleManager(log *logr.Logger, match *metav1.LabelSelector, config *rest.Config, syncPeriod time.Duration) (*AnnotationScaleManager, error)

func (*AnnotationScaleManager) Start

func (m *AnnotationScaleManager) Start() error

func (*AnnotationScaleManager) Stop

func (m *AnnotationScaleManager) Stop()

func (*AnnotationScaleManager) Stopping

func (m *AnnotationScaleManager) Stopping() bool

type DeploymentReconciler

type DeploymentReconciler struct {
	client.Client
	// contains filtered or unexported fields
}

func (*DeploymentReconciler) InjectClient

func (r *DeploymentReconciler) InjectClient(c client.Client) error

func (*DeploymentReconciler) Reconcile

This function will be called when there is a change to a Deployment or a ReplicaSet or a Pod with an OwnerReference to a Deployment.

type ScaleAnnotation

type ScaleAnnotation struct {
	Steps                  []Step    `json:"steps,omitempty"`
	CurrentStepIndex       int       `json:"current_step_index,omitempty"`
	CurrentStepState       StepState `json:"current_step_state,omitempty"`
	Message                string    `json:"message,omitempty"`
	MaxWaitAvailableSecond int       `json:"max_wait_available_second,omitempty"`
	MaxUnavailableReplicas int       `json:"max_unavailable_replicas,omitempty"`
	LastUpdateTime         time.Time `json:"last_update_time,omitempty"`
}

func NewScaleAnnotation

func NewScaleAnnotation() ScaleAnnotation

func ReadScaleAnnotation

func ReadScaleAnnotation(annotations map[string]string) (*ScaleAnnotation, error)

func (*ScaleAnnotation) StepDeadline

func (sa *ScaleAnnotation) StepDeadline() time.Time

func (*ScaleAnnotation) String

func (sa *ScaleAnnotation) String() string

type Step

type Step struct {
	Replicas int32 `json:"replicas,omitempty"`
	Pause    bool  `json:"pause,omitempty"`
}

func (Step) String

func (s Step) String() string

type StepState

type StepState string
const (
	StepStateUpgrade   StepState = "StepUpgrade"
	StepStatePaused    StepState = "StepPaused"
	StepStateReady     StepState = "StepReady"
	StepStateCompleted StepState = "Completed"
	StepStateTimeout   StepState = "Timeout"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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