def deploy_init_cluster(settings): """Provisions a GKE cluster, persistent disks, and any other prerequisites for deployment.""" print_separator("init-cluster") # initialize the VM _init_cluster_gcloud(settings) node_name = get_node_name() if not node_name: raise Exception("Unable to retrieve node name. Was the cluster created successfully?") set_environment(settings["DEPLOY_TO"]) create_namespace(settings) # create priority classes - " Priority affects scheduling order of Pods and out-of-resource eviction ordering # on the Node.... A PriorityClass is a non-namespaced object .. The higher the value, the higher the priority." # (from https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#priorityclass) run("kubectl create priorityclass medium-priority --value=1000" % settings, errors_to_ignore=["already exists"]) run("kubectl create priorityclass high-priority --value=10000" % settings, errors_to_ignore=["already exists"]) # print cluster info run("kubectl cluster-info", verbose=True) # wait for the cluster to initialize for retry_i in range(1, 5): try: deploy_settings(settings) break except RuntimeError as e: logger.error(("Error when deploying config maps: %(e)s. This sometimes happens when cluster is " "initializing. Retrying...") % locals()) time.sleep(5)
def deploy_init_cluster(settings): """Provisions a GKE cluster, persistent disks, and any other prerequisites for deployment.""" print_separator("init-cluster") # initialize the VM if settings["DEPLOY_TO"] == "minikube": _init_cluster_minikube(settings) elif settings["DEPLOY_TO_PREFIX"] == "gcloud": _init_cluster_gcloud(settings) else: raise ValueError("Unexpected DEPLOY_TO_PREFIX: %(DEPLOY_TO_PREFIX)s" % settings) node_name = get_node_name() if not node_name: raise Exception("Unable to retrieve node name. Was the cluster created successfully?") set_environment(settings["DEPLOY_TO"]) create_namespace(settings) # print cluster info run("kubectl cluster-info", verbose=True) # wait for the cluster to initialize for retry_i in range(1, 5): try: deploy_settings(settings) break except RuntimeError as e: logger.error(("Error when deploying config maps: %(e)s. This sometimes happens when cluster is " "initializing. Retrying...") % locals()) time.sleep(5)
def deploy_init_cluster(settings): """Provisions a GKE cluster, persistent disks, and any other prerequisites for deployment.""" print_separator("init-cluster") # initialize the VM if settings["DEPLOY_TO"] == "minikube": _init_cluster_minikube(settings) elif settings["DEPLOY_TO_PREFIX"] == "gcloud": _init_cluster_gcloud(settings) else: raise ValueError("Unexpected DEPLOY_TO_PREFIX: %(DEPLOY_TO_PREFIX)s" % settings) node_name = get_node_name() if not node_name: raise Exception("Unable to retrieve node name. Was the cluster created successfully?") set_environment(settings["DEPLOY_TO"]) create_namespace(settings) # create priority classes - " Priority affects scheduling order of Pods and out-of-resource eviction ordering # on the Node.... A PriorityClass is a non-namespaced object .. The higher the value, the higher the priority." # (from https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#priorityclass) run("kubectl create priorityclass medium-priority --value=1000" % settings, errors_to_ignore=["already exists"]) run("kubectl create priorityclass high-priority --value=10000" % settings, errors_to_ignore=["already exists"]) # print cluster info run("kubectl cluster-info", verbose=True) # wait for the cluster to initialize for retry_i in range(1, 5): try: deploy_settings(settings) break except RuntimeError as e: logger.error(("Error when deploying config maps: %(e)s. This sometimes happens when cluster is " "initializing. Retrying...") % locals()) time.sleep(5)