Skip to content

Commit ca53a54

Browse files
committedApr 16, 2022
simplify the doc by removing the usage of aad user
Signed-off-by: Jianguo Ma <[email protected]>
1 parent e2bb820 commit ca53a54

File tree

2 files changed

+25
-112
lines changed

2 files changed

+25
-112
lines changed
 

‎articles/openshift/howto-deploy-java-liberty-app.md

Lines changed: 25 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -45,64 +45,7 @@ Complete the following prerequisites to successfully walk through this guide.
4545
* Be sure to follow the steps in "Install the OpenShift CLI" because we'll use the `oc` command later in this article.
4646
* Write down the cluster console URL. It will look like `https://console-openshift-console.apps.<random>.<region>.aroapp.io/`.
4747
* Take note of the `kubeadmin` credentials.
48-
49-
1. Verify you can sign in to the OpenShift CLI with the token for user `kubeadmin`.
50-
51-
### Configure Azure Active Directory authentication
52-
53-
Azure Active Directory (Azure AD) implements OpenID Connect (OIDC). OIDC lets you use Azure AD to sign in to the ARO cluster. Follow the steps in [Configure Azure Active Directory authentication](configure-azure-ad-cli.md) to set up your cluster.
54-
55-
After you complete the setup, return to this document and sign in to the cluster with an Azure AD user.
56-
57-
1. Sign in to the OpenShift web console from your browser using the credentials of an Azure AD user. We'll leverage the OpenShift OpenID authentication against Azure Active Directory to use OpenID to define the administrator.
58-
59-
1. Use an InPrivate, Incognito or other equivalent browser window feature to sign in to the console. The window will look different after having enabled OIDC.
60-
61-
:::image type="content" source="media/built-in-container-registry/oidc-enabled-login-window.png" alt-text="OpenID Connect enabled sign in window.":::
62-
1. Select **AAD**
63-
64-
> [!NOTE]
65-
> Take note of the username and password you use to sign in here. This username and password will function as an administrator for other actions in this article.
66-
1. Sign in with the OpenShift CLI by using the following steps. For discussion, this process is known as `oc login`.
67-
1. At the right-top of the web console, expand the context menu of the signed-in user, then select **Copy Login Command**.
68-
1. Sign in to a new tab window with the same user if necessary.
69-
1. Select **Display Token**.
70-
1. Copy the value listed below **Login with this token** to the clipboard and run it in a shell, as shown here.
71-
72-
```bash
73-
oc login --token=<login-token> --server=<server-url>
74-
```
75-
76-
1. Run `oc whoami` in the console and note the output as **\<aad-user>**. We'll use this value later in the article.
77-
1. Sign out of the OpenShift web console. Select the button in the top right of the browser window labeled as the **\<aad-user>** and choose **Log Out**.
78-
79-
### Create an OpenShift namespace for the Java app
80-
81-
1. Sign in to the OpenShift web console from your browser using the `kubeadmin` credentials.
82-
2. Navigate to **Administration** > **Namespaces** > **Create Namespace**.
83-
3. Fill in `open-liberty-demo` for **Name** and select **Create**, as shown next.
84-
85-
![create namespace](./media/howto-deploy-java-liberty-app/create-namespace.png)
86-
87-
### Create an administrator for the demo project
88-
89-
Besides image management, the **aad-user** will also be granted administrative permissions for managing resources in the demo project of the ARO 4 cluster. Sign in to the OpenShift CLI and grant the **aad-user** the necessary privileges by following these steps.
90-
91-
1. Sign in to the OpenShift web console from your browser using the `kubeadmin` credentials.
92-
1. At the right-top of the web console, expand the context menu of the signed-in user, then select **Copy Login Command**.
93-
1. Sign in to a new tab window with the same user if necessary.
94-
1. Select **Display Token**.
95-
1. Copy the value listed below **Login with this token** to the clipboard and run it in a shell, as shown here.
96-
1. Execute the following commands to grant `admin` role to the **aad-user** in namespace `open-liberty-demo`.
97-
98-
```bash
99-
# Switch to project "open-liberty-demo"
100-
oc project open-liberty-demo
101-
Now using project "open-liberty-demo" on server "https://api.x8xl3f4y.eastus.aroapp.io:6443".
102-
103-
oc adm policy add-role-to-user admin <aad-user>
104-
clusterrole.rbac.authorization.k8s.io/admin added: "kaaIjx75vFWovvKF7c02M0ya5qzwcSJ074RZBfXUc34"
105-
```
48+
* Be sure to follow the steps in "Connect using the OpenShift CLI" with the `kubeadmin` credentials.
10649

10750
### Install the Open Liberty OpenShift Operator
10851

@@ -120,6 +63,16 @@ After creating and connecting to the cluster, install the Open Liberty Operator.
12063

