mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-10-30 01:42:48 +00:00
Merge pull request #128971 from aojea/servicecidr_ga
KEP-1880 Multiple Service CIDRs: Graduate to GA
This commit is contained in:
@@ -50,6 +50,7 @@ API rule violation: names_match,k8s.io/api/core/v1,RBDVolumeSource,RBDPool
|
||||
API rule violation: names_match,k8s.io/api/core/v1,RBDVolumeSource,RadosUser
|
||||
API rule violation: names_match,k8s.io/api/core/v1,VolumeSource,CephFS
|
||||
API rule violation: names_match,k8s.io/api/core/v1,VolumeSource,StorageOS
|
||||
API rule violation: names_match,k8s.io/api/networking/v1,ServiceCIDRSpec,CIDRs
|
||||
API rule violation: names_match,k8s.io/api/networking/v1alpha1,ServiceCIDRSpec,CIDRs
|
||||
API rule violation: names_match,k8s.io/api/networking/v1beta1,ServiceCIDRSpec,CIDRs
|
||||
API rule violation: names_match,k8s.io/api/resource/v1alpha3,DeviceAttribute,BoolValue
|
||||
|
||||
@@ -805,6 +805,29 @@
|
||||
"watch"
|
||||
]
|
||||
},
|
||||
{
|
||||
"resource": "ipaddresses",
|
||||
"responseKind": {
|
||||
"group": "",
|
||||
"kind": "IPAddress",
|
||||
"version": ""
|
||||
},
|
||||
"scope": "Cluster",
|
||||
"shortNames": [
|
||||
"ip"
|
||||
],
|
||||
"singularResource": "ipaddress",
|
||||
"verbs": [
|
||||
"create",
|
||||
"delete",
|
||||
"deletecollection",
|
||||
"get",
|
||||
"list",
|
||||
"patch",
|
||||
"update",
|
||||
"watch"
|
||||
]
|
||||
},
|
||||
{
|
||||
"resource": "networkpolicies",
|
||||
"responseKind": {
|
||||
@@ -827,6 +850,41 @@
|
||||
"update",
|
||||
"watch"
|
||||
]
|
||||
},
|
||||
{
|
||||
"resource": "servicecidrs",
|
||||
"responseKind": {
|
||||
"group": "",
|
||||
"kind": "ServiceCIDR",
|
||||
"version": ""
|
||||
},
|
||||
"scope": "Cluster",
|
||||
"singularResource": "servicecidr",
|
||||
"subresources": [
|
||||
{
|
||||
"responseKind": {
|
||||
"group": "",
|
||||
"kind": "ServiceCIDR",
|
||||
"version": ""
|
||||
},
|
||||
"subresource": "status",
|
||||
"verbs": [
|
||||
"get",
|
||||
"patch",
|
||||
"update"
|
||||
]
|
||||
}
|
||||
],
|
||||
"verbs": [
|
||||
"create",
|
||||
"delete",
|
||||
"deletecollection",
|
||||
"get",
|
||||
"list",
|
||||
"patch",
|
||||
"update",
|
||||
"watch"
|
||||
]
|
||||
}
|
||||
],
|
||||
"version": "v1"
|
||||
|
||||
@@ -51,6 +51,26 @@
|
||||
"update"
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "IPAddress",
|
||||
"name": "ipaddresses",
|
||||
"namespaced": false,
|
||||
"shortNames": [
|
||||
"ip"
|
||||
],
|
||||
"singularName": "ipaddress",
|
||||
"storageVersionHash": "O4H8VxQhW5Y=",
|
||||
"verbs": [
|
||||
"create",
|
||||
"delete",
|
||||
"deletecollection",
|
||||
"get",
|
||||
"list",
|
||||
"patch",
|
||||
"update",
|
||||
"watch"
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "NetworkPolicy",
|
||||
"name": "networkpolicies",
|
||||
@@ -70,6 +90,34 @@
|
||||
"update",
|
||||
"watch"
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "ServiceCIDR",
|
||||
"name": "servicecidrs",
|
||||
"namespaced": false,
|
||||
"singularName": "servicecidr",
|
||||
"storageVersionHash": "8ufAXOnr3Yg=",
|
||||
"verbs": [
|
||||
"create",
|
||||
"delete",
|
||||
"deletecollection",
|
||||
"get",
|
||||
"list",
|
||||
"patch",
|
||||
"update",
|
||||
"watch"
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "ServiceCIDR",
|
||||
"name": "servicecidrs/status",
|
||||
"namespaced": false,
|
||||
"singularName": "",
|
||||
"verbs": [
|
||||
"get",
|
||||
"patch",
|
||||
"update"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
1703
api/openapi-spec/swagger.json
generated
1703
api/openapi-spec/swagger.json
generated
File diff suppressed because it is too large
Load Diff
3076
api/openapi-spec/v3/apis__networking.k8s.io__v1_openapi.json
generated
3076
api/openapi-spec/v3/apis__networking.k8s.io__v1_openapi.json
generated
File diff suppressed because it is too large
Load Diff
@@ -21,6 +21,7 @@ import (
|
||||
"testing"
|
||||
|
||||
utilnet "k8s.io/apimachinery/pkg/util/net"
|
||||
"k8s.io/apimachinery/pkg/util/version"
|
||||
apiserveroptions "k8s.io/apiserver/pkg/server/options"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
||||
@@ -182,6 +183,9 @@ func TestClusterServiceIPRange(t *testing.T) {
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
if !tc.ipAllocatorGate {
|
||||
featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, utilfeature.DefaultFeatureGate, version.MustParse("1.32"))
|
||||
}
|
||||
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.MultiCIDRServiceAllocator, tc.ipAllocatorGate)
|
||||
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.DisableAllocatorDualWrite, tc.disableDualWriteGate)
|
||||
|
||||
|
||||
@@ -40,8 +40,8 @@ func newServiceCIDRsControllerDescriptor() *ControllerDescriptor {
|
||||
func startServiceCIDRsController(ctx context.Context, controllerContext ControllerContext, controllerName string) (controller.Interface, bool, error) {
|
||||
go servicecidrs.NewController(
|
||||
ctx,
|
||||
controllerContext.InformerFactory.Networking().V1beta1().ServiceCIDRs(),
|
||||
controllerContext.InformerFactory.Networking().V1beta1().IPAddresses(),
|
||||
controllerContext.InformerFactory.Networking().V1().ServiceCIDRs(),
|
||||
controllerContext.InformerFactory.Networking().V1().IPAddresses(),
|
||||
controllerContext.ClientBuilder.ClientOrDie("service-cidrs-controller"),
|
||||
).Run(ctx, 5)
|
||||
// TODO use component config
|
||||
|
||||
@@ -573,7 +573,7 @@ func (s *ProxyServer) Run(ctx context.Context) error {
|
||||
go endpointSliceConfig.Run(ctx.Done())
|
||||
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.MultiCIDRServiceAllocator) {
|
||||
serviceCIDRConfig := config.NewServiceCIDRConfig(ctx, informerFactory.Networking().V1beta1().ServiceCIDRs(), s.Config.ConfigSyncPeriod.Duration)
|
||||
serviceCIDRConfig := config.NewServiceCIDRConfig(ctx, informerFactory.Networking().V1().ServiceCIDRs(), s.Config.ConfigSyncPeriod.Duration)
|
||||
serviceCIDRConfig.RegisterEventHandler(s.Proxier)
|
||||
go serviceCIDRConfig.Run(wait.NeverStop)
|
||||
}
|
||||
|
||||
@@ -21,14 +21,14 @@ import (
|
||||
"net"
|
||||
"net/netip"
|
||||
|
||||
networkingv1beta1 "k8s.io/api/networking/v1beta1"
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
networkinglisters "k8s.io/client-go/listers/networking/v1beta1"
|
||||
networkinglisters "k8s.io/client-go/listers/networking/v1"
|
||||
)
|
||||
|
||||
// OverlapsPrefix return the list of ServiceCIDR that overlaps with the prefix passed as argument
|
||||
func OverlapsPrefix(serviceCIDRLister networkinglisters.ServiceCIDRLister, prefix netip.Prefix) []*networkingv1beta1.ServiceCIDR {
|
||||
result := []*networkingv1beta1.ServiceCIDR{}
|
||||
func OverlapsPrefix(serviceCIDRLister networkinglisters.ServiceCIDRLister, prefix netip.Prefix) []*networkingv1.ServiceCIDR {
|
||||
result := []*networkingv1.ServiceCIDR{}
|
||||
serviceCIDRList, err := serviceCIDRLister.List(labels.Everything())
|
||||
if err != nil {
|
||||
return result
|
||||
@@ -47,8 +47,8 @@ func OverlapsPrefix(serviceCIDRLister networkinglisters.ServiceCIDRLister, prefi
|
||||
}
|
||||
|
||||
// ContainsPrefix return the list of ServiceCIDR that contains the prefix passed as argument
|
||||
func ContainsPrefix(serviceCIDRLister networkinglisters.ServiceCIDRLister, prefix netip.Prefix) []*networkingv1beta1.ServiceCIDR {
|
||||
result := []*networkingv1beta1.ServiceCIDR{}
|
||||
func ContainsPrefix(serviceCIDRLister networkinglisters.ServiceCIDRLister, prefix netip.Prefix) []*networkingv1.ServiceCIDR {
|
||||
result := []*networkingv1.ServiceCIDR{}
|
||||
serviceCIDRList, err := serviceCIDRLister.List(labels.Everything())
|
||||
if err != nil {
|
||||
return result
|
||||
@@ -67,14 +67,14 @@ func ContainsPrefix(serviceCIDRLister networkinglisters.ServiceCIDRLister, prefi
|
||||
}
|
||||
|
||||
// ContainsIP return the list of ServiceCIDR that contains the IP address passed as argument
|
||||
func ContainsIP(serviceCIDRLister networkinglisters.ServiceCIDRLister, ip net.IP) []*networkingv1beta1.ServiceCIDR {
|
||||
func ContainsIP(serviceCIDRLister networkinglisters.ServiceCIDRLister, ip net.IP) []*networkingv1.ServiceCIDR {
|
||||
address := IPToAddr(ip)
|
||||
return ContainsAddress(serviceCIDRLister, address)
|
||||
}
|
||||
|
||||
// ContainsAddress return the list of ServiceCIDR that contains the address passed as argument
|
||||
func ContainsAddress(serviceCIDRLister networkinglisters.ServiceCIDRLister, address netip.Addr) []*networkingv1beta1.ServiceCIDR {
|
||||
result := []*networkingv1beta1.ServiceCIDR{}
|
||||
func ContainsAddress(serviceCIDRLister networkinglisters.ServiceCIDRLister, address netip.Addr) []*networkingv1.ServiceCIDR {
|
||||
result := []*networkingv1.ServiceCIDR{}
|
||||
serviceCIDRList, err := serviceCIDRLister.List(labels.Everything())
|
||||
if err != nil {
|
||||
return result
|
||||
|
||||
@@ -22,19 +22,19 @@ import (
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
networkingv1beta1 "k8s.io/api/networking/v1beta1"
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
networkinglisters "k8s.io/client-go/listers/networking/v1beta1"
|
||||
networkinglisters "k8s.io/client-go/listers/networking/v1"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
netutils "k8s.io/utils/net"
|
||||
)
|
||||
|
||||
func newServiceCIDR(name, primary, secondary string) *networkingv1beta1.ServiceCIDR {
|
||||
serviceCIDR := &networkingv1beta1.ServiceCIDR{
|
||||
func newServiceCIDR(name, primary, secondary string) *networkingv1.ServiceCIDR {
|
||||
serviceCIDR := &networkingv1.ServiceCIDR{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
},
|
||||
Spec: networkingv1beta1.ServiceCIDRSpec{},
|
||||
Spec: networkingv1.ServiceCIDRSpec{},
|
||||
}
|
||||
serviceCIDR.Spec.CIDRs = append(serviceCIDR.Spec.CIDRs, primary)
|
||||
if secondary != "" {
|
||||
@@ -46,13 +46,13 @@ func newServiceCIDR(name, primary, secondary string) *networkingv1beta1.ServiceC
|
||||
func TestOverlapsPrefix(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
serviceCIDRs []*networkingv1beta1.ServiceCIDR
|
||||
serviceCIDRs []*networkingv1.ServiceCIDR
|
||||
prefix netip.Prefix
|
||||
want []string
|
||||
}{
|
||||
{
|
||||
name: "only one ServiceCIDR and IPv4 prefix contained",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
},
|
||||
prefix: netip.MustParsePrefix("10.0.0.0/26"),
|
||||
@@ -60,7 +60,7 @@ func TestOverlapsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "only one ServiceCIDR and same IPv4 prefix",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
},
|
||||
prefix: netip.MustParsePrefix("10.0.0.0/24"),
|
||||
@@ -68,7 +68,7 @@ func TestOverlapsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "only one ServiceCIDR and larger IPv4 prefix",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
},
|
||||
prefix: netip.MustParsePrefix("10.0.0.0/16"),
|
||||
@@ -76,7 +76,7 @@ func TestOverlapsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "only one ServiceCIDR and non contained IPv4 prefix",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
},
|
||||
prefix: netip.MustParsePrefix("192.168.0.0/24"),
|
||||
@@ -84,7 +84,7 @@ func TestOverlapsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "only one ServiceCIDR and IPv6 prefix contained",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
},
|
||||
prefix: netip.MustParsePrefix("2001:db8::/112"),
|
||||
@@ -92,7 +92,7 @@ func TestOverlapsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "only one ServiceCIDR and same IPv6 prefix",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
},
|
||||
prefix: netip.MustParsePrefix("2001:db8::/96"),
|
||||
@@ -100,7 +100,7 @@ func TestOverlapsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "only one ServiceCIDR and IPv6 larger",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
},
|
||||
prefix: netip.MustParsePrefix("2001:db8::/64"),
|
||||
@@ -108,7 +108,7 @@ func TestOverlapsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "only one ServiceCIDR and IPv6 prefix out of range",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
},
|
||||
prefix: netip.MustParsePrefix("2001:db2::/112"),
|
||||
@@ -116,7 +116,7 @@ func TestOverlapsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "two ServiceCIDR and IPv4 prefix contained",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
},
|
||||
@@ -125,7 +125,7 @@ func TestOverlapsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "two overlapping ServiceCIDR and IPv4 prefix only contained in one",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
},
|
||||
@@ -134,7 +134,7 @@ func TestOverlapsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "two ServiceCIDR and IPv4 larger",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
},
|
||||
@@ -143,7 +143,7 @@ func TestOverlapsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "two ServiceCIDR and IPv4 prefix not contained",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
},
|
||||
@@ -152,7 +152,7 @@ func TestOverlapsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "two ServiceCIDR and IPv6 prefix contained",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
},
|
||||
@@ -161,7 +161,7 @@ func TestOverlapsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "two ServiceCIDR and IPv6 prefix contained in one",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
},
|
||||
@@ -170,7 +170,7 @@ func TestOverlapsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "two ServiceCIDR and aprefix larger",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
},
|
||||
@@ -179,7 +179,7 @@ func TestOverlapsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "two ServiceCIDR and prefix out of range",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
},
|
||||
@@ -188,7 +188,7 @@ func TestOverlapsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "multiple ServiceCIDR match with overlap contained",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("kubernetes2", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
@@ -198,7 +198,7 @@ func TestOverlapsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "multiple ServiceCIDR match with overlap contains",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("kubernetes2", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
@@ -234,13 +234,13 @@ func TestOverlapsPrefix(t *testing.T) {
|
||||
func TestContainsPrefix(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
serviceCIDRs []*networkingv1beta1.ServiceCIDR
|
||||
serviceCIDRs []*networkingv1.ServiceCIDR
|
||||
prefix netip.Prefix
|
||||
want []string
|
||||
}{
|
||||
{
|
||||
name: "only one ServiceCIDR and IPv4 prefix contained",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
},
|
||||
prefix: netip.MustParsePrefix("10.0.0.0/26"),
|
||||
@@ -248,7 +248,7 @@ func TestContainsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "only one ServiceCIDR and same IPv4 prefix",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
},
|
||||
prefix: netip.MustParsePrefix("10.0.0.0/24"),
|
||||
@@ -256,7 +256,7 @@ func TestContainsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "only one ServiceCIDR and larger IPv4 prefix",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
},
|
||||
prefix: netip.MustParsePrefix("10.0.0.0/16"),
|
||||
@@ -264,7 +264,7 @@ func TestContainsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "only one ServiceCIDR and non containerd IPv4 prefix",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
},
|
||||
prefix: netip.MustParsePrefix("192.168.0.0/24"),
|
||||
@@ -272,7 +272,7 @@ func TestContainsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "only one ServiceCIDR and IPv6 prefix contained",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
},
|
||||
prefix: netip.MustParsePrefix("2001:db8::/112"),
|
||||
@@ -280,7 +280,7 @@ func TestContainsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "only one ServiceCIDR and same IPv6 prefix",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
},
|
||||
prefix: netip.MustParsePrefix("2001:db8::/96"),
|
||||
@@ -288,7 +288,7 @@ func TestContainsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "only one ServiceCIDR and IPv6 larger",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
},
|
||||
prefix: netip.MustParsePrefix("2001:db8::/64"),
|
||||
@@ -296,7 +296,7 @@ func TestContainsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "only one ServiceCIDR and IPv6 prefix out of range",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
},
|
||||
prefix: netip.MustParsePrefix("2001:db2::/112"),
|
||||
@@ -304,7 +304,7 @@ func TestContainsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "two ServiceCIDR and IPv4 prefix contained",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
},
|
||||
@@ -313,7 +313,7 @@ func TestContainsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "two ServiceCIDR and IPv4 prefix only contained in one",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
},
|
||||
@@ -322,7 +322,7 @@ func TestContainsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "two ServiceCIDR and IPv4 larger",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
},
|
||||
@@ -331,7 +331,7 @@ func TestContainsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "two ServiceCIDR and IPv4 prefix not contained",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
},
|
||||
@@ -340,7 +340,7 @@ func TestContainsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "two ServiceCIDR and IPv6 prefix contained",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
},
|
||||
@@ -349,7 +349,7 @@ func TestContainsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "two ServiceCIDR and IPv6 prefix contained in one",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
},
|
||||
@@ -358,7 +358,7 @@ func TestContainsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "two ServiceCIDR and aprefix larger",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
},
|
||||
@@ -367,7 +367,7 @@ func TestContainsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "two ServiceCIDR and prefix out of range",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
},
|
||||
@@ -376,7 +376,7 @@ func TestContainsPrefix(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "multiple ServiceCIDR match with overlap",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("kubernetes2", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
@@ -412,13 +412,13 @@ func TestContainsPrefix(t *testing.T) {
|
||||
func TestContainsAddress(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
serviceCIDRs []*networkingv1beta1.ServiceCIDR
|
||||
serviceCIDRs []*networkingv1.ServiceCIDR
|
||||
address netip.Addr
|
||||
want []string
|
||||
}{
|
||||
{
|
||||
name: "only one ServiceCIDR and IPv4 address contained",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
},
|
||||
address: netip.MustParseAddr("10.0.0.1"),
|
||||
@@ -426,7 +426,7 @@ func TestContainsAddress(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "only one ServiceCIDR and IPv4 address broadcast",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
},
|
||||
address: netip.MustParseAddr("10.0.0.255"),
|
||||
@@ -434,7 +434,7 @@ func TestContainsAddress(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "only one ServiceCIDR and IPv4 address base",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
},
|
||||
address: netip.MustParseAddr("10.0.0.0"),
|
||||
@@ -442,7 +442,7 @@ func TestContainsAddress(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "only one ServiceCIDR and IPv4 address out of range",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
},
|
||||
address: netip.MustParseAddr("192.0.0.1"),
|
||||
@@ -450,7 +450,7 @@ func TestContainsAddress(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "only one ServiceCIDR and IPv6 address contained",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
},
|
||||
address: netip.MustParseAddr("2001:db8::2:3"),
|
||||
@@ -458,7 +458,7 @@ func TestContainsAddress(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "only one ServiceCIDR and IPv6 address broadcast",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
},
|
||||
address: netip.MustParseAddr("2001:db8::ffff:ffff"),
|
||||
@@ -466,7 +466,7 @@ func TestContainsAddress(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "only one ServiceCIDR and IPv6 address base",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
},
|
||||
address: netip.MustParseAddr("2001:db8::"),
|
||||
@@ -474,7 +474,7 @@ func TestContainsAddress(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "only one ServiceCIDR and IPv6 address out of range",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
},
|
||||
address: netip.MustParseAddr("2002:1:2:3::2"),
|
||||
@@ -482,7 +482,7 @@ func TestContainsAddress(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "two ServiceCIDR and IPv4 address contained",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
},
|
||||
@@ -491,7 +491,7 @@ func TestContainsAddress(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "two ServiceCIDR and IPv4 address broadcast",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
},
|
||||
@@ -500,7 +500,7 @@ func TestContainsAddress(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "two ServiceCIDR and IPv4 address base",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
},
|
||||
@@ -509,7 +509,7 @@ func TestContainsAddress(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "two ServiceCIDR and IPv4 address out of range",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
},
|
||||
@@ -518,7 +518,7 @@ func TestContainsAddress(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "two ServiceCIDR and IPv6 address contained",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
},
|
||||
@@ -527,7 +527,7 @@ func TestContainsAddress(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "two ServiceCIDR and address broadcast",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
},
|
||||
@@ -536,7 +536,7 @@ func TestContainsAddress(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "two ServiceCIDR and address base",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
},
|
||||
@@ -545,7 +545,7 @@ func TestContainsAddress(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "two ServiceCIDR and address out of range",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
},
|
||||
@@ -554,7 +554,7 @@ func TestContainsAddress(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "multiple ServiceCIDR match with overlap",
|
||||
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
|
||||
serviceCIDRs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("kubernetes2", "10.0.0.0/24", "2001:db8::/96"),
|
||||
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
|
||||
|
||||
268
pkg/apis/networking/v1/zz_generated.conversion.go
generated
268
pkg/apis/networking/v1/zz_generated.conversion.go
generated
@@ -61,6 +61,36 @@ func RegisterConversions(s *runtime.Scheme) error {
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networkingv1.IPAddress)(nil), (*networking.IPAddress)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_IPAddress_To_networking_IPAddress(a.(*networkingv1.IPAddress), b.(*networking.IPAddress), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.IPAddress)(nil), (*networkingv1.IPAddress)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_IPAddress_To_v1_IPAddress(a.(*networking.IPAddress), b.(*networkingv1.IPAddress), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networkingv1.IPAddressList)(nil), (*networking.IPAddressList)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_IPAddressList_To_networking_IPAddressList(a.(*networkingv1.IPAddressList), b.(*networking.IPAddressList), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.IPAddressList)(nil), (*networkingv1.IPAddressList)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_IPAddressList_To_v1_IPAddressList(a.(*networking.IPAddressList), b.(*networkingv1.IPAddressList), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networkingv1.IPAddressSpec)(nil), (*networking.IPAddressSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_IPAddressSpec_To_networking_IPAddressSpec(a.(*networkingv1.IPAddressSpec), b.(*networking.IPAddressSpec), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.IPAddressSpec)(nil), (*networkingv1.IPAddressSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_IPAddressSpec_To_v1_IPAddressSpec(a.(*networking.IPAddressSpec), b.(*networkingv1.IPAddressSpec), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networkingv1.IPBlock)(nil), (*networking.IPBlock)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_IPBlock_To_networking_IPBlock(a.(*networkingv1.IPBlock), b.(*networking.IPBlock), scope)
|
||||
}); err != nil {
|
||||
@@ -301,6 +331,16 @@ func RegisterConversions(s *runtime.Scheme) error {
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networkingv1.ParentReference)(nil), (*networking.ParentReference)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_ParentReference_To_networking_ParentReference(a.(*networkingv1.ParentReference), b.(*networking.ParentReference), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.ParentReference)(nil), (*networkingv1.ParentReference)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_ParentReference_To_v1_ParentReference(a.(*networking.ParentReference), b.(*networkingv1.ParentReference), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networkingv1.ServiceBackendPort)(nil), (*networking.ServiceBackendPort)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_ServiceBackendPort_To_networking_ServiceBackendPort(a.(*networkingv1.ServiceBackendPort), b.(*networking.ServiceBackendPort), scope)
|
||||
}); err != nil {
|
||||
@@ -311,6 +351,46 @@ func RegisterConversions(s *runtime.Scheme) error {
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networkingv1.ServiceCIDR)(nil), (*networking.ServiceCIDR)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_ServiceCIDR_To_networking_ServiceCIDR(a.(*networkingv1.ServiceCIDR), b.(*networking.ServiceCIDR), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.ServiceCIDR)(nil), (*networkingv1.ServiceCIDR)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_ServiceCIDR_To_v1_ServiceCIDR(a.(*networking.ServiceCIDR), b.(*networkingv1.ServiceCIDR), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networkingv1.ServiceCIDRList)(nil), (*networking.ServiceCIDRList)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_ServiceCIDRList_To_networking_ServiceCIDRList(a.(*networkingv1.ServiceCIDRList), b.(*networking.ServiceCIDRList), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.ServiceCIDRList)(nil), (*networkingv1.ServiceCIDRList)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_ServiceCIDRList_To_v1_ServiceCIDRList(a.(*networking.ServiceCIDRList), b.(*networkingv1.ServiceCIDRList), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networkingv1.ServiceCIDRSpec)(nil), (*networking.ServiceCIDRSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_ServiceCIDRSpec_To_networking_ServiceCIDRSpec(a.(*networkingv1.ServiceCIDRSpec), b.(*networking.ServiceCIDRSpec), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.ServiceCIDRSpec)(nil), (*networkingv1.ServiceCIDRSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_ServiceCIDRSpec_To_v1_ServiceCIDRSpec(a.(*networking.ServiceCIDRSpec), b.(*networkingv1.ServiceCIDRSpec), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networkingv1.ServiceCIDRStatus)(nil), (*networking.ServiceCIDRStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_ServiceCIDRStatus_To_networking_ServiceCIDRStatus(a.(*networkingv1.ServiceCIDRStatus), b.(*networking.ServiceCIDRStatus), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.ServiceCIDRStatus)(nil), (*networkingv1.ServiceCIDRStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_ServiceCIDRStatus_To_v1_ServiceCIDRStatus(a.(*networking.ServiceCIDRStatus), b.(*networkingv1.ServiceCIDRStatus), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -362,6 +442,74 @@ func Convert_networking_HTTPIngressRuleValue_To_v1_HTTPIngressRuleValue(in *netw
|
||||
return autoConvert_networking_HTTPIngressRuleValue_To_v1_HTTPIngressRuleValue(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_IPAddress_To_networking_IPAddress(in *networkingv1.IPAddress, out *networking.IPAddress, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_v1_IPAddressSpec_To_networking_IPAddressSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_IPAddress_To_networking_IPAddress is an autogenerated conversion function.
|
||||
func Convert_v1_IPAddress_To_networking_IPAddress(in *networkingv1.IPAddress, out *networking.IPAddress, s conversion.Scope) error {
|
||||
return autoConvert_v1_IPAddress_To_networking_IPAddress(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_IPAddress_To_v1_IPAddress(in *networking.IPAddress, out *networkingv1.IPAddress, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_networking_IPAddressSpec_To_v1_IPAddressSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_IPAddress_To_v1_IPAddress is an autogenerated conversion function.
|
||||
func Convert_networking_IPAddress_To_v1_IPAddress(in *networking.IPAddress, out *networkingv1.IPAddress, s conversion.Scope) error {
|
||||
return autoConvert_networking_IPAddress_To_v1_IPAddress(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_IPAddressList_To_networking_IPAddressList(in *networkingv1.IPAddressList, out *networking.IPAddressList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
out.Items = *(*[]networking.IPAddress)(unsafe.Pointer(&in.Items))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_IPAddressList_To_networking_IPAddressList is an autogenerated conversion function.
|
||||
func Convert_v1_IPAddressList_To_networking_IPAddressList(in *networkingv1.IPAddressList, out *networking.IPAddressList, s conversion.Scope) error {
|
||||
return autoConvert_v1_IPAddressList_To_networking_IPAddressList(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_IPAddressList_To_v1_IPAddressList(in *networking.IPAddressList, out *networkingv1.IPAddressList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
out.Items = *(*[]networkingv1.IPAddress)(unsafe.Pointer(&in.Items))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_IPAddressList_To_v1_IPAddressList is an autogenerated conversion function.
|
||||
func Convert_networking_IPAddressList_To_v1_IPAddressList(in *networking.IPAddressList, out *networkingv1.IPAddressList, s conversion.Scope) error {
|
||||
return autoConvert_networking_IPAddressList_To_v1_IPAddressList(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_IPAddressSpec_To_networking_IPAddressSpec(in *networkingv1.IPAddressSpec, out *networking.IPAddressSpec, s conversion.Scope) error {
|
||||
out.ParentRef = (*networking.ParentReference)(unsafe.Pointer(in.ParentRef))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_IPAddressSpec_To_networking_IPAddressSpec is an autogenerated conversion function.
|
||||
func Convert_v1_IPAddressSpec_To_networking_IPAddressSpec(in *networkingv1.IPAddressSpec, out *networking.IPAddressSpec, s conversion.Scope) error {
|
||||
return autoConvert_v1_IPAddressSpec_To_networking_IPAddressSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_IPAddressSpec_To_v1_IPAddressSpec(in *networking.IPAddressSpec, out *networkingv1.IPAddressSpec, s conversion.Scope) error {
|
||||
out.ParentRef = (*networkingv1.ParentReference)(unsafe.Pointer(in.ParentRef))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_IPAddressSpec_To_v1_IPAddressSpec is an autogenerated conversion function.
|
||||
func Convert_networking_IPAddressSpec_To_v1_IPAddressSpec(in *networking.IPAddressSpec, out *networkingv1.IPAddressSpec, s conversion.Scope) error {
|
||||
return autoConvert_networking_IPAddressSpec_To_v1_IPAddressSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_IPBlock_To_networking_IPBlock(in *networkingv1.IPBlock, out *networking.IPBlock, s conversion.Scope) error {
|
||||
out.CIDR = in.CIDR
|
||||
out.Except = *(*[]string)(unsafe.Pointer(&in.Except))
|
||||
@@ -936,6 +1084,32 @@ func Convert_networking_NetworkPolicySpec_To_v1_NetworkPolicySpec(in *networking
|
||||
return autoConvert_networking_NetworkPolicySpec_To_v1_NetworkPolicySpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_ParentReference_To_networking_ParentReference(in *networkingv1.ParentReference, out *networking.ParentReference, s conversion.Scope) error {
|
||||
out.Group = in.Group
|
||||
out.Resource = in.Resource
|
||||
out.Namespace = in.Namespace
|
||||
out.Name = in.Name
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_ParentReference_To_networking_ParentReference is an autogenerated conversion function.
|
||||
func Convert_v1_ParentReference_To_networking_ParentReference(in *networkingv1.ParentReference, out *networking.ParentReference, s conversion.Scope) error {
|
||||
return autoConvert_v1_ParentReference_To_networking_ParentReference(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_ParentReference_To_v1_ParentReference(in *networking.ParentReference, out *networkingv1.ParentReference, s conversion.Scope) error {
|
||||
out.Group = in.Group
|
||||
out.Resource = in.Resource
|
||||
out.Namespace = in.Namespace
|
||||
out.Name = in.Name
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_ParentReference_To_v1_ParentReference is an autogenerated conversion function.
|
||||
func Convert_networking_ParentReference_To_v1_ParentReference(in *networking.ParentReference, out *networkingv1.ParentReference, s conversion.Scope) error {
|
||||
return autoConvert_networking_ParentReference_To_v1_ParentReference(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_ServiceBackendPort_To_networking_ServiceBackendPort(in *networkingv1.ServiceBackendPort, out *networking.ServiceBackendPort, s conversion.Scope) error {
|
||||
out.Name = in.Name
|
||||
out.Number = in.Number
|
||||
@@ -957,3 +1131,97 @@ func autoConvert_networking_ServiceBackendPort_To_v1_ServiceBackendPort(in *netw
|
||||
func Convert_networking_ServiceBackendPort_To_v1_ServiceBackendPort(in *networking.ServiceBackendPort, out *networkingv1.ServiceBackendPort, s conversion.Scope) error {
|
||||
return autoConvert_networking_ServiceBackendPort_To_v1_ServiceBackendPort(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_ServiceCIDR_To_networking_ServiceCIDR(in *networkingv1.ServiceCIDR, out *networking.ServiceCIDR, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_v1_ServiceCIDRSpec_To_networking_ServiceCIDRSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_v1_ServiceCIDRStatus_To_networking_ServiceCIDRStatus(&in.Status, &out.Status, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_ServiceCIDR_To_networking_ServiceCIDR is an autogenerated conversion function.
|
||||
func Convert_v1_ServiceCIDR_To_networking_ServiceCIDR(in *networkingv1.ServiceCIDR, out *networking.ServiceCIDR, s conversion.Scope) error {
|
||||
return autoConvert_v1_ServiceCIDR_To_networking_ServiceCIDR(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_ServiceCIDR_To_v1_ServiceCIDR(in *networking.ServiceCIDR, out *networkingv1.ServiceCIDR, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_networking_ServiceCIDRSpec_To_v1_ServiceCIDRSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_networking_ServiceCIDRStatus_To_v1_ServiceCIDRStatus(&in.Status, &out.Status, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_ServiceCIDR_To_v1_ServiceCIDR is an autogenerated conversion function.
|
||||
func Convert_networking_ServiceCIDR_To_v1_ServiceCIDR(in *networking.ServiceCIDR, out *networkingv1.ServiceCIDR, s conversion.Scope) error {
|
||||
return autoConvert_networking_ServiceCIDR_To_v1_ServiceCIDR(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_ServiceCIDRList_To_networking_ServiceCIDRList(in *networkingv1.ServiceCIDRList, out *networking.ServiceCIDRList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
out.Items = *(*[]networking.ServiceCIDR)(unsafe.Pointer(&in.Items))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_ServiceCIDRList_To_networking_ServiceCIDRList is an autogenerated conversion function.
|
||||
func Convert_v1_ServiceCIDRList_To_networking_ServiceCIDRList(in *networkingv1.ServiceCIDRList, out *networking.ServiceCIDRList, s conversion.Scope) error {
|
||||
return autoConvert_v1_ServiceCIDRList_To_networking_ServiceCIDRList(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_ServiceCIDRList_To_v1_ServiceCIDRList(in *networking.ServiceCIDRList, out *networkingv1.ServiceCIDRList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
out.Items = *(*[]networkingv1.ServiceCIDR)(unsafe.Pointer(&in.Items))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_ServiceCIDRList_To_v1_ServiceCIDRList is an autogenerated conversion function.
|
||||
func Convert_networking_ServiceCIDRList_To_v1_ServiceCIDRList(in *networking.ServiceCIDRList, out *networkingv1.ServiceCIDRList, s conversion.Scope) error {
|
||||
return autoConvert_networking_ServiceCIDRList_To_v1_ServiceCIDRList(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_ServiceCIDRSpec_To_networking_ServiceCIDRSpec(in *networkingv1.ServiceCIDRSpec, out *networking.ServiceCIDRSpec, s conversion.Scope) error {
|
||||
out.CIDRs = *(*[]string)(unsafe.Pointer(&in.CIDRs))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_ServiceCIDRSpec_To_networking_ServiceCIDRSpec is an autogenerated conversion function.
|
||||
func Convert_v1_ServiceCIDRSpec_To_networking_ServiceCIDRSpec(in *networkingv1.ServiceCIDRSpec, out *networking.ServiceCIDRSpec, s conversion.Scope) error {
|
||||
return autoConvert_v1_ServiceCIDRSpec_To_networking_ServiceCIDRSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_ServiceCIDRSpec_To_v1_ServiceCIDRSpec(in *networking.ServiceCIDRSpec, out *networkingv1.ServiceCIDRSpec, s conversion.Scope) error {
|
||||
out.CIDRs = *(*[]string)(unsafe.Pointer(&in.CIDRs))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_ServiceCIDRSpec_To_v1_ServiceCIDRSpec is an autogenerated conversion function.
|
||||
func Convert_networking_ServiceCIDRSpec_To_v1_ServiceCIDRSpec(in *networking.ServiceCIDRSpec, out *networkingv1.ServiceCIDRSpec, s conversion.Scope) error {
|
||||
return autoConvert_networking_ServiceCIDRSpec_To_v1_ServiceCIDRSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_ServiceCIDRStatus_To_networking_ServiceCIDRStatus(in *networkingv1.ServiceCIDRStatus, out *networking.ServiceCIDRStatus, s conversion.Scope) error {
|
||||
out.Conditions = *(*[]metav1.Condition)(unsafe.Pointer(&in.Conditions))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_ServiceCIDRStatus_To_networking_ServiceCIDRStatus is an autogenerated conversion function.
|
||||
func Convert_v1_ServiceCIDRStatus_To_networking_ServiceCIDRStatus(in *networkingv1.ServiceCIDRStatus, out *networking.ServiceCIDRStatus, s conversion.Scope) error {
|
||||
return autoConvert_v1_ServiceCIDRStatus_To_networking_ServiceCIDRStatus(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_ServiceCIDRStatus_To_v1_ServiceCIDRStatus(in *networking.ServiceCIDRStatus, out *networkingv1.ServiceCIDRStatus, s conversion.Scope) error {
|
||||
out.Conditions = *(*[]metav1.Condition)(unsafe.Pointer(&in.Conditions))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_ServiceCIDRStatus_To_v1_ServiceCIDRStatus is an autogenerated conversion function.
|
||||
func Convert_networking_ServiceCIDRStatus_To_v1_ServiceCIDRStatus(in *networking.ServiceCIDRStatus, out *networkingv1.ServiceCIDRStatus, s conversion.Scope) error {
|
||||
return autoConvert_networking_ServiceCIDRStatus_To_v1_ServiceCIDRStatus(in, out, s)
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
"time"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
networkingapiv1beta1 "k8s.io/api/networking/v1beta1"
|
||||
networkingapiv1 "k8s.io/api/networking/v1"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
@@ -32,12 +32,12 @@ import (
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
metav1apply "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
networkingapiv1beta1apply "k8s.io/client-go/applyconfigurations/networking/v1beta1"
|
||||
networkinginformers "k8s.io/client-go/informers/networking/v1beta1"
|
||||
networkingapiv1apply "k8s.io/client-go/applyconfigurations/networking/v1"
|
||||
networkinginformers "k8s.io/client-go/informers/networking/v1"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||
networkinglisters "k8s.io/client-go/listers/networking/v1beta1"
|
||||
networkinglisters "k8s.io/client-go/listers/networking/v1"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/tools/record"
|
||||
"k8s.io/client-go/util/workqueue"
|
||||
@@ -147,7 +147,7 @@ func (c *Controller) Run(ctx context.Context, workers int) {
|
||||
}
|
||||
|
||||
func (c *Controller) addServiceCIDR(obj interface{}) {
|
||||
cidr, ok := obj.(*networkingapiv1beta1.ServiceCIDR)
|
||||
cidr, ok := obj.(*networkingapiv1.ServiceCIDR)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
@@ -174,7 +174,7 @@ func (c *Controller) deleteServiceCIDR(obj interface{}) {
|
||||
|
||||
// addIPAddress may block a ServiceCIDR deletion
|
||||
func (c *Controller) addIPAddress(obj interface{}) {
|
||||
ip, ok := obj.(*networkingapiv1beta1.IPAddress)
|
||||
ip, ok := obj.(*networkingapiv1.IPAddress)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
@@ -186,13 +186,13 @@ func (c *Controller) addIPAddress(obj interface{}) {
|
||||
|
||||
// deleteIPAddress may unblock a ServiceCIDR deletion
|
||||
func (c *Controller) deleteIPAddress(obj interface{}) {
|
||||
ip, ok := obj.(*networkingapiv1beta1.IPAddress)
|
||||
ip, ok := obj.(*networkingapiv1.IPAddress)
|
||||
if !ok {
|
||||
tombstone, ok := obj.(cache.DeletedFinalStateUnknown)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
ip, ok = tombstone.Obj.(*networkingapiv1beta1.IPAddress)
|
||||
ip, ok = tombstone.Obj.(*networkingapiv1.IPAddress)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
@@ -206,7 +206,7 @@ func (c *Controller) deleteIPAddress(obj interface{}) {
|
||||
// overlappingServiceCIDRs, given a ServiceCIDR return the ServiceCIDRs that contain or are contained,
|
||||
// this is required because adding or removing a CIDR will require to recompute the
|
||||
// state of each ServiceCIDR to check if can be unblocked on deletion.
|
||||
func (c *Controller) overlappingServiceCIDRs(serviceCIDR *networkingapiv1beta1.ServiceCIDR) []string {
|
||||
func (c *Controller) overlappingServiceCIDRs(serviceCIDR *networkingapiv1.ServiceCIDR) []string {
|
||||
result := sets.New[string]()
|
||||
for _, cidr := range serviceCIDR.Spec.CIDRs {
|
||||
if prefix, err := netip.ParsePrefix(cidr); err == nil { // if is empty err will not be nil
|
||||
@@ -222,9 +222,9 @@ func (c *Controller) overlappingServiceCIDRs(serviceCIDR *networkingapiv1beta1.S
|
||||
|
||||
// containingServiceCIDRs, given an IPAddress return the ServiceCIDRs that contains the IP,
|
||||
// as it may block or be blocking the deletion of the ServiceCIDRs that contain it.
|
||||
func (c *Controller) containingServiceCIDRs(ip *networkingapiv1beta1.IPAddress) []string {
|
||||
func (c *Controller) containingServiceCIDRs(ip *networkingapiv1.IPAddress) []string {
|
||||
// only process IPs managed by the kube-apiserver
|
||||
managedBy, ok := ip.Labels[networkingapiv1beta1.LabelManagedBy]
|
||||
managedBy, ok := ip.Labels[networkingapiv1.LabelManagedBy]
|
||||
if !ok || managedBy != ipallocator.ControllerName {
|
||||
return []string{}
|
||||
}
|
||||
@@ -302,15 +302,15 @@ func (c *Controller) sync(ctx context.Context, key string) error {
|
||||
// update the status to indicate why the ServiceCIDR can not be deleted,
|
||||
// it will be reevaludated by an event on any ServiceCIDR or IPAddress related object
|
||||
// that may remove this condition.
|
||||
svcApplyStatus := networkingapiv1beta1apply.ServiceCIDRStatus().WithConditions(
|
||||
svcApplyStatus := networkingapiv1apply.ServiceCIDRStatus().WithConditions(
|
||||
metav1apply.Condition().
|
||||
WithType(networkingapiv1beta1.ServiceCIDRConditionReady).
|
||||
WithType(networkingapiv1.ServiceCIDRConditionReady).
|
||||
WithStatus(metav1.ConditionFalse).
|
||||
WithReason(networkingapiv1beta1.ServiceCIDRReasonTerminating).
|
||||
WithReason(networkingapiv1.ServiceCIDRReasonTerminating).
|
||||
WithMessage("There are still IPAddresses referencing the ServiceCIDR, please remove them or create a new ServiceCIDR").
|
||||
WithLastTransitionTime(metav1.Now()))
|
||||
svcApply := networkingapiv1beta1apply.ServiceCIDR(cidr.Name).WithStatus(svcApplyStatus)
|
||||
_, err = c.client.NetworkingV1beta1().ServiceCIDRs().ApplyStatus(ctx, svcApply, metav1.ApplyOptions{FieldManager: controllerName, Force: true})
|
||||
svcApply := networkingapiv1apply.ServiceCIDR(cidr.Name).WithStatus(svcApplyStatus)
|
||||
_, err = c.client.NetworkingV1().ServiceCIDRs().ApplyStatus(ctx, svcApply, metav1.ApplyOptions{FieldManager: controllerName, Force: true})
|
||||
return err
|
||||
}
|
||||
// If there are no IPAddress depending on this ServiceCIDR is safe to remove it,
|
||||
@@ -333,14 +333,14 @@ func (c *Controller) sync(ctx context.Context, key string) error {
|
||||
}
|
||||
|
||||
// Set Ready condition to True.
|
||||
svcApplyStatus := networkingapiv1beta1apply.ServiceCIDRStatus().WithConditions(
|
||||
svcApplyStatus := networkingapiv1apply.ServiceCIDRStatus().WithConditions(
|
||||
metav1apply.Condition().
|
||||
WithType(networkingapiv1beta1.ServiceCIDRConditionReady).
|
||||
WithType(networkingapiv1.ServiceCIDRConditionReady).
|
||||
WithStatus(metav1.ConditionTrue).
|
||||
WithMessage("Kubernetes Service CIDR is ready").
|
||||
WithLastTransitionTime(metav1.Now()))
|
||||
svcApply := networkingapiv1beta1apply.ServiceCIDR(cidr.Name).WithStatus(svcApplyStatus)
|
||||
if _, err := c.client.NetworkingV1beta1().ServiceCIDRs().ApplyStatus(ctx, svcApply, metav1.ApplyOptions{FieldManager: controllerName, Force: true}); err != nil {
|
||||
svcApply := networkingapiv1apply.ServiceCIDR(cidr.Name).WithStatus(svcApplyStatus)
|
||||
if _, err := c.client.NetworkingV1().ServiceCIDRs().ApplyStatus(ctx, svcApply, metav1.ApplyOptions{FieldManager: controllerName, Force: true}); err != nil {
|
||||
logger.Info("error updating default ServiceCIDR status", "error", err)
|
||||
c.eventRecorder.Eventf(cidr, v1.EventTypeWarning, "KubernetesServiceCIDRError", "The ServiceCIDR Status can not be set to Ready=True")
|
||||
return err
|
||||
@@ -350,7 +350,7 @@ func (c *Controller) sync(ctx context.Context, key string) error {
|
||||
}
|
||||
|
||||
// canDeleteCIDR checks that the ServiceCIDR can be safely deleted and not leave orphan IPAddresses
|
||||
func (c *Controller) canDeleteCIDR(ctx context.Context, serviceCIDR *networkingapiv1beta1.ServiceCIDR) (bool, error) {
|
||||
func (c *Controller) canDeleteCIDR(ctx context.Context, serviceCIDR *networkingapiv1.ServiceCIDR) (bool, error) {
|
||||
logger := klog.FromContext(ctx)
|
||||
// Check if there is a subnet that already contains the ServiceCIDR that is going to be deleted.
|
||||
hasParent := true
|
||||
@@ -379,8 +379,8 @@ func (c *Controller) canDeleteCIDR(ctx context.Context, serviceCIDR *networkinga
|
||||
for _, cidr := range serviceCIDR.Spec.CIDRs {
|
||||
// get all the IPv4 addresses
|
||||
ipLabelSelector := labels.Set(map[string]string{
|
||||
networkingapiv1beta1.LabelIPAddressFamily: string(convertToV1IPFamily(netutils.IPFamilyOfCIDRString(cidr))),
|
||||
networkingapiv1beta1.LabelManagedBy: ipallocator.ControllerName,
|
||||
networkingapiv1.LabelIPAddressFamily: string(convertToV1IPFamily(netutils.IPFamilyOfCIDRString(cidr))),
|
||||
networkingapiv1.LabelManagedBy: ipallocator.ControllerName,
|
||||
}).AsSelectorPreValidated()
|
||||
ips, err := c.ipAddressLister.List(ipLabelSelector)
|
||||
if err != nil {
|
||||
@@ -411,7 +411,7 @@ func (c *Controller) canDeleteCIDR(ctx context.Context, serviceCIDR *networkinga
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func (c *Controller) addServiceCIDRFinalizerIfNeeded(ctx context.Context, cidr *networkingapiv1beta1.ServiceCIDR) error {
|
||||
func (c *Controller) addServiceCIDRFinalizerIfNeeded(ctx context.Context, cidr *networkingapiv1.ServiceCIDR) error {
|
||||
for _, f := range cidr.GetFinalizers() {
|
||||
if f == ServiceCIDRProtectionFinalizer {
|
||||
return nil
|
||||
@@ -427,7 +427,7 @@ func (c *Controller) addServiceCIDRFinalizerIfNeeded(ctx context.Context, cidr *
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = c.client.NetworkingV1beta1().ServiceCIDRs().Patch(ctx, cidr.Name, types.StrategicMergePatchType, patchBytes, metav1.PatchOptions{})
|
||||
_, err = c.client.NetworkingV1().ServiceCIDRs().Patch(ctx, cidr.Name, types.StrategicMergePatchType, patchBytes, metav1.PatchOptions{})
|
||||
if err != nil && !apierrors.IsNotFound(err) {
|
||||
return err
|
||||
}
|
||||
@@ -436,7 +436,7 @@ func (c *Controller) addServiceCIDRFinalizerIfNeeded(ctx context.Context, cidr *
|
||||
|
||||
}
|
||||
|
||||
func (c *Controller) removeServiceCIDRFinalizerIfNeeded(ctx context.Context, cidr *networkingapiv1beta1.ServiceCIDR) error {
|
||||
func (c *Controller) removeServiceCIDRFinalizerIfNeeded(ctx context.Context, cidr *networkingapiv1.ServiceCIDR) error {
|
||||
found := false
|
||||
for _, f := range cidr.GetFinalizers() {
|
||||
if f == ServiceCIDRProtectionFinalizer {
|
||||
@@ -456,7 +456,7 @@ func (c *Controller) removeServiceCIDRFinalizerIfNeeded(ctx context.Context, cid
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = c.client.NetworkingV1beta1().ServiceCIDRs().Patch(ctx, cidr.Name, types.StrategicMergePatchType, patchBytes, metav1.PatchOptions{})
|
||||
_, err = c.client.NetworkingV1().ServiceCIDRs().Patch(ctx, cidr.Name, types.StrategicMergePatchType, patchBytes, metav1.PatchOptions{})
|
||||
if err != nil && !apierrors.IsNotFound(err) {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import (
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/google/go-cmp/cmp/cmpopts"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
networkingapiv1beta1 "k8s.io/api/networking/v1beta1"
|
||||
networkingapiv1 "k8s.io/api/networking/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/informers"
|
||||
"k8s.io/client-go/kubernetes/fake"
|
||||
@@ -44,12 +44,12 @@ type testController struct {
|
||||
ipaddressesStore cache.Store
|
||||
}
|
||||
|
||||
func newController(ctx context.Context, t *testing.T, cidrs []*networkingapiv1beta1.ServiceCIDR, ips []*networkingapiv1beta1.IPAddress) (*fake.Clientset, *testController) {
|
||||
func newController(ctx context.Context, t *testing.T, cidrs []*networkingapiv1.ServiceCIDR, ips []*networkingapiv1.IPAddress) (*fake.Clientset, *testController) {
|
||||
client := fake.NewSimpleClientset()
|
||||
|
||||
informerFactory := informers.NewSharedInformerFactory(client, controller.NoResyncPeriodFunc())
|
||||
|
||||
serviceCIDRInformer := informerFactory.Networking().V1beta1().ServiceCIDRs()
|
||||
serviceCIDRInformer := informerFactory.Networking().V1().ServiceCIDRs()
|
||||
cidrStore := serviceCIDRInformer.Informer().GetStore()
|
||||
for _, obj := range cidrs {
|
||||
err := cidrStore.Add(obj)
|
||||
@@ -57,7 +57,7 @@ func newController(ctx context.Context, t *testing.T, cidrs []*networkingapiv1be
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
ipAddressInformer := informerFactory.Networking().V1beta1().IPAddresses()
|
||||
ipAddressInformer := informerFactory.Networking().V1().IPAddresses()
|
||||
ipStore := ipAddressInformer.Informer().GetStore()
|
||||
for _, obj := range ips {
|
||||
err := ipStore.Add(obj)
|
||||
@@ -97,8 +97,8 @@ func TestControllerSync(t *testing.T) {
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
cidrs []*networkingapiv1beta1.ServiceCIDR
|
||||
ips []*networkingapiv1beta1.IPAddress
|
||||
cidrs []*networkingapiv1.ServiceCIDR
|
||||
ips []*networkingapiv1.IPAddress
|
||||
cidrSynced string
|
||||
actions [][]string // verb and resource and subresource
|
||||
}{
|
||||
@@ -107,7 +107,7 @@ func TestControllerSync(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "default service CIDR must have finalizer",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
},
|
||||
cidrSynced: defaultservicecidr.DefaultServiceCIDRName,
|
||||
@@ -115,7 +115,7 @@ func TestControllerSync(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "service CIDR must have finalizer",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
makeServiceCIDR("no-finalizer", "192.168.0.0/24", "2001:db2::/64"),
|
||||
},
|
||||
cidrSynced: "no-finalizer",
|
||||
@@ -123,7 +123,7 @@ func TestControllerSync(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "service CIDR being deleted must remove the finalizer",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
deletedServiceCIDR,
|
||||
},
|
||||
cidrSynced: deletedServiceCIDR.Name,
|
||||
@@ -131,7 +131,7 @@ func TestControllerSync(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "service CIDR being deleted but within the grace period must be requeued not remove the finalizer", // TODO: assert is actually requeued
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
deletingServiceCIDR,
|
||||
},
|
||||
cidrSynced: deletingServiceCIDR.Name,
|
||||
@@ -139,10 +139,10 @@ func TestControllerSync(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "service CIDR being deleted with IPv4 addresses should update the status",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
deletedServiceCIDR,
|
||||
},
|
||||
ips: []*networkingapiv1beta1.IPAddress{
|
||||
ips: []*networkingapiv1.IPAddress{
|
||||
makeIPAddress("192.168.0.1"),
|
||||
},
|
||||
cidrSynced: deletedServiceCIDR.Name,
|
||||
@@ -150,11 +150,11 @@ func TestControllerSync(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "service CIDR being deleted and overlapping same range and IPv4 addresses should remove the finalizer",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
deletedServiceCIDR,
|
||||
makeServiceCIDR("overlapping", "192.168.0.0/24", "2001:db2::/64"),
|
||||
},
|
||||
ips: []*networkingapiv1beta1.IPAddress{
|
||||
ips: []*networkingapiv1.IPAddress{
|
||||
makeIPAddress("192.168.0.1"),
|
||||
},
|
||||
cidrSynced: deletedServiceCIDR.Name,
|
||||
@@ -162,11 +162,11 @@ func TestControllerSync(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "service CIDR being deleted and overlapping and IPv4 addresses should remove the finalizer",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
deletedServiceCIDR,
|
||||
makeServiceCIDR("overlapping", "192.168.0.0/16", "2001:db2::/64"),
|
||||
},
|
||||
ips: []*networkingapiv1beta1.IPAddress{
|
||||
ips: []*networkingapiv1.IPAddress{
|
||||
makeIPAddress("192.168.0.1"),
|
||||
},
|
||||
cidrSynced: deletedServiceCIDR.Name,
|
||||
@@ -174,11 +174,11 @@ func TestControllerSync(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "service CIDR being deleted and not overlapping and IPv4 addresses should update the status",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
deletedServiceCIDR,
|
||||
makeServiceCIDR("overlapping", "192.168.255.0/26", "2001:db2::/64"),
|
||||
},
|
||||
ips: []*networkingapiv1beta1.IPAddress{
|
||||
ips: []*networkingapiv1.IPAddress{
|
||||
makeIPAddress("192.168.0.1"),
|
||||
},
|
||||
cidrSynced: deletedServiceCIDR.Name,
|
||||
@@ -186,10 +186,10 @@ func TestControllerSync(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "service CIDR being deleted with IPv6 addresses should update the status",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
deletedServiceCIDR,
|
||||
},
|
||||
ips: []*networkingapiv1beta1.IPAddress{
|
||||
ips: []*networkingapiv1.IPAddress{
|
||||
makeIPAddress("2001:db2::1"),
|
||||
},
|
||||
cidrSynced: deletedServiceCIDR.Name,
|
||||
@@ -197,11 +197,11 @@ func TestControllerSync(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "service CIDR being deleted and overlapping same range and IPv6 addresses should remove the finalizer",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
deletedServiceCIDR,
|
||||
makeServiceCIDR("overlapping", "192.168.0.0/24", "2001:db2::/64"),
|
||||
},
|
||||
ips: []*networkingapiv1beta1.IPAddress{
|
||||
ips: []*networkingapiv1.IPAddress{
|
||||
makeIPAddress("2001:db2::1"),
|
||||
},
|
||||
cidrSynced: deletedServiceCIDR.Name,
|
||||
@@ -209,11 +209,11 @@ func TestControllerSync(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "service CIDR being deleted and overlapping and IPv6 addresses should remove the finalizer",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
deletedServiceCIDR,
|
||||
makeServiceCIDR("overlapping", "192.168.0.0/16", "2001:db2::/48"),
|
||||
},
|
||||
ips: []*networkingapiv1beta1.IPAddress{
|
||||
ips: []*networkingapiv1.IPAddress{
|
||||
makeIPAddress("2001:db2::1"),
|
||||
},
|
||||
cidrSynced: deletedServiceCIDR.Name,
|
||||
@@ -221,11 +221,11 @@ func TestControllerSync(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "service CIDR being deleted and not overlapping and IPv6 addresses should update the status",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
deletedServiceCIDR,
|
||||
makeServiceCIDR("overlapping", "192.168.255.0/26", "2001:db2:a:b::/64"),
|
||||
},
|
||||
ips: []*networkingapiv1beta1.IPAddress{
|
||||
ips: []*networkingapiv1.IPAddress{
|
||||
makeIPAddress("2001:db2::1"),
|
||||
},
|
||||
cidrSynced: deletedServiceCIDR.Name,
|
||||
@@ -247,12 +247,12 @@ func TestControllerSync(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func makeServiceCIDR(name, primary, secondary string) *networkingapiv1beta1.ServiceCIDR {
|
||||
serviceCIDR := &networkingapiv1beta1.ServiceCIDR{
|
||||
func makeServiceCIDR(name, primary, secondary string) *networkingapiv1.ServiceCIDR {
|
||||
serviceCIDR := &networkingapiv1.ServiceCIDR{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
},
|
||||
Spec: networkingapiv1beta1.ServiceCIDRSpec{},
|
||||
Spec: networkingapiv1.ServiceCIDRSpec{},
|
||||
}
|
||||
serviceCIDR.Spec.CIDRs = append(serviceCIDR.Spec.CIDRs, primary)
|
||||
if secondary != "" {
|
||||
@@ -261,17 +261,17 @@ func makeServiceCIDR(name, primary, secondary string) *networkingapiv1beta1.Serv
|
||||
return serviceCIDR
|
||||
}
|
||||
|
||||
func makeIPAddress(name string) *networkingapiv1beta1.IPAddress {
|
||||
func makeIPAddress(name string) *networkingapiv1.IPAddress {
|
||||
family := string(v1.IPv4Protocol)
|
||||
if netutils.IsIPv6String(name) {
|
||||
family = string(v1.IPv6Protocol)
|
||||
}
|
||||
return &networkingapiv1beta1.IPAddress{
|
||||
return &networkingapiv1.IPAddress{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
Labels: map[string]string{
|
||||
networkingapiv1beta1.LabelIPAddressFamily: family,
|
||||
networkingapiv1beta1.LabelManagedBy: ipallocator.ControllerName,
|
||||
networkingapiv1.LabelIPAddressFamily: family,
|
||||
networkingapiv1.LabelManagedBy: ipallocator.ControllerName,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -302,9 +302,9 @@ func expectAction(t *testing.T, actions []k8stesting.Action, expected [][]string
|
||||
func TestController_canDeleteCIDR(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
cidrs []*networkingapiv1beta1.ServiceCIDR
|
||||
ips []*networkingapiv1beta1.IPAddress
|
||||
cidrSynced *networkingapiv1beta1.ServiceCIDR
|
||||
cidrs []*networkingapiv1.ServiceCIDR
|
||||
ips []*networkingapiv1.IPAddress
|
||||
cidrSynced *networkingapiv1.ServiceCIDR
|
||||
want bool
|
||||
}{
|
||||
{
|
||||
@@ -314,7 +314,7 @@ func TestController_canDeleteCIDR(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "CIDR and no IPs",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
},
|
||||
cidrSynced: makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
@@ -322,10 +322,10 @@ func TestController_canDeleteCIDR(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "CIDR with IPs",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
},
|
||||
ips: []*networkingapiv1beta1.IPAddress{
|
||||
ips: []*networkingapiv1.IPAddress{
|
||||
makeIPAddress("192.168.0.24"),
|
||||
},
|
||||
cidrSynced: makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
@@ -333,10 +333,10 @@ func TestController_canDeleteCIDR(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "CIDR without IPs",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
},
|
||||
ips: []*networkingapiv1beta1.IPAddress{
|
||||
ips: []*networkingapiv1.IPAddress{
|
||||
makeIPAddress("192.168.1.24"),
|
||||
},
|
||||
cidrSynced: makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
@@ -344,10 +344,10 @@ func TestController_canDeleteCIDR(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "CIDR with IPv4 address referencing the subnet address",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
},
|
||||
ips: []*networkingapiv1beta1.IPAddress{
|
||||
ips: []*networkingapiv1.IPAddress{
|
||||
makeIPAddress("192.168.0.0"),
|
||||
},
|
||||
cidrSynced: makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
@@ -355,10 +355,10 @@ func TestController_canDeleteCIDR(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "CIDR with IPv4 address referencing the broadcast address",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
},
|
||||
ips: []*networkingapiv1beta1.IPAddress{
|
||||
ips: []*networkingapiv1.IPAddress{
|
||||
makeIPAddress("192.168.0.255"),
|
||||
},
|
||||
cidrSynced: makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
@@ -366,10 +366,10 @@ func TestController_canDeleteCIDR(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "CIDR with IPv6 address referencing the broadcast address",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
},
|
||||
ips: []*networkingapiv1beta1.IPAddress{
|
||||
ips: []*networkingapiv1.IPAddress{
|
||||
makeIPAddress("2001:0db2::ffff:ffff:ffff:ffff"),
|
||||
},
|
||||
cidrSynced: makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
@@ -377,11 +377,11 @@ func TestController_canDeleteCIDR(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "CIDR with same range overlapping and IPs",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
makeServiceCIDR("overlapping", "192.168.0.0/24", "2001:db2::/64"),
|
||||
},
|
||||
ips: []*networkingapiv1beta1.IPAddress{
|
||||
ips: []*networkingapiv1.IPAddress{
|
||||
makeIPAddress("192.168.0.23"),
|
||||
},
|
||||
cidrSynced: makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
@@ -389,11 +389,11 @@ func TestController_canDeleteCIDR(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "CIDR with smaller range overlapping and IPs",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
makeServiceCIDR("overlapping", "192.168.0.0/26", "2001:db2::/64"),
|
||||
},
|
||||
ips: []*networkingapiv1beta1.IPAddress{
|
||||
ips: []*networkingapiv1.IPAddress{
|
||||
makeIPAddress("192.168.0.23"),
|
||||
},
|
||||
cidrSynced: makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
@@ -401,11 +401,11 @@ func TestController_canDeleteCIDR(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "CIDR with smaller range overlapping but IPs orphan",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
makeServiceCIDR("overlapping", "192.168.0.0/28", "2001:db2::/64"),
|
||||
},
|
||||
ips: []*networkingapiv1beta1.IPAddress{
|
||||
ips: []*networkingapiv1.IPAddress{
|
||||
makeIPAddress("192.168.0.23"),
|
||||
},
|
||||
cidrSynced: makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
@@ -413,11 +413,11 @@ func TestController_canDeleteCIDR(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "CIDR with larger range overlapping and IPs",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
makeServiceCIDR("overlapping", "192.168.0.0/16", "2001:db2::/64"),
|
||||
},
|
||||
ips: []*networkingapiv1beta1.IPAddress{
|
||||
ips: []*networkingapiv1.IPAddress{
|
||||
makeIPAddress("192.168.0.23"),
|
||||
},
|
||||
cidrSynced: makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
@@ -442,8 +442,8 @@ func TestController_canDeleteCIDR(t *testing.T) {
|
||||
func TestController_ipToCidrs(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
cidrs []*networkingapiv1beta1.ServiceCIDR
|
||||
ip *networkingapiv1beta1.IPAddress
|
||||
cidrs []*networkingapiv1.ServiceCIDR
|
||||
ip *networkingapiv1.IPAddress
|
||||
want []string
|
||||
}{
|
||||
{
|
||||
@@ -452,7 +452,7 @@ func TestController_ipToCidrs(t *testing.T) {
|
||||
want: []string{},
|
||||
}, {
|
||||
name: "one CIDR",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
makeServiceCIDR("unrelated", "10.0.0.0/24", ""),
|
||||
makeServiceCIDR("unrelated2", "10.0.0.0/16", ""),
|
||||
@@ -461,7 +461,7 @@ func TestController_ipToCidrs(t *testing.T) {
|
||||
want: []string{defaultservicecidr.DefaultServiceCIDRName},
|
||||
}, {
|
||||
name: "two equal CIDR",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
makeServiceCIDR("overlapping", "192.168.0.0/24", "2001:db2::/96"),
|
||||
makeServiceCIDR("unrelated", "10.0.0.0/24", ""),
|
||||
@@ -471,7 +471,7 @@ func TestController_ipToCidrs(t *testing.T) {
|
||||
want: []string{defaultservicecidr.DefaultServiceCIDRName, "overlapping"},
|
||||
}, {
|
||||
name: "three CIDR - two same and one larger",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
makeServiceCIDR("overlapping", "192.168.0.0/24", "2001:db2::/64"),
|
||||
makeServiceCIDR("overlapping2", "192.168.0.0/26", "2001:db2::/96"),
|
||||
@@ -482,7 +482,7 @@ func TestController_ipToCidrs(t *testing.T) {
|
||||
want: []string{defaultservicecidr.DefaultServiceCIDRName, "overlapping", "overlapping2"},
|
||||
}, {
|
||||
name: "three CIDR - two same and one larger - IPv4 subnet address",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
makeServiceCIDR("overlapping", "192.168.0.0/24", "2001:db2::/64"),
|
||||
makeServiceCIDR("overlapping2", "192.168.0.0/26", "2001:db2::/96"),
|
||||
@@ -493,7 +493,7 @@ func TestController_ipToCidrs(t *testing.T) {
|
||||
want: []string{},
|
||||
}, {
|
||||
name: "three CIDR - two same and one larger - IPv4 broadcast address",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
makeServiceCIDR("overlapping", "192.168.0.0/24", "2001:db2::/64"),
|
||||
makeServiceCIDR("overlapping2", "192.168.0.0/26", "2001:db2::/96"),
|
||||
@@ -504,7 +504,7 @@ func TestController_ipToCidrs(t *testing.T) {
|
||||
want: []string{defaultservicecidr.DefaultServiceCIDRName, "overlapping"},
|
||||
}, {
|
||||
name: "three CIDR - two same and one larger - IPv6 subnet address",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
makeServiceCIDR("overlapping", "192.168.0.0/24", "2001:db2::/64"),
|
||||
makeServiceCIDR("overlapping2", "192.168.0.0/26", "2001:db2::/96"),
|
||||
@@ -515,7 +515,7 @@ func TestController_ipToCidrs(t *testing.T) {
|
||||
want: []string{},
|
||||
}, {
|
||||
name: "three CIDR - two same and one larger - IPv6 broadcast address",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
makeServiceCIDR("overlapping", "192.168.0.0/24", "2001:db2::/64"),
|
||||
makeServiceCIDR("overlapping2", "192.168.0.0/26", "2001:db2::/96"),
|
||||
@@ -539,8 +539,8 @@ func TestController_ipToCidrs(t *testing.T) {
|
||||
func TestController_cidrToCidrs(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
cidrs []*networkingapiv1beta1.ServiceCIDR
|
||||
cidr *networkingapiv1beta1.ServiceCIDR
|
||||
cidrs []*networkingapiv1.ServiceCIDR
|
||||
cidr *networkingapiv1.ServiceCIDR
|
||||
want []string
|
||||
}{
|
||||
{
|
||||
@@ -549,7 +549,7 @@ func TestController_cidrToCidrs(t *testing.T) {
|
||||
want: []string{},
|
||||
}, {
|
||||
name: "one CIDR",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
makeServiceCIDR("unrelated", "10.0.0.0/24", ""),
|
||||
makeServiceCIDR("unrelated2", "10.0.0.0/16", ""),
|
||||
@@ -558,7 +558,7 @@ func TestController_cidrToCidrs(t *testing.T) {
|
||||
want: []string{defaultservicecidr.DefaultServiceCIDRName},
|
||||
}, {
|
||||
name: "two equal CIDR",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
makeServiceCIDR("overlapping", "192.168.0.0/24", "2001:db2::/96"),
|
||||
makeServiceCIDR("unrelated", "10.0.0.0/24", ""),
|
||||
@@ -568,7 +568,7 @@ func TestController_cidrToCidrs(t *testing.T) {
|
||||
want: []string{defaultservicecidr.DefaultServiceCIDRName, "overlapping"},
|
||||
}, {
|
||||
name: "three CIDR - two same and one larger",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
|
||||
makeServiceCIDR("overlapping", "192.168.0.0/24", "2001:db2::/64"),
|
||||
makeServiceCIDR("overlapping2", "192.168.0.0/26", "2001:db2::/96"),
|
||||
|
||||
@@ -23,19 +23,19 @@ import (
|
||||
"time"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
networkingapiv1beta1 "k8s.io/api/networking/v1beta1"
|
||||
networkingapiv1 "k8s.io/api/networking/v1"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/fields"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
metav1apply "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
networkingapiv1beta1apply "k8s.io/client-go/applyconfigurations/networking/v1beta1"
|
||||
networkingv1beta1informers "k8s.io/client-go/informers/networking/v1beta1"
|
||||
networkingapiv1apply "k8s.io/client-go/applyconfigurations/networking/v1"
|
||||
networkingv1informers "k8s.io/client-go/informers/networking/v1"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||
networkingv1beta1listers "k8s.io/client-go/listers/networking/v1beta1"
|
||||
networkingv1listers "k8s.io/client-go/listers/networking/v1"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/tools/record"
|
||||
"k8s.io/klog/v2"
|
||||
@@ -67,13 +67,13 @@ func NewController(
|
||||
}
|
||||
// instead of using the shared informers from the controlplane instance, we construct our own informer
|
||||
// because we need such a small subset of the information available, only the kubernetes.default ServiceCIDR
|
||||
c.serviceCIDRInformer = networkingv1beta1informers.NewFilteredServiceCIDRInformer(client, 12*time.Hour,
|
||||
c.serviceCIDRInformer = networkingv1informers.NewFilteredServiceCIDRInformer(client, 12*time.Hour,
|
||||
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
|
||||
func(options *metav1.ListOptions) {
|
||||
options.FieldSelector = fields.OneTermEqualSelector("metadata.name", DefaultServiceCIDRName).String()
|
||||
})
|
||||
|
||||
c.serviceCIDRLister = networkingv1beta1listers.NewServiceCIDRLister(c.serviceCIDRInformer.GetIndexer())
|
||||
c.serviceCIDRLister = networkingv1listers.NewServiceCIDRLister(c.serviceCIDRInformer.GetIndexer())
|
||||
c.serviceCIDRsSynced = c.serviceCIDRInformer.HasSynced
|
||||
|
||||
return c
|
||||
@@ -88,7 +88,7 @@ type Controller struct {
|
||||
eventRecorder record.EventRecorder
|
||||
|
||||
serviceCIDRInformer cache.SharedIndexInformer
|
||||
serviceCIDRLister networkingv1beta1listers.ServiceCIDRLister
|
||||
serviceCIDRLister networkingv1listers.ServiceCIDRLister
|
||||
serviceCIDRsSynced cache.InformerSynced
|
||||
|
||||
interval time.Duration
|
||||
@@ -149,15 +149,15 @@ func (c *Controller) sync() error {
|
||||
|
||||
// default ServiceCIDR does not exist
|
||||
klog.Infof("Creating default ServiceCIDR with CIDRs: %v", c.cidrs)
|
||||
serviceCIDR = &networkingapiv1beta1.ServiceCIDR{
|
||||
serviceCIDR = &networkingapiv1.ServiceCIDR{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: DefaultServiceCIDRName,
|
||||
},
|
||||
Spec: networkingapiv1beta1.ServiceCIDRSpec{
|
||||
Spec: networkingapiv1.ServiceCIDRSpec{
|
||||
CIDRs: c.cidrs,
|
||||
},
|
||||
}
|
||||
serviceCIDR, err = c.client.NetworkingV1beta1().ServiceCIDRs().Create(context.Background(), serviceCIDR, metav1.CreateOptions{})
|
||||
serviceCIDR, err = c.client.NetworkingV1().ServiceCIDRs().Create(context.Background(), serviceCIDR, metav1.CreateOptions{})
|
||||
if err != nil && !apierrors.IsAlreadyExists(err) {
|
||||
c.eventRecorder.Eventf(serviceCIDR, v1.EventTypeWarning, "KubernetesDefaultServiceCIDRError", "The default ServiceCIDR can not be created")
|
||||
return err
|
||||
@@ -166,7 +166,7 @@ func (c *Controller) sync() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Controller) syncStatus(serviceCIDR *networkingapiv1beta1.ServiceCIDR) {
|
||||
func (c *Controller) syncStatus(serviceCIDR *networkingapiv1.ServiceCIDR) {
|
||||
// don't sync the status of the ServiceCIDR if is being deleted,
|
||||
// deletion must be handled by the controller-manager
|
||||
if !serviceCIDR.GetDeletionTimestamp().IsZero() {
|
||||
@@ -176,7 +176,7 @@ func (c *Controller) syncStatus(serviceCIDR *networkingapiv1beta1.ServiceCIDR) {
|
||||
// This controller will set the Ready condition to true if the Ready condition
|
||||
// does not exist and the CIDR values match this controller CIDR values.
|
||||
for _, condition := range serviceCIDR.Status.Conditions {
|
||||
if condition.Type == networkingapiv1beta1.ServiceCIDRConditionReady {
|
||||
if condition.Type == networkingapiv1.ServiceCIDRConditionReady {
|
||||
if condition.Status == metav1.ConditionTrue {
|
||||
return
|
||||
}
|
||||
@@ -188,14 +188,14 @@ func (c *Controller) syncStatus(serviceCIDR *networkingapiv1beta1.ServiceCIDR) {
|
||||
// set status to ready if the ServiceCIDR matches this configuration
|
||||
if reflect.DeepEqual(c.cidrs, serviceCIDR.Spec.CIDRs) {
|
||||
klog.Infof("Setting default ServiceCIDR condition Ready to True")
|
||||
svcApplyStatus := networkingapiv1beta1apply.ServiceCIDRStatus().WithConditions(
|
||||
svcApplyStatus := networkingapiv1apply.ServiceCIDRStatus().WithConditions(
|
||||
metav1apply.Condition().
|
||||
WithType(networkingapiv1beta1.ServiceCIDRConditionReady).
|
||||
WithType(networkingapiv1.ServiceCIDRConditionReady).
|
||||
WithStatus(metav1.ConditionTrue).
|
||||
WithMessage("Kubernetes default Service CIDR is ready").
|
||||
WithLastTransitionTime(metav1.Now()))
|
||||
svcApply := networkingapiv1beta1apply.ServiceCIDR(DefaultServiceCIDRName).WithStatus(svcApplyStatus)
|
||||
if _, errApply := c.client.NetworkingV1beta1().ServiceCIDRs().ApplyStatus(context.Background(), svcApply, metav1.ApplyOptions{FieldManager: controllerName, Force: true}); errApply != nil {
|
||||
svcApply := networkingapiv1apply.ServiceCIDR(DefaultServiceCIDRName).WithStatus(svcApplyStatus)
|
||||
if _, errApply := c.client.NetworkingV1().ServiceCIDRs().ApplyStatus(context.Background(), svcApply, metav1.ApplyOptions{FieldManager: controllerName, Force: true}); errApply != nil {
|
||||
klog.Infof("error updating default ServiceCIDR status: %v", errApply)
|
||||
c.eventRecorder.Eventf(serviceCIDR, v1.EventTypeWarning, "KubernetesDefaultServiceCIDRError", "The default ServiceCIDR Status can not be set to Ready=True")
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
networkingapiv1beta1 "k8s.io/api/networking/v1beta1"
|
||||
networkingapiv1 "k8s.io/api/networking/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/informers"
|
||||
"k8s.io/client-go/kubernetes/fake"
|
||||
@@ -35,11 +35,11 @@ const (
|
||||
defaultIPv6CIDR = "2001:db8::/64"
|
||||
)
|
||||
|
||||
func newController(t *testing.T, objects []*networkingapiv1beta1.ServiceCIDR) (*fake.Clientset, *Controller) {
|
||||
func newController(t *testing.T, objects []*networkingapiv1.ServiceCIDR) (*fake.Clientset, *Controller) {
|
||||
client := fake.NewSimpleClientset()
|
||||
|
||||
informerFactory := informers.NewSharedInformerFactory(client, 0)
|
||||
serviceCIDRInformer := informerFactory.Networking().V1beta1().ServiceCIDRs()
|
||||
serviceCIDRInformer := informerFactory.Networking().V1().ServiceCIDRs()
|
||||
|
||||
store := serviceCIDRInformer.Informer().GetStore()
|
||||
for _, obj := range objects {
|
||||
@@ -64,7 +64,7 @@ func newController(t *testing.T, objects []*networkingapiv1beta1.ServiceCIDR) (*
|
||||
func TestControllerSync(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
cidrs []*networkingapiv1beta1.ServiceCIDR
|
||||
cidrs []*networkingapiv1.ServiceCIDR
|
||||
actions [][]string // verb and resource
|
||||
}{
|
||||
{
|
||||
@@ -73,12 +73,12 @@ func TestControllerSync(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "existing default service CIDR update Ready condition",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: DefaultServiceCIDRName,
|
||||
},
|
||||
Spec: networkingapiv1beta1.ServiceCIDRSpec{
|
||||
Spec: networkingapiv1.ServiceCIDRSpec{
|
||||
CIDRs: []string{defaultIPv4CIDR, defaultIPv6CIDR},
|
||||
},
|
||||
},
|
||||
@@ -87,12 +87,12 @@ func TestControllerSync(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "existing default service CIDR not matching cidrs",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: DefaultServiceCIDRName,
|
||||
},
|
||||
Spec: networkingapiv1beta1.ServiceCIDRSpec{
|
||||
Spec: networkingapiv1.ServiceCIDRSpec{
|
||||
CIDRs: []string{"fd00::/112"},
|
||||
},
|
||||
},
|
||||
@@ -100,18 +100,18 @@ func TestControllerSync(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "existing default service CIDR not ready",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: DefaultServiceCIDRName,
|
||||
},
|
||||
Spec: networkingapiv1beta1.ServiceCIDRSpec{
|
||||
Spec: networkingapiv1.ServiceCIDRSpec{
|
||||
CIDRs: []string{defaultIPv4CIDR, defaultIPv6CIDR},
|
||||
},
|
||||
Status: networkingapiv1beta1.ServiceCIDRStatus{
|
||||
Status: networkingapiv1.ServiceCIDRStatus{
|
||||
Conditions: []metav1.Condition{
|
||||
{
|
||||
Type: string(networkingapiv1beta1.ServiceCIDRConditionReady),
|
||||
Type: string(networkingapiv1.ServiceCIDRConditionReady),
|
||||
Status: metav1.ConditionFalse,
|
||||
},
|
||||
},
|
||||
@@ -121,13 +121,13 @@ func TestControllerSync(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "existing default service CIDR being deleted",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: DefaultServiceCIDRName,
|
||||
DeletionTimestamp: ptr.To(metav1.Now()),
|
||||
},
|
||||
Spec: networkingapiv1beta1.ServiceCIDRSpec{
|
||||
Spec: networkingapiv1.ServiceCIDRSpec{
|
||||
CIDRs: []string{defaultIPv4CIDR, defaultIPv6CIDR},
|
||||
},
|
||||
},
|
||||
@@ -135,12 +135,12 @@ func TestControllerSync(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "existing service CIDRs but not default",
|
||||
cidrs: []*networkingapiv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingapiv1.ServiceCIDR{
|
||||
{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "non-default-cidr",
|
||||
},
|
||||
Spec: networkingapiv1beta1.ServiceCIDRSpec{
|
||||
Spec: networkingapiv1.ServiceCIDRSpec{
|
||||
CIDRs: []string{defaultIPv4CIDR, defaultIPv6CIDR},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -62,6 +62,8 @@ var GVRToStorageVersionHash = map[string]string{
|
||||
"networking.k8s.io/v1/networkpolicies": "YpfwF18m1G8=",
|
||||
"networking.k8s.io/v1/ingresses": "39NQlfNR+bo=",
|
||||
"networking.k8s.io/v1/ingressclasses": "l/iqIbDgFyQ=",
|
||||
"networking.k8s.io/v1/ipaddresses": "O4H8VxQhW5Y=",
|
||||
"networking.k8s.io/v1/servicecidrs": "8ufAXOnr3Yg=",
|
||||
"node.k8s.io/v1/runtimeclasses": "WQTu1GL3T2Q=",
|
||||
"policy/v1/poddisruptionbudgets": "EVWiDmWqyJw=",
|
||||
"rbac.authorization.k8s.io/v1/clusterrolebindings": "48tpQ8gZHFc=",
|
||||
|
||||
@@ -159,7 +159,8 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate
|
||||
},
|
||||
|
||||
DisableAllocatorDualWrite: {
|
||||
{Version: version.MustParse("1.31"), Default: false, PreRelease: featuregate.Alpha}, // remove after MultiCIDRServiceAllocator is GA
|
||||
{Version: version.MustParse("1.31"), Default: false, PreRelease: featuregate.Alpha},
|
||||
{Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Beta}, // remove after MultiCIDRServiceAllocator is GA
|
||||
},
|
||||
|
||||
DisableCloudProviders: {
|
||||
@@ -526,6 +527,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate
|
||||
MultiCIDRServiceAllocator: {
|
||||
{Version: version.MustParse("1.27"), Default: false, PreRelease: featuregate.Alpha},
|
||||
{Version: version.MustParse("1.31"), Default: false, PreRelease: featuregate.Beta},
|
||||
{Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.GA, LockToDefault: false}, // remove in 1.36
|
||||
},
|
||||
|
||||
NFTablesProxyMode: {
|
||||
|
||||
339
pkg/generated/openapi/zz_generated.openapi.go
generated
339
pkg/generated/openapi/zz_generated.openapi.go
generated
@@ -783,6 +783,9 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
|
||||
"k8s.io/api/imagepolicy/v1alpha1.ImageReviewStatus": schema_k8sio_api_imagepolicy_v1alpha1_ImageReviewStatus(ref),
|
||||
"k8s.io/api/networking/v1.HTTPIngressPath": schema_k8sio_api_networking_v1_HTTPIngressPath(ref),
|
||||
"k8s.io/api/networking/v1.HTTPIngressRuleValue": schema_k8sio_api_networking_v1_HTTPIngressRuleValue(ref),
|
||||
"k8s.io/api/networking/v1.IPAddress": schema_k8sio_api_networking_v1_IPAddress(ref),
|
||||
"k8s.io/api/networking/v1.IPAddressList": schema_k8sio_api_networking_v1_IPAddressList(ref),
|
||||
"k8s.io/api/networking/v1.IPAddressSpec": schema_k8sio_api_networking_v1_IPAddressSpec(ref),
|
||||
"k8s.io/api/networking/v1.IPBlock": schema_k8sio_api_networking_v1_IPBlock(ref),
|
||||
"k8s.io/api/networking/v1.Ingress": schema_k8sio_api_networking_v1_Ingress(ref),
|
||||
"k8s.io/api/networking/v1.IngressBackend": schema_k8sio_api_networking_v1_IngressBackend(ref),
|
||||
@@ -807,7 +810,12 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
|
||||
"k8s.io/api/networking/v1.NetworkPolicyPeer": schema_k8sio_api_networking_v1_NetworkPolicyPeer(ref),
|
||||
"k8s.io/api/networking/v1.NetworkPolicyPort": schema_k8sio_api_networking_v1_NetworkPolicyPort(ref),
|
||||
"k8s.io/api/networking/v1.NetworkPolicySpec": schema_k8sio_api_networking_v1_NetworkPolicySpec(ref),
|
||||
"k8s.io/api/networking/v1.ParentReference": schema_k8sio_api_networking_v1_ParentReference(ref),
|
||||
"k8s.io/api/networking/v1.ServiceBackendPort": schema_k8sio_api_networking_v1_ServiceBackendPort(ref),
|
||||
"k8s.io/api/networking/v1.ServiceCIDR": schema_k8sio_api_networking_v1_ServiceCIDR(ref),
|
||||
"k8s.io/api/networking/v1.ServiceCIDRList": schema_k8sio_api_networking_v1_ServiceCIDRList(ref),
|
||||
"k8s.io/api/networking/v1.ServiceCIDRSpec": schema_k8sio_api_networking_v1_ServiceCIDRSpec(ref),
|
||||
"k8s.io/api/networking/v1.ServiceCIDRStatus": schema_k8sio_api_networking_v1_ServiceCIDRStatus(ref),
|
||||
"k8s.io/api/networking/v1alpha1.IPAddress": schema_k8sio_api_networking_v1alpha1_IPAddress(ref),
|
||||
"k8s.io/api/networking/v1alpha1.IPAddressList": schema_k8sio_api_networking_v1alpha1_IPAddressList(ref),
|
||||
"k8s.io/api/networking/v1alpha1.IPAddressSpec": schema_k8sio_api_networking_v1alpha1_IPAddressSpec(ref),
|
||||
@@ -40718,6 +40726,122 @@ func schema_k8sio_api_networking_v1_HTTPIngressRuleValue(ref common.ReferenceCal
|
||||
}
|
||||
}
|
||||
|
||||
func schema_k8sio_api_networking_v1_IPAddress(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "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: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"kind": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
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{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"apiVersion": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
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{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"metadata": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
|
||||
},
|
||||
},
|
||||
"spec": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "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",
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("k8s.io/api/networking/v1.IPAddressSpec"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"k8s.io/api/networking/v1.IPAddressSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_k8sio_api_networking_v1_IPAddressList(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "IPAddressList contains a list of IPAddress.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"kind": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
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{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"apiVersion": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
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{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"metadata": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
|
||||
},
|
||||
},
|
||||
"items": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "items is the list of IPAddresses.",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("k8s.io/api/networking/v1.IPAddress"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"items"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"k8s.io/api/networking/v1.IPAddress", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_k8sio_api_networking_v1_IPAddressSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "IPAddressSpec describe the attributes in an IP Address.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"parentRef": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "ParentRef references the resource that an IPAddress is attached to. An IPAddress must reference a parent object.",
|
||||
Ref: ref("k8s.io/api/networking/v1.ParentReference"),
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"parentRef"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"k8s.io/api/networking/v1.ParentReference"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_k8sio_api_networking_v1_IPBlock(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
@@ -41738,6 +41862,48 @@ func schema_k8sio_api_networking_v1_NetworkPolicySpec(ref common.ReferenceCallba
|
||||
}
|
||||
}
|
||||
|
||||
func schema_k8sio_api_networking_v1_ParentReference(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "ParentReference describes a reference to a parent object.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"group": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Group is the group of the object being referenced.",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"resource": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Resource is the resource of the object being referenced.",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"namespace": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Namespace is the namespace of the object being referenced.",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"name": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Name is the name of the object being referenced.",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"resource", "name"},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_k8sio_api_networking_v1_ServiceBackendPort(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
@@ -41770,6 +41936,179 @@ func schema_k8sio_api_networking_v1_ServiceBackendPort(ref common.ReferenceCallb
|
||||
}
|
||||
}
|
||||
|
||||
func schema_k8sio_api_networking_v1_ServiceCIDR(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "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: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"kind": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
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{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"apiVersion": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
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{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"metadata": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
|
||||
},
|
||||
},
|
||||
"spec": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "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",
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("k8s.io/api/networking/v1.ServiceCIDRSpec"),
|
||||
},
|
||||
},
|
||||
"status": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "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",
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("k8s.io/api/networking/v1.ServiceCIDRStatus"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"k8s.io/api/networking/v1.ServiceCIDRSpec", "k8s.io/api/networking/v1.ServiceCIDRStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_k8sio_api_networking_v1_ServiceCIDRList(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "ServiceCIDRList contains a list of ServiceCIDR objects.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"kind": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
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{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"apiVersion": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
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{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"metadata": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
|
||||
},
|
||||
},
|
||||
"items": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "items is the list of ServiceCIDRs.",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("k8s.io/api/networking/v1.ServiceCIDR"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"items"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"k8s.io/api/networking/v1.ServiceCIDR", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_k8sio_api_networking_v1_ServiceCIDRSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "ServiceCIDRSpec define the CIDRs the user wants to use for allocating ClusterIPs for Services.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"cidrs": {
|
||||
VendorExtensible: spec.VendorExtensible{
|
||||
Extensions: spec.Extensions{
|
||||
"x-kubernetes-list-type": "atomic",
|
||||
},
|
||||
},
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "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.",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_k8sio_api_networking_v1_ServiceCIDRStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "ServiceCIDRStatus describes the current state of the ServiceCIDR.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"conditions": {
|
||||
VendorExtensible: spec.VendorExtensible{
|
||||
Extensions: spec.Extensions{
|
||||
"x-kubernetes-list-map-keys": []interface{}{
|
||||
"type",
|
||||
},
|
||||
"x-kubernetes-list-type": "map",
|
||||
"x-kubernetes-patch-merge-key": "type",
|
||||
"x-kubernetes-patch-strategy": "merge",
|
||||
},
|
||||
},
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "conditions holds an array of metav1.Condition that describe the state of the ServiceCIDR. Current service state",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Condition"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.Condition"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_k8sio_api_networking_v1alpha1_IPAddress(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
|
||||
@@ -74,6 +74,8 @@ func NewStorageFactoryConfig() *StorageFactoryConfig {
|
||||
// TODO (https://github.com/kubernetes/kubernetes/issues/108451): remove the override in 1.25.
|
||||
// apisstorage.Resource("csistoragecapacities").WithVersion("v1beta1"),
|
||||
coordination.Resource("leasecandidates").WithVersion("v1alpha2"),
|
||||
// TODO(aojea) ipaddresses and servicecidrs are v1 in 1.33
|
||||
// remove them in 1.34 when all apiserver understand the v1 version.
|
||||
networking.Resource("ipaddresses").WithVersion("v1beta1"),
|
||||
networking.Resource("servicecidrs").WithVersion("v1beta1"),
|
||||
admissionregistration.Resource("mutatingadmissionpolicies").WithVersion("v1alpha1"),
|
||||
|
||||
@@ -24,12 +24,12 @@ import (
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
discoveryv1 "k8s.io/api/discovery/v1"
|
||||
networkingv1beta1 "k8s.io/api/networking/v1beta1"
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
v1informers "k8s.io/client-go/informers/core/v1"
|
||||
discoveryv1informers "k8s.io/client-go/informers/discovery/v1"
|
||||
networkingv1beta1informers "k8s.io/client-go/informers/networking/v1beta1"
|
||||
networkingv1informers "k8s.io/client-go/informers/networking/v1"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
@@ -404,7 +404,7 @@ type ServiceCIDRConfig struct {
|
||||
}
|
||||
|
||||
// NewServiceCIDRConfig creates a new ServiceCIDRConfig.
|
||||
func NewServiceCIDRConfig(ctx context.Context, serviceCIDRInformer networkingv1beta1informers.ServiceCIDRInformer, resyncPeriod time.Duration) *ServiceCIDRConfig {
|
||||
func NewServiceCIDRConfig(ctx context.Context, serviceCIDRInformer networkingv1informers.ServiceCIDRInformer, resyncPeriod time.Duration) *ServiceCIDRConfig {
|
||||
result := &ServiceCIDRConfig{
|
||||
cidrs: sets.New[string](),
|
||||
logger: klog.FromContext(ctx),
|
||||
@@ -448,11 +448,11 @@ func (c *ServiceCIDRConfig) Run(stopCh <-chan struct{}) {
|
||||
// handleServiceCIDREvent is a helper function to handle Add, Update and Delete
|
||||
// events on ServiceCIDR objects and call downstream event handlers.
|
||||
func (c *ServiceCIDRConfig) handleServiceCIDREvent(oldObj, newObj interface{}) {
|
||||
var oldServiceCIDR, newServiceCIDR *networkingv1beta1.ServiceCIDR
|
||||
var oldServiceCIDR, newServiceCIDR *networkingv1.ServiceCIDR
|
||||
var ok bool
|
||||
|
||||
if oldObj != nil {
|
||||
oldServiceCIDR, ok = oldObj.(*networkingv1beta1.ServiceCIDR)
|
||||
oldServiceCIDR, ok = oldObj.(*networkingv1.ServiceCIDR)
|
||||
if !ok {
|
||||
utilruntime.HandleError(fmt.Errorf("unexpected object type: %v", oldObj))
|
||||
return
|
||||
@@ -460,7 +460,7 @@ func (c *ServiceCIDRConfig) handleServiceCIDREvent(oldObj, newObj interface{}) {
|
||||
}
|
||||
|
||||
if newObj != nil {
|
||||
newServiceCIDR, ok = newObj.(*networkingv1beta1.ServiceCIDR)
|
||||
newServiceCIDR, ok = newObj.(*networkingv1.ServiceCIDR)
|
||||
if !ok {
|
||||
utilruntime.HandleError(fmt.Errorf("unexpected object type: %v", newObj))
|
||||
return
|
||||
|
||||
@@ -34,7 +34,7 @@ import (
|
||||
serverstorage "k8s.io/apiserver/pkg/server/storage"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
networkingv1beta1client "k8s.io/client-go/kubernetes/typed/networking/v1beta1"
|
||||
networkingv1client "k8s.io/client-go/kubernetes/typed/networking/v1"
|
||||
policyclient "k8s.io/client-go/kubernetes/typed/policy/v1"
|
||||
"k8s.io/klog/v2"
|
||||
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
||||
@@ -140,8 +140,8 @@ func New(c Config) (*legacyProvider, error) {
|
||||
c.Services.IPRepairInterval,
|
||||
client,
|
||||
c.Informers.Core().V1().Services(),
|
||||
c.Informers.Networking().V1beta1().ServiceCIDRs(),
|
||||
c.Informers.Networking().V1beta1().IPAddresses(),
|
||||
c.Informers.Networking().V1().ServiceCIDRs(),
|
||||
c.Informers.Networking().V1().IPAddresses(),
|
||||
).RunUntil
|
||||
}
|
||||
|
||||
@@ -351,7 +351,7 @@ func (c *Config) newServiceIPAllocators() (registries rangeRegistries, primaryCl
|
||||
return rangeRegistries{}, nil, nil, nil, fmt.Errorf("cannot create cluster IP allocator: %v", err)
|
||||
}
|
||||
} else {
|
||||
networkingv1beta1Client, err := networkingv1beta1client.NewForConfig(c.LoopbackClientConfig)
|
||||
networkingv1Client, err := networkingv1client.NewForConfig(c.LoopbackClientConfig)
|
||||
if err != nil {
|
||||
return rangeRegistries{}, nil, nil, nil, err
|
||||
}
|
||||
@@ -391,9 +391,9 @@ func (c *Config) newServiceIPAllocators() (registries rangeRegistries, primaryCl
|
||||
// sets the default IPFamily that may not be coherent with the
|
||||
// existing default ServiceCIDR
|
||||
primaryClusterIPAllocator, err = ipallocator.NewMetaAllocator(
|
||||
networkingv1beta1Client,
|
||||
c.Informers.Networking().V1beta1().ServiceCIDRs(),
|
||||
c.Informers.Networking().V1beta1().IPAddresses(),
|
||||
networkingv1Client,
|
||||
c.Informers.Networking().V1().ServiceCIDRs(),
|
||||
c.Informers.Networking().V1().IPAddresses(),
|
||||
netutils.IsIPv6CIDR(&serviceClusterIPRange),
|
||||
bitmapAllocator,
|
||||
)
|
||||
@@ -423,7 +423,7 @@ func (c *Config) newServiceIPAllocators() (registries rangeRegistries, primaryCl
|
||||
return rangeRegistries{}, nil, nil, nil, fmt.Errorf("cannot create cluster secondary IP allocator: %v", err)
|
||||
}
|
||||
} else {
|
||||
networkingv1beta1Client, err := networkingv1beta1client.NewForConfig(c.LoopbackClientConfig)
|
||||
networkingv1Client, err := networkingv1client.NewForConfig(c.LoopbackClientConfig)
|
||||
if err != nil {
|
||||
return rangeRegistries{}, nil, nil, nil, err
|
||||
}
|
||||
@@ -463,9 +463,9 @@ func (c *Config) newServiceIPAllocators() (registries rangeRegistries, primaryCl
|
||||
// sets the default IPFamily that may not be coherent with the
|
||||
// existing default ServiceCIDR
|
||||
secondaryClusterIPAllocator, err = ipallocator.NewMetaAllocator(
|
||||
networkingv1beta1Client,
|
||||
c.Informers.Networking().V1beta1().ServiceCIDRs(),
|
||||
c.Informers.Networking().V1beta1().IPAddresses(),
|
||||
networkingv1Client,
|
||||
c.Informers.Networking().V1().ServiceCIDRs(),
|
||||
c.Informers.Networking().V1().IPAddresses(),
|
||||
netutils.IsIPv6CIDR(&c.Services.SecondaryClusterIPRange),
|
||||
bitmapAllocator,
|
||||
)
|
||||
|
||||
@@ -24,16 +24,16 @@ import (
|
||||
"time"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
networkingv1beta1 "k8s.io/api/networking/v1beta1"
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
networkingv1beta1informers "k8s.io/client-go/informers/networking/v1beta1"
|
||||
networkingv1beta1client "k8s.io/client-go/kubernetes/typed/networking/v1beta1"
|
||||
networkingv1beta1listers "k8s.io/client-go/listers/networking/v1beta1"
|
||||
networkingv1informers "k8s.io/client-go/informers/networking/v1"
|
||||
networkingv1client "k8s.io/client-go/kubernetes/typed/networking/v1"
|
||||
networkingv1listers "k8s.io/client-go/listers/networking/v1"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/util/workqueue"
|
||||
"k8s.io/klog/v2"
|
||||
@@ -52,12 +52,12 @@ import (
|
||||
// MetaAllocator implements current allocator interface using
|
||||
// ServiceCIDR and IPAddress API objects.
|
||||
type MetaAllocator struct {
|
||||
client networkingv1beta1client.NetworkingV1beta1Interface
|
||||
serviceCIDRLister networkingv1beta1listers.ServiceCIDRLister
|
||||
client networkingv1client.NetworkingV1Interface
|
||||
serviceCIDRLister networkingv1listers.ServiceCIDRLister
|
||||
serviceCIDRSynced cache.InformerSynced
|
||||
ipAddressLister networkingv1beta1listers.IPAddressLister
|
||||
ipAddressLister networkingv1listers.IPAddressLister
|
||||
ipAddressSynced cache.InformerSynced
|
||||
ipAddressInformer networkingv1beta1informers.IPAddressInformer
|
||||
ipAddressInformer networkingv1informers.IPAddressInformer
|
||||
queue workqueue.TypedRateLimitingInterface[string]
|
||||
|
||||
internalStopCh chan struct{}
|
||||
@@ -87,9 +87,9 @@ var _ Interface = &MetaAllocator{}
|
||||
// and ServiceCIDR objects to track the assigned IP addresses,
|
||||
// using an informer cache as storage.
|
||||
func NewMetaAllocator(
|
||||
client networkingv1beta1client.NetworkingV1beta1Interface,
|
||||
serviceCIDRInformer networkingv1beta1informers.ServiceCIDRInformer,
|
||||
ipAddressInformer networkingv1beta1informers.IPAddressInformer,
|
||||
client networkingv1client.NetworkingV1Interface,
|
||||
serviceCIDRInformer networkingv1informers.ServiceCIDRInformer,
|
||||
ipAddressInformer networkingv1informers.IPAddressInformer,
|
||||
isIPv6 bool,
|
||||
bitmapAllocator Interface,
|
||||
) (*MetaAllocator, error) {
|
||||
@@ -100,9 +100,9 @@ func NewMetaAllocator(
|
||||
}
|
||||
|
||||
// newMetaAllocator is used to build the allocator for testing
|
||||
func newMetaAllocator(client networkingv1beta1client.NetworkingV1beta1Interface,
|
||||
serviceCIDRInformer networkingv1beta1informers.ServiceCIDRInformer,
|
||||
ipAddressInformer networkingv1beta1informers.IPAddressInformer,
|
||||
func newMetaAllocator(client networkingv1client.NetworkingV1Interface,
|
||||
serviceCIDRInformer networkingv1informers.ServiceCIDRInformer,
|
||||
ipAddressInformer networkingv1informers.IPAddressInformer,
|
||||
isIPv6 bool,
|
||||
bitmapAllocator Interface,
|
||||
) *MetaAllocator {
|
||||
@@ -152,13 +152,13 @@ func (c *MetaAllocator) enqueueServiceCIDR(obj interface{}) {
|
||||
}
|
||||
|
||||
func (c *MetaAllocator) deleteServiceCIDR(obj interface{}) {
|
||||
serviceCIDR, ok := obj.(*networkingv1beta1.ServiceCIDR)
|
||||
serviceCIDR, ok := obj.(*networkingv1.ServiceCIDR)
|
||||
if !ok {
|
||||
tombstone, ok := obj.(cache.DeletedFinalStateUnknown)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
serviceCIDR, ok = tombstone.Obj.(*networkingv1beta1.ServiceCIDR)
|
||||
serviceCIDR, ok = tombstone.Obj.(*networkingv1.ServiceCIDR)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
@@ -414,8 +414,8 @@ func (c *MetaAllocator) Release(ip net.IP) error {
|
||||
}
|
||||
func (c *MetaAllocator) ForEach(f func(ip net.IP)) {
|
||||
ipLabelSelector := labels.Set(map[string]string{
|
||||
networkingv1beta1.LabelIPAddressFamily: string(c.IPFamily()),
|
||||
networkingv1beta1.LabelManagedBy: ControllerName,
|
||||
networkingv1.LabelIPAddressFamily: string(c.IPFamily()),
|
||||
networkingv1.LabelManagedBy: ControllerName,
|
||||
}).AsSelectorPreValidated()
|
||||
ips, err := c.ipAddressLister.List(ipLabelSelector)
|
||||
if err != nil {
|
||||
@@ -454,8 +454,8 @@ func (c *MetaAllocator) Destroy() {
|
||||
// for testing
|
||||
func (c *MetaAllocator) Used() int {
|
||||
ipLabelSelector := labels.Set(map[string]string{
|
||||
networkingv1beta1.LabelIPAddressFamily: string(c.IPFamily()),
|
||||
networkingv1beta1.LabelManagedBy: ControllerName,
|
||||
networkingv1.LabelIPAddressFamily: string(c.IPFamily()),
|
||||
networkingv1.LabelManagedBy: ControllerName,
|
||||
}).AsSelectorPreValidated()
|
||||
ips, err := c.ipAddressLister.List(ipLabelSelector)
|
||||
if err != nil {
|
||||
@@ -512,13 +512,13 @@ func (c *MetaAllocator) DryRun() Interface {
|
||||
return &Allocator{}
|
||||
}
|
||||
|
||||
func isReady(serviceCIDR *networkingv1beta1.ServiceCIDR) bool {
|
||||
func isReady(serviceCIDR *networkingv1.ServiceCIDR) bool {
|
||||
if serviceCIDR == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
for _, condition := range serviceCIDR.Status.Conditions {
|
||||
if condition.Type == networkingv1beta1.ServiceCIDRConditionReady {
|
||||
if condition.Type == networkingv1.ServiceCIDRConditionReady {
|
||||
return condition.Status == metav1.ConditionStatus(metav1.ConditionTrue)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
networkingv1beta1 "k8s.io/api/networking/v1beta1"
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
@@ -41,13 +41,13 @@ func newTestMetaAllocator() (*MetaAllocator, error) {
|
||||
client := fake.NewSimpleClientset()
|
||||
|
||||
informerFactory := informers.NewSharedInformerFactory(client, 0*time.Second)
|
||||
serviceCIDRInformer := informerFactory.Networking().V1beta1().ServiceCIDRs()
|
||||
serviceCIDRInformer := informerFactory.Networking().V1().ServiceCIDRs()
|
||||
serviceCIDRStore := serviceCIDRInformer.Informer().GetIndexer()
|
||||
ipInformer := informerFactory.Networking().V1beta1().IPAddresses()
|
||||
ipInformer := informerFactory.Networking().V1().IPAddresses()
|
||||
ipStore := ipInformer.Informer().GetIndexer()
|
||||
|
||||
client.PrependReactor("create", "servicecidrs", k8stesting.ReactionFunc(func(action k8stesting.Action) (bool, runtime.Object, error) {
|
||||
cidr := action.(k8stesting.CreateAction).GetObject().(*networkingv1beta1.ServiceCIDR)
|
||||
cidr := action.(k8stesting.CreateAction).GetObject().(*networkingv1.ServiceCIDR)
|
||||
_, exists, err := serviceCIDRStore.GetByKey(cidr.Name)
|
||||
if exists && err != nil {
|
||||
return false, nil, fmt.Errorf("cidr already exist")
|
||||
@@ -59,16 +59,16 @@ func newTestMetaAllocator() (*MetaAllocator, error) {
|
||||
client.PrependReactor("delete", "servicecidrs", k8stesting.ReactionFunc(func(action k8stesting.Action) (bool, runtime.Object, error) {
|
||||
name := action.(k8stesting.DeleteAction).GetName()
|
||||
obj, exists, err := serviceCIDRStore.GetByKey(name)
|
||||
cidr := &networkingv1beta1.ServiceCIDR{}
|
||||
cidr := &networkingv1.ServiceCIDR{}
|
||||
if exists && err == nil {
|
||||
cidr = obj.(*networkingv1beta1.ServiceCIDR)
|
||||
cidr = obj.(*networkingv1.ServiceCIDR)
|
||||
err = serviceCIDRStore.Delete(cidr)
|
||||
}
|
||||
return false, cidr, err
|
||||
}))
|
||||
|
||||
client.PrependReactor("create", "ipaddresses", k8stesting.ReactionFunc(func(action k8stesting.Action) (bool, runtime.Object, error) {
|
||||
ip := action.(k8stesting.CreateAction).GetObject().(*networkingv1beta1.IPAddress)
|
||||
ip := action.(k8stesting.CreateAction).GetObject().(*networkingv1.IPAddress)
|
||||
_, exists, err := ipStore.GetByKey(ip.Name)
|
||||
if exists && err != nil {
|
||||
return false, nil, fmt.Errorf("ip already exist")
|
||||
@@ -80,15 +80,15 @@ func newTestMetaAllocator() (*MetaAllocator, error) {
|
||||
client.PrependReactor("delete", "ipaddresses", k8stesting.ReactionFunc(func(action k8stesting.Action) (bool, runtime.Object, error) {
|
||||
name := action.(k8stesting.DeleteAction).GetName()
|
||||
obj, exists, err := ipStore.GetByKey(name)
|
||||
ip := &networkingv1beta1.IPAddress{}
|
||||
ip := &networkingv1.IPAddress{}
|
||||
if exists && err == nil {
|
||||
ip = obj.(*networkingv1beta1.IPAddress)
|
||||
ip = obj.(*networkingv1.IPAddress)
|
||||
err = ipStore.Delete(ip)
|
||||
}
|
||||
return false, ip, err
|
||||
}))
|
||||
|
||||
c := newMetaAllocator(client.NetworkingV1beta1(), serviceCIDRInformer, ipInformer, false, nil)
|
||||
c := newMetaAllocator(client.NetworkingV1(), serviceCIDRInformer, ipInformer, false, nil)
|
||||
|
||||
c.serviceCIDRSynced = func() bool { return true }
|
||||
c.ipAddressSynced = func() bool { return true }
|
||||
@@ -602,18 +602,18 @@ func TestCIDRAllocateDualWriteCollision(t *testing.T) {
|
||||
}
|
||||
|
||||
// TODO: add IPv6 and dual stack test cases
|
||||
func newServiceCIDR(name, cidr string) *networkingv1beta1.ServiceCIDR {
|
||||
return &networkingv1beta1.ServiceCIDR{
|
||||
func newServiceCIDR(name, cidr string) *networkingv1.ServiceCIDR {
|
||||
return &networkingv1.ServiceCIDR{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
},
|
||||
Spec: networkingv1beta1.ServiceCIDRSpec{
|
||||
Spec: networkingv1.ServiceCIDRSpec{
|
||||
CIDRs: []string{cidr},
|
||||
},
|
||||
Status: networkingv1beta1.ServiceCIDRStatus{
|
||||
Status: networkingv1.ServiceCIDRStatus{
|
||||
Conditions: []metav1.Condition{
|
||||
{
|
||||
Type: string(networkingv1beta1.ServiceCIDRConditionReady),
|
||||
Type: string(networkingv1.ServiceCIDRConditionReady),
|
||||
Status: metav1.ConditionTrue,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -23,17 +23,17 @@ import (
|
||||
"time"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
networkingv1beta1 "k8s.io/api/networking/v1beta1"
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
coreinformers "k8s.io/client-go/informers/core/v1"
|
||||
networkinginformers "k8s.io/client-go/informers/networking/v1beta1"
|
||||
networkinginformers "k8s.io/client-go/informers/networking/v1"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
corelisters "k8s.io/client-go/listers/core/v1"
|
||||
networkinglisters "k8s.io/client-go/listers/networking/v1beta1"
|
||||
networkinglisters "k8s.io/client-go/listers/networking/v1"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/tools/events"
|
||||
"k8s.io/client-go/util/retry"
|
||||
@@ -263,7 +263,7 @@ func (r *RepairIPAddress) doRunOnce() error {
|
||||
// Check that there is no IP created by the allocator without
|
||||
// a Service associated.
|
||||
ipLabelSelector := labels.Set(map[string]string{
|
||||
networkingv1beta1.LabelManagedBy: ipallocator.ControllerName,
|
||||
networkingv1.LabelManagedBy: ipallocator.ControllerName,
|
||||
}).AsSelectorPreValidated()
|
||||
ipAddresses, err := r.ipAddressLister.List(ipLabelSelector)
|
||||
if err != nil {
|
||||
@@ -360,7 +360,7 @@ func (r *RepairIPAddress) syncService(key string) error {
|
||||
// ClusterIP doesn't seem to be allocated, create it.
|
||||
r.recorder.Eventf(svc, nil, v1.EventTypeWarning, "ClusterIPNotAllocated", "ClusterIPAllocation", "Cluster IP [%v]: %s is not allocated; repairing", family, ip)
|
||||
runtime.HandleError(fmt.Errorf("the ClusterIP [%v]: %s for Service %s/%s is not allocated; repairing", family, ip, svc.Namespace, svc.Name))
|
||||
_, err := r.client.NetworkingV1beta1().IPAddresses().Create(context.Background(), newIPAddress(ip.String(), svc), metav1.CreateOptions{})
|
||||
_, err := r.client.NetworkingV1().IPAddresses().Create(context.Background(), newIPAddress(ip.String(), svc), metav1.CreateOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -417,11 +417,11 @@ func (r *RepairIPAddress) syncService(key string) error {
|
||||
}
|
||||
|
||||
func (r *RepairIPAddress) recreateIPAddress(name string, svc *v1.Service) error {
|
||||
err := r.client.NetworkingV1beta1().IPAddresses().Delete(context.Background(), name, metav1.DeleteOptions{})
|
||||
err := r.client.NetworkingV1().IPAddresses().Delete(context.Background(), name, metav1.DeleteOptions{})
|
||||
if err != nil && !apierrors.IsNotFound(err) {
|
||||
return err
|
||||
}
|
||||
_, err = r.client.NetworkingV1beta1().IPAddresses().Create(context.Background(), newIPAddress(name, svc), metav1.CreateOptions{})
|
||||
_, err = r.client.NetworkingV1().IPAddresses().Create(context.Background(), newIPAddress(name, svc), metav1.CreateOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -482,7 +482,7 @@ func (r *RepairIPAddress) syncIPAddress(key string) error {
|
||||
if ipAddress.Spec.ParentRef.Group != "" || ipAddress.Spec.ParentRef.Resource != "services" {
|
||||
runtime.HandleError(fmt.Errorf("IPAddress %s appears to have been modified, not referencing a Service %v: cleaning up", ipAddress.Name, ipAddress.Spec.ParentRef))
|
||||
r.recorder.Eventf(ipAddress, nil, v1.EventTypeWarning, "IPAddressNotAllocated", "IPAddressAllocation", "IPAddress %s appears to have been modified, not referencing a Service %v: cleaning up", ipAddress.Name, ipAddress.Spec.ParentRef)
|
||||
err := r.client.NetworkingV1beta1().IPAddresses().Delete(context.Background(), ipAddress.Name, metav1.DeleteOptions{})
|
||||
err := r.client.NetworkingV1().IPAddresses().Delete(context.Background(), ipAddress.Name, metav1.DeleteOptions{})
|
||||
if err != nil && !apierrors.IsNotFound(err) {
|
||||
return err
|
||||
}
|
||||
@@ -499,7 +499,7 @@ func (r *RepairIPAddress) syncIPAddress(key string) error {
|
||||
if ipLifetime > gracePeriod {
|
||||
runtime.HandleError(fmt.Errorf("IPAddress %s appears to have leaked: cleaning up", ipAddress.Name))
|
||||
r.recorder.Eventf(ipAddress, nil, v1.EventTypeWarning, "IPAddressNotAllocated", "IPAddressAllocation", "IPAddress: %s for Service %s/%s appears to have leaked: cleaning up", ipAddress.Name, ipAddress.Spec.ParentRef.Namespace, ipAddress.Spec.ParentRef.Name)
|
||||
err := r.client.NetworkingV1beta1().IPAddresses().Delete(context.Background(), ipAddress.Name, metav1.DeleteOptions{})
|
||||
err := r.client.NetworkingV1().IPAddresses().Delete(context.Background(), ipAddress.Name, metav1.DeleteOptions{})
|
||||
if err != nil && !apierrors.IsNotFound(err) {
|
||||
return err
|
||||
}
|
||||
@@ -522,7 +522,7 @@ func (r *RepairIPAddress) syncIPAddress(key string) error {
|
||||
}
|
||||
runtime.HandleError(fmt.Errorf("the IPAddress: %s for Service %s/%s has a wrong reference %#v; cleaning up", ipAddress.Name, svc.Name, svc.Namespace, ipAddress.Spec.ParentRef))
|
||||
r.recorder.Eventf(ipAddress, nil, v1.EventTypeWarning, "IPAddressWrongReference", "IPAddressAllocation", "IPAddress: %s for Service %s/%s has a wrong reference; cleaning up", ipAddress.Name, svc.Namespace, svc.Name)
|
||||
err = r.client.NetworkingV1beta1().IPAddresses().Delete(context.Background(), ipAddress.Name, metav1.DeleteOptions{})
|
||||
err = r.client.NetworkingV1().IPAddresses().Delete(context.Background(), ipAddress.Name, metav1.DeleteOptions{})
|
||||
if err != nil && !apierrors.IsNotFound(err) {
|
||||
return err
|
||||
}
|
||||
@@ -535,31 +535,31 @@ func (r *RepairIPAddress) isIPOutOfRange(ip net.IP) bool {
|
||||
return len(servicecidr.ContainsIP(r.serviceCIDRLister, ip)) == 0
|
||||
}
|
||||
|
||||
func newIPAddress(name string, svc *v1.Service) *networkingv1beta1.IPAddress {
|
||||
func newIPAddress(name string, svc *v1.Service) *networkingv1.IPAddress {
|
||||
family := string(v1.IPv4Protocol)
|
||||
if netutils.IsIPv6String(name) {
|
||||
family = string(v1.IPv6Protocol)
|
||||
}
|
||||
return &networkingv1beta1.IPAddress{
|
||||
return &networkingv1.IPAddress{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
Labels: map[string]string{
|
||||
networkingv1beta1.LabelIPAddressFamily: family,
|
||||
networkingv1beta1.LabelManagedBy: ipallocator.ControllerName,
|
||||
networkingv1.LabelIPAddressFamily: family,
|
||||
networkingv1.LabelManagedBy: ipallocator.ControllerName,
|
||||
},
|
||||
},
|
||||
Spec: networkingv1beta1.IPAddressSpec{
|
||||
Spec: networkingv1.IPAddressSpec{
|
||||
ParentRef: serviceToRef(svc),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func serviceToRef(svc *v1.Service) *networkingv1beta1.ParentReference {
|
||||
func serviceToRef(svc *v1.Service) *networkingv1.ParentReference {
|
||||
if svc == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return &networkingv1beta1.ParentReference{
|
||||
return &networkingv1.ParentReference{
|
||||
Group: "",
|
||||
Resource: "services",
|
||||
Namespace: svc.Namespace,
|
||||
@@ -576,16 +576,16 @@ func getFamilyByIP(ip net.IP) v1.IPFamily {
|
||||
|
||||
// managedByController returns true if the controller of the provided
|
||||
// EndpointSlices is the EndpointSlice controller.
|
||||
func managedByController(ip *networkingv1beta1.IPAddress) bool {
|
||||
managedBy, ok := ip.Labels[networkingv1beta1.LabelManagedBy]
|
||||
func managedByController(ip *networkingv1.IPAddress) bool {
|
||||
managedBy, ok := ip.Labels[networkingv1.LabelManagedBy]
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
return managedBy == ipallocator.ControllerName
|
||||
}
|
||||
|
||||
func verifyIPAddressLabels(ip *networkingv1beta1.IPAddress) bool {
|
||||
labelFamily, ok := ip.Labels[networkingv1beta1.LabelIPAddressFamily]
|
||||
func verifyIPAddressLabels(ip *networkingv1.IPAddress) bool {
|
||||
labelFamily, ok := ip.Labels[networkingv1.LabelIPAddressFamily]
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
networkingv1beta1 "k8s.io/api/networking/v1beta1"
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
@@ -54,25 +54,25 @@ func newFakeRepair() (*fake.Clientset, *fakeRepair) {
|
||||
serviceInformer := informerFactory.Core().V1().Services()
|
||||
serviceIndexer := serviceInformer.Informer().GetIndexer()
|
||||
|
||||
serviceCIDRInformer := informerFactory.Networking().V1beta1().ServiceCIDRs()
|
||||
serviceCIDRInformer := informerFactory.Networking().V1().ServiceCIDRs()
|
||||
serviceCIDRIndexer := serviceCIDRInformer.Informer().GetIndexer()
|
||||
|
||||
ipInformer := informerFactory.Networking().V1beta1().IPAddresses()
|
||||
ipInformer := informerFactory.Networking().V1().IPAddresses()
|
||||
ipIndexer := ipInformer.Informer().GetIndexer()
|
||||
|
||||
fakeClient.PrependReactor("create", "ipaddresses", k8stesting.ReactionFunc(func(action k8stesting.Action) (bool, runtime.Object, error) {
|
||||
ip := action.(k8stesting.CreateAction).GetObject().(*networkingv1beta1.IPAddress)
|
||||
ip := action.(k8stesting.CreateAction).GetObject().(*networkingv1.IPAddress)
|
||||
err := ipIndexer.Add(ip)
|
||||
return false, ip, err
|
||||
}))
|
||||
fakeClient.PrependReactor("update", "ipaddresses", k8stesting.ReactionFunc(func(action k8stesting.Action) (bool, runtime.Object, error) {
|
||||
ip := action.(k8stesting.UpdateAction).GetObject().(*networkingv1beta1.IPAddress)
|
||||
ip := action.(k8stesting.UpdateAction).GetObject().(*networkingv1.IPAddress)
|
||||
return false, ip, fmt.Errorf("IPAddress is inmutable after creation")
|
||||
}))
|
||||
fakeClient.PrependReactor("delete", "ipaddresses", k8stesting.ReactionFunc(func(action k8stesting.Action) (bool, runtime.Object, error) {
|
||||
ip := action.(k8stesting.DeleteAction).GetName()
|
||||
err := ipIndexer.Delete(ip)
|
||||
return false, &networkingv1beta1.IPAddress{}, err
|
||||
return false, &networkingv1.IPAddress{}, err
|
||||
}))
|
||||
|
||||
r := NewRepairIPAddress(0*time.Second,
|
||||
@@ -88,8 +88,8 @@ func TestRepairServiceIP(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
svcs []*v1.Service
|
||||
ipAddresses []*networkingv1beta1.IPAddress
|
||||
cidrs []*networkingv1beta1.ServiceCIDR
|
||||
ipAddresses []*networkingv1.IPAddress
|
||||
cidrs []*networkingv1.ServiceCIDR
|
||||
expectedIPs []string
|
||||
actions [][]string // verb and resource
|
||||
events []string
|
||||
@@ -97,10 +97,10 @@ func TestRepairServiceIP(t *testing.T) {
|
||||
{
|
||||
name: "no changes needed single stack",
|
||||
svcs: []*v1.Service{newService("test-svc", []string{"10.0.1.1"})},
|
||||
ipAddresses: []*networkingv1beta1.IPAddress{
|
||||
ipAddresses: []*networkingv1.IPAddress{
|
||||
newIPAddress("10.0.1.1", newService("test-svc", []string{"10.0.1.1"})),
|
||||
},
|
||||
cidrs: []*networkingv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
|
||||
},
|
||||
expectedIPs: []string{"10.0.1.1"},
|
||||
@@ -110,11 +110,11 @@ func TestRepairServiceIP(t *testing.T) {
|
||||
{
|
||||
name: "no changes needed dual stack",
|
||||
svcs: []*v1.Service{newService("test-svc", []string{"10.0.1.1", "2001:db8::10"})},
|
||||
ipAddresses: []*networkingv1beta1.IPAddress{
|
||||
ipAddresses: []*networkingv1.IPAddress{
|
||||
newIPAddress("10.0.1.1", newService("test-svc", []string{"10.0.1.1"})),
|
||||
newIPAddress("2001:db8::10", newService("test-svc", []string{"2001:db8::10"})),
|
||||
},
|
||||
cidrs: []*networkingv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
|
||||
},
|
||||
expectedIPs: []string{"10.0.1.1", "2001:db8::10"},
|
||||
@@ -124,11 +124,11 @@ func TestRepairServiceIP(t *testing.T) {
|
||||
{
|
||||
name: "no changes needed dual stack multiple cidrs",
|
||||
svcs: []*v1.Service{newService("test-svc", []string{"192.168.0.1", "2001:db8:a:b::10"})},
|
||||
ipAddresses: []*networkingv1beta1.IPAddress{
|
||||
ipAddresses: []*networkingv1.IPAddress{
|
||||
newIPAddress("192.168.0.1", newService("test-svc", []string{"192.168.0.1"})),
|
||||
newIPAddress("2001:db8:a:b::10", newService("test-svc", []string{"2001:db8:a:b::10"})),
|
||||
},
|
||||
cidrs: []*networkingv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
|
||||
newServiceCIDR("custom", "192.168.0.0/24", "2001:db8:a:b::/64"),
|
||||
},
|
||||
@@ -140,7 +140,7 @@ func TestRepairServiceIP(t *testing.T) {
|
||||
{
|
||||
name: "create IPAddress single stack",
|
||||
svcs: []*v1.Service{newService("test-svc", []string{"10.0.1.1"})},
|
||||
cidrs: []*networkingv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
|
||||
},
|
||||
expectedIPs: []string{"10.0.1.1"},
|
||||
@@ -150,7 +150,7 @@ func TestRepairServiceIP(t *testing.T) {
|
||||
{
|
||||
name: "create IPAddresses dual stack",
|
||||
svcs: []*v1.Service{newService("test-svc", []string{"10.0.1.1", "2001:db8::10"})},
|
||||
cidrs: []*networkingv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
|
||||
},
|
||||
expectedIPs: []string{"10.0.1.1", "2001:db8::10"},
|
||||
@@ -163,7 +163,7 @@ func TestRepairServiceIP(t *testing.T) {
|
||||
{
|
||||
name: "create IPAddress single stack from secondary",
|
||||
svcs: []*v1.Service{newService("test-svc", []string{"192.168.1.1"})},
|
||||
cidrs: []*networkingv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
|
||||
newServiceCIDR("custom", "192.168.1.0/24", ""),
|
||||
},
|
||||
@@ -174,10 +174,10 @@ func TestRepairServiceIP(t *testing.T) {
|
||||
{
|
||||
name: "reconcile IPAddress single stack wrong reference",
|
||||
svcs: []*v1.Service{newService("test-svc", []string{"10.0.1.1"})},
|
||||
ipAddresses: []*networkingv1beta1.IPAddress{
|
||||
ipAddresses: []*networkingv1.IPAddress{
|
||||
newIPAddress("10.0.1.1", newService("test-svc2", []string{"10.0.1.1"})),
|
||||
},
|
||||
cidrs: []*networkingv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
|
||||
},
|
||||
expectedIPs: []string{"10.0.1.1"},
|
||||
@@ -187,11 +187,11 @@ func TestRepairServiceIP(t *testing.T) {
|
||||
{
|
||||
name: "reconcile IPAddresses dual stack",
|
||||
svcs: []*v1.Service{newService("test-svc", []string{"10.0.1.1", "2001:db8::10"})},
|
||||
ipAddresses: []*networkingv1beta1.IPAddress{
|
||||
ipAddresses: []*networkingv1.IPAddress{
|
||||
newIPAddress("10.0.1.1", newService("test-svc2", []string{"10.0.1.1"})),
|
||||
newIPAddress("2001:db8::10", newService("test-svc2", []string{"2001:db8::10"})),
|
||||
},
|
||||
cidrs: []*networkingv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
|
||||
},
|
||||
expectedIPs: []string{"10.0.1.1", "2001:db8::10"},
|
||||
@@ -204,11 +204,11 @@ func TestRepairServiceIP(t *testing.T) {
|
||||
{
|
||||
name: "one IP out of range",
|
||||
svcs: []*v1.Service{newService("test-svc", []string{"192.168.1.1", "2001:db8::10"})},
|
||||
ipAddresses: []*networkingv1beta1.IPAddress{
|
||||
ipAddresses: []*networkingv1.IPAddress{
|
||||
newIPAddress("192.168.1.1", newService("test-svc", []string{"192.168.1.1"})),
|
||||
newIPAddress("2001:db8::10", newService("test-svc", []string{"2001:db8::10"})),
|
||||
},
|
||||
cidrs: []*networkingv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
|
||||
},
|
||||
expectedIPs: []string{"2001:db8::10"},
|
||||
@@ -217,10 +217,10 @@ func TestRepairServiceIP(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "one IP orphan",
|
||||
ipAddresses: []*networkingv1beta1.IPAddress{
|
||||
ipAddresses: []*networkingv1.IPAddress{
|
||||
newIPAddress("10.0.1.1", newService("test-svc", []string{"10.0.1.1"})),
|
||||
},
|
||||
cidrs: []*networkingv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
|
||||
},
|
||||
actions: [][]string{{"delete", "ipaddresses"}},
|
||||
@@ -229,10 +229,10 @@ func TestRepairServiceIP(t *testing.T) {
|
||||
{
|
||||
name: "one IP out of range matching the network address",
|
||||
svcs: []*v1.Service{newService("test-svc", []string{"10.0.0.0"})},
|
||||
ipAddresses: []*networkingv1beta1.IPAddress{
|
||||
ipAddresses: []*networkingv1.IPAddress{
|
||||
newIPAddress("10.0.0.0", newService("test-svc", []string{"10.0.0.0"})),
|
||||
},
|
||||
cidrs: []*networkingv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
|
||||
},
|
||||
expectedIPs: []string{"10.0.0.0"},
|
||||
@@ -242,10 +242,10 @@ func TestRepairServiceIP(t *testing.T) {
|
||||
{
|
||||
name: "one IP out of range matching the broadcast address",
|
||||
svcs: []*v1.Service{newService("test-svc", []string{"10.0.255.255"})},
|
||||
ipAddresses: []*networkingv1beta1.IPAddress{
|
||||
ipAddresses: []*networkingv1.IPAddress{
|
||||
newIPAddress("10.0.255.255", newService("test-svc", []string{"10.0.255.255"})),
|
||||
},
|
||||
cidrs: []*networkingv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
|
||||
},
|
||||
expectedIPs: []string{"10.0.255.255"},
|
||||
@@ -255,10 +255,10 @@ func TestRepairServiceIP(t *testing.T) {
|
||||
{
|
||||
name: "one IPv6 out of range matching the subnet address",
|
||||
svcs: []*v1.Service{newService("test-svc", []string{"2001:db8::"})},
|
||||
ipAddresses: []*networkingv1beta1.IPAddress{
|
||||
ipAddresses: []*networkingv1.IPAddress{
|
||||
newIPAddress("2001:db8::", newService("test-svc", []string{"2001:db8::"})),
|
||||
},
|
||||
cidrs: []*networkingv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
|
||||
},
|
||||
expectedIPs: []string{"2001:db8::"},
|
||||
@@ -268,20 +268,20 @@ func TestRepairServiceIP(t *testing.T) {
|
||||
{
|
||||
name: "one IPv6 matching the broadcast address",
|
||||
svcs: []*v1.Service{newService("test-svc", []string{"2001:db8::ffff:ffff:ffff:ffff"})},
|
||||
ipAddresses: []*networkingv1beta1.IPAddress{
|
||||
ipAddresses: []*networkingv1.IPAddress{
|
||||
newIPAddress("2001:db8::ffff:ffff:ffff:ffff", newService("test-svc", []string{"2001:db8::ffff:ffff:ffff:ffff"})),
|
||||
},
|
||||
cidrs: []*networkingv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
|
||||
},
|
||||
expectedIPs: []string{"2001:db8::ffff:ffff:ffff:ffff"},
|
||||
},
|
||||
{
|
||||
name: "one IP orphan matching the broadcast address",
|
||||
ipAddresses: []*networkingv1beta1.IPAddress{
|
||||
ipAddresses: []*networkingv1.IPAddress{
|
||||
newIPAddress("10.0.255.255", newService("test-svc", []string{"10.0.255.255"})),
|
||||
},
|
||||
cidrs: []*networkingv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
|
||||
},
|
||||
actions: [][]string{{"delete", "ipaddresses"}},
|
||||
@@ -290,11 +290,11 @@ func TestRepairServiceIP(t *testing.T) {
|
||||
{
|
||||
name: "Two IPAddresses referencing the same service",
|
||||
svcs: []*v1.Service{newService("test-svc", []string{"10.0.1.1"})},
|
||||
ipAddresses: []*networkingv1beta1.IPAddress{
|
||||
ipAddresses: []*networkingv1.IPAddress{
|
||||
newIPAddress("10.0.1.1", newService("test-svc", []string{"10.0.1.1"})),
|
||||
newIPAddress("10.0.1.2", newService("test-svc", []string{"10.0.1.1"})),
|
||||
},
|
||||
cidrs: []*networkingv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
|
||||
},
|
||||
actions: [][]string{{"delete", "ipaddresses"}},
|
||||
@@ -306,10 +306,10 @@ func TestRepairServiceIP(t *testing.T) {
|
||||
newService("test-svc", []string{"10.0.1.1"}),
|
||||
newService("test-svc2", []string{"10.0.1.1"}),
|
||||
},
|
||||
ipAddresses: []*networkingv1beta1.IPAddress{
|
||||
ipAddresses: []*networkingv1.IPAddress{
|
||||
newIPAddress("10.0.1.1", newService("test-svc2", []string{"10.0.1.1"})),
|
||||
},
|
||||
cidrs: []*networkingv1beta1.ServiceCIDR{
|
||||
cidrs: []*networkingv1.ServiceCIDR{
|
||||
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
|
||||
},
|
||||
events: []string{"Warning ClusterIPAlreadyAllocated Cluster IP [IPv4]:10.0.1.1 was assigned to multiple services; please recreate service"},
|
||||
@@ -370,23 +370,23 @@ func TestRepairServiceIP(t *testing.T) {
|
||||
func TestRepairIPAddress_syncIPAddress(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
ip *networkingv1beta1.IPAddress
|
||||
ip *networkingv1.IPAddress
|
||||
actions [][]string // verb and resource
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "correct ipv4 address",
|
||||
ip: &networkingv1beta1.IPAddress{
|
||||
ip: &networkingv1.IPAddress{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "10.0.1.1",
|
||||
Labels: map[string]string{
|
||||
networkingv1beta1.LabelIPAddressFamily: string(v1.IPv4Protocol),
|
||||
networkingv1beta1.LabelManagedBy: ipallocator.ControllerName,
|
||||
networkingv1.LabelIPAddressFamily: string(v1.IPv4Protocol),
|
||||
networkingv1.LabelManagedBy: ipallocator.ControllerName,
|
||||
},
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
},
|
||||
Spec: networkingv1beta1.IPAddressSpec{
|
||||
ParentRef: &networkingv1beta1.ParentReference{
|
||||
Spec: networkingv1.IPAddressSpec{
|
||||
ParentRef: &networkingv1.ParentReference{
|
||||
Group: "",
|
||||
Resource: "services",
|
||||
Name: "foo",
|
||||
@@ -397,17 +397,17 @@ func TestRepairIPAddress_syncIPAddress(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "correct ipv6 address",
|
||||
ip: &networkingv1beta1.IPAddress{
|
||||
ip: &networkingv1.IPAddress{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "2001:db8::11",
|
||||
Labels: map[string]string{
|
||||
networkingv1beta1.LabelIPAddressFamily: string(v1.IPv6Protocol),
|
||||
networkingv1beta1.LabelManagedBy: ipallocator.ControllerName,
|
||||
networkingv1.LabelIPAddressFamily: string(v1.IPv6Protocol),
|
||||
networkingv1.LabelManagedBy: ipallocator.ControllerName,
|
||||
},
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
},
|
||||
Spec: networkingv1beta1.IPAddressSpec{
|
||||
ParentRef: &networkingv1beta1.ParentReference{
|
||||
Spec: networkingv1.IPAddressSpec{
|
||||
ParentRef: &networkingv1.ParentReference{
|
||||
Group: "",
|
||||
Resource: "services",
|
||||
Name: "foo",
|
||||
@@ -418,17 +418,17 @@ func TestRepairIPAddress_syncIPAddress(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "not managed by this controller",
|
||||
ip: &networkingv1beta1.IPAddress{
|
||||
ip: &networkingv1.IPAddress{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "2001:db8::11",
|
||||
Labels: map[string]string{
|
||||
networkingv1beta1.LabelIPAddressFamily: string(v1.IPv6Protocol),
|
||||
networkingv1beta1.LabelManagedBy: "controller-foo",
|
||||
networkingv1.LabelIPAddressFamily: string(v1.IPv6Protocol),
|
||||
networkingv1.LabelManagedBy: "controller-foo",
|
||||
},
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
},
|
||||
Spec: networkingv1beta1.IPAddressSpec{
|
||||
ParentRef: &networkingv1beta1.ParentReference{
|
||||
Spec: networkingv1.IPAddressSpec{
|
||||
ParentRef: &networkingv1.ParentReference{
|
||||
Group: "networking.gateway.k8s.io",
|
||||
Resource: "gateway",
|
||||
Name: "foo",
|
||||
@@ -439,17 +439,17 @@ func TestRepairIPAddress_syncIPAddress(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "out of range",
|
||||
ip: &networkingv1beta1.IPAddress{
|
||||
ip: &networkingv1.IPAddress{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "fd00:db8::11",
|
||||
Labels: map[string]string{
|
||||
networkingv1beta1.LabelIPAddressFamily: string(v1.IPv6Protocol),
|
||||
networkingv1beta1.LabelManagedBy: ipallocator.ControllerName,
|
||||
networkingv1.LabelIPAddressFamily: string(v1.IPv6Protocol),
|
||||
networkingv1.LabelManagedBy: ipallocator.ControllerName,
|
||||
},
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
},
|
||||
Spec: networkingv1beta1.IPAddressSpec{
|
||||
ParentRef: &networkingv1beta1.ParentReference{
|
||||
Spec: networkingv1.IPAddressSpec{
|
||||
ParentRef: &networkingv1.ParentReference{
|
||||
Group: "",
|
||||
Resource: "services",
|
||||
Name: "foo",
|
||||
@@ -460,17 +460,17 @@ func TestRepairIPAddress_syncIPAddress(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "leaked ip",
|
||||
ip: &networkingv1beta1.IPAddress{
|
||||
ip: &networkingv1.IPAddress{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "10.0.1.1",
|
||||
Labels: map[string]string{
|
||||
networkingv1beta1.LabelIPAddressFamily: string(v1.IPv6Protocol),
|
||||
networkingv1beta1.LabelManagedBy: ipallocator.ControllerName,
|
||||
networkingv1.LabelIPAddressFamily: string(v1.IPv6Protocol),
|
||||
networkingv1.LabelManagedBy: ipallocator.ControllerName,
|
||||
},
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
},
|
||||
Spec: networkingv1beta1.IPAddressSpec{
|
||||
ParentRef: &networkingv1beta1.ParentReference{
|
||||
Spec: networkingv1.IPAddressSpec{
|
||||
ParentRef: &networkingv1.ParentReference{
|
||||
Group: "",
|
||||
Resource: "services",
|
||||
Name: "noexist",
|
||||
@@ -522,12 +522,12 @@ func newService(name string, ips []string) *v1.Service {
|
||||
return svc
|
||||
}
|
||||
|
||||
func newServiceCIDR(name, primary, secondary string) *networkingv1beta1.ServiceCIDR {
|
||||
serviceCIDR := &networkingv1beta1.ServiceCIDR{
|
||||
func newServiceCIDR(name, primary, secondary string) *networkingv1.ServiceCIDR {
|
||||
serviceCIDR := &networkingv1.ServiceCIDR{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
},
|
||||
Spec: networkingv1beta1.ServiceCIDRSpec{},
|
||||
Spec: networkingv1.ServiceCIDRSpec{},
|
||||
}
|
||||
serviceCIDR.Spec.CIDRs = append(serviceCIDR.Spec.CIDRs, primary)
|
||||
if secondary != "" {
|
||||
|
||||
@@ -27,13 +27,13 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
networkingv1beta1 "k8s.io/api/networking/v1beta1"
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
networkingv1beta1informers "k8s.io/client-go/informers/networking/v1beta1"
|
||||
networkingv1beta1client "k8s.io/client-go/kubernetes/typed/networking/v1beta1"
|
||||
networkingv1beta1listers "k8s.io/client-go/listers/networking/v1beta1"
|
||||
networkingv1informers "k8s.io/client-go/informers/networking/v1"
|
||||
networkingv1client "k8s.io/client-go/kubernetes/typed/networking/v1"
|
||||
networkingv1listers "k8s.io/client-go/listers/networking/v1"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/klog/v2"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
@@ -56,8 +56,8 @@ type Allocator struct {
|
||||
rangeOffset int // subdivides the assigned IP range to prefer dynamic allocation from the upper range
|
||||
size uint64 // cap the total number of IPs available to maxInt64
|
||||
|
||||
client networkingv1beta1client.NetworkingV1beta1Interface
|
||||
ipAddressLister networkingv1beta1listers.IPAddressLister
|
||||
client networkingv1client.NetworkingV1Interface
|
||||
ipAddressLister networkingv1listers.IPAddressLister
|
||||
ipAddressSynced cache.InformerSynced
|
||||
// ready indicates if the allocator is able to allocate new IP addresses.
|
||||
// This is required because it depends on the ServiceCIDR to be ready.
|
||||
@@ -77,8 +77,8 @@ var _ Interface = &Allocator{}
|
||||
// using an informer cache as storage.
|
||||
func NewIPAllocator(
|
||||
cidr *net.IPNet,
|
||||
client networkingv1beta1client.NetworkingV1beta1Interface,
|
||||
ipAddressInformer networkingv1beta1informers.IPAddressInformer,
|
||||
client networkingv1client.NetworkingV1Interface,
|
||||
ipAddressInformer networkingv1informers.IPAddressInformer,
|
||||
) (*Allocator, error) {
|
||||
prefix, err := netip.ParsePrefix(cidr.String())
|
||||
if err != nil {
|
||||
@@ -139,15 +139,15 @@ func NewIPAllocator(
|
||||
}
|
||||
|
||||
func (a *Allocator) createIPAddress(name string, svc *api.Service, scope string) error {
|
||||
ipAddress := networkingv1beta1.IPAddress{
|
||||
ipAddress := networkingv1.IPAddress{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
Labels: map[string]string{
|
||||
networkingv1beta1.LabelIPAddressFamily: string(a.IPFamily()),
|
||||
networkingv1beta1.LabelManagedBy: ControllerName,
|
||||
networkingv1.LabelIPAddressFamily: string(a.IPFamily()),
|
||||
networkingv1.LabelManagedBy: ControllerName,
|
||||
},
|
||||
},
|
||||
Spec: networkingv1beta1.IPAddressSpec{
|
||||
Spec: networkingv1.IPAddressSpec{
|
||||
ParentRef: serviceToRef(svc),
|
||||
},
|
||||
}
|
||||
@@ -379,8 +379,8 @@ func (a *Allocator) release(ip net.IP, dryRun bool) error {
|
||||
// This is required to satisfy the Allocator Interface only
|
||||
func (a *Allocator) ForEach(f func(net.IP)) {
|
||||
ipLabelSelector := labels.Set(map[string]string{
|
||||
networkingv1beta1.LabelIPAddressFamily: string(a.IPFamily()),
|
||||
networkingv1beta1.LabelManagedBy: ControllerName,
|
||||
networkingv1.LabelIPAddressFamily: string(a.IPFamily()),
|
||||
networkingv1.LabelManagedBy: ControllerName,
|
||||
}).AsSelectorPreValidated()
|
||||
ips, err := a.ipAddressLister.List(ipLabelSelector)
|
||||
if err != nil {
|
||||
@@ -413,8 +413,8 @@ func (a *Allocator) IPFamily() api.IPFamily {
|
||||
// for testing, it assumes this is the allocator is unique for the ipFamily
|
||||
func (a *Allocator) Used() int {
|
||||
ipLabelSelector := labels.Set(map[string]string{
|
||||
networkingv1beta1.LabelIPAddressFamily: string(a.IPFamily()),
|
||||
networkingv1beta1.LabelManagedBy: ControllerName,
|
||||
networkingv1.LabelIPAddressFamily: string(a.IPFamily()),
|
||||
networkingv1.LabelManagedBy: ControllerName,
|
||||
}).AsSelectorPreValidated()
|
||||
ips, err := a.ipAddressLister.List(ipLabelSelector)
|
||||
if err != nil {
|
||||
@@ -568,12 +568,12 @@ func broadcastAddress(subnet netip.Prefix) (netip.Addr, error) {
|
||||
}
|
||||
|
||||
// serviceToRef obtain the Service Parent Reference
|
||||
func serviceToRef(svc *api.Service) *networkingv1beta1.ParentReference {
|
||||
func serviceToRef(svc *api.Service) *networkingv1.ParentReference {
|
||||
if svc == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return &networkingv1beta1.ParentReference{
|
||||
return &networkingv1.ParentReference{
|
||||
Group: "",
|
||||
Resource: "services",
|
||||
Namespace: svc.Namespace,
|
||||
|
||||
@@ -25,7 +25,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
networkingv1beta1 "k8s.io/api/networking/v1beta1"
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/client-go/informers"
|
||||
@@ -40,11 +40,11 @@ func newTestAllocator(cidr *net.IPNet) (*Allocator, error) {
|
||||
client := fake.NewSimpleClientset()
|
||||
|
||||
informerFactory := informers.NewSharedInformerFactory(client, 0*time.Second)
|
||||
ipInformer := informerFactory.Networking().V1beta1().IPAddresses()
|
||||
ipInformer := informerFactory.Networking().V1().IPAddresses()
|
||||
ipStore := ipInformer.Informer().GetIndexer()
|
||||
|
||||
client.PrependReactor("create", "ipaddresses", k8stesting.ReactionFunc(func(action k8stesting.Action) (bool, runtime.Object, error) {
|
||||
ip := action.(k8stesting.CreateAction).GetObject().(*networkingv1beta1.IPAddress)
|
||||
ip := action.(k8stesting.CreateAction).GetObject().(*networkingv1.IPAddress)
|
||||
_, exists, err := ipStore.GetByKey(ip.Name)
|
||||
if exists && err != nil {
|
||||
return false, nil, fmt.Errorf("ip already exist")
|
||||
@@ -56,15 +56,15 @@ func newTestAllocator(cidr *net.IPNet) (*Allocator, error) {
|
||||
client.PrependReactor("delete", "ipaddresses", k8stesting.ReactionFunc(func(action k8stesting.Action) (bool, runtime.Object, error) {
|
||||
name := action.(k8stesting.DeleteAction).GetName()
|
||||
obj, exists, err := ipStore.GetByKey(name)
|
||||
ip := &networkingv1beta1.IPAddress{}
|
||||
ip := &networkingv1.IPAddress{}
|
||||
if exists && err == nil {
|
||||
ip = obj.(*networkingv1beta1.IPAddress)
|
||||
ip = obj.(*networkingv1.IPAddress)
|
||||
err = ipStore.Delete(ip)
|
||||
}
|
||||
return false, ip, err
|
||||
}))
|
||||
|
||||
c, err := NewIPAllocator(cidr, client.NetworkingV1beta1(), ipInformer)
|
||||
c, err := NewIPAllocator(cidr, client.NetworkingV1(), ipInformer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ func (p RESTStorageProvider) NewRESTStorage(apiResourceConfigSource serverstorag
|
||||
// If you add a version here, be sure to add an entry in `k8s.io/kubernetes/cmd/kube-apiserver/app/aggregator.go with specific priorities.
|
||||
// TODO refactor the plumbing to provide the information in the APIGroupInfo
|
||||
|
||||
if storageMap, err := p.v1alpha1Storage(apiResourceConfigSource, restOptionsGetter); err != nil {
|
||||
if storageMap, err := p.v1beta1Storage(apiResourceConfigSource, restOptionsGetter); err != nil {
|
||||
return genericapiserver.APIGroupInfo{}, err
|
||||
} else if len(storageMap) > 0 {
|
||||
apiGroupInfo.VersionedResourcesStorageMap[networkingapiv1beta1.SchemeGroupVersion.Version] = storageMap
|
||||
@@ -85,10 +85,29 @@ func (p RESTStorageProvider) v1Storage(apiResourceConfigSource serverstorage.API
|
||||
storage[resource] = ingressClassStorage
|
||||
}
|
||||
|
||||
// ipaddress
|
||||
if resource := "ipaddresses"; apiResourceConfigSource.ResourceEnabled(networkingapiv1.SchemeGroupVersion.WithResource(resource)) {
|
||||
ipAddressStorage, err := ipaddressstore.NewREST(restOptionsGetter)
|
||||
if err != nil {
|
||||
return storage, err
|
||||
}
|
||||
storage[resource] = ipAddressStorage
|
||||
}
|
||||
|
||||
// servicecidrs
|
||||
if resource := "servicecidrs"; apiResourceConfigSource.ResourceEnabled(networkingapiv1.SchemeGroupVersion.WithResource(resource)) {
|
||||
serviceCIDRStorage, serviceCIDRStatusStorage, err := servicecidrstore.NewREST(restOptionsGetter)
|
||||
if err != nil {
|
||||
return storage, err
|
||||
}
|
||||
storage[resource] = serviceCIDRStorage
|
||||
storage[resource+"/status"] = serviceCIDRStatusStorage
|
||||
}
|
||||
|
||||
return storage, nil
|
||||
}
|
||||
|
||||
func (p RESTStorageProvider) v1alpha1Storage(apiResourceConfigSource serverstorage.APIResourceConfigSource, restOptionsGetter generic.RESTOptionsGetter) (map[string]rest.Storage, error) {
|
||||
func (p RESTStorageProvider) v1beta1Storage(apiResourceConfigSource serverstorage.APIResourceConfigSource, restOptionsGetter generic.RESTOptionsGetter) (map[string]rest.Storage, error) {
|
||||
storage := map[string]rest.Storage{}
|
||||
|
||||
// ipaddress
|
||||
|
||||
@@ -54,6 +54,9 @@ func (serviceCIDRStrategy) NamespaceScoped() bool {
|
||||
// and should not be modified by the user.
|
||||
func (serviceCIDRStrategy) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
||||
fields := map[fieldpath.APIVersion]*fieldpath.Set{
|
||||
"networking/v1": fieldpath.NewSet(
|
||||
fieldpath.MakePathOrDie("status"),
|
||||
),
|
||||
"networking/v1beta1": fieldpath.NewSet(
|
||||
fieldpath.MakePathOrDie("status"),
|
||||
),
|
||||
@@ -129,6 +132,9 @@ var StatusStrategy = serviceCIDRStatusStrategy{Strategy}
|
||||
// and should not be modified by the user.
|
||||
func (serviceCIDRStatusStrategy) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
||||
fields := map[fieldpath.APIVersion]*fieldpath.Set{
|
||||
"networking/v1": fieldpath.NewSet(
|
||||
fieldpath.MakePathOrDie("spec"),
|
||||
),
|
||||
"networking/v1beta1": fieldpath.NewSet(
|
||||
fieldpath.MakePathOrDie("spec"),
|
||||
),
|
||||
|
||||
@@ -1199,6 +1199,13 @@ items:
|
||||
- create
|
||||
- patch
|
||||
- update
|
||||
- apiGroups:
|
||||
- networking.k8s.io
|
||||
resources:
|
||||
- servicecidrs
|
||||
verbs:
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- discovery.k8s.io
|
||||
resources:
|
||||
|
||||
@@ -476,6 +476,23 @@ items:
|
||||
- kind: ServiceAccount
|
||||
name: service-account-controller
|
||||
namespace: kube-system
|
||||
- apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
annotations:
|
||||
rbac.authorization.kubernetes.io/autoupdate: "true"
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
kubernetes.io/bootstrapping: rbac-defaults
|
||||
name: system:controller:service-cidrs-controller
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: system:controller:service-cidrs-controller
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: service-cidrs-controller
|
||||
namespace: kube-system
|
||||
- apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
|
||||
@@ -1328,6 +1328,57 @@ items:
|
||||
- create
|
||||
- patch
|
||||
- update
|
||||
- apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
annotations:
|
||||
rbac.authorization.kubernetes.io/autoupdate: "true"
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
kubernetes.io/bootstrapping: rbac-defaults
|
||||
name: system:controller:service-cidrs-controller
|
||||
rules:
|
||||
- apiGroups:
|
||||
- networking.k8s.io
|
||||
resources:
|
||||
- servicecidrs
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- watch
|
||||
- apiGroups:
|
||||
- networking.k8s.io
|
||||
resources:
|
||||
- servicecidrs/finalizers
|
||||
verbs:
|
||||
- patch
|
||||
- update
|
||||
- apiGroups:
|
||||
- networking.k8s.io
|
||||
resources:
|
||||
- servicecidrs/status
|
||||
verbs:
|
||||
- patch
|
||||
- update
|
||||
- apiGroups:
|
||||
- networking.k8s.io
|
||||
resources:
|
||||
- ipaddresses
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- ""
|
||||
- events.k8s.io
|
||||
resources:
|
||||
- events
|
||||
verbs:
|
||||
- create
|
||||
- patch
|
||||
- update
|
||||
- apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
|
||||
1997
staging/src/k8s.io/api/networking/v1/generated.pb.go
generated
1997
staging/src/k8s.io/api/networking/v1/generated.pb.go
generated
File diff suppressed because it is too large
Load Diff
@@ -72,6 +72,44 @@ message HTTPIngressRuleValue {
|
||||
repeated HTTPIngressPath paths = 1;
|
||||
}
|
||||
|
||||
// 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
|
||||
message IPAddress {
|
||||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||
|
||||
// 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
|
||||
optional IPAddressSpec spec = 2;
|
||||
}
|
||||
|
||||
// IPAddressList contains a list of IPAddress.
|
||||
message IPAddressList {
|
||||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
|
||||
|
||||
// items is the list of IPAddresses.
|
||||
repeated IPAddress items = 2;
|
||||
}
|
||||
|
||||
// IPAddressSpec describe the attributes in an IP Address.
|
||||
message IPAddressSpec {
|
||||
// ParentRef references the resource that an IPAddress is attached to.
|
||||
// An IPAddress must reference a parent object.
|
||||
// +required
|
||||
optional ParentReference parentRef = 1;
|
||||
}
|
||||
|
||||
// IPBlock describes a particular CIDR (Ex. "192.168.1.0/24","2001:db8::/64") that is allowed
|
||||
// to the pods matched by a NetworkPolicySpec's podSelector. The except entry describes CIDRs
|
||||
// that should not be included within this rule.
|
||||
@@ -540,6 +578,25 @@ message NetworkPolicySpec {
|
||||
repeated string policyTypes = 4;
|
||||
}
|
||||
|
||||
// ParentReference describes a reference to a parent object.
|
||||
message ParentReference {
|
||||
// Group is the group of the object being referenced.
|
||||
// +optional
|
||||
optional string group = 1;
|
||||
|
||||
// Resource is the resource of the object being referenced.
|
||||
// +required
|
||||
optional string resource = 2;
|
||||
|
||||
// Namespace is the namespace of the object being referenced.
|
||||
// +optional
|
||||
optional string namespace = 3;
|
||||
|
||||
// Name is the name of the object being referenced.
|
||||
// +required
|
||||
optional string name = 4;
|
||||
}
|
||||
|
||||
// ServiceBackendPort is the service port being referenced.
|
||||
// +structType=atomic
|
||||
message ServiceBackendPort {
|
||||
@@ -554,3 +611,55 @@ message ServiceBackendPort {
|
||||
optional int32 number = 2;
|
||||
}
|
||||
|
||||
// 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.
|
||||
message ServiceCIDR {
|
||||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||
|
||||
// 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
|
||||
optional ServiceCIDRSpec spec = 2;
|
||||
|
||||
// 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
|
||||
optional ServiceCIDRStatus status = 3;
|
||||
}
|
||||
|
||||
// ServiceCIDRList contains a list of ServiceCIDR objects.
|
||||
message ServiceCIDRList {
|
||||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
|
||||
|
||||
// items is the list of ServiceCIDRs.
|
||||
repeated ServiceCIDR items = 2;
|
||||
}
|
||||
|
||||
// ServiceCIDRSpec define the CIDRs the user wants to use for allocating ClusterIPs for Services.
|
||||
message ServiceCIDRSpec {
|
||||
// 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
|
||||
repeated string cidrs = 1;
|
||||
}
|
||||
|
||||
// ServiceCIDRStatus describes the current state of the ServiceCIDR.
|
||||
message ServiceCIDRStatus {
|
||||
// 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
|
||||
repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -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"`
|
||||
}
|
||||
|
||||
@@ -47,6 +47,35 @@ func (HTTPIngressRuleValue) SwaggerDoc() map[string]string {
|
||||
return map_HTTPIngressRuleValue
|
||||
}
|
||||
|
||||
var map_IPAddress = map[string]string{
|
||||
"": "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",
|
||||
"metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
|
||||
"spec": "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",
|
||||
}
|
||||
|
||||
func (IPAddress) SwaggerDoc() map[string]string {
|
||||
return map_IPAddress
|
||||
}
|
||||
|
||||
var map_IPAddressList = map[string]string{
|
||||
"": "IPAddressList contains a list of IPAddress.",
|
||||
"metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
|
||||
"items": "items is the list of IPAddresses.",
|
||||
}
|
||||
|
||||
func (IPAddressList) SwaggerDoc() map[string]string {
|
||||
return map_IPAddressList
|
||||
}
|
||||
|
||||
var map_IPAddressSpec = map[string]string{
|
||||
"": "IPAddressSpec describe the attributes in an IP Address.",
|
||||
"parentRef": "ParentRef references the resource that an IPAddress is attached to. An IPAddress must reference a parent object.",
|
||||
}
|
||||
|
||||
func (IPAddressSpec) SwaggerDoc() map[string]string {
|
||||
return map_IPAddressSpec
|
||||
}
|
||||
|
||||
var map_IPBlock = map[string]string{
|
||||
"": "IPBlock describes a particular CIDR (Ex. \"192.168.1.0/24\",\"2001:db8::/64\") that is allowed to the pods matched by a NetworkPolicySpec's podSelector. The except entry describes CIDRs that should not be included within this rule.",
|
||||
"cidr": "cidr is a string representing the IPBlock Valid examples are \"192.168.1.0/24\" or \"2001:db8::/64\"",
|
||||
@@ -294,6 +323,18 @@ func (NetworkPolicySpec) SwaggerDoc() map[string]string {
|
||||
return map_NetworkPolicySpec
|
||||
}
|
||||
|
||||
var map_ParentReference = map[string]string{
|
||||
"": "ParentReference describes a reference to a parent object.",
|
||||
"group": "Group is the group of the object being referenced.",
|
||||
"resource": "Resource is the resource of the object being referenced.",
|
||||
"namespace": "Namespace is the namespace of the object being referenced.",
|
||||
"name": "Name is the name of the object being referenced.",
|
||||
}
|
||||
|
||||
func (ParentReference) SwaggerDoc() map[string]string {
|
||||
return map_ParentReference
|
||||
}
|
||||
|
||||
var map_ServiceBackendPort = map[string]string{
|
||||
"": "ServiceBackendPort is the service port being referenced.",
|
||||
"name": "name is the name of the port on the Service. This is a mutually exclusive setting with \"Number\".",
|
||||
@@ -304,4 +345,43 @@ func (ServiceBackendPort) SwaggerDoc() map[string]string {
|
||||
return map_ServiceBackendPort
|
||||
}
|
||||
|
||||
var map_ServiceCIDR = map[string]string{
|
||||
"": "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.",
|
||||
"metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
|
||||
"spec": "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",
|
||||
"status": "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",
|
||||
}
|
||||
|
||||
func (ServiceCIDR) SwaggerDoc() map[string]string {
|
||||
return map_ServiceCIDR
|
||||
}
|
||||
|
||||
var map_ServiceCIDRList = map[string]string{
|
||||
"": "ServiceCIDRList contains a list of ServiceCIDR objects.",
|
||||
"metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
|
||||
"items": "items is the list of ServiceCIDRs.",
|
||||
}
|
||||
|
||||
func (ServiceCIDRList) SwaggerDoc() map[string]string {
|
||||
return map_ServiceCIDRList
|
||||
}
|
||||
|
||||
var map_ServiceCIDRSpec = map[string]string{
|
||||
"": "ServiceCIDRSpec define the CIDRs the user wants to use for allocating ClusterIPs for Services.",
|
||||
"cidrs": "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.",
|
||||
}
|
||||
|
||||
func (ServiceCIDRSpec) SwaggerDoc() map[string]string {
|
||||
return map_ServiceCIDRSpec
|
||||
}
|
||||
|
||||
var map_ServiceCIDRStatus = map[string]string{
|
||||
"": "ServiceCIDRStatus describes the current state of the ServiceCIDR.",
|
||||
"conditions": "conditions holds an array of metav1.Condition that describe the state of the ServiceCIDR. Current service state",
|
||||
}
|
||||
|
||||
func (ServiceCIDRStatus) SwaggerDoc() map[string]string {
|
||||
return map_ServiceCIDRStatus
|
||||
}
|
||||
|
||||
// AUTO-GENERATED FUNCTIONS END HERE
|
||||
|
||||
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"
|
||||
)
|
||||
@@ -73,6 +73,87 @@ func (in *HTTPIngressRuleValue) DeepCopy() *HTTPIngressRuleValue {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *IPAddress) DeepCopyInto(out *IPAddress) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddress.
|
||||
func (in *IPAddress) DeepCopy() *IPAddress {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(IPAddress)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *IPAddress) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *IPAddressList) DeepCopyInto(out *IPAddressList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]IPAddress, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddressList.
|
||||
func (in *IPAddressList) DeepCopy() *IPAddressList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(IPAddressList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *IPAddressList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *IPAddressSpec) DeepCopyInto(out *IPAddressSpec) {
|
||||
*out = *in
|
||||
if in.ParentRef != nil {
|
||||
in, out := &in.ParentRef, &out.ParentRef
|
||||
*out = new(ParentReference)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddressSpec.
|
||||
func (in *IPAddressSpec) DeepCopy() *IPAddressSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(IPAddressSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *IPBlock) DeepCopyInto(out *IPBlock) {
|
||||
*out = *in
|
||||
@@ -711,6 +792,22 @@ func (in *NetworkPolicySpec) DeepCopy() *NetworkPolicySpec {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ParentReference) DeepCopyInto(out *ParentReference) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ParentReference.
|
||||
func (in *ParentReference) DeepCopy() *ParentReference {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ParentReference)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ServiceBackendPort) DeepCopyInto(out *ServiceBackendPort) {
|
||||
*out = *in
|
||||
@@ -726,3 +823,108 @@ func (in *ServiceBackendPort) DeepCopy() *ServiceBackendPort {
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ServiceCIDR) DeepCopyInto(out *ServiceCIDR) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceCIDR.
|
||||
func (in *ServiceCIDR) DeepCopy() *ServiceCIDR {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ServiceCIDR)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ServiceCIDR) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ServiceCIDRList) DeepCopyInto(out *ServiceCIDRList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]ServiceCIDR, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceCIDRList.
|
||||
func (in *ServiceCIDRList) DeepCopy() *ServiceCIDRList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ServiceCIDRList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ServiceCIDRList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ServiceCIDRSpec) DeepCopyInto(out *ServiceCIDRSpec) {
|
||||
*out = *in
|
||||
if in.CIDRs != nil {
|
||||
in, out := &in.CIDRs, &out.CIDRs
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceCIDRSpec.
|
||||
func (in *ServiceCIDRSpec) DeepCopy() *ServiceCIDRSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ServiceCIDRSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ServiceCIDRStatus) DeepCopyInto(out *ServiceCIDRStatus) {
|
||||
*out = *in
|
||||
if in.Conditions != nil {
|
||||
in, out := &in.Conditions, &out.Conditions
|
||||
*out = make([]metav1.Condition, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceCIDRStatus.
|
||||
func (in *ServiceCIDRStatus) DeepCopy() *ServiceCIDRStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ServiceCIDRStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
@@ -21,6 +21,18 @@ limitations under the License.
|
||||
|
||||
package v1
|
||||
|
||||
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
|
||||
func (in *IPAddress) APILifecycleIntroduced() (major, minor int) {
|
||||
return 1, 33
|
||||
}
|
||||
|
||||
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
|
||||
func (in *IPAddressList) APILifecycleIntroduced() (major, minor int) {
|
||||
return 1, 33
|
||||
}
|
||||
|
||||
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
|
||||
func (in *Ingress) APILifecycleIntroduced() (major, minor int) {
|
||||
@@ -56,3 +68,15 @@ func (in *NetworkPolicy) APILifecycleIntroduced() (major, minor int) {
|
||||
func (in *NetworkPolicyList) APILifecycleIntroduced() (major, minor int) {
|
||||
return 1, 19
|
||||
}
|
||||
|
||||
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
|
||||
func (in *ServiceCIDR) APILifecycleIntroduced() (major, minor int) {
|
||||
return 1, 33
|
||||
}
|
||||
|
||||
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
|
||||
func (in *ServiceCIDRList) APILifecycleIntroduced() (major, minor int) {
|
||||
return 1, 33
|
||||
}
|
||||
|
||||
54
staging/src/k8s.io/api/testdata/HEAD/networking.k8s.io.v1.IPAddress.json
vendored
Normal file
54
staging/src/k8s.io/api/testdata/HEAD/networking.k8s.io.v1.IPAddress.json
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"kind": "IPAddress",
|
||||
"apiVersion": "networking.k8s.io/v1",
|
||||
"metadata": {
|
||||
"name": "nameValue",
|
||||
"generateName": "generateNameValue",
|
||||
"namespace": "namespaceValue",
|
||||
"selfLink": "selfLinkValue",
|
||||
"uid": "uidValue",
|
||||
"resourceVersion": "resourceVersionValue",
|
||||
"generation": 7,
|
||||
"creationTimestamp": "2008-01-01T01:01:01Z",
|
||||
"deletionTimestamp": "2009-01-01T01:01:01Z",
|
||||
"deletionGracePeriodSeconds": 10,
|
||||
"labels": {
|
||||
"labelsKey": "labelsValue"
|
||||
},
|
||||
"annotations": {
|
||||
"annotationsKey": "annotationsValue"
|
||||
},
|
||||
"ownerReferences": [
|
||||
{
|
||||
"apiVersion": "apiVersionValue",
|
||||
"kind": "kindValue",
|
||||
"name": "nameValue",
|
||||
"uid": "uidValue",
|
||||
"controller": true,
|
||||
"blockOwnerDeletion": true
|
||||
}
|
||||
],
|
||||
"finalizers": [
|
||||
"finalizersValue"
|
||||
],
|
||||
"managedFields": [
|
||||
{
|
||||
"manager": "managerValue",
|
||||
"operation": "operationValue",
|
||||
"apiVersion": "apiVersionValue",
|
||||
"time": "2004-01-01T01:01:01Z",
|
||||
"fieldsType": "fieldsTypeValue",
|
||||
"fieldsV1": {},
|
||||
"subresource": "subresourceValue"
|
||||
}
|
||||
]
|
||||
},
|
||||
"spec": {
|
||||
"parentRef": {
|
||||
"group": "groupValue",
|
||||
"resource": "resourceValue",
|
||||
"namespace": "namespaceValue",
|
||||
"name": "nameValue"
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
staging/src/k8s.io/api/testdata/HEAD/networking.k8s.io.v1.IPAddress.pb
vendored
Normal file
BIN
staging/src/k8s.io/api/testdata/HEAD/networking.k8s.io.v1.IPAddress.pb
vendored
Normal file
Binary file not shown.
40
staging/src/k8s.io/api/testdata/HEAD/networking.k8s.io.v1.IPAddress.yaml
vendored
Normal file
40
staging/src/k8s.io/api/testdata/HEAD/networking.k8s.io.v1.IPAddress.yaml
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: IPAddress
|
||||
metadata:
|
||||
annotations:
|
||||
annotationsKey: annotationsValue
|
||||
creationTimestamp: "2008-01-01T01:01:01Z"
|
||||
deletionGracePeriodSeconds: 10
|
||||
deletionTimestamp: "2009-01-01T01:01:01Z"
|
||||
finalizers:
|
||||
- finalizersValue
|
||||
generateName: generateNameValue
|
||||
generation: 7
|
||||
labels:
|
||||
labelsKey: labelsValue
|
||||
managedFields:
|
||||
- apiVersion: apiVersionValue
|
||||
fieldsType: fieldsTypeValue
|
||||
fieldsV1: {}
|
||||
manager: managerValue
|
||||
operation: operationValue
|
||||
subresource: subresourceValue
|
||||
time: "2004-01-01T01:01:01Z"
|
||||
name: nameValue
|
||||
namespace: namespaceValue
|
||||
ownerReferences:
|
||||
- apiVersion: apiVersionValue
|
||||
blockOwnerDeletion: true
|
||||
controller: true
|
||||
kind: kindValue
|
||||
name: nameValue
|
||||
uid: uidValue
|
||||
resourceVersion: resourceVersionValue
|
||||
selfLink: selfLinkValue
|
||||
uid: uidValue
|
||||
spec:
|
||||
parentRef:
|
||||
group: groupValue
|
||||
name: nameValue
|
||||
namespace: namespaceValue
|
||||
resource: resourceValue
|
||||
63
staging/src/k8s.io/api/testdata/HEAD/networking.k8s.io.v1.ServiceCIDR.json
vendored
Normal file
63
staging/src/k8s.io/api/testdata/HEAD/networking.k8s.io.v1.ServiceCIDR.json
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"kind": "ServiceCIDR",
|
||||
"apiVersion": "networking.k8s.io/v1",
|
||||
"metadata": {
|
||||
"name": "nameValue",
|
||||
"generateName": "generateNameValue",
|
||||
"namespace": "namespaceValue",
|
||||
"selfLink": "selfLinkValue",
|
||||
"uid": "uidValue",
|
||||
"resourceVersion": "resourceVersionValue",
|
||||
"generation": 7,
|
||||
"creationTimestamp": "2008-01-01T01:01:01Z",
|
||||
"deletionTimestamp": "2009-01-01T01:01:01Z",
|
||||
"deletionGracePeriodSeconds": 10,
|
||||
"labels": {
|
||||
"labelsKey": "labelsValue"
|
||||
},
|
||||
"annotations": {
|
||||
"annotationsKey": "annotationsValue"
|
||||
},
|
||||
"ownerReferences": [
|
||||
{
|
||||
"apiVersion": "apiVersionValue",
|
||||
"kind": "kindValue",
|
||||
"name": "nameValue",
|
||||
"uid": "uidValue",
|
||||
"controller": true,
|
||||
"blockOwnerDeletion": true
|
||||
}
|
||||
],
|
||||
"finalizers": [
|
||||
"finalizersValue"
|
||||
],
|
||||
"managedFields": [
|
||||
{
|
||||
"manager": "managerValue",
|
||||
"operation": "operationValue",
|
||||
"apiVersion": "apiVersionValue",
|
||||
"time": "2004-01-01T01:01:01Z",
|
||||
"fieldsType": "fieldsTypeValue",
|
||||
"fieldsV1": {},
|
||||
"subresource": "subresourceValue"
|
||||
}
|
||||
]
|
||||
},
|
||||
"spec": {
|
||||
"cidrs": [
|
||||
"cidrsValue"
|
||||
]
|
||||
},
|
||||
"status": {
|
||||
"conditions": [
|
||||
{
|
||||
"type": "typeValue",
|
||||
"status": "statusValue",
|
||||
"observedGeneration": 3,
|
||||
"lastTransitionTime": "2004-01-01T01:01:01Z",
|
||||
"reason": "reasonValue",
|
||||
"message": "messageValue"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
BIN
staging/src/k8s.io/api/testdata/HEAD/networking.k8s.io.v1.ServiceCIDR.pb
vendored
Normal file
BIN
staging/src/k8s.io/api/testdata/HEAD/networking.k8s.io.v1.ServiceCIDR.pb
vendored
Normal file
Binary file not shown.
45
staging/src/k8s.io/api/testdata/HEAD/networking.k8s.io.v1.ServiceCIDR.yaml
vendored
Normal file
45
staging/src/k8s.io/api/testdata/HEAD/networking.k8s.io.v1.ServiceCIDR.yaml
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: ServiceCIDR
|
||||
metadata:
|
||||
annotations:
|
||||
annotationsKey: annotationsValue
|
||||
creationTimestamp: "2008-01-01T01:01:01Z"
|
||||
deletionGracePeriodSeconds: 10
|
||||
deletionTimestamp: "2009-01-01T01:01:01Z"
|
||||
finalizers:
|
||||
- finalizersValue
|
||||
generateName: generateNameValue
|
||||
generation: 7
|
||||
labels:
|
||||
labelsKey: labelsValue
|
||||
managedFields:
|
||||
- apiVersion: apiVersionValue
|
||||
fieldsType: fieldsTypeValue
|
||||
fieldsV1: {}
|
||||
manager: managerValue
|
||||
operation: operationValue
|
||||
subresource: subresourceValue
|
||||
time: "2004-01-01T01:01:01Z"
|
||||
name: nameValue
|
||||
namespace: namespaceValue
|
||||
ownerReferences:
|
||||
- apiVersion: apiVersionValue
|
||||
blockOwnerDeletion: true
|
||||
controller: true
|
||||
kind: kindValue
|
||||
name: nameValue
|
||||
uid: uidValue
|
||||
resourceVersion: resourceVersionValue
|
||||
selfLink: selfLinkValue
|
||||
uid: uidValue
|
||||
spec:
|
||||
cidrs:
|
||||
- cidrsValue
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: "2004-01-01T01:01:01Z"
|
||||
message: messageValue
|
||||
observedGeneration: 3
|
||||
reason: reasonValue
|
||||
status: statusValue
|
||||
type: typeValue
|
||||
@@ -10911,6 +10911,29 @@ var schemaYAML = typed.YAMLObject(`types:
|
||||
elementType:
|
||||
namedType: io.k8s.api.networking.v1.HTTPIngressPath
|
||||
elementRelationship: atomic
|
||||
- name: io.k8s.api.networking.v1.IPAddress
|
||||
map:
|
||||
fields:
|
||||
- name: apiVersion
|
||||
type:
|
||||
scalar: string
|
||||
- name: kind
|
||||
type:
|
||||
scalar: string
|
||||
- name: metadata
|
||||
type:
|
||||
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
|
||||
default: {}
|
||||
- name: spec
|
||||
type:
|
||||
namedType: io.k8s.api.networking.v1.IPAddressSpec
|
||||
default: {}
|
||||
- name: io.k8s.api.networking.v1.IPAddressSpec
|
||||
map:
|
||||
fields:
|
||||
- name: parentRef
|
||||
type:
|
||||
namedType: io.k8s.api.networking.v1.ParentReference
|
||||
- name: io.k8s.api.networking.v1.IPBlock
|
||||
map:
|
||||
fields:
|
||||
@@ -11194,6 +11217,21 @@ var schemaYAML = typed.YAMLObject(`types:
|
||||
elementType:
|
||||
scalar: string
|
||||
elementRelationship: atomic
|
||||
- name: io.k8s.api.networking.v1.ParentReference
|
||||
map:
|
||||
fields:
|
||||
- name: group
|
||||
type:
|
||||
scalar: string
|
||||
- name: name
|
||||
type:
|
||||
scalar: string
|
||||
- name: namespace
|
||||
type:
|
||||
scalar: string
|
||||
- name: resource
|
||||
type:
|
||||
scalar: string
|
||||
- name: io.k8s.api.networking.v1.ServiceBackendPort
|
||||
map:
|
||||
fields:
|
||||
@@ -11204,6 +11242,47 @@ var schemaYAML = typed.YAMLObject(`types:
|
||||
type:
|
||||
scalar: numeric
|
||||
elementRelationship: atomic
|
||||
- name: io.k8s.api.networking.v1.ServiceCIDR
|
||||
map:
|
||||
fields:
|
||||
- name: apiVersion
|
||||
type:
|
||||
scalar: string
|
||||
- name: kind
|
||||
type:
|
||||
scalar: string
|
||||
- name: metadata
|
||||
type:
|
||||
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
|
||||
default: {}
|
||||
- name: spec
|
||||
type:
|
||||
namedType: io.k8s.api.networking.v1.ServiceCIDRSpec
|
||||
default: {}
|
||||
- name: status
|
||||
type:
|
||||
namedType: io.k8s.api.networking.v1.ServiceCIDRStatus
|
||||
default: {}
|
||||
- name: io.k8s.api.networking.v1.ServiceCIDRSpec
|
||||
map:
|
||||
fields:
|
||||
- name: cidrs
|
||||
type:
|
||||
list:
|
||||
elementType:
|
||||
scalar: string
|
||||
elementRelationship: atomic
|
||||
- name: io.k8s.api.networking.v1.ServiceCIDRStatus
|
||||
map:
|
||||
fields:
|
||||
- name: conditions
|
||||
type:
|
||||
list:
|
||||
elementType:
|
||||
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition
|
||||
elementRelationship: associative
|
||||
keys:
|
||||
- type
|
||||
- name: io.k8s.api.networking.v1alpha1.IPAddress
|
||||
map:
|
||||
fields:
|
||||
|
||||
@@ -0,0 +1,253 @@
|
||||
/*
|
||||
Copyright 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.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
apismetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
managedfields "k8s.io/apimachinery/pkg/util/managedfields"
|
||||
internal "k8s.io/client-go/applyconfigurations/internal"
|
||||
metav1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
)
|
||||
|
||||
// IPAddressApplyConfiguration represents a declarative configuration of the IPAddress type for use
|
||||
// with apply.
|
||||
type IPAddressApplyConfiguration struct {
|
||||
metav1.TypeMetaApplyConfiguration `json:",inline"`
|
||||
*metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||
Spec *IPAddressSpecApplyConfiguration `json:"spec,omitempty"`
|
||||
}
|
||||
|
||||
// IPAddress constructs a declarative configuration of the IPAddress type for use with
|
||||
// apply.
|
||||
func IPAddress(name string) *IPAddressApplyConfiguration {
|
||||
b := &IPAddressApplyConfiguration{}
|
||||
b.WithName(name)
|
||||
b.WithKind("IPAddress")
|
||||
b.WithAPIVersion("networking.k8s.io/v1")
|
||||
return b
|
||||
}
|
||||
|
||||
// ExtractIPAddress extracts the applied configuration owned by fieldManager from
|
||||
// iPAddress. If no managedFields are found in iPAddress for fieldManager, a
|
||||
// IPAddressApplyConfiguration is returned with only the Name, Namespace (if applicable),
|
||||
// APIVersion and Kind populated. It is possible that no managed fields were found for because other
|
||||
// field managers have taken ownership of all the fields previously owned by fieldManager, or because
|
||||
// the fieldManager never owned fields any fields.
|
||||
// iPAddress must be a unmodified IPAddress API object that was retrieved from the Kubernetes API.
|
||||
// ExtractIPAddress provides a way to perform a extract/modify-in-place/apply workflow.
|
||||
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
|
||||
// applied if another fieldManager has updated or force applied any of the previously applied fields.
|
||||
// Experimental!
|
||||
func ExtractIPAddress(iPAddress *networkingv1.IPAddress, fieldManager string) (*IPAddressApplyConfiguration, error) {
|
||||
return extractIPAddress(iPAddress, fieldManager, "")
|
||||
}
|
||||
|
||||
// ExtractIPAddressStatus is the same as ExtractIPAddress except
|
||||
// that it extracts the status subresource applied configuration.
|
||||
// Experimental!
|
||||
func ExtractIPAddressStatus(iPAddress *networkingv1.IPAddress, fieldManager string) (*IPAddressApplyConfiguration, error) {
|
||||
return extractIPAddress(iPAddress, fieldManager, "status")
|
||||
}
|
||||
|
||||
func extractIPAddress(iPAddress *networkingv1.IPAddress, fieldManager string, subresource string) (*IPAddressApplyConfiguration, error) {
|
||||
b := &IPAddressApplyConfiguration{}
|
||||
err := managedfields.ExtractInto(iPAddress, internal.Parser().Type("io.k8s.api.networking.v1.IPAddress"), fieldManager, b, subresource)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b.WithName(iPAddress.Name)
|
||||
|
||||
b.WithKind("IPAddress")
|
||||
b.WithAPIVersion("networking.k8s.io/v1")
|
||||
return b, nil
|
||||
}
|
||||
|
||||
// WithKind sets the Kind field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Kind field is set to the value of the last call.
|
||||
func (b *IPAddressApplyConfiguration) WithKind(value string) *IPAddressApplyConfiguration {
|
||||
b.TypeMetaApplyConfiguration.Kind = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the APIVersion field is set to the value of the last call.
|
||||
func (b *IPAddressApplyConfiguration) WithAPIVersion(value string) *IPAddressApplyConfiguration {
|
||||
b.TypeMetaApplyConfiguration.APIVersion = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithName sets the Name field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Name field is set to the value of the last call.
|
||||
func (b *IPAddressApplyConfiguration) WithName(value string) *IPAddressApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.Name = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithGenerateName sets the GenerateName field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the GenerateName field is set to the value of the last call.
|
||||
func (b *IPAddressApplyConfiguration) WithGenerateName(value string) *IPAddressApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.GenerateName = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithNamespace sets the Namespace field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Namespace field is set to the value of the last call.
|
||||
func (b *IPAddressApplyConfiguration) WithNamespace(value string) *IPAddressApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.Namespace = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithUID sets the UID field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the UID field is set to the value of the last call.
|
||||
func (b *IPAddressApplyConfiguration) WithUID(value types.UID) *IPAddressApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.UID = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the ResourceVersion field is set to the value of the last call.
|
||||
func (b *IPAddressApplyConfiguration) WithResourceVersion(value string) *IPAddressApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.ResourceVersion = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithGeneration sets the Generation field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Generation field is set to the value of the last call.
|
||||
func (b *IPAddressApplyConfiguration) WithGeneration(value int64) *IPAddressApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.Generation = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the CreationTimestamp field is set to the value of the last call.
|
||||
func (b *IPAddressApplyConfiguration) WithCreationTimestamp(value apismetav1.Time) *IPAddressApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.CreationTimestamp = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the DeletionTimestamp field is set to the value of the last call.
|
||||
func (b *IPAddressApplyConfiguration) WithDeletionTimestamp(value apismetav1.Time) *IPAddressApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
|
||||
func (b *IPAddressApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *IPAddressApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithLabels puts the entries into the Labels field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, the entries provided by each call will be put on the Labels field,
|
||||
// overwriting an existing map entries in Labels field with the same key.
|
||||
func (b *IPAddressApplyConfiguration) WithLabels(entries map[string]string) *IPAddressApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 {
|
||||
b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries))
|
||||
}
|
||||
for k, v := range entries {
|
||||
b.ObjectMetaApplyConfiguration.Labels[k] = v
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithAnnotations puts the entries into the Annotations field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, the entries provided by each call will be put on the Annotations field,
|
||||
// overwriting an existing map entries in Annotations field with the same key.
|
||||
func (b *IPAddressApplyConfiguration) WithAnnotations(entries map[string]string) *IPAddressApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 {
|
||||
b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries))
|
||||
}
|
||||
for k, v := range entries {
|
||||
b.ObjectMetaApplyConfiguration.Annotations[k] = v
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the OwnerReferences field.
|
||||
func (b *IPAddressApplyConfiguration) WithOwnerReferences(values ...*metav1.OwnerReferenceApplyConfiguration) *IPAddressApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
for i := range values {
|
||||
if values[i] == nil {
|
||||
panic("nil value passed to WithOwnerReferences")
|
||||
}
|
||||
b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithFinalizers adds the given value to the Finalizers field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the Finalizers field.
|
||||
func (b *IPAddressApplyConfiguration) WithFinalizers(values ...string) *IPAddressApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
for i := range values {
|
||||
b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (b *IPAddressApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
|
||||
if b.ObjectMetaApplyConfiguration == nil {
|
||||
b.ObjectMetaApplyConfiguration = &metav1.ObjectMetaApplyConfiguration{}
|
||||
}
|
||||
}
|
||||
|
||||
// WithSpec sets the Spec field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Spec field is set to the value of the last call.
|
||||
func (b *IPAddressApplyConfiguration) WithSpec(value *IPAddressSpecApplyConfiguration) *IPAddressApplyConfiguration {
|
||||
b.Spec = value
|
||||
return b
|
||||
}
|
||||
|
||||
// GetName retrieves the value of the Name field in the declarative configuration.
|
||||
func (b *IPAddressApplyConfiguration) GetName() *string {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
return b.ObjectMetaApplyConfiguration.Name
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
Copyright 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.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
// IPAddressSpecApplyConfiguration represents a declarative configuration of the IPAddressSpec type for use
|
||||
// with apply.
|
||||
type IPAddressSpecApplyConfiguration struct {
|
||||
ParentRef *ParentReferenceApplyConfiguration `json:"parentRef,omitempty"`
|
||||
}
|
||||
|
||||
// IPAddressSpecApplyConfiguration constructs a declarative configuration of the IPAddressSpec type for use with
|
||||
// apply.
|
||||
func IPAddressSpec() *IPAddressSpecApplyConfiguration {
|
||||
return &IPAddressSpecApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithParentRef sets the ParentRef field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the ParentRef field is set to the value of the last call.
|
||||
func (b *IPAddressSpecApplyConfiguration) WithParentRef(value *ParentReferenceApplyConfiguration) *IPAddressSpecApplyConfiguration {
|
||||
b.ParentRef = value
|
||||
return b
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
Copyright 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.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
// ParentReferenceApplyConfiguration represents a declarative configuration of the ParentReference type for use
|
||||
// with apply.
|
||||
type ParentReferenceApplyConfiguration struct {
|
||||
Group *string `json:"group,omitempty"`
|
||||
Resource *string `json:"resource,omitempty"`
|
||||
Namespace *string `json:"namespace,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// ParentReferenceApplyConfiguration constructs a declarative configuration of the ParentReference type for use with
|
||||
// apply.
|
||||
func ParentReference() *ParentReferenceApplyConfiguration {
|
||||
return &ParentReferenceApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithGroup sets the Group field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Group field is set to the value of the last call.
|
||||
func (b *ParentReferenceApplyConfiguration) WithGroup(value string) *ParentReferenceApplyConfiguration {
|
||||
b.Group = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithResource sets the Resource field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Resource field is set to the value of the last call.
|
||||
func (b *ParentReferenceApplyConfiguration) WithResource(value string) *ParentReferenceApplyConfiguration {
|
||||
b.Resource = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithNamespace sets the Namespace field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Namespace field is set to the value of the last call.
|
||||
func (b *ParentReferenceApplyConfiguration) WithNamespace(value string) *ParentReferenceApplyConfiguration {
|
||||
b.Namespace = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithName sets the Name field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Name field is set to the value of the last call.
|
||||
func (b *ParentReferenceApplyConfiguration) WithName(value string) *ParentReferenceApplyConfiguration {
|
||||
b.Name = &value
|
||||
return b
|
||||
}
|
||||
@@ -0,0 +1,262 @@
|
||||
/*
|
||||
Copyright 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.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
apismetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
managedfields "k8s.io/apimachinery/pkg/util/managedfields"
|
||||
internal "k8s.io/client-go/applyconfigurations/internal"
|
||||
metav1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
)
|
||||
|
||||
// ServiceCIDRApplyConfiguration represents a declarative configuration of the ServiceCIDR type for use
|
||||
// with apply.
|
||||
type ServiceCIDRApplyConfiguration struct {
|
||||
metav1.TypeMetaApplyConfiguration `json:",inline"`
|
||||
*metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||
Spec *ServiceCIDRSpecApplyConfiguration `json:"spec,omitempty"`
|
||||
Status *ServiceCIDRStatusApplyConfiguration `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// ServiceCIDR constructs a declarative configuration of the ServiceCIDR type for use with
|
||||
// apply.
|
||||
func ServiceCIDR(name string) *ServiceCIDRApplyConfiguration {
|
||||
b := &ServiceCIDRApplyConfiguration{}
|
||||
b.WithName(name)
|
||||
b.WithKind("ServiceCIDR")
|
||||
b.WithAPIVersion("networking.k8s.io/v1")
|
||||
return b
|
||||
}
|
||||
|
||||
// ExtractServiceCIDR extracts the applied configuration owned by fieldManager from
|
||||
// serviceCIDR. If no managedFields are found in serviceCIDR for fieldManager, a
|
||||
// ServiceCIDRApplyConfiguration is returned with only the Name, Namespace (if applicable),
|
||||
// APIVersion and Kind populated. It is possible that no managed fields were found for because other
|
||||
// field managers have taken ownership of all the fields previously owned by fieldManager, or because
|
||||
// the fieldManager never owned fields any fields.
|
||||
// serviceCIDR must be a unmodified ServiceCIDR API object that was retrieved from the Kubernetes API.
|
||||
// ExtractServiceCIDR provides a way to perform a extract/modify-in-place/apply workflow.
|
||||
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
|
||||
// applied if another fieldManager has updated or force applied any of the previously applied fields.
|
||||
// Experimental!
|
||||
func ExtractServiceCIDR(serviceCIDR *networkingv1.ServiceCIDR, fieldManager string) (*ServiceCIDRApplyConfiguration, error) {
|
||||
return extractServiceCIDR(serviceCIDR, fieldManager, "")
|
||||
}
|
||||
|
||||
// ExtractServiceCIDRStatus is the same as ExtractServiceCIDR except
|
||||
// that it extracts the status subresource applied configuration.
|
||||
// Experimental!
|
||||
func ExtractServiceCIDRStatus(serviceCIDR *networkingv1.ServiceCIDR, fieldManager string) (*ServiceCIDRApplyConfiguration, error) {
|
||||
return extractServiceCIDR(serviceCIDR, fieldManager, "status")
|
||||
}
|
||||
|
||||
func extractServiceCIDR(serviceCIDR *networkingv1.ServiceCIDR, fieldManager string, subresource string) (*ServiceCIDRApplyConfiguration, error) {
|
||||
b := &ServiceCIDRApplyConfiguration{}
|
||||
err := managedfields.ExtractInto(serviceCIDR, internal.Parser().Type("io.k8s.api.networking.v1.ServiceCIDR"), fieldManager, b, subresource)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b.WithName(serviceCIDR.Name)
|
||||
|
||||
b.WithKind("ServiceCIDR")
|
||||
b.WithAPIVersion("networking.k8s.io/v1")
|
||||
return b, nil
|
||||
}
|
||||
|
||||
// WithKind sets the Kind field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Kind field is set to the value of the last call.
|
||||
func (b *ServiceCIDRApplyConfiguration) WithKind(value string) *ServiceCIDRApplyConfiguration {
|
||||
b.TypeMetaApplyConfiguration.Kind = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the APIVersion field is set to the value of the last call.
|
||||
func (b *ServiceCIDRApplyConfiguration) WithAPIVersion(value string) *ServiceCIDRApplyConfiguration {
|
||||
b.TypeMetaApplyConfiguration.APIVersion = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithName sets the Name field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Name field is set to the value of the last call.
|
||||
func (b *ServiceCIDRApplyConfiguration) WithName(value string) *ServiceCIDRApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.Name = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithGenerateName sets the GenerateName field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the GenerateName field is set to the value of the last call.
|
||||
func (b *ServiceCIDRApplyConfiguration) WithGenerateName(value string) *ServiceCIDRApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.GenerateName = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithNamespace sets the Namespace field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Namespace field is set to the value of the last call.
|
||||
func (b *ServiceCIDRApplyConfiguration) WithNamespace(value string) *ServiceCIDRApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.Namespace = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithUID sets the UID field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the UID field is set to the value of the last call.
|
||||
func (b *ServiceCIDRApplyConfiguration) WithUID(value types.UID) *ServiceCIDRApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.UID = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the ResourceVersion field is set to the value of the last call.
|
||||
func (b *ServiceCIDRApplyConfiguration) WithResourceVersion(value string) *ServiceCIDRApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.ResourceVersion = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithGeneration sets the Generation field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Generation field is set to the value of the last call.
|
||||
func (b *ServiceCIDRApplyConfiguration) WithGeneration(value int64) *ServiceCIDRApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.Generation = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the CreationTimestamp field is set to the value of the last call.
|
||||
func (b *ServiceCIDRApplyConfiguration) WithCreationTimestamp(value apismetav1.Time) *ServiceCIDRApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.CreationTimestamp = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the DeletionTimestamp field is set to the value of the last call.
|
||||
func (b *ServiceCIDRApplyConfiguration) WithDeletionTimestamp(value apismetav1.Time) *ServiceCIDRApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
|
||||
func (b *ServiceCIDRApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ServiceCIDRApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithLabels puts the entries into the Labels field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, the entries provided by each call will be put on the Labels field,
|
||||
// overwriting an existing map entries in Labels field with the same key.
|
||||
func (b *ServiceCIDRApplyConfiguration) WithLabels(entries map[string]string) *ServiceCIDRApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 {
|
||||
b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries))
|
||||
}
|
||||
for k, v := range entries {
|
||||
b.ObjectMetaApplyConfiguration.Labels[k] = v
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithAnnotations puts the entries into the Annotations field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, the entries provided by each call will be put on the Annotations field,
|
||||
// overwriting an existing map entries in Annotations field with the same key.
|
||||
func (b *ServiceCIDRApplyConfiguration) WithAnnotations(entries map[string]string) *ServiceCIDRApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 {
|
||||
b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries))
|
||||
}
|
||||
for k, v := range entries {
|
||||
b.ObjectMetaApplyConfiguration.Annotations[k] = v
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the OwnerReferences field.
|
||||
func (b *ServiceCIDRApplyConfiguration) WithOwnerReferences(values ...*metav1.OwnerReferenceApplyConfiguration) *ServiceCIDRApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
for i := range values {
|
||||
if values[i] == nil {
|
||||
panic("nil value passed to WithOwnerReferences")
|
||||
}
|
||||
b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithFinalizers adds the given value to the Finalizers field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the Finalizers field.
|
||||
func (b *ServiceCIDRApplyConfiguration) WithFinalizers(values ...string) *ServiceCIDRApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
for i := range values {
|
||||
b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (b *ServiceCIDRApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
|
||||
if b.ObjectMetaApplyConfiguration == nil {
|
||||
b.ObjectMetaApplyConfiguration = &metav1.ObjectMetaApplyConfiguration{}
|
||||
}
|
||||
}
|
||||
|
||||
// WithSpec sets the Spec field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Spec field is set to the value of the last call.
|
||||
func (b *ServiceCIDRApplyConfiguration) WithSpec(value *ServiceCIDRSpecApplyConfiguration) *ServiceCIDRApplyConfiguration {
|
||||
b.Spec = value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Status field is set to the value of the last call.
|
||||
func (b *ServiceCIDRApplyConfiguration) WithStatus(value *ServiceCIDRStatusApplyConfiguration) *ServiceCIDRApplyConfiguration {
|
||||
b.Status = value
|
||||
return b
|
||||
}
|
||||
|
||||
// GetName retrieves the value of the Name field in the declarative configuration.
|
||||
func (b *ServiceCIDRApplyConfiguration) GetName() *string {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
return b.ObjectMetaApplyConfiguration.Name
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
Copyright 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.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
// ServiceCIDRSpecApplyConfiguration represents a declarative configuration of the ServiceCIDRSpec type for use
|
||||
// with apply.
|
||||
type ServiceCIDRSpecApplyConfiguration struct {
|
||||
CIDRs []string `json:"cidrs,omitempty"`
|
||||
}
|
||||
|
||||
// ServiceCIDRSpecApplyConfiguration constructs a declarative configuration of the ServiceCIDRSpec type for use with
|
||||
// apply.
|
||||
func ServiceCIDRSpec() *ServiceCIDRSpecApplyConfiguration {
|
||||
return &ServiceCIDRSpecApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithCIDRs adds the given value to the CIDRs field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the CIDRs field.
|
||||
func (b *ServiceCIDRSpecApplyConfiguration) WithCIDRs(values ...string) *ServiceCIDRSpecApplyConfiguration {
|
||||
for i := range values {
|
||||
b.CIDRs = append(b.CIDRs, values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
Copyright 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.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
)
|
||||
|
||||
// ServiceCIDRStatusApplyConfiguration represents a declarative configuration of the ServiceCIDRStatus type for use
|
||||
// with apply.
|
||||
type ServiceCIDRStatusApplyConfiguration struct {
|
||||
Conditions []metav1.ConditionApplyConfiguration `json:"conditions,omitempty"`
|
||||
}
|
||||
|
||||
// ServiceCIDRStatusApplyConfiguration constructs a declarative configuration of the ServiceCIDRStatus type for use with
|
||||
// apply.
|
||||
func ServiceCIDRStatus() *ServiceCIDRStatusApplyConfiguration {
|
||||
return &ServiceCIDRStatusApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithConditions adds the given value to the Conditions field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the Conditions field.
|
||||
func (b *ServiceCIDRStatusApplyConfiguration) WithConditions(values ...*metav1.ConditionApplyConfiguration) *ServiceCIDRStatusApplyConfiguration {
|
||||
for i := range values {
|
||||
if values[i] == nil {
|
||||
panic("nil value passed to WithConditions")
|
||||
}
|
||||
b.Conditions = append(b.Conditions, *values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
@@ -1406,6 +1406,10 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
|
||||
return &applyconfigurationsnetworkingv1.IngressStatusApplyConfiguration{}
|
||||
case networkingv1.SchemeGroupVersion.WithKind("IngressTLS"):
|
||||
return &applyconfigurationsnetworkingv1.IngressTLSApplyConfiguration{}
|
||||
case networkingv1.SchemeGroupVersion.WithKind("IPAddress"):
|
||||
return &applyconfigurationsnetworkingv1.IPAddressApplyConfiguration{}
|
||||
case networkingv1.SchemeGroupVersion.WithKind("IPAddressSpec"):
|
||||
return &applyconfigurationsnetworkingv1.IPAddressSpecApplyConfiguration{}
|
||||
case networkingv1.SchemeGroupVersion.WithKind("IPBlock"):
|
||||
return &applyconfigurationsnetworkingv1.IPBlockApplyConfiguration{}
|
||||
case networkingv1.SchemeGroupVersion.WithKind("NetworkPolicy"):
|
||||
@@ -1420,8 +1424,16 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
|
||||
return &applyconfigurationsnetworkingv1.NetworkPolicyPortApplyConfiguration{}
|
||||
case networkingv1.SchemeGroupVersion.WithKind("NetworkPolicySpec"):
|
||||
return &applyconfigurationsnetworkingv1.NetworkPolicySpecApplyConfiguration{}
|
||||
case networkingv1.SchemeGroupVersion.WithKind("ParentReference"):
|
||||
return &applyconfigurationsnetworkingv1.ParentReferenceApplyConfiguration{}
|
||||
case networkingv1.SchemeGroupVersion.WithKind("ServiceBackendPort"):
|
||||
return &applyconfigurationsnetworkingv1.ServiceBackendPortApplyConfiguration{}
|
||||
case networkingv1.SchemeGroupVersion.WithKind("ServiceCIDR"):
|
||||
return &applyconfigurationsnetworkingv1.ServiceCIDRApplyConfiguration{}
|
||||
case networkingv1.SchemeGroupVersion.WithKind("ServiceCIDRSpec"):
|
||||
return &applyconfigurationsnetworkingv1.ServiceCIDRSpecApplyConfiguration{}
|
||||
case networkingv1.SchemeGroupVersion.WithKind("ServiceCIDRStatus"):
|
||||
return &applyconfigurationsnetworkingv1.ServiceCIDRStatusApplyConfiguration{}
|
||||
|
||||
// Group=networking.k8s.io, Version=v1alpha1
|
||||
case networkingv1alpha1.SchemeGroupVersion.WithKind("IPAddress"):
|
||||
|
||||
@@ -303,12 +303,16 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Internal().V1alpha1().StorageVersions().Informer()}, nil
|
||||
|
||||
// Group=networking.k8s.io, Version=v1
|
||||
case networkingv1.SchemeGroupVersion.WithResource("ipaddresses"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1().IPAddresses().Informer()}, nil
|
||||
case networkingv1.SchemeGroupVersion.WithResource("ingresses"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1().Ingresses().Informer()}, nil
|
||||
case networkingv1.SchemeGroupVersion.WithResource("ingressclasses"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1().IngressClasses().Informer()}, nil
|
||||
case networkingv1.SchemeGroupVersion.WithResource("networkpolicies"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1().NetworkPolicies().Informer()}, nil
|
||||
case networkingv1.SchemeGroupVersion.WithResource("servicecidrs"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1().ServiceCIDRs().Informer()}, nil
|
||||
|
||||
// Group=networking.k8s.io, Version=v1alpha1
|
||||
case networkingv1alpha1.SchemeGroupVersion.WithResource("ipaddresses"):
|
||||
|
||||
@@ -24,12 +24,16 @@ import (
|
||||
|
||||
// Interface provides access to all the informers in this group version.
|
||||
type Interface interface {
|
||||
// IPAddresses returns a IPAddressInformer.
|
||||
IPAddresses() IPAddressInformer
|
||||
// Ingresses returns a IngressInformer.
|
||||
Ingresses() IngressInformer
|
||||
// IngressClasses returns a IngressClassInformer.
|
||||
IngressClasses() IngressClassInformer
|
||||
// NetworkPolicies returns a NetworkPolicyInformer.
|
||||
NetworkPolicies() NetworkPolicyInformer
|
||||
// ServiceCIDRs returns a ServiceCIDRInformer.
|
||||
ServiceCIDRs() ServiceCIDRInformer
|
||||
}
|
||||
|
||||
type version struct {
|
||||
@@ -43,6 +47,11 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
|
||||
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
||||
}
|
||||
|
||||
// IPAddresses returns a IPAddressInformer.
|
||||
func (v *version) IPAddresses() IPAddressInformer {
|
||||
return &iPAddressInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
// Ingresses returns a IngressInformer.
|
||||
func (v *version) Ingresses() IngressInformer {
|
||||
return &ingressInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
@@ -57,3 +66,8 @@ func (v *version) IngressClasses() IngressClassInformer {
|
||||
func (v *version) NetworkPolicies() NetworkPolicyInformer {
|
||||
return &networkPolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
// ServiceCIDRs returns a ServiceCIDRInformer.
|
||||
func (v *version) ServiceCIDRs() ServiceCIDRInformer {
|
||||
return &serviceCIDRInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
Copyright 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.
|
||||
*/
|
||||
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
context "context"
|
||||
time "time"
|
||||
|
||||
apinetworkingv1 "k8s.io/api/networking/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
|
||||
kubernetes "k8s.io/client-go/kubernetes"
|
||||
networkingv1 "k8s.io/client-go/listers/networking/v1"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// IPAddressInformer provides access to a shared informer and lister for
|
||||
// IPAddresses.
|
||||
type IPAddressInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() networkingv1.IPAddressLister
|
||||
}
|
||||
|
||||
type iPAddressInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
}
|
||||
|
||||
// NewIPAddressInformer constructs a new informer for IPAddress type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewIPAddressInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredIPAddressInformer(client, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredIPAddressInformer constructs a new informer for IPAddress type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewFilteredIPAddressInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.NetworkingV1().IPAddresses().List(context.TODO(), options)
|
||||
},
|
||||
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.NetworkingV1().IPAddresses().Watch(context.TODO(), options)
|
||||
},
|
||||
},
|
||||
&apinetworkingv1.IPAddress{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *iPAddressInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredIPAddressInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *iPAddressInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&apinetworkingv1.IPAddress{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *iPAddressInformer) Lister() networkingv1.IPAddressLister {
|
||||
return networkingv1.NewIPAddressLister(f.Informer().GetIndexer())
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
Copyright 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.
|
||||
*/
|
||||
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
context "context"
|
||||
time "time"
|
||||
|
||||
apinetworkingv1 "k8s.io/api/networking/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
|
||||
kubernetes "k8s.io/client-go/kubernetes"
|
||||
networkingv1 "k8s.io/client-go/listers/networking/v1"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// ServiceCIDRInformer provides access to a shared informer and lister for
|
||||
// ServiceCIDRs.
|
||||
type ServiceCIDRInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() networkingv1.ServiceCIDRLister
|
||||
}
|
||||
|
||||
type serviceCIDRInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
}
|
||||
|
||||
// NewServiceCIDRInformer constructs a new informer for ServiceCIDR type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewServiceCIDRInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredServiceCIDRInformer(client, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredServiceCIDRInformer constructs a new informer for ServiceCIDR type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewFilteredServiceCIDRInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.NetworkingV1().ServiceCIDRs().List(context.TODO(), options)
|
||||
},
|
||||
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.NetworkingV1().ServiceCIDRs().Watch(context.TODO(), options)
|
||||
},
|
||||
},
|
||||
&apinetworkingv1.ServiceCIDR{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *serviceCIDRInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredServiceCIDRInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *serviceCIDRInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&apinetworkingv1.ServiceCIDR{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *serviceCIDRInformer) Lister() networkingv1.ServiceCIDRLister {
|
||||
return networkingv1.NewServiceCIDRLister(f.Informer().GetIndexer())
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
Copyright 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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
v1 "k8s.io/api/networking/v1"
|
||||
networkingv1 "k8s.io/client-go/applyconfigurations/networking/v1"
|
||||
gentype "k8s.io/client-go/gentype"
|
||||
typednetworkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1"
|
||||
)
|
||||
|
||||
// fakeIPAddresses implements IPAddressInterface
|
||||
type fakeIPAddresses struct {
|
||||
*gentype.FakeClientWithListAndApply[*v1.IPAddress, *v1.IPAddressList, *networkingv1.IPAddressApplyConfiguration]
|
||||
Fake *FakeNetworkingV1
|
||||
}
|
||||
|
||||
func newFakeIPAddresses(fake *FakeNetworkingV1) typednetworkingv1.IPAddressInterface {
|
||||
return &fakeIPAddresses{
|
||||
gentype.NewFakeClientWithListAndApply[*v1.IPAddress, *v1.IPAddressList, *networkingv1.IPAddressApplyConfiguration](
|
||||
fake.Fake,
|
||||
"",
|
||||
v1.SchemeGroupVersion.WithResource("ipaddresses"),
|
||||
v1.SchemeGroupVersion.WithKind("IPAddress"),
|
||||
func() *v1.IPAddress { return &v1.IPAddress{} },
|
||||
func() *v1.IPAddressList { return &v1.IPAddressList{} },
|
||||
func(dst, src *v1.IPAddressList) { dst.ListMeta = src.ListMeta },
|
||||
func(list *v1.IPAddressList) []*v1.IPAddress { return gentype.ToPointerSlice(list.Items) },
|
||||
func(list *v1.IPAddressList, items []*v1.IPAddress) { list.Items = gentype.FromPointerSlice(items) },
|
||||
),
|
||||
fake,
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,10 @@ type FakeNetworkingV1 struct {
|
||||
*testing.Fake
|
||||
}
|
||||
|
||||
func (c *FakeNetworkingV1) IPAddresses() v1.IPAddressInterface {
|
||||
return newFakeIPAddresses(c)
|
||||
}
|
||||
|
||||
func (c *FakeNetworkingV1) Ingresses(namespace string) v1.IngressInterface {
|
||||
return newFakeIngresses(c, namespace)
|
||||
}
|
||||
@@ -40,6 +44,10 @@ func (c *FakeNetworkingV1) NetworkPolicies(namespace string) v1.NetworkPolicyInt
|
||||
return newFakeNetworkPolicies(c, namespace)
|
||||
}
|
||||
|
||||
func (c *FakeNetworkingV1) ServiceCIDRs() v1.ServiceCIDRInterface {
|
||||
return newFakeServiceCIDRs(c)
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *FakeNetworkingV1) RESTClient() rest.Interface {
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
Copyright 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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
v1 "k8s.io/api/networking/v1"
|
||||
networkingv1 "k8s.io/client-go/applyconfigurations/networking/v1"
|
||||
gentype "k8s.io/client-go/gentype"
|
||||
typednetworkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1"
|
||||
)
|
||||
|
||||
// fakeServiceCIDRs implements ServiceCIDRInterface
|
||||
type fakeServiceCIDRs struct {
|
||||
*gentype.FakeClientWithListAndApply[*v1.ServiceCIDR, *v1.ServiceCIDRList, *networkingv1.ServiceCIDRApplyConfiguration]
|
||||
Fake *FakeNetworkingV1
|
||||
}
|
||||
|
||||
func newFakeServiceCIDRs(fake *FakeNetworkingV1) typednetworkingv1.ServiceCIDRInterface {
|
||||
return &fakeServiceCIDRs{
|
||||
gentype.NewFakeClientWithListAndApply[*v1.ServiceCIDR, *v1.ServiceCIDRList, *networkingv1.ServiceCIDRApplyConfiguration](
|
||||
fake.Fake,
|
||||
"",
|
||||
v1.SchemeGroupVersion.WithResource("servicecidrs"),
|
||||
v1.SchemeGroupVersion.WithKind("ServiceCIDR"),
|
||||
func() *v1.ServiceCIDR { return &v1.ServiceCIDR{} },
|
||||
func() *v1.ServiceCIDRList { return &v1.ServiceCIDRList{} },
|
||||
func(dst, src *v1.ServiceCIDRList) { dst.ListMeta = src.ListMeta },
|
||||
func(list *v1.ServiceCIDRList) []*v1.ServiceCIDR { return gentype.ToPointerSlice(list.Items) },
|
||||
func(list *v1.ServiceCIDRList, items []*v1.ServiceCIDR) { list.Items = gentype.FromPointerSlice(items) },
|
||||
),
|
||||
fake,
|
||||
}
|
||||
}
|
||||
@@ -18,8 +18,12 @@ limitations under the License.
|
||||
|
||||
package v1
|
||||
|
||||
type IPAddressExpansion interface{}
|
||||
|
||||
type IngressExpansion interface{}
|
||||
|
||||
type IngressClassExpansion interface{}
|
||||
|
||||
type NetworkPolicyExpansion interface{}
|
||||
|
||||
type ServiceCIDRExpansion interface{}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
Copyright 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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
applyconfigurationsnetworkingv1 "k8s.io/client-go/applyconfigurations/networking/v1"
|
||||
gentype "k8s.io/client-go/gentype"
|
||||
scheme "k8s.io/client-go/kubernetes/scheme"
|
||||
)
|
||||
|
||||
// IPAddressesGetter has a method to return a IPAddressInterface.
|
||||
// A group's client should implement this interface.
|
||||
type IPAddressesGetter interface {
|
||||
IPAddresses() IPAddressInterface
|
||||
}
|
||||
|
||||
// IPAddressInterface has methods to work with IPAddress resources.
|
||||
type IPAddressInterface interface {
|
||||
Create(ctx context.Context, iPAddress *networkingv1.IPAddress, opts metav1.CreateOptions) (*networkingv1.IPAddress, error)
|
||||
Update(ctx context.Context, iPAddress *networkingv1.IPAddress, opts metav1.UpdateOptions) (*networkingv1.IPAddress, error)
|
||||
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts metav1.GetOptions) (*networkingv1.IPAddress, error)
|
||||
List(ctx context.Context, opts metav1.ListOptions) (*networkingv1.IPAddressList, error)
|
||||
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *networkingv1.IPAddress, err error)
|
||||
Apply(ctx context.Context, iPAddress *applyconfigurationsnetworkingv1.IPAddressApplyConfiguration, opts metav1.ApplyOptions) (result *networkingv1.IPAddress, err error)
|
||||
IPAddressExpansion
|
||||
}
|
||||
|
||||
// iPAddresses implements IPAddressInterface
|
||||
type iPAddresses struct {
|
||||
*gentype.ClientWithListAndApply[*networkingv1.IPAddress, *networkingv1.IPAddressList, *applyconfigurationsnetworkingv1.IPAddressApplyConfiguration]
|
||||
}
|
||||
|
||||
// newIPAddresses returns a IPAddresses
|
||||
func newIPAddresses(c *NetworkingV1Client) *iPAddresses {
|
||||
return &iPAddresses{
|
||||
gentype.NewClientWithListAndApply[*networkingv1.IPAddress, *networkingv1.IPAddressList, *applyconfigurationsnetworkingv1.IPAddressApplyConfiguration](
|
||||
"ipaddresses",
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *networkingv1.IPAddress { return &networkingv1.IPAddress{} },
|
||||
func() *networkingv1.IPAddressList { return &networkingv1.IPAddressList{} },
|
||||
gentype.PrefersProtobuf[*networkingv1.IPAddress](),
|
||||
),
|
||||
}
|
||||
}
|
||||
@@ -28,9 +28,11 @@ import (
|
||||
|
||||
type NetworkingV1Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
IPAddressesGetter
|
||||
IngressesGetter
|
||||
IngressClassesGetter
|
||||
NetworkPoliciesGetter
|
||||
ServiceCIDRsGetter
|
||||
}
|
||||
|
||||
// NetworkingV1Client is used to interact with features provided by the networking.k8s.io group.
|
||||
@@ -38,6 +40,10 @@ type NetworkingV1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
||||
func (c *NetworkingV1Client) IPAddresses() IPAddressInterface {
|
||||
return newIPAddresses(c)
|
||||
}
|
||||
|
||||
func (c *NetworkingV1Client) Ingresses(namespace string) IngressInterface {
|
||||
return newIngresses(c, namespace)
|
||||
}
|
||||
@@ -50,6 +56,10 @@ func (c *NetworkingV1Client) NetworkPolicies(namespace string) NetworkPolicyInte
|
||||
return newNetworkPolicies(c, namespace)
|
||||
}
|
||||
|
||||
func (c *NetworkingV1Client) ServiceCIDRs() ServiceCIDRInterface {
|
||||
return newServiceCIDRs(c)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new NetworkingV1Client for the given config.
|
||||
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
|
||||
// where httpClient was generated with rest.HTTPClientFor(c).
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
Copyright 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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
applyconfigurationsnetworkingv1 "k8s.io/client-go/applyconfigurations/networking/v1"
|
||||
gentype "k8s.io/client-go/gentype"
|
||||
scheme "k8s.io/client-go/kubernetes/scheme"
|
||||
)
|
||||
|
||||
// ServiceCIDRsGetter has a method to return a ServiceCIDRInterface.
|
||||
// A group's client should implement this interface.
|
||||
type ServiceCIDRsGetter interface {
|
||||
ServiceCIDRs() ServiceCIDRInterface
|
||||
}
|
||||
|
||||
// ServiceCIDRInterface has methods to work with ServiceCIDR resources.
|
||||
type ServiceCIDRInterface interface {
|
||||
Create(ctx context.Context, serviceCIDR *networkingv1.ServiceCIDR, opts metav1.CreateOptions) (*networkingv1.ServiceCIDR, error)
|
||||
Update(ctx context.Context, serviceCIDR *networkingv1.ServiceCIDR, opts metav1.UpdateOptions) (*networkingv1.ServiceCIDR, error)
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
UpdateStatus(ctx context.Context, serviceCIDR *networkingv1.ServiceCIDR, opts metav1.UpdateOptions) (*networkingv1.ServiceCIDR, error)
|
||||
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts metav1.GetOptions) (*networkingv1.ServiceCIDR, error)
|
||||
List(ctx context.Context, opts metav1.ListOptions) (*networkingv1.ServiceCIDRList, error)
|
||||
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *networkingv1.ServiceCIDR, err error)
|
||||
Apply(ctx context.Context, serviceCIDR *applyconfigurationsnetworkingv1.ServiceCIDRApplyConfiguration, opts metav1.ApplyOptions) (result *networkingv1.ServiceCIDR, err error)
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
|
||||
ApplyStatus(ctx context.Context, serviceCIDR *applyconfigurationsnetworkingv1.ServiceCIDRApplyConfiguration, opts metav1.ApplyOptions) (result *networkingv1.ServiceCIDR, err error)
|
||||
ServiceCIDRExpansion
|
||||
}
|
||||
|
||||
// serviceCIDRs implements ServiceCIDRInterface
|
||||
type serviceCIDRs struct {
|
||||
*gentype.ClientWithListAndApply[*networkingv1.ServiceCIDR, *networkingv1.ServiceCIDRList, *applyconfigurationsnetworkingv1.ServiceCIDRApplyConfiguration]
|
||||
}
|
||||
|
||||
// newServiceCIDRs returns a ServiceCIDRs
|
||||
func newServiceCIDRs(c *NetworkingV1Client) *serviceCIDRs {
|
||||
return &serviceCIDRs{
|
||||
gentype.NewClientWithListAndApply[*networkingv1.ServiceCIDR, *networkingv1.ServiceCIDRList, *applyconfigurationsnetworkingv1.ServiceCIDRApplyConfiguration](
|
||||
"servicecidrs",
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *networkingv1.ServiceCIDR { return &networkingv1.ServiceCIDR{} },
|
||||
func() *networkingv1.ServiceCIDRList { return &networkingv1.ServiceCIDRList{} },
|
||||
gentype.PrefersProtobuf[*networkingv1.ServiceCIDR](),
|
||||
),
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,10 @@ limitations under the License.
|
||||
|
||||
package v1
|
||||
|
||||
// IPAddressListerExpansion allows custom methods to be added to
|
||||
// IPAddressLister.
|
||||
type IPAddressListerExpansion interface{}
|
||||
|
||||
// IngressListerExpansion allows custom methods to be added to
|
||||
// IngressLister.
|
||||
type IngressListerExpansion interface{}
|
||||
@@ -37,3 +41,7 @@ type NetworkPolicyListerExpansion interface{}
|
||||
// NetworkPolicyNamespaceListerExpansion allows custom methods to be added to
|
||||
// NetworkPolicyNamespaceLister.
|
||||
type NetworkPolicyNamespaceListerExpansion interface{}
|
||||
|
||||
// ServiceCIDRListerExpansion allows custom methods to be added to
|
||||
// ServiceCIDRLister.
|
||||
type ServiceCIDRListerExpansion interface{}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
Copyright 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.
|
||||
*/
|
||||
|
||||
// Code generated by lister-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
listers "k8s.io/client-go/listers"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// IPAddressLister helps list IPAddresses.
|
||||
// All objects returned here must be treated as read-only.
|
||||
type IPAddressLister interface {
|
||||
// List lists all IPAddresses in the indexer.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*networkingv1.IPAddress, err error)
|
||||
// Get retrieves the IPAddress from the index for a given name.
|
||||
// Objects returned here must be treated as read-only.
|
||||
Get(name string) (*networkingv1.IPAddress, error)
|
||||
IPAddressListerExpansion
|
||||
}
|
||||
|
||||
// iPAddressLister implements the IPAddressLister interface.
|
||||
type iPAddressLister struct {
|
||||
listers.ResourceIndexer[*networkingv1.IPAddress]
|
||||
}
|
||||
|
||||
// NewIPAddressLister returns a new IPAddressLister.
|
||||
func NewIPAddressLister(indexer cache.Indexer) IPAddressLister {
|
||||
return &iPAddressLister{listers.New[*networkingv1.IPAddress](indexer, networkingv1.Resource("ipaddress"))}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
Copyright 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.
|
||||
*/
|
||||
|
||||
// Code generated by lister-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
listers "k8s.io/client-go/listers"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// ServiceCIDRLister helps list ServiceCIDRs.
|
||||
// All objects returned here must be treated as read-only.
|
||||
type ServiceCIDRLister interface {
|
||||
// List lists all ServiceCIDRs in the indexer.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*networkingv1.ServiceCIDR, err error)
|
||||
// Get retrieves the ServiceCIDR from the index for a given name.
|
||||
// Objects returned here must be treated as read-only.
|
||||
Get(name string) (*networkingv1.ServiceCIDR, error)
|
||||
ServiceCIDRListerExpansion
|
||||
}
|
||||
|
||||
// serviceCIDRLister implements the ServiceCIDRLister interface.
|
||||
type serviceCIDRLister struct {
|
||||
listers.ResourceIndexer[*networkingv1.ServiceCIDR]
|
||||
}
|
||||
|
||||
// NewServiceCIDRLister returns a new ServiceCIDRLister.
|
||||
func NewServiceCIDRLister(indexer cache.Indexer) ServiceCIDRLister {
|
||||
return &serviceCIDRLister{listers.New[*networkingv1.ServiceCIDR](indexer, networkingv1.Resource("servicecidr"))}
|
||||
}
|
||||
@@ -217,6 +217,8 @@ func describerMap(clientConfig *rest.Config) (map[schema.GroupKind]ResourceDescr
|
||||
{Group: networkingv1.GroupName, Kind: "IngressClass"}: &IngressClassDescriber{c},
|
||||
{Group: networkingv1beta1.GroupName, Kind: "ServiceCIDR"}: &ServiceCIDRDescriber{c},
|
||||
{Group: networkingv1beta1.GroupName, Kind: "IPAddress"}: &IPAddressDescriber{c},
|
||||
{Group: networkingv1.GroupName, Kind: "ServiceCIDR"}: &ServiceCIDRDescriber{c},
|
||||
{Group: networkingv1.GroupName, Kind: "IPAddress"}: &IPAddressDescriber{c},
|
||||
{Group: batchv1.GroupName, Kind: "Job"}: &JobDescriber{c},
|
||||
{Group: batchv1.GroupName, Kind: "CronJob"}: &CronJobDescriber{c},
|
||||
{Group: batchv1beta1.GroupName, Kind: "CronJob"}: &CronJobDescriber{c},
|
||||
@@ -2889,6 +2891,14 @@ type ServiceCIDRDescriber struct {
|
||||
func (c *ServiceCIDRDescriber) Describe(namespace, name string, describerSettings DescriberSettings) (string, error) {
|
||||
var events *corev1.EventList
|
||||
|
||||
svcV1, err := c.client.NetworkingV1().ServiceCIDRs().Get(context.TODO(), name, metav1.GetOptions{})
|
||||
if err == nil {
|
||||
if describerSettings.ShowEvents {
|
||||
events, _ = searchEvents(c.client.CoreV1(), svcV1, describerSettings.ChunkSize)
|
||||
}
|
||||
return c.describeServiceCIDRV1(svcV1, events)
|
||||
}
|
||||
|
||||
svcV1beta1, err := c.client.NetworkingV1beta1().ServiceCIDRs().Get(context.TODO(), name, metav1.GetOptions{})
|
||||
if err == nil {
|
||||
if describerSettings.ShowEvents {
|
||||
@@ -2899,6 +2909,37 @@ func (c *ServiceCIDRDescriber) Describe(namespace, name string, describerSetting
|
||||
return "", err
|
||||
}
|
||||
|
||||
func (c *ServiceCIDRDescriber) describeServiceCIDRV1(svc *networkingv1.ServiceCIDR, events *corev1.EventList) (string, error) {
|
||||
return tabbedString(func(out io.Writer) error {
|
||||
w := NewPrefixWriter(out)
|
||||
w.Write(LEVEL_0, "Name:\t%v\n", svc.Name)
|
||||
printLabelsMultiline(w, "Labels", svc.Labels)
|
||||
printAnnotationsMultiline(w, "Annotations", svc.Annotations)
|
||||
|
||||
w.Write(LEVEL_0, "CIDRs:\t%v\n", strings.Join(svc.Spec.CIDRs, ", "))
|
||||
|
||||
if len(svc.Status.Conditions) > 0 {
|
||||
w.Write(LEVEL_0, "Status:\n")
|
||||
w.Write(LEVEL_0, "Conditions:\n")
|
||||
w.Write(LEVEL_1, "Type\tStatus\tLastTransitionTime\tReason\tMessage\n")
|
||||
w.Write(LEVEL_1, "----\t------\t------------------\t------\t-------\n")
|
||||
for _, c := range svc.Status.Conditions {
|
||||
w.Write(LEVEL_1, "%v\t%v\t%s\t%v\t%v\n",
|
||||
c.Type,
|
||||
c.Status,
|
||||
c.LastTransitionTime.Time.Format(time.RFC1123Z),
|
||||
c.Reason,
|
||||
c.Message)
|
||||
}
|
||||
}
|
||||
|
||||
if events != nil {
|
||||
DescribeEvents(events, w)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (c *ServiceCIDRDescriber) describeServiceCIDRV1beta1(svc *networkingv1beta1.ServiceCIDR, events *corev1.EventList) (string, error) {
|
||||
return tabbedString(func(out io.Writer) error {
|
||||
w := NewPrefixWriter(out)
|
||||
@@ -2938,6 +2979,14 @@ type IPAddressDescriber struct {
|
||||
func (c *IPAddressDescriber) Describe(namespace, name string, describerSettings DescriberSettings) (string, error) {
|
||||
var events *corev1.EventList
|
||||
|
||||
ipV1, err := c.client.NetworkingV1().IPAddresses().Get(context.TODO(), name, metav1.GetOptions{})
|
||||
if err == nil {
|
||||
if describerSettings.ShowEvents {
|
||||
events, _ = searchEvents(c.client.CoreV1(), ipV1, describerSettings.ChunkSize)
|
||||
}
|
||||
return c.describeIPAddressV1(ipV1, events)
|
||||
}
|
||||
|
||||
ipV1beta1, err := c.client.NetworkingV1beta1().IPAddresses().Get(context.TODO(), name, metav1.GetOptions{})
|
||||
if err == nil {
|
||||
if describerSettings.ShowEvents {
|
||||
@@ -2948,6 +2997,28 @@ func (c *IPAddressDescriber) Describe(namespace, name string, describerSettings
|
||||
return "", err
|
||||
}
|
||||
|
||||
func (c *IPAddressDescriber) describeIPAddressV1(ip *networkingv1.IPAddress, events *corev1.EventList) (string, error) {
|
||||
return tabbedString(func(out io.Writer) error {
|
||||
w := NewPrefixWriter(out)
|
||||
w.Write(LEVEL_0, "Name:\t%v\n", ip.Name)
|
||||
printLabelsMultiline(w, "Labels", ip.Labels)
|
||||
printAnnotationsMultiline(w, "Annotations", ip.Annotations)
|
||||
|
||||
if ip.Spec.ParentRef != nil {
|
||||
w.Write(LEVEL_0, "Parent Reference:\n")
|
||||
w.Write(LEVEL_1, "Group:\t%v\n", ip.Spec.ParentRef.Group)
|
||||
w.Write(LEVEL_1, "Resource:\t%v\n", ip.Spec.ParentRef.Resource)
|
||||
w.Write(LEVEL_1, "Namespace:\t%v\n", ip.Spec.ParentRef.Namespace)
|
||||
w.Write(LEVEL_1, "Name:\t%v\n", ip.Spec.ParentRef.Name)
|
||||
}
|
||||
|
||||
if events != nil {
|
||||
DescribeEvents(events, w)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (c *IPAddressDescriber) describeIPAddressV1beta1(ip *networkingv1beta1.IPAddress, events *corev1.EventList) (string, error) {
|
||||
return tabbedString(func(out io.Writer) error {
|
||||
w := NewPrefixWriter(out)
|
||||
|
||||
@@ -6590,6 +6590,54 @@ Events: <none>` + "\n",
|
||||
Labels: <none>
|
||||
Annotations: <none>
|
||||
CIDRs: fd00:1:1::/64
|
||||
Events: <none>` + "\n",
|
||||
},
|
||||
"ServiceCIDR v1": {
|
||||
input: fake.NewSimpleClientset(&networkingv1.ServiceCIDR{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "foo.123",
|
||||
},
|
||||
Spec: networkingv1.ServiceCIDRSpec{
|
||||
CIDRs: []string{"10.1.0.0/16", "fd00:1:1::/64"},
|
||||
},
|
||||
}),
|
||||
|
||||
output: `Name: foo.123
|
||||
Labels: <none>
|
||||
Annotations: <none>
|
||||
CIDRs: 10.1.0.0/16, fd00:1:1::/64
|
||||
Events: <none>` + "\n",
|
||||
},
|
||||
"ServiceCIDR v1 IPv4": {
|
||||
input: fake.NewSimpleClientset(&networkingv1.ServiceCIDR{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "foo.123",
|
||||
},
|
||||
Spec: networkingv1.ServiceCIDRSpec{
|
||||
CIDRs: []string{"10.1.0.0/16"},
|
||||
},
|
||||
}),
|
||||
|
||||
output: `Name: foo.123
|
||||
Labels: <none>
|
||||
Annotations: <none>
|
||||
CIDRs: 10.1.0.0/16
|
||||
Events: <none>` + "\n",
|
||||
},
|
||||
"ServiceCIDR v1 IPv6": {
|
||||
input: fake.NewSimpleClientset(&networkingv1.ServiceCIDR{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "foo.123",
|
||||
},
|
||||
Spec: networkingv1.ServiceCIDRSpec{
|
||||
CIDRs: []string{"fd00:1:1::/64"},
|
||||
},
|
||||
}),
|
||||
|
||||
output: `Name: foo.123
|
||||
Labels: <none>
|
||||
Annotations: <none>
|
||||
CIDRs: fd00:1:1::/64
|
||||
Events: <none>` + "\n",
|
||||
},
|
||||
}
|
||||
@@ -6633,6 +6681,31 @@ func TestDescribeIPAddress(t *testing.T) {
|
||||
output: `Name: foo.123
|
||||
Labels: <none>
|
||||
Annotations: <none>
|
||||
Parent Reference:
|
||||
Group: mygroup
|
||||
Resource: myresource
|
||||
Namespace: mynamespace
|
||||
Name: myname
|
||||
Events: <none>` + "\n",
|
||||
},
|
||||
"IPAddress v1": {
|
||||
input: fake.NewSimpleClientset(&networkingv1.IPAddress{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "foo.123",
|
||||
},
|
||||
Spec: networkingv1.IPAddressSpec{
|
||||
ParentRef: &networkingv1.ParentReference{
|
||||
Group: "mygroup",
|
||||
Resource: "myresource",
|
||||
Namespace: "mynamespace",
|
||||
Name: "myname",
|
||||
},
|
||||
},
|
||||
}),
|
||||
|
||||
output: `Name: foo.123
|
||||
Labels: <none>
|
||||
Annotations: <none>
|
||||
Parent Reference:
|
||||
Group: mygroup
|
||||
Resource: myresource
|
||||
|
||||
@@ -18,16 +18,15 @@ package network
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/netip"
|
||||
|
||||
"github.com/onsi/ginkgo/v2"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
networkingv1beta1 "k8s.io/api/networking/v1beta1"
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
"k8s.io/kubernetes/test/e2e/feature"
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
e2enode "k8s.io/kubernetes/test/e2e/framework/node"
|
||||
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
|
||||
@@ -37,7 +36,7 @@ import (
|
||||
admissionapi "k8s.io/pod-security-admission/api"
|
||||
)
|
||||
|
||||
var _ = common.SIGDescribe(feature.ServiceCIDRs, framework.WithFeatureGate(features.MultiCIDRServiceAllocator), func() {
|
||||
var _ = common.SIGDescribe("Service CIDRs", func() {
|
||||
|
||||
fr := framework.NewDefaultFramework("servicecidrs")
|
||||
fr.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
|
||||
@@ -62,19 +61,30 @@ var _ = common.SIGDescribe(feature.ServiceCIDRs, framework.WithFeatureGate(featu
|
||||
})
|
||||
|
||||
ginkgo.It("should create Services and serve on different Service CIDRs", func(ctx context.Context) {
|
||||
// use a ServiceCIDR that does not have risk to overlap with other ranges
|
||||
serviceCIDR := netip.MustParsePrefix("203.0.113.0/24") // RFC 5737 (TEST-NET-3) is provided for use in documentation.
|
||||
// use a random IP inside the range
|
||||
serviceIP := netip.MustParseAddr("203.0.113.10")
|
||||
if framework.TestContext.ClusterIsIPv6() {
|
||||
serviceCIDR = netip.MustParsePrefix("2001:db8:cb00::/64") // RFC 3849 IPv6 Address Prefix Reserved for Documentation.
|
||||
serviceIP = netip.MustParseAddr("2001:db8:cb00::a")
|
||||
}
|
||||
|
||||
// create a new service CIDR
|
||||
svcCIDR := &networkingv1beta1.ServiceCIDR{
|
||||
svcCIDR := &networkingv1.ServiceCIDR{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test-svc-cidr",
|
||||
},
|
||||
Spec: networkingv1beta1.ServiceCIDRSpec{
|
||||
CIDRs: []string{"10.196.196.0/24"},
|
||||
Spec: networkingv1.ServiceCIDRSpec{
|
||||
CIDRs: []string{serviceCIDR.String()},
|
||||
},
|
||||
}
|
||||
_, err := cs.NetworkingV1beta1().ServiceCIDRs().Create(context.TODO(), svcCIDR, metav1.CreateOptions{})
|
||||
_, err := cs.NetworkingV1().ServiceCIDRs().Create(context.TODO(), svcCIDR, metav1.CreateOptions{})
|
||||
framework.ExpectNoError(err, "error creating ServiceCIDR")
|
||||
ginkgo.DeferCleanup(cs.NetworkingV1().ServiceCIDRs().Delete, svcCIDR.Name, metav1.DeleteOptions{})
|
||||
|
||||
if pollErr := wait.PollUntilContextTimeout(ctx, framework.Poll, e2eservice.RespondingTimeout, false, func(ctx context.Context) (bool, error) {
|
||||
svcCIDR, err := cs.NetworkingV1beta1().ServiceCIDRs().Get(ctx, svcCIDR.Name, metav1.GetOptions{})
|
||||
svcCIDR, err := cs.NetworkingV1().ServiceCIDRs().Get(ctx, svcCIDR.Name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return false, nil
|
||||
}
|
||||
@@ -87,14 +97,30 @@ var _ = common.SIGDescribe(feature.ServiceCIDRs, framework.WithFeatureGate(featu
|
||||
jig := e2eservice.NewTestJig(cs, ns, serviceName)
|
||||
|
||||
ginkgo.By("creating service " + serviceName + " with type=NodePort in namespace " + ns)
|
||||
nodePortService, err := jig.CreateTCPService(ctx, func(svc *v1.Service) {
|
||||
svc.Spec.ClusterIP = "10.196.196.77"
|
||||
svc.Spec.Type = v1.ServiceTypeNodePort
|
||||
svc.Spec.Ports = []v1.ServicePort{
|
||||
{Port: 80, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt(9376)},
|
||||
// Because this test run in parallel with other test there is a chance that the ClusterIP
|
||||
// gets allocated, we also need to ensure the ClusterIP belongs to the new Service range
|
||||
// so we need to explicitly set it. Try several times before giving up.
|
||||
var nodePortService *v1.Service
|
||||
for i := 0; i < 5; i++ {
|
||||
nodePortService, err = jig.CreateTCPService(ctx, func(svc *v1.Service) {
|
||||
svc.Spec.ClusterIP = serviceIP.String()
|
||||
svc.Spec.Type = v1.ServiceTypeNodePort
|
||||
svc.Spec.Ports = []v1.ServicePort{
|
||||
{Port: 80, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt(9376)},
|
||||
}
|
||||
})
|
||||
if err != nil {
|
||||
serviceIP = serviceIP.Next()
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
framework.ExpectNoError(err, "unable to allocate Service on new ServiceCIDR")
|
||||
|
||||
ginkgo.DeferCleanup(func(ctx context.Context) {
|
||||
err := cs.CoreV1().Services(ns).Delete(ctx, serviceName, metav1.DeleteOptions{})
|
||||
framework.ExpectNoError(err, "failed to delete service: %s in namespace: %s", serviceName, ns)
|
||||
})
|
||||
framework.ExpectNoError(err)
|
||||
err = jig.CreateServicePods(ctx, 2)
|
||||
framework.ExpectNoError(err)
|
||||
execPod := e2epod.CreateExecPodOrFail(ctx, cs, ns, "execpod", nil)
|
||||
@@ -104,13 +130,13 @@ var _ = common.SIGDescribe(feature.ServiceCIDRs, framework.WithFeatureGate(featu
|
||||
|
||||
})
|
||||
|
||||
func isReady(serviceCIDR *networkingv1beta1.ServiceCIDR) bool {
|
||||
func isReady(serviceCIDR *networkingv1.ServiceCIDR) bool {
|
||||
if serviceCIDR == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
for _, condition := range serviceCIDR.Status.Conditions {
|
||||
if condition.Type == string(networkingv1beta1.ServiceCIDRConditionReady) {
|
||||
if condition.Type == string(networkingv1.ServiceCIDRConditionReady) {
|
||||
return condition.Status == metav1.ConditionStatus(metav1.ConditionTrue)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -392,6 +392,10 @@
|
||||
lockToDefault: false
|
||||
preRelease: Alpha
|
||||
version: "1.31"
|
||||
- default: false
|
||||
lockToDefault: false
|
||||
preRelease: Beta
|
||||
version: "1.33"
|
||||
- name: DisableCloudProviders
|
||||
versionedSpecs:
|
||||
- default: false
|
||||
@@ -802,6 +806,10 @@
|
||||
lockToDefault: false
|
||||
preRelease: Beta
|
||||
version: "1.31"
|
||||
- default: true
|
||||
lockToDefault: false
|
||||
preRelease: GA
|
||||
version: "1.33"
|
||||
- name: MutatingAdmissionPolicy
|
||||
versionedSpecs:
|
||||
- default: false
|
||||
|
||||
@@ -68,6 +68,7 @@ var resetFieldsStatusData = map[schema.GroupVersionResource]string{
|
||||
gvr("admissionregistration.k8s.io", "v1", "validatingadmissionpolicies"): `{"status": {"conditions":[{"type":"Accepted","status":"True","lastTransitionTime":"2020-01-01T00:00:00Z","reason":"RuleApplied","message":"Rule was applied"}]}}`,
|
||||
gvr("networking.k8s.io", "v1alpha1", "servicecidrs"): `{"status": {"conditions":[{"type":"Accepted","status":"True","lastTransitionTime":"2020-01-01T00:00:00Z","reason":"RuleApplied","message":"Rule was applied"}]}}`,
|
||||
gvr("networking.k8s.io", "v1beta1", "servicecidrs"): `{"status": {"conditions":[{"type":"Accepted","status":"True","lastTransitionTime":"2020-01-01T00:00:00Z","reason":"RuleApplied","message":"Rule was applied"}]}}`,
|
||||
gvr("networking.k8s.io", "v1", "servicecidrs"): `{"status": {"conditions":[{"type":"Accepted","status":"True","lastTransitionTime":"2020-01-01T00:00:00Z","reason":"RuleApplied","message":"Rule was applied"}]}}`,
|
||||
}
|
||||
|
||||
// resetFieldsStatusDefault conflicts with statusDefault
|
||||
@@ -138,6 +139,7 @@ var resetFieldsSpecData = map[schema.GroupVersionResource]string{
|
||||
gvr("networking.k8s.io", "v1", "ingresses"): `{"spec": {"defaultBackend": {"service": {"name": "service2"}}}}`,
|
||||
gvr("networking.k8s.io", "v1alpha1", "servicecidrs"): `{}`,
|
||||
gvr("networking.k8s.io", "v1beta1", "servicecidrs"): `{}`,
|
||||
gvr("networking.k8s.io", "v1", "servicecidrs"): `{}`,
|
||||
gvr("policy", "v1", "poddisruptionbudgets"): `{"spec": {"selector": {"matchLabels": {"anokkey2": "anokvalue"}}}}`,
|
||||
gvr("policy", "v1beta1", "poddisruptionbudgets"): `{"spec": {"selector": {"matchLabels": {"anokkey2": "anokvalue"}}}}`,
|
||||
gvr("storage.k8s.io", "v1alpha1", "volumeattachments"): `{"metadata": {"name": "va3"}, "spec": {"nodeName": "localhost2"}}`,
|
||||
|
||||
@@ -272,6 +272,18 @@ func GetEtcdStorageDataForNamespaceServedAt(namespace string, v string, removeAl
|
||||
ExpectedEtcdPath: "/registry/networkpolicies/" + namespace + "/np2",
|
||||
IntroducedVersion: "1.7",
|
||||
},
|
||||
gvr("networking.k8s.io", "v1", "ipaddresses"): {
|
||||
Stub: `{"metadata": {"name": "192.168.2.3"}, "spec": {"parentRef": {"resource": "services","name": "test", "namespace": "ns"}}}`,
|
||||
ExpectedEtcdPath: "/registry/ipaddresses/192.168.2.3",
|
||||
ExpectedGVK: gvkP("networking.k8s.io", "v1beta1", "IPAddress"),
|
||||
IntroducedVersion: "1.33",
|
||||
},
|
||||
gvr("networking.k8s.io", "v1", "servicecidrs"): {
|
||||
Stub: `{"metadata": {"name": "range-b2"}, "spec": {"cidrs": ["192.168.0.0/16","fd00:1::/120"]}}`,
|
||||
ExpectedEtcdPath: "/registry/servicecidrs/range-b2",
|
||||
ExpectedGVK: gvkP("networking.k8s.io", "v1beta1", "ServiceCIDR"),
|
||||
IntroducedVersion: "1.33",
|
||||
},
|
||||
// --
|
||||
|
||||
// k8s.io/kubernetes/pkg/apis/networking/v1beta1
|
||||
|
||||
@@ -45,6 +45,7 @@ import (
|
||||
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
||||
componentbaseversion "k8s.io/component-base/version"
|
||||
"k8s.io/kubernetes/cmd/kube-apiserver/app/options"
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
)
|
||||
|
||||
// Only add kinds to this list when this a virtual resource with get and create verbs that doesn't actually
|
||||
@@ -94,6 +95,14 @@ func testEtcdStoragePathWithVersion(t *testing.T, v string) {
|
||||
// Only test for beta and GA APIs with emulated version.
|
||||
featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, feature.DefaultFeatureGate, version.MustParse(v))
|
||||
featuregatetesting.SetFeatureGateDuringTest(t, feature.DefaultFeatureGate, "AllBeta", true)
|
||||
// Feature Gates that are GA and depend directly on the API version to work can not be emulated in previous versions.
|
||||
// Example feature:
|
||||
// v1.x-2 : FeatureGate alpha , API v1alpha1/feature
|
||||
// v1.x-1 : FeatureGate beta , API v1beta1/feature
|
||||
// v1.x : FeatureGate GA , API v1/feature
|
||||
// The code in v1.x uses the clients with the v1 API, if we emulate v1.x-1 it will not work against apiserver that
|
||||
// only understand v1beta1.
|
||||
featuregatetesting.SetFeatureGateDuringTest(t, feature.DefaultFeatureGate, features.MultiCIDRServiceAllocator, false)
|
||||
}
|
||||
registerEffectiveEmulationVersion(t)
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@ func TestServiceAllocIPAddressLargeCIDR(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
_, err = client.NetworkingV1beta1().IPAddresses().Get(tCtx, svc.Spec.ClusterIP, metav1.GetOptions{})
|
||||
_, err = client.NetworkingV1().IPAddresses().Get(tCtx, svc.Spec.ClusterIP, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
@@ -219,7 +219,7 @@ func TestServiceAllocIPAddressLargeCIDR(t *testing.T) {
|
||||
t.Errorf("unexpected error text: %v", err)
|
||||
}
|
||||
|
||||
_, err = client.NetworkingV1beta1().IPAddresses().Get(context.TODO(), lastSvc.Spec.ClusterIP, metav1.GetOptions{})
|
||||
_, err = client.NetworkingV1().IPAddresses().Get(context.TODO(), lastSvc.Spec.ClusterIP, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
@@ -286,7 +286,7 @@ func TestMigrateService(t *testing.T) {
|
||||
|
||||
err = wait.PollImmediate(1*time.Second, 10*time.Second, func() (bool, error) {
|
||||
// The repair loop must create the IP address associated
|
||||
_, err = kubeclient.NetworkingV1beta1().IPAddresses().Get(context.TODO(), svc.Spec.ClusterIP, metav1.GetOptions{})
|
||||
_, err = kubeclient.NetworkingV1().IPAddresses().Get(context.TODO(), svc.Spec.ClusterIP, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return false, nil
|
||||
}
|
||||
@@ -339,7 +339,7 @@ func TestSkewedAllocatorsRollback(t *testing.T) {
|
||||
t.Error(err)
|
||||
continue
|
||||
}
|
||||
_, err = kubeclient1.NetworkingV1beta1().IPAddresses().Get(context.TODO(), service.Spec.ClusterIP, metav1.GetOptions{})
|
||||
_, err = kubeclient1.NetworkingV1().IPAddresses().Get(context.TODO(), service.Spec.ClusterIP, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
@@ -369,7 +369,7 @@ func TestSkewedAllocatorsRollback(t *testing.T) {
|
||||
|
||||
err = wait.PollImmediate(1*time.Second, 10*time.Second, func() (bool, error) {
|
||||
// The repair loop must create the IP address associated
|
||||
_, err = kubeclient1.NetworkingV1beta1().IPAddresses().Get(context.TODO(), service.Spec.ClusterIP, metav1.GetOptions{})
|
||||
_, err = kubeclient1.NetworkingV1().IPAddresses().Get(context.TODO(), service.Spec.ClusterIP, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return false, nil
|
||||
}
|
||||
@@ -498,7 +498,7 @@ func TestSkewAllocatorsRollout(t *testing.T) {
|
||||
// It takes some time for the repairip loop to create the corresponding IPAddress objects
|
||||
// ClusterIPs are synchronized through the bitmap.
|
||||
err = wait.PollUntilContextTimeout(context.Background(), 1*time.Second, 10*time.Second, true, func(context.Context) (bool, error) {
|
||||
ips, err := kubeclientNew.NetworkingV1beta1().IPAddresses().List(context.Background(), metav1.ListOptions{})
|
||||
ips, err := kubeclientNew.NetworkingV1().IPAddresses().List(context.Background(), metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return false, nil
|
||||
}
|
||||
@@ -527,7 +527,7 @@ func TestSkewAllocatorsRollout(t *testing.T) {
|
||||
ip := fmt.Sprintf("10.0.0.%d", i)
|
||||
err = wait.PollUntilContextTimeout(context.Background(), 1*time.Second, 10*time.Second, true, func(context.Context) (bool, error) {
|
||||
// The repair loop must create the IP address associated
|
||||
_, err = kubeclientNew.NetworkingV1beta1().IPAddresses().Get(context.Background(), ip, metav1.GetOptions{})
|
||||
_, err = kubeclientNew.NetworkingV1().IPAddresses().Get(context.Background(), ip, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return false, nil
|
||||
}
|
||||
@@ -577,7 +577,7 @@ func TestFlagsIPAllocator(t *testing.T) {
|
||||
t.Error(err)
|
||||
continue
|
||||
}
|
||||
_, err = kubeclient1.NetworkingV1beta1().IPAddresses().Get(context.TODO(), service.Spec.ClusterIP, metav1.GetOptions{})
|
||||
_, err = kubeclient1.NetworkingV1().IPAddresses().Get(context.TODO(), service.Spec.ClusterIP, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
"time"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
networkingv1beta1 "k8s.io/api/networking/v1beta1"
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
@@ -77,8 +77,8 @@ func TestMigrateServiceCIDR(t *testing.T) {
|
||||
// ServiceCIDR controller
|
||||
go servicecidrs.NewController(
|
||||
tCtx,
|
||||
informers1.Networking().V1beta1().ServiceCIDRs(),
|
||||
informers1.Networking().V1beta1().IPAddresses(),
|
||||
informers1.Networking().V1().ServiceCIDRs(),
|
||||
informers1.Networking().V1().IPAddresses(),
|
||||
client1,
|
||||
).Run(tCtx, 5)
|
||||
informers1.Start(tCtx.Done())
|
||||
@@ -86,7 +86,7 @@ func TestMigrateServiceCIDR(t *testing.T) {
|
||||
|
||||
// the default serviceCIDR should have a finalizer and ready condition set to true
|
||||
if err := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, time.Minute, false, func(ctx context.Context) (bool, error) {
|
||||
cidr, err := client1.NetworkingV1beta1().ServiceCIDRs().Get(context.TODO(), defaultservicecidr.DefaultServiceCIDRName, metav1.GetOptions{})
|
||||
cidr, err := client1.NetworkingV1().ServiceCIDRs().Get(context.TODO(), defaultservicecidr.DefaultServiceCIDRName, metav1.GetOptions{})
|
||||
if err != nil && !apierrors.IsNotFound(err) {
|
||||
return false, err
|
||||
}
|
||||
@@ -120,13 +120,13 @@ func TestMigrateServiceCIDR(t *testing.T) {
|
||||
}
|
||||
}
|
||||
// Add a new service CIDR to be able to migrate the apiserver
|
||||
if _, err := client1.NetworkingV1beta1().ServiceCIDRs().Create(context.Background(), makeServiceCIDR("migration-cidr", cidr2, ""), metav1.CreateOptions{}); err != nil {
|
||||
if _, err := client1.NetworkingV1().ServiceCIDRs().Create(context.Background(), makeServiceCIDR("migration-cidr", cidr2, ""), metav1.CreateOptions{}); err != nil {
|
||||
t.Fatalf("got unexpected error: %v", err)
|
||||
}
|
||||
|
||||
// wait ServiceCIDR is ready
|
||||
if err := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, time.Minute, false, func(ctx context.Context) (bool, error) {
|
||||
cidr, err := client1.NetworkingV1beta1().ServiceCIDRs().Get(context.TODO(), "migration-cidr", metav1.GetOptions{})
|
||||
cidr, err := client1.NetworkingV1().ServiceCIDRs().Get(context.TODO(), "migration-cidr", metav1.GetOptions{})
|
||||
if err != nil && !apierrors.IsNotFound(err) {
|
||||
return false, err
|
||||
}
|
||||
@@ -136,18 +136,18 @@ func TestMigrateServiceCIDR(t *testing.T) {
|
||||
}
|
||||
|
||||
// delete the default ServiceCIDR so is no longer used for allocating IPs
|
||||
if err := client1.NetworkingV1beta1().ServiceCIDRs().Delete(context.Background(), defaultservicecidr.DefaultServiceCIDRName, metav1.DeleteOptions{}); err != nil {
|
||||
if err := client1.NetworkingV1().ServiceCIDRs().Delete(context.Background(), defaultservicecidr.DefaultServiceCIDRName, metav1.DeleteOptions{}); err != nil {
|
||||
t.Fatalf("got unexpected error: %v", err)
|
||||
}
|
||||
|
||||
// the default serviceCIDR should be pending deletion with Ready condition set to false
|
||||
if err := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, time.Minute, false, func(ctx context.Context) (bool, error) {
|
||||
cidr, err := client1.NetworkingV1beta1().ServiceCIDRs().Get(context.TODO(), defaultservicecidr.DefaultServiceCIDRName, metav1.GetOptions{})
|
||||
cidr, err := client1.NetworkingV1().ServiceCIDRs().Get(context.TODO(), defaultservicecidr.DefaultServiceCIDRName, metav1.GetOptions{})
|
||||
if err != nil && !apierrors.IsNotFound(err) {
|
||||
return false, err
|
||||
}
|
||||
for _, condition := range cidr.Status.Conditions {
|
||||
if condition.Type == networkingv1beta1.ServiceCIDRConditionReady {
|
||||
if condition.Type == networkingv1.ServiceCIDRConditionReady {
|
||||
return condition.Status == metav1.ConditionFalse, nil
|
||||
}
|
||||
}
|
||||
@@ -216,8 +216,8 @@ func TestMigrateServiceCIDR(t *testing.T) {
|
||||
informers2 := informers.NewSharedInformerFactory(client2, resyncPeriod)
|
||||
go servicecidrs.NewController(
|
||||
tCtx2,
|
||||
informers2.Networking().V1beta1().ServiceCIDRs(),
|
||||
informers2.Networking().V1beta1().IPAddresses(),
|
||||
informers2.Networking().V1().ServiceCIDRs(),
|
||||
informers2.Networking().V1().IPAddresses(),
|
||||
client2,
|
||||
).Run(tCtx2, 5)
|
||||
informers2.Start(tCtx2.Done())
|
||||
@@ -231,7 +231,7 @@ func TestMigrateServiceCIDR(t *testing.T) {
|
||||
|
||||
// the default serviceCIDR should be the new one
|
||||
if err := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, time.Minute, false, func(ctx context.Context) (bool, error) {
|
||||
cidr, err := client2.NetworkingV1beta1().ServiceCIDRs().Get(context.TODO(), defaultservicecidr.DefaultServiceCIDRName, metav1.GetOptions{})
|
||||
cidr, err := client2.NetworkingV1().ServiceCIDRs().Get(context.TODO(), defaultservicecidr.DefaultServiceCIDRName, metav1.GetOptions{})
|
||||
if err != nil && !apierrors.IsNotFound(err) {
|
||||
return false, err
|
||||
}
|
||||
@@ -252,7 +252,7 @@ func TestMigrateServiceCIDR(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, condition := range cidr.Status.Conditions {
|
||||
if condition.Type == networkingv1beta1.ServiceCIDRConditionReady {
|
||||
if condition.Type == networkingv1.ServiceCIDRConditionReady {
|
||||
t.Logf("Expected Condition %s to be %s", condition.Status, metav1.ConditionTrue)
|
||||
return condition.Status == metav1.ConditionTrue, nil
|
||||
}
|
||||
@@ -277,13 +277,13 @@ func TestMigrateServiceCIDR(t *testing.T) {
|
||||
}
|
||||
|
||||
// The temporary ServiceCIDR can be deleted now since the Default ServiceCIDR will cover it
|
||||
if err := client2.NetworkingV1beta1().ServiceCIDRs().Delete(context.Background(), "migration-cidr", metav1.DeleteOptions{}); err != nil {
|
||||
if err := client2.NetworkingV1().ServiceCIDRs().Delete(context.Background(), "migration-cidr", metav1.DeleteOptions{}); err != nil {
|
||||
t.Fatalf("got unexpected error: %v", err)
|
||||
}
|
||||
|
||||
// wait ServiceCIDR no longer exist
|
||||
if err := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, time.Minute, false, func(ctx context.Context) (bool, error) {
|
||||
_, err := client2.NetworkingV1beta1().ServiceCIDRs().Get(context.TODO(), "migration-cidr", metav1.GetOptions{})
|
||||
_, err := client2.NetworkingV1().ServiceCIDRs().Get(context.TODO(), "migration-cidr", metav1.GetOptions{})
|
||||
if err != nil && !apierrors.IsNotFound(err) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import (
|
||||
"time"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
networkingv1beta1 "k8s.io/api/networking/v1beta1"
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
@@ -43,7 +43,7 @@ func TestServiceAllocNewServiceCIDR(t *testing.T) {
|
||||
s := kubeapiservertesting.StartTestServerOrDie(t,
|
||||
apiServerOptions,
|
||||
[]string{
|
||||
"--runtime-config=networking.k8s.io/v1beta1=true",
|
||||
"--runtime-config=networking.k8s.io/v1=true",
|
||||
"--service-cluster-ip-range=192.168.0.0/29",
|
||||
"--advertise-address=10.1.1.1",
|
||||
"--disable-admission-plugins=ServiceAccount",
|
||||
@@ -63,8 +63,8 @@ func TestServiceAllocNewServiceCIDR(t *testing.T) {
|
||||
informerFactory := informers.NewSharedInformerFactory(client, resyncPeriod)
|
||||
go servicecidrs.NewController(
|
||||
ctx,
|
||||
informerFactory.Networking().V1beta1().ServiceCIDRs(),
|
||||
informerFactory.Networking().V1beta1().IPAddresses(),
|
||||
informerFactory.Networking().V1().ServiceCIDRs(),
|
||||
informerFactory.Networking().V1().IPAddresses(),
|
||||
client,
|
||||
).Run(ctx, 5)
|
||||
informerFactory.Start(ctx.Done())
|
||||
@@ -97,12 +97,12 @@ func TestServiceAllocNewServiceCIDR(t *testing.T) {
|
||||
|
||||
// Add a new service CIDR to be able to create new IPs.
|
||||
cidr := makeServiceCIDR("test2", "10.168.0.0/24", "")
|
||||
if _, err := client.NetworkingV1beta1().ServiceCIDRs().Create(context.Background(), cidr, metav1.CreateOptions{}); err != nil {
|
||||
if _, err := client.NetworkingV1().ServiceCIDRs().Create(context.Background(), cidr, metav1.CreateOptions{}); err != nil {
|
||||
t.Fatalf("got unexpected error: %v", err)
|
||||
}
|
||||
// wait ServiceCIDR is ready
|
||||
if err := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, time.Minute, false, func(ctx context.Context) (bool, error) {
|
||||
cidr, err := client.NetworkingV1beta1().ServiceCIDRs().Get(context.TODO(), cidr.Name, metav1.GetOptions{})
|
||||
cidr, err := client.NetworkingV1().ServiceCIDRs().Get(context.TODO(), cidr.Name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -141,7 +141,7 @@ func TestServiceCIDRDeletion(t *testing.T) {
|
||||
s := kubeapiservertesting.StartTestServerOrDie(t,
|
||||
apiServerOptions,
|
||||
[]string{
|
||||
"--runtime-config=networking.k8s.io/v1beta1=true",
|
||||
"--runtime-config=networking.k8s.io/v1=true",
|
||||
"--service-cluster-ip-range=" + cidr1,
|
||||
"--advertise-address=172.16.1.1",
|
||||
"--disable-admission-plugins=ServiceAccount",
|
||||
@@ -165,8 +165,8 @@ func TestServiceCIDRDeletion(t *testing.T) {
|
||||
informerFactory := informers.NewSharedInformerFactory(client, resyncPeriod)
|
||||
go servicecidrs.NewController(
|
||||
ctx,
|
||||
informerFactory.Networking().V1beta1().ServiceCIDRs(),
|
||||
informerFactory.Networking().V1beta1().IPAddresses(),
|
||||
informerFactory.Networking().V1().ServiceCIDRs(),
|
||||
informerFactory.Networking().V1().IPAddresses(),
|
||||
client,
|
||||
).Run(ctx, 5)
|
||||
informerFactory.Start(ctx.Done())
|
||||
@@ -180,13 +180,13 @@ func TestServiceCIDRDeletion(t *testing.T) {
|
||||
}
|
||||
}
|
||||
// create a new ServiceCIDRs that overlaps the default one
|
||||
_, err = client.NetworkingV1beta1().ServiceCIDRs().Create(ctx, makeServiceCIDR("cidr1", cidr1, ""), metav1.CreateOptions{})
|
||||
_, err = client.NetworkingV1().ServiceCIDRs().Create(ctx, makeServiceCIDR("cidr1", cidr1, ""), metav1.CreateOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// Wait until is ready.
|
||||
if err := wait.PollUntilContextTimeout(context.Background(), 250*time.Millisecond, 30*time.Second, false, func(ctx context.Context) (bool, error) {
|
||||
cidr, err := client.NetworkingV1beta1().ServiceCIDRs().Get(ctx, "cidr1", metav1.GetOptions{})
|
||||
cidr, err := client.NetworkingV1().ServiceCIDRs().Get(ctx, "cidr1", metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return false, nil
|
||||
}
|
||||
@@ -195,13 +195,13 @@ func TestServiceCIDRDeletion(t *testing.T) {
|
||||
t.Fatalf("cidr1 is not ready")
|
||||
}
|
||||
// we should be able to delete the ServiceCIDR despite it contains IP addresses as it overlaps with the default ServiceCIDR
|
||||
err = client.NetworkingV1beta1().ServiceCIDRs().Delete(ctx, "cidr1", metav1.DeleteOptions{})
|
||||
err = client.NetworkingV1().ServiceCIDRs().Delete(ctx, "cidr1", metav1.DeleteOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if err := wait.PollUntilContextTimeout(context.Background(), 250*time.Millisecond, 30*time.Second, false, func(ctx context.Context) (bool, error) {
|
||||
_, err := client.NetworkingV1beta1().ServiceCIDRs().Get(ctx, "cidr1", metav1.GetOptions{})
|
||||
_, err := client.NetworkingV1().ServiceCIDRs().Get(ctx, "cidr1", metav1.GetOptions{})
|
||||
if err != nil && apierrors.IsNotFound(err) {
|
||||
return true, nil
|
||||
}
|
||||
@@ -211,14 +211,14 @@ func TestServiceCIDRDeletion(t *testing.T) {
|
||||
}
|
||||
|
||||
// add a new ServiceCIDR with a new range
|
||||
_, err = client.NetworkingV1beta1().ServiceCIDRs().Create(ctx, makeServiceCIDR("cidr2", cidr2, ""), metav1.CreateOptions{})
|
||||
_, err = client.NetworkingV1().ServiceCIDRs().Create(ctx, makeServiceCIDR("cidr2", cidr2, ""), metav1.CreateOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// wait the allocator process the new ServiceCIDR
|
||||
// Wait until is ready.
|
||||
if err := wait.PollUntilContextTimeout(context.Background(), 250*time.Millisecond, 30*time.Second, false, func(ctx context.Context) (bool, error) {
|
||||
cidr, err := client.NetworkingV1beta1().ServiceCIDRs().Get(ctx, "cidr2", metav1.GetOptions{})
|
||||
cidr, err := client.NetworkingV1().ServiceCIDRs().Get(ctx, "cidr2", metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return false, nil
|
||||
}
|
||||
@@ -237,13 +237,13 @@ func TestServiceCIDRDeletion(t *testing.T) {
|
||||
}
|
||||
|
||||
// add a new ServiceCIDR that overlaps the existing one
|
||||
_, err = client.NetworkingV1beta1().ServiceCIDRs().Create(ctx, makeServiceCIDR("cidr3", cidr3, ""), metav1.CreateOptions{})
|
||||
_, err = client.NetworkingV1().ServiceCIDRs().Create(ctx, makeServiceCIDR("cidr3", cidr3, ""), metav1.CreateOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// Wait until is ready.
|
||||
if err := wait.PollUntilContextTimeout(context.Background(), 250*time.Millisecond, 30*time.Second, false, func(ctx context.Context) (bool, error) {
|
||||
cidr, err := client.NetworkingV1beta1().ServiceCIDRs().Get(ctx, "cidr3", metav1.GetOptions{})
|
||||
cidr, err := client.NetworkingV1().ServiceCIDRs().Get(ctx, "cidr3", metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return false, nil
|
||||
}
|
||||
@@ -252,13 +252,13 @@ func TestServiceCIDRDeletion(t *testing.T) {
|
||||
t.Fatalf("cidr3 is not ready")
|
||||
}
|
||||
// we should be able to delete the ServiceCIDR2 despite it contains IP addresses as it is contained on ServiceCIDR3
|
||||
err = client.NetworkingV1beta1().ServiceCIDRs().Delete(ctx, "cidr2", metav1.DeleteOptions{})
|
||||
err = client.NetworkingV1().ServiceCIDRs().Delete(ctx, "cidr2", metav1.DeleteOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if err := wait.PollUntilContextTimeout(context.Background(), 250*time.Millisecond, 30*time.Second, false, func(ctx context.Context) (bool, error) {
|
||||
_, err := client.NetworkingV1beta1().ServiceCIDRs().Get(ctx, "cidr2", metav1.GetOptions{})
|
||||
_, err := client.NetworkingV1().ServiceCIDRs().Get(ctx, "cidr2", metav1.GetOptions{})
|
||||
if err != nil && apierrors.IsNotFound(err) {
|
||||
return true, nil
|
||||
}
|
||||
@@ -268,18 +268,18 @@ func TestServiceCIDRDeletion(t *testing.T) {
|
||||
}
|
||||
|
||||
// serviceCIDR3 will not be able to be deleted until the IPAddress is removed
|
||||
err = client.NetworkingV1beta1().ServiceCIDRs().Delete(ctx, "cidr3", metav1.DeleteOptions{})
|
||||
err = client.NetworkingV1().ServiceCIDRs().Delete(ctx, "cidr3", metav1.DeleteOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// Wait until is not ready.
|
||||
if err := wait.PollUntilContextTimeout(context.Background(), 250*time.Millisecond, 30*time.Second, false, func(ctx context.Context) (bool, error) {
|
||||
cidr, err := client.NetworkingV1beta1().ServiceCIDRs().Get(ctx, "cidr3", metav1.GetOptions{})
|
||||
cidr, err := client.NetworkingV1().ServiceCIDRs().Get(ctx, "cidr3", metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return false, nil
|
||||
}
|
||||
for _, condition := range cidr.Status.Conditions {
|
||||
if condition.Type == networkingv1beta1.ServiceCIDRConditionReady {
|
||||
if condition.Type == networkingv1.ServiceCIDRConditionReady {
|
||||
return condition.Status == metav1.ConditionStatus(metav1.ConditionFalse), nil
|
||||
}
|
||||
}
|
||||
@@ -295,7 +295,7 @@ func TestServiceCIDRDeletion(t *testing.T) {
|
||||
|
||||
// cidr3 must not exist
|
||||
if err := wait.PollUntilContextTimeout(context.Background(), 250*time.Millisecond, 30*time.Second, false, func(ctx context.Context) (bool, error) {
|
||||
_, err := client.NetworkingV1beta1().ServiceCIDRs().Get(ctx, "cidr3", metav1.GetOptions{})
|
||||
_, err := client.NetworkingV1().ServiceCIDRs().Get(ctx, "cidr3", metav1.GetOptions{})
|
||||
if err != nil && apierrors.IsNotFound(err) {
|
||||
return true, nil
|
||||
}
|
||||
@@ -305,12 +305,12 @@ func TestServiceCIDRDeletion(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func makeServiceCIDR(name, primary, secondary string) *networkingv1beta1.ServiceCIDR {
|
||||
serviceCIDR := &networkingv1beta1.ServiceCIDR{
|
||||
func makeServiceCIDR(name, primary, secondary string) *networkingv1.ServiceCIDR {
|
||||
serviceCIDR := &networkingv1.ServiceCIDR{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
},
|
||||
Spec: networkingv1beta1.ServiceCIDRSpec{},
|
||||
Spec: networkingv1.ServiceCIDRSpec{},
|
||||
}
|
||||
serviceCIDR.Spec.CIDRs = append(serviceCIDR.Spec.CIDRs, primary)
|
||||
if secondary != "" {
|
||||
@@ -334,13 +334,13 @@ func makeService(name string) *v1.Service {
|
||||
}
|
||||
|
||||
// returns true of the ServiceCIDRConditionReady is true
|
||||
func isServiceCIDRReady(serviceCIDR *networkingv1beta1.ServiceCIDR) bool {
|
||||
func isServiceCIDRReady(serviceCIDR *networkingv1.ServiceCIDR) bool {
|
||||
if serviceCIDR == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
for _, condition := range serviceCIDR.Status.Conditions {
|
||||
if condition.Type == networkingv1beta1.ServiceCIDRConditionReady {
|
||||
if condition.Type == networkingv1.ServiceCIDRConditionReady {
|
||||
return condition.Status == metav1.ConditionStatus(metav1.ConditionTrue)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user