Skip to content

Commit

Permalink
add image pull secret functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
AntreasAntoniou authored Mar 20, 2024
1 parent 90e6a60 commit 3171fc0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions kubejobs/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def __init__(
labels: Optional[dict] = None,
annotations: Optional[dict] = None,
namespace: Optional[str] = None,
image_pull_secret: Optional[str] = None,
):
self.name = name

Expand Down Expand Up @@ -159,6 +160,7 @@ def __init__(
else f"{MAX_RAM // (MAX_GPU - gpu_limit + 1)}G"
)
self.secret_env_vars = secret_env_vars
self.image_pull_secret = image_pull_secret
self.env_vars = env_vars
self.volume_mounts = volume_mounts
self.job_deadlineseconds = job_deadlineseconds
Expand Down Expand Up @@ -327,6 +329,9 @@ def generate_yaml(self):
},
}

if self.image_pull_secret:
job["spec"]["imagePullSecrets"] = {"name": self.image_pull_secret}

if self.job_deadlineseconds:
job["spec"]["activeDeadlineSeconds"] = self.job_deadlineseconds

Expand Down

0 comments on commit 3171fc0

Please sign in to comment.