Skip to content

Commit

Permalink
Merge branch 'cherry-pick-d3420885' into 'release/4.1'
Browse files Browse the repository at this point in the history
Cherry-pick branch 'update_automation_scripts_and_docs' into 'release/4.1'

See merge request weblogic-cloud/weblogic-kubernetes-operator!4453
  • Loading branch information
rjeberhard committed Sep 27, 2023
2 parents ad9f3c0 + 2f24c6e commit 97d61ee
Show file tree
Hide file tree
Showing 12 changed files with 1,165 additions and 600 deletions.
8 changes: 5 additions & 3 deletions documentation/site/content/developerguide/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,21 @@ update to the documentation, follow this process:
```

3. Make your documentation updates by editing the source files in
`documentation/<release-version>/content`, for example `documentation/4.0/content`.
`documentation/site/content`.
{{% notice note %}}
Make sure you check in the changes from the `documentation/<release-version>/content` area _only_;
Make sure you check in the changes from the `documentation/site/content` area _only_;
do not build the site and check in the static files.
{{% /notice %}}

4. If you wish to view your changes, you can run the site locally using
these commands. The site will be available on the URL shown here:

```shell
$ cd documentation/<release-version>
$ cd documentation/site
$ hugo server -b http://localhost:1313/weblogic-kubernetes-operator
```

You can also run the `runlocal.sh` script in that directory to start the Hugo server locally.

5. When you are ready to submit your changes, push your branch to `origin`
and submit a pull request. Remember to follow the guidelines in the
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
The output from the `create-domain-on-aks.sh` script includes a statement about the Azure resources created by the script. To delete the cluster and free all related resources, simply delete the resource groups. The output will list the resource groups, such as.

```shell
The following Azure resources have been created:
Resource groups: ejb8191resourcegroup1597641911, MC_ejb8191resourcegroup1597641911_ejb8191akscluster1597641911_eastus
The following Azure Resouces have been created:
Resource groups: wlsresourcegroup6091605169, MC_wlsresourcegroup6091605169_wlsakscluster6091605169_eastus
```

Given the above output, the following Azure CLI commands will delete the resource groups.

```shell
$ az group delete --yes --no-wait --name ejb8191resourcegroup1597641911
$ az group delete --yes --no-wait --name MC_ejb8191resourcegroup1597641911_ejb8191akscluster1597641911_eastus
```
$ az group delete --yes --no-wait --name wlsresourcegroup6091605169
```
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
```shell
$ az group delete --yes --no-wait --name $AKS_PERS_RESOURCE_GROUP
$ az group delete --yes --no-wait --name "MC_$AKS_PERS_RESOURCE_GROUP"_"$AKS_CLUSTER_NAME"_"$AKS_PERS_LOCATION"
```

Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@

#### Create the AKS cluster

