From 93fa223e623958f2f99d0073ef7ca40b5f2b9080 Mon Sep 17 00:00:00 2001 From: Prajyot Parab <42934355+Prajyot-Parab@users.noreply.github.com> Date: Wed, 19 Aug 2020 10:42:00 +0530 Subject: [PATCH] Update ocp upgrade code (#33) Fixes: #32 Signed-off-by: Prajyot Parab --- docs/quickstart.md | 3 ++- modules/5_install/install.tf | 5 +++-- modules/5_install/templates/upgrade_vars.yaml | 3 ++- modules/5_install/variables.tf | 3 ++- ocp.tf | 3 ++- var.tfvars | 5 +++-- variables.tf | 11 ++++++++--- 7 files changed, 22 insertions(+), 11 deletions(-) diff --git a/docs/quickstart.md b/docs/quickstart.md index a4ad400..380f7e1 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -93,7 +93,8 @@ Update the following variables specific to OCP storage. Note that currently only Update the following variables specific to OCP upgrade. The upgrade will be performed after a successful install of OCP. - * `upgrade_image` : (Optional) OpenShift release image having higher and supported version. If set, OCP cluster will be upgraded to this image version. (e.g. `"quay.io/openshift-release-dev/ocp-release-nightly@sha256:552ed19a988fff336712a50..."`) + * `upgrade_version` : (Optional) OpenShift higher and supported version. If set, OCP cluster will be upgraded to this version. (e.g. `"4.5.4"`) + * `upgrade_channel` : (Optional) OpenShift channel having required upgrade version available for cluster upgrade. By default it is automatically set to stable channel of installed cluster (eg: stable-4.5). See [Understanding Upgrade Channels](https://docs.openshift.com/container-platform/4.5/updating/updating-cluster-between-minor.html#understanding-upgrade-channels_updating-cluster-between-minor) for more information on setting the upgrade channel. * `upgrade_pause_time` : (Optional) Minutes to pause the playbook execution before starting to check the upgrade status once the upgrade command is executed. * `upgrade_delay_time` : (Optional) Seconds to wait before re-checking the upgrade status once the playbook execution resumes. diff --git a/modules/5_install/install.tf b/modules/5_install/install.tf index 665a500..5b032e9 100644 --- a/modules/5_install/install.tf +++ b/modules/5_install/install.tf @@ -72,7 +72,8 @@ locals { } upgrade_vars = { - upgrade_image = var.upgrade_image + upgrade_version = var.upgrade_version + upgrade_channel = var.upgrade_channel pause_time = var.upgrade_pause_time delay_time = var.upgrade_delay_time } @@ -148,7 +149,7 @@ resource "null_resource" "install" { resource "null_resource" "upgrade" { depends_on = [null_resource.install] - count = var.upgrade_image != "" ? 1 : 0 + count = var.upgrade_version != "" ? 1 : 0 connection { type = "ssh" user = var.rhel_username diff --git a/modules/5_install/templates/upgrade_vars.yaml b/modules/5_install/templates/upgrade_vars.yaml index 69ce756..a305010 100644 --- a/modules/5_install/templates/upgrade_vars.yaml +++ b/modules/5_install/templates/upgrade_vars.yaml @@ -1,5 +1,6 @@ --- -upgrade_image: "${upgrade_image}" +upgrade_version: "${upgrade_version}" +upgrade_channel: "${upgrade_channel}" pause_time: ${pause_time} delay_time: ${delay_time} diff --git a/modules/5_install/variables.tf b/modules/5_install/variables.tf index 1e09b16..3a585e5 100644 --- a/modules/5_install/variables.tf +++ b/modules/5_install/variables.tf @@ -61,6 +61,7 @@ variable "log_level" {} variable "ansible_extra_options" {} -variable "upgrade_image" {} +variable "upgrade_version" {} +variable "upgrade_channel" {} variable "upgrade_pause_time" {} variable "upgrade_delay_time" {} diff --git a/ocp.tf b/ocp.tf index a9aa82a..509d794 100644 --- a/ocp.tf +++ b/ocp.tf @@ -105,7 +105,8 @@ module "install" { install_playbook_tag = var.install_playbook_tag log_level = var.installer_log_level ansible_extra_options = var.ansible_extra_options - upgrade_image = var.upgrade_image + upgrade_version = var.upgrade_version + upgrade_channel = var.upgrade_channel upgrade_pause_time = var.upgrade_pause_time upgrade_delay_time = var.upgrade_delay_time } diff --git a/var.tfvars b/var.tfvars index 3942b32..730ec6f 100644 --- a/var.tfvars +++ b/var.tfvars @@ -37,11 +37,12 @@ installer_log_level = "info" ansible_extra_options = "-v" #helpernode_tag = "fddbbc651153ef2966e5cb4d4167990b31c01ceb" -#install_playbook_tag = "fd018e391831d431a0828b58c7b25f7c5b0bb581" +#install_playbook_tag = "9cfd3b330464152e795e7e4ea61385b8e684685a" storage_type = "nfs" volume_size = "300" # Value in GB -#upgrade_image = "" +#upgrade_version = "" +#upgrade_channel = "" #(stable-4.x, fast-4.x, candidate-4.x) eg. stable-4.5 #upgrade_pause_time = "90" #upgrade_delay_time = "600" diff --git a/variables.tf b/variables.tf index 603db05..b262ffb 100644 --- a/variables.tf +++ b/variables.tf @@ -156,7 +156,7 @@ variable "helpernode_tag" { variable "install_playbook_tag" { description = "Set the branch/tag name or commit# for using ocp4-playbooks repo" # Checkout level for https://github.com/ocp-power-automation/ocp4-playbooks which is used for running ocp4 installations steps - default = "fd018e391831d431a0828b58c7b25f7c5b0bb581" + default = "9cfd3b330464152e795e7e4ea61385b8e684685a" } variable "ansible_extra_options" { @@ -221,8 +221,13 @@ variable "volume_size" { default = "300" } -variable "upgrade_image" { - description = "OCP upgrade image" +variable "upgrade_version" { + description = "OCP upgrade version eg. 4.5.4" + default = "" +} + +variable "upgrade_channel" { + description = "Upgrade channel having required version availble for cluster upgrade (stable-4.x, fast-4.x, candidate-4.x) eg. stable-4.5" default = "" }