store

package
v0.0.0-...-894910e Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// IngressKey picks a specific "class" for the Ingress.
	// The controller only processes Ingresses with this annotation either
	// unset, or set to either the configured value or the empty string.
	IngressKey = "kubernetes.io/ingress.class"
)
View Source
const IngressNGINXController = "k8s.io/ingress-nginx"

IngressNGINXController defines the valid value of IngressClass Controller field for ingress-nginx

Variables

View Source
var (
	// DefaultClass defines the default class used in the alb ingress controller
	DefaultClass = "alb"

	// IngressClass sets the runtime ingress class to use
	// An empty string means accept all ingresses without
	// annotation and the ones configured with class alb
	IngressClassName = "alb"
)
View Source
var IngressClass *networking.IngressClass

IngressClass indicates the class of the Ingress to use as filter

View Source
var IsIngressV1Beta1Ready bool

IsIngressV1Beta1Ready indicates if the running Kubernetes version is at least v1.18.0

View Source
var IsIngressV1Ready bool

IsIngressV1Ready indicates if the running Kubernetes version is at least v1.19.0

Functions

func GetIngressPod

func GetIngressPod(kubeClient clientset.Interface) error

GetIngressPod load the ingress-nginx pod

func GetNodeIPOrName

func GetNodeIPOrName(kubeClient clientset.Interface, name string, useInternalIP bool) string

GetNodeIPOrName returns the IP address or the name of a node in the cluster

func IsIngressAlbClass

func IsIngressAlbClass(ing networking.Ingress) bool

func IsValid

func IsValid(ing *networking.Ingress) bool

IsValid returns true if the given Ingress specify the ingress.class annotation or IngressClassName resource for Kubernetes >= v1.18

func MetaNamespaceKey

func MetaNamespaceKey(obj interface{}) string

MetaNamespaceKey knows how to make keys for API objects which implement meta.Interface.

func NetworkingIngressAvailable

func NetworkingIngressAvailable(client clientset.Interface) (bool, bool, bool)

NetworkingIngressAvailable checks if the package "k8s.io/api/networking/v1beta1" is available or not and if Ingress V1 is supported (k8s >= v1.18.0)

func ParseNameNS

func ParseNameNS(input string) (string, string, error)

ParseNameNS parses a string searching a namespace and name

func SetDefaultALBPathType

func SetDefaultALBPathType(ing *networking.Ingress)

SetDefaultNGINXPathType sets a default PathType when is not defined.

Types

type ConfigMapLister

type ConfigMapLister struct {
	cache.Store
}

ConfigMapLister makes a Store that lists Configmaps.

func (*ConfigMapLister) ByKey

func (cml *ConfigMapLister) ByKey(key string) (*apiv1.ConfigMap, error)

ByKey returns the ConfigMap matching key in the local ConfigMap Store.

type EndpointLister

type EndpointLister struct {
	cache.Store
}

EndpointLister makes a Store that lists Endpoints.

func (*EndpointLister) ByKey

func (s *EndpointLister) ByKey(key string) (*apiv1.Endpoints, error)

ByKey returns the Endpoints of the Service matching key in the local Endpoint Store.

type Informer

Informer defines the required SharedIndexInformers that interact with the API server.

func (*Informer) Run

func (i *Informer) Run(stopCh chan struct{})

Run initiates the synchronization of the informers against the API server.

type Ingress

type Ingress struct {
	networking.Ingress `json:"-"`
}

Ingress holds the definition of an Ingress plus its annotations

func FilterIngresses

func FilterIngresses(ingresses []*Ingress, filterFunc IngressFilterFunc) []*Ingress

FilterIngresses returns the list of Ingresses

type IngressFilterFunc

type IngressFilterFunc func(*Ingress) bool

IngressFilterFunc decides if an Ingress should be omitted or not

type IngressLister

type IngressLister struct {
	cache.Store
}

