Documentation ¶
Index ¶
- Constants
- func Convert_v2beta1_ExternalMetricSource_To_autoscaling_ExternalMetricSource(in *autoscalingv2beta1.ExternalMetricSource, ...) error
- func Convert_v2beta1_MetricSpec_To_autoscaling_MetricSpec(in *v2beta1.MetricSpec, out *autoscaling.MetricSpec, s conversion.Scope) error
- func Convert_v2beta1_ObjectMetricSource_To_autoscaling_ObjectMetricSource(in *autoscalingv2beta1.ObjectMetricSource, out *autoscaling.ObjectMetricSource, ...) error
- func Convert_v2beta1_PodsMetricSource_To_autoscaling_PodsMetricSource(in *autoscalingv2beta1.PodsMetricSource, out *autoscaling.PodsMetricSource, ...) error
- func Convert_v2beta1_ResourceMetricSource_To_autoscaling_ResourceMetricSource(in *autoscalingv2beta1.ResourceMetricSource, ...) error
- func IsResourceUpToDate(stack *zv1.Stack, resourceMeta metav1.ObjectMeta) bool
- type MetricsList
- type MetricsReporter
- type PrescalingTrafficReconciler
- type SimpleTrafficReconciler
- type StackContainer
- func (sc *StackContainer) GenerateDeployment() *appsv1.Deployment
- func (sc *StackContainer) GenerateHPA() (*autoscaling.HorizontalPodAutoscaler, error)
- func (sc *StackContainer) GenerateIngress() (*networking.Ingress, error)
- func (sc *StackContainer) GenerateRouteGroup() (*rgv1.RouteGroup, error)
- func (sc *StackContainer) GenerateService() (*v1.Service, error)
- func (sc *StackContainer) GenerateStackStatus() *zv1.StackStatus
- func (sc *StackContainer) HasBackendPort() bool
- func (sc *StackContainer) HasTraffic() bool
- func (sc *StackContainer) IsAutoscaled() bool
- func (sc *StackContainer) IsReady() bool
- func (sc *StackContainer) MaxReplicas() int32
- func (sc *StackContainer) Name() string
- func (sc *StackContainer) Namespace() string
- func (sc *StackContainer) ScaledDown() bool
- type StackResources
- type StackSetContainer
- func (ssc *StackSetContainer) GenerateIngress() (*networking.Ingress, error)
- func (ssc *StackSetContainer) GenerateRouteGroup() (*rgv1.RouteGroup, error)
- func (ssc *StackSetContainer) GenerateStackSetStatus() *zv1.StackSetStatus
- func (ssc *StackSetContainer) GenerateStackSetTraffic() []*zv1.DesiredTraffic
- func (ssc *StackSetContainer) ManageTraffic(currentTimestamp time.Time) error
- func (ssc *StackSetContainer) MarkExpiredStacks()
- func (ssc *StackSetContainer) NewStack() (*StackContainer, string)
- func (ssc *StackSetContainer) TrafficChanges() []TrafficChange
- func (ssc *StackSetContainer) UpdateFromResources() error
- type TrafficChange
- type TrafficReconciler
Constants ¶
const ( APIVersion = "zalando.org/v1" KindStackSet = "StackSet" KindStack = "Stack" )
const ( StacksetHeritageLabelKey = "stackset" StackVersionLabelKey = "stack-version" )
Variables ¶
This section is empty.
Functions ¶
func Convert_v2beta1_ExternalMetricSource_To_autoscaling_ExternalMetricSource ¶ added in v1.3.0
func Convert_v2beta1_ExternalMetricSource_To_autoscaling_ExternalMetricSource(in *autoscalingv2beta1.ExternalMetricSource, out *autoscaling.ExternalMetricSource, s conversion.Scope) error
func Convert_v2beta1_MetricSpec_To_autoscaling_MetricSpec ¶ added in v1.3.0
func Convert_v2beta1_MetricSpec_To_autoscaling_MetricSpec(in *v2beta1.MetricSpec, out *autoscaling.MetricSpec, s conversion.Scope) error
Convert_v2beta1_MetricSpec_To_autoscaling_MetricSpec is an autogenerated conversion function.
func Convert_v2beta1_ObjectMetricSource_To_autoscaling_ObjectMetricSource ¶ added in v1.3.0
func Convert_v2beta1_ObjectMetricSource_To_autoscaling_ObjectMetricSource(in *autoscalingv2beta1.ObjectMetricSource, out *autoscaling.ObjectMetricSource, s conversion.Scope) error
func Convert_v2beta1_PodsMetricSource_To_autoscaling_PodsMetricSource ¶ added in v1.3.0
func Convert_v2beta1_PodsMetricSource_To_autoscaling_PodsMetricSource(in *autoscalingv2beta1.PodsMetricSource, out *autoscaling.PodsMetricSource, s conversion.Scope) error
func Convert_v2beta1_ResourceMetricSource_To_autoscaling_ResourceMetricSource ¶ added in v1.3.0
func Convert_v2beta1_ResourceMetricSource_To_autoscaling_ResourceMetricSource(in *autoscalingv2beta1.ResourceMetricSource, out *autoscaling.ResourceMetricSource, s conversion.Scope) error
func IsResourceUpToDate ¶
func IsResourceUpToDate(stack *zv1.Stack, resourceMeta metav1.ObjectMeta) bool
IsResourceUpToDate checks whether the stack is assigned to the resource by comparing the stack generation with the corresponding resource annotation.
Types ¶
type MetricsList ¶
type MetricsList []autoscaling.MetricSpec
func (MetricsList) Len ¶
func (l MetricsList) Len() int
func (MetricsList) Less ¶
func (l MetricsList) Less(i, j int) bool
func (MetricsList) Swap ¶
func (l MetricsList) Swap(i, j int)
type MetricsReporter ¶
type MetricsReporter struct {
// contains filtered or unexported fields
}
func NewMetricsReporter ¶
func NewMetricsReporter(registry prometheus.Registerer) (*MetricsReporter, error)
func (*MetricsReporter) Report ¶
func (reporter *MetricsReporter) Report(stacksets map[types.UID]*StackSetContainer) error
func (*MetricsReporter) ReportError ¶ added in v1.1.23
func (reporter *MetricsReporter) ReportError()
type PrescalingTrafficReconciler ¶
PrescalingTrafficReconciler is a traffic reconciler that forcibly scales up the deployment before switching traffic
func (PrescalingTrafficReconciler) Reconcile ¶
func (r PrescalingTrafficReconciler) Reconcile(stacks map[string]*StackContainer, currentTimestamp time.Time) error
type SimpleTrafficReconciler ¶
type SimpleTrafficReconciler struct{}
SimpleTrafficReconciler is the most simple traffic reconciler which implements the default traffic switching supported in the stackset-controller.
func (SimpleTrafficReconciler) Reconcile ¶
func (SimpleTrafficReconciler) Reconcile(stacks map[string]*StackContainer, currentTimestamp time.Time) error
type StackContainer ¶
type StackContainer struct { // Stack represents the desired state of the stack, updated by the reconciliation logic Stack *zv1.Stack // PendingRemoval is set to true if the stack should be deleted PendingRemoval bool // Resources contains Kubernetes entities for the Stack's resources (Deployment, Ingress, etc) Resources StackResources // contains filtered or unexported fields }
StackContainer is a container for storing the full state of a Stack including all the managed sub-resources. This includes the Stack resource itself and all the sub resources like Deployment, HPA and Service.
func (*StackContainer) GenerateDeployment ¶
func (sc *StackContainer) GenerateDeployment() *appsv1.Deployment
func (*StackContainer) GenerateHPA ¶
func (sc *StackContainer) GenerateHPA() (*autoscaling.HorizontalPodAutoscaler, error)
func (*StackContainer) GenerateIngress ¶
func (sc *StackContainer) GenerateIngress() (*networking.Ingress, error)
func (*StackContainer) GenerateRouteGroup ¶ added in v1.3.5
func (sc *StackContainer) GenerateRouteGroup() (*rgv1.RouteGroup, error)
func (*StackContainer) GenerateService ¶
func (sc *StackContainer) GenerateService() (*v1.Service, error)
func (*StackContainer) GenerateStackStatus ¶
func (sc *StackContainer) GenerateStackStatus() *zv1.StackStatus
func (*StackContainer) HasBackendPort ¶ added in v1.1.0
func (sc *StackContainer) HasBackendPort() bool
func (*StackContainer) HasTraffic ¶
func (sc *StackContainer) HasTraffic() bool
func (*StackContainer) IsAutoscaled ¶
func (sc *StackContainer) IsAutoscaled() bool
func (*StackContainer) IsReady ¶
func (sc *StackContainer) IsReady() bool
func (*StackContainer) MaxReplicas ¶
func (sc *StackContainer) MaxReplicas() int32
func (*StackContainer) Name ¶
func (sc *StackContainer) Name() string
func (*StackContainer) Namespace ¶
func (sc *StackContainer) Namespace() string
func (*StackContainer) ScaledDown ¶
func (sc *StackContainer) ScaledDown() bool
type StackResources ¶
type StackResources struct { Deployment *appsv1.Deployment HPA *autoscaling.HorizontalPodAutoscaler Service *v1.Service Ingress *networking.Ingress RouteGroup *rgv1.RouteGroup }
StackResources describes the resources of a stack.
type StackSetContainer ¶
type StackSetContainer struct { StackSet *zv1.StackSet // StackContainers is a set of stacks belonging to the StackSet // including the Stack sub resources like Deployments and Services. StackContainers map[types.UID]*StackContainer // Ingress defines the current Ingress resource belonging to the // StackSet. This is a reference to the actual resource while // `StackSet.Spec.Ingress` defines the ingress configuration specified // by the user on the StackSet. Ingress *networking.Ingress // RouteGroups defines the current RouteGroup resource belonging to the // StackSet. This is a reference to the actual resource while // `StackSet.Spec.RouteGroup` defines the route group configuration // specified by the user on the StackSet. RouteGroup *rgv1.RouteGroup // TrafficReconciler is the reconciler implementation used for // switching traffic between stacks. E.g. for prescaling stacks before // switching traffic. TrafficReconciler TrafficReconciler // contains filtered or unexported fields }
StackSetContainer is a container for storing the full state of a StackSet including the sub-resources which are part of the StackSet. It respresents a snapshot of the resources currently in the Cluster. This includes an optional Ingress resource as well as the current Traffic distribution. It also contains a set of StackContainers which respresents the full state of the individual Stacks part of the StackSet.
func NewContainer ¶ added in v1.1.20
func NewContainer(stackset *zv1.StackSet, reconciler TrafficReconciler, backendWeightsAnnotationKey, clusterDomain string) *StackSetContainer
func (*StackSetContainer) GenerateIngress ¶
func (ssc *StackSetContainer) GenerateIngress() (*networking.Ingress, error)
func (*StackSetContainer) GenerateRouteGroup ¶ added in v1.3.5
func (ssc *StackSetContainer) GenerateRouteGroup() (*rgv1.RouteGroup, error)
func (*StackSetContainer) GenerateStackSetStatus ¶
func (ssc *StackSetContainer) GenerateStackSetStatus() *zv1.StackSetStatus
func (*StackSetContainer) GenerateStackSetTraffic ¶ added in v1.1.0
func (ssc *StackSetContainer) GenerateStackSetTraffic() []*zv1.DesiredTraffic
func (*StackSetContainer) ManageTraffic ¶
func (ssc *StackSetContainer) ManageTraffic(currentTimestamp time.Time) error
ManageTraffic handles the traffic reconciler logic
func (*StackSetContainer) MarkExpiredStacks ¶
func (ssc *StackSetContainer) MarkExpiredStacks()
MarkExpiredStacks marks stacks that should be deleted
func (*StackSetContainer) NewStack ¶
func (ssc *StackSetContainer) NewStack() (*StackContainer, string)
NewStack returns an (optional) stack that should be created
func (*StackSetContainer) TrafficChanges ¶
func (ssc *StackSetContainer) TrafficChanges() []TrafficChange
func (*StackSetContainer) UpdateFromResources ¶
func (ssc *StackSetContainer) UpdateFromResources() error
UpdateFromResources populates stack state information (e.g. replica counts or traffic) from related resources
type TrafficChange ¶
TrafficChange contains information about a traffic change event
func (TrafficChange) String ¶
func (tc TrafficChange) String() string
type TrafficReconciler ¶
type TrafficReconciler interface { // Handle the traffic switching and/or scaling logic. Reconcile(stacks map[string]*StackContainer, currentTimestamp time.Time) error }