Skip to content

Use the context of cluster_name in the function get_client_type_by_name#14723

Open
jilju wants to merge 1 commit intored-hat-storage:masterfrom
jilju:use_clustrer_name_context_get_client_type_by_name
Open

Use the context of cluster_name in the function get_client_type_by_name#14723
jilju wants to merge 1 commit intored-hat-storage:masterfrom
jilju:use_clustrer_name_context_get_client_type_by_name

Conversation

@jilju
Copy link
Contributor

@jilju jilju commented Mar 19, 2026

The function get_client_type_by_name is unaware of the current cluster context. It assumes the current context is of the cluster_name value and call other functions which require provider mode context. Without current context being the given cluster, the called functions cannot use the value of ENV_DATA.provider_cluster_name.
Added switch to cluster_name context and marker switch_to_orig_index_at_last.

@jilju jilju requested a review from a team as a code owner March 19, 2026 19:39
@openshift-ci
Copy link

openshift-ci bot commented Mar 19, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: jilju

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jilju
Copy link
Contributor Author

jilju commented Mar 19, 2026

Example of a situation which will be solved by this PR. get_client_type_by_name is calling is_hosted_cluster where it switch to provider context without considering the possibility of 2 provider clusters in the config, like in RDR scenarios.

The info Resource: 'bm4-c21-01', selector: 'None' was not found. is because the hosted cluster bm4-c21-01 was verified in another provider cluster. Switching the context as added in this PR will resolve this issue.

