def init_namespace_by_bcs(self, access_token, project_id, project_code, data): """k8s 的集群需要创建 Namespace 和 jfrog Sercret""" client = K8SClient(access_token, project_id, data['cluster_id'], env=None) name = data['name'] # 创建 ns self.create_ns_by_bcs(client, name, data) # 创建 jfrog account secret self.create_jfrog_secret(client, access_token, project_id, project_code, data) # 如果需要使用资源配额,创建配额 if data.get("quota"): client = ns_resource.NamespaceQuota(access_token, project_id, data["cluster_id"]) client.create_namespace_quota(name, data["quota"])
def _ns_quota_client(self, access_token, project_id, cluster_id): return ns_resource.NamespaceQuota(access_token=access_token, project_id=project_id, cluster_id=cluster_id)