model

package
v0.0.0-...-8a901cc Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0, Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Common attributes which may be set on allocations by clients.
	IPAMBlockAttributePod             = "pod"
	IPAMBlockAttributeNamespace       = "namespace"
	IPAMBlockAttributeNode            = "node"
	IPAMBlockAttributeType            = "type"
	IPAMBlockAttributeTypeIPIP        = "ipipTunnelAddress"
	IPAMBlockAttributeTypeVXLAN       = "vxlanTunnelAddress"
	IPAMBlockAttributeTypeVXLANV6     = "vxlanV6TunnelAddress"
	IPAMBlockAttributeTypeWireguard   = "wireguardTunnelAddress"
	IPAMBlockAttributeTypeWireguardV6 = "wireguardV6TunnelAddress"
	IPAMBlockAttributeTimestamp       = "timestamp"
)
View Source
const (
	NoRegion     string = "no-region"
	RegionPrefix string = "region-"
)
View Source
const (
	IPAMConfigGlobalName = "default"
)
View Source
const (
	KindKubernetesAdminNetworkPolicy = "KubernetesAdminNetworkPolicy"
)
View Source
const (
	KindKubernetesEndpointSlice = "KubernetesEndpointSlice"
)
View Source
const (
	KindKubernetesNetworkPolicy = "KubernetesNetworkPolicy"
)
View Source
const (
	KindKubernetesService = "KubernetesService"
)

Variables

This section is empty.

Functions

func AllResourcePlurals

func AllResourcePlurals() []string

func ErrorSlashInRegionString

func ErrorSlashInRegionString(regionString string) error

func IsListOptionsLastSegmentPrefix

func IsListOptionsLastSegmentPrefix(listOptions ListInterface) bool

IsListOptionsLastSegmentPrefix returns true if the final segment of the default path root is a name prefix rather than the full name.

func KeyToDefaultDeleteParentPaths

func KeyToDefaultDeleteParentPaths(key Key) ([]string, error)

KeyToDefaultDeleteParentPaths returns a slice of '/'-delimited paths which are used to delete parent entries that may be auto-created by directory-based KV stores (e.g. etcd v3). These paths should also be removed provided they have no more child entries.

The list of parent paths is ordered, and directories should be removed in the order supplied in the slice and only if the directory is empty.

For example,

KeyToDefaultDeletePaths(WorkloadEndpointKey{
	Nodename: "h",
	OrchestratorID: "o",
	WorkloadID: "w",
	EndpointID: "e",
})

returns

["/calico/v1/host/h/workload/o/w/endpoint",

"/calico/v1/host/h/workload/o/w"]

indicating that these paths should also be deleted when they are empty. In this example it is equivalent to deleting the workload when there are no more endpoints in the workload.

func KeyToDefaultDeletePath

func KeyToDefaultDeletePath(key Key) (string, error)

KeyToDefaultDeletePath converts one of the Keys from this package into a unique '/'-delimited path, which is suitable for use as the key when (recursively) deleting the value from a hierarchical (i.e. one with directories and leaves) key/value datastore such as etcd v3.

KeyToDefaultDeletePath returns a different path to KeyToDefaultPath when it is a passed a Key that represents a non-leaf, such as a TierKey. (A tier has its own metadata but it also contains policies as children.)

KeyToDefaultDeletePath returns the common prefix of the non-leaf key and its children so that a recursive delete of that key would delete the object itself and any children it has.

For example, KeyToDefaultDeletePath(TierKey{Tier: "a"}) returns

"/calico/v1/policy/tier/a"

which is a prefix of both KeyToDefaultPath(TierKey{Tier: "a"}):

"/calico/v1/policy/tier/a/metadata"

and KeyToDefaultPath(PolicyKey{Tier: "a", Name: "b"}):

"/calico/v1/policy/tier/a/policy/b"

func KeyToDefaultPath

func KeyToDefaultPath(key Key) (string, error)

KeyToDefaultPath converts one of the Keys from this package into a unique '/'-delimited path, which is suitable for use as the key when storing the value in a hierarchical (i.e. one with directories and leaves) key/value datastore such as etcd v3.

Each unique key returns a unique path.

Keys with a hierarchical relationship share a common prefix. However, in order to support datastores that do not support storing data at non-leaf nodes in the hierarchy (such as etcd v3), the path returned for a "parent" key, is not a direct ancestor of its children.

func ListOptionsIsFullyQualified

func ListOptionsIsFullyQualified(listOptions ListInterface) bool

ListOptionsIsFullyQualified returns true if the options actually specify a fully qualified resource rather than a partial match.

func ListOptionsToDefaultPathRoot

func ListOptionsToDefaultPathRoot(listOptions ListInterface) string

ListOptionsToDefaultPathRoot converts list options struct into a common-prefix path suitable for querying a datastore that uses the paths returned by KeyToDefaultPath. For example,

ListOptionsToDefaultPathRoot(TierListOptions{})

doesn't specify any particular tier so it returns "/calico/v1/policy/tier" which is a prefix for all tiers. The datastore must then do a recursive query to find all children of that path. However,

