-
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.
- Loading branch information
1 parent
0f5d43f
commit 88c62e3
Showing
29 changed files
with
2,545 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.7.0 | ||
creationTimestamp: null | ||
name: ippools.nsx.vmware.com | ||
spec: | ||
group: nsx.vmware.com | ||
names: | ||
kind: IPPool | ||
listKind: IPPoolList | ||
plural: ippools | ||
singular: ippool | ||
scope: Namespaced | ||
versions: | ||
- name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
properties: | ||
spec: | ||
properties: | ||
subnets: | ||
items: | ||
properties: | ||
ipFamily: | ||
pattern: ^ipv(4|6)$ | ||
type: string | ||
name: | ||
type: string | ||
prefixLength: | ||
minimum: 1 | ||
type: integer | ||
type: object | ||
type: array | ||
type: object | ||
type: object | ||
x-kubernetes-preserve-unknown-fields: true | ||
served: true | ||
storage: false | ||
- name: v1alpha2 | ||
schema: | ||
openAPIV3Schema: | ||
description: IPPool is the Schema for the ippools API | ||
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: | ||
description: IPPoolSpec defines the desired state of IPPool. | ||
properties: | ||
subnets: | ||
description: Subnets defines set of subnets need to be allocated. | ||
items: | ||
description: SubnetRequest defines the subnet allocation request. | ||
properties: | ||
ipFamily: | ||
default: IPv4 | ||
description: IPFamily defines the IP family type for this subnet, | ||
could be IPv4 or IPv6. This is optional, the default is IPv4. | ||
enum: | ||
- IPv4 | ||
- IPv6 | ||
type: string | ||
name: | ||
description: Name defines the name of this subnet. | ||
type: string | ||
prefixLength: | ||
description: PrefixLength defines prefix length for this subnet. | ||
type: integer | ||
required: | ||
- name | ||
type: object | ||
type: array | ||
type: | ||
default: public | ||
description: Type defines the type of this IPPool, public or private. | ||
enum: | ||
- public | ||
- private | ||
type: string | ||
required: | ||
- type | ||
type: object | ||
status: | ||
description: IPPoolStatus defines the observed state of IPPool. | ||
properties: | ||
conditions: | ||
description: Conditions defines current state of the IPPool. | ||
items: | ||
description: Condition defines condition of custom resource. | ||
properties: | ||
lastTransitionTime: | ||
description: Last time the condition transitioned from one status | ||
to another. This should be when the underlying condition changed. | ||
If that is not known, then using the time when the API field | ||
changed is acceptable. | ||
format: date-time | ||
type: string | ||
message: | ||
description: Message shows a human-readable message about condition. | ||
type: string | ||
reason: | ||
description: Reason shows a brief reason of condition. | ||
type: string | ||
status: | ||
description: Status of the condition, one of True, False, Unknown. | ||
type: string | ||
type: | ||
description: Type defines condition type. | ||
type: string | ||
required: | ||
- status | ||
- type | ||
type: object | ||
type: array | ||
subnets: | ||
description: Subnets defines subnets allocation result. | ||
items: | ||
description: SubnetResult defines the subnet allocation result. | ||
properties: | ||
cidr: | ||
description: CIDR defines the allocated CIDR. | ||
type: string | ||
name: | ||
description: Name defines the name of this subnet. | ||
type: string | ||
required: | ||
- cidr | ||
- name | ||
type: object | ||
type: array | ||
required: | ||
- conditions | ||
- subnets | ||
type: object | ||
required: | ||
- metadata | ||
- spec | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} | ||
status: | ||
acceptedNames: | ||
kind: "" | ||
plural: "" | ||
conditions: [] | ||
storedVersions: ["v1alpha2"] |
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,23 @@ | ||
/* Copyright © 2022 VMware, Inc. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 */ | ||
|
||
// Package v1alpha2 contains API Schema definitions for the v1alpha2 API group | ||
//+kubebuilder:object:generate=true | ||
//+groupName=nsx.vmware.com | ||
package v1alpha2 | ||
|
||
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: "nsx.vmware.com", Version: "v1alpha2"} | ||
|
||
// 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 | ||
) |
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,79 @@ | ||
/* Copyright © 2022 VMware, Inc. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 */ | ||
|
||
package v1alpha2 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
"github.com/vmware-tanzu/nsx-operator/pkg/apis/v1alpha1" | ||
) | ||
|
||
//+kubebuilder:object:root=true | ||
//+kubebuilder:subresource:status | ||
|
||
// IPPool is the Schema for the ippools API | ||
type IPPool struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata"` | ||
|
||
Spec IPPoolSpec `json:"spec"` | ||
Status IPPoolStatus `json:"status,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// IPPoolList contains a list of IPPool | ||
type IPPoolList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []IPPool `json:"items"` | ||
} | ||
|
||
// IPPoolSpec defines the desired state of IPPool. | ||
type IPPoolSpec struct { | ||
// Type defines the type of this IPPool, public or private. | ||
// +kubebuilder:validation:Enum=public;private | ||
// +kubebuilder:default=public | ||
Type string `json:"type"` | ||
// Subnets defines set of subnets need to be allocated. | ||
// +optional | ||
Subnets []SubnetRequest `json:"subnets"` | ||
} | ||
|
||
// IPPoolStatus defines the observed state of IPPool. | ||
type IPPoolStatus struct { | ||
// Subnets defines subnets allocation result. | ||
Subnets []SubnetResult `json:"subnets"` | ||
// Conditions defines current state of the IPPool. | ||
Conditions []v1alpha1.Condition `json:"conditions"` | ||
} | ||
|
||
// SubnetRequest defines the subnet allocation request. | ||
type SubnetRequest struct { | ||
// PrefixLength defines prefix length for this subnet. | ||
// +optional | ||
PrefixLength int `json:"prefixLength,omitempty"` | ||
|
||
// IPFamily defines the IP family type for this subnet, could be IPv4 or IPv6. | ||
// This is optional, the default is IPv4. | ||
// +kubebuilder:validation:Enum=IPv4;IPv6 | ||
// +kubebuilder:default=IPv4 | ||
IPFamily string `json:"ipFamily,omitempty"` | ||
|
||
// Name defines the name of this subnet. | ||
Name string `json:"name"` | ||
} | ||
|
||
// SubnetResult defines the subnet allocation result. | ||
type SubnetResult struct { | ||
// CIDR defines the allocated CIDR. | ||
CIDR string `json:"cidr"` | ||
|
||
// Name defines the name of this subnet. | ||
Name string `json:"name"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&IPPool{}, &IPPoolList{}) | ||
} |
Oops, something went wrong.