import platform import os from itertools import product import datetime from spider.exec_eval import result_eq from kubernetes import client, config import base64 def is_file(file_path): if os.path.exists(file_path) is True and os.path.isfile(file_path) is True: return True return False def try_get_default_ssl_ca_path(): os_name = platform.system() if os_name == 'Darwin': return '/etc/ssl/cert.pem' if os_name != 'Linux': return '' ssl_ca_path_list = ['/etc/ssl/cert.pem', '/etc/ssl/certs/ca-certificates.crt', '/etc/pki/tls/certs/ca-bundle.crt', '/etc/ssl/ca-bundle.pem'] for p in ssl_ca_path_list: if is_file(p) is True: return p return '' if __name__ == "__main__": config.load_kube_config() v1 = client.CoreV1Api() secret = v1.read_namespaced_secret("openai-secret", "evaluation").data key = str(base64.b64decode(secret["openaikey"]), 'utf-8') print(key)