Created
June 15, 2017 19:49
-
-
Save detiber/49cbca9f98fa206d68cc71417482f978 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
from github3 import login | |
from kubernetes.client.rest import ApiException | |
from openshift import config | |
from openshift.client import ApiClient, UserOpenshiftIoV1Api, V1Group | |
from yaml import load | |
... | |
def openshift_client(): | |
api_client = config.new_client_from_config() | |
api_client.host = 'https://kubernetes.default.svc' | |
with open('/var/run/secrets/kubernetes.io/serviceaccount/token') as token_file: | |
api_client.config.api_key = {'authorization': token_file.read()} | |
with open('/var/run/secrets/kubernetes.io/serviceaccount/ca.crt') as ca_file: | |
api_client.config.ssl_ca_cert = ca_file.read() | |
return api_client |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment