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 committed Aug 8, 2022
1 parent 2a37aec commit c5537cb
Show file tree
Hide file tree
Showing 20 changed files with 952 additions and 4 deletions.
40 changes: 40 additions & 0 deletions build/charts/antrea/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 @@ -1267,6 +1267,48 @@ spec:
- eip

---
# Source: 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: crds/ippool.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down
40 changes: 40 additions & 0 deletions build/yamls/antrea-crds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,46 @@ spec:
---
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---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: ippools.crd.antrea.io
labels:
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 @@ -1267,6 +1267,48 @@ spec:
- eip

---
# Source: 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: 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 @@ -1267,6 +1267,48 @@ spec:
- eip

---
# Source: 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: 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 @@ -1267,6 +1267,48 @@ spec:
- eip

---
# Source: 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: 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 @@ -1267,6 +1267,48 @@ spec:
- eip

---
# Source: 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: 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 @@ -638,3 +638,38 @@ type IGMPProtocol struct {
IGMPType *int32 `json:"igmpType,omitempty"`
GroupAddress string `json:"groupAddress,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 c5537cb

Please sign in to comment.