def create_service_account_api_token(config=None, name=None): s = Secret() s.name = "{}-token-{}".format(name, str(uuid.uuid4().hex[:5])) s.add_annotation(Secret.K8s_ANNOTATION_SERVICE_ACCOUNT_NAME, name) s.type = Secret.K8s_TYPE_SERVICE_ACCOUNT k8s = K8sSecret(config=config, name=s.name) k8s.model = s k8s.create() return k8s
def create_service_account_api_token(config=None, name=None): s = Secret() s.name = "{}-secret".format(name) s.add_annotation('kubernetes.io/service-account.name', name) s.type = 'kubernetes.io/service-account-token' k8s = K8sSecret(config=config, name=s.name) k8s.model = s k8s.create() return k8s