store

package
v1.6.9 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigMap

type ConfigMap struct {
	Namespace   string
	Name        string
	Loaded      bool
	Annotations MapStringW
	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 added in v1.6.0

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

type Endpoints

type Endpoints struct {
	Namespace string
	Service   StringW
	Ports     map[string]*PortEndpoints
	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 HAProxySrv

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

type Ingress

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

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

func (*Ingress) Equal

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

Equal compares two Ingresses, ignores

type IngressClass

type IngressClass struct {
	APIVersion string
	Name       string
	Controller string
	Status     Status
}

func ConvertToIngressClass

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

func (*IngressClass) Equal

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

Equal checks if IngressClasses are equal

type IngressPath

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

IngressPath is useful data from k8s structures about ingress path

func (*IngressPath) Equal

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

Equal checks if Ingress Paths are equal

type IngressRule

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

IngressRule is useful data from k8s structures about ingress rule

func (*IngressRule) Equal

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

Equal checks if Ingress Rules are equal

type IngressTLS

type IngressTLS struct {
	Host       string
	SecretName StringW
	Status     Status
}

IngressTLS describes the transport layer security associated with an Ingress.

func (*IngressTLS) Equal

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

Equal checks if Ingress secrets are equal

type K8s

type K8s struct {
	Namespaces       map[string]*Namespace
	IngressClasses   map[string]*IngressClass
	NamespacesAccess NamespacesWatch
	ConfigMaps       ConfigMaps
}

func NewK8sStore

func NewK8sStore(args utils.OSArgs) K8s

func (K8s) Clean

func (k K8s) Clean()

func (*K8s) EventConfigMap

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

func (*K8s) EventEndpoints

func (k *K8s) EventEndpoints(ns *Namespace, data *Endpoints, syncHAproxySrvs func(oldEndpoints, newEndpoints *PortEndpoints) error) (updateRequired bool)

func (*K8s) EventIngress

func (k *K8s) EventIngress(ns *Namespace, data *Ingress, controllerClass string) (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) 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) FetchSecret

func (k K8s) FetchSecret(secretPath, defaultNs string) (*Secret, error)

FetchSecret fetches secret with secretPath format "namespace/secretName" if format is just "secretName" defaultNs param will be used.

func (K8s) GetNamespace

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

GetNamespace returns Namespace. Creates one if not existing

func (K8s) GetValueFromAnnotations

func (k K8s) GetValueFromAnnotations(annotationName string, annotations ...MapStringW) (data *StringW, err error)

GetValueFromAnnotations returns value by checking in multiple annotations. moves through list until it finds value if value is new or deleted, we check for next state to correctly set watch & value

func (K8s) SetDefaultAnnotation

func (k K8s) SetDefaultAnnotation(annotation, value string)

type MapStringW

type MapStringW map[string]*StringW

MapStringW stores values and enables

func ConvertToMapStringW

func ConvertToMapStringW(annotations map[string]string) MapStringW

ConvertToMapStringW removes prefixes in annotation

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]*Endpoints
	Services  map[string]*Service
	Secret    map[string]*Secret
	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 PortEndpoints

type PortEndpoints struct {
	Port            int64
	BackendName     string // For runtime operations
	DynUpdateFailed bool
	AddrCount       int
	AddrNew         map[string]struct{}
	HAProxySrvs     []*HAProxySrv
}

PortEndpoints describes endpionts of a service port

func (*PortEndpoints) Equal

func (oldE *PortEndpoints) Equal(newE *PortEndpoints) bool

Equal checks if old PortEndpoints equals to a new PortEndpoints. All Addresses of a new PortEndpoints are in AddrNew. Addresses of old PortEndpoints are configured in HAProxySrvs and some may be still in AddrNew in case len(HAProxySrvs) < AddrCount. (Eventually all addresses will be in HAProxySrvs after updateHAProxy())

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 MapStringW
	Selector    MapStringW
	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

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