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

Add Success Policy to JobSet API #124

Merged
merged 10 commits into from
May 19, 2023

Conversation

danielvegamyhre
Copy link
Contributor

@danielvegamyhre danielvegamyhre commented May 7, 2023

Fixes #82
Fixes #120

@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 requested a review from ahg-g May 7, 2023 18:04
@k8s-ci-robot k8s-ci-robot added 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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 7, 2023
@danielvegamyhre danielvegamyhre force-pushed the success branch 2 times, most recently from 9531f84 to 49f5346 Compare May 7, 2023 19:38
api/v1alpha1/jobset_types.go Outdated Show resolved Hide resolved
api/v1alpha1/jobset_types.go Outdated Show resolved Hide resolved
api/v1alpha1/jobset_types.go Show resolved Hide resolved
api/v1alpha1/jobset_types.go Outdated Show resolved Hide resolved
pkg/controllers/jobset_controller.go Outdated Show resolved Hide resolved
pkg/controllers/jobset_controller.go Outdated Show resolved Hide resolved
pkg/controllers/jobset_controller.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 16, 2023
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 18, 2023
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 18, 2023
api/v1alpha1/jobset_types.go Outdated Show resolved Hide resolved
api/v1alpha1/jobset_types.go Outdated Show resolved Hide resolved
api/v1alpha1/jobset_types.go Outdated Show resolved Hide resolved
pkg/controllers/jobset_controller.go Outdated Show resolved Hide resolved
pkg/controllers/jobset_controller.go Outdated Show resolved Hide resolved
pkg/util/util/util.go Outdated Show resolved Hide resolved
test/integration/controller/jobset_controller_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@kannon92 kannon92 left a comment

Choose a reason for hiding this comment

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

/lgtm
But probably should leave final approval for @ahg-g.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 18, 2023
@ahg-g
Copy link
Contributor

ahg-g commented May 18, 2023

/hold

just in case it merges by mistake

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 18, 2023
api/v1alpha1/jobset_types.go Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
@kannon92
Copy link
Contributor

/hold

just in case it merges by mistake

Sorry about that. Forgot that /lgtm will cause a merge since you and @danielvegamyhre are approvers.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 18, 2023
@ahg-g
Copy link
Contributor

ahg-g commented May 19, 2023

/label tide/merge-method-squash
/hold cancel
/lgtm

@k8s-ci-robot k8s-ci-robot added tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels May 19, 2023
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 19, 2023
@k8s-ci-robot k8s-ci-robot merged commit 623147f into kubernetes-sigs:main May 19, 2023
8 checks passed
@vsoch
Copy link
Contributor

vsoch commented May 20, 2023

Did some testing! For others interested in doing this, you need to install the development version to your cluster and the module from the main branch reference:

# For your cluster
kubectl apply --server-side -k github.com/kubernetes-sigs/jobset/config/default?ref=main

# For your operator (if relevant)
go get sigs.k8s.io/jobset@main

And then testing - I tested a job name that didn't exist, this seems like the correct result!

2023-05-19T23:57:34Z    DEBUG   controller-runtime.webhook.webhooks     wrote response  {"webhook": "/validate-jobset-x-k8s-io-v1alpha1-jobset", "code": 403, "reason": "invalid replicatedJob name 'broker' does not appear in .spec.ReplicatedJobs", "UID": "0becc279-1e3a-48db-8328-b70dc007406a", "allowed": false}

And then the actual use case - a broker job in the jobset successfully finishing:

$ kubectl get -n flux-operator pods
NAME                                       READY   STATUS      RESTARTS   AGE
minicluster-flux-sample-broker-0-0-jmw2b   0/1     Completed   0          23s
minicluster-flux-sample-worker-0-0-nmnn8   0/1     Completed   0          23s
minicluster-flux-sample-worker-0-1-rv7gh   0/1     Completed   0          23s
minicluster-flux-sample-worker-0-2-48jp6   0/1     Completed   0          23s

You can see how we are using it here. We actually have a design for the operator now that the workers do exit when the broker leader exits, but this is nice because it's mapping that same logic into Kubernetes too.

I think once I've tested everything, the decision point will likely come down to being able to test this in a more production sense. The pros of this design are separation of the worker / broker logic into separate scripts. The cons are the longer names of the pods and (at least in this setup) what appears to be a bit of slowness sometimes. But I'm going to chock that up to my setup, and will assume when it's added proper it will be on par with the current objects in batch! The last thing to test is #136, and one thing I'm realizing is we would want to make sure that the label selector is transparent to be able to potentially apply it to other objects in the cluster (e.g., for the Flux Operator, a one off container service).

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/XL Denotes a PR that changes 500-999 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
7 participants