Bug 1770406 - Azure: No validations for bring-you-own-VPC
Summary: Azure: No validations for bring-you-own-VPC
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Installer
Version: 4.3.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 4.3.0
Assignee: John Hixson
QA Contact: Mike Gahagan
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-11-08 22:57 UTC by John Hixson
Modified: 2020-01-23 11:12 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-01-23 11:11:45 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
openshift install log (65.88 KB, text/plain)
2019-11-08 22:57 UTC, John Hixson
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github openshift installer pull 2613 0 'None' closed Bug 1770406: Azure: Add virtual network & subnet validations 2021-02-17 15:54:34 UTC
Red Hat Product Errata RHBA-2020:0062 0 None None None 2020-01-23 11:12:03 UTC

Description John Hixson 2019-11-08 22:57:01 UTC
Created attachment 1634150 [details]
openshift install log

Description of problem:

When installing into an existing Azure VPC, no validation is done for the required resources that are necessary for it to install correctly.

The required resources are:
- network resource group
- virtual network
- compute subnet
- control plane subnet

None of these are validated prior to generated the terraform that creates the resources in Azure. 

How reproducible:
Always reproducable

Steps to Reproduce:
1. Create an install-config such as this:

apiVersion: v1
baseDomain: installer.azure.devcluster.openshift.com
compute:
- hyperthreading: Enabled
  name: worker
  platform:
    azure:
      osDisk:
        diskSizeGB: 128
      type: Standard_D4s_v3
controlPlane:
  hyperthreading: Enabled
  name: master
  platform: {}
  replicas: 3
metadata:
  creationTimestamp: null
  name: testbyovpc
networking:
  clusterNetwork:
  - cidr: 10.128.0.0/14
    hostPrefix: 23
  machineCIDR: 10.0.0.0/16
  networkType: OpenShiftSDN
  serviceNetwork:
  - 172.30.0.0/16
platform:
  azure:
    baseDomainResourceGroupName: os4-common
    region: centralus
    networkResourceGroupName: DOESNOTEXIST_jhixson_vnet_rg
    virtualNetwork: DOESNOTEXIST_jhixson_test_vnet
    controlPlaneSubnet: DOESNOTEXIST_jhixson_test_master_subnet
    computeSubnet: DOESNOTEXIST_jhixson_test_worker_subnet

2. Run the installer
3. Observe failure after terraform is generated

Actual results:

<SNIP>
DEBUG Generating Cluster...                        
INFO Creating infrastructure resources...         
DEBUG Symlinking plugin terraform-provider-local src: "/home/jhixson/go/src/github.com/openshift/installer/bin/openshift-install" dst: "/tmp/openshift-install-732899658/plugins/terraform-provider-local" 
DEBUG Symlinking plugin terraform-provider-openstack src: "/home/jhixson/go/src/github.com/openshift/installer/bin/openshift-install" dst: "/tmp/openshift-install-732899658/plugins/terraform-provider-openstack" 
DEBUG Symlinking plugin terraform-provider-random src: "/home/jhixson/go/src/github.com/openshift/installer/bin/openshift-install" dst: "/tmp/openshift-install-732899658/plugins/terraform-provider-random" 
DEBUG Symlinking plugin terraform-provider-aws src: "/home/jhixson/go/src/github.com/openshift/installer/bin/openshift-install" dst: "/tmp/openshift-install-732899658/plugins/terraform-provider-aws" 
DEBUG Symlinking plugin terraform-provider-azurerm src: "/home/jhixson/go/src/github.com/openshift/installer/bin/openshift-install" dst: "/tmp/openshift-install-732899658/plugins/terraform-provider-azurerm" 
DEBUG Symlinking plugin terraform-provider-azureprivatedns src: "/home/jhixson/go/src/github.com/openshift/installer/bin/openshift-install" dst: "/tmp/openshift-install-732899658/plugins/terraform-provider-azureprivatedns" 
DEBUG Symlinking plugin terraform-provider-google src: "/home/jhixson/go/src/github.com/openshift/installer/bin/openshift-install" dst: "/tmp/openshift-install-732899658/plugins/terraform-provider-google" 
DEBUG Symlinking plugin terraform-provider-ignition src: "/home/jhixson/go/src/github.com/openshift/installer/bin/openshift-install" dst: "/tmp/openshift-install-732899658/plugins/terraform-provider-ignition" 
DEBUG Initializing modules...                      
DEBUG - bootstrap in ../../../tmp/openshift-install-732899658/bootstrap 
DEBUG - dns in ../../../tmp/openshift-install-732899658/dns 
DEBUG - master in ../../../tmp/openshift-install-732899658/master 
DEBUG - vnet in ../../../tmp/openshift-install-732899658/vnet 
DEBUG                                              
DEBUG Initializing the backend...                  
DEBUG                                              
DEBUG Initializing provider plugins...             
DEBUG                                              
DEBUG Terraform has been successfully initialized! 
DEBUG                                              
DEBUG You may now begin working with Terraform. Try running "terraform plan" to see 
DEBUG any changes that are required for your infrastructure. All Terraform commands 
DEBUG should now work.                             
DEBUG                                              
DEBUG If you ever set or change modules or backend configuration for Terraform, 
DEBUG rerun this command to reinitialize your working directory. If you forget, other 
DEBUG commands will detect it and remind you to do so if necessary. 
DEBUG module.vnet.data.azurerm_virtual_network.preexisting_virtual_network[0]: Refreshing state... 
DEBUG module.vnet.data.azurerm_subnet.preexisting_worker_subnet[0]: Refreshing state... 
DEBUG data.azurerm_resource_group.network[0]: Refreshing state... 
DEBUG module.vnet.data.azurerm_subnet.preexisting_master_subnet[0]: Refreshing state... 
ERROR                                              
ERROR Error: Error: Resource Group "DOESNOTEXIST_jhixson_vnet_rg" was not found 
ERROR                                              
ERROR   on ../../../tmp/openshift-install-732899658/main.tf line 106, in data "azurerm_resource_group" "network": 
ERROR  106: data "azurerm_resource_group" "network" { 
ERROR                                              
ERROR                                              
ERROR                                              
ERROR Error: Error: Subnet "DOESNOTEXIST_jhixson_test_master_subnet" (Virtual Network "DOESNOTEXIST_jhixson_test_vnet" / Resource Group "DOESNOTEXIST_jhixson_vnet_rg") was not found 
ERROR                                              
ERROR   on ../../../tmp/openshift-install-732899658/vnet/common.tf line 4, in data "azurerm_subnet" "preexisting_master_subnet": 
ERROR    4: data "azurerm_subnet" "preexisting_master_subnet" { 
ERROR                                              
ERROR                                              
ERROR                                              
ERROR Error: Error: Subnet "DOESNOTEXIST_jhixson_test_worker_subnet" (Virtual Network "DOESNOTEXIST_jhixson_test_vnet" / Resource Group "DOESNOTEXIST_jhixson_vnet_rg") was not found 
ERROR                                              
ERROR   on ../../../tmp/openshift-install-732899658/vnet/common.tf line 12, in data "azurerm_subnet" "preexisting_worker_subnet": 
ERROR   12: data "azurerm_subnet" "preexisting_worker_subnet" { 
ERROR                                              
ERROR                                              
ERROR                                              
ERROR Error: Error: Virtual Network "DOESNOTEXIST_jhixson_test_vnet" (Resource Group "DOESNOTEXIST_jhixson_vnet_rg") was not found 
ERROR                                              
ERROR   on ../../../tmp/openshift-install-732899658/vnet/common.tf line 20, in data "azurerm_virtual_network" "preexisting_virtual_network": 
ERROR   20: data "azurerm_virtual_network" "preexisting_virtual_network" { 
ERROR                                              
ERROR                                              
ERROR Failed to read tfstate: open /tmp/openshift-install-732899658/terraform.tfstate: no such file or directory 
FATAL failed to fetch Cluster: failed to generate asset "Cluster": failed to create cluster: failed to apply using Terraform 


Expected results:

Error out of the installer as soon as possible when any one of the required resources does not exist or is wrong.

Comment 2 Mike Gahagan 2019-11-11 16:51:22 UTC
Confirmed Network Resource Group validation is in place and working in 4.3.0-0.nightly-2019-11-11-132930

[m@dhcp145-82 43_azure_install]$ ./openshift-install create cluster --dir=clusters/mgahagan-111111 --log-level debug
DEBUG OpenShift Installer v4.3.0                   
DEBUG Built from commit 0b98b56e96f2e56a12dcaf1860d3162294b07a82 
DEBUG Fetching Terraform Variables...              
DEBUG Loading Terraform Variables...               
DEBUG   Loading Cluster ID...                      
DEBUG     Loading Install Config...                
DEBUG       Loading SSH Key...                     
DEBUG       Using SSH Key loaded from state file   
DEBUG       Loading Base Domain...                 
DEBUG         Loading Platform...                  
DEBUG         Using Platform loaded from state file 
DEBUG       Using Base Domain loaded from state file 
DEBUG       Loading Cluster Name...                
DEBUG         Loading Base Domain...               
DEBUG       Using Cluster Name loaded from state file 
DEBUG       Loading Pull Secret...                 
DEBUG       Using Pull Secret loaded from state file 
DEBUG       Loading Platform...                    
FATAL failed to fetch Terraform Variables: failed to load asset "Install Config": platform.azure.virtualNetwork: Invalid value: "DOESNOTEXIST_jhixson_test_vnet": failed to get virtual network DOESNOTEXIST_jhixson_test_vnet: network.VirtualNetworksClient#Get: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="ResourceGroupNotFound" Message="Resource group 'DOESNOTEXIST_jhixson_vnet_rg' could not be found."

Comment 4 errata-xmlrpc 2020-01-23 11:11:45 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:0062


Note You need to log in before you can comment on or make changes to this bug.