def flexy_post_processing(self): """ Perform a few actions required after flexy execution: - update global pull-secret - login to mirror registry (disconected cluster) - configure proxy server (disconnected cluster) - configure ntp (if required) """ # Apply pull secrets on ocp cluster kubeconfig = os.path.join(self.cluster_path, config.RUN.get("kubeconfig_location")) # load cluster info load_cluster_info() # if on disconnected cluster, perform required tasks pull_secret_path = os.path.join(constants.DATA_DIR, "pull-secret") if config.DEPLOYMENT.get("disconnected"): # login to mirror registry login_to_mirror_registry(pull_secret_path) # configure additional allowed domains in proxy configure_allowed_domains_in_proxy() # update pull-secret secret_cmd = (f"oc set data secret/pull-secret " f"--kubeconfig {kubeconfig} " f"-n {constants.OPENSHIFT_CONFIG_NAMESPACE} " f"--from-file=.dockerconfigjson={pull_secret_path}") exec_cmd(secret_cmd) if not config.ENV_DATA.get("skip_ntp_configuration", False): ntp_cmd = (f"oc --kubeconfig {kubeconfig} " f"create -f {constants.NTP_CHRONY_CONF}") logger.info("Creating NTP chrony") exec_cmd(ntp_cmd) # sleep here to start update machineconfigpool status time.sleep(60) wait_for_machineconfigpool_status("all")
def flexy_post_processing(self): """ Perform a few actions required after flexy execution: - update global pull-secret - login to mirror registry (disconected cluster) - configure proxy server (disconnected cluster) - configure ntp (if required) """ kubeconfig = os.path.join(self.cluster_path, config.RUN.get("kubeconfig_location")) # Update kubeconfig with proxy-url (if client_http_proxy # configured) to redirect client access through proxy server. # Since flexy-dir is already copied to cluster-dir, we will update # kubeconfig on both places. flexy_kubeconfig = os.path.join( self.flexy_host_dir, constants.FLEXY_RELATIVE_CLUSTER_DIR, "auth/kubeconfig", ) update_kubeconfig_with_proxy_url_for_client(kubeconfig) update_kubeconfig_with_proxy_url_for_client(flexy_kubeconfig) # load cluster info load_cluster_info() # Download terraform binary based on version used by Flexy and # update the installer path in ENV_DATA terraform_data_dir = os.path.join(self.cluster_path, constants.TERRAFORM_DATA_DIR) terraform_tfstate = os.path.join(terraform_data_dir, "terraform.tfstate") with open(terraform_tfstate, "r") as fd: ttc = hcl.load(fd) terraform_version = ttc.get("terraform_version", config.DEPLOYMENT["terraform_version"]) terraform_installer = get_terraform(version=terraform_version) config.ENV_DATA["terraform_installer"] = terraform_installer # Download terraform ignition provider # ignition provider dependancy from OCP 4.6 ocp_version = get_ocp_version() if Version.coerce(ocp_version) >= Version.coerce("4.6"): get_terraform_ignition_provider(terraform_data_dir) # if on disconnected cluster, perform required tasks pull_secret_path = os.path.join(constants.DATA_DIR, "pull-secret") if config.DEPLOYMENT.get("disconnected"): # login to mirror registry login_to_mirror_registry(pull_secret_path) # configure additional allowed domains in proxy configure_allowed_domains_in_proxy() # update pull-secret secret_cmd = (f"oc set data secret/pull-secret " f"--kubeconfig {kubeconfig} " f"-n {constants.OPENSHIFT_CONFIG_NAMESPACE} " f"--from-file=.dockerconfigjson={pull_secret_path}") exec_cmd(secret_cmd) if not config.ENV_DATA.get("skip_ntp_configuration", False): ntp_cmd = (f"oc --kubeconfig {kubeconfig} " f"create -f {constants.NTP_CHRONY_CONF}") logger.info("Creating NTP chrony") exec_cmd(ntp_cmd) # sleep here to start update machineconfigpool status time.sleep(60) wait_for_machineconfigpool_status("all")