mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 16:29:21 +00:00
promote ServiceCIDR and IPAddress to GA
This commit is contained in:
parent
272f33de90
commit
eeae7b3fc8
@ -50,6 +50,10 @@ func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
&IngressClassList{},
|
||||
&NetworkPolicy{},
|
||||
&NetworkPolicyList{},
|
||||
&IPAddress{},
|
||||
&IPAddressList{},
|
||||
&ServiceCIDR{},
|
||||
&ServiceCIDRList{},
|
||||
)
|
||||
|
||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||
|
@ -635,3 +635,133 @@ type IngressClassList struct {
|
||||
// items is the list of IngressClasses.
|
||||
Items []IngressClass `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:prerelease-lifecycle-gen:introduced=1.33
|
||||
|
||||
// IPAddress represents a single IP of a single IP Family. The object is designed to be used by APIs
|
||||
// that operate on IP addresses. The object is used by the Service core API for allocation of IP addresses.
|
||||
// An IP address can be represented in different formats, to guarantee the uniqueness of the IP,
|
||||
// the name of the object is the IP address in canonical format, four decimal digits separated
|
||||
// by dots suppressing leading zeros for IPv4 and the representation defined by RFC 5952 for IPv6.
|
||||
// Valid: 192.168.1.5 or 2001:db8::1 or 2001:db8:aaaa:bbbb:cccc:dddd:eeee:1
|
||||
// Invalid: 10.01.2.3 or 2001:db8:0:0:0::1
|
||||
type IPAddress struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
// spec is the desired state of the IPAddress.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Spec IPAddressSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
|
||||
}
|
||||
|
||||
// IPAddressSpec describe the attributes in an IP Address.
|
||||
type IPAddressSpec struct {
|
||||
// ParentRef references the resource that an IPAddress is attached to.
|
||||
// An IPAddress must reference a parent object.
|
||||
// +required
|
||||
ParentRef *ParentReference `json:"parentRef,omitempty" protobuf:"bytes,1,opt,name=parentRef"`
|
||||
}
|
||||
|
||||
// ParentReference describes a reference to a parent object.
|
||||
type ParentReference struct {
|
||||
// Group is the group of the object being referenced.
|
||||
// +optional
|
||||
Group string `json:"group,omitempty" protobuf:"bytes,1,opt,name=group"`
|
||||
// Resource is the resource of the object being referenced.
|
||||
// +required
|
||||
Resource string `json:"resource,omitempty" protobuf:"bytes,2,opt,name=resource"`
|
||||
// Namespace is the namespace of the object being referenced.
|
||||
// +optional
|
||||
Namespace string `json:"namespace,omitempty" protobuf:"bytes,3,opt,name=namespace"`
|
||||
// Name is the name of the object being referenced.
|
||||
// +required
|
||||
Name string `json:"name,omitempty" protobuf:"bytes,4,opt,name=name"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:prerelease-lifecycle-gen:introduced=1.33
|
||||
|
||||
// IPAddressList contains a list of IPAddress.
|
||||
type IPAddressList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
// items is the list of IPAddresses.
|
||||
Items []IPAddress `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:prerelease-lifecycle-gen:introduced=1.33
|
||||
|
||||
// ServiceCIDR defines a range of IP addresses using CIDR format (e.g. 192.168.0.0/24 or 2001:db2::/64).
|
||||
// This range is used to allocate ClusterIPs to Service objects.
|
||||
type ServiceCIDR struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
// spec is the desired state of the ServiceCIDR.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Spec ServiceCIDRSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
|
||||
// status represents the current state of the ServiceCIDR.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Status ServiceCIDRStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
|
||||
}
|
||||
|
||||
// ServiceCIDRSpec define the CIDRs the user wants to use for allocating ClusterIPs for Services.
|
||||
type ServiceCIDRSpec struct {
|
||||
// CIDRs defines the IP blocks in CIDR notation (e.g. "192.168.0.0/24" or "2001:db8::/64")
|
||||
// from which to assign service cluster IPs. Max of two CIDRs is allowed, one of each IP family.
|
||||
// This field is immutable.
|
||||
// +optional
|
||||
// +listType=atomic
|
||||
CIDRs []string `json:"cidrs,omitempty" protobuf:"bytes,1,opt,name=cidrs"`
|
||||
}
|
||||
|
||||
const (
|
||||
// ServiceCIDRConditionReady represents status of a ServiceCIDR that is ready to be used by the
|
||||
// apiserver to allocate ClusterIPs for Services.
|
||||
ServiceCIDRConditionReady = "Ready"
|
||||
// ServiceCIDRReasonTerminating represents a reason where a ServiceCIDR is not ready because it is
|
||||
// being deleted.
|
||||
ServiceCIDRReasonTerminating = "Terminating"
|
||||
)
|
||||
|
||||
// ServiceCIDRStatus describes the current state of the ServiceCIDR.
|
||||
type ServiceCIDRStatus struct {
|
||||
// conditions holds an array of metav1.Condition that describe the state of the ServiceCIDR.
|
||||
// Current service state
|
||||
// +optional
|
||||
// +patchMergeKey=type
|
||||
// +patchStrategy=merge
|
||||
// +listType=map
|
||||
// +listMapKey=type
|
||||
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:prerelease-lifecycle-gen:introduced=1.33
|
||||
|
||||
// ServiceCIDRList contains a list of ServiceCIDR objects.
|
||||
type ServiceCIDRList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
// items is the list of ServiceCIDRs.
|
||||
Items []ServiceCIDR `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||
}
|
||||
|
33
staging/src/k8s.io/api/networking/v1/well_known_labels.go
Normal file
33
staging/src/k8s.io/api/networking/v1/well_known_labels.go
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
Copyright 2023 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 v1
|
||||
|
||||
const (
|
||||
|
||||
// TODO: Use IPFamily as field with a field selector,And the value is set based on
|
||||
// the name at create time and immutable.
|
||||
// LabelIPAddressFamily is used to indicate the IP family of a Kubernetes IPAddress.
|
||||
// This label simplify dual-stack client operations allowing to obtain the list of
|
||||
// IP addresses filtered by family.
|
||||
LabelIPAddressFamily = "ipaddress.kubernetes.io/ip-family"
|
||||
// LabelManagedBy is used to indicate the controller or entity that manages
|
||||
// an IPAddress. This label aims to enable different IPAddress
|
||||
// objects to be managed by different controllers or entities within the
|
||||
// same cluster. It is highly recommended to configure this label for all
|
||||
// IPAddress objects.
|
||||
LabelManagedBy = "ipaddress.kubernetes.io/managed-by"
|
||||
)
|
Loading…
Reference in New Issue
Block a user