Skip to content

Commit eeae7b3

Browse files
committed
promote ServiceCIDR and IPAddress to GA
1 parent 272f33d commit eeae7b3

File tree

3 files changed

+167
-0
lines changed

3 files changed

+167
-0
lines changed

staging/src/k8s.io/api/networking/v1/register.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ func addKnownTypes(scheme *runtime.Scheme) error {
5050
&IngressClassList{},
5151
&NetworkPolicy{},
5252
&NetworkPolicyList{},
53+
&IPAddress{},
54+
&IPAddressList{},
55+
&ServiceCIDR{},
56+
&ServiceCIDRList{},
5357
)
5458

5559
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)

staging/src/k8s.io/api/networking/v1/types.go

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,3 +635,133 @@ type IngressClassList struct {
635635
// items is the list of IngressClasses.
636636
Items []IngressClass `json:"items" protobuf:"bytes,2,rep,name=items"`
637637
}
638+
639+
// +genclient
640+
// +genclient:nonNamespaced
641+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
642+
// +k8s:prerelease-lifecycle-gen:introduced=1.33
643+
644+
// IPAddress represents a single IP of a single IP Family. The object is designed to be used by APIs
645+
// that operate on IP addresses. The object is used by the Service core API for allocation of IP addresses.
646+
// An IP address can be represented in different formats, to guarantee the uniqueness of the IP,
647+
// the name of the object is the IP address in canonical format, four decimal digits separated
648+
// by dots suppressing leading zeros for IPv4 and the representation defined by RFC 5952 for IPv6.
649+
// Valid: 192.168.1.5 or 2001:db8::1 or 2001:db8:aaaa:bbbb:cccc:dddd:eeee:1
650+
// Invalid: 10.01.2.3 or 2001:db8:0:0:0::1
651+
type IPAddress struct {
652+
metav1.TypeMeta `json:",inline"`
653+
// Standard object's metadata.
654+
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
655+
// +optional
656+
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
657+
// spec is the desired state of the IPAddress.
658+
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
659+
// +optional
660+
Spec IPAddressSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
661+
}
662+
663+
// IPAddressSpec describe the attributes in an IP Address.
664+
type IPAddressSpec struct {
665+
// ParentRef references the resource that an IPAddress is attached to.
666+
// An IPAddress must reference a parent object.
667+
// +required
668+
ParentRef *ParentReference `json:"parentRef,omitempty" protobuf:"bytes,1,opt,name=parentRef"`
669+
}
670+
671+
// ParentReference describes a reference to a parent object.
672+
type ParentReference struct {
673+
// Group is the group of the object being referenced.
674+
// +optional
675+
Group string `json:"group,omitempty" protobuf:"bytes,1,opt,name=group"`
676+
// Resource is the resource of the object being referenced.
677+
// +required
678+
Resource string `json:"resource,omitempty" protobuf:"bytes,2,opt,name=resource"`
679+
// Namespace is the namespace of the object being referenced.
680+
// +optional
681+
Namespace string `json:"namespace,omitempty" protobuf:"bytes,3,opt,name=namespace"`
682+
// Name is the name of the object being referenced.
683+
// +required
684+
Name string `json:"name,omitempty" protobuf:"bytes,4,opt,name=name"`
685+
}
686+
687+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
688+
// +k8s:prerelease-lifecycle-gen:introduced=1.33
689+
690+
// IPAddressList contains a list of IPAddress.
691+
type IPAddressList struct {
692+
metav1.TypeMeta `json:",inline"`
693+
// Standard object's metadata.
694+
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
695+
// +optional
696+
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
697+
// items is the list of IPAddresses.
698+
Items []IPAddress `json:"items" protobuf:"bytes,2,rep,name=items"`
699+
}
700+
701+
// +genclient
702+
// +genclient:nonNamespaced
703+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
704+
// +k8s:prerelease-lifecycle-gen:introduced=1.33
705+
706+
// ServiceCIDR defines a range of IP addresses using CIDR format (e.g. 192.168.0.0/24 or 2001:db2::/64).
707+
// This range is used to allocate ClusterIPs to Service objects.
708+
type ServiceCIDR struct {
709+
metav1.TypeMeta `json:",inline"`
710+
// Standard object's metadata.
711+
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
712+
// +optional
713+
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
714+
// spec is the desired state of the ServiceCIDR.
715+
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
716+
// +optional
717+
Spec ServiceCIDRSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
718+
// status represents the current state of the ServiceCIDR.
719+
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
720+
// +optional
721+
Status ServiceCIDRStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
722+
}
723+
724+
// ServiceCIDRSpec define the CIDRs the user wants to use for allocating ClusterIPs for Services.
725+
type ServiceCIDRSpec struct {
726+
// CIDRs defines the IP blocks in CIDR notation (e.g. "192.168.0.0/24" or "2001:db8::/64")
727+
// from which to assign service cluster IPs. Max of two CIDRs is allowed, one of each IP family.
728+
// This field is immutable.
729+
// +optional
730+
// +listType=atomic
731+
CIDRs []string `json:"cidrs,omitempty" protobuf:"bytes,1,opt,name=cidrs"`
732+
}
733+
734+
const (
735+
// ServiceCIDRConditionReady represents status of a ServiceCIDR that is ready to be used by the
736+
// apiserver to allocate ClusterIPs for Services.
737+
ServiceCIDRConditionReady = "Ready"
738+
// ServiceCIDRReasonTerminating represents a reason where a ServiceCIDR is not ready because it is
739+
// being deleted.
740+
ServiceCIDRReasonTerminating = "Terminating"
741+
)
742+
743+
// ServiceCIDRStatus describes the current state of the ServiceCIDR.
744+
type ServiceCIDRStatus struct {
745+
// conditions holds an array of metav1.Condition that describe the state of the ServiceCIDR.
746+
// Current service state
747+
// +optional
748+
// +patchMergeKey=type
749+
// +patchStrategy=merge
750+
// +listType=map
751+
// +listMapKey=type
752+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
753+
}
754+
755+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
756+
// +k8s:prerelease-lifecycle-gen:introduced=1.33
757+
758+
// ServiceCIDRList contains a list of ServiceCIDR objects.
759+
type ServiceCIDRList struct {
760+
metav1.TypeMeta `json:",inline"`
761+
// Standard object's metadata.
762+
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
763+
// +optional
764+
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
765+
// items is the list of ServiceCIDRs.
766+
Items []ServiceCIDR `json:"items" protobuf:"bytes,2,rep,name=items"`
767+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
Copyright 2023 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1
18+
19+
const (
20+
21+
// TODO: Use IPFamily as field with a field selector,And the value is set based on
22+
// the name at create time and immutable.
23+
// LabelIPAddressFamily is used to indicate the IP family of a Kubernetes IPAddress.
24+
// This label simplify dual-stack client operations allowing to obtain the list of
25+
// IP addresses filtered by family.
26+
LabelIPAddressFamily = "ipaddress.kubernetes.io/ip-family"
27+
// LabelManagedBy is used to indicate the controller or entity that manages
28+
// an IPAddress. This label aims to enable different IPAddress
29+
// objects to be managed by different controllers or entities within the
30+
// same cluster. It is highly recommended to configure this label for all
31+
// IPAddress objects.
32+
LabelManagedBy = "ipaddress.kubernetes.io/managed-by"
33+
)

0 commit comments

Comments
 (0)