Skip to content

Commit

Permalink
fix: Removed @deprecated fields from RunImageConfiguration
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Nuri <[email protected]>
  • Loading branch information
manusa committed Jun 5, 2020
1 parent e268401 commit 578aca8
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 63 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Usage:
* Fix #221: Role Resources Not Supported by Kubernetes Cluster Configurations
* Fix #226: Refactored FileUtil#getRelativeFilePath to use native Java File capabilities
* Fix #224: RoleBinding Resources Not Supported by Kubernetes Cluster Configurations
* Fix #191: Removed `@Deprecated` fields from RunImageConfiguration

### 1.0.0-alpha-3 (2020-05-06)
* Fix #167: Add CMD for wildfly based applications
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
/**
* @author roland
*/
@SuppressWarnings("JavaDoc")
@Builder(toBuilder = true)
@AllArgsConstructor
@NoArgsConstructor
Expand Down Expand Up @@ -118,12 +117,6 @@ public boolean isDefault() {
*
*/
private List<String> ports;
/**
* @deprecated use {@link #getContainerNamePattern} instead
* @return NamingStrategy naming strategy
*/
@Deprecated
private NamingStrategy namingStrategy;
/**
* A pattern to define the naming of the container where:
*
Expand Down Expand Up @@ -202,11 +195,6 @@ public List<String> getPorts() {
return EnvUtil.removeEmptyEntries(ports);
}

@Deprecated
public String getNetRaw() {
return net;
}

public NetworkConfig getNetworkingConfig() {
if (network != null) {
return network;
Expand All @@ -226,51 +214,12 @@ public List<String> getLinks() {
return EnvUtil.splitAtCommasAndTrim(links);
}

/**
* Naming scheme for how to name container.
*
* @deprecated for backward compatibility, use containerNamePattern instead
*/
@Deprecated
public enum NamingStrategy {
/**
* No extra naming
*/
none,
/**
* Use the alias as defined in the configuration
*/
alias
}

public RestartPolicy getRestartPolicy() {
return Optional.ofNullable(restartPolicy).orElse(RestartPolicy.DEFAULT);
}

public boolean skip() {
return Optional.ofNullable(skip).orElse(false);
}

public static class RunImageConfigurationBuilder {
public RunImageConfigurationBuilder cmdString(String cmdString) {
if (cmdString != null) {
cmd = Arguments.builder().shell(cmdString).build();
}
return this;
}

/**
* @deprecated use {@link #containerNamePattern} instead
* @return RunImageConfigurationBuilder object
*/
@Deprecated
public RunImageConfigurationBuilder namingStrategyString(String namingStrategyString) {
namingStrategy = Optional.ofNullable(namingStrategyString)
.map(String::toLowerCase)
.map(NamingStrategy::valueOf)
.orElse(NamingStrategy.none);
return this;
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public enum ConfigKey {
CAP_ADD,
CAP_DROP,
CLEANUP,
CONTAINER_NAME_PATTERN,
CPUSHARES,
CPUS,
CPUSET,
Expand Down Expand Up @@ -87,7 +88,6 @@ public enum ConfigKey {
MEMORY,
MEMORY_SWAP,
NAME,
NAMING_STRATEGY,
NET,
NETWORK_MODE("network.mode"),
NETWORK_NAME("network.name"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import static org.eclipse.jkube.kit.build.service.docker.config.handler.property.ConfigKey.CAP_DROP;
import static org.eclipse.jkube.kit.build.service.docker.config.handler.property.ConfigKey.CLEANUP;
import static org.eclipse.jkube.kit.build.service.docker.config.handler.property.ConfigKey.CMD;
import static org.eclipse.jkube.kit.build.service.docker.config.handler.property.ConfigKey.CONTAINER_NAME_PATTERN;
import static org.eclipse.jkube.kit.build.service.docker.config.handler.property.ConfigKey.CONTEXT_DIR;
import static org.eclipse.jkube.kit.build.service.docker.config.handler.property.ConfigKey.CPUS;
import static org.eclipse.jkube.kit.build.service.docker.config.handler.property.ConfigKey.CPUSET;
Expand Down Expand Up @@ -105,7 +106,6 @@
import static org.eclipse.jkube.kit.build.service.docker.config.handler.property.ConfigKey.MEMORY;
import static org.eclipse.jkube.kit.build.service.docker.config.handler.property.ConfigKey.MEMORY_SWAP;
import static org.eclipse.jkube.kit.build.service.docker.config.handler.property.ConfigKey.NAME;
import static org.eclipse.jkube.kit.build.service.docker.config.handler.property.ConfigKey.NAMING_STRATEGY;
import static org.eclipse.jkube.kit.build.service.docker.config.handler.property.ConfigKey.NET;
import static org.eclipse.jkube.kit.build.service.docker.config.handler.property.ConfigKey.NETWORK_ALIAS;
import static org.eclipse.jkube.kit.build.service.docker.config.handler.property.ConfigKey.NETWORK_MODE;
Expand Down Expand Up @@ -285,7 +285,7 @@ private RunImageConfiguration extractRunConfiguration(ImageConfiguration fromCon
.cmd(extractArguments(valueProvider, CMD, config == null ? null : config.getCmd()))
.dns(valueProvider.getList(DNS, config == null ? null : config.getDns()))
.dependsOn(valueProvider.getList(DEPENDS_ON, config == null ? null : config.getDependsOn()))
.net(valueProvider.getString(NET, config == null ? null : config.getNetRaw()))
.net(valueProvider.getString(NET, config == null ? null : config.getNet()))
.network(extractNetworkConfig(config == null ? null : config.getNetworkingConfig(), valueProvider))
.dnsSearch(valueProvider.getList(DNS_SEARCH, config == null ? null : config.getDnsSearch()))
.domainname(valueProvider.getString(DOMAINNAME, config == null ? null : config.getDomainname()))
Expand All @@ -301,7 +301,7 @@ private RunImageConfiguration extractRunConfiguration(ImageConfiguration fromCon
.links(valueProvider.getList(LINKS, config == null ? null : config.getLinks()))
.memory(valueProvider.getLong(MEMORY, config == null ? null : config.getMemory()))
.memorySwap(valueProvider.getLong(MEMORY_SWAP, config == null ? null : config.getMemorySwap()))
.namingStrategyString(valueProvider.getString(NAMING_STRATEGY, config == null || config.getNamingStrategy() == null ? null : config.getNamingStrategy().name()))
.containerNamePattern(valueProvider.getString(CONTAINER_NAME_PATTERN, config == null ? null :config.getContainerNamePattern()))
.exposedPropertyKey(valueProvider.getString(EXPOSED_PROPERTY_KEY, config == null ? null : config.getExposedPropertyKey()))
.portPropertyFile(valueProvider.getString(PORT_PROPERTY_FILE, config == null ? null : config.getPortPropertyFile()))
.ports(valueProvider.getList(PORTS, config == null ? null : config.getPorts()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,8 @@ private static Set<String> extractContainerNames(final Collection<Container> exi

private static String extractContainerNamePattern(ImageConfiguration image, String defaultContainerNamePattern) {
RunImageConfiguration runConfig = image.getRunConfiguration();
if (runConfig != null) {
if (runConfig.getContainerNamePattern() != null) {
return runConfig.getContainerNamePattern();
}
if (runConfig.getNamingStrategy() == RunImageConfiguration.NamingStrategy.alias) {
return "%a";
}
if (runConfig != null && runConfig.getContainerNamePattern() != null) {
return runConfig.getContainerNamePattern();
}
return defaultContainerNamePattern != null ? defaultContainerNamePattern : DEFAULT_CONTAINER_NAME_PATTERN;
}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
Expand Down

0 comments on commit 578aca8

Please sign in to comment.