Skip to content

Commit

Permalink
Merge pull request #32166 from iocanel/fix-probe-scheme-32135
Browse files Browse the repository at this point in the history
ApplyHttpGetActionPortDecorator now also sets scheme
  • Loading branch information
gsmet authored Mar 28, 2023
2 parents cd66e78 + da7857b commit 6b6f562
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class ApplyHttpGetActionPortDecorator extends Decorator<HTTPGetActionFlue
private final String deployment;
private final String container;
private final Integer port;
private final String scheme;
private final String probeKind;

public ApplyHttpGetActionPortDecorator(Integer port) {
Expand All @@ -43,10 +44,15 @@ public ApplyHttpGetActionPortDecorator(String deployment, String container, Inte
}

public ApplyHttpGetActionPortDecorator(String deployment, String container, Integer port, String probeKind) {
this(deployment, container, port, probeKind, port != null && (port == 443 || port == 8443) ? "HTTPS" : "HTTP"); // this is the original convention coming from dekorate
}

public ApplyHttpGetActionPortDecorator(String deployment, String container, Integer port, String probeKind, String scheme) {
this.deployment = deployment;
this.container = container;
this.port = port;
this.probeKind = probeKind;
this.scheme = scheme;
}

@Override
Expand Down Expand Up @@ -90,6 +96,12 @@ public void visit(HTTPGetActionFluent<?> action) {
} else {
action.withNewPort(port);
}

if (scheme == null) {
action.withScheme((String) null);
} else {
action.withScheme(scheme);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public void assertGeneratedResources() throws IOException {
.satisfies(container -> {
assertThat(container.getReadinessProbe()).isNotNull().satisfies(p -> {
assertEquals(p.getHttpGet().getPort().getIntVal(), 9191);
assertEquals(p.getHttpGet().getScheme(), "HTTP");
});
});
});
Expand Down

0 comments on commit 6b6f562

Please sign in to comment.