Skip to content

Commit 2b3fb5c

Browse files
committed
[ExternalNode] Add ExternalNode CRD
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 03b3f2b commit 2b3fb5c

19 files changed

Lines changed: 909 additions & 6 deletions

File tree

build/yamls/antrea-aks.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,47 @@ spec:
12001200
---
12011201
apiVersion: apiextensions.k8s.io/v1
12021202
kind: CustomResourceDefinition
1203+
metadata:
1204+
labels:
1205+
app: antrea
1206+
name: externalnodes.crd.antrea.io
1207+
spec:
1208+
group: crd.antrea.io
1209+
names:
1210+
kind: ExternalNode
1211+
plural: externalnodes
1212+
shortNames:
1213+
- en
1214+
singular: externalnode
1215+
scope: Namespaced
1216+
versions:
1217+
- name: v1alpha1
1218+
schema:
1219+
openAPIV3Schema:
1220+
properties:
1221+
spec:
1222+
properties:
1223+
interfaces:
1224+
items:
1225+
properties:
1226+
ips:
1227+
items:
1228+
oneOf:
1229+
- format: ipv4
1230+
- format: ipv6
1231+
type: string
1232+
type: array
1233+
name:
1234+
type: string
1235+
type: object
1236+
type: array
1237+
type: object
1238+
type: object
1239+
served: true
1240+
storage: true
1241+
---
1242+
apiVersion: apiextensions.k8s.io/v1
1243+
kind: CustomResourceDefinition
12031244
metadata:
12041245
labels:
12051246
app: antrea

build/yamls/antrea-eks.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,47 @@ spec:
12001200
---
12011201
apiVersion: apiextensions.k8s.io/v1
12021202
kind: CustomResourceDefinition
1203+
metadata:
1204+
labels:
1205+
app: antrea
1206+
name: externalnodes.crd.antrea.io
1207+
spec:
1208+
group: crd.antrea.io
1209+
names:
1210+
kind: ExternalNode
1211+
plural: externalnodes
1212+
shortNames:
1213+
- en
1214+
singular: externalnode
1215+
scope: Namespaced
1216+
versions:
1217+
- name: v1alpha1
1218+
schema:
1219+
openAPIV3Schema:
1220+
properties:
1221+
spec:
1222+
properties:
1223+
interfaces:
1224+
items:
1225+
properties:
1226+
ips:
1227+
items:
1228+
oneOf:
1229+
- format: ipv4
1230+
- format: ipv6
1231+
type: string
1232+
type: array
1233+
name:
1234+
type: string
1235+
type: object
1236+
type: array
1237+
type: object
1238+
type: object
1239+
served: true
1240+
storage: true
1241+
---
1242+
apiVersion: apiextensions.k8s.io/v1
1243+
kind: CustomResourceDefinition
12031244
metadata:
12041245
labels:
12051246
app: antrea

build/yamls/antrea-gke.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,47 @@ spec:
12001200
---
12011201
apiVersion: apiextensions.k8s.io/v1
12021202
kind: CustomResourceDefinition
1203+
metadata:
1204+
labels:
1205+
app: antrea
1206+
name: externalnodes.crd.antrea.io
1207+
spec:
1208+
group: crd.antrea.io
1209+
names:
1210+
kind: ExternalNode
1211+
plural: externalnodes
1212+
shortNames:
1213+
- en
1214+
singular: externalnode
1215+
scope: Namespaced
1216+
versions:
1217+
- name: v1alpha1
1218+
schema:
1219+
openAPIV3Schema:
1220+
properties:
1221+
spec:
1222+
properties:
1223+
interfaces:
1224+
items:
1225+
properties:
1226+
ips:
1227+
items:
1228+
oneOf:
1229+
- format: ipv4
1230+
- format: ipv6
1231+
type: string
1232+
type: array
1233+
name:
1234+
type: string
1235+
type: object
1236+
type: array
1237+
type: object
1238+
type: object
1239+
served: true
1240+
storage: true
1241+
---
1242+
apiVersion: apiextensions.k8s.io/v1
1243+
kind: CustomResourceDefinition
12031244
metadata:
12041245
labels:
12051246
app: antrea