This sample requires that you disable the AKS addon `http_application_routing` by default. If you want to enable `http_application_routing`, then follow [HTTP application routing](https://docs.microsoft.com/azure/aks/http-application-routing).

Run the following commands to create the AKS cluster instance.

```shell
# Change these parameters as needed for your own environment
# Specify a prefix to name resources, only allow lowercase letters and numbers, between 1 and 7 characters
$ export NAME_PREFIX=wls
# Used to generate resource names.
$ export TIMESTAMP=`date +%s`
$ export AKS_CLUSTER_NAME="${NAME_PREFIX}aks${TIMESTAMP}"
$ export AKS_PERS_RESOURCE_GROUP="${NAME_PREFIX}resourcegroup${TIMESTAMP}"
$ export AKS_PERS_LOCATION=eastus

$ az group create --name $AKS_PERS_RESOURCE_GROUP --location $AKS_PERS_LOCATION

$ az aks create \
--resource-group $AKS_PERS_RESOURCE_GROUP \
--name $AKS_CLUSTER_NAME \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ You will dynamically create and use a persistent volume with Azure Files NFS sha
| `default-action` | `Deny` | For security, we suggest that you deny access by default and choose to allow access from the AKS cluster network. |

```shell
# Change the value as needed for your own environment
$ export AKS_PERS_STORAGE_ACCOUNT_NAME="${NAME_PREFIX}storage${TIMESTAMP}"

$ az storage account create \
--resource-group $AKS_PERS_RESOURCE_GROUP \
Expand All @@ -44,8 +42,7 @@ You will dynamically create and use a persistent volume with Azure Files NFS sha
The following command creates an NFS share with 100GiB:

```shell
# Change value as needed for your own environment
$ export AKS_PERS_SHARE_NAME="${NAME_PREFIX}-weblogic-${TIMESTAMP}"

# Create NFS file share
$ az storage share-rm create \
--resource-group $AKS_PERS_RESOURCE_GROUP \
Expand Down Expand Up @@ -184,74 +181,53 @@ You will dynamically create and use a persistent volume with Azure Files NFS sha
]
```

##### Create Storage Class
##### Create SC and PVC

This sample will dynamically create and use a persistent volume with Azure Files in AKS. These features are passed to Kubernetes using YAML files.

The script `kubernetes/samples/scripts/create-weblogic-domain-on-azure-kubernetes-service/create-domain-on-aks.sh` generates the required configuration files automatically, given an input file containing the parameters.

A parameters file is provided at `kubernetes/samples/scripts/create-weblogic-domain-on-azure-kubernetes-service/create-domain-on-aks-inputs.yaml`. Copy and customize this file for your needs.

To generate YAML files to create Storage Class in the AKS cluster, the following values must be substituted in your copy of the input file.

| Name in YAML file | Example value | Notes |
|-------------------|---------------|-------|
| `namePrefix` | `wls` | Alphanumeric value used as a disambiguation prefix for several Kubernetes resources. Make sure the value matches the value of `${NAME_PREFIX}` to keep names in step-by-step commands the same with those in configuration files. |

Use the following command to generate configuration files, assuming the output directory is `~/azure`. The script will overwrite any files generated by a previous invocation.

```shell
$ cd kubernetes/samples/scripts/create-weblogic-domain-on-azure-kubernetes-service
$ cp create-domain-on-aks-inputs.yaml my-create-domain-on-aks-inputs.yaml
$ ./create-domain-on-aks.sh -i my-create-domain-on-aks-inputs.yaml -o ~/azure -u ${TIMESTAMP}
```

After running the command, all needed configuration files are generated and output to `~/azure/weblogic-on-aks`:
##### Generated configuration files
Use the below command to generate configuration files.

```shell
The following files were generated:
/home/username/azure/weblogic-on-aks/azure-csi-nfs.yaml
/home/username/azure/weblogic-on-aks/pvc.yaml
/home/username/azure/weblogic-on-aks/admin-lb.yaml
/home/username/azure/weblogic-on-aks/cluster-lb.yaml
/home/username/azure/weblogic-on-aks/domain1.yaml

Completed
```

**NOTE**: Beyond the required and default configurations generated by the command, you can modify the generated YAML files to further customize your deployment. For further information about customizing your deployment, consult the operator documentation, [AKS documentation](https://docs.microsoft.com/azure/aks/), and Kubernetes references.

##### Apply generated configuration files
cat >azure-csi-nfs-${TIMESTAMP}.yaml <<EOF
# Copyright (c) 2018, 2023, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.

To define how an Azure file NFS share is created, we have provided a configuration file `azure-csi-nfs.yaml`. You can find it in your output directory.

The following command displays the YAML content of your current settings. This should be the same with content in `azure-csi-nfs.yaml`. The Storage Class name is `azurefile-csi-nfs`.

This sample uses Azure Files Container Storage Interface (CSI) drivers to manage the NFS file share, provisioner is `file.csi.azure.com`, see the [Azure Files CSI drivers documentation](https://docs.microsoft.com/azure/aks/azure-files-csi).

```shell
cat <<EOF
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: azurefile-csi-nfs
provisioner: file.csi.azure.com
allowVolumeExpansion: true
parameters:
protocol: nfs
mountOptions:
- nconnect=4
resourceGroup: ${AKS_PERS_RESOURCE_GROUP}
storageAccount: ${AKS_PERS_STORAGE_ACCOUNT_NAME}
shareName: ${AKS_PERS_SHARE_NAME}
reclaimPolicy: Delete
volumeBindingMode: Immediate
allowVolumeExpansion: true

EOF

cat >pvc-${TIMESTAMP}.yaml <<EOF
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: wls-azurefile-${TIMESTAMP}
spec:
accessModes:
- ReadWriteMany
storageClassName: azurefile-csi-nfs
resources:
requests:
storage: 5Gi

EOF
```

Use the `kubectl` command to create the Storage Class and persistent volume claim to the `default` namespace.

```shell
$ kubectl apply -f ~/azure/weblogic-on-aks/azure-csi-nfs.yaml
```

```
persistentvolume/wls-azurefile created
$ kubectl apply -f azure-csi-nfs-${TIMESTAMP}.yaml
$ kubectl apply -f pvc-${TIMESTAMP}.yaml
```

Use the following command to verify:
Expand All @@ -260,15 +236,27 @@ Use the following command to verify:
$ kubectl get sc
```

Example output:
Example of `kubectl get sc` output:

```shell
$ kubectl get sc
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
azurefile file.csi.azure.com Delete Immediate true 83s
azurefile-csi file.csi.azure.com Delete Immediate true 83s
azurefile-csi-nfs file.csi.azure.com Delete Immediate true 50s
....
azurefile file.csi.azure.com Delete Immediate true 30m
azurefile-csi file.csi.azure.com Delete Immediate true 30m
azurefile-csi-nfs file.csi.azure.com Delete Immediate true 24m
azurefile-csi-premium file.csi.azure.com Delete Immediate true 30m
azurefile-premium file.csi.azure.com Delete Immediate true 30m
...
```

```shell
$ kubectl get pvc
```

**NOTE**: Carefully inspect the output and verify it matches the above. `ACCESS MODES`, `CLAIM`, and `STORAGECLASS` are vital.
Example of `kubectl get pvc` output:

```shell
$ kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
wls-azurefile-1693900684 Bound pvc-1f615766-0f21-4c88-80e1-93c9bdabb3eb 5Gi RWX azurefile-csi-nfs 46s
```
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
This sample assumes the following prerequisite environment.

* If you don't have an [Azure subscription](https://learn.microsoft.com/en-us/azure/guides/developer/azure-developer-guide#understanding-accounts-subscriptions-and-billing), create a [free account](https://azure.microsoft.com/free/?ref=microsoft.com&utm_source=microsoft.com&utm_medium=docs&utm_campaign=visualstudio) before you begin.
* It's recommended that the Azure identity you use to # and complete this article has either the [Owner](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#owner) role in the current subscription or the [Contributor](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#contributor) and [User Access Administrator](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#user-access-administrator) roles in the current subscription.
* It's **strongly** recommended that the Azure identity you use to # and complete this article has either the [Owner](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#owner) role in the current subscription or the [Contributor](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#contributor) and [User Access Administrator](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#user-access-administrator) roles in the current subscription.
* If your identity has very limited role assignments, ensure you have the following role assignments in the AKS resource group and AKS node resource group.
* [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 AKS cluster. This requires asking a privileged user to assign the roles before creating resource in the resource group.
* [Contributor](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#contributor) role in the AKS node resource group whose name starts with "MC_". This requires asking a privileged user to assign the role after the AKS instance is created.
* 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.
* [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` with the name `wdt-domain-image:WLS-v1`. 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.
* 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.
14 changes: 13 additions & 1 deletion documentation/site/runlocal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,19 @@
# Copyright (c) 2019, 2021, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.

# `./runlocal.sh <your local port> <your local ip address>` causes the
# site to be available at `http://<your local ip address>:<your local
# port>/weblogic-kubernetes-operator/`. This is useful when running on
# a LAN. `./runlocal.sh` with no arguments continues to operate as
# originally writen. That is, the site is available at
# http://localhost:1313/weblogic-kubernetes-operator/.

# 1313 is the hugo default port
port=${1:-1313}
host=${2-localhost}

if [[ $host != 'localhost'* ]]; then
bind="--bind $host"
fi

hugo server -b http://localhost:$port/weblogic-kubernetes-operator -D -p $port
hugo server $bind --baseURL http://$host:$port/weblogic-kubernetes-operator --buildDrafts -p $port
Loading

0 comments on commit 97d61ee

Please # to comment.