12164
:::image type="content" source="media/howto-deploy-java-liberty-app/open-liberty-operator-installed.png" alt-text="Installed Operators showing Open Liberty is installed.":::
12265

66+
### Create an OpenShift namespace for the Java app
67+
68+
Follow the instructions below to create an OpenShift namespace for use with your app.
69+
70+
1. Make sure you have signed in to the OpenShift web console from your browser using the `kubeadmin` credentials.
71+
2. Navigate to **Administration** > **Namespaces** > **Create Namespace**.
72+
3. Fill in `open-liberty-demo` for **Name** and select **Create**, as shown next.
73+
74+
![create namespace](./media/howto-deploy-java-liberty-app/create-namespace.png)
75+
12376
### Create an Azure Database for MySQL
12477

12578
Follow the instructions below to set up an Azure Database for MySQL for use with your app. If your application doesn't require a database, you can skip this section.
@@ -202,7 +155,7 @@ cd <path-to-your-repo>/open-liberty-on-aro/3-integration/connect-db/mysql
202155
export DB_SERVER_NAME=<Server name>.mysql.database.azure.com
203156
export DB_PORT_NUMBER=3306
204157
export DB_NAME=<Database name>
205-
export DB_USER=<Server admin username>@<Database name>
158+
export DB_USER=<Server admin username>@<Server name>
206159
export DB_PASSWORD=<Server admin password>
207160
export NAMESPACE=open-liberty-demo
208161

@@ -264,31 +217,11 @@ Complete the following steps to build the application image:
264217

265218
# [with DB connection](#tab/with-mysql-image)
266219

267-
### Log in to the OpenShift CLI as the Azure AD user
268-
269-
Since you have already successfully run the app in the Liberty Docker container, sign in to the OpenShift CLI as the Azure AD user in order to build image remotely on the cluster.
270-
271-
1. Sign in to the OpenShift web console from your browser using the credentials of an Azure AD user.
272-
273-
1. Use an InPrivate, Incognito or other equivalent browser window feature to sign in to the console.
274-
1. Select **AAD**
275-
276-
> [!NOTE]
277-
> Take note of the username and password you use to sign in here. This username and password will function as an administrator for other actions in this and other articles.
278-
1. Sign in with the OpenShift CLI by using the following steps. For discussion, this process is known as `oc login`.
279-
1. At the right-top of the web console, expand the context menu of the signed-in user, then select **Copy Login Command**.
280-
1. Sign in to a new tab window with the same user if necessary.
281-
1. Select **Display Token**.
282-
1. Copy the value listed below **Login with this token** to the clipboard and run it in a shell, as shown here.
283-
284-
```bash
285-
oc login --token=<login-token> --server=<server-url>
286-
```
287-
288220
### Build the application and push to the image stream
289221

290-
Next, you're going to build the image remotely on the cluster by executing the following commands.
222+
Since you have already successfully run the app in the Liberty Docker container, you're going to build the image remotely on the cluster by executing the following commands.
291223

224+
1. Make sure you have already signed in to the OpenShift CLI using the `kubeadmin` credentials.
292225
1. Identify the source directory and Dockerfile.
293226

294227
```bash
@@ -352,31 +285,11 @@ Before deploying the containerized application to a remote cluster, build and ru
352285
1. Open `http://localhost:9080/` in your browser to visit the application home page.
353286
1. Press **Control-C** to stop the application and Liberty server.
354287

355-
### Log in to the OpenShift CLI as the Azure AD user
356-
357-
When you're satisfied with the state of the application, sign in to the OpenShift CLI as the Azure AD user in order to build image remotely on the cluster.
358-
359-
1. Sign in to the OpenShift web console from your browser using the credentials of an Azure AD user.
360-
361-
1. Use an InPrivate, Incognito or other equivalent browser window feature to sign in to the console.
362-
1. Select **AAD**
363-
364-
> [!NOTE]
365-
> Take note of the username and password you use to sign in here. This username and password will function as an administrator for other actions in this and other articles.
366-
1. Sign in with the OpenShift CLI by using the following steps. For discussion, this process is known as `oc login`.
367-
1. At the right-top of the web console, expand the context menu of the signed-in user, then select **Copy Login Command**.
368-
1. Sign in to a new tab window with the same user if necessary.
369-
1. Select **Display Token**.
370-
1. Copy the value listed below **Login with this token** to the clipboard and run it in a shell, as shown here.
371-
372-
```bash
373-
oc login --token=<login-token> --server=<server-url>
374-
```
375-
376288
### Build the application and push to the image stream
377289

378-
Next, you're going to build the image remotely on the cluster by executing the following commands.
290+
When you're satisfied with the state of the application, you're going to build the image remotely on the cluster by executing the following commands.
379291

292+
1. Make sure you have already signed in to the OpenShift CLI using the `kubeadmin` credentials.
380293
1. Identity the source directory and the Dockerfile.
381294

