Skip to content

"Bring your own vnet" for Application Gateway on AKS offer #146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 66 commits into from
Jun 22, 2022

Conversation

galiacheng
Copy link
Contributor

@galiacheng galiacheng commented Jun 1, 2022

Current aks offer covers "Bring your own VNET" for AKS cluster by bringing existing AKS cluster, while it does not support "Bring your own VNET" for Application Gateway, this PR is to support VNET customization for Application Gateway.

Contents

  • Requirements
  • VNET scenarios that the offer will support after this PR is merged
  • Test cases
  • How to validate private access

Requirements

For quick start and quick validation

  1. Run WLS on AKS and enable Application Gateway in new VNET that defined by aks offer, and expose the WLS cluster with public frontend IP.
  2. Run WLS on AKS and enable Application Gateway in new VNET that defined by aks offer, and expose the WLS cluster with private frontend IP.

For enterprise workload migration/POC

  1. Run WLS on AKS and enable Application Gateway in pre-defined VNET(s), and expose the WLS cluster with public frontend IP.
  2. Run WLS on AKS and enable Application Gateway in pre-defined VNET(s), and expose the WLS cluster with private frontend IP.

Current offer supports R1, this pr will enable R2-R4.

VNET scenarios that the offer will support after this PR merged

Note: custom T3 is disabled from UI definition, customer is able to enable custom T3 with advanced deployment using the templates, so the diagrams include T3/T3s access to WebLogic Server.

AKS and Application Gateway are in the same VNET:
image

AKS and Application Gateway are in different VNET:
image

Test cases

  1. New AKS and Application Gateway within new VNET that deployed by offer, expose WLS cluster with public IP address.
  2. New AKS within new VNET that deployed by offer and Application Gateway within an existing VNET, expose WLS cluster with public IP address.
  3. Existing AKS and Application Gateway within new VNET that deployed by offer, expose WLS cluster with public IP address.
  4. Existing AKS and Application Gateway within the same VNET with AKS, expose WLS cluster with public IP address.
    • Deploy AKS cluster from Azure portal
    • In the VNET of AKS cluster, create a subnet(/24) for Application Gateway
    • Deploy the offer, select the existing AKS cluster, for Application Gateway, select the subnet inside the VNET of AKS cluster
  5. Existing AKS and Application Gateway within different VNET of AKS, expose WLS cluster with public IP address.
    • Deploy AKS cluster from Azure portal
    • Deploy a VNET(/24) from Azure portal, and create a subnet(/24) for Application Gateway
    • Deploy the offer, select the existing AKS cluster, for Application Gateway, select above subnet
  6. New AKS and Application Gateway within new VNET that deployed by offer, expose WLS cluster with private IP address.
  7. New AKS within new VNET that deployed by offer and Application Gateway within an existing VNET, expose WLS cluster with private IP address.
  8. Existing AKS and Application Gateway within new VNET that deployed by offer, expose WLS cluster with private IP address.
  9. Existing AKS and Application Gateway within the same VNET with AKS, expose WLS cluster with private IP address.
  10. Existing AKS and Application Gateway within different VNET of AKS, expose WLS cluster with private IP address.

Validating private access

The following steps are to validate the WLS cluster accessibility that is exposed to internal network using private IP. If you expose the cluster via public IP, just test it from your browser, need not follow the steps.

Deploy offer and enable application gateway with private frontend IP:

  • Networking
    • Connect to Azure Application Gateway: Yes
    • Configure frontend IP with private IP address: Checked

