store

package
v1.8.8 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NETWORKINGV1BETA1 = "networking.k8s.io/v1beta1"
	EXTENSIONSV1BETA1 = "extensions/v1beta1"
	NETWORKINGV1      = "networking.k8s.io/v1"

	PATH_TYPE_EXACT                   = "Exact"
	PATH_TYPE_PREFIX                  = "Prefix"
	PATH_TYPE_IMPLEMENTATION_SPECIFIC = "ImplementationSpecific"
)

Variables

This section is empty.

Functions

func CopyAnnotations

func CopyAnnotations(in map[string]string) map[string]string

CopyAnnotations returns a copy of annotations map and removes prefixe from annotations name

Types

type ConfigMap

type ConfigMap struct {
	Namespace   string
	Name        string
	Loaded      bool
	Annotations map[string]string
	Status      Status
}

ConfigMap is useful data from k8s structures about configmap

func (*ConfigMap) Equal

func (a *ConfigMap) Equal(b *ConfigMap) bool

Equal compares two config maps, ignores statuses and old values

type ConfigMaps

type ConfigMaps struct {
	Main         *ConfigMap
	TCPServices  *ConfigMap
	Errorfiles   *ConfigMap
	PatternFiles *ConfigMap
}

type CustomResources

type CustomResources struct {
	Global     map[string]*models.Global
	Defaults   map[string]*models.Defaults
	LogTargets map[string]models.LogTargets
	Backends   map[string]*models.Backend
}

type Endpoints

type Endpoints struct {
	SliceName string
	Namespace string
	Service   string
	Ports     map[string]*PortEndpoints // Ports[portName]
	Status    Status
}

Endpoints describes endpoints of a service

func (*Endpoints) Equal

func (a *Endpoints) Equal(b *Endpoints) bool

Equal checks if two services have same endpoints

type ErrNotFound

type ErrNotFound error

type HAProxySrv

type HAProxySrv struct {
	// Srv disabled is srv with address ""
	Name     string
	Address  string
	Modified bool
	Port     int64
}

func (*HAProxySrv) String added in v1.8.4

func (h *HAProxySrv) String() string

type Ingress

type Ingress struct {
	IngressCore
	Ignored   bool   // true if resource ignored because of non matching Controller Class
	Status    Status // Used for store purpose
	Addresses []string
}

Ingress is useful data from k8s structures about ingress

func ConvertToIngress

func ConvertToIngress(resource interface{}) (ingress *Ingress, err error)

ConvertToIngress detects the interface{} provided by the SharedInformer and select the proper strategy to convert and return the resource as a store.Ingress struct

type IngressClass

type IngressClass struct {
	APIVersion  string
	Name        string
	Controller  string
	Annotations map[string]string
	Status      Status // Used for store purpose
}

func ConvertToIngressClass

func ConvertToIngressClass(resource interface{}) (ingress *IngressClass, err error)

type IngressCore

type IngressCore struct {
	// Required for K8s.UpdateIngressStatus to select proper versioned Client Set
	APIVersion     string
	Namespace      string
	Name           string
	Class          string
	Annotations    map[string]string
	Rules          map[string]*IngressRule
	DefaultBackend *IngressPath
	TLS            map[string]*IngressTLS
}

type IngressPath

type IngressPath struct {
	SvcNamespace     string
	SvcName          string
	SvcPortInt       int64
	SvcPortString    string
	SvcPortResolved  *ServicePort
	Path             string
	PathTypeMatch    string
	IsDefaultBackend bool
}

IngressPath is useful data from k8s structures about ingress path

type IngressRule

type IngressRule struct {
	Host  string
	Paths map[string]*IngressPath
}

IngressRule is useful data from k8s structures about ingress rule

type IngressTLS

type IngressTLS struct {
	Host       string
	SecretName string
}

IngressTLS describes the transport layer security associated with an Ingress.

type K8s

type K8s struct {
	NbrHAProxyInst          int64
	Namespaces              map[string]*Namespace
	IngressClasses          map[string]*IngressClass
	NamespacesAccess        NamespacesWatch
	ConfigMaps              ConfigMaps
	PublishServiceAddresses []string
	SecretsProcessed        map[string]struct{}
	BackendProcessed        map[string]struct{}
	UpdateStatusFunc        func(ingresses []*Ingress, publishServiceAddresses []string)
}

func NewK8sStore

func NewK8sStore(args utils.OSArgs) K8s

func (*K8s) Clean

func (k *K8s) Clean()

func (*K8s) EventBackendCR

func (k *K8s) EventBackendCR(namespace, name string, data *corev1alpha1.Backend) bool

func (*K8s) EventConfigMap

func (k *K8s) EventConfigMap(ns *Namespace, data *ConfigMap) (updateRequired bool)

func (*K8s) EventDefaultsCR

func (k *K8s) EventDefaultsCR(namespace, name string, data *corev1alpha1.Defaults) bool

func (*K8s) EventEndpoints

func (k *K8s) EventEndpoints(ns *Namespace, data *Endpoints, syncHAproxySrvs func(backend *RuntimeBackend, portUpdated bool) error) (updateRequired bool)

func (*K8s) EventGlobalCR

func (k *K8s) EventGlobalCR(namespace, name string, data *corev1alpha1.Global) bool