382295
```bash
@@ -412,13 +325,14 @@ Next, you're going to build the image remotely on the cluster by executing the f
412325
## Deploy application on the ARO 4 cluster
413326

414327
Now you can deploy the sample Liberty application to the Azure Red Hat OpenShift 4 cluster you created earlier when working through the prerequisites.
328+
415329
# [with DB from web console](#tab/with-mysql-deploy-console)
416330

417331
### Deploy the application from the web console
418332

419333
Because we use the Open Liberty Operator to manage Liberty applications, we need to create an instance of its *Custom Resource Definition*, of type "OpenLibertyApplication". The Operator will then take care of all aspects of managing the OpenShift resources required for deployment.
420334

421-
1. Sign in to the OpenShift web console from your browser using the credentials of the Azure AD user.
335+
1. Sign in to the OpenShift web console from your browser using the `kubeadmin` credentials.
422336
1. Expand **Home**, Select **Projects** > **open-liberty-demo**.
423337
1. Navigate to **Operators** > **Installed Operators**.
424338
1. In the middle of the page, select **Open Liberty Operator**.
@@ -448,8 +362,8 @@ You'll see the application home page opened in the browser.
448362
Instead of using the web console GUI, you can deploy the application from the CLI. If you haven't already done so, download and install the `oc` command-line tool by following the steps in Red Hat documentation: [Getting Started with the CLI](https://docs.openshift.com/container-platform/4.2/cli_reference/openshift_cli/getting-started-cli.html).
449363

450364
Now you can deploy the sample Liberty application to the ARO 4 cluster with the following steps.
451-
1. Log in to the OpenShift web console from your browser using the credentials of the Azure AD user.
452-
1. [Log in to the OpenShift CLI with the token for the Azure AD user](https://github.com/Azure-Samples/open-liberty-on-aro/blob/master/guides/howto-deploy-java-liberty-app.md#log-in-to-the-openshift-cli-with-the-token).
365+
366+
1. Make sure you have already signed in to the OpenShift CLI using the `kubeadmin` credentials.
453367
1. Run the following commands to deploy the application.
454368
```bash
455369
# Change directory to "<path-to-repo>/3-integration/connect-db/mysql/target"
@@ -483,7 +397,7 @@ Once the Liberty application is up and running, open the output of **Route Host*
483397

484398
Because we use the Open Liberty Operator to manage Liberty applications, we need to create an instance of its *Custom Resource Definition*, of type "OpenLibertyApplication". The Operator will then take care of all aspects of managing the OpenShift resources required for deployment.
485399

486-
1. Sign in to the OpenShift web console from your browser using the credentials of the Azure AD user.
400+
1. Sign in to the OpenShift web console from your browser using the `kubeadmin` credentials.
487401
1. Expand **Home**, Select **Projects** > **open-liberty-demo**.
488402
1. Navigate to **Operators** > **Installed Operators**.
489403
1. In the middle of the page, select **Open Liberty Operator**.
@@ -516,9 +430,8 @@ When you're done with the application, follow these steps to delete the applicat
516430
517431
Instead of using the web console GUI, you can deploy the application from the CLI. If you haven't already done so, download and install the `oc` command-line tool by following Red Hat documentation [Getting Started with the CLI](https://docs.openshift.com/container-platform/4.2/cli_reference/openshift_cli/getting-started-cli.html).
518432

519-
1. Sign in to the OpenShift web console from your browser using the credentials of the Azure AD user.
520-
2. Sign in to the OpenShift CLI with the token for the Azure AD user.
521-
3. Change directory to `2-simple` of your local clone, and run the following commands to deploy your Liberty application to the ARO 4 cluster. Command output is also shown inline.
433+
1. Make sure you have already signed in to the OpenShift CLI using the `kubeadmin` credentials.
434+
1. Change directory to `2-simple` of your local clone, and run the following commands to deploy your Liberty application to the ARO 4 cluster. Command output is also shown inline.
522435

523436
```bash
524437
# Switch to namespace "open-liberty-demo" where resources of demo app will belong to
@@ -544,8 +457,8 @@ Instead of using the web console GUI, you can deploy the application from the CL
544457
javaee-cafe-simple 1/1 1 0 102s
545458
```
546459

547-
4. Check to see `1/1` under the `READY` column before you continue. If not, investigate and resolve the problem before continuing.
548-
5. Discover the host of route to the application with the `oc get route` command, as shown here.
460+
1. Check to see `1/1` under the `READY` column before you continue. If not, investigate and resolve the problem before continuing.
461+
1. Discover the host of route to the application with the `oc get route` command, as shown here.
549462

550463
```bash
551464
# Get host of the route
Binary file not shown.

0 commit comments

Comments
 (0)
Please sign in to comment.