-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix (kubernetes-client-api) :
Config
's autoConfigure
should disab…
…le auto configuration `Config`'s autoConfigure field should behave as per expectations. We need to make changes to ConfigBuilder and ConfigFluent in order to achieve this. - Move generated classes `ConfigBuilder` and `ConfigFluent` to `src/main/java` - `ConfigBuilder` would invoke `Config.empty()` in it's constructor instead of `new Config()` (this was enabling auto configuration) - add a boolean field to `ConfigFluent` in order to keep track of whether user has overridden auto configuration via builder or not. - Make all fields in Config class use boxed types instead of primitive types so that we can distinguish whether they have been configured by user. Signed-off-by: Rohan Kumar <[email protected]>
- Loading branch information
1 parent
8d78ecf
commit d9d9c72
Showing
9 changed files
with
1,961 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
338 changes: 249 additions & 89 deletions
338
kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/Config.java
Large diffs are not rendered by default.
Oops, something went wrong.
53 changes: 53 additions & 0 deletions
53
kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/ConfigBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package io.fabric8.kubernetes.client; | ||
|
||
import io.fabric8.kubernetes.api.builder.VisitableBuilder; | ||
|
||
import static io.fabric8.kubernetes.client.Config.disableAutoConfig; | ||
|
||
public class ConfigBuilder extends ConfigFluent<ConfigBuilder> implements VisitableBuilder<Config, ConfigBuilder> { | ||
public ConfigBuilder() { | ||
this(emptyConfigWithAutoConfigure()); | ||
} | ||
|
||
public ConfigBuilder(ConfigFluent<?> fluent) { | ||
this(fluent, emptyConfigWithAutoConfigure()); | ||
} | ||
|
||
public ConfigBuilder(ConfigFluent<?> fluent, Config instance) { | ||
this.fluent = fluent; | ||
fluent.copyInstance(instance); | ||
} | ||
|
||
public ConfigBuilder(Config instance) { | ||
this.fluent = this; | ||
this.copyInstance(instance); | ||
} | ||
|
||
ConfigFluent<?> fluent; | ||
|
||
private static Config emptyConfigWithAutoConfigure() { | ||
Config config = Config.empty(); | ||
config.setAutoConfigure(!disableAutoConfig()); | ||
return config; | ||
} | ||
|
||
public Config build() { | ||
Config buildable = new Config(fluent.getMasterUrl(), fluent.getApiVersion(), fluent.getNamespace(), fluent.getTrustCerts(), | ||
fluent.getDisableHostnameVerification(), fluent.getCaCertFile(), fluent.getCaCertData(), fluent.getClientCertFile(), | ||
fluent.getClientCertData(), fluent.getClientKeyFile(), fluent.getClientKeyData(), fluent.getClientKeyAlgo(), | ||
fluent.getClientKeyPassphrase(), fluent.getUsername(), fluent.getPassword(), fluent.getOauthToken(), | ||
fluent.getAutoOAuthToken(), fluent.getWatchReconnectInterval(), fluent.getWatchReconnectLimit(), | ||
fluent.getConnectionTimeout(), fluent.getRequestTimeout(), fluent.getScaleTimeout(), fluent.getLoggingInterval(), | ||
fluent.getMaxConcurrentRequests(), fluent.getMaxConcurrentRequestsPerHost(), fluent.getHttp2Disable(), | ||
fluent.getHttpProxy(), fluent.getHttpsProxy(), fluent.getNoProxy(), fluent.getUserAgent(), fluent.getTlsVersions(), | ||
fluent.getWebsocketPingInterval(), fluent.getProxyUsername(), fluent.getProxyPassword(), fluent.getTrustStoreFile(), | ||
fluent.getTrustStorePassphrase(), fluent.getKeyStoreFile(), fluent.getKeyStorePassphrase(), | ||
fluent.getImpersonateUsername(), fluent.getImpersonateGroups(), fluent.getImpersonateExtras(), | ||
fluent.getOauthTokenProvider(), fluent.getCustomHeaders(), fluent.getRequestRetryBackoffLimit(), | ||
fluent.getRequestRetryBackoffInterval(), fluent.getUploadRequestTimeout(), fluent.getOnlyHttpWatches(), | ||
fluent.getCurrentContext(), fluent.getContexts(), !fluent.hasAutoConfigureDisabledByUser()); | ||
buildable.setAuthProvider(fluent.getAuthProvider()); | ||
buildable.setFile(fluent.getFile()); | ||
return buildable; | ||
} | ||
} |
Oops, something went wrong.