converters

package
v3.5.0-0.dev+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var V1EgressRule1 = apiv1.Rule{
	Action:    "pass",
	IPVersion: &ipv4,
	Protocol:  &numProtocol1,
	ICMP:      &icmp1,
	Source: apiv1.EntityRule{
		Tag:      "tag3",
		Net:      &cidr2,
		Selector: "all()",
	},
}
View Source
var V1EgressRule2 = apiv1.Rule{
	Action:    "allow",
	IPVersion: &ipv6,
	Protocol:  &v1strProtocol2,
	ICMP:      &icmp1,
	Source: apiv1.EntityRule{
		Tag:      "tag4",
		Net:      &cidrv62,
		Selector: "label2 == '1234'",
	},
}
View Source
var V1InRule1 = apiv1.Rule{
	Action:    "allow",
	IPVersion: &ipv4,
	Protocol:  &v1strProtocol1,
	ICMP:      &icmp1,
	Source: apiv1.EntityRule{
		Tag:      "tag1",
		Net:      &cidr1,
		Nets:     []*net.IPNet{&cidr3, &cidr4},
		NotNet:   &cidr2,
		NotNets:  []*net.IPNet{&cidr1, &cidr3},
		Selector: "has(calico/k8s_ns) || bake == 'cake'",
	},
	Destination: apiv1.EntityRule{
		Tag:     "kingindanorth",
		Net:     &cidr2,
		Nets:    []*net.IPNet{&cidr1, &cidr3},
		NotNet:  &cidr1,
		NotNets: []*net.IPNet{&cidr3, &cidr4},
	},
}
View Source
var V1InRule2 = apiv1.Rule{
	Action:    "deny",
	IPVersion: &ipv6,
	Protocol:  &numProtocol1,
	ICMP:      &icmp1,
	Source: apiv1.EntityRule{
		Tag:      "tag2",
		Net:      &cidrv61,
		Selector: "has(label2)",
	},
}
View Source
var V1ModelEgressRule1 = model.Rule{
	Action:      "next-tier",
	IPVersion:   &ipv4,
	Protocol:    &numProtocol1,
	ICMPType:    &icmpType1,
	ICMPCode:    &icmpCode1,
	SrcTag:      "tag3",
	SrcNet:      &cidr2Net,
	SrcSelector: "all()",
}
View Source
var V1ModelEgressRule2 = model.Rule{
	Action:      "allow",
	IPVersion:   &ipv6,
	Protocol:    &v1strProtocol2,
	ICMPType:    &icmpType1,
	ICMPCode:    &icmpCode1,
	SrcTag:      "tag4",
	SrcNet:      &cidrv62,
	SrcSelector: "label2 == '1234'",
}
View Source
var V1ModelInRule1 = model.Rule{
	Action:      "allow",
	IPVersion:   &ipv4,
	Protocol:    &v1strProtocol1,
	ICMPType:    &icmpType1,
	ICMPCode:    &icmpCode1,
	SrcTag:      "tag1",
	SrcNet:      &cidr1Net,
	SrcNets:     []*net.IPNet{&cidr3Net, &cidr4Net},
	NotSrcNet:   &cidr2Net,
	NotSrcNets:  []*net.IPNet{&cidr1Net, &cidr3Net},
	DstTag:      "kingindanorth",
	DstNet:      &cidr2Net,
	DstNets:     []*net.IPNet{&cidr1Net, &cidr3Net},
	NotDstNet:   &cidr1Net,
	NotDstNets:  []*net.IPNet{&cidr3Net, &cidr4Net},
	SrcSelector: "has(calico/k8s_ns) || bake == 'cake'",
}
View Source
var V1ModelInRule2 = model.Rule{
	Action:      "deny",
	IPVersion:   &ipv6,
	Protocol:    &numProtocol1,
	ICMPType:    &icmpType1,
	ICMPCode:    &icmpCode1,
	SrcTag:      "tag2",
	SrcNet:      &cidrv61,
	SrcSelector: "has(label2)",
}
View Source
var V3EgressRule1 = apiv3.Rule{
	Action:    apiv3.Pass,
	IPVersion: &ipv4,
	Protocol:  &numProtocol1,
	ICMP:      &v3icmp1,
	Source: apiv3.EntityRule{
		Nets:     []string{cidr2StrictMaskStr},
		Selector: "(all()) && tag3 == ''",
	},
}
View Source
var V3EgressRule2 = apiv3.Rule{
	Action:    apiv3.Allow,
	IPVersion: &ipv6,
	Protocol:  &v3strProtocol2,
	ICMP:      &v3icmp1,
	Source: apiv3.EntityRule{
		Nets:     []string{cidrv62Str},
		Selector: "(label2 == '1234') && tag4 == ''",
	},
}
View Source
var V3InRule1 = apiv3.Rule{
	Action:    apiv3.Allow,
	IPVersion: &ipv4,
	Protocol:  &v3strProtocol1,
	ICMP:      &v3icmp1,
	Source: apiv3.EntityRule{
		Nets:     []string{cidr3StrictMaskStr, cidr4StrictMaskStr, cidr1StrictMaskStr},
		NotNets:  []string{cidr1StrictMaskStr, cidr3StrictMaskStr, cidr2StrictMaskStr},
		Selector: "(has(projectcalico.org/namespace) || bake == 'cake') && tag1 == ''",
	},
	Destination: apiv3.EntityRule{
		Nets:     []string{cidr1StrictMaskStr, cidr3StrictMaskStr, cidr2StrictMaskStr},
		NotNets:  []string{cidr3StrictMaskStr, cidr4StrictMaskStr, cidr1StrictMaskStr},
		Selector: "kingindanorth == ''",
	},
}
View Source
var V3InRule2 = apiv3.Rule{
	Action:    apiv3.Deny,
	IPVersion: &ipv6,
	Protocol:  &numProtocol1,
	ICMP:      &v3icmp1,
	Source: apiv3.EntityRule{
		Nets:     []string{cidrv61Str},
		Selector: "(has(label2)) && tag2 == ''",
	},
}

