add build tags to legacy provider code and make it possible to build kube-controller-manager without any legacyproviders or without particular legacy providers

This commit is contained in:
Benjamin Elder 2019-06-25 04:16:05 -07:00
parent 37651f1cef
commit 678d3f2841
194 changed files with 738 additions and 80 deletions

View File

@ -31,15 +31,10 @@ import (
_ "k8s.io/kubernetes/pkg/cloudprovider/providers" _ "k8s.io/kubernetes/pkg/cloudprovider/providers"
// Volume plugins // Volume plugins
"k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/awsebs"
"k8s.io/kubernetes/pkg/volume/azure_dd"
"k8s.io/kubernetes/pkg/volume/azure_file"
"k8s.io/kubernetes/pkg/volume/cinder"
"k8s.io/kubernetes/pkg/volume/csi" "k8s.io/kubernetes/pkg/volume/csi"
"k8s.io/kubernetes/pkg/volume/fc" "k8s.io/kubernetes/pkg/volume/fc"
"k8s.io/kubernetes/pkg/volume/flexvolume" "k8s.io/kubernetes/pkg/volume/flexvolume"
"k8s.io/kubernetes/pkg/volume/flocker" "k8s.io/kubernetes/pkg/volume/flocker"
"k8s.io/kubernetes/pkg/volume/gcepd"
"k8s.io/kubernetes/pkg/volume/glusterfs" "k8s.io/kubernetes/pkg/volume/glusterfs"
"k8s.io/kubernetes/pkg/volume/hostpath" "k8s.io/kubernetes/pkg/volume/hostpath"
"k8s.io/kubernetes/pkg/volume/iscsi" "k8s.io/kubernetes/pkg/volume/iscsi"
@ -51,7 +46,6 @@ import (
"k8s.io/kubernetes/pkg/volume/scaleio" "k8s.io/kubernetes/pkg/volume/scaleio"
"k8s.io/kubernetes/pkg/volume/storageos" "k8s.io/kubernetes/pkg/volume/storageos"
volumeutil "k8s.io/kubernetes/pkg/volume/util" volumeutil "k8s.io/kubernetes/pkg/volume/util"
"k8s.io/kubernetes/pkg/volume/vsphere_volume"
utilfeature "k8s.io/apiserver/pkg/util/feature" utilfeature "k8s.io/apiserver/pkg/util/feature"
persistentvolumeconfig "k8s.io/kubernetes/pkg/controller/volume/persistentvolume/config" persistentvolumeconfig "k8s.io/kubernetes/pkg/controller/volume/persistentvolume/config"
@ -66,12 +60,8 @@ import (
func ProbeAttachableVolumePlugins() []volume.VolumePlugin { func ProbeAttachableVolumePlugins() []volume.VolumePlugin {
allPlugins := []volume.VolumePlugin{} allPlugins := []volume.VolumePlugin{}
allPlugins = append(allPlugins, awsebs.ProbeVolumePlugins()...) allPlugins = appendAttachableLegacyProviderVolumes(allPlugins)
allPlugins = append(allPlugins, gcepd.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, cinder.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, portworx.ProbeVolumePlugins()...) allPlugins = append(allPlugins, portworx.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, vsphere_volume.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, azure_dd.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, scaleio.ProbeVolumePlugins()...) allPlugins = append(allPlugins, scaleio.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, storageos.ProbeVolumePlugins()...) allPlugins = append(allPlugins, storageos.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, fc.ProbeVolumePlugins()...) allPlugins = append(allPlugins, fc.ProbeVolumePlugins()...)
@ -92,15 +82,10 @@ func GetDynamicPluginProber(config persistentvolumeconfig.VolumeConfiguration) v
func ProbeExpandableVolumePlugins(config persistentvolumeconfig.VolumeConfiguration) []volume.VolumePlugin { func ProbeExpandableVolumePlugins(config persistentvolumeconfig.VolumeConfiguration) []volume.VolumePlugin {
allPlugins := []volume.VolumePlugin{} allPlugins := []volume.VolumePlugin{}
allPlugins = append(allPlugins, awsebs.ProbeVolumePlugins()...) allPlugins = appendExpandableLegacyProviderVolumes(allPlugins)
allPlugins = append(allPlugins, gcepd.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, cinder.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, portworx.ProbeVolumePlugins()...) allPlugins = append(allPlugins, portworx.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, vsphere_volume.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, glusterfs.ProbeVolumePlugins()...) allPlugins = append(allPlugins, glusterfs.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, rbd.ProbeVolumePlugins()...) allPlugins = append(allPlugins, rbd.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, azure_dd.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, azure_file.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, scaleio.ProbeVolumePlugins()...) allPlugins = append(allPlugins, scaleio.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, storageos.ProbeVolumePlugins()...) allPlugins = append(allPlugins, storageos.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, fc.ProbeVolumePlugins()...) allPlugins = append(allPlugins, fc.ProbeVolumePlugins()...)
@ -146,7 +131,7 @@ func ProbeControllerVolumePlugins(cloud cloudprovider.Interface, config persiste
// add rbd provisioner // add rbd provisioner
allPlugins = append(allPlugins, rbd.ProbeVolumePlugins()...) allPlugins = append(allPlugins, rbd.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, quobyte.ProbeVolumePlugins()...) allPlugins = append(allPlugins, quobyte.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, azure_file.ProbeVolumePlugins()...) allPlugins = appendLegacyProviderVolumes(allPlugins)
allPlugins = append(allPlugins, flocker.ProbeVolumePlugins()...) allPlugins = append(allPlugins, flocker.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, portworx.ProbeVolumePlugins()...) allPlugins = append(allPlugins, portworx.ProbeVolumePlugins()...)
@ -154,12 +139,6 @@ func ProbeControllerVolumePlugins(cloud cloudprovider.Interface, config persiste
allPlugins = append(allPlugins, local.ProbeVolumePlugins()...) allPlugins = append(allPlugins, local.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, storageos.ProbeVolumePlugins()...) allPlugins = append(allPlugins, storageos.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, awsebs.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, gcepd.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, cinder.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, vsphere_volume.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, azure_dd.ProbeVolumePlugins()...)
if utilfeature.DefaultFeatureGate.Enabled(features.CSIInlineVolume) { if utilfeature.DefaultFeatureGate.Enabled(features.CSIInlineVolume) {
allPlugins = append(allPlugins, csi.ProbeVolumePlugins()...) allPlugins = append(allPlugins, csi.ProbeVolumePlugins()...)
} }

View File

@ -0,0 +1,52 @@
// +build !nolegacyproviders
/*
Copyright 2019 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 app
import (
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/awsebs"
"k8s.io/kubernetes/pkg/volume/azure_dd"
"k8s.io/kubernetes/pkg/volume/azure_file"
"k8s.io/kubernetes/pkg/volume/cinder"
"k8s.io/kubernetes/pkg/volume/gcepd"
"k8s.io/kubernetes/pkg/volume/vsphere_volume"
)
func appendAttachableLegacyProviderVolumes(allPlugins []volume.VolumePlugin) []volume.VolumePlugin {
allPlugins = append(allPlugins, awsebs.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, azure_dd.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, cinder.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, gcepd.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, vsphere_volume.ProbeVolumePlugins()...)
return allPlugins
}
func appendExpandableLegacyProviderVolumes(allPlugins []volume.VolumePlugin) []volume.VolumePlugin {
return appendLegacyProviderVolumes(allPlugins)
}
func appendLegacyProviderVolumes(allPlugins []volume.VolumePlugin) []volume.VolumePlugin {
allPlugins = append(allPlugins, awsebs.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, azure_dd.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, azure_file.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, cinder.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, gcepd.ProbeVolumePlugins()...)
allPlugins = append(allPlugins, vsphere_volume.ProbeVolumePlugins()...)
return allPlugins
}

View File

@ -0,0 +1,38 @@
// +build nolegacyproviders
/*
Copyright 2019 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 app
import (
"k8s.io/kubernetes/pkg/volume"
)
func appendAttachableLegacyProviderVolumes(allPlugins []volume.VolumePlugin) []volume.VolumePlugin {
// no-op when compiled without legacy cloud providers
return allPlugins
}
func appendExpandableLegacyProviderVolumes(allPlugins []volume.VolumePlugin) []volume.VolumePlugin {
// no-op when compiled without legacy cloud providers
return allPlugins
}
func appendLegacyProviderVolumes(allPlugins []volume.VolumePlugin) []volume.VolumePlugin {
// no-op when compiled without legacy cloud providers
return allPlugins
}

View File

@ -0,0 +1,17 @@
/*
Copyright 2019 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 cloudprovider

View File

@ -0,0 +1,17 @@
/*
Copyright 2019 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 openstack

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2014 The Kubernetes Authors. Copyright 2014 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2017 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.
@ -23,9 +25,9 @@ import (
"github.com/gophercloud/gophercloud" "github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/openstack/compute/v2/servers" "github.com/gophercloud/gophercloud/openstack/compute/v2/servers"
v1 "k8s.io/api/core/v1"
"k8s.io/klog" "k8s.io/klog"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
cloudprovider "k8s.io/cloud-provider" cloudprovider "k8s.io/cloud-provider"
) )

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.
@ -39,7 +41,7 @@ import (
"github.com/gophercloud/gophercloud/pagination" "github.com/gophercloud/gophercloud/pagination"
"k8s.io/klog" "k8s.io/klog"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/util/wait"

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2017 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2014 The Kubernetes Authors. Copyright 2014 The Kubernetes Authors.
@ -29,7 +31,7 @@ import (
"github.com/gophercloud/gophercloud" "github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/openstack/compute/v2/servers" "github.com/gophercloud/gophercloud/openstack/compute/v2/servers"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2015 The Kubernetes Authors. Copyright 2015 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2017 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
@ -23,7 +25,7 @@ import (
"k8s.io/klog" "k8s.io/klog"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
clientset "k8s.io/client-go/kubernetes" clientset "k8s.io/client-go/kubernetes"

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.
@ -25,7 +27,7 @@ import (
"k8s.io/klog" "k8s.io/klog"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"

View File

@ -0,0 +1,32 @@
// +build nolegacyproviders
/*
Copyright 2019 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 ipam
import (
"errors"
informers "k8s.io/client-go/informers/core/v1"
clientset "k8s.io/client-go/kubernetes"
cloudprovider "k8s.io/cloud-provider"
)
// NewCloudCIDRAllocator creates a new cloud CIDR allocator.
func NewCloudCIDRAllocator(client clientset.Interface, cloud cloudprovider.Interface, nodeInformer informers.NodeInformer) (CIDRAllocator, error) {
return nil, errors.New("legacy cloud provider support not built")
}

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2018 The Kubernetes Authors. Copyright 2018 The Kubernetes Authors.
@ -21,7 +23,7 @@ import (
"testing" "testing"
"time" "time"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/informers" "k8s.io/client-go/informers"
"k8s.io/client-go/kubernetes/fake" "k8s.io/client-go/kubernetes/fake"

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2017 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.

View File

@ -0,0 +1,69 @@
// +build !nolegacyproviders
/*
Copyright 2019 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 nodeipam
import (
"net"
coreinformers "k8s.io/client-go/informers/core/v1"
clientset "k8s.io/client-go/kubernetes"
cloudprovider "k8s.io/cloud-provider"
"k8s.io/klog"
"k8s.io/kubernetes/pkg/controller/nodeipam/ipam"
nodesync "k8s.io/kubernetes/pkg/controller/nodeipam/ipam/sync"
)
func startLegacyIPAM(
ic *Controller,
nodeInformer coreinformers.NodeInformer,
cloud cloudprovider.Interface,
kubeClient clientset.Interface,
clusterCIDRs []*net.IPNet,
serviceCIDR *net.IPNet,
nodeCIDRMaskSize int,
) {
cfg := &ipam.Config{
Resync: ipamResyncInterval,
MaxBackoff: ipamMaxBackoff,
InitialRetry: ipamInitialBackoff,
}
switch ic.allocatorType {
case ipam.IPAMFromClusterAllocatorType:
cfg.Mode = nodesync.SyncFromCluster
case ipam.IPAMFromCloudAllocatorType:
cfg.Mode = nodesync.SyncFromCloud
}
// we may end up here with no cidr at all in case of FromCloud/FromCluster
var cidr *net.IPNet
if len(clusterCIDRs) > 0 {
cidr = clusterCIDRs[0]
}
if len(clusterCIDRs) > 1 {
klog.Warningf("Multiple cidrs were configured with FromCluster or FromCloud. cidrs except first one were discarded")
}
ipamc, err := ipam.NewController(cfg, kubeClient, cloud, cidr, serviceCIDR, nodeCIDRMaskSize)
if err != nil {
klog.Fatalf("Error creating ipam controller: %v", err)
}
if err := ipamc.Start(nodeInformer); err != nil {
klog.Fatalf("Error trying to Init(): %v", err)
}
}

View File

@ -28,14 +28,13 @@ import (
"k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/record" "k8s.io/client-go/tools/record"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
coreinformers "k8s.io/client-go/informers/core/v1" coreinformers "k8s.io/client-go/informers/core/v1"
clientset "k8s.io/client-go/kubernetes" clientset "k8s.io/client-go/kubernetes"
corelisters "k8s.io/client-go/listers/core/v1" corelisters "k8s.io/client-go/listers/core/v1"
cloudprovider "k8s.io/cloud-provider" cloudprovider "k8s.io/cloud-provider"
"k8s.io/kubernetes/pkg/controller" "k8s.io/kubernetes/pkg/controller"
"k8s.io/kubernetes/pkg/controller/nodeipam/ipam" "k8s.io/kubernetes/pkg/controller/nodeipam/ipam"
nodesync "k8s.io/kubernetes/pkg/controller/nodeipam/ipam/sync"
"k8s.io/kubernetes/pkg/util/metrics" "k8s.io/kubernetes/pkg/util/metrics"
) )
@ -131,33 +130,7 @@ func NewNodeIpamController(
// TODO: Abstract this check into a generic controller manager should run method. // TODO: Abstract this check into a generic controller manager should run method.
if ic.allocatorType == ipam.IPAMFromClusterAllocatorType || ic.allocatorType == ipam.IPAMFromCloudAllocatorType { if ic.allocatorType == ipam.IPAMFromClusterAllocatorType || ic.allocatorType == ipam.IPAMFromCloudAllocatorType {
cfg := &ipam.Config{ startLegacyIPAM(ic, nodeInformer, cloud, kubeClient, clusterCIDRs, serviceCIDR, nodeCIDRMaskSize)
Resync: ipamResyncInterval,
MaxBackoff: ipamMaxBackoff,
InitialRetry: ipamInitialBackoff,
}
switch ic.allocatorType {
case ipam.IPAMFromClusterAllocatorType:
cfg.Mode = nodesync.SyncFromCluster
case ipam.IPAMFromCloudAllocatorType:
cfg.Mode = nodesync.SyncFromCloud
}
// we may end up here with no cidr at all in case of FromCloud/FromCluster
var cidr *net.IPNet
if len(clusterCIDRs) > 0 {
cidr = clusterCIDRs[0]
}
if len(clusterCIDRs) > 1 {
klog.Warningf("Multiple cidrs were configured with FromCluster or FromCloud. cidrs except first one were discarded")
}
ipamc, err := ipam.NewController(cfg, kubeClient, cloud, cidr, serviceCIDR, nodeCIDRMaskSize)
if err != nil {
klog.Fatalf("Error creating ipam controller: %v", err)
}
if err := ipamc.Start(nodeInformer); err != nil {
klog.Fatalf("Error trying to Init(): %v", err)
}
} else { } else {
var err error var err error
ic.cidrAllocator, err = ipam.New(kubeClient, cloud, nodeInformer, ic.allocatorType, clusterCIDRs, ic.serviceCIDR, nodeCIDRMaskSize) ic.cidrAllocator, err = ipam.New(kubeClient, cloud, nodeInformer, ic.allocatorType, clusterCIDRs, ic.serviceCIDR, nodeCIDRMaskSize)

View File

@ -0,0 +1,40 @@
// +build nolegacyproviders
/*
Copyright 2019 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 nodeipam
import (
"net"
coreinformers "k8s.io/client-go/informers/core/v1"
clientset "k8s.io/client-go/kubernetes"
cloudprovider "k8s.io/cloud-provider"
"k8s.io/klog"
)
func startLegacyIPAM(
ic *Controller,
nodeInformer coreinformers.NodeInformer,
cloud cloudprovider.Interface,
kubeClient clientset.Interface,
clusterCIDRs []*net.IPNet,
serviceCIDR *net.IPNet,
nodeCIDRMaskSize int,
) {
klog.Fatal("Error trying to Init(): legacy cloud provider support disabled at build time")
}

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.
@ -22,7 +24,7 @@ import (
"k8s.io/klog" "k8s.io/klog"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
"k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume"

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2014 The Kubernetes Authors. Copyright 2014 The Kubernetes Authors.
@ -28,7 +30,7 @@ import (
"k8s.io/klog" "k8s.io/klog"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2018 The Kubernetes Authors. Copyright 2018 The Kubernetes Authors.
@ -22,7 +24,7 @@ import (
"strconv" "strconv"
"strings" "strings"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
"k8s.io/klog" "k8s.io/klog"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2018 The Kubernetes Authors. Copyright 2018 The Kubernetes Authors.
@ -21,7 +23,7 @@ import (
"path/filepath" "path/filepath"
"testing" "testing"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
utiltesting "k8s.io/client-go/util/testing" utiltesting "k8s.io/client-go/util/testing"

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2014 The Kubernetes Authors. Copyright 2014 The Kubernetes Authors.
@ -24,7 +26,7 @@ import (
"testing" "testing"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2014 The Kubernetes Authors. Copyright 2014 The Kubernetes Authors.
@ -26,10 +28,10 @@ import (
"k8s.io/klog" "k8s.io/klog"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
"k8s.io/cloud-provider" cloudprovider "k8s.io/cloud-provider"
volumehelpers "k8s.io/cloud-provider/volume/helpers" volumehelpers "k8s.io/cloud-provider/volume/helpers"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume"

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2019 The Kubernetes Authors. Copyright 2019 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2017 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,4 @@
// +build !nolegacyproviders
// +build linux // +build linux
/* /*

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2017 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,4 @@
// +build !nolegacyproviders
// +build !linux,!windows // +build !linux,!windows
/* /*

View File

@ -1,3 +1,4 @@
// +build !nolegacyproviders
// +build windows // +build windows
/* /*

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2018 The Kubernetes Authors. Copyright 2018 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2018 The Kubernetes Authors. Copyright 2018 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2019 The Kubernetes Authors. Copyright 2019 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2015 The Kubernetes Authors. Copyright 2015 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2017 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2017 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2018 The Kubernetes Authors. Copyright 2018 The Kubernetes Authors.

View File

@ -0,0 +1,17 @@
/*
Copyright 2019 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 azure_dd

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2017 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2015 The Kubernetes Authors. Copyright 2015 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2018 The Kubernetes Authors. Copyright 2018 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2018 The Kubernetes Authors. Copyright 2018 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2015 The Kubernetes Authors. Copyright 2015 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2015 The Kubernetes Authors. Copyright 2015 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.
@ -27,7 +29,7 @@ import (
"strconv" "strconv"
"time" "time"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
"k8s.io/klog" "k8s.io/klog"

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.
@ -21,7 +23,7 @@ import (
"fmt" "fmt"
"testing" "testing"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
cloudprovider "k8s.io/cloud-provider" cloudprovider "k8s.io/cloud-provider"
@ -29,9 +31,10 @@ import (
"k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume"
volumetest "k8s.io/kubernetes/pkg/volume/testing" volumetest "k8s.io/kubernetes/pkg/volume/testing"
"strings"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
"k8s.io/klog" "k8s.io/klog"
"strings"
) )
func TestGetDeviceName_Volume(t *testing.T) { func TestGetDeviceName_Volume(t *testing.T) {

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2014 The Kubernetes Authors. Copyright 2014 The Kubernetes Authors.
@ -25,7 +27,7 @@ import (
"strconv" "strconv"
"strings" "strings"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2018 The Kubernetes Authors. Copyright 2018 The Kubernetes Authors.
@ -21,7 +23,7 @@ import (
"path/filepath" "path/filepath"
"strconv" "strconv"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
"k8s.io/klog" "k8s.io/klog"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2018 The Kubernetes Authors. Copyright 2018 The Kubernetes Authors.
@ -21,7 +23,7 @@ import (
"path/filepath" "path/filepath"
"testing" "testing"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
utiltesting "k8s.io/client-go/util/testing" utiltesting "k8s.io/client-go/util/testing"

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2014 The Kubernetes Authors. Copyright 2014 The Kubernetes Authors.
@ -24,7 +26,7 @@ import (
"sort" "sort"
"testing" "testing"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/kubernetes/fake" "k8s.io/client-go/kubernetes/fake"

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2014 The Kubernetes Authors. Copyright 2014 The Kubernetes Authors.
@ -23,7 +25,7 @@ import (
"strings" "strings"
"time" "time"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
cloudprovider "k8s.io/cloud-provider" cloudprovider "k8s.io/cloud-provider"
cloudvolume "k8s.io/cloud-provider/volume" cloudvolume "k8s.io/cloud-provider/volume"

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2018 The Kubernetes Authors. Copyright 2018 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.

View File

@ -0,0 +1,17 @@
/*
Copyright 2019 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 vsphere_volume

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2018 The Kubernetes Authors. Copyright 2018 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2018 The Kubernetes Authors. Copyright 2018 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2014 The Kubernetes Authors. Copyright 2014 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2017 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2014 The Kubernetes Authors. Copyright 2014 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2014 The Kubernetes Authors. Copyright 2014 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2017 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2017 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2014 The Kubernetes Authors. Copyright 2014 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2014 The Kubernetes Authors. Copyright 2014 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2014 The Kubernetes Authors. Copyright 2014 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.

View File

@ -0,0 +1,17 @@
/*
Copyright 2019 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 aws

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2017 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2017 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2015 The Kubernetes Authors. Copyright 2015 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2015 The Kubernetes Authors. Copyright 2015 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2017 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyroviders
/* /*
Copyright 2014 The Kubernetes Authors. Copyright 2014 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2016 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2017 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2017 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,5 @@
// +build !nolegacyproviders
/* /*
Copyright 2017 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.

Some files were not shown because too many files have changed in this diff Show More