ListOptionsToDefaultPathRoot(TierListOptions{Tier:"a"})

returns a more-specific path, which filters down to the specific tier of interest: "/calico/v1/policy/tier/a"

func ParseValue

func ParseValue(key Key, rawData []byte) (interface{}, error)

ParseValue parses the default JSON representation of our data into one of our value structs, according to the type of key. I.e. if passed a PolicyKey as the first parameter, it will try to parse rawData into a Policy struct.

func RegionString

func RegionString(region string) string

func SerializeValue

func SerializeValue(d *KVPair) ([]byte, error)

SerializeValue serializes a value in the model to a []byte to be stored in the datastore. This performs the opposite processing to ParseValue()

Types

type ActiveStatusReportKey

type ActiveStatusReportKey struct {
	Hostname     string `json:"-" validate:"required,hostname"`
	RegionString string
}

func (ActiveStatusReportKey) String

func (key ActiveStatusReportKey) String() string

type ActiveStatusReportListOptions

type ActiveStatusReportListOptions struct {
	Hostname     string
	RegionString string
}

func (ActiveStatusReportListOptions) KeyFromDefaultPath

func (options ActiveStatusReportListOptions) KeyFromDefaultPath(ekey string) Key

type Allocation

type Allocation struct {
	Addr net.IP
	Host string
}

type AllocationAttribute

type AllocationAttribute struct {
	AttrPrimary   *string           `json:"handle_id"`
	AttrSecondary map[string]string `json:"secondary"`
}

type AllocationBlock

type AllocationBlock struct {
	// The block's CIDR.
	CIDR net.IPNet `json:"cidr"`

	// Affinity of the block, if this block has one. If set, it will be of the form
	// "host:<hostname>". If not set, this block is not affine to a host.
	Affinity *string `json:"affinity"`

	// Array of allocations in-use within this block. nil entries mean the allocation is free.
	// For non-nil entries at index i, the index is the ordinal of the allocation within this block
	// and the value is the index of the associated attributes in the Attributes array.
	Allocations []*int `json:"allocations"`

	// Unallocated is an ordered list of allocations which are free in the block.
	Unallocated []int `json:"unallocated"`

	// Attributes is an array of arbitrary metadata associated with allocations in the block. To find
	// attributes for a given allocation, use the value of the allocation's entry in the Allocations array
	// as the index of the element in this array.
	Attributes []AllocationAttribute `json:"attributes"`

	// We store a sequence number that is updated each time the block is written.
	// Each allocation will also store the sequence number of the block at the time of its creation.
	// When releasing an IP, passing the sequence number associated with the allocation allows us
	// to protect against a race condition and ensure the IP hasn't been released and re-allocated
	// since the release request.
	SequenceNumber uint64 `json:"sequenceNumber"`

	// Map of allocated ordinal within the block to sequence number of the block at
	// the time of allocation. Kubernetes does not allow numerical keys for maps, so
	// the key is cast to a string.
	SequenceNumberForAllocation map[string]uint64 `json:"sequenceNumberForAllocation"`

	// Deleted is an internal boolean used to workaround a limitation in the Kubernetes API whereby
	// deletion will not return a conflict error if the block has been updated.
	Deleted bool `json:"deleted"`

	// HostAffinity is deprecated in favor of Affinity.
	// This is only to keep compatibility with existing deployments.
	// The data format should be `Affinity: host:hostname` (not `hostAffinity: hostname`).
	HostAffinity *string `json:"hostAffinity,omitempty"`
}

func (*AllocationBlock) ClearSequenceNumberForOrdinal

func (b *AllocationBlock) ClearSequenceNumberForOrdinal(ordinal int)

func (*AllocationBlock) GetSequenceNumberForOrdinal

func (b *AllocationBlock) GetSequenceNumberForOrdinal(ordinal int) uint64

func (*AllocationBlock) Host

func (b *AllocationBlock) Host() string

func (*AllocationBlock) IPToOrdinal

func (b *AllocationBlock) IPToOrdinal(ip net.IP) (int, error)

Find the ordinal (i.e. how far into the block) a given IP lies. Returns an error if the IP is outside the block.

func (*AllocationBlock) IsDeleted

func (b *AllocationBlock) IsDeleted() bool

func (*AllocationBlock) MarkDeleted

func (b *AllocationBlock) MarkDeleted()

func (*AllocationBlock) NonAffineAllocations

func (b *AllocationBlock) NonAffineAllocations() []Allocation

func (*AllocationBlock) NumAddresses

func (b *AllocationBlock) NumAddresses() int

Get number of addresses covered by the block

func (*AllocationBlock) OrdinalToIP

func (b *AllocationBlock) OrdinalToIP(ord int) net.IP

Calculates the IP at the given position within the block. ord=0 gives the first IP in the block.

func (*AllocationBlock) SetSequenceNumberForOrdinal

func (b *AllocationBlock) SetSequenceNumberForOrdinal(ordinal int)

type BGPNode

