Skip to content

Commit

Permalink
[ExternalNode] Add ExternalNode CRD (antrea-io#3639)
Browse files Browse the repository at this point in the history
This change adds API definition for ExternalNode CRD
and generates the corresponding client and yaml files.

Signed-off-by: Mengdie Song <songm@vmware.com>
  • Loading branch information
mengdie-song authored and wenyingd committed May 20, 2022
1 parent 052ddb8 commit 631c3b9
Show file tree
Hide file tree
Showing 19 changed files with 912 additions and 4 deletions.
40 changes: 40 additions & 0 deletions build/charts/antrea/templates/crds/externalnode.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
labels:
app: antrea
name: externalnodes.crd.antrea.io
spec:
group: crd.antrea.io
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
interfaces:
type: array
items:
type: object
properties:
ips:
type: array
items:
type: string
oneOf:
- format: ipv4
- format: ipv6
name:
type: string
served: true
storage: true
scope: Namespaced
names:
kind: ExternalNode
plural: externalnodes
shortNames:
- en
singular: externalnode
42 changes: 42 additions & 0 deletions build/yamls/antrea-aks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1628,6 +1628,48 @@ spec:
shortNames:
- eip
---
# Source: antrea/templates/crds/externalnode.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
labels:
app: antrea
name: externalnodes.crd.antrea.io
spec:
group: crd.antrea.io
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
interfaces:
type: array
items:
type: object
properties:
ips:
type: array
items:
type: string
oneOf:
- format: ipv4
- format: ipv6
name:
type: string
served: true
storage: true
scope: Namespaced
names:
kind: ExternalNode
plural: externalnodes
shortNames:
- en
singular: externalnode
---
# Source: antrea/templates/crds/ippool.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down
42 changes: 42 additions & 0 deletions build/yamls/antrea-eks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1628,6 +1628,48 @@ spec:
shortNames:
- eip
---
# Source: antrea/templates/crds/externalnode.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
labels:
app: antrea
name: externalnodes.crd.antrea.io
spec:
group: crd.antrea.io
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
interfaces:
type: array
items:
type: object
properties:
ips:
type: array
items:
type: string
oneOf:
- format: ipv4
- format: ipv6
name:
type: string
served: true
storage: true
scope: Namespaced
names:
kind: ExternalNode
plural: externalnodes
shortNames:
- en
singular: externalnode
---
# Source: antrea/templates/crds/ippool.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down
42 changes: 42 additions & 0 deletions build/yamls/antrea-gke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1628,6 +1628,48 @@ spec:
shortNames:
- eip
---
# Source: antrea/templates/crds/externalnode.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
labels:
app: antrea
name: externalnodes.crd.antrea.io
spec:
group: crd.antrea.io
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
interfaces:
type: array
items:
type: object
properties:
ips:
type: array
items:
type: string
oneOf:
- format: ipv4
- format: ipv6
name:
type: string
served: true
storage: true
scope: Namespaced
names:
kind: ExternalNode
plural: externalnodes
shortNames:
- en
singular: externalnode
---
# Source: antrea/templates/crds/ippool.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down
42 changes: 42 additions & 0 deletions build/yamls/antrea-ipsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1641,6 +1641,48 @@ spec:
shortNames:
- eip
---
# Source: antrea/templates/crds/externalnode.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
labels:
app: antrea
name: externalnodes.crd.antrea.io
spec:
group: crd.antrea.io
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
interfaces:
type: array
items:
type: object
properties:
ips:
type: array
items:
type: string
oneOf:
- format: ipv4
- format: ipv6
name:
type: string
served: true
storage: true
scope: Namespaced
names:
kind: ExternalNode
plural: externalnodes
shortNames:
- en
singular: externalnode
---
# Source: antrea/templates/crds/ippool.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down
42 changes: 42 additions & 0 deletions build/yamls/antrea.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1628,6 +1628,48 @@ spec:
shortNames:
- eip
---
# Source: antrea/templates/crds/externalnode.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
labels:
app: antrea
name: externalnodes.crd.antrea.io
spec:
group: crd.antrea.io
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
interfaces:
type: array
items:
type: object
properties:
ips:
type: array
items:
type: string
oneOf:
- format: ipv4
- format: ipv6
name:
type: string
served: true
storage: true
scope: Namespaced
names:
kind: ExternalNode
plural: externalnodes
shortNames:
- en
singular: externalnode
---
# Source: antrea/templates/crds/ippool.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/crd/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&ClusterNetworkPolicyList{},
&Tier{},
&TierList{},
&ExternalNode{},
&ExternalNodeList{},
)

metav1.AddToGroupVersion(
Expand Down
35 changes: 35 additions & 0 deletions pkg/apis/crd/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -618,3 +618,38 @@ type ICMPProtocol struct {
ICMPType *int32 `json:"icmpType,omitempty"`
ICMPCode *int32 `json:"icmpCode,omitempty"`
}

// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// ExternalNode refers to a virtual machine or a bare-metal server
// which is not a K8s node, but has Antrea agent running on it.
type ExternalNode struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ExternalNodeSpec `json:"spec,omitempty"`
}

// ExternalNodeSpec defines the desired state for ExternalNode.
type ExternalNodeSpec struct {
// Only one network interface is supported now.
// Other interfaces except interfaces[0] will be ignored if there are more than one interfaces.
Interfaces []NetworkInterface `json:"interfaces,omitempty"`
}

type NetworkInterface struct {
Name string `json:"name,omitempty"`

IPs []string `json:"ips,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

type ExternalNodeList struct {
metav1.TypeMeta `json:",inline"`
// +optional
metav1.ListMeta `json:"metadata,omitempty"`

Items []ExternalNode `json:"items,omitempty"`
}
Loading

0 comments on commit 631c3b9

Please sign in to comment.