k8s

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CDNGroupAnnotation is the annotation key that represents a group of Ingresses composing a single Distribution
	CDNGroupAnnotation = "cdn-origin-controller.gympass.com/cdn.group"
	// CDNClassAnnotation is the annotation key that represents a class
	CDNClassAnnotation = "cdn-origin-controller.gympass.com/cdn.class"
	// CDNFinalizer is the finalizer to be used in Ingresses managed by the operator
	CDNFinalizer = "cdn-origin-controller.gympass.com/finalizer"
)
View Source
const (
	CFUserOriginAccessPublic = "Public"
	CFUserOriginAccessBucket = "Bucket"
)

Variables

This section is empty.

Functions

func AddFinalizer

func AddFinalizer(object client.Object)

AddFinalizer adds the finalizer managed by this controller to a given Ingress. It does not make any calls to the API server.

func CDNClassAnnotationValue

func CDNClassAnnotationValue(object client.Object) string

CDNClassAnnotationValue returns the CDN class found within an Ingress' annotations

func CDNClassNotEmpty added in v0.2.0

func CDNClassNotEmpty(candidate string) bool

CDNClassNotEmpty returns a boolean indicating if CDNClass is available

func HasFinalizer

func HasFinalizer(object client.Object) bool

HasFinalizer returns whether a given Ingress has a finalizer managed by this controller

func HasGroupAnnotation

func HasGroupAnnotation(o client.Object) bool

HasGroupAnnotation returns whether the given Ingress has the CDN group annotation

func HasLoadBalancer

func HasLoadBalancer(o client.Object) bool

HasLoadBalancer returns whether the given Ingress has been provisioned

func IsBeingRemovedFromDesiredState

func IsBeingRemovedFromDesiredState(obj client.Object) bool

IsBeingRemovedFromDesiredState return whether the Ingress is being removed or if it no longer belongs to a group

func RemoveFinalizer

func RemoveFinalizer(object client.Object)

RemoveFinalizer removes the finalizer managed by this controller from a given Ingress. It does not make any calls to the API server.

func UsedDeprecatedFields added in v0.4.0

func UsedDeprecatedFields(ing client.Object) []string

func ValidateIngressFunctionAssociations added in v0.4.0

func ValidateIngressFunctionAssociations(ing *networkingv1.Ingress) error

Types

type CDNClass added in v0.2.0

type CDNClass struct {
	// HostedZoneID of domain name
	HostedZoneID string
	// CreateAlias determine if should create an DNS alias or not
	CreateAlias bool
	// TXTOwnerValue the value to generate ownership TXT dns registry
	TXTOwnerValue string
}

CDNClass represents the domain object

type CDNClassFetcher added in v0.2.0

type CDNClassFetcher interface {
	FetchByName(ctx context.Context, name string) (CDNClass, error)
}

func NewCDNClassFetcher added in v0.2.0

func NewCDNClassFetcher(client client.Client) CDNClassFetcher

type CDNIngress

type CDNIngress struct {
	types.NamespacedName
	OriginHost           string
	Group                string
	UnmergedPaths        []Path
	OriginReqPolicy      string
	OriginHeaders        map[string]string
	CachePolicy          string
	OriginRespTimeout    int64
	AlternateDomainNames []string
	UnmergedWebACLARN    string
	IsBeingRemoved       bool
	OriginAccess         string
	Class                CDNClass
	Tags                 map[string]string
}

CDNIngress represents an Ingress within the bounded context of cdn-origin-controller

func NewCDNIngressFromV1

func NewCDNIngressFromV1(ctx context.Context, ing *networkingv1.Ingress, class CDNClass) (CDNIngress, error)

NewCDNIngressFromV1 creates a new CDNIngress from a v1 Ingress

func (CDNIngress) GetName

func (c CDNIngress) GetName() string

GetName returns the CDNIngress name

func (CDNIngress) GetNamespace

func (c CDNIngress) GetNamespace() string

GetNamespace returns the CDNIngress namespace

type FunctionAssociations added in v0.4.0

type FunctionAssociations struct {
	ViewerRequest  *ViewerRequestFunction `yaml:"viewerRequest"`
	ViewerResponse *ViewerFunction        `yaml:"viewerResponse"`
	OriginRequest  *OriginRequestFunction `yaml:"originRequest"`
	OriginResponse *OriginFunction        `yaml:"originResponse"`
}

func (FunctionAssociations) IsEmpty added in v0.4.0

func (fa FunctionAssociations) IsEmpty() bool

func (FunctionAssociations) Merge added in v0.4.0

func (FunctionAssociations) Validate added in v0.4.0

func (fa FunctionAssociations) Validate() error

type FunctionAssociationsPaths added in v0.4.0

type FunctionAssociationsPaths struct {
	Paths map[string]FunctionAssociations `yaml:",inline"`
}

type FunctionType added in v0.4.0

type FunctionType string
const (
	FunctionTypeEdge       FunctionType = "edge"
	FunctionTypeCloudfront FunctionType = "cloudfront"
)

type IngressFetcher

type IngressFetcher interface {
	// FetchBy fetches all Ingresses and returns a slice of the ones matching the given predicate.
	// User-supplied origins present in annotations of these Ingresses are also included in the output.
	FetchBy(ctx context.Context, cdnClass CDNClass, predicate func(CDNIngress) bool) ([]CDNIngress, error)
}

IngressFetcher interacts with Kubernetes to fetch networking.k8s.io Ingress resources

func NewIngressFetcherV1

func NewIngressFetcherV1(k8sClient client.Client) IngressFetcher

NewIngressFetcherV1 creates an IngressFetcher that works with v1 Ingreses

type OriginFunction added in v0.4.0

type OriginFunction struct {
	ARN string `yaml:"arn"`
}

type OriginRequestFunction added in v0.4.0

type OriginRequestFunction struct {
	OriginFunction `yaml:",inline"`
	IncludeBody    bool `yaml:"includeBody"`
}

type Path

type Path struct {
	PathPattern          string
	PathType             string
	FunctionAssociations FunctionAssociations
}

Path represents a path item within an Ingress

type SharedIngressParams

type SharedIngressParams struct {
	WebACLARN string
	// contains filtered or unexported fields
}

SharedIngressParams represents parameters which might be specified in multiple Ingresses

func NewSharedIngressParams

func NewSharedIngressParams(ingresses []CDNIngress) (SharedIngressParams, error)

NewSharedIngressParams creates a new SharedIngressParams from a slice of CDNIngress

func (SharedIngressParams) PathsFromOrigin added in v0.4.0

func (sp SharedIngressParams) PathsFromOrigin(originHost string) []Path

type ViewerFunction added in v0.4.0

type ViewerFunction struct {
	ARN          string       `yaml:"arn"`
	FunctionType FunctionType `yaml:"functionType"`
}

type ViewerRequestFunction added in v0.4.0

type ViewerRequestFunction struct {
	ViewerFunction `yaml:",inline"`
	IncludeBody    bool `yaml:"includeBody"`
}

Jump to

Keyboard shortcuts

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