-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
152 additions
and
28 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
70 changes: 63 additions & 7 deletions
70
...yment/src/main/java/io/quarkus/kubernetes/deployment/ApplyHttpGetActionPortDecorator.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
48 changes: 48 additions & 0 deletions
48
...oyment/src/main/java/io/quarkus/kubernetes/deployment/ApplyReadinesHttpPortDecorator.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,48 @@ | ||
package io.quarkus.kubernetes.deployment; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import io.dekorate.kubernetes.config.ContainerFluent; | ||
import io.dekorate.kubernetes.decorator.AddLivenessProbeDecorator; | ||
import io.dekorate.kubernetes.decorator.AddReadinessProbeDecorator; | ||
import io.dekorate.kubernetes.decorator.Decorator; | ||
import io.dekorate.kubernetes.decorator.ResourceProvidingDecorator; | ||
import io.fabric8.kubernetes.api.model.HTTPGetActionFluent; | ||
import io.fabric8.kubernetes.api.model.HasMetadata; | ||
|
||
public class ApplyReadinesHttpPortDecorator extends Decorator<HTTPGetActionFluent<?>> { | ||
|
||
private Integer port; | ||
|
||
public ApplyReadinesHttpPortDecorator(String deploymentName, String containerName, Integer port) { | ||
this.port = port; | ||
addRequirement(HasMetadata.class, h -> deploymentName == null || deploymentName.equals(h.getMetadata().getName())); | ||
addRequirement(ContainerFluent.class, c -> containerName == null || containerName.equals(c.getName())); | ||
} | ||
|
||
@Override | ||
public void visit(List<Map.Entry<String, Object>> path, HTTPGetActionFluent<?> action) { | ||
if (path.stream().map(e -> e.getKey()).anyMatch(i -> i.equals("readinessProbe"))) { | ||
visit(action); | ||
} | ||
} | ||
|
||
@Override | ||
public void visit(HTTPGetActionFluent<?> action) { | ||
if (port == null) { | ||
// workaround to make sure we don't get a NPE | ||
action.withNewPort((String) null); | ||
} else { | ||
action.withNewPort(port); | ||
} | ||
|
||
} | ||
|
||
@Override | ||
public Class<? extends Decorator>[] after() { | ||
return new Class[] { ResourceProvidingDecorator.class, AddSidecarDecorator.class, | ||
AddLivenessProbeDecorator.class, AddReadinessProbeDecorator.class, ApplyHttpGetActionPortDecorator.class }; | ||
} | ||
|
||
} |
6 changes: 0 additions & 6 deletions
6
...ment/src/main/java/io/quarkus/kubernetes/deployment/ChangeDeploymentTriggerDecorator.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 |
---|---|---|
@@ -1,16 +1,10 @@ | ||
package io.quarkus.kubernetes.deployment; | ||
|
||
import io.dekorate.kubernetes.decorator.Decorator; | ||
import io.dekorate.openshift.decorator.ApplyDeploymentTriggerDecorator; | ||
|
||
public class ChangeDeploymentTriggerDecorator extends ApplyDeploymentTriggerDecorator { | ||
|
||
public ChangeDeploymentTriggerDecorator(String containerName, String imageStreamTag) { | ||
super(containerName, imageStreamTag); | ||
} | ||
|
||
@Override | ||
public Class<? extends Decorator>[] after() { | ||
return new Class[] { ApplyDeploymentTriggerDecorator.class, RemoveDeploymentTriggerDecorator.class }; | ||
} | ||
} |
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