-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10434 from iocanel/issue-9663-openshift-deployments
Allow openshift to work with docker and jib container images
- Loading branch information
Showing
20 changed files
with
374 additions
and
24 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
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
20 changes: 20 additions & 0 deletions
20
...er/deployment/src/main/java/io/quarkus/container/image/docker/deployment/DockerBuild.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,20 @@ | ||
|
||
package io.quarkus.container.image.docker.deployment; | ||
|
||
import java.util.function.BooleanSupplier; | ||
|
||
import io.quarkus.container.image.deployment.ContainerImageConfig; | ||
|
||
public class DockerBuild implements BooleanSupplier { | ||
|
||
private final ContainerImageConfig containerImageConfig; | ||
|
||
DockerBuild(ContainerImageConfig containerImageConfig) { | ||
this.containerImageConfig = containerImageConfig; | ||
} | ||
|
||
@Override | ||
public boolean getAsBoolean() { | ||
return containerImageConfig.builder.map(b -> b.equals(DockerProcessor.DOCKER)).orElse(true); | ||
} | ||
} |
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
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
20 changes: 20 additions & 0 deletions
20
...b/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibBuildEnabled.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,20 @@ | ||
|
||
package io.quarkus.container.image.jib.deployment; | ||
|
||
import java.util.function.BooleanSupplier; | ||
|
||
import io.quarkus.container.image.deployment.ContainerImageConfig; | ||
|
||
public class JibBuildEnabled implements BooleanSupplier { | ||
|
||
private final ContainerImageConfig containerImageConfig; | ||
|
||
JibBuildEnabled(ContainerImageConfig containerImageConfig) { | ||
this.containerImageConfig = containerImageConfig; | ||
} | ||
|
||
@Override | ||
public boolean getAsBoolean() { | ||
return containerImageConfig.builder.map(b -> b.equals(JibProcessor.JIB)).orElse(true); | ||
} | ||
} |
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
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
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
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
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
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
58 changes: 58 additions & 0 deletions
58
...illa/deployment/src/main/java/io/quarkus/kubernetes/deployment/RemoveEnvVarDecorator.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,58 @@ | ||
package io.quarkus.kubernetes.deployment; | ||
|
||
import io.dekorate.deps.kubernetes.api.model.ContainerFluent; | ||
import io.dekorate.kubernetes.decorator.AddEnvVarDecorator; | ||
import io.dekorate.kubernetes.decorator.ApplicationContainerDecorator; | ||
import io.dekorate.kubernetes.decorator.Decorator; | ||
import io.dekorate.kubernetes.decorator.ResourceProvidingDecorator; | ||
|
||
public class RemoveEnvVarDecorator extends ApplicationContainerDecorator<ContainerFluent<?>> { | ||
|
||
private final String envVarName; | ||
|
||
public RemoveEnvVarDecorator(String envVarName) { | ||
this(ANY, envVarName); | ||
} | ||
|
||
public RemoveEnvVarDecorator(String name, String envVarName) { | ||
super(name); | ||
this.envVarName = envVarName; | ||
} | ||
|
||
public void andThenVisit(ContainerFluent<?> container) { | ||
container.removeMatchingFromEnv(e -> e.getName().equals(envVarName)); | ||
} | ||
|
||
public String getEnvVarKey() { | ||
return this.envVarName; | ||
} | ||
|
||
public Class<? extends Decorator>[] after() { | ||
return new Class[] { ResourceProvidingDecorator.class, AddEnvVarDecorator.class }; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
final int prime = 31; | ||
int result = 1; | ||
result = prime * result + ((envVarName == null) ? 0 : envVarName.hashCode()); | ||
return result; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (this == obj) | ||
return true; | ||
if (obj == null) | ||
return false; | ||
if (getClass() != obj.getClass()) | ||
return false; | ||
RemoveEnvVarDecorator other = (RemoveEnvVarDecorator) obj; | ||
if (envVarName == null) { | ||
if (other.envVarName != null) | ||
return false; | ||
} else if (!envVarName.equals(other.envVarName)) | ||
return false; | ||
return true; | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
.../kubernetes/maven-invoker-way/src/it/openshift-docker-build-and-deploy/invoker.properties
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,4 @@ | ||
# invoker.goals=clean package -Dquarkus.container.build=true -Dquarkus.package.type=native | ||
invoker.goals=clean package -Dquarkus.kubernetes.deploy=true | ||
# expect a failure since there is no Kubernetes cluster to deploy to | ||
invoker.buildResult = failure |
Oops, something went wrong.