|
| 1 | +/* |
| 2 | +
|
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +package v1alpha |
| 18 | + |
| 19 | +import ( |
| 20 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 21 | +) |
| 22 | + |
| 23 | +// Important: Run "make" to regenerate code after modifying this file |
| 24 | + |
| 25 | +// +kubebuilder:object:root=true |
| 26 | + |
| 27 | +// NodeNetworkConfig is the Schema for the nodenetworkconfigs API |
| 28 | +// +kubebuilder:resource:scope=Cluster |
| 29 | +// +kubebuilder:subresource:status |
| 30 | +type NodeNetworkConfig struct { |
| 31 | + metav1.TypeMeta `json:",inline"` |
| 32 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 33 | + |
| 34 | + Spec NodeNetworkConfigSpec `json:"spec,omitempty"` |
| 35 | + Status NodeNetworkConfigStatus `json:"status,omitempty"` |
| 36 | +} |
| 37 | + |
| 38 | +// +kubebuilder:object:root=true |
| 39 | + |
| 40 | +// NodeNetworkConfigList contains a list of NetworkConfig |
| 41 | +type NodeNetworkConfigList struct { |
| 42 | + metav1.TypeMeta `json:",inline"` |
| 43 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 44 | + Items []NodeNetworkConfig `json:"items"` |
| 45 | +} |
| 46 | + |
| 47 | +// NodeNetworkConfigSpec defines the desired state of NetworkConfig |
| 48 | +type NodeNetworkConfigSpec struct { |
| 49 | + RequestedIPCount int64 `json:"requestedIPCount,omitempty"` |
| 50 | + IPsNotInUse []string `json:"iPsNotInUse,omitempty"` |
| 51 | +} |
| 52 | + |
| 53 | +// NodeNetworkConfigStatus defines the observed state of NetworkConfig |
| 54 | +type NodeNetworkConfigStatus struct { |
| 55 | + BatchSize int64 `json:"batchSize,omitempty"` |
| 56 | + ReleaseThresholdPercent int64 `json:"releaseThresholdPercent,omitempty"` |
| 57 | + RequestThresholdPercent int64 `json:"requestThresholdPercent,omitempty"` |
| 58 | + NetworkContainers []NetworkContainer `json:"networkContainers,omitempty"` |
| 59 | +} |
| 60 | + |
| 61 | +// NetworkContainer defines the structure of a Network Container as found in NetworkConfigStatus |
| 62 | +type NetworkContainer struct { |
| 63 | + ID string `json:"id,omitempty"` |
| 64 | + PrimaryIP string `json:"primaryIP,omitempty"` |
| 65 | + SubnetID string `json:"subnetID,omitempty"` |
| 66 | + IPAssignments []IPAssignment `json:"iPAssignments,omitempty"` |
| 67 | + DefaultGateway string `json:"defaultGateway,omitempty"` |
| 68 | + // Netmask for the subnet represented by this NC's SubnetID |
| 69 | + Netmask string `json:"netmask,omitempty"` |
| 70 | +} |
| 71 | + |
| 72 | +// IPAssignment groups an IP address and Name. Name is a UUID set by the the IP address assigner. |
| 73 | +type IPAssignment struct { |
| 74 | + Name string `json:"name,omitempty"` |
| 75 | + IP string `json:"iP,omitempty"` |
| 76 | +} |
| 77 | + |
| 78 | +func init() { |
| 79 | + SchemeBuilder.Register(&NodeNetworkConfig{}, &NodeNetworkConfigList{}) |
| 80 | +} |
0 commit comments