Documentation ¶
Index ¶
- Constants
- Variables
- func AreAnnotationsUpToDate(updated, existing metav1.ObjectMeta) bool
- 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 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) GenerateIngressSegment() (*networking.Ingress, error)
- func (sc *StackContainer) GenerateRouteGroup() (*rgv1.RouteGroup, error)
- func (sc *StackContainer) GenerateRouteGroupSegment() (*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
- func (sc *StackContainer) UpdateObjectMeta(objMeta *metav1.ObjectMeta) *metav1.ObjectMeta
- type StackResources
- type StackSetContainer
- func (ssc *StackSetContainer) ComputeTrafficSegments() ([]types.UID, error)
- func (ssc *StackSetContainer) EnableSegmentTraffic()
- 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) SupportsSegmentTraffic() bool
- func (ssc *StackSetContainer) SynchronizeIngressAnnotations(annotations []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 ( SegmentSuffix = "-traffic-segment" IngressPredicateKey = "zalando.org/skipper-predicate" )
const ( StacksetHeritageLabelKey = "stackset" StackVersionLabelKey = "stack-version" )
Variables ¶
var ( // PathTypeImplementationSpecific is the used implementation path type // for k8s.io/api/networking/v1.HTTPIngressPath resources. PathTypeImplementationSpecific = networking.PathTypeImplementationSpecific )
Functions ¶
func AreAnnotationsUpToDate ¶ added in v1.4.23
func AreAnnotationsUpToDate(updated, existing metav1.ObjectMeta) bool
AreAnnotationsUpToDate checks whether the annotations of the existing and updated resource are up to date.
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 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()
func (*MetricsReporter) ReportPanic ¶ added in v1.3.28
func (reporter *MetricsReporter) ReportPanic()
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) GenerateIngressSegment ¶ added in v1.4.23
func (sc *StackContainer) GenerateIngressSegment() ( *networking.Ingress, error, )
func (*StackContainer) GenerateRouteGroup ¶ added in v1.3.5
func (sc *StackContainer) GenerateRouteGroup() (*rgv1.RouteGroup, error)
func (*StackContainer) GenerateRouteGroupSegment ¶ added in v1.4.23
func (sc *StackContainer) GenerateRouteGroupSegment() ( *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
func (*StackContainer) UpdateObjectMeta ¶ added in v1.4.22
func (sc *StackContainer) UpdateObjectMeta(objMeta *metav1.ObjectMeta) *metav1.ObjectMeta
type StackResources ¶
type StackResources struct { Deployment *appsv1.Deployment HPA *autoscaling.HorizontalPodAutoscaler Service *v1.Service Ingress *networking.Ingress IngressSegment *networking.Ingress RouteGroup *rgv1.RouteGroup RouteGroupSegment *rgv1.RouteGroup ConfigMaps []*v1.ConfigMap Secrets []*v1.Secret }
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 represents 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 represents 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 string, clusterDomains []string) *StackSetContainer
func (*StackSetContainer) ComputeTrafficSegments ¶ added in v1.4.23
func (ssc *StackSetContainer) ComputeTrafficSegments() ([]types.UID, error)
ComputeTrafficSegments returns the stack segments necessary to fulfill the actual traffic configured in the main StackSet.
Returns an ordered list of traffic segments, to ensure no gaps in traffic assignment.
func (*StackSetContainer) EnableSegmentTraffic ¶ added in v1.4.23
func (ssc *StackSetContainer) EnableSegmentTraffic()
EnableSegmentTraffic enables managing traffic weight by using dedicated Ingress and RouteGroup resources with Skipper's TrafficSegment predicate.
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) SupportsSegmentTraffic ¶ added in v1.4.23
func (ssc *StackSetContainer) SupportsSegmentTraffic() bool
SupportsSegmentTraffic returns if the StackSet has segmented traffic enabled.
func (*StackSetContainer) SynchronizeIngressAnnotations ¶ added in v1.4.26
func (ssc *StackSetContainer) SynchronizeIngressAnnotations( annotations []string, )
SynchronizeIngressAnnotations ensures that the container propagates the specified annotations to all segment Ingress or Routegroups, when they are present in the StackSet's Ingress or RouteGroup definition.
This synchronization is only relevant when the container supports traffic segments.
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 }