Skip to content

Commit

Permalink
OPENSHIFTP-188: disable etcd defragmentation using flag cicd_disable_…
Browse files Browse the repository at this point in the history
…defrag

Signed-off-by: Chandan Abhyankar <[email protected]>
  • Loading branch information
Chandan-Abhyankar authored and prb112 committed Jul 29, 2024
1 parent e4e3f85 commit a78eadb
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ module "support" {
nfs_path = var.nfs_path
cluster_network_mtu = var.cluster_network_mtu
cicd = var.cicd
cicd_disable_defrag = var.cicd_disable_defrag
}

module "worker" {
Expand Down
28 changes: 28 additions & 0 deletions modules/4_pvs_support/pvs_support.tf
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,34 @@ EOF
}
}

# Dev Note: disable etcd defragmentation using flag cicd_disable_defrag
resource "null_resource" "disable_etcd_defrag" {
depends_on = [null_resource.config_login, null_resource.config]
count = var.cicd_disable_defrag ? 1 : 0
connection {
type = "ssh"
user = var.rhel_username
host = var.bastion_public_ip
private_key = file(var.private_key_file)
agent = var.ssh_agent
timeout = "${var.connection_timeout}m"
}

provisioner "remote-exec" {
inline = [<<EOF
export HTTPS_PROXY="http://${var.vpc_support_server_ip}:3128"
outval=$(oc get configmap etcd-disable-defrag -n openshift-etcd-operator)
if [ -z "$outval" ]
then
oc create configmap etcd-disable-defrag -n openshift-etcd-operator
else
echo "configmap etcd-disable-defrag already exists"
fi
EOF
]
}
}

# Dev Note: setup nfs deployment
resource "null_resource" "nfs_deployment" {
depends_on = [null_resource.config_login, null_resource.config]
Expand Down
1 change: 1 addition & 0 deletions modules/4_pvs_support/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ variable "nfs_server" {}
variable "nfs_path" {}
variable "cluster_network_mtu" {}
variable "cicd" {}
variable "cicd_disable_defrag" {}
variable "worker" {
type = object({ count = number, memory = string, processors = string })
default = {
Expand Down
7 changes: 7 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,13 @@ variable "keep_dns" {
default = false
}

variable "cicd_disable_defrag" {
type = bool
description = "Creates a config map 'etcd-disable-defrag' to disable the etcd defragmentation"
default = false
# User needs to manually remove the config map to restore the settings
}

################################################################
# Overrides the dhcp network, transit gateway creation from a
# PowerVS perspective.
Expand Down

0 comments on commit a78eadb

Please sign in to comment.