Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Commit

Permalink
fixing issue 1632 (#1633)
Browse files Browse the repository at this point in the history
  • Loading branch information
theexplorist authored and rohanKanojia committed May 22, 2019
1 parent 9f75dfb commit 8da1173
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ After this we will switch probably to real [Semantic Versioning 2.0.0](http://se

### 4.1-SNAPSHOT
* Update Docker Maven Plugin to 0.29.0
* Fix 1632: imagePullPolicy configuration fixed as per documentation
* Fix #1591: Add support for custom resources creation via resource fragments

### 4.1.0 (16-02-2019)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,21 @@ protected Boolean getTrimImageInContainerSpecFlag(Boolean defaultValue) {
}
}

/**
* This method overrides the ImagePullPolicy value by the value provided in
* XML config.
*
* @param resourceConfig
* @param defaultValue
* @return
*/
protected String getImagePullPolicy(ResourceConfig resourceConfig, String defaultValue) {
if(resourceConfig != null) {
return resourceConfig.getImagePullPolicy() != null ? resourceConfig.getImagePullPolicy() : defaultValue;
}
return defaultValue;
}

/**
* This method just makes sure that the replica count provided in XML config
* overrides the default option; and resource fragments are always given
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void create(PlatformMode platformMode, KubernetesListBuilder builder) {
ResourceConfig xmlResourceConfig = getConfiguration().getResource().orElse(null);
final ResourceConfig config = new ResourceConfig.Builder()
.controllerName(name)
.imagePullPolicy(getConfig(Config.pullPolicy))
.imagePullPolicy(getImagePullPolicy(xmlResourceConfig, getConfig(Config.pullPolicy)))
.withReplicas(getReplicaCount(builder, xmlResourceConfig, Configs.asInt(getConfig(Config.replicaCount))))
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,21 +182,6 @@ private List<String> getContainersFromPodSpec(PodTemplateSpec spec) {
}


/**
* This method overrides the ImagePullPolicy value by the value provided in
* XML config.
*
* @param resourceConfig
* @param defaultValue
* @return
*/
private String getImagePullPolicy(ResourceConfig resourceConfig, String defaultValue) {
if(resourceConfig != null) {
return resourceConfig.getImagePullPolicy() != null ? resourceConfig.getImagePullPolicy() : defaultValue;
}
return defaultValue;
}

private Long getOpenshiftDeployTimeoutInSeconds(Long defaultValue) {
if (getContext().getProperty("fabric8.openshift.deployTimeoutSeconds") != null) {
return Long.parseLong(getContext().getProperty("fabric8.openshift.deployTimeoutSeconds").toString());
Expand Down
2 changes: 1 addition & 1 deletion samples/spring-boot-with-yaml/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@

<build>
<plugins>

<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>


<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
Expand Down

0 comments on commit 8da1173

Please sign in to comment.