annotations

package
v0.11.7 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2021 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackendConfig

type BackendConfig struct {
	Paths  hatypes.BackendPaths
	Config map[string]*ConfigValue
}

BackendConfig ...

func (*BackendConfig) ConfigEquals

func (b *BackendConfig) ConfigEquals(other map[string]*ConfigValue) bool

ConfigEquals ...

func (*BackendConfig) Get

func (b *BackendConfig) Get(key string) *ConfigValue

Get ...

func (*BackendConfig) String

func (b *BackendConfig) String() string

String ...

type ConfigOverwrite

type ConfigOverwrite func(path *hatypes.BackendPath, values map[string]*ConfigValue) map[string]*ConfigValue

ConfigOverwrite ...

type ConfigValue

type ConfigValue struct {
	Source *Source
	Value  string
}

ConfigValue ...

func (*ConfigValue) Bool

func (cv *ConfigValue) Bool() bool

Bool ...

func (*ConfigValue) Int

func (cv *ConfigValue) Int() int

Int ...

func (*ConfigValue) Int64

func (cv *ConfigValue) Int64() int64

Int64 ...

func (*ConfigValue) String

func (cv *ConfigValue) String() string

String ...

type Map

type Map struct {
	Source *Source
	Link   hatypes.PathLink
	Value  string
}

Map ...

TODO rename URI to Hostpath -- currently this is a little mess. Fix also testCase data in order to represent a hostname+path. Hostname is the domain name. Path is the declared starting path on ingress Together they populate a map_beg() converter in order to match HAProxy's `base` sample fetch method.

func (*Map) String

func (m *Map) String() string

String ...

type MapBuilder

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

MapBuilder ...

func NewMapBuilder

func NewMapBuilder(logger types.Logger, annPrefix string, annDefaults map[string]string) *MapBuilder

NewMapBuilder ...

func (*MapBuilder) NewMapper

func (b *MapBuilder) NewMapper() *Mapper

NewMapper ...

type Mapper

type Mapper struct {
	MapBuilder
	// contains filtered or unexported fields
}

Mapper ...

func (*Mapper) AddAnnotations

func (c *Mapper) AddAnnotations(source *Source, link hatypes.PathLink, ann map[string]string) (conflicts []string)

AddAnnotations ...

func (*Mapper) Get

func (c *Mapper) Get(key string) *ConfigValue

Get ...

func (*Mapper) GetBackendConfig

func (c *Mapper) GetBackendConfig(backend *hatypes.Backend, keys []string, overwrite ConfigOverwrite) []*BackendConfig

GetBackendConfig builds a generic BackendConfig using annotation maps registered previously as its data source

An annotation map is a `map[<uri>]<value>` collected on ingress/service parsing phase. A HAProxy backend need a group of annotation keys - ie a group of maps - grouped by URI in order to create and apply ACLs.

The rule of thumb on the final BackendConfig array is:

  1. Every backend path must be declared, so a HAProxy method can just `if len(BackendConfig) > 1 then need-acl`;
  2. Added annotation means declared annotation (ingress, service or default) so the config reader `Get<Type>FromMap()“ can distinguish between `undeclared` and `declared empty`.

func (*Mapper) GetStrMap

func (c *Mapper) GetStrMap(key string) ([]*Map, bool)

GetStrMap ...

type Source

type Source struct {
	Namespace string
	Name      string
	Type      string
}

Source ...

func (*Source) FullName added in v0.11.1

func (s *Source) FullName() string

FullName ...

func (*Source) String

func (s *Source) String() string

String ...

type Updater

type Updater interface {
	UpdateGlobalConfig(haproxyConfig haproxy.Config, mapper *Mapper)
	UpdateHostConfig(host *hatypes.Host, mapper *Mapper)
	UpdateBackendConfig(backend *hatypes.Backend, mapper *Mapper)
}

Updater ...

func NewUpdater

func NewUpdater(haproxy haproxy.Config, options *ingtypes.ConverterOptions) Updater

NewUpdater ...

Jump to

Keyboard shortcuts

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