2026-03-19 19:03:29  09:33:29 - MainThread - ocs_ci.ocs.acm.acm - �[32mINFO�[0m - C[jijoy-ah-m18] - Click on 'Install'
2026-03-19 19:03:29  09:33:29 - MainThread - ocs_ci.framework - �[32mINFO�[0m - C[jijoy-bm2] - Switched to cluster: jijoy-bm2
2026-03-19 19:03:29  09:33:29 - MainThread - ocs_ci.ocs.ocp - �[32mINFO�[0m - C[jijoy-bm2] - Check if resource: bm2-c21-01 exists.
2026-03-19 19:03:29  09:33:29 - MainThread - ocs_ci.utility.utils - �[32mINFO�[0m - C[jijoy-bm2] - Executing command: oc --kubeconfig /home/jenkins/clusters/jijoy-bm2/openshift-cluster-dir/auth/kubeconfig -n clusters get hostedclusters bm2-c21-01 -n clusters -o yaml
2026-03-19 19:03:30  09:33:29 - MainThread - ocs_ci.ocs.ocp - �[32mINFO�[0m - C[jijoy-bm2] - Resource: 'bm2-c21-01', selector: 'None' was found.
2026-03-19 19:03:30  09:33:29 - MainThread - ocs_ci.framework - �[32mINFO�[0m - C[jijoy-ah-m18] - Switched to cluster: jijoy-ah-m18
2026-03-19 19:03:30  09:33:29 - MainThread - ocs_ci.framework - �[32mINFO�[0m - C[bm2-c21-01] - Switched to cluster: bm2-c21-01
2026-03-19 19:03:30  09:33:29 - MainThread - ocs_ci.framework - �[32mINFO�[0m - C[jijoy-bm2] - Switched to cluster: jijoy-bm2
2026-03-19 19:03:30  09:33:29 - MainThread - ocs_ci.utility.utils - �[32mINFO�[0m - C[jijoy-bm2] - Executing command: oc --kubeconfig /home/jenkins/clusters/jijoy-bm2/openshift-cluster-dir/auth/kubeconfig -n clusters get hostedclusters bm2-c21-01 -n clusters -o yaml
2026-03-19 19:03:30  09:33:30 - MainThread - ocs_ci.utility.decorators - �[32mINFO�[0m - C[jijoy-bm2] - Switching back to the original cluster
2026-03-19 19:03:30  09:33:30 - MainThread - ocs_ci.framework - �[32mINFO�[0m - C[jijoy-ah-m18] - Switched to cluster: jijoy-ah-m18
2026-03-19 19:03:30  09:33:30 - MainThread - ocs_ci.ocs.ocp - �[32mINFO�[0m - C[jijoy-ah-m18] - Command: patch SubmarinerConfig submariner -n dr-bm2-c21-01 -p '[{"op": "replace", "path": "/spec/hostedCluster", "value": true }, {"op": "replace", "path": "/spec/loadBalancerEnable", "value": true }]' --type json
2026-03-19 19:03:30  09:33:30 - MainThread - ocs_ci.utility.utils - �[32mINFO�[0m - C[jijoy-ah-m18] - Executing command: oc --kubeconfig /home/jenkins/clusters/jijoy-ah-m18/openshift-cluster-dir/auth/kubeconfig -n dr-bm2-c21-01 patch SubmarinerConfig submariner -n dr-bm2-c21-01 -p '[{"op": "replace", "path": "/spec/hostedCluster", "value": true }, {"op": "replace", "path": "/spec/loadBalancerEnable", "value": true }]' --type json
2026-03-19 19:03:30  09:33:30 - MainThread - ocs_ci.framework - �[32mINFO�[0m - C[jijoy-bm2] - Switched to cluster: jijoy-bm2
2026-03-19 19:03:30  09:33:30 - MainThread - ocs_ci.ocs.ocp - �[32mINFO�[0m - C[jijoy-bm2] - Check if resource: bm4-c21-01 exists.
2026-03-19 19:03:30  09:33:30 - MainThread - ocs_ci.utility.utils - �[32mINFO�[0m - C[jijoy-bm2] - Executing command: oc --kubeconfig /home/jenkins/clusters/jijoy-bm2/openshift-cluster-dir/auth/kubeconfig -n clusters get hostedclusters bm4-c21-01 -n clusters -o yaml
2026-03-19 19:03:31  09:33:30 - MainThread - ocs_ci.ocs.ocp - �[32mINFO�[0m - C[jijoy-bm2] - Resource: 'bm4-c21-01', selector: 'None' was not found.
2026-03-19 19:03:31  09:33:30 - MainThread - ocs_ci.framework - �[32mINFO�[0m - C[jijoy-ah-m18] - Switched to cluster: jijoy-ah-m18
2026-03-19 19:03:31  09:33:30 - MainThread - ocs_ci.utility.utils - �[32mINFO�[0m - C[jijoy-ah-m18] - Executing command: oc --kubeconfig /home/jenkins/clusters/jijoy-ah-m18/openshift-cluster-dir/auth/kubeconfig get managedclusters.cluster.open-cluster-management.io -o yaml
2026-03-19 19:03:31  09:33:31 - MainThread - ocs_ci.framework - �[32mINFO�[0m - C[jijoy-bm2] - Switched to cluster: jijoy-bm2
2026-03-19 19:03:31  09:33:31 - MainThread - ocs_ci.ocs.ocp - �[32mINFO�[0m - C[jijoy-bm2] - Check if resource: bm2-c21-01 exists.
2026-03-19 19:03:31  09:33:31 - MainThread - ocs_ci.utility.utils - �[32mINFO�[0m - C[jijoy-bm2] - Executing command: oc --kubeconfig /home/jenkins/clusters/jijoy-bm2/openshift-cluster-dir/auth/kubeconfig -n clusters get hostedclusters bm2-c21-01 -n clusters -o yaml
2026-03-19 19:03:32  09:33:32 - MainThread - ocs_ci.ocs.ocp - �[32mINFO�[0m - C[jijoy-bm2] - Resource: 'bm2-c21-01', selector: 'None' was found.
2026-03-19 19:03:32  09:33:32 - MainThread - ocs_ci.framework - �[32mINFO�[0m - C[jijoy-ah-m18] - Switched to cluster: jijoy-ah-m18
2026-03-19 19:03:32  09:33:32 - MainThread - ocs_ci.framework - �[32mINFO�[0m - C[jijoy-bm2] - Switched to cluster: jijoy-bm2
2026-03-19 19:03:32  09:33:32 - MainThread - ocs_ci.ocs.ocp - �[32mINFO�[0m - C[jijoy-bm2] - Check if resource: bm4-c21-01 exists.
2026-03-19 19:03:32  09:33:32 - MainThread - ocs_ci.utility.utils - �[32mINFO�[0m - C[jijoy-bm2] - Executing command: oc --kubeconfig /home/jenkins/clusters/jijoy-bm2/openshift-cluster-dir/auth/kubeconfig -n clusters get hostedclusters bm4-c21-01 -n clusters -o yaml
2026-03-19 19:03:32  09:33:32 - MainThread - ocs_ci.ocs.ocp - �[32mINFO�[0m - C[jijoy-bm2] - Resource: 'bm4-c21-01', selector: 'None' was not found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant