Skip to content
This repository has been archived by the owner on Aug 18, 2023. It is now read-only.

Commit

Permalink
Update ocp upgrade code (#33)
Browse files Browse the repository at this point in the history
Fixes: #32
Signed-off-by: Prajyot Parab <prajyot.parab@ibm.com>
  • Loading branch information
Prajyot-Parab authored Aug 19, 2020
1 parent f34c667 commit 93fa223
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 11 deletions.
3 changes: 2 additions & 1 deletion docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
5 changes: 3 additions & 2 deletions modules/5_install/install.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion modules/5_install/templates/upgrade_vars.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
upgrade_image: "${upgrade_image}"
upgrade_version: "${upgrade_version}"
upgrade_channel: "${upgrade_channel}"
pause_time: ${pause_time}
delay_time: ${delay_time}

3 changes: 2 additions & 1 deletion modules/5_install/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {}
3 changes: 2 additions & 1 deletion ocp.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
5 changes: 3 additions & 2 deletions var.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -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"
11 changes: 8 additions & 3 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down Expand Up @@ -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 = ""
}

Expand Down

0 comments on commit 93fa223

Please sign in to comment.