ingress

package
v0.0.0-...-de69368 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CanaryIngressSuffix is the name suffix all canary ingresses created by the rollouts controller will have
	CanaryIngressSuffix = "-canary"
	// ManagedActionsAnnotation holds list of ALB actions that are managed by rollouts
	// DEPRECATED in favor of ManagedAnnotations
	ManagedActionsAnnotation = "rollouts.argoproj.io/managed-alb-actions"
	// ManagedAnnotations holds list of ALB annotations that are managed by rollouts supports multiple annotations
	ManagedAnnotations = "rollouts.argoproj.io/managed-alb-annotations"
	//ALBIngressAnnotation is the prefix annotation that is used by the ALB Ingress controller to configure an ALB
	ALBIngressAnnotation = "alb.ingress.kubernetes.io"
	// ALBActionPrefix the prefix to specific actions within an ALB ingress.
	ALBActionPrefix = "/actions."
	// ALBConditionPrefix the prefix to specific conditions within an ALB ingress.
	ALBConditionPrefix = "/conditions."
)

Variables

This section is empty.

Functions

func ALBActionAnnotationKey

func ALBActionAnnotationKey(r *v1alpha1.Rollout) string

ALBActionAnnotationKey returns the annotation key for a specific action

func ALBHeaderBasedActionAnnotationKey

func ALBHeaderBasedActionAnnotationKey(r *v1alpha1.Rollout, action string) string

ALBHeaderBasedActionAnnotationKey returns the annotation key for a specific action

func ALBHeaderBasedConditionAnnotationKey

func ALBHeaderBasedConditionAnnotationKey(r *v1alpha1.Rollout, action string) string

ALBHeaderBasedConditionAnnotationKey returns the annotation key for a specific condition

func BuildIngressPatch

func BuildIngressPatch(mode IngressMode, current, desired *Ingress, opts ...PatchOption) ([]byte, bool, error)

func GetCanaryIngressName

func GetCanaryIngressName(rolloutName, stableIngressName string) string

GetCanaryIngressName constructs the name to use for the canary ingress resource from a given Rollout

func GetRolloutIngressKeys

func GetRolloutIngressKeys(rollout *v1alpha1.Rollout) []string

GetRolloutIngressKeys returns ingresses keys (namespace/ingressName) which are referenced by specified rollout

func HasRuleWithService

func HasRuleWithService(i *Ingress, svc string) bool

HasRuleWithService check if an Ingress has a service in one of it's rules

func MultipleAlbIngressesConfigured

func MultipleAlbIngressesConfigured(rollout *v1alpha1.Rollout) bool

func MultipleNginxIngressesConfigured

func MultipleNginxIngressesConfigured(rollout *v1alpha1.Rollout) bool

func SingleAlbIngressConfigured

func SingleAlbIngressConfigured(rollout *v1alpha1.Rollout) bool

func SingleNginxIngressConfigured

func SingleNginxIngressConfigured(rollout *v1alpha1.Rollout) bool

Types

type ALBAction

type ALBAction struct {
	Type          string           `json:"Type"`
	ForwardConfig ALBForwardConfig `json:"ForwardConfig"`
}

ALBAction describes an ALB action that configure the behavior of an ALB. This struct is marshaled into a string that is added to the Ingress's annotations.

type ALBCondition

type ALBCondition struct {
	Field            string           `json:"field"`
	HttpHeaderConfig HttpHeaderConfig `json:"httpHeaderConfig"`
}

ALBCondition describes an ALB action condition that configure the behavior of an ALB. This struct is marshaled into a string that is added to the Ingress's annotations.

type ALBForwardConfig

type ALBForwardConfig struct {
	TargetGroups                []ALBTargetGroup                `json:"TargetGroups"`
	TargetGroupStickinessConfig *ALBTargetGroupStickinessConfig `json:"TargetGroupStickinessConfig,omitempty"`
}

ALBForwardConfig describes a list of target groups that the ALB should route traffic towards

type ALBTargetGroup

type ALBTargetGroup struct {
	// the K8s service Name
	ServiceName string `json:"ServiceName,omitempty"`
	// the K8s service port
	ServicePort string `json:"ServicePort,omitempty"`
	// The weight. The range is 0 to 999.
	Weight *int64 `json:"Weight,omitempty"`
}

ALBTargetGroup holds the weight to send to a specific destination consisting of a K8s service and port or ARN

type ALBTargetGroupStickinessConfig

type ALBTargetGroupStickinessConfig struct {
	Enabled         bool  `json:"Enabled"`
	DurationSeconds int64 `json:"DurationSeconds"`
}

ALBTargetGroupStickinessConfig describes settings for the listener to apply to all forwards

type HttpHeaderConfig

type HttpHeaderConfig struct {
	HttpHeaderName string   `json:"httpHeaderName"`
	Values         []string `json:"values"`
}

HttpHeaderConfig describes header config for the ALB action condition

type Ingress

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

Ingress defines an Ingress resource abstraction used to allow Rollouts to work with the newer 'networking' package as well as with the legacy extensions package.

func NewIngress

func NewIngress(i *v1.Ingress) *Ingress

NewIngress will instantiate and return an Ingress with the given Ingress from networking/v1 package

func NewIngressWithAnnotations