func (*K8s) EventIngress

func (k *K8s) EventIngress(ns *Namespace, data *Ingress) (updateRequired bool)

func (*K8s) EventIngressClass

func (k *K8s) EventIngressClass(data *IngressClass) (updateRequired bool)

func (*K8s) EventNamespace

func (k *K8s) EventNamespace(ns *Namespace, data *Namespace) (updateRequired bool)

func (*K8s) EventPod

func (k *K8s) EventPod(podEvent PodEvent) (updateRequired bool)

func (*K8s) EventPublishService

func (k *K8s) EventPublishService(ns *Namespace, data *Service) (updateRequired bool)

func (*K8s) EventSecret

func (k *K8s) EventSecret(ns *Namespace, data *Secret) (updateRequired bool)

func (*K8s) EventService

func (k *K8s) EventService(ns *Namespace, data *Service) (updateRequired bool)

func (K8s) GetEndpoints

func (k K8s) GetEndpoints(namespace, name string) (endpoints map[string]*PortEndpoints, err error)

GetEndpoints takes the ns and name of a service and provides a map of endpoints: portName --> *PortEndpoints

func (K8s) GetNamespace

func (k K8s) GetNamespace(name string) *Namespace

GetNamespace returns Namespace. Creates one if not existing

func (K8s) GetSecret

func (k K8s) GetSecret(namespace, name string) (*Secret, error)

func (K8s) GetService

func (k K8s) GetService(namespace, name string) (*Service, error)

type MapStringW

type MapStringW map[string]*StringW

MapStringW stores values and enables

func (*MapStringW) Clean

func (a *MapStringW) Clean()

Clean removes all with status

func (*MapStringW) Clone

func (a *MapStringW) Clone() MapStringW

Clone removes all with status

func (*MapStringW) Equal

func (a *MapStringW) Equal(b MapStringW) bool

Equal compares if two maps are equal

func (*MapStringW) Get

func (a *MapStringW) Get(name string) (data *StringW, err error)

Get checks if name exists and if not, returns default value if defined

func (*MapStringW) SetStatus

func (a *MapStringW) SetStatus(old MapStringW) (different bool)

SetStatus sets Status state for all items in map

func (*MapStringW) SetStatusState

func (a *MapStringW) SetStatusState(state Status)

SetStatusState sets all watches to desired state

func (*MapStringW) String

func (a *MapStringW) String() string

Get checks if name exists and if not, returns default value if defined

type Namespace

type Namespace struct {
	Name           string
	Relevant       bool
	Ingresses      map[string]*Ingress
	Endpoints      map[string]map[string]*Endpoints // service -> sliceName -> Endpoints
	Services       map[string]*Service
	Secret         map[string]*Secret
	HAProxyRuntime map[string]map[string]*RuntimeBackend // service -> portName -> Backend
	CRs            *CustomResources
	Status         Status
	// contains filtered or unexported fields
}

Namespace is useful data from k8s structures about namespace

type NamespacesWatch

type NamespacesWatch struct {
	Whitelist map[string]struct{}
	Blacklist map[string]struct{}
}

type PodEvent

type PodEvent struct {
	Created bool
}

PodEvent carries creation/deletion pod event.

type PortEndpoints

type PortEndpoints struct {
	Port      int64
	Addresses map[string]struct{}
}

PortEndpoints describes endpoints of a service port

func (*PortEndpoints) Equal

func (a *PortEndpoints) Equal(b *PortEndpoints) bool

Equal checks if old PortEndpoints equals to a new PortEndpoints.

type RuntimeBackend

type RuntimeBackend struct {
	Name            string
	HAProxySrvs     []*HAProxySrv
	Endpoints       PortEndpoints
	DynUpdateFailed bool
}

RuntimeBackend holds the runtime state of an HAProxy backend

type Secret

type Secret struct {
	Namespace string
	Name      string
	Data      map[string][]byte
	Status    Status
}

Secret is useful data from k8s structures about secret

func (*Secret) Equal

func (a *Secret) Equal(b *Secret) bool

Equal compares two secrets, ignores statuses and old values

type Service

type Service struct {
	Namespace   string
	Name        string
	Ports       []ServicePort
	Addresses   []string // Used only for publish-service
	DNS         string
	Annotations map[string]string
	Status      Status
}

Service is useful data from k8s structures about service

func (*Service) Equal

func (a *Service) Equal(b *Service) bool

Equal compares two services, ignores statuses and old values

func (*Service) EqualWithAddresses

func (a *Service) EqualWithAddresses(b *Service) bool

type ServicePort

type ServicePort struct {
	Name     string
	Protocol string
	Port     int64
	Status   Status
}

ServicePort describes port of a service

func (*ServicePort) Equal

func (a *ServicePort) Equal(b *ServicePort) bool

type Status

type Status string
const (
	ADDED    Status = "ADDED"
	DELETED  Status = "DELETED"
	ERROR    Status = "ERROR"
	EMPTY    Status = ""
	MODIFIED Status = "MODIFIED"
)

type StringW

type StringW struct {
	Value    string
	OldValue string
	Status   Status
}

StringW string value that has modified flag

func (*StringW) Equal

func (a *StringW) Equal(b *StringW) bool

Equal compares only Value, rest is not relevant

Jump to

Keyboard shortcuts

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