Documentation ¶
Index ¶
- Constants
- func ConvertV2ToV1IPNAT(ipnat apiv2.IPNAT) *model.IPNAT
- func NewBGPConfigUpdateProcessor() watchersyncer.SyncerUpdateProcessor
- func NewBGPNodeUpdateProcessor() watchersyncer.SyncerUpdateProcessor
- func NewBGPPeerUpdateProcessor() watchersyncer.SyncerUpdateProcessor
- func NewClusterInfoUpdateProcessor() watchersyncer.SyncerUpdateProcessor
- func NewConfigUpdateProcessor(specType reflect.Type, allowAnnotations bool, nodeConfigKeyFn NodeConfigKeyFn, ...) watchersyncer.SyncerUpdateProcessor
- func NewConflictResolvingCacheUpdateProcessor(v2Kind string, converter ConvertV2ToV1) watchersyncer.SyncerUpdateProcessor
- func NewFelixConfigUpdateProcessor() watchersyncer.SyncerUpdateProcessor
- func NewFelixNodeUpdateProcessor() watchersyncer.SyncerUpdateProcessor
- func NewGlobalNetworkPolicyUpdateProcessor() watchersyncer.SyncerUpdateProcessor
- func NewHostEndpointUpdateProcessor() watchersyncer.SyncerUpdateProcessor
- func NewIPPoolUpdateProcessor() watchersyncer.SyncerUpdateProcessor
- func NewNetworkPolicyUpdateProcessor() watchersyncer.SyncerUpdateProcessor
- func NewProfileUpdateProcessor() watchersyncer.SyncerUpdateProcessor
- func NewSimpleUpdateProcessor(v2Kind string, kConverter ConvertV2ToV1Key, vConverter ConvertV2ToV1Value) watchersyncer.SyncerUpdateProcessor
- func NewWorkloadEndpointUpdateProcessor() watchersyncer.SyncerUpdateProcessor
- func RuleAPIV2ToBackend(ar apiv2.Rule) model.Rule
- func RulesAPIV2ToBackend(ars []apiv2.Rule) []model.Rule
- type ConvertV2ToV1
- type ConvertV2ToV1Key
- type ConvertV2ToV1Value
- type FelixNodeUpdateProcessor
- type GlobalConfigKeyFn
- type NodeConfigKeyFn
- type ValueToStringFn
Constants ¶
const ( AllowAnnotations = true DisallowAnnotations = false )
Variables ¶
This section is empty.
Functions ¶
func NewBGPConfigUpdateProcessor ¶
func NewBGPConfigUpdateProcessor() watchersyncer.SyncerUpdateProcessor
Create a new SyncerUpdateProcessor to sync BGPConfiguration data in v1 format for consumption by the BGP daemon.
func NewBGPNodeUpdateProcessor ¶
func NewBGPNodeUpdateProcessor() watchersyncer.SyncerUpdateProcessor
Create a new SyncerUpdateProcessor to sync Node data in v1 format for consumption by the BGP daemon.
func NewBGPPeerUpdateProcessor ¶
func NewBGPPeerUpdateProcessor() watchersyncer.SyncerUpdateProcessor
Create a new SyncerUpdateProcessor to sync IPPool data in v1 format for consumption by both Felix and the BGP daemon.
func NewClusterInfoUpdateProcessor ¶
func NewClusterInfoUpdateProcessor() watchersyncer.SyncerUpdateProcessor
Create a new NewClusterInfoUpdateProcessor.
func NewConfigUpdateProcessor ¶
func NewConfigUpdateProcessor( specType reflect.Type, allowAnnotations bool, nodeConfigKeyFn NodeConfigKeyFn, globalConfigKeyFn GlobalConfigKeyFn, stringifiers map[string]ValueToStringFn, ) watchersyncer.SyncerUpdateProcessor
NewConfigUpdateProcessor creates a SyncerUpdateProcessor that can be used to map Configuration-type resources to the v1 model. This converter basically expands each field as a separate key and uses a stringified of the field as the configuration value. If the field is not specified in the configuration resource we expand that that a delete for the associated key.
If the field specifies a "confignamev1" tag, then the value in that tag is used as the config name, otherwise the struct field name is used.
A set of ValueToStringFn can be specified for each of the (converted) field names to handle marshaling the field value into the string value required in the v1 model.
It is assumed that the name of the resource follows the format: - `default` for global - `node.<nodename>` for per-node
If allowAnnotations is set to true, then this helper will also check the annotations for additional config key/values. An annotation prefixed with "config.projectcalico.org/" will be used (prefix removed) as the config key, and the value of the annotation used as the value. These values are not validated, and take precedence over keys of the same name in the Spec - thus it's possible to use an annotation to work around any validation provided on the Spec.
func NewConflictResolvingCacheUpdateProcessor ¶
func NewConflictResolvingCacheUpdateProcessor(v2Kind string, converter ConvertV2ToV1) watchersyncer.SyncerUpdateProcessor
ConflictResolvingNameCacheProcessor implements a cached update processor that may be used to handle resources where the indexing has changed between the v2 and v1 models. In v2 all resources have a single name field which in some cases may be unlinked to the v1 indexes. This means it's potentially possible to have multiple v2 resources that share a common set of indexes when converted to the v1 model - e.g. IPPools in v2 are indexed by arbitrary name, and in v1 by the Pool CIDR, it would be possible to have multiple pools configured with the same CIDR.
This cache may also be used when name conflicts are not an issue, but there is no direct map between the v1 key and the v2 key, for example HostEndpoints have an additional "node" index in the v1 key, so this cache can be used to resolve between the v2 name and the last set of v1 indices to provide the relevant updates.
Notes:
- this update processor only handles simple 1:1 conversions (i.e. a single v2 model mapping to a single v1 model).
- generally, validation processing would prevent the user from making configuration changes with conflicting (duplicate) information - but since that operation is not atomic, we need to handle gracefully these situations whether or not that validation processing is in place.
- since the relationship between the v1 and v2 indexes is not locked, the v1 index for a given v2 resource may be changed by an update.
This cache handles conflicting entries by only syncing the v1 data for the v2 resource with the lowest alphanumeric name. This means:
- Adding a conflicting resource with a higher alphanumeric name will not result in any syncer update.
- Deleting the conflicting resource with the lowest alphanumeric name will result in an update using the configuration of the conflicting resource with the next lowest alphanumeric name.
- Modifying an existing resource (that is already in our cache) is more complicated. It is possible that the modification may alter the v1 key - and in which case we need to effectively treat as a delete (for the old v1 key) and an add for the new v1 key.
func NewFelixConfigUpdateProcessor ¶
func NewFelixConfigUpdateProcessor() watchersyncer.SyncerUpdateProcessor
Create a new SyncerUpdateProcessor to sync FelixConfiguration data in v1 format for consumption by Felix.
func NewFelixNodeUpdateProcessor ¶
func NewFelixNodeUpdateProcessor() watchersyncer.SyncerUpdateProcessor
Create a new SyncerUpdateProcessor to sync Node data in v1 format for consumption by Felix.
func NewGlobalNetworkPolicyUpdateProcessor ¶
func NewGlobalNetworkPolicyUpdateProcessor() watchersyncer.SyncerUpdateProcessor
Create a new SyncerUpdateProcessor to sync GlobalNetworkPolicy data in v1 format for consumption by Felix.
func NewHostEndpointUpdateProcessor ¶
func NewHostEndpointUpdateProcessor() watchersyncer.SyncerUpdateProcessor
Create a new SyncerUpdateProcessor to sync HostEndpoint data in v1 format for consumption by both Felix and the BGP daemon.
func NewIPPoolUpdateProcessor ¶
func NewIPPoolUpdateProcessor() watchersyncer.SyncerUpdateProcessor
Create a new SyncerUpdateProcessor to sync IPPool data in v1 format for consumption by both Felix and the BGP daemon.
func NewNetworkPolicyUpdateProcessor ¶
func NewNetworkPolicyUpdateProcessor() watchersyncer.SyncerUpdateProcessor
Create a new SyncerUpdateProcessor to sync NetworkPolicy data in v1 format for consumption by Felix.
func NewProfileUpdateProcessor ¶
func NewProfileUpdateProcessor() watchersyncer.SyncerUpdateProcessor
Create a new SyncerUpdateProcessor to sync Profile data in v1 format for consumption by Felix.
func NewSimpleUpdateProcessor ¶
func NewSimpleUpdateProcessor(v2Kind string, kConverter ConvertV2ToV1Key, vConverter ConvertV2ToV1Value) watchersyncer.SyncerUpdateProcessor
func NewWorkloadEndpointUpdateProcessor ¶
func NewWorkloadEndpointUpdateProcessor() watchersyncer.SyncerUpdateProcessor
Create a new SyncerUpdateProcessor to sync WorkloadEndpoint data in v1 format for consumption by Felix.
func RuleAPIV2ToBackend ¶
RuleAPIToBackend converts an API Rule structure to a Backend Rule structure.
Types ¶
type ConvertV2ToV1Key ¶
type ConvertV2ToV1Key func(v2Key model.ResourceKey) (model.Key, error)
type ConvertV2ToV1Value ¶
type ConvertV2ToV1Value func(interface{}) (interface{}, error)
type FelixNodeUpdateProcessor ¶
type FelixNodeUpdateProcessor struct { }
FelixNodeUpdateProcessor implements the SyncerUpdateProcessor interface. This converts the v2 node configuration into the v1 data types consumed by confd.
func (*FelixNodeUpdateProcessor) OnSyncerStarting ¶
func (c *FelixNodeUpdateProcessor) OnSyncerStarting()
Sync is restarting - nothing to do for this processor.
type GlobalConfigKeyFn ¶
Convert the config name to the corresponding global config key
type NodeConfigKeyFn ¶
Convert the node and config name to the corresponding per-node config key
type ValueToStringFn ¶
type ValueToStringFn func(value interface{}) string
Convert an arbitrary value to the string value used in the config.
Source Files ¶
- bgpconfigprocessor.go
- bgpnodeprocessor.go
- bgppeerprocessor.go
- clusterinfoprocessor.go
- configurationprocessor.go
- conflictresolvingcacheproc.go
- doc.go
- felixconfigprocessor.go
- felixnodeprocessor.go
- globalnetworkpolicyprocessor.go
- hostendpointprocessor.go
- ippoolprocessor.go
- networkpolicyprocessor.go
- processor.go
- profileprocessor.go
- rules.go
- workloadendpointprocessor.go