Skip to content

Commit cd02574

Browse files
mengdie-songwenyingd
authored andcommitted
[ExternalNode] Add ExternalNode CRD (antrea-io#3639)
This change adds API definition for ExternalNode CRD and generates the corresponding client and yaml files. Signed-off-by: Mengdie Song <songm@vmware.com>
1 parent 052ddb8 commit cd02574

19 files changed

Lines changed: 912 additions & 4 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
labels:
5+
app: antrea
6+
name: externalnodes.crd.antrea.io
7+
spec:
8+
group: crd.antrea.io
9+
versions:
10+
- name: v1alpha1
11+
schema:
12+
openAPIV3Schema:
13+
type: object
14+
properties:
15+
spec:
16+
type: object
17+
properties:
18+
interfaces:
19+
type: array
20+
items:
21+
type: object
22+
properties:
23+
ips:
24+
type: array
25+
items:
26+
type: string
27+
oneOf:
28+
- format: ipv4
29+
- format: ipv6
30+
name:
31+
type: string
32+
served: true
33+
storage: true
34+
scope: Namespaced
35+
names:
36+
kind: ExternalNode
37+
plural: externalnodes
38+
shortNames:
39+
- en
40+
singular: externalnode

build/yamls/antrea-aks.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,6 +1628,48 @@ spec:
16281628
shortNames:
16291629
- eip
16301630
---
1631+
# Source: antrea/templates/crds/externalnode.yaml
1632+
apiVersion: apiextensions.k8s.io/v1
1633+
kind: CustomResourceDefinition
1634+
metadata:
1635+
labels:
1636+
app: antrea
1637+
name: externalnodes.crd.antrea.io
1638+
spec:
1639+
group: crd.antrea.io
1640+
versions:
1641+
- name: v1alpha1
1642+
schema:
1643+
openAPIV3Schema:
1644+
type: object
1645+
properties:
1646+
spec:
1647+
type: object
1648+
properties:
1649+
interfaces:
1650+
type: array
1651+
items:
1652+
type: object
1653+
properties:
1654+
ips:
1655+
type: array
1656+
items:
1657+
type: string
1658+
oneOf:
1659+
- format: ipv4
1660+
- format: ipv6
1661+
name:
1662+
type: string
1663+
served: true
1664+
storage: true
1665+
scope: Namespaced
1666+
names:
1667+
kind: ExternalNode
1668+
plural: externalnodes
1669+
shortNames:
1670+
- en
1671+
singular: externalnode
1672+
---
16311673
# Source: antrea/templates/crds/ippool.yaml
16321674
apiVersion: apiextensions.k8s.io/v1
16331675
kind: CustomResourceDefinition

build/yamls/antrea-eks.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,6 +1628,48 @@ spec:
16281628
shortNames:
16291629
- eip
16301630
---
1631+
# Source: antrea/templates/crds/externalnode.yaml
1632+
apiVersion: apiextensions.k8s.io/v1
1633+
kind: CustomResourceDefinition
1634+
metadata:
1635+
labels:
1636+
app: antrea
1637+
name: externalnodes.crd.antrea.io
1638+
spec:
1639+
group: crd.antrea.io
1640+
versions:
1641+
- name: v1alpha1
1642+
schema:
1643+
openAPIV3Schema:
1644+
type: object
1645+
properties:
1646+
spec:
1647+
type: object
1648+
properties:
1649+
interfaces:
1650+
type: array
1651+
items:
1652+
type: object
1653+
properties:
1654+
ips:
1655+
type: array
1656+
items:
1657+
type: string
1658+
oneOf:
1659+
- format: ipv4
1660+
- format: ipv6
1661+
name:
1662+
type: string
1663+
served: true
1664+
storage: true
1665+
scope: Namespaced
1666+
names:
1667+
kind: ExternalNode
1668+
plural: externalnodes
1669+
shortNames:
1670+
- en
1671+
singular: externalnode
1672+
---
16311673
# Source: antrea/templates/crds/ippool.yaml
16321674
apiVersion: apiextensions.k8s.io/v1
16331675
kind: CustomResourceDefinition

build/yamls/antrea-gke.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,6 +1628,48 @@ spec:
16281628
shortNames:
16291629
- eip
16301630
---
1631+
# Source: antrea/templates/crds/externalnode.yaml
1632+
apiVersion: apiextensions.k8s.io/v1
1633+
kind: CustomResourceDefinition
1634+
metadata:
1635+
labels:
1636+
app: antrea
1637+
name: externalnodes.crd.antrea.io
1638+
spec:
1639+
group: crd.antrea.io
1640+
versions:
1641+
- name: v1alpha1
1642+
schema:
1643+
openAPIV3Schema:
1644+
type: object
1645+
properties:
1646+
spec:
1647+
type: object
1648+
properties:
1649+
interfaces:
1650+
type: array
1651+
items:
1652+
type: object
1653+
properties:
1654+
ips:
1655+
type: array
1656+
items:
1657+
type: string
1658+
oneOf:
1659+
- format: ipv4
1660+
- format: ipv6
1661+
name:
1662+
type: string
1663+
served: true
1664+
storage: true
1665+
scope: Namespaced
1666+
names:
1667+
kind: ExternalNode
1668+
plural: externalnodes
1669+
shortNames:
1670+
- en
1671+
singular: externalnode
1672+
---
16311673
# Source: antrea/templates/crds/ippool.yaml
16321674
apiVersion: apiextensions.k8s.io/v1
16331675
kind: CustomResourceDefinition

build/yamls/antrea-ipsec.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,6 +1641,48 @@ spec:
16411641
shortNames:
16421642
- eip
16431643
---
1644+
# Source: antrea/templates/crds/externalnode.yaml
1645+
apiVersion: apiextensions.k8s.io/v1
1646+
kind: CustomResourceDefinition
1647+
metadata:
1648+
labels:
1649+
app: antrea
1650+
name: externalnodes.crd.antrea.io
1651+
spec:
1652+
group: crd.antrea.io
1653+
versions:
1654+
- name: v1alpha1
1655+
schema:
1656+
openAPIV3Schema:
1657+
type: object
1658+
properties:
1659+
spec:
1660+
type: object
1661+
properties:
1662+
interfaces:
1663+
type: array
1664+
items:
1665+
type: object
1666+
properties:
1667+
ips:
1668+
type: array
1669+
items:
1670+
type: string
1671+
oneOf:
1672+
- format: ipv4
1673+
- format: ipv6
1674+
name:
1675+
type: string
1676+
served: true
1677+
storage: true
1678+
scope: Namespaced
1679+
names:
1680+
kind: ExternalNode
1681+
plural: externalnodes
1682+
shortNames:
1683+
- en
1684+
singular: externalnode
1685+
---
16441686
# Source: antrea/templates/crds/ippool.yaml
16451687
apiVersion: apiextensions.k8s.io/v1
16461688
kind: CustomResourceDefinition

build/yamls/antrea.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,6 +1628,48 @@ spec:
16281628
shortNames:
16291629
- eip
16301630
---
1631+
# Source: antrea/templates/crds/externalnode.yaml
1632+
apiVersion: apiextensions.k8s.io/v1
1633+
kind: CustomResourceDefinition
1634+
metadata:
1635+
labels:
1636+
app: antrea
1637+
name: externalnodes.crd.antrea.io
1638+
spec:
1639+
group: crd.antrea.io
1640+
versions:
1641+
- name: v1alpha1
1642+
schema:
1643+
openAPIV3Schema:
1644+
type: object
1645+
properties:
1646+
spec:
1647+
type: object
1648+
properties:
1649+
interfaces:
1650+
type: array
1651+
items:
1652+
type: object
1653+
properties:
1654+
ips:
1655+
type: array
1656+
items:
1657+
type: string
1658+
oneOf:
1659+
- format: ipv4
1660+
- format: ipv6
1661+
name:
1662+
type: string
1663+
served: true
1664+
storage: true
1665+
scope: Namespaced
1666+
names:
1667+
kind: ExternalNode
1668+
plural: externalnodes
1669+
shortNames:
1670+
- en
1671+
singular: externalnode
1672+
---
16311673
# Source: antrea/templates/crds/ippool.yaml
16321674
apiVersion: apiextensions.k8s.io/v1
16331675
kind: CustomResourceDefinition

pkg/apis/crd/v1alpha1/register.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
5757
&ClusterNetworkPolicyList{},
5858
&Tier{},
5959
&TierList{},
60+
&ExternalNode{},
61+
&ExternalNodeList{},
6062
)
6163