type BGPNode struct {
}

type BGPNodeKey

type BGPNodeKey struct {
	Host string
}

func (BGPNodeKey) String

func (key BGPNodeKey) String() string

type BGPPeer

type BGPPeer struct {
	// PeerIP is the IP address of the BGP peer.
	PeerIP net.IP `json:"ip"`

	// ASNum is the AS number of the peer.  Note that we write out the
	// value as a string in the backend, because confd templating
	// converts large uints to float e notation which breaks the BIRD
	// configuration.
	ASNum numorstring.ASNumber `json:"as_num,string"`
}

type BlockAffinity

type BlockAffinity struct {
	State   BlockAffinityState `json:"state"`
	Deleted bool               `json:"deleted"`
}

type BlockAffinityKey

type BlockAffinityKey struct {
	CIDR net.IPNet `json:"-" validate:"required,name"`
	Host string    `json:"-"`
}

func (BlockAffinityKey) String

func (key BlockAffinityKey) String() string

type BlockAffinityListOptions

type BlockAffinityListOptions struct {
	Host      string
	IPVersion int
}

func (BlockAffinityListOptions) KeyFromDefaultPath

func (options BlockAffinityListOptions) KeyFromDefaultPath(path string) Key

type BlockAffinityState

type BlockAffinityState string
const (
	StateConfirmed       BlockAffinityState = "confirmed"
	StatePending         BlockAffinityState = "pending"
	StatePendingDeletion BlockAffinityState = "pendingDeletion"
)

type BlockKey

type BlockKey struct {
	CIDR net.IPNet `json:"-" validate:"required,name"`
}

func (BlockKey) String

func (key BlockKey) String() string

type BlockListOptions

type BlockListOptions struct {
	IPVersion int `json:"-"`
}

func (BlockListOptions) KeyFromDefaultPath

func (options BlockListOptions) KeyFromDefaultPath(path string) Key

type DeletionMarker

type DeletionMarker interface {
	MarkDeleted()
	IsDeleted() bool
}

type EndpointPort

type EndpointPort struct {
	Name     string               `json:"name" validate:"name"`
	Protocol numorstring.Protocol `json:"protocol"`
	Port     uint16               `json:"port" validate:"gt=0"`
}

type GlobalBGPConfigKey

type GlobalBGPConfigKey struct {
	// The name of the global BGP config key.
	Name string `json:"-" validate:"required,name"`
}

func (GlobalBGPConfigKey) String

func (key GlobalBGPConfigKey) String() string

type GlobalBGPConfigListOptions

type GlobalBGPConfigListOptions struct {
	Name string
}

func (GlobalBGPConfigListOptions) KeyFromDefaultPath

func (options GlobalBGPConfigListOptions) KeyFromDefaultPath(path string) Key

type GlobalBGPPeerKey

type GlobalBGPPeerKey struct {
	PeerIP net.IP `json:"-" validate:"required"`
	Port   uint16 `json:"-" validate:"omitempty"`
}

func (GlobalBGPPeerKey) String

func (key GlobalBGPPeerKey) String() string

type GlobalBGPPeerListOptions

type GlobalBGPPeerListOptions struct {
	PeerIP net.IP
	Port   uint16
}

func (GlobalBGPPeerListOptions) KeyFromDefaultPath

func (options GlobalBGPPeerListOptions) KeyFromDefaultPath(path string) Key

type GlobalConfigKey

type GlobalConfigKey struct {
	Name string `json:"-" validate:"required,name"`
}

func (GlobalConfigKey) String

func (key GlobalConfigKey) String() string

type GlobalConfigListOptions

type GlobalConfigListOptions struct {
	Name string
}

func (GlobalConfigListOptions) KeyFromDefaultPath

func (options GlobalConfigListOptions) KeyFromDefaultPath(path string) Key

type HTTPMatch

type HTTPMatch struct {
	Methods []string         `json:"methods,omitempty" validate:"omitempty"`
	Paths   []apiv3.HTTPPath `json:"paths,omitempty" validate:"omitempty"`
}

type HostConfigKey

type HostConfigKey struct {
	Hostname string `json:"-" validate:"required,name"`
	Name     string `json:"-" validate:"required,name"`
}

func (HostConfigKey) String

func (key HostConfigKey) String() string

type HostConfigListOptions

type HostConfigListOptions struct {
	Hostname string
	Name     string
}

func (HostConfigListOptions) KeyFromDefaultPath

func (options HostConfigListOptions) KeyFromDefaultPath(path string) Key

type HostEndpoint

type HostEndpoint struct {
	Name              string            `json:"name,omitempty" validate:"omitempty,interface"`
	ExpectedIPv4Addrs []net.IP          `json:"expected_ipv4_addrs,omitempty" validate:"omitempty,dive,ipv4"`
	ExpectedIPv6Addrs []net.IP          `json:"expected_ipv6_addrs,omitempty" validate:"omitempty,dive,ipv6"`
	Labels            map[string]string `json:"labels,omitempty" validate:"omitempty,labels"`
	ProfileIDs        []string          `json:"profile_ids,omitempty" validate:"omitempty,dive,name"`
	Ports             []EndpointPort    `json:"ports,omitempty" validate:"dive"`
}

