-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a new IPAddressUsage resource type which is used for an aggregated API server to get IPAddressUsage from the VPC that is associated with the VPC.
- Loading branch information
1 parent
00b052d
commit 31bbfd2
Showing
8 changed files
with
244 additions
and
4 deletions.
There are no files selected for viewing
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
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
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,7 @@ | ||
/* Copyright © 2024 Broadcom, Inc. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 */ | ||
|
||
// | ||
// +domain=vpc.nsx.vmware.com | ||
|
||
package apis |
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,8 @@ | ||
/* Copyright © 2024 Broadcom, Inc. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 */ | ||
|
||
// +k8s:openapi-gen=true | ||
// +k8s:deepcopy-gen=package,register | ||
// +k8s:defaulter-gen=TypeMeta | ||
// +groupName=vpc.nsx.vmware.com | ||
package v1alpha1 |
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,62 @@ | ||
/* Copyright © 2024 Broadcom, Inc. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 */ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
const ( | ||
External Visibility = "EXTERNAL" | ||
Project Visibility = "PROJECT" | ||
Private Visibility = "PRIVATE" | ||
) | ||
|
||
type Visibility string | ||
|
||
type IPAddress struct { | ||
Address string `json:"address,omitempty" protobuf:"bytes,1,opt,name=address"` | ||
Subnet string `json:"subnet,omitempty" protobuf:"bytes,2,opt,name=subnet"` | ||
} | ||
|
||
type AllocatedByVPC struct { | ||
Count int `json:"count,omitempty" protobuf:"bytes,1,opt,name=count"` | ||
IPAddresses []IPAddress `json:"ipAddresses,omitempty" protobuf:"bytes,2,opt,name=ipAddresses"` | ||
CIDR string `json:"cidr,omitempty" protobuf:"bytes,3,opt,name=cidr"` | ||
Visibility Visibility `json:"visibility,omitempty" protobuf:"bytes,4,opt,name=visibility"` | ||
} | ||
|
||
// IPBlock contains the used IPAddresses and CIDR. | ||
type IPBlock struct { | ||
Path string `json:"path,omitempty" protobuf:"bytes,1,rep,name=path"` | ||
Available int `json:"available,omitempty" protobuf:"bytes,2,rep,name=available"` | ||
// AllocatedByVPC contains the cidr and used IP Range. | ||
Allocated AllocatedByVPC `json:"allocatedByVpc,omitempty" protobuf:"bytes,3,rep,name=allocatedByVpc"` | ||
} | ||
|
||
// +genclient | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// IPAddressUsage | ||
// +k8s:openapi-gen=true | ||
// +genclient:Namespaced | ||
// +genclient:onlyVerbs=get | ||
type IPAddressUsage struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` | ||
|
||
IPBlocks []IPBlock `json:"ipBlocks" protobuf:"bytes,2,rep,name=ipBlocks"` | ||
} | ||
|
||
// IPAddressUsageList | ||
// +k8s:openapi-gen=true | ||
// +genclient:Namespaced | ||
// +genclient:onlyVerbs=get | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
type IPAddressUsageList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
|
||
Items []IPAddressUsage `json:"items"` | ||
} |
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,30 @@ | ||
/* Copyright © 2024 Broadcom, Inc. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 */ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
) | ||
|
||
const ( | ||
GroupName = "vpc.nsx.vmware.com" | ||
Version = "v1alpha1" | ||
ResourceName = "ipaddressusages" | ||
) | ||
|
||
var AddToScheme = func(scheme *runtime.Scheme) error { | ||
metav1.AddToGroupVersion(scheme, schema.GroupVersion{ | ||
Group: GroupName, | ||
Version: Version, | ||
}) | ||
// +kubebuilder:scaffold:install | ||
|
||
scheme.AddKnownTypes(schema.GroupVersion{ | ||
Group: GroupName, | ||
Version: Version, | ||
}, &IPAddressUsage{}, &IPAddressUsageList{}) | ||
return nil | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,7 @@ | ||
/* Copyright © 2024 Broadcom, Inc. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 */ | ||
|
||
// | ||
// +domain=vpc.nsx.vmware.com | ||
|
||
package apiserver |