New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable single-level DNS domains (*.domain.tld) in SINGLE_PORT mode to simplify HTTPS setup #8983
Changes from 7 commits
9ebce21
b07961a
bebcda9
ca031cf
e38d42a
0bab286
07e8d49
6688eec
f7c1f60
bf4c592
5db0bfd
7ee2e79
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,7 +98,7 @@ services: | |
<% end -%> | ||
volumes: | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
- '<%= scope.lookupvar('che::che_instance') -%>/config/traefik/traefik.toml:/etc/traefik/traefik.toml' | ||
- '<%= scope.lookupvar('che::che_instance') -%>/config/traefik:/etc/traefik' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is needed to place https certifactes in the |
||
restart: always | ||
<% end -%> | ||
|
||
|
@@ -162,7 +162,9 @@ services: | |
labels: | ||
traefik.keycloak.frontend.entryPoints: "http" | ||
traefik.keycloak.port: "8080" | ||
<% if ! @che_docker_ip_external.empty? -%> | ||
<% if scope.lookupvar('che::che_single_port') == 'true' and scope.lookupvar('che::che_single_port_wildcard_domain_ipless') == 'true' -%> | ||
traefik.keycloak.frontend.rule: "Host:keycloak.<%= scope.lookupvar('che::che_single_port_wildcard_domain_host') -%>" | ||
<% elsif ! @che_docker_ip_external.empty? -%> | ||
traefik.keycloak.frontend.rule: "Host:keycloak.<%= scope.lookupvar('che::che_docker_ip_external') -%>.<%= scope.lookupvar('che::che_single_port_wildcard_domain_host') -%>" | ||
<% else -%> | ||
traefik.keycloak.frontend.rule: "Host:keycloak.<%= scope.lookupvar('che::docker_ip') -%>.<%= scope.lookupvar('che::che_single_port_wildcard_domain_host') -%>" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,16 +40,25 @@ public class SinglePortLabelsProvisioner implements ConfigurationProvisioner { | |
private final String internalIpOfContainers; | ||
private final String externalIpOfContainers; | ||
private final String dockerNetwork; | ||
private final String cheHostProtocol; | ||
private final Boolean singleportWildcardIPless; | ||
private final String singleportWildcardDomainHost; | ||
|
||
@Inject | ||
public SinglePortLabelsProvisioner( | ||
@Nullable @Named("che.docker.ip") String internalIpOfContainers, | ||
@Nullable @Named("che.docker.ip.external") String externalIpOfContainers, | ||
@Nullable @Named("che.docker.network") String dockerNetwork, | ||
@Nullable @Named("che.host.protocol") String cheHostProtocol, | ||
@Nullable @Named("che.singleport.wildcard_domain.ipless") Boolean singleportWildcardIPless, | ||
@Nullable @Named("che.singleport.wildcard_domain.host") String singleportWildcardDomainHost, | ||
Provider<SinglePortHostnameBuilder> hostnameBuilderProvider) { | ||
this.hostnameBuilderProvider = hostnameBuilderProvider; | ||
this.internalIpOfContainers = internalIpOfContainers; | ||
this.externalIpOfContainers = externalIpOfContainers; | ||
this.singleportWildcardIPless = singleportWildcardIPless; | ||
this.cheHostProtocol = cheHostProtocol; | ||
this.singleportWildcardDomainHost = singleportWildcardDomainHost; | ||
this.dockerNetwork = dockerNetwork; | ||
} | ||
|
||
|
@@ -98,6 +107,11 @@ private String getServiceName(String host) { | |
(externalIpOfContainers != null && host.contains(externalIpOfContainers)) | ||
? host.indexOf(externalIpOfContainers) | ||
: host.indexOf(internalIpOfContainers); | ||
return host.substring(0, idx - 1).replaceAll("\\.", "-"); | ||
if (idx > 1) { | ||
return host.substring(0, idx - 1).replaceAll("\\.", "-"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, review logic here again. We dont need to replace dots anymore. Only cut until first dot and throw out any optional IP and wildcard domain. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good point! |
||
} else { | ||
// the hostname does not contain the external or internal IPs | ||
return host.replaceAll("\\.", "-"); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not see where $che_keycloak_auth__server__url is used, do we need that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, i think this is a leftover