6264
metav1.AddToGroupVersion(

pkg/apis/crd/v1alpha1/types.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,3 +618,38 @@ type ICMPProtocol struct {
618618
ICMPType *int32 `json:"icmpType,omitempty"`
619619
ICMPCode *int32 `json:"icmpCode,omitempty"`
620620
}
621+
622+
// +genclient
623+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
624+
625+
// ExternalNode refers to a virtual machine or a bare-metal server
626+
// which is not a K8s node, but has Antrea agent running on it.
627+
type ExternalNode struct {
628+
metav1.TypeMeta `json:",inline"`
629+
metav1.ObjectMeta `json:"metadata,omitempty"`
630+
631+
Spec ExternalNodeSpec `json:"spec,omitempty"`
632+
}
633+
634+
// ExternalNodeSpec defines the desired state for ExternalNode.
635+
type ExternalNodeSpec struct {
636+
// Only one network interface is supported now.
637+
// Other interfaces except interfaces[0] will be ignored if there are more than one interfaces.
638+
Interfaces []NetworkInterface `json:"interfaces,omitempty"`
639+
}
640+
641+
type NetworkInterface struct {
642+
Name string `json:"name,omitempty"`
643+
644+
IPs []string `json:"ips,omitempty"`
645+
}
646+
647+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
648+
649+
type ExternalNodeList struct {
650+
metav1.TypeMeta `json:",inline"`
651+
// +optional
652+
metav1.ListMeta `json:"metadata,omitempty"`
653+
654+
Items []ExternalNode `json:"items,omitempty"`
655+
}

0 commit comments

Comments
 (0)