-
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. - Add a new Constructor with additional boolean arguments `autoConfigure` and `shouldSetDefaultValues` - Move generated classes `ConfigBuilder` and `ConfigFluent` to `src/main/java` - `ConfigBuilder` would invoke `Config` constructor to create a completely empty Config object instead of `new Config()` (this was enabling auto configuration) - 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 2eaff74
Showing
12 changed files
with
2,701 additions
and
161 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
406 changes: 295 additions & 111 deletions
406
kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/Config.java
Large diffs are not rendered by default.
Oops, something went wrong.
81 changes: 81 additions & 0 deletions
81
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,81 @@ | ||
/* | ||
* Copyright (C) 2015 Red Hat, Inc. | ||
* | ||
* 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 io.fabric8.kubernetes.client; | ||
|
||
import io.fabric8.kubernetes.api.builder.VisitableBuilder; | ||
|
||
import java.util.Optional; | ||
|
||
import static io.fabric8.kubernetes.client.Config.disableAutoConfig; | ||
|
||
public class ConfigBuilder extends ConfigFluent<ConfigBuilder> implements VisitableBuilder<Config, ConfigBuilder> { | ||
public ConfigBuilder() { | ||
this(new Config(null, null, null, null, null, null, null, | ||
null, null, null, null, null, null, null, | ||
null, null, null, null, null, null, null, | ||
null, null, null, null, null, | ||
null, null, null, null, null, null, null, null, | ||
null, null, null, null, null, null, | ||
null, null, null, null, null, | ||
null, null, null, null, null, false)); | ||
} | ||
|
||
public ConfigBuilder(ConfigFluent<?> fluent) { | ||
this(fluent, new Config(null, null, null, null, null, null, null, | ||
null, null, null, null, null, null, null, | ||
null, null, null, null, null, null, null, | ||
null, null, null, null, null, | ||
null, null, null, null, null, null, null, null, | ||
null, null, null, null, null, null, | ||
null, null, null, null, null, | ||
null, null, null, null, null, false)); | ||
} | ||
|
||
public ConfigBuilder(ConfigFluent<?> fluent, Config instance) { | ||
this.fluent = fluent; | ||
fluent.copyInstance(instance); | ||
} | ||
|
||
public ConfigBuilder(Config instance) { | ||
this.fluent = this; | ||
this.copyInstance(instance); | ||
} | ||
|
||
ConfigFluent<?> fluent; | ||
|
||
public Config build() { | ||
Boolean autoConfigure = Optional.ofNullable(fluent.getAutoConfigure()).orElse(!disableAutoConfig()); | ||
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(), autoConfigure, true); | ||
buildable.setDefaultNamespace(fluent.isDefaultNamespace()); | ||
buildable.setAuthProvider(fluent.getAuthProvider()); | ||
buildable.setAuthProvider(fluent.getAuthProvider()); | ||
buildable.setFile(fluent.getFile()); | ||
return buildable; | ||
} | ||
} |
Oops, something went wrong.