func NewIngressWithAnnotations(mode IngressMode, annotations map[string]string) *Ingress

func NewIngressWithSpecAndAnnotations

func NewIngressWithSpecAndAnnotations(ingress *Ingress, annotations map[string]string) *Ingress

func NewLegacyIngress

func NewLegacyIngress(li *v1beta1.Ingress) *Ingress

NewLegacyIngress will instantiate and return an Ingress with the given Ingress from extensions/v1beta1 package

func (*Ingress) CreateAnnotationBasedPath

func (i *Ingress) CreateAnnotationBasedPath(actionName string)

func (*Ingress) DeepCopy

func (i *Ingress) DeepCopy() *Ingress

func (*Ingress) GetAnnotations

func (i *Ingress) GetAnnotations() map[string]string

func (*Ingress) GetClass

func (i *Ingress) GetClass() string

GetClass returns the ingress class. For backwards compatibility `kubernetes.io/ingress.class` annotation will be used if set, otherwise `spec.ingressClassName` is used.

func (*Ingress) GetExtensionsIngress

func (i *Ingress) GetExtensionsIngress() (*v1beta1.Ingress, error)

func (*Ingress) GetLabels

func (i *Ingress) GetLabels() map[string]string

func (*Ingress) GetLoadBalancerHostnames

func (i *Ingress) GetLoadBalancerHostnames() []string

func (*Ingress) GetName

func (i *Ingress) GetName() string

func (*Ingress) GetNamespace

func (i *Ingress) GetNamespace() string

func (*Ingress) GetNetworkingIngress

func (i *Ingress) GetNetworkingIngress() (*v1.Ingress, error)

func (*Ingress) GetObjectMeta

func (i *Ingress) GetObjectMeta() metav1.Object

func (*Ingress) Mode

func (i *Ingress) Mode() IngressMode

func (*Ingress) RemovePathByServiceName

func (i *Ingress) RemovePathByServiceName(actionName string)

func (*Ingress) SetAnnotations

func (i *Ingress) SetAnnotations(annotations map[string]string)

func (*Ingress) SortHttpPaths

func (i *Ingress) SortHttpPaths(routes []v1alpha1.MangedRoutes)

type IngressMode

type IngressMode int
const (
	IngressModeExtensions IngressMode = iota + 1 // start iota with 1 to avoid having this as default value
	IngressModeNetworking
)

func DetermineIngressMode

func DetermineIngressMode(apiVersion string, d discovery.ServerVersionInterface) (IngressMode, error)

DetermineIngressMode will first attempt to determine the ingress mode by checking the given apiVersion. If it is "extensions/v1beta1" will return IngressModeExtensions. If it is "networking/v1" will return IngressModeNetworking. Otherwise it will check the kubernetes server version to determine the ingress mode.

type IngressWrap

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

IngressWrap wraps the two ingress informers provided by the client-go. This is used to centralize the ingress informer operations to allow Rollouts to interact with both versions.

func NewIngressWrapper

func NewIngressWrapper(mode IngressMode, client kubernetes.Interface, informerFactory informers.SharedInformerFactory) (*IngressWrap, error)

func (*IngressWrap) Create

func (w *IngressWrap) Create(ctx context.Context, namespace string, ingress *Ingress, opts metav1.CreateOptions) (*Ingress, error)

func (*IngressWrap) Get

func (w *IngressWrap) Get(ctx context.Context, namespace, name string, opts metav1.GetOptions) (*Ingress, error)

func (*IngressWrap) GetCached

func (w *IngressWrap) GetCached(namespace, name string) (*Ingress, error)

func (*IngressWrap) HasSynced

func (w *IngressWrap) HasSynced() bool

func (*IngressWrap) Informer

func (w *IngressWrap) Informer() cache.SharedIndexInformer

func (*IngressWrap) Patch

func (w *IngressWrap) Patch(ctx context.Context, namespace, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*Ingress, error)

func (*IngressWrap) Update

func (w *IngressWrap) Update(ctx context.Context, namespace string, ingress *Ingress) (*Ingress, error)

type ManagedALBActions

type ManagedALBActions map[string]string

ManagedALBActions a mapping of Rollout names to the ALB action that the Rollout manages

func NewManagedALBActions

func NewManagedALBActions(annotation string) (ManagedALBActions, error)

NewManagedALBActions converts a string into a mapping of the rollouts to managed ALB actions

func (ManagedALBActions) String

func (m ManagedALBActions) String() string

String outputs a string of all the managed ALB actions that is stored in the Ingress's annotations

type ManagedALBAnnotation

type ManagedALBAnnotation []string

type ManagedALBAnnotations

type ManagedALBAnnotations map[string]ManagedALBAnnotation

func NewManagedALBAnnotations

func NewManagedALBAnnotations(json string) (ManagedALBAnnotations, error)

func (ManagedALBAnnotations) String

func (m ManagedALBAnnotations) String() string

String outputs a string of all the managed ALB annotations that is stored in the Ingress's annotations

type PatchOption

type PatchOption func(p *patchConfig)

func WithAnnotations

func WithAnnotations() PatchOption

func WithLabels

func WithLabels() PatchOption

func WithSpec

func WithSpec() PatchOption

Jump to

Keyboard shortcuts

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