Get deployment output: clusterExternalUrl (e.g. http://10.3.0.4/), the application url is ${clusterExternalUrl}testwebapp/ (e.g. http://10.3.0.4/testwebapp/)

There are two approaches to access the application: using kubectl exec or a jump box. You can choose one of them to test the feature.

Validate cluster accessibility from Admin Pod

  • Connect AKS from terminal: az aks get-credentials --resource-group haiche-private-vnet-5 --name wlsonaks1ea3ptpccopio4
  • Get admin pod:
$ kubectl get pod -n sample-domain1-ns
NAME                             READY   STATUS    RESTARTS   AGE
sample-domain1-admin-server      1/1     Running   0          16h
sample-domain1-managed-server1   1/1     Running   0          16h
sample-domain1-managed-server2   1/1     Running   0          16h
  • Run kubectl exec to curl the application: kubectl exec -it <admin-pod-name> -n <wls-namespace> -- /bin/bash -c "${applicationUrl}"
 $ kubectl exec -it sample-domain1-admin-server -n sample-domain1-ns -- /bin/bash -c "curl http://10.3.0.4/testwebapp/"
<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <link rel="stylesheet" href="/testwebapp/res/styles.css;jsessionid=WLki_K2IHVkmUjOYaVh_AzCPAchlRqXVA_byQNir0Zo2KF_qCXBe!1626444911" type="text/css">
    <title>Test WebApp</title>
  </head>
  <body>


    <li>InetAddress: sample-domain1-managed-server2/10.244.1.8
    <li>InetAddress.hostname: sample-domain1-managed-server2

  </body>
</html>

Admin Pod and Application Gateway are in the same VNET (VNET peering), should be able to access Application Gateway Url.

Access WLS cluster with jump box

  • Create a resource group from Azure Portal, with name e.g. haiche-jump-box
  • Create a ubuntu machine from Azure portal
    • Basics
      • Region: in the same region with AKS
    • Networking, keep default values
  • Create network peer between VNET of UBUNTU machine and Application Gateway
    • Get the VNET name of Application Gateway from the resource group that provisioned by the offer, the VNET name starts with wlsaks-vnet, e.g. wlsaks-vnet12345678
    • Open the VNET of UBUNTU machine in jump box resource group, and create network peering
      • Peer link name: input a name
      • Remote Peer link name: input a name
      • Virtual Network: select the VNET of Application Gateway that got in previous step, e.g. wlsaks-vnet12345678
      • Add
  • After the peering is completed, the peer status should be connected.
  • Restart UBUNTU machine to make peering available
  • SSH to UBUNTU machine and curl the application url, e.g.
weblogic@testwlsaks:~$ curl http://10.3.0.4/testwebapp/ -v
*   Trying 10.3.0.4:80...
* TCP_NODELAY set
* Connected to 10.3.0.4 (10.3.0.4) port 80 (#0)
> GET /testwebapp/ HTTP/1.1
> Host: 10.3.0.4
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Date: Thu, 02 Jun 2022 06:37:22 GMT
< Content-Type: text/html; charset=UTF-8
< Content-Length: 486
< Connection: keep-alive
< X-ORACLE-DMS-ECID: 425f30d6-02e1-439b-8402-57b7f051a685-00011b28
< X-ORACLE-DMS-RID: 0
< Set-Cookie: JSESSIONID=TggjIgsSP8X0NyWXgAUkCPQiaX71uFmksz9fYj9Amlyf00VD1u9k!-823443147; path=/; HttpOnly
<
<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <link rel="stylesheet" href="/testwebapp/res/styles.css;jsessionid=TggjIgsSP8X0NyWXgAUkCPQiaX71uFmksz9fYj9Amlyf00VD1u9k!-823443147" type="text/css">
    <title>Test WebApp</title>
  </head>
  <body>


    <li>InetAddress: sample-domain1-managed-server1/10.244.0.9
    <li>InetAddress.hostname: sample-domain1-managed-server1

  </body>
</html>
* Connection #0 to host 10.3.0.4 left intact

@galiacheng galiacheng marked this pull request as draft June 1, 2022 14:04
@galiacheng galiacheng changed the title "Bring your own vnet" for Application Gateway "Bring your own vnet" for Application Gateway on AKS offer Jun 1, 2022
@galiacheng
Copy link
Contributor Author

@galiacheng galiacheng marked this pull request as ready for review June 2, 2022 09:43
@galiacheng
Copy link
Contributor Author

@edburns edburns force-pushed the private-vnet-support branch from 508a44f to 3537ca6 Compare June 13, 2022 17:33
Comment on lines +353 to +355
appGatewaySubnetId=$(az network application-gateway show -g ${curRGName} --name ${appgwName} -o tsv --query "gatewayIpConfigurations[0].subnet.id")
appGatewayVnetResourceGroup=$(az network application-gateway show -g ${curRGName} --name ${appgwName} -o tsv --query "gatewayIpConfigurations[0].subnet.resourceGroup")
appGatewaySubnetName=$(az resource show --ids ${appGatewaySubnetId} --query "name" -o tsv)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not going to hold up the commit for this comment, but I would like to ask @galiacheng if they judge it is appropriate to undertake an audit of the existing shell scripts in this offer and make them comply with the best practices shown in articles such as this? If so, please file a User Story in our internal tracker and we can prioritize and schedule that work. If not, please let me know why not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @edburns see user story

galiacheng and others added 20 commits June 13, 2022 22:42
…rontend ip.

Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	modified:   weblogic-azure-aks/src/main/arm/createUiDefinition.json
	modified:   weblogic-azure-aks/src/main/bicep/mainTemplate.bicep
	modified:   weblogic-azure-aks/src/main/bicep/modules/_azure-resoruces/_appgateway.bicep
	new file:   weblogic-azure-aks/src/main/bicep/modules/_azure-resoruces/_vnetAppGateway.bicep
Signed-off-by: galiacheng <[email protected]>
Signed-off-by: galiacheng <[email protected]>
Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	modified:   weblogic-azure-aks/src/main/arm/createUiDefinition.json
Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	modified:   weblogic-azure-aks/src/main/bicep/mainTemplate.bicep
Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	modified:   weblogic-azure-aks/src/main/arm/scripts/appgw-helm-config.yaml.template
	modified:   weblogic-azure-aks/src/main/arm/scripts/createAppGatewayIngress.sh
Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	modified:   weblogic-azure-aks/src/main/bicep/modules/_azure-resoruces/_appgateway.bicep
Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	modified:   weblogic-azure-aks/src/main/arm/createUiDefinition.json
Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	new file:   weblogic-azure-aks/src/main/arm/scripts/inline-scripts/queryPrivateIPForAppGateway.sh
	modified:   weblogic-azure-aks/src/main/bicep/mainTemplate.bicep
	modified:   weblogic-azure-aks/src/main/bicep/modules/_azure-resoruces/_appgateway.bicep
	new file:   weblogic-azure-aks/src/main/bicep/modules/_deployment-scripts/_ds_query_available_private_ip_from_subnet.bicep
	modified:   weblogic-azure-aks/src/main/bicep/modules/networking.bicep
Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	modified:   weblogic-azure-aks/src/main/arm/scripts/inline-scripts/queryPrivateIPForAppGateway.sh
	modified:   weblogic-azure-aks/src/main/bicep/modules/_deployment-scripts/_ds_query_available_private_ip_from_subnet.bicep
Signed-off-by: galiacheng <[email protected]>

Changes to be committed:
	modified:   weblogic-azure-aks/src/main/arm/scripts/common.sh
	modified:   weblogic-azure-aks/src/main/arm/scripts/createAppGatewayIngress.sh
Signed-off-by: galiacheng <[email protected]>
Signed-off-by: galiacheng <[email protected]>

 Changes not staged for commit:
	modified:   weblogic-azure-aks/src/main/bicep/mainTemplate.bicep
Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	modified:   weblogic-azure-aks/src/main/arm/createUiDefinition.json
Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	modified:   src/main/bicep/modules/_azure-resoruces/_appgateway.bicep
	modified:   src/main/bicep/modules/networking.bicep
Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	modified:   weblogic-azure-aks/src/main/bicep/mainTemplate.bicep
modified:   weblogic-azure-aks/pom.xml

- Increment pom.

modified:   weblogic-azure-aks/src/main/arm/createUiDefinition.json

- Trivial wording changes.

Signed-off-by: Ed Burns <[email protected]>
@edburns edburns force-pushed the private-vnet-support branch from 3537ca6 to 479e46d Compare June 14, 2022 02:46
galiacheng and others added 22 commits June 17, 2022 13:30
Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	new file:   weblogic-azure-aks/src/main/arm/scripts/inline-scripts/queryPrivateIPForAppGateway.sh
	modified:   weblogic-azure-aks/src/main/bicep/mainTemplate.bicep
	modified:   weblogic-azure-aks/src/main/bicep/modules/_azure-resoruces/_appgateway.bicep
	new file:   weblogic-azure-aks/src/main/bicep/modules/_deployment-scripts/_ds_query_available_private_ip_from_subnet.bicep
	modified:   weblogic-azure-aks/src/main/bicep/modules/networking.bicep
Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	modified:   weblogic-azure-aks/src/main/arm/scripts/inline-scripts/queryPrivateIPForAppGateway.sh
	modified:   weblogic-azure-aks/src/main/bicep/modules/_deployment-scripts/_ds_query_available_private_ip_from_subnet.bicep
Signed-off-by: galiacheng <[email protected]>

Changes to be committed:
	modified:   weblogic-azure-aks/src/main/arm/scripts/common.sh
	modified:   weblogic-azure-aks/src/main/arm/scripts/createAppGatewayIngress.sh
Signed-off-by: galiacheng <[email protected]>
Signed-off-by: galiacheng <[email protected]>

 Changes not staged for commit:
	modified:   weblogic-azure-aks/src/main/bicep/mainTemplate.bicep
Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	modified:   weblogic-azure-aks/src/main/arm/createUiDefinition.json
Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	modified:   src/main/bicep/modules/_azure-resoruces/_appgateway.bicep
	modified:   src/main/bicep/modules/networking.bicep
Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	modified:   weblogic-azure-aks/src/main/bicep/mainTemplate.bicep
modified:   weblogic-azure-aks/pom.xml

- Increment pom.

modified:   weblogic-azure-aks/src/main/arm/createUiDefinition.json

- Trivial wording changes.

Signed-off-by: Ed Burns <[email protected]>
Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	modified:   src/main/arm/createUiDefinition.json
…nition

Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	modified:   src/main/bicep/mainTemplate.bicep
	modified:   src/main/bicep/modules/_azure-resoruces/_appgateway.bicep
	modified:   src/main/bicep/modules/_azure-resoruces/_vnetAppGateway.bicep
	modified:   src/main/bicep/modules/_deployment-scripts/_ds-validate-parameters.bicep
	modified:   src/main/bicep/modules/_deployment-scripts/_ds_query_available_private_ip_from_subnet.bicep
	modified:   src/main/bicep/modules/networking.bicep
…vaults/2021-10-01

Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	modified:   src/main/bicep/mainTemplate.bicep
	modified:   src/main/bicep/modules/_azure-resoruces/_keyvault/_keyvaultForGatewayBackendCert.bicep
	modified:   src/main/bicep/modules/_azure-resoruces/_keyvault/_keyvaultForWLSSSLCert.bicep
	modified:   src/main/bicep/modules/_azure-resoruces/_keyvault/_keyvaultWithExistingCert.bicep
	modified:   src/main/bicep/modules/_azure-resoruces/_keyvault/_keyvaultWithNewCert.bicep
	modified:   src/main/bicep/modules/networking.bicep
…erRegistry/registries/2021-09-01

Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	modified:   src/main/bicep/modules/_azure-resoruces/_acr.bicep
Type Mismatch: Parameter 'wlsIdentityKeyStoreData' in nested tem
plate 'wls-domain-deployment' is defined as string, but the parent template def
ines it as secureString). Line: 4883, Column: 22
        Type Mismatch: Parameter 'wlsPrivateKeyAlias' in nested temp
late 'wls-domain-deployment' is defined as string, but the parent template defi
nes it as secureString). Line: 4914, Column: 22
        Type Mismatch: Parameter 'wlsTrustKeyStoreData' in nested te
