Skip to content

Commit

Permalink
Revert "New ClusterConfiguration parameter for user labels"
Browse files Browse the repository at this point in the history
This reverts commit e2cc8e1.
  • Loading branch information
franciscojavierarceo authored and openshift-merge-bot[bot] committed Apr 30, 2024
1 parent 4efbfdf commit a9b314e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 23 deletions.
6 changes: 3 additions & 3 deletions src/codeflare_sdk/cluster/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ def create_app_wrapper(self):
write_to_file = self.config.write_to_file
verify_tls = self.config.verify_tls
local_queue = self.config.local_queue
user_labels = self.config.user_labels
return generate_appwrapper(
name=name,
namespace=namespace,
Expand All @@ -212,7 +211,6 @@ def create_app_wrapper(self):
write_to_file=write_to_file,
verify_tls=verify_tls,
local_queue=local_queue,
user_labels=user_labels,
)

# creates a new cluster with the provided or default spec
Expand Down Expand Up @@ -455,7 +453,9 @@ def cluster_dashboard_uri(self) -> str:
"name"
] == f"ray-dashboard-{self.config.name}" or route["metadata"][
"name"
].startswith(f"{self.config.name}-ingress"):
].startswith(
f"{self.config.name}-ingress"
):
protocol = "https" if route["spec"].get("tls") else "http"
return f"{protocol}://{route['spec']['host']}"
else:
Expand Down
1 change: 0 additions & 1 deletion src/codeflare_sdk/cluster/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class ClusterConfiguration:
dispatch_priority: str = None
write_to_file: bool = False
verify_tls: bool = True
user_labels: dict = field(default_factory=dict)

def __post_init__(self):
if not self.verify_tls:
Expand Down
23 changes: 4 additions & 19 deletions src/codeflare_sdk/utils/generate_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,7 @@ def get_default_kueue_name(namespace: str):


def write_components(
user_yaml: dict,
output_file_name: str,
namespace: str,
local_queue: Optional[str],
user_labels: dict,
user_yaml: dict, output_file_name: str, namespace: str, local_queue: Optional[str]
):
# Create the directory if it doesn't exist
directory_path = os.path.dirname(output_file_name)
Expand All @@ -335,8 +331,6 @@ def write_components(
]
labels = component["generictemplate"]["metadata"]["labels"]
labels.update({"kueue.x-k8s.io/queue-name": lq_name})
for key in user_labels:
labels.update({key: user_labels[key]})
outfile.write("---\n")
yaml.dump(
component["generictemplate"], outfile, default_flow_style=False
Expand All @@ -345,11 +339,7 @@ def write_components(


def load_components(
user_yaml: dict,
name: str,
namespace: str,
local_queue: Optional[str],
user_labels: dict,
user_yaml: dict, name: str, namespace: str, local_queue: Optional[str]
):
component_list = []
components = user_yaml.get("spec", "resources")["resources"].get("GenericItems")
Expand All @@ -365,8 +355,6 @@ def load_components(
]
labels = component["generictemplate"]["metadata"]["labels"]
labels.update({"kueue.x-k8s.io/queue-name": lq_name})
for key in user_labels:
labels.update({key: user_labels[key]})
component_list.append(component["generictemplate"])

resources = "---\n" + "---\n".join(
Expand Down Expand Up @@ -407,7 +395,6 @@ def generate_appwrapper(
write_to_file: bool,
verify_tls: bool,
local_queue: Optional[str],
user_labels,
):
user_yaml = read_template(template)
appwrapper_name, cluster_name = gen_names(name)
Expand Down Expand Up @@ -459,13 +446,11 @@ def generate_appwrapper(
if mcad:
write_user_appwrapper(user_yaml, outfile)
else:
write_components(user_yaml, outfile, namespace, local_queue, user_labels)
write_components(user_yaml, outfile, namespace, local_queue)
return outfile
else:
if mcad:
user_yaml = load_appwrapper(user_yaml, name)
else:
user_yaml = load_components(
user_yaml, name, namespace, local_queue, user_labels
)
user_yaml = load_components(user_yaml, name, namespace, local_queue)
return user_yaml

0 comments on commit a9b314e

Please sign in to comment.