-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reserve nodenetwork CRD and tag it deprecated
- Loading branch information
Showing
13 changed files
with
1,169 additions
and
0 deletions.
There are no files selected for viewing
156 changes: 156 additions & 0 deletions
156
manifests/crds/network.harvesterhci.io_nodenetworks.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
{} | ||
creationTimestamp: null | ||
name: nodenetworks.network.harvesterhci.io | ||
spec: | ||
group: network.harvesterhci.io | ||
names: | ||
kind: NodeNetwork | ||
listKind: NodeNetworkList | ||
plural: nodenetworks | ||
shortNames: | ||
- nn | ||
- nns | ||
singular: nodenetwork | ||
scope: Cluster | ||
versions: | ||
- additionalPrinterColumns: | ||
- jsonPath: .spec.description | ||
name: DESCRIPTION | ||
type: string | ||
- jsonPath: .spec.nodeName | ||
name: NODENAME | ||
type: string | ||
- jsonPath: .spec.type | ||
name: TYPE | ||
type: string | ||
- jsonPath: .spec.nic | ||
name: NetworkInterface | ||
type: string | ||
deprecated: true | ||
name: v1beta1 | ||
schema: | ||
openAPIV3Schema: | ||
properties: | ||
apiVersion: | ||
description: 'APIVersion defines the versioned schema of this representation | ||
of an object. Servers should convert recognized schemas to the latest | ||
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' | ||
type: string | ||
kind: | ||
description: 'Kind is a string value representing the REST resource this | ||
object represents. Servers may infer this from the endpoint the client | ||
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
properties: | ||
description: | ||
type: string | ||
nic: | ||
type: string | ||
nodeName: | ||
type: string | ||
type: | ||
enum: | ||
- vlan | ||
type: string | ||
required: | ||
- nodeName | ||
type: object | ||
status: | ||
properties: | ||
conditions: | ||
items: | ||
properties: | ||
lastTransitionTime: | ||
description: Last time the condition transitioned from one status | ||
to another. | ||
type: string | ||
lastUpdateTime: | ||
description: The last time this condition was updated. | ||
type: string | ||
message: | ||
description: Human-readable message indicating details about | ||
last transition | ||
type: string | ||
reason: | ||
description: The reason for the condition's last transition. | ||
type: string | ||
status: | ||
description: Status of the condition, one of True, False, Unknown. | ||
type: string | ||
type: | ||
description: Type of the condition. | ||
type: string | ||
required: | ||
- status | ||
- type | ||
type: object | ||
type: array | ||
networkIDs: | ||
items: | ||
type: integer | ||
type: array | ||
networkLinkStatus: | ||
additionalProperties: | ||
properties: | ||
index: | ||
type: integer | ||
mac: | ||
type: string | ||
masterIndex: | ||
type: integer | ||
name: | ||
type: string | ||
promiscuous: | ||
type: boolean | ||
state: | ||
type: string | ||
type: | ||
type: string | ||
required: | ||
- name | ||
type: object | ||
type: object | ||
nics: | ||
items: | ||
properties: | ||
index: | ||
description: Index of the NIC | ||
type: integer | ||
masterIndex: | ||
description: Index of the NIC's master | ||
type: integer | ||
name: | ||
description: Name of the NIC | ||
type: string | ||
state: | ||
description: State of the NIC, up/down/unknown | ||
type: string | ||
type: | ||
description: Interface type of the NIC | ||
type: string | ||
usedByManagementNetwork: | ||
description: Specify whether used by management network or not | ||
type: boolean | ||
usedByVlanNetwork: | ||
description: Specify whether used by VLAN network or not | ||
type: boolean | ||
required: | ||
- index | ||
- name | ||
- state | ||
- type | ||
type: object | ||
type: array | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: {} |
114 changes: 114 additions & 0 deletions
114
pkg/apis/network.harvesterhci.io/v1beta1/nodenetwork.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
package v1beta1 | ||
|
||
import ( | ||
"github.com/rancher/wrangler/pkg/condition" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// NodeNetwork is deprecated from Harvester v1.1.0 and only keep it for upgrade compatibility purpose | ||
|
||
const GroupName = "network.harvesterhci.io" | ||
|
||
// +genclient | ||
// +genclient:nonNamespaced | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
// +kubebuilder:resource:shortName=nn;nns,scope=Cluster | ||
// +kubebuilder:deprecatedversion | ||
// +kubebuilder:printcolumn:name="DESCRIPTION",type=string,JSONPath=`.spec.description` | ||
// +kubebuilder:printcolumn:name="NODENAME",type=string,JSONPath=`.spec.nodeName` | ||
// +kubebuilder:printcolumn:name="TYPE",type=string,JSONPath=`.spec.type` | ||
// +kubebuilder:printcolumn:name="NetworkInterface",type=string,JSONPath=`.spec.nic` | ||
|
||
type NodeNetwork struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec NodeNetworkSpec `json:"spec,omitempty"` | ||
Status NodeNetworkStatus `json:"status,omitempty"` | ||
} | ||
|
||
type NodeNetworkSpec struct { | ||
// +optional | ||
Description string `json:"description,omitempty"` | ||
|
||
NodeName string `json:"nodeName"` | ||
|
||
// +kubebuilder:validation:Required | ||
Type NetworkType `json:"type,omitempty"` | ||
|
||
// +optional | ||
NetworkInterface string `json:"nic,omitempty"` | ||
} | ||
|
||
// +kubebuilder:validation:Enum=vlan | ||
type NetworkType string | ||
|
||
const ( | ||
NetworkTypeVLAN NetworkType = "vlan" | ||
) | ||
|
||
type NodeNetworkStatus struct { | ||
// +optional | ||
NetworkIDs []NetworkID `json:"networkIDs,omitempty"` | ||
|
||
// +optional | ||
NetworkLinkStatus map[string]*LinkStatus `json:"networkLinkStatus,omitempty"` | ||
|
||
// +optional | ||
NetworkInterfaces []NetworkInterface `json:"nics,omitempty"` | ||
|
||
// +optional | ||
Conditions []Condition `json:"conditions,omitempty"` | ||
} | ||
|
||
type NetworkInterface struct { | ||
// Index of the NIC | ||
Index int `json:"index"` | ||
// Index of the NIC's master | ||
MasterIndex int `json:"masterIndex,omitempty"` | ||
// Name of the NIC | ||
Name string `json:"name"` | ||
// Interface type of the NIC | ||
Type string `json:"type"` | ||
// State of the NIC, up/down/unknown | ||
State string `json:"state"` | ||
// Specify whether used by management network or not | ||
UsedByMgmtNetwork bool `json:"usedByManagementNetwork,omitempty"` | ||
// Specify whether used by VLAN network or not | ||
UsedByVlanNetwork bool `json:"usedByVlanNetwork,omitempty"` | ||
} | ||
|
||
type NetworkID int | ||
|
||
type NodeNetworkLinkStatus struct { | ||
// +optional | ||
Index int `json:"index,omitempty"` | ||
|
||
// +optional | ||
Type string `json:"type,omitempty"` | ||
|
||
// +optional | ||
MAC string `json:"mac,omitempty"` | ||
|
||
// +optional | ||
Promiscuous bool `json:"promiscuous,omitempty"` | ||
|
||
// +optional | ||
State string `json:"state,omitempty"` | ||
|
||
// +optional | ||
IPV4Address []string `json:"ipv4Address,omitempty"` | ||
|
||
// +optional | ||
MasterIndex int `json:"masterIndex,omitempty"` | ||
|
||
// +optional | ||
Routes []string `json:"routes,omitempty"` | ||
|
||
// +optional | ||
Conditions []Condition `json:"conditions,omitempty"` | ||
} | ||
|
||
var ( | ||
NodeNetworkReady condition.Cond = "Ready" | ||
) |
Oops, something went wrong.