Skip to content

Commit

Permalink
Merge branch 'upgrade-wko-in-aks-sample' into 'main'
Browse files Browse the repository at this point in the history
Update aks samples

See merge request weblogic-cloud/weblogic-kubernetes-operator!4640

(cherry picked from commit a2320a0)

108e3f4 update aks samples.
b75009e update download-wls-tools.txt
e225387 fix app path
262b221 fix scripts
e8386a4 access the built in sample application.
275aca5 update index.jsp content.
e39b381 Merge branch 'oracle:main' into main
e5744b7 On branch upgrade-wko-in-aks-sample Ready for review from Rosemary.
  • Loading branch information
rjeberhard committed Mar 31, 2024
1 parent 1d6074b commit 8613f9d
Show file tree
Hide file tree
Showing 12 changed files with 329 additions and 434 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
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://learn.microsoft.com/en-us/azure/aks/cluster-container-registry-integration?tabs=azure-cli#configure-acr-integration-for-an-existing-aks-cluster).

```shell
$ export ACR_ID=$(az acr show -n $ACR_NAME --resource-group $AKS_PERS_RESOURCE_GROUP --query "id" -o tsv)
$ az aks update --name $AKS_CLUSTER_NAME --resource-group $AKS_PERS_RESOURCE_GROUP --attach-acr $ACR_ID
```

