Skip to content

Commit 38d3e36

Browse files
Merge pull request #165 from bradmwilliams/multiple-contexts-example
Adding multiple contexts example
2 parents da70c5d + fe6aebb commit 38d3e36

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

examples/multiple_contexts.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import openshift_client as oc
2+
3+
if __name__ == '__main__':
4+
context1 = {
5+
'context': 'cluster1',
6+
}
7+
context2 = {
8+
'context': 'cluster2',
9+
}
10+
with oc.client_host():
11+
with oc.timeout(60 * 5):
12+
for context in [context1, context2]:
13+
with oc.options(context):
14+
with oc.project('my-project'):
15+
jobs_list = oc.selector('pods').objects()
16+
print(f'Found: {len(jobs_list)} pods in: {context["context"]}')

0 commit comments

Comments
 (0)