Пример #1
0
    def ready(self):

        client = get_client("CoreV1Api")

        cfg = util.object_as_dict(self)

        response = client.read_namespaced_service(cfg["metadata"]["name"],
                                                  cfg["metadata"]["namespace"])

        return response.status is not None
Пример #2
0
    def ready(self):

        client = get_client("AppsV1beta1Api")

        cfg = util.object_as_dict(self)

        response = client.read_namespaced_deployment(
            cfg["metadata"]["name"], cfg["metadata"]["namespace"])

        return hasattr(response,
                       "status") and (response.status.ready_replicas >= 1)
Пример #3
0
    def create(self):

        client = get_client("CoreV1Api")

        cfg = util.object_as_dict(self)

        logging.info("Creating object with config: %s" % cfg)

        response = client.create_namespaced_service(
            cfg["metadata"]["namespace"], cfg)

        pprint.pprint(response)
Пример #4
0
 def delete(self):
     client = get_client("CoreV1Api")
     cfg = util.object_as_dict(self)
     return client.delete_namespaced_service(cfg["metadata"]["name"],
                                             cfg["metadata"]["namespace"])
Пример #5
0
 def delete(self):
     client = get_client("AppsV1beta1Api")
     cfg = util.object_as_dict(self)
     return client.delete_namespaced_deployment(
         cfg["metadata"]["name"], cfg["metadata"]["namespace"],
         kubernetes.client.V1DeleteOptions())