Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move exclusive placement annotation to ReplicatedJob template #389

Merged
merged 6 commits into from
Jan 28, 2024

Conversation

danielvegamyhre
Copy link
Contributor

Fixes #344

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 27, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: danielvegamyhre

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 27, 2024
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 27, 2024
@danielvegamyhre danielvegamyhre changed the title Move excluisve placement annotation to ReplicatedJob template Move exclusive placement annotation to ReplicatedJob template Jan 27, 2024
@ahg-g
Copy link
Contributor

ahg-g commented Jan 27, 2024

For backwards compatibility, we shouldn't move, but rather we should support both. If set at the jobset level, then apply to all replicatedJobs regardless whether or not it is set at the replicatedJob.

@danielvegamyhre
Copy link
Contributor Author

For backwards compatibility, we shouldn't move, but rather we should support both. If set at the jobset level, then apply to all replicatedJobs regardless whether or not it is set at the replicatedJob.

I see, yeah I was planning on messaging you on Monday to discuss the best way to support backward compatibilty for users still using the JobSet level annotation. I think the most intuitive way to do so would be to document that if the JobSet level annotation is set, the ReplicatedJob level annotations will not matter, regardless if they are set or not. I will update the PR to support both.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 27, 2024
jobIdx int
restarts int
topology string
jobSetName string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can do this as a followup, but we are using the wrapper pattern, we shouldn't need a makeJobArgs struct, we should be able to do something like

makeJob(name, namespace)
  .ReplicatedJobName(replicatedJobName)
  .Replicas(n)

if topologyDomain, exists := rjob.Template.Annotations[jobset.ExclusiveKey]; exists {
annotations[jobset.ExclusiveKey] = topologyDomain
// Check if we are using nodeSelectorStrategy implementation of exclusive placement at the ReplicatedJob level.
if value, ok := rjob.Template.Annotations[jobset.NodeSelectorStrategyKey]; ok {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This labelAndAnnotate function is invoked for both the job template and the pod template. The job template inherits gets this already because the job is created out of rjob.Template anyways, and we don't need to set this annotation on the pod.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

anyways, we can clean this up when we add the canonical placement policy API.

@ahg-g
Copy link
Contributor

ahg-g commented Jan 28, 2024

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 28, 2024
@k8s-ci-robot k8s-ci-robot merged commit c40d5c3 into kubernetes-sigs:main Jan 28, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update exclusive placement to be configurable per ReplicatedJob instead for the entire JobSet
3 participants