-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[issue 105] - Addint the RHSSO Template provisioner
- Loading branch information
Showing
13 changed files
with
466 additions
and
3 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
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
63 changes: 63 additions & 0 deletions
63
...a/org/jboss/intersmash/tools/application/openshift/RhSsoTemplateOpenShiftApplication.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,63 @@ | ||
package org.jboss.intersmash.tools.application.openshift; | ||
|
||
import java.nio.file.Path; | ||
|
||
import org.jboss.intersmash.tools.application.openshift.template.RhSsoTemplate; | ||
|
||
/** | ||
* End user Application interface which presents RH-SSO template application on OpenShift Container Platform. | ||
* <p> | ||
* RH-SSO application that is supposed to run on OpenShift needs to implement this interface. | ||
* Usage: | ||
* <pre> | ||
* @Appsint( | ||
* @Service(RhssoApp.class) | ||
* }) | ||
* </pre> | ||
* The application will be deployed by: | ||
* <ul> | ||
* <li>{@link RhSsoTemplateOpenShiftProvisioner}</li> | ||
* </ul> | ||
* <p> | ||
* See {@link RhSsoTemplate} for available templates the | ||
* application can represent. | ||
*/ | ||
public interface RhSsoTemplateOpenShiftApplication extends TemplateApplication<RhSsoTemplate>, HasSecrets { | ||
|
||
default String getName() { | ||
return "rh-sso"; | ||
} | ||
|
||
/** | ||
* Realm configuration in json format for Keycloak partial import | ||
* <p> | ||
* https://www.keycloak.org/docs/9.0/server_admin/index.html#importing-a-realm-from-exported-json-file | ||
* <p> | ||
* Requires template parameters SSO_REALM, SSO_SERVICE_USERNAME, SSO_SERVICE_PASSWORD to be set | ||
* | ||
* @return Instance of {@link Path} representing a YAML definition for the desired realm configuration | ||
*/ | ||
default Path getRealmConfigurationFilePath() { | ||
return null; | ||
} | ||
|
||
/** | ||
* Non x509 templates expose an HTTP route named after the application name; | ||
* x509 templates don't expose an HTTP route; | ||
* | ||
* @return The service HTTP route | ||
*/ | ||
default String getHttpRouteName() { | ||
return getTemplate().isX509() ? null : getName(); | ||
} | ||
|
||
/** | ||
* Non x509 templates expose an HTTPS route named after the application name with the "secure-" prefix; | ||
* x509 templates expose an HTTPS route named after the application name; | ||
* | ||
* @return The service HTTPS route | ||
*/ | ||
default String getHttpsRouteName() { | ||
return getTemplate().isX509() ? getName() : String.format("secure-%s", getName()); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...rc/main/java/org/jboss/intersmash/tools/application/openshift/template/RhSsoTemplate.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,46 @@ | ||
package org.jboss.intersmash.tools.application.openshift.template; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import org.jboss.intersmash.tools.provision.openshift.template.OpenShiftTemplate; | ||
|
||
/** | ||
* OpenShift template for RH-SSO. | ||
* <p> | ||
* See https://github.com/jboss-container-images/redhat-sso-7-openshift-image | ||
*/ | ||
public enum RhSsoTemplate implements OpenShiftTemplate { | ||
HTTPS("https"), | ||
POSTGRESQL("postgresql"), | ||
POSTGRESQL_PERSISTENT("postgresql-persistent"), | ||
X509_HTTPS("x509-https"), | ||
X509_POSTGRESQL_PERSISTENT("x509-postgresql-persistent"); | ||
|
||
private static final Map<String, RhSsoTemplate> BY_LABEL = new HashMap<>(); | ||
|
||
static { | ||
for (RhSsoTemplate e : values()) { | ||
BY_LABEL.put(e.label, e); | ||
} | ||
} | ||
|
||
private String label; | ||
|
||
RhSsoTemplate(String label) { | ||
this.label = label; | ||
} | ||
|
||
@Override | ||
public String getLabel() { | ||
return label; | ||
} | ||
|
||
public boolean isX509() { | ||
return label.contains("x509"); | ||
} | ||
|
||
public static RhSsoTemplate valueOfLabel(String label) { | ||
return BY_LABEL.get(label); | ||
} | ||
} |
Oops, something went wrong.