diff --git a/microprofile-health/README-source.adoc b/microprofile-health/README-source.adoc index 6de3f1a95b..c6aa5eed8e 100644 --- a/microprofile-health/README-source.adoc +++ b/microprofile-health/README-source.adoc @@ -5,9 +5,16 @@ include::../shared-doc/attributes.adoc[] :level: Beginner :technologies: MicroProfile Health :management-port-openshift: -:post-helm-install-actions: ../microprofile-health/expose-management-port.adoc -:extra-openshift-testing-actions: ../microprofile-health/expose-management-port.adoc -:extra-openshift-test-arguments: -Dserver.management.host=https://$(oc get route {artifactId}-management --template='{{ .spec.host }}') + +// Additional Info for OpenShift +:post-helm-install-actions-openshift: ../microprofile-health/expose-management-port-openshift.adoc +:extra-testing-actions-openshift: {post-helm-install-actions-openshift} +:extra-test-arguments-openshift: -Dserver.management.host=https://$(oc get route {artifactId}-management --template='{{ .spec.host }}') + +// Additional Info for Kubernetes +:post-helm-install-actions-kubernetes: ../microprofile-health/expose-management-port-kubernetes.adoc +:extra-testing-actions-kubernetes: {post-helm-install-actions-kubernetes} +:extra-test-arguments-kubernetes: -Dserver.management.host=http://localhost:9990 [abstract] The `microprofile-health` quickstart demonstrates the use of the MicroProfile Health specification in {productName}. @@ -455,6 +462,10 @@ include::../shared-doc/build-and-run-the-quickstart-with-bootable-jar.adoc[level // OpenShift include::../shared-doc/build-and-run-the-quickstart-with-openshift.adoc[leveloffset=+1] +ifndef::ProductRelease,EAPXPRelease[] +// Kubernetes +include::../shared-doc/build-and-run-the-quickstart-with-kubernetes.adoc[leveloffset=+1] +endif::[] == Conclusion diff --git a/microprofile-health/expose-management-port-kubernetes.adoc b/microprofile-health/expose-management-port-kubernetes.adoc new file mode 100644 index 0000000000..8b7b782854 --- /dev/null +++ b/microprofile-health/expose-management-port-kubernetes.adoc @@ -0,0 +1,5 @@ +:expose-mgmt-port-kubernetes: true +include::expose-management-port.adoc[] + +//Unset the attribute +:!expose-mgmt-port-kubernetes: \ No newline at end of file diff --git a/microprofile-health/expose-management-port-openshift.adoc b/microprofile-health/expose-management-port-openshift.adoc new file mode 100644 index 0000000000..b665ce7a4f --- /dev/null +++ b/microprofile-health/expose-management-port-openshift.adoc @@ -0,0 +1,5 @@ +:expose-mgmt-port-openshift: true +include::expose-management-port.adoc[] + +// Unset the attribute +:!expose-mgmt-port-openshift: \ No newline at end of file diff --git a/microprofile-health/expose-management-port.adoc b/microprofile-health/expose-management-port.adoc index 745e2fcab1..b6ebb54aea 100644 --- a/microprofile-health/expose-management-port.adoc +++ b/microprofile-health/expose-management-port.adoc @@ -1,16 +1,35 @@ +ifdef::expose-mgmt-port-openshift[] +:expose-mgmt-port-cli: oc +:expose-mgmt-port-yaml-suffix: openshift +endif::[] +ifdef::expose-mgmt-port-kubernetes[] +:expose-mgmt-port-cli: kubectl +:expose-mgmt-port-yaml-suffix: kubernetes +endif::[] + This quickstart requires the management port (9990) to be exposed for demo purposes and testing. We do this only to demonstrate the concepts and ease the testing. IMPORTANT: It is **not** recommended to expose the management port in a production environment! -To expose the management porte to manually exposes our service on port 9990 we deploying the following file: +To expose the management port to manually expose our service on port 9990 we deploy the following file: [source,options="nowrap",subs="+attributes"] ---- -oc apply -f charts/management-openshift.yml +{expose-mgmt-port-cli} apply -f charts/management-{expose-mgmt-port-yaml-suffix}.yml ---- Once this is deployed you will be able to access the management port via the created `microprofile-health-management` route. +ifdef::expose-mgmt-port-openshift[] To get the address of the `microprofile-health-management` route, execute: [source,options="nowrap",subs="+attributes"] ---- $ oc get route microprofile-health -o jsonpath="{.spec.host}" ---- +endif::[] +ifdef::expose-mgmt-port-kubernetes[] +To access the management port from outside the cluster, we need to set up a Kubernetes port forward. This is done with the command: +[source,options="nowrap",subs="+attributes"] +---- +{expose-mgmt-port-cli} port-forward service/microprofile-health-management 9990:9990 +---- +Note that the command to create the port-forward will not return, so it is easiest to run this in a separate terminal. +endif::[] diff --git a/shared-doc/build-and-run-the-quickstart-with-kubernetes.adoc b/shared-doc/build-and-run-the-quickstart-with-kubernetes.adoc index 596043149e..b2a5911db0 100644 --- a/shared-doc/build-and-run-the-quickstart-with-kubernetes.adoc +++ b/shared-doc/build-and-run-the-quickstart-with-kubernetes.adoc @@ -25,3 +25,6 @@ include::../shared-doc/run-integration-tests-with-kubernetes.adoc[leveloffset=+1 //Prepare Helm for Quickstart Deployment include::../shared-doc/helm-undeploy-project.adoc[leveloffset=+1] + +// Unset the attribute +:!kubernetes: diff --git a/shared-doc/build-and-run-the-quickstart-with-openshift.adoc b/shared-doc/build-and-run-the-quickstart-with-openshift.adoc index fd0b0896f9..dc838cd60c 100644 --- a/shared-doc/build-and-run-the-quickstart-with-openshift.adoc +++ b/shared-doc/build-and-run-the-quickstart-with-openshift.adoc @@ -1,4 +1,5 @@ :cloud-platform: OpenShift +:openshift: true ifndef::helm-app-name[] :helm-app-name: {artifactId} endif::helm-app-name[] @@ -24,3 +25,6 @@ include::../shared-doc/run-integration-tests-with-openshift.adoc[leveloffset=+1] //Prepare Helm for Quickstart Deployment include::../shared-doc/helm-undeploy-project.adoc[leveloffset=+1] + +// Unset the attribute +:!openshift: diff --git a/shared-doc/helm-deploy-project.adoc b/shared-doc/helm-deploy-project.adoc index 594728717b..8fbff12fd1 100644 --- a/shared-doc/helm-deploy-project.adoc +++ b/shared-doc/helm-deploy-project.adoc @@ -114,7 +114,7 @@ If you want to see all the configuration elements to customize your deployment y $ helm show readme {helmChartName} ---- -ifndef::kubernetes[] +ifdef::openshift[] Get the URL of the route to the deployment. [source,options="nowrap",subs="+attributes"] @@ -140,6 +140,9 @@ endif::[] The Maven profile named `openshift` is used by the Helm chart to provision the server with the quickstart deployed on the root web context, and thus the application should be accessed with the URL without the `/{artifactId}` path segment after `HOST:PORT`. ==== -ifdef::post-helm-install-actions[] -include::{post-helm-install-actions}[leveloffset=+1] -endif::post-helm-install-actions[] +ifdef::openshift,post-helm-install-actions-openshift[] +include::{post-helm-install-actions-openshift}[leveloffset=+1] +endif::openshift,post-helm-install-actions-openshift[] +ifdef::kubernetes,post-helm-install-actions-kubernetes[] +include::{post-helm-install-actions-kubernetes}[leveloffset=+1] +endif::kubernetes,post-helm-install-actions-kubernetes[] diff --git a/shared-doc/run-integration-tests-with-kubernetes.adoc b/shared-doc/run-integration-tests-with-kubernetes.adoc index 813eef4058..bdafc2ee73 100644 --- a/shared-doc/run-integration-tests-with-kubernetes.adoc +++ b/shared-doc/run-integration-tests-with-kubernetes.adoc @@ -6,15 +6,15 @@ The integration tests included with this quickstart, which verify that the quick The integration tests expect a deployed application, so make sure you have deployed the quickstart on Kubernetes before you begin. ==== -ifdef::extra-kubernetes-testing-actions[] -include::{extra-kubernetes-testing-actions}[leveloffset=+1] -endif::extra-kubernetes-testing-actions[] +ifdef::extra-testing-actions-kubernetes[] +include::{extra-testing-actions-kubernetes}[leveloffset=+1] +endif::extra-testing-actions-kubernetes[] -ifndef::extra-kubernetes-test-arguments[:extra-kubernetes-test-arguments:] +ifndef::extra-test-arguments-kubernetes[:extra-test-arguments-kubernetes:] Run the integration tests using the following command to run the `verify` goal with the `integration-testing` profile activated and the proper URL: [source,options="nowrap",subs="+attributes"] ---- -$ mvn verify -Pintegration-testing -Dserver.host=http://localhost:8080 {extra-openshift-test-arguments} +$ mvn verify -Pintegration-testing -Dserver.host=http://localhost:8080 {extra-test-arguments-kubernetes} ---- diff --git a/shared-doc/run-integration-tests-with-openshift.adoc b/shared-doc/run-integration-tests-with-openshift.adoc index 5d9a87487b..17e3271622 100644 --- a/shared-doc/run-integration-tests-with-openshift.adoc +++ b/shared-doc/run-integration-tests-with-openshift.adoc @@ -6,23 +6,23 @@ The integration tests included with this quickstart, which verify that the quick The integration tests expect a deployed application, so make sure you have deployed the quickstart on OpenShift before you begin. ==== -ifdef::extra-openshift-testing-actions[] -include::{extra-openshift-testing-actions}[leveloffset=+1] -endif::extra-openshift-testing-actions[] +ifdef::extra-testing-actions-openshift[] +include::{extra-testing-actions-openshift}[leveloffset=+1] +endif::extra-testing-actions-openshift[] -ifndef::extra-openshift-test-arguments[:extra-openshift-test-arguments:] +ifndef::extra-test-arguments-openshift[:extra-test-arguments-openshift:] Run the integration tests using the following command to run the `verify` goal with the `integration-testing` profile activated and the proper URL: ifndef::requires-http-route[] [source,options="nowrap",subs="+attributes"] ---- -$ mvn verify -Pintegration-testing -Dserver.host=https://$(oc get route {helm-app-name} --template='{{ .spec.host }}') {extra-openshift-test-arguments} +$ mvn verify -Pintegration-testing -Dserver.host=https://$(oc get route {helm-app-name} --template='{{ .spec.host }}') {extra-test-arguments-openshift} ---- endif::requires-http-route[] ifdef::requires-http-route[] [source,options="nowrap",subs="+attributes"] ---- -$ mvn verify -Pintegration-testing -Dserver.host=http://$(oc get route {helm-app-name} --template='{{ .spec.host }}') {extra-openshift-test-arguments} +$ mvn verify -Pintegration-testing -Dserver.host=http://$(oc get route {helm-app-name} --template='{{ .spec.host }}') {extra-test-arguments-openshift} ---- endif::requires-http-route[]