Search in sources :

Example 1 with KeycloakInstance

use of org.bf2.systemtest.framework.KeycloakInstance in project kas-fleetshard by bf2fc6cc711aee1a0c2a.

the class UpgradeST method deploy.

@BeforeAll
void deploy() throws Exception {
    strimziOperatorManagerOld = new StrimziOperatorManager(StrimziOperatorManager.getPreviousUpstreamStrimziVersion(SystemTestEnvironment.STRIMZI_VERSION));
    strimziOperatorManagerNew = new StrimziOperatorManager(SystemTestEnvironment.STRIMZI_VERSION);
    CompletableFuture.allOf(KeycloakOperatorManager.installKeycloak(kube), strimziOperatorManagerNew.installStrimzi(kube), strimziOperatorManagerOld.installStrimzi(kube), FleetShardOperatorManager.deployFleetShardOperator(kube), FleetShardOperatorManager.deployFleetShardSync(kube)).join();
    keycloak = SystemTestEnvironment.INSTALL_KEYCLOAK ? new KeycloakInstance(KeycloakOperatorManager.OPERATOR_NS) : null;
    syncEndpoint = FleetShardOperatorManager.createEndpoint(kube);
    latestStrimziVersion = SyncApiClient.getLatestStrimziVersion(syncEndpoint);
    LOGGER.info("Endpoint address {}", syncEndpoint);
}
Also used : KeycloakInstance(org.bf2.systemtest.framework.KeycloakInstance) StrimziOperatorManager(org.bf2.systemtest.operator.StrimziOperatorManager) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 2 with KeycloakInstance

use of org.bf2.systemtest.framework.KeycloakInstance in project kas-fleetshard by bf2fc6cc711aee1a0c2a.

the class ManagedKafkaResourceType method getDefault.

/**
 * get common default managedkafka instance
 *
 * @throws Exception
 */
public static ManagedKafka getDefault(String namespace, String appName, KeycloakInstance keycloak, String strimziVersion, String kafkaVersion) throws Exception {
    final String tlsCert;
    final String tlsKey;
    String hostDomain = SystemTestEnvironment.BOOTSTRAP_HOST_DOMAIN;
    if (!KubeClient.getInstance().isGenericKubernetes()) {
        OpenShiftClient cli = KubeClient.getInstance().client().adapt(OpenShiftClient.class);
        hostDomain = Optional.ofNullable(cli.operator().ingressControllers().inNamespace("openshift-ingress-operator").withName("sharded").get()).orElse(cli.operator().ingressControllers().inNamespace("openshift-ingress-operator").withName("default").get()).getStatus().getDomain();
    }
    if (SystemTestEnvironment.DUMMY_CERT.equals(SystemTestEnvironment.ENDPOINT_TLS_CERT)) {
        SecurityUtils.TlsConfig tlsConfig = SecurityUtils.getTLSConfig(hostDomain);
        tlsCert = tlsConfig.getCert();
        tlsKey = tlsConfig.getKey();
    } else {
        tlsCert = SystemTestEnvironment.ENDPOINT_TLS_CERT;
        tlsKey = SystemTestEnvironment.ENDPOINT_TLS_KEY;
    }
    final String oauthClientId;
    final String oauthTlsCert;
    final String oauthClientSecret;
    final String oauthUserClaim;
    final String oauthFallbackUserClaim;
    final String oauthJwksEndpoint;
    final String oauthTokenEndpoint;
    final String oauthIssuerEndpoint;
    if (keycloak != null) {
        oauthClientId = "kafka";
        oauthTlsCert = keycloak.getKeycloakCert();
        oauthClientSecret = "kafka";
        oauthUserClaim = keycloak.getUserNameClaim();
        oauthFallbackUserClaim = keycloak.getFallbackUserNameClaim();
        oauthJwksEndpoint = keycloak.getJwksEndpointUri();
        oauthTokenEndpoint = keycloak.getOauthTokenEndpointUri();
        oauthIssuerEndpoint = keycloak.getValidIssuerUri();
    } else if (SystemTestEnvironment.DUMMY_OAUTH_JWKS_URI.equals(SystemTestEnvironment.OAUTH_JWKS_ENDPOINT)) {
        oauthClientId = null;
        oauthTlsCert = null;
        oauthClientSecret = null;
        oauthUserClaim = null;
        oauthFallbackUserClaim = null;
        oauthJwksEndpoint = null;
        oauthTokenEndpoint = null;
        oauthIssuerEndpoint = null;
    } else {
        // use defined values by env vars for oauth
        oauthClientId = SystemTestEnvironment.OAUTH_CLIENT_ID;
        oauthTlsCert = SystemTestEnvironment.DUMMY_CERT.equals(SystemTestEnvironment.OAUTH_TLS_CERT) ? null : SystemTestEnvironment.OAUTH_TLS_CERT;
        oauthClientSecret = SystemTestEnvironment.OAUTH_CLIENT_SECRET;
        oauthUserClaim = SystemTestEnvironment.OAUTH_USER_CLAIM;
        oauthFallbackUserClaim = SystemTestEnvironment.OAUTH_FALLBACK_USER_CLAIM;
        oauthJwksEndpoint = SystemTestEnvironment.OAUTH_JWKS_ENDPOINT;
        oauthTokenEndpoint = SystemTestEnvironment.OAUTH_TOKEN_ENDPOINT;
        oauthIssuerEndpoint = SystemTestEnvironment.OAUTH_ISSUER_ENDPOINT;
    }
    return ManagedKafka.getDefault(appName, namespace, hostDomain, tlsCert, tlsKey, oauthClientId, oauthTlsCert, oauthClientSecret, oauthUserClaim, oauthFallbackUserClaim, oauthJwksEndpoint, oauthTokenEndpoint, oauthIssuerEndpoint, strimziVersion, kafkaVersion);
}
Also used : OpenShiftClient(io.fabric8.openshift.client.OpenShiftClient) SecurityUtils(org.bf2.systemtest.framework.SecurityUtils)

Example 3 with KeycloakInstance

use of org.bf2.systemtest.framework.KeycloakInstance in project kas-fleetshard by bf2fc6cc711aee1a0c2a.

the class SuiteUnitTest method testKeycloakInstance.

@ParallelTest
void testKeycloakInstance() {
    KeycloakInstance k = new KeycloakInstance("keycloak");
    assertEquals("https://keycloak.keycloak.svc:8443/auth/realms/demo/protocol/openid-connect/certs", k.getJwksEndpointUri());
    assertEquals("admin", k.getUsername());
    assertEquals("admin", k.getPassword());
    assertNotNull(k.getKeycloakCert());
}
Also used : KeycloakInstance(org.bf2.systemtest.framework.KeycloakInstance) ParallelTest(org.bf2.systemtest.framework.ParallelTest)

Aggregations

KeycloakInstance (org.bf2.systemtest.framework.KeycloakInstance)2 OpenShiftClient (io.fabric8.openshift.client.OpenShiftClient)1 ParallelTest (org.bf2.systemtest.framework.ParallelTest)1 SecurityUtils (org.bf2.systemtest.framework.SecurityUtils)1 StrimziOperatorManager (org.bf2.systemtest.operator.StrimziOperatorManager)1 BeforeAll (org.junit.jupiter.api.BeforeAll)1