Skip to content

Commit

Permalink
Update inject_bootstrap (#1987)
Browse files Browse the repository at this point in the history
* Update inject_bootstrap

Operate on files in IBIP_DIR

* Mount BIP_BUTANE_CONFIG in skipper
  • Loading branch information
vrutkovs authored Jan 16, 2023
1 parent f17ed33 commit 22d51f0
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 21 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ minikube
*~
.env
capi
sno-bootstrap-manifests

# terraform
.terraform.lock.hcl
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ ifeq ($(ENABLE_KUBE_API),true)
SERVICE_REPLICAS_COUNT=1
AUTH_TYPE=local
endif
ifdef BIP_BUTANE_CONFIG
BOOTSTRAP_INJECT_DIR=$(ROOT_DIR)/sno-bootstrap-manifests/
BOOTSTRAP_INJECT_MANIFEST=$(BOOTSTRAP_INJECT_DIR}/$(notdir ${BIP_BUTANE_CONFIG})
endif

.EXPORT_ALL_VARIABLES:

Expand Down Expand Up @@ -253,6 +257,10 @@ deploy_static_network_config_nodes:
.PHONY: deploy_ibip
deploy_ibip:
# To deploy with a worker node, set TEST_FUNC=test_bip_add_worker
ifdef BIP_BUTANE_CONFIG
rm -rf ${BOOTSTRAP_INJECT_DIR}; mkdir ${BOOTSTRAP_INJECT_DIR}
mv $(dir ${BIP_BUTANE_CONFIG})/* ${BOOTSTRAP_INJECT_DIR}/
endif
skipper make $(SKIPPER_PARAMS) _test TEST=./src/tests/test_bootstrap_in_place.py TEST_FUNC=$(or ${TEST_FUNC},'test_bootstrap_in_place_sno')

redeploy_nodes: destroy_nodes deploy_nodes
Expand Down
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ This project deploys the OpenShift Assisted Installer in Minikube and spawns lib

**Table of contents**

- [!! Warning !!](#-warning-)
- [Test-Infra](#test-infra)
- [Prerequisites](#prerequisites)
- [Installation Guide](#installation-guide)
Expand All @@ -18,26 +19,24 @@ This project deploys the OpenShift Assisted Installer in Minikube and spawns lib
- [Deployment config](#deployment-config)
- [Cluster configmap](#cluster-configmap)
- [Installation parameters](#installation-parameters)
- [Vsphere parameters](#vsphere-parameters)
- [Instructions](#instructions)
- [Host preparation](#host-preparation)
- [Usage](#usage)
- [Adding a new e2e flow](#new-e2e-flow)
- [Adding a new e2e flow](#adding-a-new-e2e-flow)
- [Full flow cases](#full-flow-cases)
- [Run full flow with install](#run-full-flow-with-install)
- [Run full flow without install](#run-full-flow-without-install)
- [Run full flow with ipv6](#run-full-flow-with-ipv6)
- [Run only deploy nodes (without pre deploy of all assisted service)](#run-only-deploy-nodes-without-pre-deploy-of-all-assisted-service)
- [Redeploy nodes](#redeploy-nodes)
- [Redeploy with assisted services](#redeploy-with-assisted-services)
- [Cleaning](#cleaning)
- [Clean all include minikube](#clean-all-include-minikube)
- [Clean nodes only](#clean-nodes-only)
- [Delete all virsh resources](#delete-all-virsh-resources)
- [Install cluster](#install-cluster)
- [Create cluster and download ISO](#create-cluster-and-download-iso)
- [Deploy Assisted Service and Monitoring stack](#deploy-assisted-service-and-monitoring-stack)
- [`deploy_assisted_service` and Create cluster and download ISO](#deploy_assisted_service-and-create-cluster-and-download-iso)
- [start_minikube and Deploy UI and open port forwarding on port 6008, allows to connect to it from browser](#start_minikube-and-deploy-ui-and-open-port-forwarding-on-port-6008-allows-to-connect-to-it-from-browser)
- [start\_minikube and Deploy UI and open port forwarding on port 6008, allows to connect to it from browser](#start_minikube-and-deploy-ui-and-open-port-forwarding-on-port-6008-allows-to-connect-to-it-from-browser)
- [Kill all open port forwarding commands, will be part of destroy target](#kill-all-open-port-forwarding-commands-will-be-part-of-destroy-target)
- [Test `assisted-service` image](#test-assisted-service-image)
- [Test agent image](#test-agent-image)
Expand All @@ -48,9 +47,10 @@ This project deploys the OpenShift Assisted Installer in Minikube and spawns lib
- [Test with RHSSO Authentication](#test-with-rhsso-authentication)
- [Single Node - Bootstrap in place with Assisted Service](#single-node---bootstrap-in-place-with-assisted-service)
- [Single Node - Bootstrap in place with Assisted Service and IPv6](#single-node---bootstrap-in-place-with-assisted-service-and-ipv6)
- [Kind](#kind)
- [On-prem](#on-prem)
- [Run operator](#run-operator)
- [Cluster-API-provider-agent](#Cluster-API-provider-agent)
- [Cluster-API-provider-agent](#cluster-api-provider-agent)
- [Test iPXE boot flow](#test-ipxe-boot-flow)

## Prerequisites
Expand Down Expand Up @@ -379,6 +379,8 @@ export NUM_MASTERS=1
make deploy_nodes_with_install
```

Set BIP_BUTANE_CONFIG env var to the path with butane config to be merged with bootstrap. Might be useful for promtail logging / other debug tasks

## Single Node - Bootstrap in place with Assisted Service and IPv6

To test single node bootstrap in place flow with assisted service and ipv6
Expand Down
2 changes: 1 addition & 1 deletion skipper.env
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,4 @@ RECLAIM_HOSTS
PREVIOUS_AGENT_IMAGE
BROKEN_AGENT_IMAGE
DISCOVERY_KERNEL_ARGUMENTS
BIP_BUTANE_CONFIG
BOOTSTRAP_INJECT_MANIFEST
4 changes: 0 additions & 4 deletions src/assisted_test_infra/test_infra/helper_classes/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,3 @@ def wait_and_kill_installer(self, host):
# Kill installer to simulate host error
selected_node = self.nodes.get_node_from_cluster_host(host)
selected_node.kill_installer()

@property
def bip_butane_config(self):
return self._config.bip_butane_config
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,3 @@ class BaseClusterConfig(BaseEntityConfig, ABC):
disk_encryption_mode: str = None
disk_encryption_roles: str = None
tang_servers: str = None
bip_butane_config: str = None
2 changes: 0 additions & 2 deletions src/tests/global_variables/env_variables_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ class _EnvVariables(DataPool, ABC):

ipxe_boot: EnvVar = EnvVar(["IPXE_BOOT"], loader=lambda x: bool(strtobool(x)))

bip_butane_config: EnvVar = EnvVar(["BIP_BUTANE_CONFIG"])

vsphere_parent_folder: str = EnvVar(["VSPHERE_PARENT_FOLDER"], default=env_defaults.DEFAULT_VSHPERE_PARENT_FOLDER)
vsphere_folder: str = EnvVar(["VSPHERE_FOLDER"])
vsphere_cluster: EnvVar = EnvVar(["VSPHERE_CLUSTER"])
Expand Down
17 changes: 10 additions & 7 deletions src/tests/test_bootstrap_in_place.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,16 +280,18 @@ def waiting_for_installation_completion(
self.log_collection(master_ip)

def inject_bootstrap(self, ignition_filename: str, butane_config: str):
expected_ignition_name = "bootstrap_initial.ign"
shutil.move(ignition_filename, expected_ignition_name)
# Backup bip ignition file to bootstrap_initial.ign
initial_ignition = os.path.join(IBIP_DIR, ignition_filename)
backup_ignition = os.path.join(IBIP_DIR, "bootstrap_initial.ign")
shutil.move(initial_ignition, backup_ignition)
flags = shlex.split(f"--rm -v {os.getcwd()}:/data -w /data")
# retry to avoid occassional quay hiccups
# Patch ignition with additional files and services
self.retrying_run_container(
"butane",
"quay.io/coreos/butane:release",
flags,
butane_config,
f"-o {ignition_filename}",
f"/data/{IBIP_DIR}/{butane_config}",
f"-o /data/{initial_ignition}",
)

def prepare_installation(self, controller_configuration: BaseNodesConfig, cluster_configuration: ClusterConfig):
Expand All @@ -303,8 +305,9 @@ def prepare_installation(self, controller_configuration: BaseNodesConfig, cluste
self.installer_generate(openshift_release_image)

ignition_filename = "bootstrap-in-place-for-live-iso.ign"
if cluster_configuration.bip_butane_config:
self.inject_bootstrap(ignition_filename, cluster_configuration.bip_butane_config)
bip_butane_config = os.environ.get("BOOTSTRAP_INJECT_MANIFEST")
if bip_butane_config:
self.inject_bootstrap(ignition_filename, bip_butane_config)

self.download_live_image(
f"{BUILD_DIR}/installer-image.iso", extract_rhcos_url_from_ocp_installer(INSTALLER_BINARY)
Expand Down

0 comments on commit 22d51f0

Please sign in to comment.