Skip to content
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

[issue 23] - Operator provisioning configurable package manifest #25

46 changes: 24 additions & 22 deletions .ci/openshift-ci/build-root/e2e-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,39 @@ set -x

printenv KUBECONFIG
printenv KUBEADMIN_PASSWORD_FILE

oc get node
oc config view
oc whoami

export TEST_ADMIN_USERNAME=tadmin
export TEST_ADMIN_PASSWORD=adminpwd

export TEST_USER_USERNAME=tadmin
export TEST_USER_PASSWORD=userpwd

export HTPASSWD_FILE=users.htpasswd
htpasswd -c -B -b $HTPASSWD_FILE $TEST_ADMIN_USERNAME $TEST_ADMIN_PASSWORD
htpasswd -b $HTPASSWD_FILE $TEST_USER_USERNAME $TEST_USER_PASSWORD
cat $HTPASSWD_FILE
oc create secret generic htpass-secret-2 --from-file=htpasswd=$HTPASSWD_FILE -n openshift-config
oc patch OAuth cluster -p '{"spec": {"identityProviders": [{"htpasswd": {"fileData": {"name": "htpass-secret-2"}},"mappingMethod": "claim","name": "my_htpasswd_provider","type": "HTPasswd"}]}}' --type=merge
oc adm policy add-cluster-role-to-user cluster-admin $TEST_ADMIN_USERNAME

# For some reason the creation of a cluster admin and a user authentication mechanism does not allow for immediate
# login, even though the oc commands don't report any error.
# This doesn't let us get a token, and XTF won't take the xtf.openshift.admin.kubeconfig and
# xtf.openshift.master.kubeconfig properties into account when the token is not present.
# Eventually this turns out to be the condition hat prevents the oc binary commands to succeed, because they would
simkam marked this conversation as resolved.
Show resolved Hide resolved
# use a tmp oc.config file which is not found on the build cluster filesystem.
# This is why we login with kubwadmin, get a token and use its full set of credentials (username, password and token)
simkam marked this conversation as resolved.
Show resolved Hide resolved
# both for xtf.openshift.admin.* and xtf.openshift.master.* properties
export SYSADMIN_USERNAME=kubeadmin
export SYSADMIN_PASSWORD=$(cat "${KUBEADMIN_PASSWORD_FILE}")
export TEST_CLUSTER_URL=$(oc whoami --show-server)
export TEST_NAMESPACE=intersmash-test
oc login "${TEST_CLUSTER_URL}" -u "${SYSADMIN_USERNAME}" -p "${SYSADMIN_PASSWORD}" --insecure-skip-tls-verify=true
export SYSADMIN_TOKEN=$(oc whoami -t)

export TEST_NAMESPACE=intersmash-test
oc new-project $TEST_NAMESPACE

cat >> test.properties <<EOL
xtf.openshift.url=${TEST_CLUSTER_URL}
xtf.openshift.namespace=${TEST_NAMESPACE}-builds
xtf.bm.namespace=${TEST_NAMESPACE}
xtf.openshift.admin.username=${TEST_ADMIN_USERNAME}
xtf.openshift.admin.password=${TEST_ADMIN_PASSWORD}
xtf.openshift.master.username=${TEST_USER_USERNAME}
xtf.openshift.master.password=${TEST_USER_PASSWORD}
xtf.openshift.namespace=${TEST_NAMESPACE}
xtf.bm.namespace=${TEST_NAMESPACE}-builds
xtf.openshift.admin.username=${SYSADMIN_USERNAME}
xtf.openshift.admin.password=${SYSADMIN_PASSWORD}
xtf.openshift.admin.token=${SYSADMIN_TOKEN}
xtf.openshift.master.username=${SYSADMIN_USERNAME}
xtf.openshift.master.password=${SYSADMIN_PASSWORD}
xtf.openshift.master.token=${SYSADMIN_TOKEN}
xtf.openshift.admin.kubeconfig=${KUBECONFIG}
xtf.openshift.master.kubeconfig=${KUBECONFIG}
EOL