type HostEndpointKey

type HostEndpointKey struct {
	Hostname   string `json:"-" validate:"required,hostname"`
	EndpointID string `json:"-" validate:"required,namespacedName"`
}

func (HostEndpointKey) String

func (key HostEndpointKey) String() string

type HostEndpointListOptions

type HostEndpointListOptions struct {
	Hostname   string
	EndpointID string
}

func (HostEndpointListOptions) KeyFromDefaultPath

func (options HostEndpointListOptions) KeyFromDefaultPath(path string) Key

type HostEndpointStatus

type HostEndpointStatus struct {
	Status string `json:"status"`
}

type HostEndpointStatusKey

type HostEndpointStatusKey struct {
	Hostname   string `json:"-" validate:"required,hostname"`
	EndpointID string `json:"-" validate:"required,namespacedName"`
}

func (HostEndpointStatusKey) String

func (key HostEndpointStatusKey) String() string

type HostEndpointStatusListOptions

type HostEndpointStatusListOptions struct {
	Hostname   string
	EndpointID string
}

func (HostEndpointStatusListOptions) KeyFromDefaultPath

func (options HostEndpointStatusListOptions) KeyFromDefaultPath(ekey string) Key

type HostIPKey

type HostIPKey struct {
	Hostname string
}

The Felix Host IP Key.

func (HostIPKey) String

func (key HostIPKey) String() string

type HostMetadata

type HostMetadata struct {
}

type HostMetadataKey

type HostMetadataKey struct {
	Hostname string
}

func (HostMetadataKey) String

func (key HostMetadataKey) String() string

type HostMetadataListOptions

type HostMetadataListOptions struct {
	Hostname string
}

func (HostMetadataListOptions) KeyFromDefaultPath

func (options HostMetadataListOptions) KeyFromDefaultPath(path string) Key

type IPAMConfig

type IPAMConfig struct {
	StrictAffinity     bool `json:"strict_affinity,omitempty"`
	AutoAllocateBlocks bool `json:"auto_allocate_blocks,omitempty"`
	MaxBlocksPerHost   int  `json:"maxBlocksPerHost,omitempty"`
}

type IPAMConfigKey

type IPAMConfigKey struct{}

func (IPAMConfigKey) String

func (key IPAMConfigKey) String() string

type IPAMHandle

type IPAMHandle struct {
	HandleID string         `json:"-"`
	Block    map[string]int `json:"block"`
	Deleted  bool           `json:"deleted"`
}

type IPAMHandleKey

type IPAMHandleKey struct {
	HandleID string `json:"id"`
}

func (IPAMHandleKey) String

func (key IPAMHandleKey) String() string

type IPAMHandleListOptions

type IPAMHandleListOptions struct {
}

func (IPAMHandleListOptions) KeyFromDefaultPath

func (options IPAMHandleListOptions) KeyFromDefaultPath(path string) Key

type IPAMHost

type IPAMHost struct {
}

type IPAMHostKey

type IPAMHostKey struct {
	Host string
}

func (IPAMHostKey) String

func (key IPAMHostKey) String() string

type IPNAT

type IPNAT struct {
	// The internal IP address which must be associated with the owning endpoint via the
	// configured IPNetworks for the endpoint.
	IntIP net.IP `json:"int_ip" validate:"ip"`

	// The external IP address.
	ExtIP net.IP `json:"ext_ip" validate:"ip"`
}

IPNat contains a single NAT mapping for a WorkloadEndpoint resource.

type IPPool

type IPPool struct {
	CIDR             net.IPNet  `json:"cidr"`
	IPIPInterface    string     `json:"ipip"`
	IPIPMode         encap.Mode `json:"ipip_mode"`
	VXLANMode        encap.Mode `json:"vxlan_mode"`
	Masquerade       bool       `json:"masquerade"`
	IPAM             bool       `json:"ipam"`
	Disabled         bool       `json:"disabled"`
	DisableBGPExport bool       `json:"disableBGPExport"`
}

type IPPoolKey

type IPPoolKey struct {
	CIDR net.IPNet `json:"-" validate:"required,name"`
}

func (IPPoolKey) String

func (key IPPoolKey) String() string

type IPPoolListOptions

type IPPoolListOptions struct {
	CIDR net.IPNet
}

func (IPPoolListOptions) KeyFromDefaultPath

func (options IPPoolListOptions) KeyFromDefaultPath(path string) Key

type KVPair

type KVPair struct {
	Key      Key
	Value    interface{}
	Revision string
	UID      *types.UID
	TTL      time.Duration // For writes, if non-zero, key has a TTL.
}

KVPair holds a typed key and value object as well as datastore specific revision information.

The Value is dependent on the Key, but in general will be one of the following types:

  • A pointer to a struct
  • A slice or map
  • A bare string, boolean value or IP address (i.e. without quotes, so not JSON format).

