-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add IPAddress and IPAddressClaim to exp api
- Loading branch information
Showing
13 changed files
with
1,155 additions
and
71 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.8.0 | ||
creationTimestamp: null | ||
name: ipaddressclaims.cluster.x-k8s.io | ||
spec: | ||
group: cluster.x-k8s.io | ||
names: | ||
categories: | ||
- cluster-api | ||
kind: IPAddressClaim | ||
listKind: IPAddressClaimList | ||
plural: ipaddressclaims | ||
singular: ipaddressclaim | ||
scope: Namespaced | ||
versions: | ||
- additionalPrinterColumns: | ||
- description: Pool the address is from | ||
jsonPath: .spec.pool.name | ||
name: Pool Name | ||
type: string | ||
- description: Pool the address is from | ||
jsonPath: .spec.pool.kind | ||
name: Pool Kind | ||
type: string | ||
name: v1beta1 | ||
schema: | ||
openAPIV3Schema: | ||
description: IPAddressClaim is the Schema for the ipaddressclaim 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: IPAddressClaimSpec is the desired state of an IPAddressClaim. | ||
properties: | ||
pool: | ||
description: PoolRef is a reference to the pool from which an IP address | ||
should be created. | ||
properties: | ||
apiGroup: | ||
description: APIGroup is the group for the resource being referenced. | ||
If APIGroup is not specified, the specified Kind must be in | ||
the core API group. For any other third-party types, APIGroup | ||
is required. | ||
type: string | ||
kind: | ||
description: Kind is the type of resource being referenced | ||
type: string | ||
name: | ||
description: Name is the name of resource being referenced | ||
type: string | ||
required: | ||
- kind | ||
- name | ||
type: object | ||
type: object | ||
status: | ||
description: IPAddressClaimStatus is the observed status of a IPAddressClaim. | ||
properties: | ||
address: | ||
description: AddressRef is a reference to the address that was created | ||
for this claim. | ||
properties: | ||
name: | ||
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names | ||
TODO: Add other useful fields. apiVersion, kind, uid?' | ||
type: string | ||
type: object | ||
conditions: | ||
description: Conditions summarises the current state of the IPAddressClaim | ||
items: | ||
description: Condition defines an observation of a Cluster API resource | ||
operational state. | ||
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: A human readable message indicating details about | ||
the transition. This field may be empty. | ||
type: string | ||
reason: | ||
description: The reason for the condition's last transition | ||
in CamelCase. The specific API may choose whether or not this | ||
field is considered a guaranteed API. This field may not be | ||
empty. | ||
type: string | ||
severity: | ||
description: Severity provides an explicit classification of | ||
Reason code, so the users or machines can immediately understand | ||
the current situation and act accordingly. The Severity field | ||
MUST be set only when Status=False. | ||
type: string | ||
status: | ||
description: Status of the condition, one of True, False, Unknown. | ||
type: string | ||
type: | ||
description: Type of condition in CamelCase or in foo.example.com/CamelCase. | ||
Many .condition.type values are consistent across resources | ||
like Available, but because arbitrary conditions can be useful | ||
(see .node.status.conditions), the ability to deconflict is | ||
important. | ||
type: string | ||
required: | ||
- lastTransitionTime | ||
- status | ||
- type | ||
type: object | ||
type: array | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} | ||
status: | ||
acceptedNames: | ||
kind: "" | ||
plural: "" | ||
conditions: [] | ||
storedVersions: [] |
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,107 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.8.0 | ||
creationTimestamp: null | ||
name: ipaddresses.cluster.x-k8s.io | ||
spec: | ||
group: cluster.x-k8s.io | ||
names: | ||
categories: | ||
- cluster-api | ||
kind: IPAddress | ||
listKind: IPAddressList | ||
plural: ipaddresses | ||
singular: ipaddress | ||
scope: Namespaced | ||
versions: | ||
- additionalPrinterColumns: | ||
- description: Pool the address is from | ||
jsonPath: .spec.pool.name | ||
name: Pool Name | ||
type: string | ||
- description: Pool the address is from | ||
jsonPath: .spec.pool.kind | ||
name: Pool Kind | ||
type: string | ||
- description: Address | ||
jsonPath: .spec.address | ||
name: Address | ||
type: string | ||
name: v1beta1 | ||
schema: | ||
openAPIV3Schema: | ||
description: IPAddress is the Schema for the ipaddress 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: IPAddressSpec is the desired state of an IPAddress. | ||
properties: | ||
address: | ||
description: Address is the IP address. | ||
type: string | ||
claim: | ||
description: ClaimRef is a reference to the claim this IPAddress was | ||
created for. | ||
properties: | ||
name: | ||
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names | ||
TODO: Add other useful fields. apiVersion, kind, uid?' | ||
type: string | ||
type: object | ||
gateway: | ||
description: Gateway is the network gateway of network the address | ||
is from. | ||
type: string | ||
pool: | ||
description: PoolRef is a reference to the pool that this IPAddress | ||
was created from. | ||
properties: | ||
apiGroup: | ||
description: APIGroup is the group for the resource being referenced. | ||
If APIGroup is not specified, the specified Kind must be in | ||
the core API group. For any other third-party types, APIGroup | ||
is required. | ||
type: string | ||
kind: | ||
description: Kind is the type of resource being referenced | ||
type: string | ||
name: | ||
description: Name is the name of resource being referenced | ||
type: string | ||
required: | ||
- kind | ||
- name | ||
type: object | ||
prefix: | ||
description: Prefix is the prefix of the address. | ||
type: integer | ||
required: | ||
- address | ||
- gateway | ||
- prefix | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} | ||
status: | ||
acceptedNames: | ||
kind: "" | ||
plural: "" | ||
conditions: [] | ||
storedVersions: [] |
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,118 @@ | ||
/* | ||
Copyright 2021 The Kubernetes Authors. | ||
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 v1beta1 | ||
|
||
import ( | ||
corev1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" | ||
) | ||
|
||
const ( | ||
// IPPoolLabel is used to add the pool name to an IPAddressClaim and IPAddress. | ||
IPPoolLabel = "ipam.cluster.x-k8s.io/pool" | ||
) | ||
|
||
// IPAddressSpec is the desired state of an IPAddress. | ||
type IPAddressSpec struct { | ||
// ClaimRef is a reference to the claim this IPAddress was created for. | ||
ClaimRef corev1.LocalObjectReference `json:"claim,omitempty"` | ||
|
||
// PoolRef is a reference to the pool that this IPAddress was created from. | ||
PoolRef corev1.TypedLocalObjectReference `json:"pool,omitempty"` | ||
|
||
// Address is the IP address. | ||
Address string `json:"address"` | ||
|
||
// Prefix is the prefix of the address. | ||
Prefix int `json:"prefix"` | ||
|
||
// Gateway is the network gateway of network the address is from. | ||
Gateway string `json:"gateway"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:resource:path=ipaddresses,scope=Namespaced,categories=cluster-api | ||
// +kubebuilder:subresource:status | ||
// +kubebuilder:storageversion | ||
// +kubebuilder:printcolumn:name="Pool Name",type="string",JSONPath=".spec.pool.name",description="Pool the address is from" | ||
// +kubebuilder:printcolumn:name="Pool Kind",type="string",JSONPath=".spec.pool.kind",description="Pool the address is from" | ||
// +kubebuilder:printcolumn:name="Address",type="string",JSONPath=".spec.address",description="Address" | ||
|
||
// IPAddress is the Schema for the ipaddress API. | ||
type IPAddress struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec IPAddressSpec `json:"spec,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// IPAddressList is a list of IPAddress. | ||
type IPAddressList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []IPAddress `json:"items"` | ||
} | ||
|
||
// IPAddressClaimSpec is the desired state of an IPAddressClaim. | ||
type IPAddressClaimSpec struct { | ||
// PoolRef is a reference to the pool from which an IP address should be created. | ||
PoolRef corev1.TypedLocalObjectReference `json:"pool,omitempty"` | ||
} | ||
|
||
// IPAddressClaimStatus is the observed status of a IPAddressClaim. | ||
type IPAddressClaimStatus struct { | ||
// AddressRef is a reference to the address that was created for this claim. | ||
AddressRef corev1.LocalObjectReference `json:"address,omitempty"` | ||
|
||
// Conditions summarises the current state of the IPAddressClaim | ||
// +optional | ||
Conditions clusterv1.Conditions `json:"conditions,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:resource:path=ipaddressclaims,scope=Namespaced,categories=cluster-api | ||
// +kubebuilder:subresource:status | ||
// +kubebuilder:storageversion | ||
// +kubebuilder:printcolumn:name="Pool Name",type="string",JSONPath=".spec.pool.name",description="Pool the address is from" | ||
// +kubebuilder:printcolumn:name="Pool Kind",type="string",JSONPath=".spec.pool.kind",description="Pool the address is from" | ||
|
||
// IPAddressClaim is the Schema for the ipaddressclaim API. | ||
type IPAddressClaim struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec IPAddressClaimSpec `json:"spec,omitempty"` | ||
Status IPAddressClaimStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// IPAddressClaimList is a list of IPAddressClaim. | ||
type IPAddressClaimList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []IPAddressClaim `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&IPAddress{}, &IPAddressList{}) | ||
SchemeBuilder.Register(&IPAddressClaim{}, &IPAddressClaimList{}) | ||
} |
Oops, something went wrong.