Skip to content

Instantly share code, notes, and snippets.

@richm
Created December 1, 2020 15:11
Show Gist options
  • Save richm/5006c00c1898a007a6ca595f1a7c0e8c to your computer and use it in GitHub Desktop.
Save richm/5006c00c1898a007a6ca595f1a7c0e8c to your computer and use it in GitHub Desktop.
from kubernetes import client, config
from openshift.dynamic import DynamicClient
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')
project_list = v1_projects.get()
for project in project_list.items:
print(project.metadata.name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment