Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set cluster_kubeconfig based on the type of resource available in provider cluster only #10172

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

jilju
Copy link
Contributor

@jilju jilju commented Jul 25, 2024

In provider mode multicluster run, set 'cluster_kubeconfig' if the resource kind is available only in provider cluster.

  • Created a primary list of 'Kind' which are available in provider cluster.
  • Set the cluster_kubeconfig value to provider cluster kubeconfig path if the Kind is available in the list.

Advantages:

  • When using the class OCP or OCS, need not switch cluster context to provider to get/create/delete/patch/decribe etc.. a resource that is in provider cluster.

Example: Need not bother about the current cluster context when using the function

def get_storage_cluster(namespace=None):
and also when using the returned object.

  • Enables simultaneous usages of two instances of different kinds where one of them is in provider and the other one is in the client cluster.
    eg: When using threading (or a mechanism to run two oc commands at the same time) , get StorageCluster(from provider) and application pod(from client) at the same time. Switching context is not helpful in this situation.

Limitations:

  • All config values are not set as the cluster where the resource is present. eg: ocs_version. This have less impact because these config values are not used in 'oc' commands. cluster_namespace will be used which is going to be same for provider and client going forward. Added a TODO to overcome this.

@pull-request-size pull-request-size bot added the size/M PR that changes 30-99 lines label Jul 25, 2024
@jilju jilju marked this pull request as ready for review August 26, 2024 11:40
@jilju jilju requested a review from a team as a code owner August 26, 2024 11:40
Copy link
Contributor

@fbalak fbalak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this is good and it can help to fix a lot of test cases without editing them. It would be good to have this included with cluster context too but it is enough to have it as TODO for now.
The note about simultaneous usage could be solved if each context have assigned static address to its kubeconfig - The static path to kubeconfig needs to exist for this PR to work. In this way the kubeconfig wouldn't have to be specifically provided but it would be used from the context and users would have access to other environment information like config parameters for the given context. It would also mitigate conflicts in different context and kubeconfig.
It would also mean not to provide kubeconfig in parameter but to add cluster_context as parameter (and use current context (config.cluster_ctx.MULTICLUSTER.get("multicluster_index")) as default).

Copy link

openshift-ci bot commented Sep 17, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dahorak, fbalak, jilju

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

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

Copy link

@ocs-ci ocs-ci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR validation

Cluster Name:
Cluster Configuration:
PR Test Suite: acceptance
PR Test Path: tests/
Additional Test Params:
OCP VERSION: 4.17
OCS VERSION: 4.17
tested against branch: master

Job PASSED.

Verified that this change is not breaking anything

@jilju
Copy link
Contributor Author

jilju commented Sep 20, 2024

Verified in provider-client multicluster run https://ocs4-jenkins-csb-odf-qe.apps.ocp-c1.prod.psi.redhat.com/job/qe-odf-multicluster/2677/
The change does not break anything.

@jilju jilju added the Verified Mark when PR was verified and log provided label Sep 20, 2024
Copy link

openshift-ci bot commented Sep 20, 2024

New changes are detected. LGTM label has been removed.

@jilju jilju added the provider-client Provider-client solution label Sep 20, 2024
@jilju jilju merged commit b452aaa into red-hat-storage:master Sep 20, 2024
6 of 7 checks passed
@jilju jilju deleted the provider_kinds branch September 20, 2024 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
provider-client Provider-client solution size/M PR that changes 30-99 lines Verified Mark when PR was verified and log provided
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants