Skip to content
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

✨ Add IPAddress and IPAddressClaim CRs to Experimental API #6313

Merged
merged 1 commit into from
Jul 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ generate-manifests-core: $(CONTROLLER_GEN) $(KUSTOMIZE) ## Generate manifests e.
paths=./$(EXP_DIR)/internal/controllers/... \
paths=./$(EXP_DIR)/addons/api/... \
paths=./$(EXP_DIR)/addons/internal/controllers/... \
paths=./$(EXP_DIR)/ipam/api/... \
paths=./$(EXP_DIR)/ipam/internal/webhooks/... \
paths=./$(EXP_DIR)/runtime/api/... \
paths=./$(EXP_DIR)/runtime/internal/controllers/... \
crd:crdVersions=v1 \
Expand Down Expand Up @@ -288,6 +290,7 @@ generate-go-deepcopy-core: $(CONTROLLER_GEN) ## Generate deepcopy go code for co
paths=./api/... \
paths=./$(EXP_DIR)/api/... \
paths=./$(EXP_DIR)/addons/api/... \
paths=./$(EXP_DIR)/ipam/api/... \
paths=./$(EXP_DIR)/runtime/api/... \
paths=./$(EXP_DIR)/runtime/hooks/api/... \
paths=./internal/runtime/test/... \
Expand Down
137 changes: 137 additions & 0 deletions config/crd/bases/ipam.cluster.x-k8s.io_ipaddressclaims.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.1
creationTimestamp: null
name: ipaddressclaims.ipam.cluster.x-k8s.io
spec:
group: ipam.cluster.x-k8s.io
names:
categories:
- cluster-api
kind: IPAddressClaim
listKind: IPAddressClaimList
plural: ipaddressclaims
singular: ipaddressclaim
scope: Namespaced
versions:
- additionalPrinterColumns:
- description: Name of the pool to allocate an address from
jsonPath: .spec.poolRef.name
name: Pool Name
type: string
- description: Kind of the pool to allocate an address from
jsonPath: .spec.poolRef.kind
name: Pool Kind
type: string
name: v1alpha1
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:
poolRef:
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:
- apiGroup
- kind
- name
type: object
required:
- poolRef
type: object
status:
description: IPAddressClaimStatus is the observed status of a IPAddressClaim.
properties:
addressRef:
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
required:
- addressRef
type: object
type: object
served: true
storage: true
subresources:
status: {}
103 changes: 103 additions & 0 deletions config/crd/bases/ipam.cluster.x-k8s.io_ipaddresses.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.1
creationTimestamp: null
name: ipaddresses.ipam.cluster.x-k8s.io
spec:
group: ipam.cluster.x-k8s.io
names:
categories:
- cluster-api
kind: IPAddress
listKind: IPAddressList
plural: ipaddresses
singular: ipaddress
scope: Namespaced
versions:
- additionalPrinterColumns:
- description: Address
jsonPath: .spec.address
name: Address
type: string
- description: Name of the pool the address is from
jsonPath: .spec.poolRef.name
name: Pool Name
type: string
- description: Kind of the pool the address is from
jsonPath: .spec.poolRef.kind
name: Pool Kind
type: string
name: v1alpha1
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
claimRef:
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 the network the address
is from.
type: string
poolRef:
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:
- apiGroup
- kind
- name
type: object
prefix:
description: Prefix is the prefix of the address.
type: integer
required:
- address
- claimRef
- gateway
- poolRef
- prefix
type: object
type: object
served: true
storage: true
subresources: {}
2 changes: 2 additions & 0 deletions config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ resources:
- bases/addons.cluster.x-k8s.io_clusterresourcesetbindings.yaml
- bases/cluster.x-k8s.io_machinehealthchecks.yaml
- bases/runtime.cluster.x-k8s.io_extensionconfigs.yaml
- bases/ipam.cluster.x-k8s.io_ipaddresses.yaml
- bases/ipam.cluster.x-k8s.io_ipaddressclaims.yaml
# +kubebuilder:scaffold:crdkustomizeresource

patchesStrategicMerge:
Expand Down
8 changes: 8 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,14 @@ rules:
- list
- patch
- watch
- apiGroups:
- ipam.cluster.x-k8s.io
resources:
- ipaddressclaims
verbs:
- get
- list
- watch
- apiGroups:
- runtime.cluster.x-k8s.io
resources:
Expand Down
46 changes: 46 additions & 0 deletions config/webhook/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -410,3 +410,49 @@ webhooks:
resources:
- clusterresourcesets
sideEffects: None
- admissionReviewVersions:
- v1
- v1beta1
clientConfig:
service:
name: webhook-service
namespace: system
path: /validate-ipam-cluster-x-k8s-io-v1alpha1-ipaddress
failurePolicy: Fail
matchPolicy: Equivalent
name: validation.ipaddress.ipam.cluster.x-k8s.io
rules:
- apiGroups:
- ipam.cluster.x-k8s.io
apiVersions:
- v1alpha1
operations:
- CREATE
- UPDATE
- DELETE
resources:
- ipaddresses
sideEffects: None
- admissionReviewVersions:
- v1
- v1beta1
clientConfig:
service:
name: webhook-service
namespace: system
path: /validate-ipam-cluster-x-k8s-io-v1alpha1-ipaddressclaim
failurePolicy: Fail
matchPolicy: Equivalent
name: validation.ipaddressclaim.ipam.cluster.x-k8s.io
rules:
- apiGroups:
- ipam.cluster.x-k8s.io
apiVersions:
- v1alpha1
operations:
- CREATE
- UPDATE
- DELETE
resources:
- ipaddressclaims
sideEffects: None
1 change: 1 addition & 0 deletions exp/api/v1beta1/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// Package v1beta1 contains experimental v1beta1 API implementation.
package v1beta1
18 changes: 18 additions & 0 deletions exp/ipam/api/v1alpha1/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
Copyright 2022 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 v1alpha1 contains API Schema definitions for the exp v1alpha1 IPAM API.
package v1alpha1
36 changes: 36 additions & 0 deletions exp/ipam/api/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
Copyright 2022 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.
*/

// +kubebuilder:object:generate=true
// +groupName=ipam.cluster.x-k8s.io

package v1alpha1

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: "ipam.cluster.x-k8s.io", Version: "v1alpha1"}

// 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
)
Loading