build/yamls/antrea-ipsec.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,47 @@ spec:
12001200
---
12011201
apiVersion: apiextensions.k8s.io/v1
12021202
kind: CustomResourceDefinition
1203+
metadata:
1204+
labels:
1205+
app: antrea
1206+
name: externalnodes.crd.antrea.io
1207+
spec:
1208+
group: crd.antrea.io
1209+
names:
1210+
kind: ExternalNode
1211+
plural: externalnodes
1212+
shortNames:
1213+
- en
1214+
singular: externalnode
1215+
scope: Namespaced
1216+
versions:
1217+
- name: v1alpha1
1218+
schema:
1219+
openAPIV3Schema:
1220+
properties:
1221+
spec:
1222+
properties:
1223+
interfaces:
1224+
items:
1225+
properties:
1226+
ips:
1227+
items:
1228+
oneOf:
1229+
- format: ipv4
1230+
- format: ipv6
1231+
type: string
1232+
type: array
1233+
name:
1234+
type: string
1235+
type: object
1236+
type: array
1237+
type: object
1238+
type: object
1239+
served: true
1240+
storage: true
1241+
---
1242+
apiVersion: apiextensions.k8s.io/v1
1243+
kind: CustomResourceDefinition
12031244
metadata:
12041245
labels:
12051246
app: antrea

build/yamls/antrea.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,47 @@ spec:
12001200
---
12011201
apiVersion: apiextensions.k8s.io/v1
12021202
kind: CustomResourceDefinition
1203+
metadata:
1204+
labels:
1205+
app: antrea
1206+
name: externalnodes.crd.antrea.io
1207+
spec:
1208+
group: crd.antrea.io
1209+
names:
1210+
kind: ExternalNode
1211+
plural: externalnodes
1212+
shortNames:
1213+
- en
1214+
singular: externalnode
1215+
scope: Namespaced
1216+
versions:
1217+
- name: v1alpha1
1218+
schema:
1219+
openAPIV3Schema:
1220+
properties:
1221+
spec:
1222+
properties:
1223+
interfaces:
1224+
items:
1225+
properties:
1226+
ips:
1227+
items:
1228+
oneOf:
1229+
- format: ipv4
1230+
- format: ipv6
1231+
type: string
1232+
type: array
1233+
name:
1234+
type: string
1235+
type: object
1236+
type: array
1237+
type: object
1238+
type: object
1239+
served: true
1240+
storage: true
1241+
---
1242+
apiVersion: apiextensions.k8s.io/v1
1243+
kind: CustomResourceDefinition
12031244
metadata:
12041245
labels:
12051246
app: antrea

build/yamls/base/crds.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2014,3 +2014,44 @@ spec:
20142014
shortNames:
20152015
- cg
20162016
---
2017+
apiVersion: apiextensions.k8s.io/v1
2018+
kind: CustomResourceDefinition
2019+
metadata:
2020+
labels:
2021+
app: antrea
2022+
name: externalnodes.crd.antrea.io
2023+
spec:
2024+
group: crd.antrea.io
2025+
names:
2026+
kind: ExternalNode
2027+
plural: externalnodes
2028+
shortNames:
2029+
- en
2030+
singular: externalnode
2031+
scope: Namespaced
2032+
versions:
2033+
- name: v1alpha1
2034+
schema:
2035+
openAPIV3Schema:
2036+
type: object
2037+
properties:
2038+
spec:
2039+
type: object
2040+
properties:
2041+
interfaces:
2042+
type: array
2043+
items:
2044+
type: object
2045+
properties:
2046+
ips:
2047+
type: array
2048+
items:
2049+
type: string
2050+
oneOf:
2051+
- format: ipv4
2052+
- format: ipv6
2053+
name:
2054+
type: string
2055+
served: true
2056+
storage: true
2057+
---

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: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,3 +600,37 @@ type NamespacedName struct {
600600
Name string `json:"name,omitempty"`
601601
Namespace string `json:"namespace,omitempty"`
602602
}
603+
604+
// +genclient
605+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
606+
607+
// ExternalNode refers to a virtual machine which is not a K8s node, but has Antrea agent running on it.
608+
type ExternalNode struct {
609+
metav1.TypeMeta `json:",inline"`
610+
metav1.ObjectMeta `json:"metadata,omitempty"`
611+
612+
Spec ExternalNodeSpec `json:"spec,omitempty"`
613+
}
614+
615+
// ExternalNodeSpec defines the desired state for ExternalNode.
616+
type ExternalNodeSpec struct {
617+
// Only one network interface is supported now.
618+
// Other interfaces except interfaces[0] will be ignored if there are more than one interfaces.
619+
Interfaces []NetworkInterface `json:"interfaces,omitempty"`
620+
}
621+
622+
type NetworkInterface struct {
623+
Name string `json:"name,omitempty"`
624+
625+
IPs []string `json:"ips,omitempty"`
626+
}
627+
628+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
629+
630+
type ExternalNodeList struct {
631+
metav1.TypeMeta `json:",inline"`
632+
// +optional
633+
metav1.ListMeta `json:"metadata,omitempty"`
634+
635+
Items []ExternalNode `json:"items,omitempty"`
636+
}

0 commit comments

Comments
 (0)