IngressLister makes a Store that lists Ingress.

func (IngressLister) ByKey

func (il IngressLister) ByKey(key string) (*networking.Ingress, error)

ByKey returns the Ingress matching key in the local Ingress Store.

type IngressWithAnnotationsLister

type IngressWithAnnotationsLister struct {
	cache.Store
}

IngressWithAnnotationsLister makes a Store that lists Ingress rules with annotations already parsed

func (IngressWithAnnotationsLister) ByKey

ByKey returns the Ingress with annotations matching key in the local store or an error

type Lister

type Lister struct {
	Ingress               IngressLister
	Service               ServiceLister
	Endpoint              EndpointLister
	Pod                   PodLister
	Node                  NodeLister
	IngressWithAnnotation IngressWithAnnotationsLister
}

Lister contains object listers (stores).

type NodeLister

type NodeLister struct {
	cache.Store
}

NodeLister makes a Store that lists Nodes.

func (*NodeLister) ByKey

func (sl *NodeLister) ByKey(key string) (*apiv1.Node, error)

ByKey returns the Node matching key in the local Node Store.

type NotExistsError

type NotExistsError string

NotExistsError is returned when an object does not exist in a local store.

func (NotExistsError) Error

func (e NotExistsError) Error() string

Error implements the error interface.

type ObjectRefMap

type ObjectRefMap interface {
	Insert(consumer string, ref ...string)
	Delete(consumer string)
	Len() int
	Has(ref string) bool
	HasConsumer(consumer string) bool
	Reference(ref string) []string
	ReferencedBy(consumer string) []string
}

ObjectRefMap is a map of references from object(s) to object (1:n). It is used to keep track of which data objects (Secrets) are used within Ingress objects.

func NewObjectRefMap

func NewObjectRefMap() ObjectRefMap

NewObjectRefMap returns a new ObjectRefMap.

type PodInfo

type PodInfo struct {
	metav1.TypeMeta
	metav1.ObjectMeta
}

PodInfo contains runtime information about the pod running the Ingres controller +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

var (
	// IngressPodDetails hold information about the ingress-nginx pod
	IngressPodDetails *PodInfo
)

type PodLister

type PodLister struct {
	cache.Store
}

PodLister makes a Store that lists Pods.

func (*PodLister) ByKey

func (s *PodLister) ByKey(key string) (*apiv1.Pod, error)

ByKey returns the Endpoints of the Service matching key in the local Endpoint Store.

type SecretLister

type SecretLister struct {
	cache.Store
}

SecretLister makes a Store that lists Secrets.

func (*SecretLister) ByKey

func (sl *SecretLister) ByKey(key string) (*apiv1.Secret, error)

ByKey returns the Secret matching key in the local Secret Store.

type ServiceLister

type ServiceLister struct {
	cache.Store
}

ServiceLister makes a Store that lists Services.

func (*ServiceLister) ByKey

func (sl *ServiceLister) ByKey(key string) (*apiv1.Service, error)

ByKey returns the Service matching key in the local Service Store.

type Storer

type Storer interface {

	// GetService returns the Service matching key.
	GetService(key string) (*corev1.Service, error)

	// GetServiceEndpoints returns the Endpoints of a Service matching key.
	GetServiceEndpoints(key string) (*corev1.Endpoints, error)

	GetPod(key string) (*corev1.Pod, error)

	// ListIngresses returns a list of all Ingresses in the store.
	ListIngresses() []*Ingress

	// Run initiates the synchronization of the controllers
	Run(stopCh chan struct{})
}

Storer is the interface that wraps the required methods to gather information about ingresses, services, secrets and ingress annotations.

func New

func New(
	namespace string,
	resyncPeriod time.Duration,
	client clientset.Interface,
	updateCh *channels.RingChannel,
	disableCatchAll bool) Storer

New creates a new object store to be used in the ingress controller

Jump to

Keyboard shortcuts

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