type KVPairList

type KVPairList struct {
	KVPairs  []*KVPair
	Revision string
}

KVPairList hosts a slice of KVPair structs and a Revision, returned from a Ls

type Key

type Key interface {

	// String returns a unique string representation of this key.  The string
	// returned by this method must uniquely identify this Key.
	String() string
	// contains filtered or unexported methods
}

Key represents a parsed datastore key.

func KeyFromDefaultPath

func KeyFromDefaultPath(path string) Key

KeyFromDefaultPath parses the default path representation of a key into one of our <Type>Key structs. Returns nil if the string doesn't match one of our key types.

func OldKeyFromDefaultPath

func OldKeyFromDefaultPath(path string) Key

OldKeyFromDefaultPath is the old, (slower) implementation of KeyFromDefaultPath. It is kept to allow fuzzing the new version against it. Parses the default path representation of a key into one of our <Type>Key structs. Returns nil if the string doesn't match one of our key types.

type LastStatusReportKey

type LastStatusReportKey struct {
	Hostname     string `json:"-" validate:"required,hostname"`
	RegionString string
}

func (LastStatusReportKey) String

func (key LastStatusReportKey) String() string

type LastStatusReportListOptions

type LastStatusReportListOptions struct {
	Hostname     string
	RegionString string
}

func (LastStatusReportListOptions) KeyFromDefaultPath

func (options LastStatusReportListOptions) KeyFromDefaultPath(ekey string) Key

type ListInterface

type ListInterface interface {

	// BUG(smc) I think we should remove this and use the package KeyFromDefaultPath function.
	// KeyFromDefaultPath parses the default path representation of the
	// Key type for this list.  It returns nil if passed a different kind
	// of path.
	KeyFromDefaultPath(key string) Key
	// contains filtered or unexported methods
}

Interface used to perform datastore lookups.

type NetworkSet

type NetworkSet struct {
	Nets       []net.IPNet       `json:"nets,omitempty" validate:"omitempty,dive,cidr"`
	Labels     map[string]string `json:"labels,omitempty" validate:"omitempty,labels"`
	ProfileIDs []string          `json:"profile_ids,omitempty" validate:"omitempty,dive,name"`
}

type NetworkSetKey

type NetworkSetKey struct {
	Name string `json:"-" validate:"required,namespacedName"`
}

func (NetworkSetKey) String

func (key NetworkSetKey) String() string

type NetworkSetListOptions

type NetworkSetListOptions struct {
	Name string
}

func (NetworkSetListOptions) KeyFromDefaultPath

func (options NetworkSetListOptions) KeyFromDefaultPath(path string) Key

type Node

type Node struct {
	// Felix specific configuration
	FelixIPv4 *net.IP

	// Node specific labels
	Labels map[string]string `json:"labels,omitempty"`

	// BGP specific configuration
	BGPIPv4Addr *net.IP
	BGPIPv6Addr *net.IP
	BGPIPv4Net  *net.IPNet
	BGPIPv6Net  *net.IPNet
	BGPASNumber *numorstring.ASNumber
	OrchRefs    []OrchRef `json:"orchRefs,omitempty"`
}

type NodeBGPConfigKey

type NodeBGPConfigKey struct {
	// The hostname for the host specific BGP config
	Nodename string `json:"-" validate:"required,name"`

	// The name of the host specific BGP config key.
	Name string `json:"-" validate:"required,name"`
}

func (NodeBGPConfigKey) String

func (key NodeBGPConfigKey) String() string

type NodeBGPConfigListOptions

type NodeBGPConfigListOptions struct {
	Nodename string
	Name     string
}

func (NodeBGPConfigListOptions) KeyFromDefaultPath

func (options NodeBGPConfigListOptions) KeyFromDefaultPath(path string) Key

type NodeBGPPeerKey

type NodeBGPPeerKey struct {
	Nodename string `json:"-" validate:"omitempty"`
	PeerIP   net.IP `json:"-" validate:"required"`
	Port     uint16 `json:"-" validate:"omitempty"`
}

func (NodeBGPPeerKey) String

func (key NodeBGPPeerKey) String() string

type NodeBGPPeerListOptions

type NodeBGPPeerListOptions struct {
	Nodename string
	PeerIP   net.IP
	Port     uint16
}

func (NodeBGPPeerListOptions) KeyFromDefaultPath

func (options NodeBGPPeerListOptions) KeyFromDefaultPath(path string) Key

type NodeKey

type NodeKey struct {
	Hostname string
}

func (NodeKey) String

func (key NodeKey) String() string

type NodeListOptions

type NodeListOptions struct {
	Hostname string
}

func (NodeListOptions) KeyFromDefaultPath

func (options NodeListOptions) KeyFromDefaultPath(path string) Key

type OrchRef

type OrchRef struct {
	Orchestrator string `json:"orchestrator,omitempty"`
	NodeName     string `json:"nodeName,omitempty"`
}

type OrchRefKey

type OrchRefKey struct {
	Hostname string
}

