Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 552654f

Browse files
committedAug 25, 2022
Synchronize
·
v3.4.7v3.4.3
1 parent 9335e0e commit 552654f

File tree

15 files changed

+299
-292
lines changed

15 files changed

+299
-292
lines changed
 

‎documentation/3.4/content/samples/azure-kubernetes-service/domain-on-pv.md

Lines changed: 153 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,39 @@ This sample demonstrates how to use the [WebLogic Kubernetes Operator](/weblogic
2626

2727
##### Clone WebLogic Kubernetes Operator repository
2828

29-
Clone the [WebLogic Kubernetes Operator repository](https://github.com/oracle/weblogic-kubernetes-operator) to your machine. You will use several scripts in this repository to create a WebLogic domain. This sample was tested with v3.3.7, but should work with the latest release.
29+
Clone the [WebLogic Kubernetes Operator repository](https://github.com/oracle/weblogic-kubernetes-operator) to your machine. You will use several scripts in this repository to create a WebLogic domain. This sample was tested with v3.4.2, but should work with the latest release.
3030

3131
```shell
3232
$ git clone --branch v{{< latestVersion >}} https://github.com/oracle/weblogic-kubernetes-operator.git
3333
```
3434

35+
##### Sign in with Azure CLI
36+
37+
The steps in this section show you how to sign in to the Azure CLI.
38+
39+
1. Open a Bash shell.
40+
41+
1. Sign out and delete some authentication files to remove any lingering credentials.
42+
43+
```shell
44+
$ az logout
45+
$ rm ~/.azure/accessTokens.json
46+
$ rm ~/.azure/azureProfile.json
47+
```
48+
49+
1. Sign in to your Azure CLI.
50+
51+
```shell
52+
$ az login
53+
```
54+
55+
1. Set the subscription ID. Be sure to replace the placeholder with the appropriate value.
56+
57+
```shell
58+
$ export SUBSCRIPTION_ID=<your-subscription-id>
59+
$ az account set -s $SUBSCRIPTION_ID
60+
```
61+
3562
{{% notice info %}} The following sections of the sample instructions will guide you, step-by-step, through the process of setting up a WebLogic cluster on AKS - remaining as close as possible to a native Kubernetes experience. This lets you understand and customize each step. If you wish to have a more automated experience that abstracts some lower level details, you can skip to the [Automation](#automation) section.
3663
{{% /notice %}}
3764

@@ -495,9 +522,6 @@ For input values, you can edit `kubernetes/samples/scripts/create-weblogic-domai
495522

496523
| Name in YAML file | Example value | Notes |
497524
|-------------------|---------------|-------|
498-
| `azureServicePrincipalAppId` | `nr086o75-pn59-4782-no5n-nq2op0rsr1q6` | Application ID of your service principal; refer to the application ID in the [Create Service Principal]({{< relref "/samples/azure-kubernetes-service/domain-on-pv#create-a-service-principal-for-aks" >}}) section. |
499-
| `azureServicePrincipalClientSecret` | `8693089o-q190-45ps-9319-or36252s3s90` | A client secret of your service principal; refer to the client secret in the [Create Service Principal]({{< relref "/samples/azure-kubernetes-service/domain-on-pv#create-a-service-principal-for-aks" >}}) section. |
500-
| `azureServicePrincipalTenantId` | `72s988os-86s1-cafe-babe-2q7pq011qo47` | Tenant (Directory ) ID of your service principal; refer to the client secret in the [Create Service Principal]({{< relref "/samples/azure-kubernetes-service/domain-on-pv#create-a-service-principal-for-aks" >}}) section. |
501525
| `dockerEmail` | `yourDockerEmail` | Oracle Single Sign-On (SSO) account email, used to pull the WebLogic Server Docker image. |
502526
| `dockerPassword` | `yourDockerPassword`| Password for Oracle SSO account, used to pull the WebLogic Server Docker image, in clear text. |
503527
| `dockerUserName` | `yourDockerId` | The same value as `dockerEmail`. |
@@ -524,46 +548,140 @@ The script will print the Administration Server address after a successful deplo
524548

525549
#### Deploy sample application
526550

527-
Now that you have WLS running in AKS, you can test the cluster by deploying the simple sample application included in the repository:
528-
529-
1. Go to the WebLogic Server Administration Console, Select "Lock & Edit".
530-
1. Select Deployments.
531-
1. Select Install.
532-
1. Select Upload your file(s).
533-
1. For the Deployment Archive, Select "Choose File".
534-
1. Select the file `kubernetes/samples/charts/application/testwebapp.war`.
535-
1. Select Next. Choose 'Install this deployment as an application'.
536-
1. Select Next. Select cluster-1 and All servers in the cluster. Select Next.
537-
1. Accept the defaults in the next screen and select Next
538-
1. Select Finish.
539-
1. Select Activate Changes.
540-
541-
{{%expand "Click here to view the application deployment screenshot." %}}
542-
![Deploy Application](../screenshot-deploy-test-app.png)
543-
{{% /expand %}}
551+
Now that you have WLS running in AKS, you can test the cluster by deploying the sample application included in the repository.
552+
553+
First, package the application with the following command:
544554

545-
Next you will need to start the application:
555+
```bash
556+
cd integration-tests/src/test/resources/bash-scripts
557+
bash build-war-app.sh -s ../apps/testwebapp/ -d /tmp/testwebapp
558+
```
546559

547-
1. Go to Deployments.
548-
1. Select Control.
549-
1. Select the check box next to `testwebapp`.
550-
1. Select Start.
551-
1. Select Servicing all requests.
552-
1. Select Yes.
560+
Successful output will look like the following:
553561

554-
After the successful deployment, go to the application through the `domain1-cluster-1-lb` external IP.
562+
```text
563+
Found source at ../apps/testwebapp/
564+
build /tmp/testwebapp/testwebapp.war with command jar -cvf /tmp/testwebapp/testwebapp.war *
565+
added manifest
566+
ignoring entry META-INF/
567+
ignoring entry META-INF/MANIFEST.MF
568+
adding: META-INF/maven/(in = 0) (out= 0)(stored 0%)
569+
adding: META-INF/maven/com.oracle.weblogic/(in = 0) (out= 0)(stored 0%)
570+
adding: META-INF/maven/com.oracle.weblogic/testwebapp/(in = 0) (out= 0)(stored 0%)
571+
adding: META-INF/maven/com.oracle.weblogic/testwebapp/pom.properties(in = 117) (out= 113)(deflated 3%)
572+
adding: META-INF/maven/com.oracle.weblogic/testwebapp/pom.xml(in = 1210) (out= 443)(deflated 63%)
573+
adding: WEB-INF/(in = 0) (out= 0)(stored 0%)
574+
adding: WEB-INF/web.xml(in = 951) (out= 428)(deflated 54%)
575+
adding: WEB-INF/weblogic.xml(in = 1140) (out= 468)(deflated 58%)
576+
adding: index.jsp(in = 1001) (out= 459)(deflated 54%)
577+
-rw-r--r-- 1 user user 3528 Jul 5 14:25 /tmp/testwebapp/testwebapp.war
578+
```
555579

556-
```shell
557-
$ kubectl get svc domain1-cluster-1-external-lb
580+
Now, you are able to deploy the sample application in `/tmp/testwebapp/testwebapp.war` to the cluster. This sample uses WLS RESTful API [/management/weblogic/latest/edit/appDeployments](https://docs.oracle.com/en/middleware/standalone/weblogic-server/14.1.1.0/wlrer/op-management-weblogic-version-edit-appdeployments-x-operations-1.html) to deploy the sample application. The WLS administration account and password in this sample are `weblogic:welcome1`, replace them with your value created in [Create WebLogic domain secrets](#create-secrets):
581+
582+
```bash
583+
$ ADMIN_SERVER_IP=$(kubectl get svc domain1-admin-server-external-lb -o=jsonpath='{.status.loadBalancer.ingress[0].ip}')
584+
$ curl --user weblogic:welcome1 -H X-Requested-By:MyClient -H Accept:application/json -s -v \
585+
-H Content-Type:multipart/form-data \
586+
-F "model={
587+
name: 'testwebapp',
588+
targets: [ { identity: [ 'clusters', 'cluster-1' ] } ]
589+
}" \
590+
-F "sourcePath=@/tmp/testwebapp/testwebapp.war" \
591+
-H "Prefer:respond-async" \
592+
-X POST http://${ADMIN_SERVER_IP}:7001/management/weblogic/latest/edit/appDeployments
558593
```
594+
595+
After the successful deployment, you will find output similar to the following:
596+
597+
{{%expand "Click here to view the output." %}}
598+
```text
599+
* Trying 52.226.101.43:7001...
600+
* TCP_NODELAY set
601+
* Connected to 52.226.101.43 (52.226.101.43) port 7001 (#0)
602+
* Server auth using Basic with user 'weblogic'
603+
> POST /management/weblogic/latest/edit/appDeployments HTTP/1.1
604+
> Host: 52.226.101.43:7001
605+
> Authorization: Basic d2VibG9naWM6d2VsY29tZTE=
606+
> User-Agent: curl/7.68.0
607+
> X-Requested-By:MyClient
608+
> Accept:application/json
609+
> Prefer:respond-async
610+
> Content-Length: 3925
611+
> Content-Type: multipart/form-data; boundary=------------------------cc76a2c2d819911f
612+
> Expect: 100-continue
613+
>
614+
* Mark bundle as not supporting multiuse
615+
< HTTP/1.1 100 Continue
616+
* We are completely uploaded and fine
617+
* Mark bundle as not supporting multiuse
618+
< HTTP/1.1 202 Accepted
619+
< Date: Thu, 11 Aug 2022 08:32:56 GMT
620+
< Location: http://domain1-admin-server:7001/management/weblogic/latest/domainRuntime/deploymentManager/deploymentProgressObjects/testwebapp
621+
< Content-Length: 764
622+
< Content-Type: application/json
623+
< X-ORACLE-DMS-ECID: 6f205c83-e172-4c34-a638-7f0c6345ce45-00000055
624+
< X-ORACLE-DMS-RID: 0
625+
< Set-Cookie: JSESSIONID=NOCMCQBO7dxyA2lUfCYp4zSYIeFB0S3V1KRRzigmmoOUfmQmlLOh!-546081476; path=/; HttpOnly
626+
< Vary: Accept-Encoding
627+
<
628+
{
629+
"links": [{
630+
"rel": "job",
631+
"href": "http:\/\/domain1-admin-server:7001\/management\/weblogic\/latest\/domainRuntime\/deploymentManager\/deploymentProgressObjects\/testwebapp"
632+
}],
633+
"identity": [
634+
"deploymentManager",
635+
"deploymentProgressObjects",
636+
"testwebapp"
637+
],
638+
"rootExceptions": [],
639+
"deploymentMessages": [],
640+
"name": "testwebapp",
641+
"operationType": 3,
642+
"startTimeAsLong": 1660206785965,
643+
"state": "STATE_RUNNING",
644+
"id": "0",
645+
"type": "DeploymentProgressObject",
646+
"targets": ["cluster-1"],
647+
"applicationName": "testwebapp",
648+
"failedTargets": [],
649+
"progress": "processing",
650+
"completed": false,
651+
"intervalToPoll": 1000,
652+
"startTime": "2022-08-11T08:33:05.965Z"
653+
* Connection #0 to host 52.226.101.43 left intact
559654
```
560-
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
561-
domain1-cluster-1-external-lb LoadBalancer 10.0.108.249 52.224.248.40 8001:32695/TCP 30m
655+
{{% /expand %}}
656+
657+
Now, you can go to the application through the `domain1-cluster-1-lb` external IP.
658+
659+
```shell
660+
$ CLUSTER_IP=$(kubectl get svc domain1-cluster-1-external-lb -o=jsonpath='{.status.loadBalancer.ingress[0].ip}')
661+
662+
$ curl http://${CLUSTER_IP}:8001/testwebapp/
562663
```
563664

564-
In the example, the application address is: `http://52.224.248.40:8001/testwebapp`.
665+
The test application will list the server host and server IP on the output, like this:
666+
667+
```html
668+
<!DOCTYPE html>
669+
<html>
670+
<head>
671+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
565672

566-
The test application will list the server host and server IP on the page.
673+
<link rel="stylesheet" href="/testwebapp/res/styles.css;jsessionid=9uiMDakndtPlZTyDB9A-OKZEFBBAPyIs_9bG3qC4uA3PYaI8DsH1!-1450005246" type="text/css">
674+
<title>Test WebApp</title>
675+
</head>
676+
<body>
677+
678+
679+
<li>InetAddress: domain1-managed-server1/10.244.1.8
680+
<li>InetAddress.hostname: domain1-managed-server1
681+
682+
</body>
683+
</html>
684+
```
567685

568686
#### Validate NFS volume
569687

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
```shell
22
$ az group delete --yes --no-wait --name $AKS_PERS_RESOURCE_GROUP
33
$ az group delete --yes --no-wait --name "MC_$AKS_PERS_RESOURCE_GROUP"_"$AKS_CLUSTER_NAME"_"$AKS_PERS_LOCATION"
4-
$ az ad sp delete --id $SP_APP_ID
54
```
65

‎documentation/3.4/content/samples/azure-kubernetes-service/includes/create-aks-cluster-body-01.txt

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,3 @@
1-
##### Create a Service Principal for AKS
2-
3-
An AKS cluster requires either an [Azure Active Directory (AD) service principal](https://docs.microsoft.com/azure/active-directory/develop/app-objects-and-service-principals) or a [managed identity](https://docs.microsoft.com/azure/aks/use-managed-identity) to interact with Azure resources.
4-
5-
We will use a service principal to create an AKS cluster. Follow the commands below to create a new service principal.
6-
7-
Please run `az login` first. Do set the subscription you want to work with. You can get a list of your subscriptions by running `az account list`.
8-
9-
```shell
10-
# Login
11-
$ az login
12-
13-
# Set your working subscription
14-
$ export SUBSCRIPTION_ID=<your-subscription-id>
15-
$ az account set -s $SUBSCRIPTION_ID
16-
```
17-
18-
Create the new service principal with the following commands:
19-
20-
```shell
21-
# Create Service Principal
22-
$ export SP_NAME=myAKSClusterServicePrincipal
23-
$ az ad sp create-for-rbac --skip-assignment --name $SP_NAME
24-
25-
# Copy the output to a file, we will use it later.
26-
```
27-
28-
If you see an error similar to the following:
29-
30-
```shell
31-
Found an existing application instance of "5pn2s201-nq4q-43n1-z942-p9r9571qr3rp". We will patch it
32-
Insufficient privileges to complete the operation.
33-
```
34-
35-
The problem may be a pre-existing service principal with the same name. Either delete the other service principal or pick a different name.
36-
37-
Successful output will look like the following:
38-
39-
```json
40-
{
41-
"appId": "r3qnq743-61s9-4758-8163-4qpo87s72s54",
42-
"displayName": "myAKSClusterServicePrincipal",
43-
"name": "http://myAKSClusterServicePrincipal",
44-
"password": "TfhR~uOJ1C1ftD5NS_LzJJj6UOjS2OwXfz",
45-
"tenant": "82sr215n-0ns5-404e-9161-206r0oqyq999"
46-
}
47-
```
48-
49-
Grant your service principal with a contributor role to create AKS resources.
50-
51-
```shell
52-
# Use the <appId> from the output of the last command
53-
$ export SP_APP_ID=r3qnq743-61s9-4758-8163-4qpo87s72s54
54-
$ az role assignment create --assignee $SP_APP_ID --role Contributor
55-
```
56-
57-
Successful output will look like the following:
58-
59-
```json
60-
{
61-
"canDelegate": null,
62-
"id": "/subscriptions/p7844r91-o11q-4n7s-np6s-996308sopqo9/providers/Microsoft.Authorization/roleAssignments/4oq396os-rs95-4n6s-n3qo-sqqpnpo91035",
63-
"name": "4oq396os-rs95-4n6s-n3qo-sqqpnpo91035",
64-
"principalId": "952551r8-n129-4on3-oqo9-231n0s6011n3",
65-
"principalType": "ServicePrincipal",
66-
"roleDefinitionId": "/subscriptions/p7844r91-o11q-4n7s-np6s-996308sopqo9/providers/Microsoft.Authorization/roleDefinitions/o24988np-6180-42n0-no88-20s7382qq24p",
67-
"scope": "/subscriptions/p7844r91-o11q-4n7s-np6s-996308sopqo9",
68-
}
69-
```
70-
711
##### Oracle Container Registry
722

733
You will need an Oracle account. The following steps will direct you to accept the license agreement for WebLogic Server. Make note of your Oracle Account password and email. This sample pertains to 12.2.1.4, but other versions may work as well.

‎documentation/3.4/content/samples/azure-kubernetes-service/includes/create-aks-cluster-body-02.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ $ export TIMESTAMP=`date +%s`
1313
$ export AKS_CLUSTER_NAME="${NAME_PREFIX}aks${TIMESTAMP}"
1414
$ export AKS_PERS_RESOURCE_GROUP="${NAME_PREFIX}resourcegroup${TIMESTAMP}"
1515
$ export AKS_PERS_LOCATION=eastus
16-
$ export SP_APP_ID=<appId from the az ad sp create-for-rbac command>
17-
$ export SP_CLIENT_SECRET=<password from the az ad sp create-for-rbac command>
1816

1917
$ az group create --name $AKS_PERS_RESOURCE_GROUP --location $AKS_PERS_LOCATION
2018
$ az aks create \
@@ -25,8 +23,7 @@ $ az aks create \
2523
--nodepool-name nodepool1 \
2624
--node-vm-size Standard_DS2_v2 \
2725
--location $AKS_PERS_LOCATION \
28-
--service-principal $SP_APP_ID \
29-
--client-secret $SP_CLIENT_SECRET
26+
--enable-managed-identity
3027
```
3128

3229
Successful output will be a JSON object with the entry `"type": "Microsoft.ContainerService/ManagedClusters"`.

‎documentation/3.4/content/samples/azure-kubernetes-service/includes/create-aks-cluster-storage.txt

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,33 @@ You will dynamically create and use a persistent volume with Azure Files NFS sha
5858

5959
The command provisions an NFS file share with NFS 4.1 or above.
6060

61-
3. Configure network security.
61+
3. Assign the AKS cluster **Contributor** role to access the storage account.
6262

63-
You must configure the network security allowing access from AKS cluster to the storage account.
63+
You must configure role assignment allowing access from AKS cluster to the storage account.
64+
65+
Get `objectId` of the AKS cluster with the following command and save it with variable `AKS_OBJECT_ID`:
66+
67+
```shell
68+
$ AKS_OBJECT_ID=$(az aks show --name ${AKS_CLUSTER_NAME} --resource-group ${AKS_PERS_RESOURCE_GROUP} --query "identity.principalId" -o tsv)
69+
```
70+
71+
Get Id of the storage account with the following command:
72+
73+
```shell
74+
$ STORAGE_ACCOUNT_ID=$(az storage account show --name ${AKS_PERS_STORAGE_ACCOUNT_NAME} --resource-group ${AKS_PERS_RESOURCE_GROUP} --query "id" -o tsv)
75+
```
76+
77+
Now, you are able to create a role assignment to grant the AKS cluster **Contributor** in the scope of the storage account. Then, the AKS cluster is able to access the file share.
78+
79+
```shell
80+
$ az role assignment create --assignee "${AKS_OBJECT_ID}" \
81+
--role "Contributor" \
82+
--scope "${STORAGE_ACCOUNT_ID}"
83+
```
84+
85+
4. Configure network security.
86+
87+
You must configure the network security allowing access from AKS cluster to the file share.
6488

6589
First, you must get the virtual network name and the subnet name of the AKS cluster.
6690

@@ -72,7 +96,10 @@ You will dynamically create and use a persistent volume with Azure Files NFS sha
7296
$ echo ${aksMCRGName}
7397

7498
# get network name of AKS cluster
75-
$ aksNetworkName=$(az resource list --resource-group ${aksMCRGName} --resource-type Microsoft.Network/virtualNetworks -o tsv --query '[*].name')
99+
$ aksNetworkName=$(az graph query -q "Resources \
100+
| where type =~ 'Microsoft.Network/virtualNetworks' \
101+
| where resourceGroup =~ '${aksMCRGName}' \
102+
| project name = name" --query "data[0].name" -o tsv)
76103
$ echo ${aksNetworkName}
77104

78105
# get subnet name of AKS agent pool

‎documentation/3.4/content/samples/azure-kubernetes-service/includes/prerequisites-01.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
This sample assumes the following prerequisite environment.
44

55
* Operating System: GNU/Linux, macOS or [WSL2 for Windows 10](https://docs.microsoft.com/windows/wsl/install-win10).
6-
* [Git](https://git-scm.com/downloads); use `git --version` to test if `git` works. This document was tested with version 2.17.1.
7-
* [Azure CLI](https://docs.microsoft.com/cli/azure); use `az --version` to test if `az` works. This document was tested with version 2.9.1.
8-
* [Docker for Desktop](https://www.docker.com/products/docker-desktop). This document was tested with `Docker version 20.10.2, build 2291f61`
9-
* [kubectl](https://kubernetes-io-vnext-staging.netlify.com/docs/tasks/tools/install-kubectl/); use `kubectl version` to test if `kubectl` works. This document was tested with version v1.16.3.
10-
* [Helm](https://helm.sh/docs/intro/install/), version 3.1 and later; use `helm version` to check the `helm` version. This document was tested with version v3.2.5.
6+
* [Git](https://git-scm.com/downloads); use `git --version` to test if `git` works. This document was tested with version 2.25.1.
7+
* [Azure CLI](https://docs.microsoft.com/cli/azure); use `az --version` to test if `az` works. This document was tested with version 2.39.0.
8+
* [Docker for Desktop](https://www.docker.com/products/docker-desktop). This document was tested with `Docker version 20.10.7`
9+
* [kubectl](https://kubernetes-io-vnext-staging.netlify.com/docs/tasks/tools/install-kubectl/); use `kubectl version` to test if `kubectl` works. This document was tested with version v1.21.2.
10+
* [Helm](https://helm.sh/docs/intro/install/), version 3.1 and later; use `helm version` to check the `helm` version. This document was tested with version v3.6.2.
11+
* A Java JDK, Version 8 or 11. Azure recommends [Microsoft Build of OpenJDK](https://docs.microsoft.com/java/openjdk/download). Ensure that your `JAVA_HOME` environment variable is set correctly in the shells in which you run the commands.

‎documentation/3.4/content/samples/azure-kubernetes-service/includes/prerequisites-02.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
This sample assumes the following prerequisite environment.
44

55
* Operating System: GNU/Linux, macOS or [WSL2 for Windows 10](https://docs.microsoft.com/windows/wsl/install-win10).
6-
* [Git](https://git-scm.com/downloads); use `git --version` to test if `git` works. This document was tested with version 2.17.1.
7-
* [Azure CLI](https://docs.microsoft.com/cli/azure); use `az --version` to test if `az` works. This document was tested with version 2.9.1.
8-
* [Docker for Desktop](https://www.docker.com/products/docker-desktop). This document was tested with `Docker version 20.10.2, build 2291f61`
9-
* [kubectl](https://kubernetes-io-vnext-staging.netlify.com/docs/tasks/tools/install-kubectl/); use `kubectl version` to test if `kubectl` works. This document was tested with version v1.16.3.
10-
* [Helm](https://helm.sh/docs/intro/install/), version 3.1 and later; use `helm version` to check the `helm` version. This document was tested with version v3.2.5.
11-
* A Java JDK, Version 8 or 11. Azure recommends [Azul Zulu for Azure](https://www.azul.com/downloads/azure-only/zulu/). Ensure that your `JAVA_HOME` environment variable is set correctly in the shells in which you run the commands.
6+
* [Git](https://git-scm.com/downloads); use `git --version` to test if `git` works. This document was tested with version 2.25.1.
7+
* [Azure CLI](https://docs.microsoft.com/cli/azure); use `az --version` to test if `az` works. This document was tested with version 2.39.0.
8+
* [Docker for Desktop](https://www.docker.com/products/docker-desktop). This document was tested with `Docker version 20.10.7`
9+
* [kubectl](https://kubernetes-io-vnext-staging.netlify.com/docs/tasks/tools/install-kubectl/); use `kubectl version` to test if `kubectl` works. This document was tested with version v1.21.2.
10+
* [Helm](https://helm.sh/docs/intro/install/), version 3.1 and later; use `helm version` to check the `helm` version. This document was tested with version v3.6.2.
11+
* A Java JDK, Version 8 or 11. Azure recommends [Microsoft Build of OpenJDK](https://docs.microsoft.com/java/openjdk/download). Ensure that your `JAVA_HOME` environment variable is set correctly in the shells in which you run the commands.
1212
* Ensure that you have the zip/unzip utility installed; use `zip/unzip -v` to test if `zip/unzip` works.

‎documentation/3.4/content/samples/azure-kubernetes-service/model-in-image.md

Lines changed: 15 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ This sample demonstrates how to use the [WebLogic Kubernetes Operator](/weblogic
2727

2828
##### Clone WebLogic Kubernetes Operator repository
2929

30-
Clone the [WebLogic Kubernetes Operator repository](https://github.com/oracle/weblogic-kubernetes-operator) to your machine. We will use several scripts in this repository to create a WebLogic domain. This sample was tested with v3.1.1, but should work with the latest release.
30+
Clone the [WebLogic Kubernetes Operator repository](https://github.com/oracle/weblogic-kubernetes-operator) to your machine. We will use several scripts in this repository to create a WebLogic domain. This sample was tested with v3.4.2, but should work with the latest release.
3131

3232
```shell
3333
$ git clone --branch v{{< latestVersion >}} https://github.com/oracle/weblogic-kubernetes-operator.git
@@ -71,31 +71,34 @@ default 1 9m24s
7171
sample-weblogic-operator-sa 1 9m5s
7272
```
7373

74-
Install the operator. Ensure your current directory is `weblogic-kubernetes-operator`. It may take you several minutes to install the operator.
74+
Install the operator. The operator’s Helm chart is located in the kubernetes/charts/weblogic-operator directory. This sample installs the operator using Helm charts from Github. It may take you several minutes to install the operator.
7575

7676
```
77-
# cd weblogic-kubernetes-operator
77+
helm repo add weblogic-operator https://oracle.github.io/weblogic-kubernetes-operator/charts --force-update
7878
```
7979
```
80-
$ helm install weblogic-operator kubernetes/charts/weblogic-operator \
80+
$ helm install weblogic-operator weblogic-operator/weblogic-operator \
8181
--namespace sample-weblogic-operator-ns \
82-
--set image=ghcr.io/oracle/weblogic-kubernetes-operator:3.1.1 \
82+
--set image=ghcr.io/oracle/weblogic-kubernetes-operator:3.4.2 \
8383
--set serviceAccount=sample-weblogic-operator-sa \
8484
--set "enableClusterRoleBinding=true" \
8585
--set "domainNamespaceSelectionStrategy=LabelSelector" \
8686
--set "domainNamespaceLabelSelector=weblogic-operator\=enabled" \
8787
--wait
8888
```
89+
90+
The output will show something similar to the following:
91+
8992
```
9093
NAME: weblogic-operator
91-
LAST DEPLOYED: Tue Nov 17 09:33:58 2020
94+
LAST DEPLOYED: Fri Aug 12 14:28:47 2022
9295
NAMESPACE: sample-weblogic-operator-ns
9396
STATUS: deployed
9497
REVISION: 1
9598
TEST SUITE: None
9699
```
97100

98-
{{% notice tip %}} If you wish to use a more recent version of the operator, replace the `3.1.1` in the preceding command with the other version number. To see the list of version numbers, visit the [GitHub releases page](https://github.com/oracle/weblogic-kubernetes-operator/releases).
101+
{{% notice tip %}} If you wish to use a more recent version of the operator, replace the `3.4.2` in the preceding command with the other version number. To see the list of version numbers, visit the [GitHub releases page](https://github.com/oracle/weblogic-kubernetes-operator/releases).
99102
{{% /notice %}}
100103

101104

@@ -383,14 +386,14 @@ $ az acr login --name $AKS_PERS_ACR
383386
Ensure Docker is running on your local machine. Run the following commands to tag and push the image to your ACR.
384387
385388
```shell
386-
$ docker tag model-in-image:WLS-v1 $AKS_PERS_ACR/$AKS_PERS_ACR:model-in-image-aks
389+
$ docker tag model-in-image:WLS-v1 $AKS_PERS_ACR/model-in-image-aks:1.0
387390
```
388391
```shell
389-
$ docker push $AKS_PERS_ACR/$AKS_PERS_ACR:model-in-image-aks
392+
$ docker push $AKS_PERS_ACR/model-in-image-aks:1.0
390393
```
391394
```
392-
The push refers to repository [contosorgresourcegroup1610068510.azurecr.io/contosorgresourcegroup1610068510.azurecr.io]
393-
model-in-image-aks: digest: sha256:208217afe336053e4c524caeea1a415ccc9cc73b206ee58175d0acc5a3eeddd9 size: 2415
395+
The push refers to repository [contosorgresourcegroup1610068510.azurecr.io/model-in-image-aks]
396+
1.0: digest: sha256:208217afe336053e4c524caeea1a415ccc9cc73b206ee58175d0acc5a3eeddd9 size: 2415
394397
```
395398
396399
Finally, connect AKS to the ACR. For more details on connecting ACR to an existing AKS, see [Configure ACR integration for existing AKS clusters](https://docs.microsoft.com/en-us/azure/aks/cluster-container-registry-integration#configure-acr-integration-for-existing-aks-clusters).
@@ -481,63 +484,6 @@ $ kubectl -n sample-domain1-ns label secret \
481484
- To make it obvious which secrets belong to which domains.
482485
- To make it easier to clean up a domain. Typical cleanup scripts use the `weblogic.domainUID` label as a convenience for finding all resources associated with a domain.
483486
484-
##### Kubernetes Secrets for Docker
485-
486-
Deploy a corresponding Kubernetes `docker secret` to the same namespace to access the image during domain creation.
487-
488-
Use `kubernetes/samples/scripts/create-kubernetes-secrets/create-docker-credentials-secret.sh` to create the secret. Please invoke the script with the `-h` option to see the available switches and usage.
489-
490-
```shell
491-
$ cd weblogic-kubernetes-operator
492-
```
493-
```shell
494-
$ cd kubernetes/samples/scripts/create-kubernetes-secrets
495-
```
496-
```shell
497-
$ ./create-docker-credentials-secret.sh -h
498-
```
499-
500-
Get the password for the ACR and store it in the Kubernetes secret.
501-
502-
```shell
503-
$ az acr credential show --name $AKS_PERS_ACR
504-
```
505-
```
506-
The login server endpoint suffix '.azurecr.io' is automatically omitted.
507-
{
508-
"passwords": [
509-
{
510-
"name": "password",
511-
"value": "f02Ls3jqnNQ0ToXIoyY2g8oJrVk0w5P/"
512-
},
513-
{
514-
"name": "password2",
515-
"value": "qbZx1bZT7=rha7Ta6Wa0zfCZqoNMNoj1"
516-
}
517-
],
518-
"username": "contosoresourcegroup1610068510"
519-
}
520-
```
521-
```shell
522-
$ export AKS_PERS_ACR_PASSWORD=<the-password-from-your-output>
523-
```
524-
525-
Use the `create-docker-credentials-secret.sh` script to store the ACR credentials as a Kubernetes secret.
526-
527-
```
528-
# cd kubernetes/samples/scripts/create-kubernetes-secrets
529-
```
530-
```shell
531-
$ export SECRET_NAME_DOCKER="regsecret"
532-
```
533-
```shell
534-
$ ./create-docker-credentials-secret.sh -s ${SECRET_NAME_DOCKER} -e $AKS_PERS_RESOURCE_GROUP -p $AKS_PERS_ACR_PASSWORD -u $AKS_PERS_RESOURCE_GROUP -d $AKS_PERS_ACR -n sample-domain1-ns
535-
```
536-
```
537-
secret/regsecret created
538-
The secret regsecret has been successfully created in the sample-domain1-ns namespace.
539-
```
540-
541487
##### Domain resource
542488
543489
Now, you create a Domain YAML file. Think of the Domain YAML file as the way to configure some aspects of your WebLogic domain using Kubernetes. The operator uses the Kubernetes "custom resource" feature to define a Kubernetes resource type called `Domain`. For more on the `Domain` Kubernetes resource, see [Domain Resource]({{< relref "/userguide/managing-domains/domain-resource" >}}). For more on custom resources see [the Kubernetes documentation](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/).
@@ -555,8 +501,7 @@ Modify the Domain YAML with your values.
555501
556502
| Name in YAML file | Example value | Notes |
557503
|-------------------|---------------|-------|
558-
|`spec.image`|`$AKS_PERS_ACR/$AKS_PERS_ACR:model-in-image-aks`|Must be the same as the value to which you pushed the image to by running the command `docker push $AKS_PERS_ACR/$AKS_PERS_ACR:model-in-image-aks`.|
559-
|`spec.imagePullSecrets.name`|`regsecret`|Make sure its value is the same value with `${SECRET_NAME_DOCKER}`.|
504+
|`spec.image`|`$AKS_PERS_ACR/model-in-image-aks:1.0`|Must be the same as the value to which you pushed the image to by running the command `docker push $AKS_PERS_ACR/model-in-image-aks:1.0`.|
560505
561506
Run the following command to create the domain custom resource:
562507

‎documentation/3.4/content/userguide/aks/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ Use the Database blade to configure Oracle WebLogic Server to connect to an exis
271271

272272
| Field | Description |
273273
|-------|-------------|
274-
| Choose database type | Select an existing database that you want Oracle WebLogic Server to connect to, from the drop-down list. The available options are:{{< line_break >}}{{< line_break >}} • Azure Database for PostgreSQL {{< line_break >}} • Oracle Database {{< line_break >}} • Azure SQL {{< line_break >}} • Other |
274+
| Choose database type | Select an existing database that you want Oracle WebLogic Server to connect to, from the drop-down list. The available options are:{{< line_break >}}{{< line_break >}} • Azure Database for PostgreSQL {{< line_break >}} • Oracle Database {{< line_break >}} • Azure SQL {{< line_break >}} • MySQL {{< line_break >}} • Other |
275275
| JNDI Name | Enter the JNDI name for your database JDBC connection. |
276276
| DataSource Connection String | Enter the JDBC connection string for your database. For information about obtaining the JDBC connection string, see [Obtain the JDBC Connection String for Your Database](https://docs.oracle.com/en/middleware/standalone/weblogic-server/wlazu/obtain-jdbc-connection-string-your-database.html#GUID-6523B742-EB68-4AF4-A85C-8B4561C133F3). |
277277
| Global transactions protocol | Determines the transaction protocol (global transaction processing behavior) for the data source. For more information, see [JDBC Data Source Transaction Options](https://docs.oracle.com/en/middleware/standalone/weblogic-server/14.1.1.0/jdbca/transactions.html#GUID-4C929E67-5FD7-477B-A749-1EA0F4FD25D4). **IMPORTANT: The correct value for this parameter depends on the selected database type. For PostgreSQL, select EmulateTwoPhaseCommit**. |

‎kubernetes/samples/scripts/create-weblogic-domain-on-azure-kubernetes-service/create-domain-on-aks-inputs.yaml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,6 @@ version: create-domain-on-aks-inputs-v1
88
# Parameters that must be changed from these values!
99
#
1010

11-
# The service principal is used to login to azure and create an azure kubernetes cluster.
12-
# If you don't have a service principal, please follow README.md
13-
# Application id of the service principal.
14-
azureServicePrincipalAppId: azure-service-principal-app-id
15-
16-
# A client secret of the service principal.
17-
azureServicePrincipalClientSecret: azure-service-principal-client-secret
18-
19-
# Tenant (Directory) id of the service principal.
20-
azureServicePrincipalTenantId: azure-service-principal-tenant-id
21-
2211
# Oracle Single Sign-On (SSO) account email, used to pull the WebLogic Server image.
2312
dockerEmail: docker-email
2413

@@ -54,7 +43,7 @@ azureKubernetesNodeVMSize: Standard_DS2_v2
5443
azureKubernetesNodepoolNamePrefix: pool1
5544

5645
#Java Option for WebLogic Server
57-
javaOptions: -Dweblogic.StdoutDebugEnabled=false -XX:MinRAMPercentage=25.0 -XX:MaxRAMPercentage=50.0
46+
javaOptions: -Dweblogic.StdoutDebugEnabled=false -XX:InitialRAMPercentage=25.0 -XX:MaxRAMPercentage=50.0
5847

5948
# The suffix of the Kubernetes secret name, the complete value is ${namePrefix}${imagePullSecretNameSuffix}. The secret name is used to access the container registry to pull the WebLogic Server image
6049
# Used to create Kubernetes secret for container registry account.

‎kubernetes/samples/scripts/create-weblogic-domain-on-azure-kubernetes-service/create-domain-on-aks.sh

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# Copyright (c) 2018, 2021, Oracle and/or its affiliates.
2+
# Copyright (c) 2018, 2022, Oracle and/or its affiliates.
33
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
#
55
# Description
@@ -29,7 +29,7 @@ scriptDir="$(cd "$(dirname "${script}")" && pwd)"
2929
source ${scriptDir}/../common/utility.sh
3030
source ${scriptDir}/../common/validate.sh
3131

32-
function usage {
32+
usage() {
3333
echo usage: ${script} -i file -o dir [-u uid] [-e] [-d] [-h]
3434
echo " -i Parameter inputs file, must be specified."
3535
echo " -o Output directory for the generated yaml files, must be specified."
@@ -91,7 +91,7 @@ fi
9191
#
9292
# Function to exit and print an error message
9393
# $1 - text of message
94-
function fail {
94+
fail() {
9595
echo [ERROR] $*
9696
exit 1
9797
}
@@ -100,7 +100,7 @@ function fail {
100100
# Function to initialize and validate the output directory
101101
# for the generated yaml files for this domain.
102102
#
103-
function initOutputDir {
103+
initOutputDir() {
104104
aksOutputDir="$outputDir/weblogic-on-aks"
105105

106106
scOutput="${aksOutputDir}/azure-csi-nfs.yaml"
@@ -120,7 +120,7 @@ function initOutputDir {
120120
#
121121
# Function to setup the environment to run the create Azure resource and domain job
122122
#
123-
function initialize {
123+
initialize() {
124124

125125
# Validate the required files exist
126126
validateErrors=false
@@ -179,7 +179,7 @@ function initialize {
179179
#
180180
# Function to generate the yaml files for creating Azure resources and WebLogic Server domain
181181
#
182-
function createYamlFiles {
182+
createYamlFiles() {
183183

184184
# Create a directory for this domain's output files
185185
mkdir -p ${aksOutputDir}
@@ -271,19 +271,9 @@ function createYamlFiles {
271271
rm -f ${aksOutputDir}/*.yaml-e
272272
}
273273

274-
function loginAzure {
275-
# login with a service principal
276-
az login --service-principal --username $azureServicePrincipalAppId \
277-
--password $azureServicePrincipalClientSecret \
278-
--tenant $azureServicePrincipalTenantId
279-
echo Login Azure with Servie Principal successfully.
274+
createResourceGroup() {
275+
az extension add --name resource-graph
280276

281-
if [ $? -ne 0 ]; then
282-
fail "Login to Azure failed!"
283-
fi
284-
}
285-
286-
function createResourceGroup {
287277
# Create a resource group
288278
echo Check if ${azureResourceGroupName} exists
289279
ret=$(az group exists --name ${azureResourceGroupName})
@@ -295,7 +285,7 @@ function createResourceGroup {
295285
az group create --name $azureResourceGroupName --location $azureLocation
296286
}
297287

298-
function createAndConnectToAKSCluster {
288+
createAndConnectToAKSCluster() {
299289
# Create aks cluster
300290
echo Check if ${aksClusterName} exists
301291
ret=$(az aks list -g ${azureResourceGroupName} | grep "${aksClusterName}")
@@ -312,22 +302,21 @@ function createAndConnectToAKSCluster {
312302
--nodepool-name ${azureKubernetesNodepoolName} \
313303
--node-vm-size ${azureKubernetesNodeVMSize} \
314304
--location $azureLocation \
315-
--service-principal $azureServicePrincipalAppId \
316-
--client-secret $azureServicePrincipalClientSecret
305+
--enable-managed-identity
317306

318307
# Connect to AKS cluster
319308
echo Connencting to Azure Kubernetes Service.
320309
az aks get-credentials --resource-group $azureResourceGroupName --name $aksClusterName
321310
}
322311

323-
function createFileShare {
312+
createFileShare() {
324313
# Create a storage account
325314
echo Check if the storage account ${storageAccountName} exists.
326315
ret=$(az storage account check-name --name ${storageAccountName})
327316
nameAvailable=$(echo "$ret" | grep "nameAvailable" | grep "false")
328317
if [ -n "$nameAvailable" ]; then
329318
echo $ret
330-
fail "Storage account ${aksClusterName} is unavailable."
319+
fail "Storage account ${storageAccountName} is unavailable."
331320
fi
332321

333322
echo Creating Azure Storage Account ${storageAccountName}.
@@ -365,13 +354,28 @@ function createFileShare {
365354
checkPvcState ${persistentVolumeClaimName} "Bound"
366355
}
367356

368-
function configureStorageAccountNetwork {
357+
configureStorageAccountNetwork() {
358+
local aksObjectId=$(az aks show --name ${aksClusterName} --resource-group ${azureResourceGroupName} --query "identity.principalId" -o tsv)
359+
local storageAccountId=$(az storage account show --name ${storageAccountName} --resource-group ${azureResourceGroupName} --query "id" -o tsv)
360+
361+
az role assignment create --assignee "${aksObjectId}" \
362+
--role "Contributor" \
363+
--scope "${storageAccountId}"
364+
365+
if [ $? != 0 ]; then
366+
fail "Failed to grant the AKS cluster with Contibutor role to access the storage account."
367+
fi
368+
369369
# get the resource group name of the AKS managed resources
370370
local aksMCRGName=$(az aks show --name $aksClusterName --resource-group $azureResourceGroupName -o tsv --query "nodeResourceGroup")
371371
echo ${aksMCRGName}
372372

373373
# get network name of AKS cluster
374-
local aksNetworkName=$(az resource list --resource-group ${aksMCRGName} --resource-type Microsoft.Network/virtualNetworks -o tsv --query '[*].name')
374+
local aksNetworkName=$(az graph query -q "Resources \
375+
| where type =~ 'Microsoft.Network/virtualNetworks' \
376+
| where resourceGroup =~ '${aksMCRGName}' \
377+
| project name = name" --query "data[0].name" -o tsv)
378+
375379
echo ${aksNetworkName}
376380

377381
# get subnet name of AKS agent pool
@@ -397,13 +401,13 @@ function configureStorageAccountNetwork {
397401
fi
398402
}
399403

400-
function installWebLogicOperator {
404+
installWebLogicOperator() {
401405
echo $(helm version)
402406
helm repo add weblogic-operator https://oracle.github.io/weblogic-kubernetes-operator/charts --force-update
403407
helm install weblogic-operator weblogic-operator/weblogic-operator
404408
}
405409

406-
function createWebLogicDomain {
410+
createWebLogicDomain() {
407411
# Create WebLogic Server Domain Credentials.
408412
echo Creating WebLogic Server Domain credentials, with user ${weblogicUserName}, domainUID ${domainUID}
409413
bash ${dirCreateDomainCredentials}/create-weblogic-credentials.sh -u ${weblogicUserName} \
@@ -425,7 +429,7 @@ function createWebLogicDomain {
425429
kubectl apply -f ${clusterLbOutput}
426430
}
427431

428-
function waitForJobComplete {
432+
waitForJobComplete() {
429433
local attempts=0
430434
local svcState="running"
431435
while [ ! "$svcState" == "completed" ] && [ ! $attempts -eq 30 ]; do
@@ -476,7 +480,7 @@ function waitForJobComplete {
476480
fi
477481
}
478482

479-
function printSummary {
483+
printSummary() {
480484
if [ "${executeIt}" = true ]; then
481485
regionJsonExcerpt=$(az group list --query "[?name=='${azureResourceGroupName}']" | grep location)
482486
tokens=($(
@@ -543,9 +547,6 @@ createYamlFiles
543547
# All done if the execute option is true
544548
if [ "${executeIt}" = true ]; then
545549

546-
# Login Azure with service principal
547-
loginAzure
548-
549550
# Create resource group
550551
createResourceGroup
551552

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
# Copyright (c) 2021, Oracle and/or its affiliates.
2-
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
3-
4-
apiVersion: v1
5-
kind: Service
6-
metadata:
7-
name: sample-domain1-admin-server-external-lb
8-
namespace: sample-domain1-ns
9-
spec:
10-
ports:
11-
- name: default
12-
port: 7001
13-
protocol: TCP
14-
targetPort: 7001
15-
selector:
16-
weblogic.domainUID: sample-domain1
17-
weblogic.serverName: admin-server
18-
sessionAffinity: None
19-
type: LoadBalancer
1+
# Copyright (c) 2021, Oracle and/or its affiliates.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
3+
4+
apiVersion: v1
5+
kind: Service
6+
metadata:
7+
name: sample-domain1-admin-server-external-lb
8+
namespace: sample-domain1-ns
9+
spec:
10+
ports:
11+
- name: default
12+
port: 7001
13+
protocol: TCP
14+
targetPort: 7001
15+
selector:
16+
weblogic.domainUID: sample-domain1
17+
weblogic.serverName: admin-server
18+
sessionAffinity: None
19+
type: LoadBalancer
Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
# Copyright (c) 2021, Oracle and/or its affiliates.
2-
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
3-
4-
apiVersion: v1
5-
kind: Service
6-
metadata:
7-
name: sample-domain1-cluster-1-lb
8-
namespace: sample-domain1-ns
9-
spec:
10-
ports:
11-
- name: default
12-
port: 8001
13-
protocol: TCP
14-
targetPort: 8001
15-
selector:
16-
weblogic.domainUID: sample-domain1
17-
weblogic.clusterName: cluster-1
18-
sessionAffinity: None
19-
type: LoadBalancer
1+
# Copyright (c) 2021, Oracle and/or its affiliates.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
3+
4+
apiVersion: v1
5+
kind: Service
6+
metadata:
7+
name: sample-domain1-cluster-1-lb
8+
namespace: sample-domain1-ns
9+
spec:
10+
ports:
11+
- name: default
12+
port: 8001
13+
protocol: TCP
14+
targetPort: 8001
15+
selector:
16+
weblogic.domainUID: sample-domain1
17+
weblogic.clusterName: cluster-1
18+
sessionAffinity: None
19+
type: LoadBalancer

‎kubernetes/samples/scripts/create-weblogic-domain-on-azure-kubernetes-service/validate.sh

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# Copyright (c) 2018, 2021, Oracle and/or its affiliates.
2+
# Copyright (c) 2018, 2022, Oracle and/or its affiliates.
33
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
#
55
# Description
@@ -17,7 +17,7 @@
1717
script="${BASH_SOURCE[0]}"
1818
scriptDir="$( cd "$( dirname "${script}" )" && pwd )"
1919

20-
function usage {
20+
usage() {
2121
echo "Arguments"
2222
echo " --aks-name [Required] :Azure Kubernetes Service instance name. "
2323
echo " --file-share [Required] :File share name."
@@ -147,26 +147,26 @@ fi
147147
#
148148
# Function to exit and print an error message
149149
# $1 - text of message
150-
function fail {
150+
fail() {
151151
echo [ERROR] $*
152152
exit 1
153153
}
154154

155-
function validateAzLogin {
155+
validateAzLogin() {
156156
az account show
157157
if [ $? -ne 0 ]; then
158158
fail "Please run az login to setup account."
159159
fi
160160
}
161161

162-
function validateResourceGroup {
162+
validateResourceGroup() {
163163
ret=$(az group exists --name ${resourceGroup})
164164
if [ $ret == false ];then
165165
fail "${resourceGroup} does not exist."
166166
fi
167167
}
168168

169-
function validateStorageAccount {
169+
validateStorageAccount() {
170170
ret=$(az storage account check-name --name ${storageAccount})
171171
echo $ret
172172
nameAvailable=$(echo "$ret" | grep "AlreadyExists")
@@ -175,14 +175,14 @@ function validateStorageAccount {
175175
fi
176176
}
177177

178-
function validateAKSName {
178+
validateAKSName() {
179179
ret=$(az aks list -g ${resourceGroup} | grep "${aksName}")
180180
if [ -z "$ret" ];then
181181
fail "AKS instance with name ${aksName} does not exist."
182182
fi
183183
}
184184

185-
function validateFileShare {
185+
validateFileShare() {
186186
export azureStorageConnectionString=$(az storage account show-connection-string \
187187
-n $storageAccount -g $resourceGroup -o tsv)
188188

@@ -193,21 +193,21 @@ function validateFileShare {
193193
fi
194194
}
195195

196-
function connectAKS {
196+
connectAKS() {
197197
az aks get-credentials --resource-group $resourceGroup --name $aksName
198198
if [ $? -ne 0 ]; then
199199
fail "Connect to ${aksName} failed."
200200
fi
201201
}
202202

203-
function validateDockerSecret {
203+
validateDockerSecret() {
204204
kubectl get secret ${secretDocker}
205205
if [ $? -ne 0 ]; then
206206
fail "Secret:${secretDocker} for docker account is not created."
207207
fi
208208
}
209209

210-
function validateWebLogicDomainSecret {
210+
validateWebLogicDomainSecret() {
211211
ret=$(kubectl get secrets | grep "weblogic-credentials")
212212
if [ $? -ne 0 ]; then
213213
fail "Secret:weblogic-credentials is not created."
@@ -216,7 +216,7 @@ function validateWebLogicDomainSecret {
216216
export secretWebLogic=$(echo ${ret%% *})
217217
}
218218

219-
function validatePVC {
219+
validatePVC() {
220220
ret=$(kubectl get pvc)
221221
index=0
222222
for item in ${ret};
@@ -234,21 +234,21 @@ function validatePVC {
234234
done
235235
}
236236

237-
function validateOperator {
237+
validateOperator() {
238238
ret=$(kubectl get pods | grep "weblogic-operator" | grep "Running")
239239
if [ -z "${ret}" ]; then
240240
fail "Please make sure WebLogic operator is running."
241241
fi
242242
}
243243

244-
function validateDomain {
244+
validateDomain() {
245245
ret=$(kubectl get domain | grep "${domainUID}")
246246
if [ -n "$ret" ]; then
247247
fail "${domainUID} is created! Please create a new domain or follow the page to delete it https://oracle.github.io/weblogic-kubernetes-operator/samples/domains/domain-home-on-pv/#delete-the-generated-domain-home."
248248
fi
249249
}
250250

251-
function pass {
251+
pass() {
252252
echo ""
253253
echo "PASS"
254254
echo "You can create your domain with the following resources ready:"

0 commit comments

Comments
 (0)
Please sign in to comment.