Skip to content

Commit b6ded28

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 8a49504 commit b6ded28

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
@@ -1666,6 +1666,48 @@ spec:
16661666
shortNames:
16671667
- eip
16681668
---
1669+
# Source: antrea/templates/crds/externalnode.yaml
1670+
apiVersion: apiextensions.k8s.io/v1
1671+
kind: CustomResourceDefinition
1672+
metadata:
1673+
labels:
1674+
app: antrea
1675+
name: externalnodes.crd.antrea.io
1676+
spec:
1677+
group: crd.antrea.io
1678+
versions:
1679+
- name: v1alpha1
1680+
schema:
1681+
openAPIV3Schema:
1682+
type: object
1683+
properties:
1684+
spec:
1685+
type: object
1686+
properties:
1687+
interfaces:
1688+
type: array
1689+
items:
1690+
type: object
1691+
properties:
1692+
ips:
1693+
type: array
1694+
items:
1695+
type: string
1696+
oneOf:
1697+
- format: ipv4
1698+
- format: ipv6
1699+
name:
1700+
type: string
1701+
served: true
1702+
storage: true
1703+
scope: Namespaced
1704+
names:
1705+
kind: ExternalNode
1706+
plural: externalnodes
1707+
shortNames:
1708+
- en
1709+
singular: externalnode
1710+
---
16691711
# Source: antrea/templates/crds/ippool.yaml
16701712
apiVersion: apiextensions.k8s.io/v1
16711713
kind: CustomResourceDefinition

build/yamls/antrea-eks.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,6 +1666,48 @@ spec:
16661666
shortNames:
16671667
- eip
16681668
---
1669+
# Source: antrea/templates/crds/externalnode.yaml
1670+
apiVersion: apiextensions.k8s.io/v1
1671+
kind: CustomResourceDefinition
1672+
metadata:
1673+
labels:
1674+
app: antrea
1675+
name: externalnodes.crd.antrea.io
1676+
spec:
1677+
group: crd.antrea.io
1678+
versions:
1679+
- name: v1alpha1
1680+
schema:
1681+
openAPIV3Schema:
1682+
type: object
1683+
properties:
1684+
spec:
1685+
type: object
1686+
properties:
1687+
interfaces:
1688+
type: array
1689+
items:
1690+
type: object
1691+
properties:
1692+
ips:
1693+
type: array
1694+
items:
1695+
type: string
1696+
oneOf:
1697+
- format: ipv4
1698+
- format: ipv6
1699+
name:
1700+
type: string
1701+
served: true
1702+
storage: true
1703+
scope: Namespaced
1704+
names:
1705+
kind: ExternalNode
1706+
plural: externalnodes
1707+
shortNames:
1708+
- en
1709+
singular: externalnode
1710+
---
16691711
# Source: antrea/templates/crds/ippool.yaml
16701712
apiVersion: apiextensions.k8s.io/v1
16711713
kind: CustomResourceDefinition

build/yamls/antrea-gke.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,6 +1666,48 @@ spec:
16661666
shortNames:
16671667
- eip
16681668
---
1669+
# Source: antrea/templates/crds/externalnode.yaml
1670+
apiVersion: apiextensions.k8s.io/v1
1671+
kind: CustomResourceDefinition
1672+
metadata:
1673+
labels:
1674+
app: antrea
1675+
name: externalnodes.crd.antrea.io
1676+
spec:
1677+
group: crd.antrea.io
1678+
versions:
1679+
- name: v1alpha1
1680+
schema:
1681+
openAPIV3Schema:
1682+
type: object
1683+
properties:
1684+
spec:
1685+
type: object
1686+
properties:
1687+
interfaces:
1688+
type: array
1689+
items:
1690+
type: object
1691+
properties:
1692+
ips:
1693+
type: array
1694+
items:
1695+
type: string
1696+
oneOf:
1697+
- format: ipv4
1698+
- format: ipv6
1699+
name:
1700+
type: string
1701+
served: true
1702+
storage: true
1703+
scope: Namespaced
1704+
names:
1705+
kind: ExternalNode
1706+
plural: externalnodes
1707+
shortNames:
1708+
- en
1709+
singular: externalnode
1710+
---
16691711
# Source: antrea/templates/crds/ippool.yaml
16701712
apiVersion: apiextensions.k8s.io/v1
16711713
kind: CustomResourceDefinition

build/yamls/antrea-ipsec.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1679,6 +1679,48 @@ spec:
16791679
shortNames:
16801680
- eip
16811681
---
1682+
# Source: antrea/templates/crds/externalnode.yaml
1683+
apiVersion: apiextensions.k8s.io/v1
1684+
kind: CustomResourceDefinition
1685+
metadata:
1686+
labels:
1687+
app: antrea
1688+
name: externalnodes.crd.antrea.io
1689+
spec:
1690+
group: crd.antrea.io
1691+
versions:
1692+
- name: v1alpha1
1693+
schema:
1694+
openAPIV3Schema:
1695+
type: object
1696+
properties:
1697+
spec:
1698+
type: object
1699+
properties:
1700+
interfaces:
1701+
type: array
1702+
items:
1703+
type: object
1704+
properties:
1705+
ips:
1706+
type: array
1707+
items:
1708+
type: string
1709+
oneOf:
1710+
- format: ipv4
1711+
- format: ipv6
1712+
name:
1713+
type: string
1714+
served: true
1715+
storage: true
1716+
scope: Namespaced
1717+
names:
1718+
kind: ExternalNode
1719+
plural: externalnodes
1720+
shortNames:
1721+
- en
1722+
singular: externalnode
1723+
---
16821724
# Source: antrea/templates/crds/ippool.yaml
16831725
apiVersion: apiextensions.k8s.io/v1
16841726
kind: CustomResourceDefinition

build/yamls/antrea.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,6 +1666,48 @@ spec:
16661666
shortNames:
16671667
- eip
16681668
---
1669+
# Source: antrea/templates/crds/externalnode.yaml
1670+
apiVersion: apiextensions.k8s.io/v1
1671+
kind: CustomResourceDefinition
1672+
metadata:
1673+
labels:
1674+
app: antrea
1675+
name: externalnodes.crd.antrea.io
1676+
spec:
1677+
group: crd.antrea.io
1678+
versions:
1679+
- name: v1alpha1
1680+
schema:
1681+
openAPIV3Schema:
1682+
type: object
1683+
properties:
1684+
spec:
1685+
type: object
1686+
properties:
1687+
interfaces:
1688+
type: array
1689+
items:
1690+
type: object
1691+
properties:
1692+
ips:
1693+
type: array
1694+
items:
1695+
type: string
1696+
oneOf:
1697+
- format: ipv4
1698+
- format: ipv6
1699+
name:
1700+
type: string
1701+
served: true
1702+
storage: true
1703+
scope: Namespaced
1704+
names:
1705+
kind: ExternalNode
1706+
plural: externalnodes
1707+
shortNames:
1708+
- en
1709+
singular: externalnode
1710+
---
16691711
# Source: antrea/templates/crds/ippool.yaml
16701712
apiVersion: apiextensions.k8s.io/v1
16711713
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)