Successful output will be a JSON object with the entry `"type": "Microsoft.ContainerService/ManagedClusters"`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
AKS can pull images from any container registry, but the easiest integration is to use Azure Container Registry (ACR). In addition to simplicity, using ACR simplifies high availability and disaster recovery with features such as geo-replication. For more information, see [Geo-replication in Azure Container Registry](https://learn.microsoft.com/en-us/azure/container-registry/container-registry-geo-replication). In this section, we will create a new Azure Container Registry, connect it to our pre-existing AKS cluster and push the image built in the preceding section to it. For complete details, see [Azure Container Registry documentation](https://learn.microsoft.com/en-us/azure/container-registry/).

Let's create an instance of ACR in the same resource group we used for AKS. We will use the environment variables used during the steps above. For simplicity, we use the resource group name as the name of the ACR instance.

```shell
$ az acr create --resource-group $AKS_PERS_RESOURCE_GROUP --name $ACR_NAME --sku Basic --admin-enabled true
```

Closely examine the JSON output from this command. Save the value of the `loginServer` property aside. It will look something like the following.

```json
"loginServer": "contosoresourcegroup1610068510.azurecr.io",
```

Use this value to sign in to the ACR instance. Note that because you are signing in with the `az` cli, you do not need a password because your identity is already conveyed by having done `az login` previously.

```shell
$ export LOGIN_SERVER=$(az acr show -n $ACR_NAME --resource-group $AKS_PERS_RESOURCE_GROUP --query "loginServer" -o tsv)
```
```shell
$ az acr login --name $LOGIN_SERVER
```

Successful output will include `Login Succeeded`.
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ You will dynamically create and use a persistent volume with Azure Files NFS sha
Successful output will be a JSON object with the entry `"type": "Microsoft.Storage/storageAccounts"`.

2. Create an NFS share.
{{% notice note %}} We strongly recommend NFS instead of SMB. NFS evolved from the UNIX operating system, and other variants such as GNU/Linux. For this reason, when using NFS with container technologies such as Docker, it is less likely to have problems for concurrent reads and file locking.

Please be sure to enable NFS v4.1. Versions lower than v4.1 will have problems.
We strongly recommend NFS instead of SMB. NFS evolved from the UNIX operating system, and other variants such as GNU/Linux. For this reason, when using NFS with container technologies such as Docker, it is less likely to have problems for concurrent reads and file locking.

{{% /notice %}}
Please be sure to enable NFS v4.1. Versions lower than v4.1 will have problems.

To create the file share, you must use `NoRootSquash` to allow the operator to change the ownership of the directory in the NFS share.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
##### Download the WebLogic Kubernetes Operator sample.

Download the WebLogic Kubernetes Operator sample ZIP file. We will use several scripts in this zip file to create a WebLogic domain. This sample was tested with v4.1.7, but should work with the latest release.
Download the WebLogic Kubernetes Operator sample ZIP file. We will use several scripts in this zip file to create a WebLogic domain. This sample was tested with v4.1.8, but should work with the latest release.

```shell
$ cd $BASE_DIR
$ mkdir sample-scripts
$ curl -m 120 -fL https://github.com/oracle/weblogic-kubernetes-operator/releases/download/v4.1.7/sample-scripts.zip \
$ curl -m 120 -fL https://github.com/oracle/weblogic-kubernetes-operator/releases/download/v4.1.8/sample-scripts.zip \
-o ${BASE_DIR}/sample-scripts/sample-scripts.zip
$ unzip ${BASE_DIR}/sample-scripts/sample-scripts.zip -d ${BASE_DIR}/sample-scripts
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
- Download the latest WebLogic Deploying Tooling (WDT) and WebLogic Image Tool (WIT) installer ZIP files to your `${WDT_MODEL_FILES_PATH}` directory. Both WDT and WIT are required to create your Model in Image images.

```shell
$ curl -m 120 -fL https://github.com/oracle/weblogic-deploy-tooling/releases/latest/download/weblogic-deploy.zip \
-o ${WDT_MODEL_FILES_PATH}/weblogic-deploy.zip
```
```shell
$ curl -m 120 -fL https://github.com/oracle/weblogic-image-tool/releases/latest/download/imagetool.zip \
-o ${WDT_MODEL_FILES_PATH}/imagetool.zip
```

- Set up the WebLogic Image Tool, run the following commands:
```shell
$ unzip ${WDT_MODEL_FILES_PATH}/imagetool.zip -d ${WDT_MODEL_FILES_PATH}
```

```
$ ${WDT_MODEL_FILES_PATH}/imagetool/bin/imagetool.sh cache deleteEntry --key wdt_latest
```

```shell
$ ${WDT_MODEL_FILES_PATH}/imagetool/bin/imagetool.sh cache addInstaller \
--type wdt \
--version latest \
--path ${WDT_MODEL_FILES_PATH}/weblogic-deploy.zip
```

These steps will install WIT to the `${WDT_MODEL_FILES_PATH}/imagetool` directory, plus put a `wdt_latest` entry in the tool’s cache which points to the WDT ZIP file installer. You will use WIT later in the sample for creating model images.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ This sample assumes the following prerequisite environment.
* Operating System: GNU/Linux, macOS or [WSL2 for Windows 10](https://docs.microsoft.com/windows/wsl/install-win10).
* Note: the Docker image creation steps will not work on a Mac with Apple Silicon.
* [Git](https://git-scm.com/downloads); use `git --version` to test if `git` works. This document was tested with version 2.25.1.
* [Azure CLI](https://docs.microsoft.com/cli/azure); use `az --version` to test if `az` works. This document was tested with version 2.48.1.
* [Azure CLI](https://docs.microsoft.com/cli/azure); use `az --version` to test if `az` works. This document was tested with version 2.58.0.
* [Docker for Desktop](https://www.docker.com/products/docker-desktop). This document was tested with `Docker version 20.10.7`
* [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.
* [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.
* 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.
* A `domain creation image` tagged as `wdt-domain-image:WLS-v1` in your local Docker server's image cache. You can create it by following the [Build the domain creation image]({{< relref "/samples/domains/domain-home-on-pv/build-domain-creation-image#build-the-domain-creation-image" >}}) step.
* Ensure that you have the zip/unzip utility installed; use `zip/unzip -v` to test if `zip/unzip` works.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This sample assumes the following prerequisite environment.
* If your identity has very limited role assignments, ensure you have [Contributor](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#contributor) role and [User Access Administrator](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#user-access-administrator) role in the resource group that runs the AKS cluster. This requires asking a privileged user to assign the roles before creating resources in the resource group.
* Operating System: GNU/Linux, macOS (Intel only, Apple Silicon not supported) [WSL2 for Windows 10](https://docs.microsoft.com/windows/wsl/install-win10).
* [Git](https://git-scm.com/downloads); use `git --version` to test if `git` works. This document was tested with version 2.25.1.
* [Azure CLI](https://docs.microsoft.com/cli/azure); use `az --version` to test if `az` works. This document was tested with version 2.48.1.
* [Azure CLI](https://docs.microsoft.com/cli/azure); use `az --version` to test if `az` works. This document was tested with version 2.58.0.
* [Docker for Desktop](https://www.docker.com/products/docker-desktop). This document was tested with `Docker version 20.10.7`
* [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.
* [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.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
In this step, you explore the staged WDT model YAML file and properties in the `${WDT_MODEL_FILES_PATH}/WLS-v1` directory. The model in this directory references the web application in your archive, configures a WebLogic Server Administration Server, and configures a WebLogic cluster. It consists of only two files, `model.10.properties`, a file with a single property, and, `model.10.yaml`, a YAML file with your WebLogic configuration.

Here is the WLS `model.10.properties`:

```
CLUSTER_SIZE=5
```

Here is the WLS `model.10.yaml`:

```yaml
domainInfo:
AdminUserName: '@@SECRET:__weblogic-credentials__:username@@'
AdminPassword: '@@SECRET:__weblogic-credentials__:password@@'
ServerStartMode: 'prod'

topology:
Name: '@@ENV:CUSTOM_DOMAIN_NAME@@'
AdminServerName: 'admin-server'
Cluster:
'cluster-1':
DynamicServers:
ServerTemplate: 'cluster-1-template'
ServerNamePrefix: 'managed-server'
DynamicClusterSize: '@@PROP:CLUSTER_SIZE@@'
MaxDynamicClusterSize: '@@PROP:CLUSTER_SIZE@@'
MinDynamicClusterSize: '0'
CalculatedListenPorts: false
Server:
'admin-server':
ListenPort: 7001
ServerTemplate:
'cluster-1-template':
Cluster: 'cluster-1'
ListenPort: 8001

appDeployments:
Application:
myapp:
SourcePath: 'wlsdeploy/applications/myapp-v1'
ModuleType: ear
Target: 'cluster-1'
```

The model file:

- Defines a WebLogic domain with:
- Cluster `cluster-1`
- Administration Server `admin-server`
- An EAR application, targeted to `cluster-1`, located in the WDT archive ZIP file at `wlsdeploy/applications/myapp-v1`

- Leverages macros to inject external values:
- The property file `CLUSTER_SIZE` property is referenced in the model YAML file `DynamicClusterSize` and `MaxDynamicClusterSize` fields using a PROP macro.
- The model file domain name is injected using a custom environment variable named `CUSTOM_DOMAIN_NAME` using an ENV macro.
- You set this environment variable later in this sample using an `env` field in its Domain.
- _This conveniently provides a simple way to deploy multiple differently named domains using the same model image_.
- The model file administrator user name and password are set using a `weblogic-credentials` secret macro reference to the WebLogic credential secret.
- This secret is in turn referenced using the `webLogicCredentialsSecret` field in the Domain.
- The `weblogic-credentials` is a reserved name that always dereferences to the owning Domain actual WebLogic credentials secret name.
Loading

0 comments on commit 8613f9d

Please sign in to comment.