func (OrchRefKey) String

func (key OrchRefKey) String() string

type OrchRefListOptions

type OrchRefListOptions struct {
	Hostname string
}

func (OrchRefListOptions) KeyFromDefaultPath

func (options OrchRefListOptions) KeyFromDefaultPath(path string) Key

type Policy

type Policy struct {
	Namespace        string                        `json:"namespace,omitempty" validate:"omitempty"`
	Order            *float64                      `json:"order,omitempty" validate:"omitempty"`
	InboundRules     []Rule                        `json:"inbound_rules,omitempty" validate:"omitempty,dive"`
	OutboundRules    []Rule                        `json:"outbound_rules,omitempty" validate:"omitempty,dive"`
	Selector         string                        `json:"selector" validate:"selector"`
	DoNotTrack       bool                          `json:"untracked,omitempty"`
	Annotations      map[string]string             `json:"annotations,omitempty"`
	PreDNAT          bool                          `json:"pre_dnat,omitempty"`
	ApplyOnForward   bool                          `json:"apply_on_forward,omitempty"`
	Types            []string                      `json:"types,omitempty"`
	PerformanceHints []apiv3.PolicyPerformanceHint `json:"performance_hints,omitempty" validate:"omitempty,unique,dive,oneof=AssumeNeededOnEveryNode"`
}

func (Policy) String

func (p Policy) String() string

type PolicyKey

type PolicyKey struct {
	Name string `json:"-" validate:"required,name"`
	Tier string `json:"-" validate:"required,name"`
}

func (PolicyKey) String

func (key PolicyKey) String() string

type PolicyListOptions

type PolicyListOptions struct {
	Name string
	Tier string
}

func (PolicyListOptions) KeyFromDefaultPath

func (options PolicyListOptions) KeyFromDefaultPath(path string) Key

type Profile

type Profile struct {
	Rules  ProfileRules
	Tags   []string
	Labels map[string]string
}

The profile structure is defined to allow the client to define a conversion interface to map between the API and backend profiles. However, in the actual underlying implementation the profile is written as three separate entries - rules, tags and labels.

type ProfileKey

type ProfileKey struct {
	Name string `json:"-" validate:"required,name"`
}

The profile key actually returns the common parent of the three separate entries. It is useful to define this to re-use some of the common machinery, and can be used for delete processing since delete needs to remove the common parent.

func (ProfileKey) String

func (key ProfileKey) String() string

type ProfileLabelsKey

type ProfileLabelsKey struct {
	ProfileKey
}

ProfileLabelsKey implements the KeyInterface for the profile labels

func (ProfileLabelsKey) String

func (key ProfileLabelsKey) String() string

type ProfileListOptions

type ProfileListOptions struct {
	Name string
}

func (ProfileListOptions) KeyFromDefaultPath

func (options ProfileListOptions) KeyFromDefaultPath(path string) Key

func (*ProfileListOptions) ListConvert

func (_ *ProfileListOptions) ListConvert(ds []*KVPair) []*KVPair

type ProfileRules

type ProfileRules struct {
	InboundRules  []Rule `json:"inbound_rules,omitempty" validate:"omitempty,dive"`
	OutboundRules []Rule `json:"outbound_rules,omitempty" validate:"omitempty,dive"`
}

type ProfileRulesKey

type ProfileRulesKey struct {
	ProfileKey
}

ProfileRulesKey implements the KeyInterface for the profile rules

func (ProfileRulesKey) String

func (key ProfileRulesKey) String() string

type ReadyFlagKey

type ReadyFlagKey struct {
}

func (ReadyFlagKey) String

func (key ReadyFlagKey) String() string

type ResourceKey

type ResourceKey struct {
	// The name of the resource.
	Name string
	// The namespace of the resource.  Not required if the resource is not namespaced.
	Namespace string
	// The resource kind.
	Kind string
}

func (ResourceKey) String

func (key ResourceKey) String() string

type ResourceListOptions

type ResourceListOptions struct {
	// The name of the resource.
	Name string
	// The namespace of the resource.  Not required if the resource is not namespaced.
	Namespace string
	// The resource kind.
	Kind string
	// Whether the name is prefix rather than the full name.
	Prefix bool
}

func (ResourceListOptions) IsLastSegmentIsPrefix

func (options ResourceListOptions) IsLastSegmentIsPrefix() bool

If the Kind, Namespace and Name are specified, but the Name is a prefix then the last segment of this path is a prefix.

func (ResourceListOptions) KeyFromDefaultPath

func (options ResourceListOptions) KeyFromDefaultPath(path string) Key

func (ResourceListOptions) String

func (options ResourceListOptions) String() string

type Rule