Functions

func ConvertNodeName

func ConvertNodeName(v1Name string) string

Convert the v1 node name to a standard v3 name. This uses the standard name normalization but does not add a qualifier. Any overlapping names will result in a failed upgrade, so the pre-upgrade validation script will check for conflicting names.

Types

type BGPPeer

type BGPPeer struct{}

BGPPeer implements the Converter interface.

func (BGPPeer) APIV1ToBackendV1

func (bp BGPPeer) APIV1ToBackendV1(rIn unversioned.Resource) (*model.KVPair, error)

APIV1ToBackendV1 converts v1 BGPPeer API to v1 BGPPeer KVPair.

func (BGPPeer) BackendV1ToAPIV3

func (bp BGPPeer) BackendV1ToAPIV3(kvp *model.KVPair) (Resource, error)

BackendV1ToAPIV3 converts v1 BGPPeer KVPair to v3 API.

type Converter

type Converter interface {
	// APIV1ToBackendV1 converts unversioned resource (v1 API) to v1 KVPair.
	APIV1ToBackendV1(unversioned.Resource) (*model.KVPair, error)

	// BackendV1ToAPIV3 converts v1 KVPair to v3 resource (v3 API)
	BackendV1ToAPIV3(*model.KVPair) (Resource, error)
}

type HostEndpoint

type HostEndpoint struct{}

HostEndpoint implements the Converter interface.

func (HostEndpoint) APIV1ToBackendV1

func (_ HostEndpoint) APIV1ToBackendV1(a unversioned.Resource) (*model.KVPair, error)

APIV1ToBackendV1 converts an APIv1 HostEndpoint structure to a KVPair containing a backend HostEndpoint and HostEndpointKey. This is part of the converter interface.

func (HostEndpoint) BackendV1ToAPIV3

func (_ HostEndpoint) BackendV1ToAPIV3(d *model.KVPair) (Resource, error)

BackendV1ToAPIV3 converts a KVPair containing a backend HostEndpoint and HostEndpointKey to an APIv3 HostEndpoint structure. This is part of the Converter interface.

type IPPool

type IPPool struct{}

IPPool implements the Converter interface.

func (IPPool) APIV1ToBackendV1

func (_ IPPool) APIV1ToBackendV1(rIn unversioned.Resource) (*model.KVPair, error)

APIV1ToBackendV1 converts v1 IPPool API to v1 IPPool KVPair.

func (IPPool) BackendV1ToAPIV3

func (_ IPPool) BackendV1ToAPIV3(kvp *model.KVPair) (Resource, error)

BackendV1ToAPIV3 converts v1 IPPool KVPair to v3 API.

type Node

type Node struct{}

func (Node) APIV1ToBackendV1

func (n Node) APIV1ToBackendV1(a unversioned.Resource) (*model.KVPair, error)

convertAPIToKVPair converts an API Node structure to a KVPair containing a backend Node and NodeKey. This is part of the conversionHelper interface.

func (Node) BackendV1ToAPIV3

func (_ Node) BackendV1ToAPIV3(d *model.KVPair) (Resource, error)

convertKVPairToAPI converts a KVPair containing a backend Node and NodeKey to an API Node structure. The Node.Spec.BGP.IPv4IPIPTunnelAddr field will need to be populated still since it comes from another resource. This is part of the conversionHelper interface.

type Policy

type Policy struct{}

Policy implements the Converter interface.

func (Policy) APIV1ToBackendV1

func (_ Policy) APIV1ToBackendV1(a unversioned.Resource) (*model.KVPair, error)

APIV1ToBackendV1 converts v1 Policy API to v1 Policy KVPair.

func (Policy) BackendV1ToAPIV3

func (_ Policy) BackendV1ToAPIV3(kvp *model.KVPair) (Resource, error)

BackendV1ToAPIV3 converts v1 Policy KVPair to v3 API.

type Profile

type Profile struct{}

Profile implements the Converter interface.

func (Profile) APIV1ToBackendV1

func (_ Profile) APIV1ToBackendV1(a unversioned.Resource) (*model.KVPair, error)

APIV1ToBackendV1 converts v1 Profile API to v1 Profile KVPair.

func (Profile) BackendV1ToAPIV3

func (_ Profile) BackendV1ToAPIV3(kvp *model.KVPair) (Resource, error)

BackendV1ToAPIV3 converts v1 Profile KVPair to v3 API.

type Resource

type Resource interface {
	runtime.Object
	v1.ObjectMetaAccessor
}

Resource is implemented by all Calico resources.

type WorkloadEndpoint

type WorkloadEndpoint struct{}

func (WorkloadEndpoint) APIV1ToBackendV1

func (_ WorkloadEndpoint) APIV1ToBackendV1(rIn unversioned.Resource) (*model.KVPair, error)

APIV1ToBackendV1 converts v1 WorkloadEndpoint API to v1 WorkloadEndpoint KVPair.

func (WorkloadEndpoint) BackendV1ToAPIV3

func (_ WorkloadEndpoint) BackendV1ToAPIV3(kvp *model.KVPair) (Resource, error)

BackendV1ToAPIV3 converts v1 WorkloadEndpoint KVPair to v3 API.

Jump to

Keyboard shortcuts

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