cat test.properties
Expand Down
77 changes: 45 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,12 @@ a given service on cloud environments via APIs that leverage the
[Operator Framework](https://github.com/operator-framework).

Intersmash makes this feature available for currently supported products (see the table below), but that can be
extended easily, since Intersmash _provisioners_ are pluggable components.
extended easily, since Intersmash _provisioners_ are pluggable components.

| Product | Supported Operator version | Default channel name | Supported product version | Repository | Notes |
|:-----------|:---------------------------|:---------------------|:--------------------------|:--------------------------------------------------|:------|
| Infinispan | 2.3.1 | 2.3.x | 14.0.6.Final | https://github.com/infinispan/infinispan-operator | |


Intersmash operator-based provisioners implement a common contract and high level behavior which is defined by the
[OperatorProvisioner](./intersmash-tools/intersmash-tools-core/src/main/java/org/jboss/intersmash/tools/provision/openshift/operator/OperatorProvisioner.java)
Expand Down Expand Up @@ -424,40 +429,48 @@ The following properties could be used to configure Intersmash. You can keep the

Intersmash properties:

| Property | Description |
|------------------------------------------------|-------------------------------------------------------------------------------------|
| intersmash.skip.deploy | Skip the deployment phase, tests will be run against a prepared environment * |
| intersmash.skip.undeploy | Do not cleanup environment after test (development use) |
| intersmash.deployments.repository.ref | Manually set git repository branch of intersmash-deployments |
| intersmash.deployments.repository.url | Manually set git repository url of intersmash-deployments |
| intersmash.openshift.script.debug | Add parameter SCRIPT_DEBUG=true to DeploymentConfig/Pod |
| intersmash.operators.source | Sets CatalogSource that should be used to deploy Operators |
| intersmash.wildfly.image | Wildfly Builder image URL |
| intersmash.wildfly.runtime.image | Wildfly Runtime image URL |
| intersmash.wildfly.helm.charts.repo | Wildfly Helm Charts repository URL |
| intersmash.wildfly.helm.charts.branch | Wildfly Helm Charts repository branch |
| intersmash.wildfly.helm.charts.name | Wildfly Helm Charts repository namespaces |
| intersmash.wildfly.operators.catalog_source | Wildfly custom catalog for Operator (must be in namespace openshift-marketplace) |
| intersmash.wildfly.operators.index_image | Wildfly custom index image for Operator |
| intersmash.infinispan.image | Infinispan image URL |
| intersmash.infinispan.templates | URL where Infinispan OpenShift templates resides |
| intersmash.infinispan.operators.catalog_source | Infinispan custom catalog for Operator (must be in namespace openshift-marketplace) |
| intersmash.infinispan.operators.index_image | Infinispan custom index image for Operator |
| intersmash.keycloak.image | Keycloak image URL |
| intersmash.keycloak.templates | URL where Keycloak OpenShift templates resides |
| intersmash.keycloak.operators.catalog_source | Keycloak custom catalog for Operator (must be in namespace openshift-marketplace) |
| intersmash.keycloak.operators.index_image | Keycloak custom index image for Operator |
| intersmash.kafka.operators.catalog_source | Kefka custom catalog for Operator (must be in namespace openshift-marketplace) |
| intersmash.kafka.operators.index_image | Kafka custom index image for Operator |
| intersmash.activemq.operators.catalog_source | ActiveMQ custom catalog for Operator (must be in namespace openshift-marketplace) |
| intersmash.activemq.operators.index_image | ActiveMQ custom index image for Operators |
| wildfly.feature-pack.location | Wildfly feature pack used by shared configurable deployments |
| wildfly.ee-feature-pack.location | Wildfly EE feature pack used by shared configurable deployments |
| wildfly.cloud-feature-pack.location | Wildfly cloud feature pack used by shared configurable deployments |
| Property | Description |
|--------------------------------------------------|-------------------------------------------------------------------------------------|
| intersmash.skip.deploy | Skip the deployment phase, tests will be run against a prepared environment * |
| intersmash.skip.undeploy | Do not cleanup environment after test (development use) |
| intersmash.deployments.repository.ref | Manually set git repository branch of intersmash-deployments |
| intersmash.deployments.repository.url | Manually set git repository url of intersmash-deployments |
| intersmash.openshift.script.debug | Add parameter SCRIPT_DEBUG=true to DeploymentConfig/Pod |
| intersmash.operators.source | Sets CatalogSource that should be used to deploy Operators |
| intersmash.wildfly.image | Wildfly Builder image URL |
| intersmash.wildfly.runtime.image | Wildfly Runtime image URL |
| intersmash.wildfly.helm.charts.repo | Wildfly Helm Charts repository URL |
| intersmash.wildfly.helm.charts.branch | Wildfly Helm Charts repository branch |
| intersmash.wildfly.helm.charts.name | Wildfly Helm Charts repository namespaces |
| intersmash.wildfly.operators.catalog_source | Wildfly custom catalog for Operator (must be in namespace openshift-marketplace) |
| intersmash.wildfly.operators.index_image | Wildfly custom index image for Operator |
| intersmash.wildfly.operators.package_manifest | Wildfly custom package manifest for Operator |
| intersmash.infinispan.image | Infinispan image URL |
| intersmash.infinispan.templates | URL where Infinispan OpenShift templates resides |
| intersmash.infinispan.operators.catalog_source | Infinispan custom catalog for Operator (must be in namespace openshift-marketplace) |
| intersmash.infinispan.operators.index_image | Infinispan custom index image for Operator |
| intersmash.infinispan.operators.package_manifest | Infinispan custom package manifest for Operator |
| intersmash.keycloak.image | Keycloak image URL |
| intersmash.keycloak.templates | URL where Keycloak OpenShift templates resides |
| intersmash.keycloak.operators.catalog_source | Keycloak custom catalog for Operator (must be in namespace openshift-marketplace) |
| intersmash.keycloak.operators.index_image | Keycloak custom index image for Operator |
| intersmash.keycloak.operators.package_manifest | Keycloak custom package manifest for Operator |
| intersmash.kafka.operators.catalog_source | Kafka custom catalog for Operator (must be in namespace openshift-marketplace) |
| intersmash.kafka.operators.index_image | Kafka custom index image for Operator |
| intersmash.kafka.operators.package_manifest | Kafka custom package manifest for Operator |
| intersmash.activemq.operators.catalog_source | ActiveMQ custom catalog for Operator (must be in namespace openshift-marketplace) |
| intersmash.activemq.operators.index_image | ActiveMQ custom index image for Operators |
| intersmash.activemq.operators.package_manifest | ActiveMQ custom package manifest for Operators |
| intersmash.hyperfoil.operators.catalog_source | HyperFoil custom catalog for Operator (must be in namespace openshift-marketplace) |
| intersmash.hyperfoil.operators.index_image | HyperFoil custom index image for Operators |
| intersmash.hyperfoil.operators.package_manifest | HyperFoil custom package manifest for Operators |
| wildfly.feature-pack.location | Wildfly feature pack used by shared configurable deployments |
| wildfly.ee-feature-pack.location | Wildfly EE feature pack used by shared configurable deployments |
| wildfly.cloud-feature-pack.location | Wildfly cloud feature pack used by shared configurable deployments |

[*] - When `intersmash.skip.deploy` is set, please take into account that the prepared environment should be
configured accordingly to the `Application` descriptors which are defined by the test class `@Service` annotations.
E.g.: if a test class defines an `WildflyOperatoApplication` as one of its services, and such application sets the `name`
E.g.: if a test class defines an `WildflyOperatorApplication` as one of its services, and such application sets the `name`
to be "wildfly-operator-app", then a Wildfly operator application with such a name should exist in the prepared environment.
This feature is useful to save debugging time during development, where you can deploy a complex scenario and then
enable the property to just execute tests in the following runs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.slf4j.event.Level;

Expand All @@ -57,7 +56,6 @@
*/
@Slf4j
@CleanBeforeAll
@Disabled("WIP - Disabled until global-test.properties is configured with the required property")
public class InfinispanOperatorProvisionerTest {
static final String TEST_SECRET_USERNAME = "developer";
static final String TEST_SECRET_PASSWORD = "developer";
Expand Down Expand Up @@ -378,7 +376,6 @@ private void verifyMinimalTwoReplicasInfinispan(Infinispan infinispan, boolean w
log.debug(INFINISPAN_OPERATOR_PROVISIONER.infinispansClient().withName(name).get().getStatus().toString());
}
deleteAndVerifyMinimalInfinispan(waitForPods);

}

/**
Expand Down
Loading