Hostname v2 for Operator (#28599)
Closes #27728 Signed-off-by: Václav Muzikář <vmuzikar@redhat.com>
This commit is contained in:
parent
9a466f90ab
commit
33f580daa4
6 changed files with 24 additions and 13 deletions
|
@ -44,10 +44,10 @@ spec:
|
||||||
httpsPort: 8543
|
httpsPort: 8543
|
||||||
tlsSecret: my-tls-secret
|
tlsSecret: my-tls-secret
|
||||||
hostname:
|
hostname:
|
||||||
hostname: my-hostname
|
hostname: https://my-hostname.tld
|
||||||
admin: my-admin-hostname
|
admin: https://my-hostname.tld/admin
|
||||||
strict: false
|
strict: false
|
||||||
strictBackchannel: false
|
backchannelDynamic: true
|
||||||
features:
|
features:
|
||||||
enabled:
|
enabled:
|
||||||
- docker
|
- docker
|
||||||
|
@ -168,7 +168,6 @@ spec:
|
||||||
httpEnabled: true
|
httpEnabled: true
|
||||||
hostname:
|
hostname:
|
||||||
strict: false
|
strict: false
|
||||||
strictBackchannel: false
|
|
||||||
----
|
----
|
||||||
|
|
||||||
=== Resource requirements
|
=== Resource requirements
|
||||||
|
|
|
@ -91,7 +91,8 @@ public class KeycloakDistConfigurator {
|
||||||
.mapOption("hostname-admin", HostnameSpec::getAdmin)
|
.mapOption("hostname-admin", HostnameSpec::getAdmin)
|
||||||
.mapOption("hostname-admin-url", HostnameSpec::getAdminUrl)
|
.mapOption("hostname-admin-url", HostnameSpec::getAdminUrl)
|
||||||
.mapOption("hostname-strict", HostnameSpec::isStrict)
|
.mapOption("hostname-strict", HostnameSpec::isStrict)
|
||||||
.mapOption("hostname-strict-backchannel", HostnameSpec::isStrictBackchannel);
|
.mapOption("hostname-strict-backchannel", HostnameSpec::isStrictBackchannel)
|
||||||
|
.mapOption("hostname-backchannel-dynamic", HostnameSpec::isBackchannelDynamic);
|
||||||
}
|
}
|
||||||
|
|
||||||
void configureFeatures() {
|
void configureFeatures() {
|
||||||
|
|
|
@ -27,21 +27,24 @@ import java.io.Serializable;
|
||||||
@Buildable(editableEnabled = false, builderPackage = "io.fabric8.kubernetes.api.builder")
|
@Buildable(editableEnabled = false, builderPackage = "io.fabric8.kubernetes.api.builder")
|
||||||
public class HostnameSpec implements Serializable {
|
public class HostnameSpec implements Serializable {
|
||||||
|
|
||||||
@JsonPropertyDescription("Hostname for the Keycloak server.")
|
@JsonPropertyDescription("Hostname for the Keycloak server. Applicable for Hostname v1 and v2.")
|
||||||
private String hostname;
|
private String hostname;
|
||||||
|
|
||||||
@JsonPropertyDescription("The hostname for accessing the administration console.")
|
@JsonPropertyDescription("The hostname for accessing the administration console. Applicable for Hostname v1 and v2.")
|
||||||
private String admin;
|
private String admin;
|
||||||
|
|
||||||
@JsonPropertyDescription("Set the base URL for accessing the administration console, including scheme, host, port and path")
|
@JsonPropertyDescription("DEPRECATED. Sets the base URL for accessing the administration console, including scheme, host, port and path. Applicable for Hostname v1.")
|
||||||
private String adminUrl;
|
private String adminUrl;
|
||||||
|
|
||||||
@JsonPropertyDescription("Disables dynamically resolving the hostname from request headers.")
|
@JsonPropertyDescription("Disables dynamically resolving the hostname from request headers. Applicable for Hostname v1 and v2.")
|
||||||
private Boolean strict;
|
private Boolean strict;
|
||||||
|
|
||||||
@JsonPropertyDescription("By default backchannel URLs are dynamically resolved from request headers to allow internal and external applications.")
|
@JsonPropertyDescription("DEPRECATED. By default backchannel URLs are dynamically resolved from request headers to allow internal and external applications. Applicable for Hostname v1.")
|
||||||
private Boolean strictBackchannel;
|
private Boolean strictBackchannel;
|
||||||
|
|
||||||
|
@JsonPropertyDescription("Enables dynamic resolving of backchannel URLs, including hostname, scheme, port and context path. Set to true if your application accesses Keycloak via a private network. Applicable for Hostname v2.")
|
||||||
|
private Boolean backchannelDynamic;
|
||||||
|
|
||||||
public String getHostname() {
|
public String getHostname() {
|
||||||
return hostname;
|
return hostname;
|
||||||
}
|
}
|
||||||
|
@ -81,4 +84,12 @@ public class HostnameSpec implements Serializable {
|
||||||
public void setStrictBackchannel(Boolean strictBackchannel) {
|
public void setStrictBackchannel(Boolean strictBackchannel) {
|
||||||
this.strictBackchannel = strictBackchannel;
|
this.strictBackchannel = strictBackchannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean isBackchannelDynamic() {
|
||||||
|
return backchannelDynamic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBackchannelDynamic(Boolean backchannelDynamic) {
|
||||||
|
this.backchannelDynamic = backchannelDynamic;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -325,7 +325,6 @@ public class KeycloakDeploymentTest extends BaseOperatorTest {
|
||||||
var kc = getTestKeycloakDeployment(true);
|
var kc = getTestKeycloakDeployment(true);
|
||||||
var hostnameSpec = new HostnameSpecBuilder()
|
var hostnameSpec = new HostnameSpecBuilder()
|
||||||
.withStrict(false)
|
.withStrict(false)
|
||||||
.withStrictBackchannel(false)
|
|
||||||
.build();
|
.build();
|
||||||
kc.getSpec().setHostnameSpec(hostnameSpec);
|
kc.getSpec().setHostnameSpec(hostnameSpec);
|
||||||
|
|
||||||
|
@ -354,7 +353,6 @@ public class KeycloakDeploymentTest extends BaseOperatorTest {
|
||||||
|
|
||||||
var hostnameSpec = new HostnameSpecBuilder()
|
var hostnameSpec = new HostnameSpecBuilder()
|
||||||
.withStrict(false)
|
.withStrict(false)
|
||||||
.withStrictBackchannel(false)
|
|
||||||
.build();
|
.build();
|
||||||
kc.getSpec().setHostnameSpec(hostnameSpec);
|
kc.getSpec().setHostnameSpec(hostnameSpec);
|
||||||
|
|
||||||
|
@ -375,7 +373,6 @@ public class KeycloakDeploymentTest extends BaseOperatorTest {
|
||||||
|
|
||||||
var hostnameSpec = new HostnameSpecBuilder()
|
var hostnameSpec = new HostnameSpecBuilder()
|
||||||
.withStrict(false)
|
.withStrict(false)
|
||||||
.withStrictBackchannel(false)
|
|
||||||
.build();
|
.build();
|
||||||
kc.getSpec().setHostnameSpec(hostnameSpec);
|
kc.getSpec().setHostnameSpec(hostnameSpec);
|
||||||
|
|
||||||
|
|
|
@ -116,6 +116,7 @@ public class KeycloakDistConfiguratorTest {
|
||||||
"hostname-admin-url", "https://www.my-admin-hostname.org:8448/something",
|
"hostname-admin-url", "https://www.my-admin-hostname.org:8448/something",
|
||||||
"hostname-strict", "true",
|
"hostname-strict", "true",
|
||||||
"hostname-strict-backchannel", "true",
|
"hostname-strict-backchannel", "true",
|
||||||
|
"hostname-backchannel-dynamic", "true",
|
||||||
"hostname-admin", "my-admin-hostname"
|
"hostname-admin", "my-admin-hostname"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -133,6 +134,7 @@ public class KeycloakDistConfiguratorTest {
|
||||||
assertEnvVarNotPresent(envVars, "KC_HOSTNAME_ADMIN_URL");
|
assertEnvVarNotPresent(envVars, "KC_HOSTNAME_ADMIN_URL");
|
||||||
assertEnvVarNotPresent(envVars, "KC_HOSTNAME_STRICT");
|
assertEnvVarNotPresent(envVars, "KC_HOSTNAME_STRICT");
|
||||||
assertEnvVarNotPresent(envVars, "KC_HOSTNAME_STRICT_BACKCHANNEL");
|
assertEnvVarNotPresent(envVars, "KC_HOSTNAME_STRICT_BACKCHANNEL");
|
||||||
|
assertEnvVarNotPresent(envVars, "KC_HOSTNAME_BACKCHANNEL_DYNAMIC");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -43,6 +43,7 @@ spec:
|
||||||
adminUrl: https://www.my-admin-hostname.org:8448/something
|
adminUrl: https://www.my-admin-hostname.org:8448/something
|
||||||
strict: true
|
strict: true
|
||||||
strictBackchannel: true
|
strictBackchannel: true
|
||||||
|
backchannelDynamic: true
|
||||||
cache:
|
cache:
|
||||||
configMapFile:
|
configMapFile:
|
||||||
name: my-config-map
|
name: my-config-map
|
||||||
|
|
Loading…
Reference in a new issue