mplate 'wls-domain-deployment' is defined as string, but the parent template de
fines it as secureString). Line: 4922, Column: 22
        Type Mismatch: Parameter 'wlsIdentityKeyStoreData' in nested
 template 'wls-domain-deployment' is defined as string, but the parent template
 defines it as secureString). Line: 3330, Column: 22
        Type Mismatch: Parameter 'wlsPrivateKeyAlias' in nested temp
late 'wls-domain-deployment' is defined as string, but the parent template defi
nes it as secureString). Line: 3361, Column: 22
        Type Mismatch: Parameter 'wlsTrustKeyStoreData' in nested te
mplate 'wls-domain-deployment' is defined as string, but the parent template de
fines it as secureString). Line: 3369, Column: 22
        Type Mismatch: Parameter 'wlsIdentityKeyStoreData' in nested
 template 'setup-wls-cluster' is defined as secureString, but the parent templa
te defines it as string). Line: 2511, Column: 14
        Type Mismatch: Parameter 'wlsPrivateKeyAlias' in nested temp
late 'setup-wls-cluster' is defined as secureString, but the parent template de
fines it as string). Line: 2548, Column: 14
        Type Mismatch: Parameter 'wlsTrustKeyStoreData' in nested te
mplate 'setup-wls-cluster' is defined as secureString, but the parent template
defines it as string). Line: 2556, Column: 14Type Mismatch: Parameter 'wlsIdentityKeyStoreData' in nested tem
plate 'wls-domain-deployment' is defined as string, but the parent template def
ines it as secureString). Line: 4883, Column: 22
        Type Mismatch: Parameter 'wlsPrivateKeyAlias' in nested temp