type Rule struct {
	Action string `json:"action,omitempty"`

	IPVersion *int `json:"ip_version,omitempty" validate:"omitempty,ipVersion"`

	Protocol    *numorstring.Protocol `json:"protocol,omitempty" validate:"omitempty"`
	NotProtocol *numorstring.Protocol `json:"!protocol,omitempty" validate:"omitempty"`

	// ICMP validation notes: 0 is a valid (common) ICMP type and code.  Type = 255 is not assigned
	// to any protocol and the Linux kernel doesn't support matching on it so we validate against
	// it.
	ICMPType    *int `json:"icmp_type,omitempty" validate:"omitempty,gte=0,lt=255"`
	ICMPCode    *int `json:"icmp_code,omitempty" validate:"omitempty,gte=0,lte=255"`
	NotICMPType *int `json:"!icmp_type,omitempty" validate:"omitempty,gte=0,lt=255"`
	NotICMPCode *int `json:"!icmp_code,omitempty" validate:"omitempty,gte=0,lte=255"`

	SrcTag              string             `json:"src_tag,omitempty" validate:"omitempty,tag"`
	SrcNet              *net.IPNet         `json:"src_net,omitempty" validate:"omitempty"`
	SrcNets             []*net.IPNet       `json:"src_nets,omitempty" validate:"omitempty"`
	SrcSelector         string             `json:"src_selector,omitempty" validate:"omitempty,selector"`
	SrcPorts            []numorstring.Port `json:"src_ports,omitempty" validate:"omitempty,dive"`
	SrcService          string             `json:"src_service,omitempty" validate:"omitempty"`
	SrcServiceNamespace string             `json:"src_service_ns,omitempty" validate:"omitempty"`
	DstTag              string             `json:"dst_tag,omitempty" validate:"omitempty,tag"`
	DstSelector         string             `json:"dst_selector,omitempty" validate:"omitempty,selector"`
	DstNet              *net.IPNet         `json:"dst_net,omitempty" validate:"omitempty"`
	DstNets             []*net.IPNet       `json:"dst_nets,omitempty" validate:"omitempty"`
	DstPorts            []numorstring.Port `json:"dst_ports,omitempty" validate:"omitempty,dive"`
	DstService          string             `json:"dst_service,omitempty" validate:"omitempty"`
	DstServiceNamespace string             `json:"dst_service_ns,omitempty" validate:"omitempty"`

	NotSrcTag      string             `json:"!src_tag,omitempty" validate:"omitempty,tag"`
	NotSrcNet      *net.IPNet         `json:"!src_net,omitempty" validate:"omitempty"`
	NotSrcNets     []*net.IPNet       `json:"!src_nets,omitempty" validate:"omitempty"`
	NotSrcSelector string             `json:"!src_selector,omitempty" validate:"omitempty,selector"`
	NotSrcPorts    []numorstring.Port `json:"!src_ports,omitempty" validate:"omitempty,dive"`
	NotDstTag      string             `json:"!dst_tag,omitempty" validate:"omitempty"`
	NotDstSelector string             `json:"!dst_selector,omitempty" validate:"omitempty,selector"`
	NotDstNet      *net.IPNet         `json:"!dst_net,omitempty" validate:"omitempty"`
	NotDstNets     []*net.IPNet       `json:"!dst_nets,omitempty" validate:"omitempty"`
	NotDstPorts    []numorstring.Port `json:"!dst_ports,omitempty" validate:"omitempty,dive"`

	// These fields allow us to pass through the raw match criteria from the V3 datamodel unmodified.
	// The selectors above are formed in the update processor layer by combining the original
	// selectors, namespace selectors and service account selectors into one.
	OriginalSrcSelector               string   `json:"orig_src_selector,omitempty" validate:"omitempty,selector"`
	OriginalSrcNamespaceSelector      string   `json:"orig_src_namespace_selector,omitempty" validate:"omitempty,selector"`
	OriginalDstSelector               string   `json:"orig_dst_selector,omitempty" validate:"omitempty,selector"`
	OriginalDstNamespaceSelector      string   `json:"orig_dst_namespace_selector,omitempty" validate:"omitempty,selector"`
	OriginalNotSrcSelector            string   `json:"!orig_src_selector,omitempty" validate:"omitempty,selector"`
	OriginalNotDstSelector            string   `json:"!orig_dst_selector,omitempty" validate:"omitempty,selector"`
	OriginalSrcServiceAccountNames    []string `json:"orig_src_service_acct_names,omitempty" validate:"omitempty"`
	OriginalSrcServiceAccountSelector string   `json:"orig_src_service_acct_selector,omitempty" validate:"omitempty,selector"`
	OriginalDstServiceAccountNames    []string `json:"orig_dst_service_acct_names,omitempty" validate:"omitempty"`
	OriginalDstServiceAccountSelector string   `json:"orig_dst_service_acct_selector,omitempty" validate:"omitempty,selector"`

	// These fields allow us to pass through application layer selectors from the V3 datamodel.
	HTTPMatch *HTTPMatch `json:"http,omitempty" validate:"omitempty"`

	LogPrefix string `json:"log_prefix,omitempty" validate:"omitempty"`

	Metadata *RuleMetadata `json:"metadata,omitempty" validate:"omitempty"`
}

func (Rule) AllDstNets

func (r Rule) AllDstNets() []*net.IPNet

func (Rule) AllNotDstNets

