Skip to content

Commit e232921

Browse files
authored
Merge pull request kubernetes#80353 from BenTheElder/tags
simulate in-tree cloud provider removal with a build tag
2 parents 66d3572 + 5a3301a commit e232921

File tree

215 files changed

+938
-100
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

215 files changed

+938
-100
lines changed

cmd/kube-apiserver/app/options/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ go_library(
1010
name = "go_default_library",
1111
srcs = [
1212
"globalflags.go",
13+
"globalflags_providers.go",
1314
"options.go",
1415
"validation.go",
1516
],

cmd/kube-apiserver/app/options/globalflags.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ func AddCustomGlobalFlags(fs *pflag.FlagSet) {
3333
// Lookup flags in global flag set and re-register the values with our flagset.
3434

3535
// Adds flags from k8s.io/kubernetes/pkg/cloudprovider/providers.
36-
globalflag.Register(fs, "cloud-provider-gce-lb-src-cidrs")
37-
fs.MarkDeprecated("cloud-provider-gce-lb-src-cidrs", "This flag will be removed once the GCE Cloud Provider is removed from kube-apiserver")
36+
registerLegacyGlobalFlags(fs)
3837

3938
// Adds flags from k8s.io/apiserver/pkg/admission.
4039
globalflag.Register(fs, "default-not-ready-toleration-seconds")
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// +build providerless
2+
3+
/*
4+
Copyright 2019 The Kubernetes Authors.
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
*/
18+
19+
package options
20+
21+
import (
22+
"github.com/spf13/pflag"
23+
)
24+
25+
func registerLegacyGlobalFlags(fs *pflag.FlagSet) {
26+
// no-op when no legacy providers are compiled in
27+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// +build !providerless
2+
3+
/*
4+
Copyright 2019 The Kubernetes Authors.
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
*/
18+
19+
package options
20+
21+
import (
22+
"github.com/spf13/pflag"
23+
24+
"k8s.io/component-base/cli/globalflag"
25+
)
26+
27+
func registerLegacyGlobalFlags(fs *pflag.FlagSet) {
28+
globalflag.Register(fs, "cloud-provider-gce-lb-src-cidrs")
29+
fs.MarkDeprecated("cloud-provider-gce-lb-src-cidrs", "This flag will be removed once the GCE Cloud Provider is removed from kube-apiserver")
30+
}

cmd/kube-controller-manager/app/BUILD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ go_library(
1111
"cloudproviders.go",
1212
"controllermanager.go",
1313
"core.go",
14+
"flags_providers.go",
1415
"import_known_versions.go",
1516
"plugins.go",
17+
"plugins_providers.go",
1618
"policy.go",
1719
"rbac.go",
1820
],

cmd/kube-controller-manager/app/controllermanager.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,7 @@ controller, and serviceaccounts controller.`,
126126
namedFlagSets := s.Flags(KnownControllers(), ControllersDisabledByDefault.List())
127127
verflag.AddFlags(namedFlagSets.FlagSet("global"))
128128
globalflag.AddGlobalFlags(namedFlagSets.FlagSet("global"), cmd.Name())
129-
// hoist this flag from the global flagset to preserve the commandline until
130-
// the gce cloudprovider is removed.
131-
globalflag.Register(namedFlagSets.FlagSet("generic"), "cloud-provider-gce-lb-src-cidrs")
132-
namedFlagSets.FlagSet("generic").MarkDeprecated("cloud-provider-gce-lb-src-cidrs", "This flag will be removed once the GCE Cloud Provider is removed from kube-controller-manager")
129+
registerLegacyGlobalFlags(namedFlagSets)
133130
for _, f := range namedFlagSets.FlagSets {
134131
fs.AddFlagSet(f)
135132
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// +build providerless
2+
3+
/*
4+
Copyright 2019 The Kubernetes Authors.
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
*/
18+
19+
package app
20+
21+
import (
22+
cliflag "k8s.io/component-base/cli/flag"
23+
)
24+
25+
func registerLegacyGlobalFlags(namedFlagSets cliflag.NamedFlagSets) {
26+
// no-op when legacy cloud providers are not compiled
27+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// +build !providerless
2+
3+
/*
4+
Copyright 2019 The Kubernetes Authors.
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
*/
18+
19+
package app
20+
21+
import (
22+
cliflag "k8s.io/component-base/cli/flag"
23+
"k8s.io/component-base/cli/globalflag"
24+
)
25+
26+
func registerLegacyGlobalFlags(namedFlagSets cliflag.NamedFlagSets) {
27+
// hoist this flag from the global flagset to preserve the commandline until
28+
// the gce cloudprovider is removed.
29+
globalflag.Register(namedFlagSets.FlagSet("generic"), "cloud-provider-gce-lb-src-cidrs")
30+
namedFlagSets.FlagSet("generic").MarkDeprecated("cloud-provider-gce-lb-src-cidrs", "This flag will be removed once the GCE Cloud Provider is removed from kube-controller-manager")
31+
}

cmd/kube-controller-manager/app/plugins.go

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,10 @@ import (
3131
_ "k8s.io/kubernetes/pkg/cloudprovider/providers"
3232
// Volume plugins
3333
"k8s.io/kubernetes/pkg/volume"
34-
"k8s.io/kubernetes/pkg/volume/awsebs"
35-
"k8s.io/kubernetes/pkg/volume/azure_dd"
36-
"k8s.io/kubernetes/pkg/volume/azure_file"
37-
"k8s.io/kubernetes/pkg/volume/cinder"
3834
"k8s.io/kubernetes/pkg/volume/csi"
3935
"k8s.io/kubernetes/pkg/volume/fc"
4036
"k8s.io/kubernetes/pkg/volume/flexvolume"
4137
"k8s.io/kubernetes/pkg/volume/flocker"
42-
"k8s.io/kubernetes/pkg/volume/gcepd"
4338
"k8s.io/kubernetes/pkg/volume/glusterfs"
4439
"k8s.io/kubernetes/pkg/volume/hostpath"
4540
"k8s.io/kubernetes/pkg/volume/iscsi"
@@ -51,7 +46,6 @@ import (
5146
"k8s.io/kubernetes/pkg/volume/scaleio"
5247
"k8s.io/kubernetes/pkg/volume/storageos"
5348
volumeutil "k8s.io/kubernetes/pkg/volume/util"
54-
"k8s.io/kubernetes/pkg/volume/vsphere_volume"
5549

5650
utilfeature "k8s.io/apiserver/pkg/util/feature"
5751
persistentvolumeconfig "k8s.io/kubernetes/pkg/controller/volume/persistentvolume/config"
@@ -66,12 +60,8 @@ import (
6660
func ProbeAttachableVolumePlugins() []volume.VolumePlugin {
6761
allPlugins := []volume.VolumePlugin{}
6862

69-
allPlugins = append(allPlugins, awsebs.ProbeVolumePlugins()...)
70-
allPlugins = append(allPlugins, gcepd.ProbeVolumePlugins()...)
71-
allPlugins = append(allPlugins, cinder.ProbeVolumePlugins()...)
63+
allPlugins = appendAttachableLegacyProviderVolumes(allPlugins)
7264
allPlugins = append(allPlugins, portworx.ProbeVolumePlugins()...)
73-
allPlugins = append(allPlugins, vsphere_volume.ProbeVolumePlugins()...)
74-
allPlugins = append(allPlugins, azure_dd.ProbeVolumePlugins()...)
7565
allPlugins = append(allPlugins, scaleio.ProbeVolumePlugins()...)
7666
allPlugins = append(allPlugins, storageos.ProbeVolumePlugins()...)
7767
allPlugins = append(allPlugins, fc.ProbeVolumePlugins()...)
@@ -92,15 +82,10 @@ func GetDynamicPluginProber(config persistentvolumeconfig.VolumeConfiguration) v
9282
func ProbeExpandableVolumePlugins(config persistentvolumeconfig.VolumeConfiguration) []volume.VolumePlugin {
9383
allPlugins := []volume.VolumePlugin{}
9484

95-
allPlugins = append(allPlugins, awsebs.ProbeVolumePlugins()...)
96-
allPlugins = append(allPlugins, gcepd.ProbeVolumePlugins()...)
97-
allPlugins = append(allPlugins, cinder.ProbeVolumePlugins()...)
85+
allPlugins = appendExpandableLegacyProviderVolumes(allPlugins)
9886
allPlugins = append(allPlugins, portworx.ProbeVolumePlugins()...)
99-
allPlugins = append(allPlugins, vsphere_volume.ProbeVolumePlugins()...)
10087
allPlugins = append(allPlugins, glusterfs.ProbeVolumePlugins()...)
10188
allPlugins = append(allPlugins, rbd.ProbeVolumePlugins()...)
102-
allPlugins = append(allPlugins, azure_dd.ProbeVolumePlugins()...)
103-
allPlugins = append(allPlugins, azure_file.ProbeVolumePlugins()...)
10489
allPlugins = append(allPlugins, scaleio.ProbeVolumePlugins()...)
10590
allPlugins = append(allPlugins, storageos.ProbeVolumePlugins()...)
10691
allPlugins = append(allPlugins, fc.ProbeVolumePlugins()...)
@@ -146,20 +131,14 @@ func ProbeControllerVolumePlugins(cloud cloudprovider.Interface, config persiste
146131
// add rbd provisioner
147132
allPlugins = append(allPlugins, rbd.ProbeVolumePlugins()...)
148133
allPlugins = append(allPlugins, quobyte.ProbeVolumePlugins()...)
149-
allPlugins = append(allPlugins, azure_file.ProbeVolumePlugins()...)
134+
allPlugins = appendLegacyProviderVolumes(allPlugins)
150135

151136
allPlugins = append(allPlugins, flocker.ProbeVolumePlugins()...)
152137
allPlugins = append(allPlugins, portworx.ProbeVolumePlugins()...)
153138
allPlugins = append(allPlugins, scaleio.ProbeVolumePlugins()...)
154139
allPlugins = append(allPlugins, local.ProbeVolumePlugins()...)
155140
allPlugins = append(allPlugins, storageos.ProbeVolumePlugins()...)
156141

157-
allPlugins = append(allPlugins, awsebs.ProbeVolumePlugins()...)
158-
allPlugins = append(allPlugins, gcepd.ProbeVolumePlugins()...)
159-
allPlugins = append(allPlugins, cinder.ProbeVolumePlugins()...)
160-
allPlugins = append(allPlugins, vsphere_volume.ProbeVolumePlugins()...)
161-
allPlugins = append(allPlugins, azure_dd.ProbeVolumePlugins()...)
162-
163142
if utilfeature.DefaultFeatureGate.Enabled(features.CSIInlineVolume) {
164143
allPlugins = append(allPlugins, csi.ProbeVolumePlugins()...)
165144
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// +build providerless
2+
3+
/*
4+
Copyright 2019 The Kubernetes Authors.
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
*/
18+
19+
package app
20+
21+
import (
22+
"k8s.io/kubernetes/pkg/volume"
23+
)
24+
25+
func appendAttachableLegacyProviderVolumes(allPlugins []volume.VolumePlugin) []volume.VolumePlugin {
26+
// no-op when compiled without legacy cloud providers
27+
return allPlugins
28+
}
29+
30+
func appendExpandableLegacyProviderVolumes(allPlugins []volume.VolumePlugin) []volume.VolumePlugin {
31+
// no-op when compiled without legacy cloud providers
32+
return allPlugins
33+
}
34+
35+
func appendLegacyProviderVolumes(allPlugins []volume.VolumePlugin) []volume.VolumePlugin {
36+
// no-op when compiled without legacy cloud providers
37+
return allPlugins
38+
}

0 commit comments

Comments
 (0)