late 'wls-domain-deployment' is defined as string, but the parent template defi
nes it as secureString). Line: 4914, Column: 22
        Type Mismatch: Parameter 'wlsTrustKeyStoreData' in nested te
mplate 'wls-domain-deployment' is defined as string, but the parent template de
fines it as secureString). Line: 4922, Column: 22
        Type Mismatch: Parameter 'wlsIdentityKeyStoreData' in nested
 template 'wls-domain-deployment' is defined as string, but the parent template
 defines it as secureString). Line: 3330, Column: 22
        Type Mismatch: Parameter 'wlsPrivateKeyAlias' in nested temp
late 'wls-domain-deployment' is defined as string, but the parent template defi
nes it as secureString). Line: 3361, Column: 22
        Type Mismatch: Parameter 'wlsTrustKeyStoreData' in nested te
mplate 'wls-domain-deployment' is defined as string, but the parent template de
fines it as secureString). Line: 3369, Column: 22
        Type Mismatch: Parameter 'wlsIdentityKeyStoreData' in nested
 template 'setup-wls-cluster' is defined as secureString, but the parent templa
te defines it as string). Line: 2511, Column: 14
        Type Mismatch: Parameter 'wlsPrivateKeyAlias' in nested temp
late 'setup-wls-cluster' is defined as secureString, but the parent template de
fines it as string). Line: 2548, Column: 14
        Type Mismatch: Parameter 'wlsTrustKeyStoreData' in nested te
