Skip to content

Commit 9a2a278

Browse files
authored
Merge pull request kubernetes#130162 from carlory/remove-cloud-provider-and-cloud-config-in-apiserver-CLI
kube-apiserver: removed the deprecated the `--cloud-provider` and `--cloud-config` CLI parameters.
2 parents fc87678 + c48499d commit 9a2a278

File tree

16 files changed

+10
-237
lines changed

16 files changed

+10
-237
lines changed

cluster/gce/gci/configure-kubeapiserver.sh

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ function configure-etcd-params {
5555
# in the manifest file, and then copies the manifest file to /etc/kubernetes/manifests.
5656
#
5757
# Assumed vars (which are calculated in function compute-master-manifest-variables)
58-
# CLOUD_CONFIG_OPT
59-
# CLOUD_CONFIG_VOLUME
60-
# CLOUD_CONFIG_MOUNT
6158
# DOCKER_REGISTRY
6259
# INSECURE_PORT_MAPPING
6360
function start-kube-apiserver {
@@ -66,9 +63,8 @@ function start-kube-apiserver {
6663
prepare-log-file "${KUBE_API_SERVER_AUDIT_LOG_PATH:-/var/log/kube-apiserver-audit.log}" "${KUBE_API_SERVER_RUNASUSER:-0}"
6764

6865
# Calculate variables and assemble the command line.
69-
local params="${API_SERVER_TEST_LOG_LEVEL:-"--v=2"} ${APISERVER_TEST_ARGS:-} ${CLOUD_CONFIG_OPT}"
66+
local params="${API_SERVER_TEST_LOG_LEVEL:-"--v=2"} ${APISERVER_TEST_ARGS:-}"
7067
params+=" --allow-privileged=true"
71-
params+=" --cloud-provider=${CLOUD_PROVIDER_FLAG:-external}"
7268
params+=" --client-ca-file=${CA_CERT_BUNDLE_PATH}"
7369

7470
# params is passed by reference, so no "$"
@@ -384,16 +380,12 @@ function start-kube-apiserver {
384380
sed -i -e "s@{{params}}@${params}@g" "${src_file}"
385381
sed -i -e "s@{{container_env}}@${container_env}@g" "${src_file}"
386382
sed -i -e "s@{{srv_sshproxy_path}}@/etc/srv/sshproxy@g" "${src_file}"
387-
sed -i -e "s@{{cloud_config_mount}}@${CLOUD_CONFIG_MOUNT}@g" "${src_file}"
388-
sed -i -e "s@{{cloud_config_volume}}@${CLOUD_CONFIG_VOLUME}@g" "${src_file}"
389383
sed -i -e "s@{{pillar\['kube_docker_registry'\]}}@${DOCKER_REGISTRY}@g" "${src_file}"
390384
sed -i -e "s@{{pillar\['kube-apiserver_docker_tag'\]}}@${kube_apiserver_docker_tag}@g" "${src_file}"
391385
sed -i -e "s@{{pillar\['allow_privileged'\]}}@true@g" "${src_file}"
392386
sed -i -e "s@{{liveness_probe_initial_delay}}@${KUBE_APISERVER_LIVENESS_PROBE_INITIAL_DELAY_SEC:-15}@g" "${src_file}"
393387
sed -i -e "s@{{secure_port}}@443@g" "${src_file}"
394388
sed -i -e "s@{{insecure_port_mapping}}@${INSECURE_PORT_MAPPING}@g" "${src_file}"
395-
sed -i -e "s@{{additional_cloud_config_mount}}@@g" "${src_file}"
396-
sed -i -e "s@{{additional_cloud_config_volume}}@@g" "${src_file}"
397389
sed -i -e "s@{{webhook_authn_config_mount}}@${webhook_authn_config_mount}@g" "${src_file}"
398390
sed -i -e "s@{{webhook_authn_config_volume}}@${webhook_authn_config_volume}@g" "${src_file}"
399391
sed -i -e "s@{{webhook_config_mount}}@${webhook_config_mount}@g" "${src_file}"

cluster/gce/manifests/kube-apiserver.manifest

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@
6767
"volumeMounts": [
6868
{{kms_socket_mount}}
6969
{{encryption_provider_mount}}
70-
{{cloud_config_mount}}
71-
{{additional_cloud_config_mount}}
7270
{{webhook_config_mount}}
7371
{{webhook_authn_config_mount}}
7472
{{csc_config_mount}}
@@ -108,8 +106,6 @@
108106
"volumes":[
109107
{{kms_socket_volume}}
110108
{{encryption_provider_volume}}
111-
{{cloud_config_volume}}
112-
{{additional_cloud_config_volume}}
113109
{{webhook_config_volume}}
114110
{{webhook_authn_config_volume}}
115111
{{csc_config_volume}}

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,11 @@ import (
2828

2929
cp "k8s.io/kubernetes/pkg/controlplane/apiserver/options"
3030
"k8s.io/kubernetes/pkg/kubeapiserver"
31-
kubeoptions "k8s.io/kubernetes/pkg/kubeapiserver/options"
3231
)
3332

3433
// completedOptions is a private wrapper that enforces a call of Complete() before Run can be invoked.
3534
type completedOptions struct {
3635
cp.CompletedOptions
37-
CloudProvider *kubeoptions.CloudProviderOptions
3836

3937
Extra
4038
}
@@ -64,7 +62,6 @@ func (s *ServerRunOptions) Complete(ctx context.Context) (CompletedOptions, erro
6462

6563
completed := completedOptions{
6664
CompletedOptions: controlplane,
67-
CloudProvider: s.CloudProvider,
6865

6966
Extra: s.Extra,
7067
}

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import (
3838
// ServerRunOptions runs a kubernetes api server.
3939
type ServerRunOptions struct {
4040
*controlplaneapiserver.Options // embedded to avoid noise in existing consumers
41-
CloudProvider *kubeoptions.CloudProviderOptions
4241

4342
Extra
4443
}
@@ -66,8 +65,7 @@ type Extra struct {
6665
// NewServerRunOptions creates and returns ServerRunOptions according to the given featureGate and effectiveVersion of the server binary to run.
6766
func NewServerRunOptions() *ServerRunOptions {
6867
s := ServerRunOptions{
69-
Options: controlplaneapiserver.NewOptions(),
70-
CloudProvider: kubeoptions.NewCloudProviderOptions(),
68+
Options: controlplaneapiserver.NewOptions(),
7169

7270
Extra: Extra{
7371
EndpointReconcilerType: string(reconcilers.LeaseEndpointReconcilerType),
@@ -101,7 +99,6 @@ func NewServerRunOptions() *ServerRunOptions {
10199
// Flags returns flags for a specific APIServer by section name
102100
func (s *ServerRunOptions) Flags() (fss cliflag.NamedFlagSets) {
103101
s.Options.AddFlags(&fss)
104-
s.CloudProvider.AddFlags(fss.FlagSet("cloud provider"))
105102

106103
// Note: the weird ""+ in below lines seems to be the only way to get gofmt to
107104
// arrange these text blocks sensibly. Grrr.

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ func TestAddFlags(t *testing.T) {
104104
"--authorization-webhook-config-file=/webhook-config",
105105
"--bind-address=192.168.10.20",
106106
"--client-ca-file=/client-ca",
107-
"--cloud-config=/cloud-config",
108-
"--cloud-provider=azure",
109107
"--cors-allowed-origins=10.10.10.100,10.10.10.200",
110108
"--contention-profiling=true",
111109
"--egress-selector-config-file=/var/run/kubernetes/egress-selector/connectivity.yaml",
@@ -331,10 +329,6 @@ func TestAddFlags(t *testing.T) {
331329
},
332330
MasterCount: 5,
333331
},
334-
CloudProvider: &kubeoptions.CloudProviderOptions{
335-
CloudConfigFile: "/cloud-config",
336-
CloudProvider: "azure",
337-
},
338332
}
339333

340334
expected.Authentication.OIDC.UsernameClaim = "sub"

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ func (s CompletedOptions) Validate() []error {
132132
var errs []error
133133

134134
errs = append(errs, s.CompletedOptions.Validate()...)
135-
errs = append(errs, s.CloudProvider.Validate()...)
136135
errs = append(errs, validateClusterIPFlags(s.Extra)...)
137136
errs = append(errs, validateServiceNodePort(s.Extra)...)
138137
errs = append(errs, validatePublicIPServiceClusterIPRangeIPFamilies(s.Extra, *s.GenericServerRunOptions)...)

cmd/kube-apiserver/app/server.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,7 @@ func CreateKubeAPIServerConfig(
212212
capabilities.Setup(opts.AllowPrivileged, opts.MaxConnectionBytesPerSec)
213213

214214
// additional admission initializers
215-
kubeAdmissionConfig := &kubeapiserveradmission.Config{
216-
CloudConfigFile: opts.CloudProvider.CloudConfigFile,
217-
}
215+
kubeAdmissionConfig := &kubeapiserveradmission.Config{}
218216
kubeInitializers, err := kubeAdmissionConfig.New()
219217
if err != nil {
220218
return nil, nil, nil, fmt.Errorf("failed to create admission plugin initializer: %w", err)

pkg/features/kube_features.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -175,16 +175,6 @@ const (
175175
// both allocators. This feature gate disables the dual write on the new Cluster IP allocators.
176176
DisableAllocatorDualWrite featuregate.Feature = "DisableAllocatorDualWrite"
177177

178-
// owner: @andrewsykim
179-
//
180-
// Disable any functionality in kube-apiserver, kube-controller-manager and kubelet related to the `--cloud-provider` component flag.
181-
DisableCloudProviders featuregate.Feature = "DisableCloudProviders"
182-
183-
// owner: @andrewsykim
184-
//
185-
// Disable in-tree functionality in kubelet to authenticate to cloud provider container registries for image pull credentials.
186-
DisableKubeletCloudCredentialProviders featuregate.Feature = "DisableKubeletCloudCredentialProviders"
187-
188178
// owner: @micahhausler
189179
//
190180
// Setting AllowInsecureKubeletCertificateSigningRequests to true disables node admission validation of CSRs

pkg/features/versioned_kube_features.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -167,18 +167,6 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate
167167
{Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Beta}, // remove after MultiCIDRServiceAllocator is GA
168168
},
169169

170-
DisableCloudProviders: {
171-
{Version: version.MustParse("1.22"), Default: false, PreRelease: featuregate.Alpha},
172-
{Version: version.MustParse("1.29"), Default: true, PreRelease: featuregate.Beta},
173-
{Version: version.MustParse("1.31"), Default: true, PreRelease: featuregate.GA, LockToDefault: true},
174-
},
175-
176-
DisableKubeletCloudCredentialProviders: {
177-
{Version: version.MustParse("1.23"), Default: false, PreRelease: featuregate.Alpha},
178-
{Version: version.MustParse("1.29"), Default: true, PreRelease: featuregate.Beta},
179-
{Version: version.MustParse("1.31"), Default: true, PreRelease: featuregate.GA, LockToDefault: true},
180-
},
181-
182170
DisableNodeKubeProxyVersion: {
183171
{Version: version.MustParse("1.29"), Default: false, PreRelease: featuregate.Alpha},
184172
{Version: version.MustParse("1.31"), Default: false, PreRelease: featuregate.Deprecated},

pkg/kubeapiserver/admission/config.go

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,13 @@ limitations under the License.
1717
package admission
1818

1919
import (
20-
"os"
21-
22-
"k8s.io/klog/v2"
23-
2420
"k8s.io/apiserver/pkg/admission"
2521
)
2622

2723
// Config holds the configuration needed to for initialize the admission plugins
28-
type Config struct {
29-
CloudConfigFile string
30-
}
24+
type Config struct{}
3125

3226
// New sets up the plugins and admission start hooks needed for admission
3327
func (c *Config) New() ([]admission.PluginInitializer, error) {
34-
var cloudConfig []byte
35-
if c.CloudConfigFile != "" {
36-
var err error
37-
cloudConfig, err = os.ReadFile(c.CloudConfigFile)
38-
if err != nil {
39-
klog.Fatalf("Error reading from cloud configuration file %s: %#v", c.CloudConfigFile, err)
40-
}
41-
}
42-
43-
return []admission.PluginInitializer{NewPluginInitializer(cloudConfig)}, nil
28+
return []admission.PluginInitializer{NewPluginInitializer()}, nil
4429
}

0 commit comments

Comments
 (0)