func (r Rule) AllNotDstNets() []*net.IPNet

func (Rule) AllNotSrcNets

func (r Rule) AllNotSrcNets() []*net.IPNet

func (Rule) AllSrcNets

func (r Rule) AllSrcNets() []*net.IPNet

func (Rule) String

func (r Rule) String() string

type RuleMetadata

type RuleMetadata struct {
	Annotations map[string]string `json:"annotations,omitempty"`
}

type StatusReport

type StatusReport struct {
	Timestamp     string  `json:"time"`
	UptimeSeconds float64 `json:"uptime"`
	FirstUpdate   bool    `json:"first_update"`
}

type Tier

type Tier struct {
	Order         *float64  `json:"order,omitempty"`
	DefaultAction v3.Action `json:"defaultAction,omitempty"`
}

type TierKey

type TierKey struct {
	Name string `json:"-" validate:"required,name"`
}

func (TierKey) String

func (key TierKey) String() string

type TierListOptions

type TierListOptions struct {
	Name string
}

func (TierListOptions) KeyFromDefaultPath

func (options TierListOptions) KeyFromDefaultPath(path string) Key

type Wireguard

type Wireguard struct {
	InterfaceIPv4Addr *net.IP `json:"interfaceIPv4Addr,omitempty"`
	PublicKey         string  `json:"publicKey,omitempty"`
	InterfaceIPv6Addr *net.IP `json:"interfaceIPv6Addr,omitempty"`
	PublicKeyV6       string  `json:"publicKeyV6,omitempty"`
}

type WireguardKey

type WireguardKey struct {
	NodeName string
}

The Felix Wireguard Key.

func (WireguardKey) String

func (key WireguardKey) String() string

type WireguardListOptions

type WireguardListOptions struct {
	NodeName string
}

func (WireguardListOptions) KeyFromDefaultPath

func (options WireguardListOptions) KeyFromDefaultPath(path string) Key

type WorkloadEndpoint

type WorkloadEndpoint struct {
	State                      string            `json:"state"`
	Name                       string            `json:"name"`
	ActiveInstanceID           string            `json:"active_instance_id"`
	Mac                        *net.MAC          `json:"mac"`
	ProfileIDs                 []string          `json:"profile_ids"`
	IPv4Nets                   []net.IPNet       `json:"ipv4_nets"`
	IPv6Nets                   []net.IPNet       `json:"ipv6_nets"`
	IPv4NAT                    []IPNAT           `json:"ipv4_nat,omitempty"`
	IPv6NAT                    []IPNAT           `json:"ipv6_nat,omitempty"`
	Labels                     map[string]string `json:"labels,omitempty"`
	IPv4Gateway                *net.IP           `json:"ipv4_gateway,omitempty" validate:"omitempty,ipv4"`
	IPv6Gateway                *net.IP           `json:"ipv6_gateway,omitempty" validate:"omitempty,ipv6"`
	Ports                      []EndpointPort    `json:"ports,omitempty" validate:"dive"`
	GenerateName               string            `json:"generate_name,omitempty"`
	AllowSpoofedSourcePrefixes []net.IPNet       `json:"allow_spoofed_source_ips,omitempty"`
	Annotations                map[string]string `json:"annotations,omitempty"`
}

type WorkloadEndpointKey

type WorkloadEndpointKey struct {
	Hostname       string `json:"-"`
	OrchestratorID string `json:"-"`
	WorkloadID     string `json:"-"`
	EndpointID     string `json:"-"`
}

func (WorkloadEndpointKey) String

func (key WorkloadEndpointKey) String() string

type WorkloadEndpointListOptions

type WorkloadEndpointListOptions struct {
	Hostname       string
	OrchestratorID string
	WorkloadID     string
	EndpointID     string
}

func (WorkloadEndpointListOptions) KeyFromDefaultPath

func (options WorkloadEndpointListOptions) KeyFromDefaultPath(path string) Key

type WorkloadEndpointStatus

type WorkloadEndpointStatus struct {
	Status string `json:"status"`
}

type WorkloadEndpointStatusKey

type WorkloadEndpointStatusKey struct {
	Hostname       string `json:"-"`
	OrchestratorID string `json:"-"`
	WorkloadID     string `json:"-"`
	EndpointID     string `json:"-"`
	RegionString   string
}

func (WorkloadEndpointStatusKey) String

func (key WorkloadEndpointStatusKey) String() string

type WorkloadEndpointStatusListOptions

type WorkloadEndpointStatusListOptions struct {
	Hostname       string
	OrchestratorID string
	WorkloadID     string
	EndpointID     string
	RegionString   string
}

func (WorkloadEndpointStatusListOptions) KeyFromDefaultPath

func (options WorkloadEndpointStatusListOptions) KeyFromDefaultPath(ekey string) Key

Notes

Bugs

  • I think we should remove this and use the package KeyFromDefaultPath function. KeyFromDefaultPath parses the default path representation of the Key type for this list. It returns nil if passed a different kind of path.

Jump to

Keyboard shortcuts

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