controller

package
v1.4.70 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PrescaleStacksAnnotationKey               = "alpha.stackset-controller.zalando.org/prescale-stacks"
	ResetHPAMinReplicasDelayAnnotationKey     = "alpha.stackset-controller.zalando.org/reset-hpa-min-replicas-delay"
	StacksetControllerControllerAnnotationKey = "stackset-controller.zalando.org/controller"
	ControllerLastUpdatedAnnotationKey        = "stackset-controller.zalando.org/updated-timestamp"
)

Variables

This section is empty.

Functions

func NewTestEnvironment

func NewTestEnvironment() *testEnvironment

Types

type StackSetController

type StackSetController struct {
	HealthReporter healthcheck.Handler

	sync.Mutex
	// contains filtered or unexported fields
}

StackSetController is the main controller. It watches for changes to stackset resources and starts and maintains other controllers per stackset resource.

func NewStackSetController

func NewStackSetController(
	client clientset.Interface,
	namespace string,
	controllerID string,
	parallelWork int,
	backendWeightsAnnotationKey string,
	clusterDomains []string,
	registry prometheus.Registerer,
	interval time.Duration,
	routeGroupSupportEnabled bool,
	syncIngressAnnotations []string,
	configMapSupportEnabled bool,
	secretSupportEnabled bool,
	pcsSupportEnabled bool,
) (*StackSetController, error)

NewStackSetController initializes a new StackSetController.

func (*StackSetController) AddUpdateStackSetIngress added in v1.3.8

func (c *StackSetController) AddUpdateStackSetIngress(ctx context.Context, stackset *zv1.StackSet, existing *networking.Ingress, routegroup *rgv1.RouteGroup, ingress *networking.Ingress) (*networking.Ingress, error)

AddUpdateStackSetIngress reconciles the Ingress but never deletes it, it returns the existing/new Ingress

func (*StackSetController) AddUpdateStackSetRouteGroup added in v1.3.8

func (c *StackSetController) AddUpdateStackSetRouteGroup(ctx context.Context, stackset *zv1.StackSet, existing *rgv1.RouteGroup, ingress *networking.Ingress, rg *rgv1.RouteGroup) (*rgv1.RouteGroup, error)

AddUpdateStackSetRouteGroup reconciles the RouteGroup but never deletes it, it returns the existing/new RouteGroup

func (*StackSetController) CleanupOldStacks

func (c *StackSetController) CleanupOldStacks(ctx context.Context, ssc *core.StackSetContainer) error

CleanupOldStacks deletes stacks that are no longer needed.

func (*StackSetController) CreateCurrentStack

func (c *StackSetController) CreateCurrentStack(ctx context.Context, ssc *core.StackSetContainer) error

CreateCurrentStack creates a new Stack object for the current stack, if needed

func (*StackSetController) ReconcileStackConfigMapRef added in v1.4.43

func (c *StackSetController) ReconcileStackConfigMapRef(
	ctx context.Context,
	stack *zv1.Stack,
	rsc zv1.ConfigurationResourcesSpec,
	updateObjMeta func(*metav1.ObjectMeta) *metav1.ObjectMeta,
) error

func (*StackSetController) ReconcileStackConfigMapRefs added in v1.4.42

func (c *StackSetController) ReconcileStackConfigMapRefs(
	ctx context.Context,
	stack *zv1.Stack,
	updateObjMeta func(*metav1.ObjectMeta) *metav1.ObjectMeta,
) error

ReconcileStackConfigMapRefs will update the named user-provided ConfigMaps to be attached to the Stack by ownerReferences, when a list of Configuration Resources are defined on the Stack template.

The provided ConfigMap name must be prefixed by the Stack name. eg: Stack: myapp-v1 ConfigMap: myapp-v1-my-config

User update of running versioned ConfigMaps is not encouraged but is allowed on consideration of emergency needs. Similarly, addition of ConfigMaps to running resources is also allowed, so the method checks for changes on the ConfigurationResources to ensure all listed ConfigMaps are properly linked to the Stack.

func (*StackSetController) ReconcileStackDeployment

func (c *StackSetController) ReconcileStackDeployment(ctx context.Context, stack *zv1.Stack, existing *apps.Deployment, generateUpdated func() *apps.Deployment) error

func (*StackSetController) ReconcileStackHPA

func (c *StackSetController) ReconcileStackHPA(ctx context.Context, stack *zv1.Stack, existing *v2.HorizontalPodAutoscaler, generateUpdated func() (*v2.HorizontalPodAutoscaler, error)) error