mplate 'setup-wls-cluster' is defined as secureString, but the parent template
defines it as string). Line: 2556, Column: 14

Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	modified:   src/main/bicep/modules/_azure-resoruces/_keyvault/_keyvaultForWLSSSLCert.bicep
	modified:   src/main/bicep/modules/_deployment-scripts/_ds-create-wls-cluster.bicep
…ed 'vnetForApplicationGateway' must output the newOrExisting property when hideExisting is false

Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	modified:   weblogic-azure-aks/src/main/arm/createUiDefinition.json
	modified:   weblogic-azure-aks/src/main/bicep/mainTemplate.bicep
	modified:   weblogic-azure-aks/src/main/bicep/modules/_azure-resoruces/_vnetAppGateway.bicep
Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	modified:   weblogic-azure-aks/src/main/arm/scripts/inline-scripts/validateParameters.sh
	modified:   weblogic-azure-aks/src/main/bicep/mainTemplate.bicep
	modified:   weblogic-azure-aks/src/main/bicep/modules/_azure-resoruces/_appgateway.bicep
	modified:   weblogic-azure-aks/src/main/bicep/modules/_deployment-scripts/_ds-create-networking.bicep
	modified:   weblogic-azure-aks/src/main/bicep/modules/_deployment-scripts/_ds-validate-parameters.bicep
	modified:   weblogic-azure-aks/src/main/bicep/modules/networking.bicep
	modified:   weblogic-azure-aks/src/main/bicep/modules/setupWebLogicCluster.bicep
Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	modified:   .github/workflows/buildWlsAksArtifact.yml
	modified:   .github/workflows/testWlsAksWithDependencyCreation.yml
	modified:   .github/workflows/testWlsAksWithoutDependencyCreation.yml
Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	modified:   weblogic-azure-aks/src/main/arm/scripts/common.sh
The new version of Azure CLI `az ad sp create-for-rbac` requires specifying `--scope` if `--role` is specified.
The new version of Azure CLI `az ad sp create-for-rbac` requires specifying `--scope` if `--role` is specified.
Fix wording for 'confirm service principal'.
Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	modified:   ../arm/createUiDefinition.json
@edburns edburns force-pushed the private-vnet-support branch from fb8c3d8 to 7c2b87c Compare June 17, 2022 17:30
Signed-off-by: galiacheng <[email protected]>

 Changes to be committed:
	deleted:    src/resources/ejb-client-stateless-1.0.0.war
	deleted:    src/resources/ejb-server-stateless-1.0.0.jar
@mriccell mriccell merged commit a109f23 into oracle:main Jun 22, 2022
@galiacheng galiacheng deleted the private-vnet-support branch July 21, 2022 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants