Skip to content

Commit

Permalink
Fix some bad merge
Browse files Browse the repository at this point in the history
  • Loading branch information
benclifford committed Oct 21, 2024
1 parent 415f780 commit c78defa
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions parsl/providers/kubernetes/kube.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,6 @@ def submit(self, cmd_string: str, tasks_per_node: int, job_name: str = "parsl.ku
pod_name = pod_name.rstrip(".-") # Remove trailing dot or hyphen after trim
pod_name = f"{pod_name}.{job_id}"

pod_name = _sanitizeDNS1123(pod_name)

formatted_cmd = template_string.format(command=cmd_string,
worker_init=self.worker_init)

Expand Down Expand Up @@ -359,25 +357,3 @@ def label(self):
@property
def status_polling_interval(self):
return 60


# this is based on:
# https://github.com/kubernetes/apimachinery/blob/703232ea6da48aed7ac22260dabc6eac01aab896/pkg/util/validation/validation.go#L177C32-L177C62
DNS_LABEL_REGEXP = "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"


def _sanitizeDNS1123(raw: str) -> str:
"""Rewrite input string to be a valid RFC1123 DNS label.
This is required for Kubernetes pod names.
"""

# label must be lowercase
raw = raw.lower()

# label can only contain [-a-z0-9] characters - replace everything
# else with -
raw = re.sub("[^-a-z0-9]", "-", raw)

# TODO: sanitize against first and last symbols (no - at start or end?)
assert re.match(DNS_LABEL_REGEXP, raw), "sanitized DNS1123 label has not been properly sanitized: " + raw
return raw

0 comments on commit c78defa

Please sign in to comment.