-
Notifications
You must be signed in to change notification settings - Fork 260
NetworkConfig CRD defintions #570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0b52a89
5f89f93
af4803e
588e7e5
ec58366
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # Dependencies for generator | ||
| GOFILES = $(wildcard api/v1/*.go) | ||
|
|
||
| generate: $(GOFILES) controller-gen | ||
| controller-gen object:headerFile="boilerplate.go.txt" paths="./..." | ||
|
|
||
| .PHONY: controller-gen | ||
|
|
||
| controller-gen: | ||
| @(cd && GO111MODULE=on go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.3.0) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| /* | ||
|
|
||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| // Package v1alpha contains API Schema definitions for the acn v1alpha API group | ||
| // +kubebuilder:object:generate=true | ||
| // +groupName=acn.azure.com | ||
| package v1alpha | ||
|
|
||
| import ( | ||
| "k8s.io/apimachinery/pkg/runtime/schema" | ||
| "sigs.k8s.io/controller-runtime/pkg/scheme" | ||
| ) | ||
|
|
||
| var ( | ||
| // GroupVersion is group version used to register these objects | ||
| GroupVersion = schema.GroupVersion{Group: "acn.azure.com", Version: "v1alpha"} | ||
|
|
||
| // SchemeBuilder is used to add go types to the GroupVersionKind scheme | ||
| SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} | ||
|
|
||
| // AddToScheme adds the types in this group-version to the given scheme. | ||
| AddToScheme = SchemeBuilder.AddToScheme | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| /* | ||
|
|
||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package v1alpha | ||
|
|
||
| import ( | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| ) | ||
|
|
||
| // Important: Run "make" to regenerate code after modifying this file | ||
|
|
||
| // +kubebuilder:object:root=true | ||
|
|
||
| // NodeNetworkConfig is the Schema for the nodenetworkconfigs API | ||
| // +kubebuilder:resource:scope=Cluster | ||
| // +kubebuilder:subresource:status | ||
| type NodeNetworkConfig struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
|
||
| Spec NodeNetworkConfigSpec `json:"spec,omitempty"` | ||
| Status NodeNetworkConfigStatus `json:"status,omitempty"` | ||
| } | ||
|
|
||
| // +kubebuilder:object:root=true | ||
|
|
||
| // NodeNetworkConfigList contains a list of NetworkConfig | ||
| type NodeNetworkConfigList struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ListMeta `json:"metadata,omitempty"` | ||
| Items []NodeNetworkConfig `json:"items"` | ||
| } | ||
|
|
||
| // NodeNetworkConfigSpec defines the desired state of NetworkConfig | ||
| type NodeNetworkConfigSpec struct { | ||
| RequestedIPCount int64 `json:"requestedIPCount,omitempty"` | ||
| IPsNotInUse []string `json:"iPsNotInUse,omitempty"` | ||
| } | ||
|
|
||
| // NodeNetworkConfigStatus defines the observed state of NetworkConfig | ||
| type NodeNetworkConfigStatus struct { | ||
| BatchSize int64 `json:"batchSize,omitempty"` | ||
| ReleaseThresholdPercent int64 `json:"releaseThresholdPercent,omitempty"` | ||
| RequestThresholdPercent int64 `json:"requestThresholdPercent,omitempty"` | ||
| NetworkContainers []NetworkContainer `json:"networkContainers,omitempty"` | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we give an example if why we'd have multiple network containers on a single node? i
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When would a single node have different different primary ips and different subnets.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right now we are planning one NC per node and thus one primary IP and one subnet. However, this imposes a limit on the number of IPs, so we want to support multiple NCs in the future. It will be easier to add multi-NC support when we can support it on the other tooling if the CRD already supports it. |
||
| } | ||
|
|
||
| // NetworkContainer defines the structure of a Network Container as found in NetworkConfigStatus | ||
| type NetworkContainer struct { | ||
| ID string `json:"id,omitempty"` | ||
| PrimaryIP string `json:"primaryIP,omitempty"` | ||
| SubnetID string `json:"subnetID,omitempty"` | ||
| IPAssignments []IPAssignment `json:"iPAssignments,omitempty"` | ||
| DefaultGateway string `json:"defaultGateway,omitempty"` | ||
| // Netmask for the subnet represented by this NC's SubnetID | ||
| Netmask string `json:"netmask,omitempty"` | ||
| } | ||
|
|
||
| // IPAssignment groups an IP address and Name. Name is a UUID set by the the IP address assigner. | ||
| type IPAssignment struct { | ||
| Name string `json:"name,omitempty"` | ||
| IP string `json:"iP,omitempty"` | ||
| } | ||
|
|
||
| func init() { | ||
| SchemeBuilder.Register(&NodeNetworkConfig{}, &NodeNetworkConfigList{}) | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| /* | ||
|
|
||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move these batchSize, Release and Request threshold in some other struct for code readiblity? Also, In case we need to extend it, it wont change the main struct