Esempio n. 1
0
    def create_image_pull_secret(config=None, prefix=None, name=None, data=None):
        s = Secret()

        if name is not None:
            s.name = "{0}-docker-{1}".format(name, str(uuid.uuid4().hex[:5]))
        elif name is None and prefix is not None:
            s.name = "{0}-docker-{1}".format(prefix, str(uuid.uuid4().hex[:5]))
        else:
            s.name = "docker-{0}".format(str(uuid.uuid4().hex[:5]))

        s.dockerconfigjson = data
        k8s = K8sSecret(config=config, name=s.name)
        k8s.model = s
        k8s.create()
        return k8s
Esempio n. 2
0
    def create_image_pull_secret(config=None, prefix=None, name=None, data=None):
        s = Secret()

        if name is not None:
            s.name = "{0}-docker-{1}".format(name, str(uuid.uuid4().hex[:5]))
        elif name is None and prefix is not None:
            s.name = "{0}-docker-{1}".format(prefix, str(uuid.uuid4().hex[:5]))
        else:
            s.name = "docker-{0}".format(str(uuid.uuid4().hex[:5]))

        s.dockerconfigjson = data
        k8s = K8sSecret(config=config, name=s.name)
        k8s.model = s
        k8s.create()
        return k8s
Esempio n. 3
0
 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
Esempio n. 4
0
 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
Esempio n. 5
0
 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