func (*StackSetController) ReconcileStackIngress

func (c *StackSetController) ReconcileStackIngress(ctx context.Context, stack *zv1.Stack, existing *networking.Ingress, generateUpdated func() (*networking.Ingress, error)) error

func (*StackSetController) ReconcileStackPlatformCredentialsSet added in v1.4.67

func (c *StackSetController) ReconcileStackPlatformCredentialsSet(
	ctx context.Context,
	stack *zv1.Stack,
	rsc *zv1.PCS,
	existing []*zv1.PlatformCredentialsSet,
	generateUpdated func(*zv1.PCS) (*zv1.PlatformCredentialsSet, error),
) error

func (*StackSetController) ReconcileStackPlatformCredentialsSets added in v1.4.67

func (c *StackSetController) ReconcileStackPlatformCredentialsSets(
	ctx context.Context,
	stack *zv1.Stack,
	existing []*zv1.PlatformCredentialsSet,
	generateUpdated func(*zv1.PCS) (*zv1.PlatformCredentialsSet, error),
) error

func (*StackSetController) ReconcileStackResources

func (c *StackSetController) ReconcileStackResources(ctx context.Context, ssc *core.StackSetContainer, sc *core.StackContainer) error

func (*StackSetController) ReconcileStackRouteGroup added in v1.3.5

func (c *StackSetController) ReconcileStackRouteGroup(ctx context.Context, stack *zv1.Stack, existing *rgv1.RouteGroup, generateUpdated func() (*rgv1.RouteGroup, error)) error

func (*StackSetController) ReconcileStackSecretRef added in v1.4.43

func (c *StackSetController) ReconcileStackSecretRef(ctx context.Context,
	stack *zv1.Stack,
	rsc zv1.ConfigurationResourcesSpec,
	updateObjMeta func(*metav1.ObjectMeta) *metav1.ObjectMeta,
) error

func (*StackSetController) ReconcileStackSecretRefs added in v1.4.42

func (c *StackSetController) ReconcileStackSecretRefs(
	ctx context.Context,
	stack *zv1.Stack,
	updateObjMeta func(*metav1.ObjectMeta) *metav1.ObjectMeta,
) error

ReconcileStackSecretRefs will update the named user-provided Secrets to be attached to the Stack by ownerReferences, when a list of Configuration Resources are defined on the Stack template.

The provided Secret name must be prefixed by the Stack name. eg: Stack: myapp-v1 Secret: myapp-v1-my-secret

User update of running versioned Secrets is not encouraged but is allowed on consideration of emergency needs. Similarly, addition of Secrets to running resources is also allowed, so the method checks for changes on the ConfigurationResources to ensure all listed Secrets are properly linked to the Stack.

func (*StackSetController) ReconcileStackService

func (c *StackSetController) ReconcileStackService(ctx context.Context, stack *zv1.Stack, existing *apiv1.Service, generateUpdated func() (*apiv1.Service, error)) error

func (*StackSetController) ReconcileStackSet

func (c *StackSetController) ReconcileStackSet(ctx context.Context, container *core.StackSetContainer) (err error)

ReconcileStackSet reconciles all the things from a stackset

func (*StackSetController) ReconcileStackSetDesiredTraffic added in v1.1.0

func (c *StackSetController) ReconcileStackSetDesiredTraffic(ctx context.Context, existing *zv1.StackSet, generateUpdated func() []*zv1.DesiredTraffic) error

func (*StackSetController) ReconcileStatuses

func (c *StackSetController) ReconcileStatuses(ctx context.Context, ssc *core.StackSetContainer) error

ReconcileStatuses reconciles the statuses of StackSets and Stacks.

func (*StackSetController) ReconcileTrafficSegments added in v1.4.23

func (c *StackSetController) ReconcileTrafficSegments(
	ctx context.Context,
	ssc *core.StackSetContainer,
) ([]types.UID, error)

ReconcileTrafficSegments updates the traffic segments according to the actual traffic weight of each stack.

Returns the ordered list of Trafic Segments that need to be updated.

func (*StackSetController) RecordTrafficSwitch added in v1.4.63

func (c *StackSetController) RecordTrafficSwitch(ctx context.Context, ssc *core.StackSetContainer) error

RecordTrafficSwitch records an event detailing when switches in traffic to Stacks, only when there are changes to record.

func (*StackSetController) Run

Run runs the main loop of the StackSetController. Before the loops it sets up a watcher to watch StackSet resources. The watch will send changes over a channel which is polled from the main loop.

Jump to

Keyboard shortcuts

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