Skip to content

ConfigBuilder.withAutoConfigure is not working #6137

@ttbadr

Description

@ttbadr

Describe the bug

I create a kube config in code with ConfigBuilder, and I don't want to load the default kube config file, so I use the withAutoConfig method of the ConfigBuilder to set the autoConfig to false, but it's not working, the default kube config file still loaded.

after inverstigate, I found the default constructor of the ConfigBuilder will create a new Config

  public ConfigBuilder() {
    this(new Config());
  }

below is the default constructor of the Config, It will get the autoConfig value from system properties or env, not from the configBuilder

@Deprecated
  public Config() {
    this(!disableAutoConfig());
  }

  private static boolean disableAutoConfig() {
    return Utils.getSystemPropertyOrEnvVar(KUBERNETES_DISABLE_AUTO_CONFIG_SYSTEM_PROPERTY, false);
  }

Fabric8 Kubernetes Client version

6.12.1

Steps to reproduce

  1. make sure the default kubeConfig file exist and have some cluster configurations
  2. create a config with ConfigBuilder, set the autoConfig to false
  3. check the config object, it have configurations from the default kubeConfig file

Expected behavior

no default kubeConfig file loaded if autoConfig is false

Runtime

Kubernetes (vanilla)

Kubernetes API Server version

1.23

Environment

Windows

Fabric8 Kubernetes Client Logs

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions