Skip to content

Commit

Permalink
Merge pull request #7822 from r4f4/azure-revert-pr7642
Browse files Browse the repository at this point in the history
OCPBUGS-24995: Revert "Merge pull request #7642 from AnnaZivkovic/azure_duplicate_im…
  • Loading branch information
openshift-merge-bot[bot] committed Dec 12, 2023
2 parents 5fb7adc + 5f80a97 commit 271f256
Show file tree
Hide file tree
Showing 10 changed files with 104 additions and 251 deletions.
8 changes: 4 additions & 4 deletions data/data/azure/bootstrap/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ provider "azurerm" {
}

data "azurerm_storage_account" "storage_account" {
name = azurerm_storage_account.cluster.name
name = var.storage_account_name
resource_group_name = var.resource_group_name
}

Expand Down Expand Up @@ -57,13 +57,13 @@ data "azurerm_storage_account_sas" "ignition" {

resource "azurerm_storage_container" "ignition" {
name = "ignition"
storage_account_name = azurerm_storage_account.cluster.name
storage_account_name = var.storage_account_name
}

resource "azurerm_storage_blob" "ignition" {
name = "bootstrap.ign"
source = var.ignition_bootstrap_file
storage_account_name = azurerm_storage_account.cluster.name
storage_account_name = var.storage_account_name
storage_container_name = azurerm_storage_container.ignition.name
type = var.azure_keyvault_key_name != "" ? "Page" : "Block"
}
Expand Down Expand Up @@ -223,7 +223,7 @@ resource "azurerm_linux_virtual_machine" "bootstrap" {
}

# Either source_image_id or source_image_reference must be defined
source_image_id = azurerm_shared_image_version.bootstrap_image_version.id
source_image_id = ! var.azure_use_marketplace_image ? var.vm_image : null

dynamic "source_image_reference" {
for_each = var.azure_use_marketplace_image ? [1] : []
Expand Down
9 changes: 0 additions & 9 deletions data/data/azure/bootstrap/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
output "bootstrap_ip" {
value = var.azure_private ? azurerm_network_interface.bootstrap.private_ip_address : azurerm_public_ip.bootstrap_public_ip_v4[0].ip_address
}

output "storage_account_id" {
value = azurerm_storage_account.cluster.id
}

output "storage_rhcos_image_url" {
value = azurerm_storage_blob.rhcos_image.url
}

89 changes: 0 additions & 89 deletions data/data/azure/bootstrap/storage.tf

This file was deleted.

18 changes: 4 additions & 14 deletions data/data/azure/bootstrap/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,14 @@ variable "resource_group_name" {
description = "The resource group name for the deployment."
}

variable "image_version_gallery_name" {
variable "storage_account_name" {
type = string
description = "The name of the image gallery used to set up shared images."
description = "the name of the storage account for the cluster. It can be used for boot diagnostics."
}

variable "image_version_gen2_gallery_name" {
variable "vm_image" {
type = string
description = "The name of the gen2 image gallery used to set up shared images."
}

variable "image_version_name" {
type = string
description = "The name of shared image used to set up shared images."
}

variable "image_version_gen2_name" {
type = string
description = "The name of the gen2 shared image used to set up shared images."
description = "The resource id of the vm image used for bootstrap."
}

variable "identity" {
Expand Down
11 changes: 1 addition & 10 deletions data/data/azure/cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module "master" {
vm_size = var.azure_master_vm_type
disk_encryption_set_id = var.azure_master_disk_encryption_set_id
encryption_at_host_enabled = var.azure_master_encryption_at_host_enabled
vm_image = var.vm_image
identity = var.identity
ignition = var.ignition_master
elb_backend_pool_v4_id = var.elb_backend_pool_v4_id
Expand Down Expand Up @@ -52,16 +53,6 @@ module "master" {
secure_boot = var.azure_master_secure_boot
virtualized_trusted_platform_module = var.azure_master_virtualized_trusted_platform_module

storage_account_id = var.storage_account_id
storage_rhcos_image_url = var.storage_rhcos_image_url
image_version_gallery_name = var.image_version_gallery_name
image_version_gen2_gallery_name = var.image_version_gen2_gallery_name
image_version_name = var.image_version_name
image_version_gen2_name = var.image_version_gen2_name
azure_image_release = var.azure_image_release
azure_region = var.azure_region
azure_hypervgeneration_version = var.azure_hypervgeneration_version

use_ipv4 = var.use_ipv4
use_ipv6 = var.use_ipv6
}
Expand Down
41 changes: 2 additions & 39 deletions data/data/azure/cluster/master/master.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,6 @@ locals {
ip_v4_configuration_name = "pipConfig"
// TODO: Azure machine provider probably needs to look for pipConfig-v6 as well (or a different name like pipConfig-secondary)
ip_v6_configuration_name = "pipConfig-v6"

vm_image = var.azure_hypervgeneration_version == "V2" ? azurerm_shared_image_version.clustergen2_image_version.id : azurerm_shared_image_version.cluster_image_version.id

}
resource "azurerm_shared_image_version" "cluster_image_version" {
name = var.azure_image_release
gallery_name = var.image_version_gallery_name
image_name = var.image_version_name
resource_group_name = var.resource_group_name
location = var.azure_region

blob_uri = var.storage_rhcos_image_url
storage_account_id = var.storage_account_id

target_region {
name = var.azure_region
regional_replica_count = 1
}

tags = var.azure_extra_tags
}

resource "azurerm_shared_image_version" "clustergen2_image_version" {
name = var.azure_image_release
gallery_name = var.image_version_gen2_gallery_name
image_name = var.image_version_gen2_name
resource_group_name = var.resource_group_name
location = var.azure_region

blob_uri = var.storage_rhcos_image_url
storage_account_id = var.storage_account_id

target_region {
name = var.azure_region
regional_replica_count = 1
}

tags = var.azure_extra_tags
}

resource "azurerm_network_interface" "master" {
Expand Down Expand Up @@ -162,7 +124,8 @@ resource "azurerm_linux_virtual_machine" "master" {
}

# Either source_image_id or source_image_reference must be defined
source_image_id = ! var.use_marketplace_image ? local.vm_image : null
source_image_id = ! var.use_marketplace_image ? var.vm_image : null

dynamic "source_image_reference" {
for_each = var.use_marketplace_image ? [1] : []

Expand Down
41 changes: 2 additions & 39 deletions data/data/azure/cluster/master/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,46 +27,9 @@ variable "encryption_at_host_enabled" {
description = "Enables encryption at the VM host."
}

variable "storage_account_id" {
variable "vm_image" {
type = string
description = "The storage account ID for the cluster. It can be used for boot diagnostics"
}

variable "storage_rhcos_image_url" {
type = string
description = "The rhcos image url used to identify the vm image for bootstrap and cluster."
}

variable "image_version_gallery_name" {
type = string
description = "The name of the image gallery used to set up shared images."
}

variable "image_version_gen2_gallery_name" {
type = string
description = "The name of the gen2 image gallery used to set up shared images."
}

variable "image_version_name" {
type = string
description = "The name of shared image used to set up shared images."
}

variable "image_version_gen2_name" {
type = string
description = "The name of the gen2 shared image used to set up shared images."
}

variable "azure_region" {
type = string
}

variable "azure_image_release" {
type = string
}

variable "azure_hypervgeneration_version" {
type = string
description = "The resource id of the vm image used for masters."
}

variable "use_marketplace_image" {
Expand Down
29 changes: 2 additions & 27 deletions data/data/azure/cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -62,34 +62,9 @@ variable "resource_group_name" {
description = "The resource group name for the deployment."
}

variable "storage_account_id" {
variable "vm_image" {
type = string
description = "The storage account ID for the cluster. It can be used for boot diagnostics"
}

variable "storage_rhcos_image_url" {
type = string
description = "The rhcos image url used to identify the vm image for bootstrap and cluster."
}

variable "image_version_gallery_name" {
type = string
description = "The name of the image gallery used to set up shared images."
}

variable "image_version_gen2_gallery_name" {
type = string
description = "The name of the gen2 image gallery used to set up shared images."
}

variable "image_version_name" {
type = string
description = "The name of shared image used to set up shared images."
}

variable "image_version_gen2_name" {
type = string
description = "The name of the gen2 shared image used to set up shared images."
description = "The resource id of the vm image used for bootstrap."
}

variable "identity" {
Expand Down
Loading

0 comments on commit 271f256

Please sign in to comment.