Cant login to multiple clusters
dkoci opened this issue · 4 comments
Hi. I have 2 openshift clusters. I would like to print projects from all 2 clusters. I have for loop which login into cluster one by one. It is working for 1 cluster, but I cant access to another cluter.
Am I mising something?
ocp_clusters = [{"apihost": cluster1, "username": user1, "password": pass1}, {"apihost": cluster2, "username": user2, "password": pass2}]
for cluster in ocp_clusters:
kubeConfig = OCPLoginConfiguration(ocp_username=cluster['username'], ocp_password=cluster['password'])
kubeConfig.host = cluster['apihost']
kubeConfig.verify_ssl = False
#kubeConfig.ssl_ca_cert = 'okd-test.pem' # use a certificate bundle for the TLS validation
kubeConfig.get_token()
print('Auth token: {0}'.format(kubeConfig.api_key))
print('Token expires: {0}'.format(kubeConfig.api_key_expires))
k8s_client = config.new_client_from_config()
dyn_client = DynamicClient(k8s_client)
v1_projects = dyn_client.resources.get(api_version='project.openshift.io/v1', kind='Project')
v1_routes = dyn_client.resources.get(api_version='route.openshift.io/v1', kind='Route')
project_list = v1_projects.get(label_selector='telekom.si/logging-env')
..................
rest of the code
..................
Thnak you
Issues go stale after 90d of inactivity.
Mark the issue as fresh by commenting /remove-lifecycle stale
.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen
.
If this issue is safe to close now please do so with /close
.
/lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh by commenting /remove-lifecycle rotten
.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen
.
If this issue is safe to close now please do so with /close
.
/lifecycle rotten
/remove-lifecycle stale
Rotten issues close after 30d of inactivity.
Reopen the issue by commenting /reopen
.
Mark the issue as fresh by commenting /remove-lifecycle rotten
.
Exclude this issue from closing again by commenting /lifecycle frozen
.
/close
@openshift-bot: Closing this issue.
In response to this:
Rotten issues close after 30d of inactivity.
Reopen the issue by commenting
/reopen
.
Mark the issue as fresh by commenting/remove-lifecycle rotten
.
Exclude this issue from closing again by commenting/lifecycle frozen
./close
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.