feat(jobs): tolerations and node affinity for operator-managed jobs - #27
Open
Azerothian wants to merge 1 commit into
Open
Azerothian wants to merge 1 commit into
Azerothian wants to merge 1 commit into
Conversation
…managed jobs Adds spec.jobScheduling with tolerations and affinity, applied to the pods of every job the operator creates (database creation, schema setup, schema update). On clusters whose temporal nodes are tainted or dedicated this previously left the jobs Pending forever, which blocked the whole cluster reconcile since persistence setup gates everything after it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #18
What
Adds
spec.jobSchedulingtoTemporalCluster, a global scheduling block applied to the pods of every Job the operator creates (database creation, schema setup and schema update — all built throughpersistence.SchemaJobBuilder):Both fields use the core Kubernetes types (
[]corev1.Toleration,*corev1.Affinity), so anything valid in a pod spec is valid here, including pod affinity/anti-affinity. The accessors (GetTolerations/GetAffinity) are nil-safe, so a cluster that never sets the field is unaffected.Why
Without this, on clusters whose temporal nodes are tainted or dedicated the operator's jobs either land on the wrong nodes or stay
Pendingforever — which blocks the whole cluster reconcile, since persistence setup gates the rest. There was previously no way to express this (alexandrevilain#704).Files
api/v1beta1/temporalcluster_types.go—JobSchedulingSpec+ nil-safe accessors,TemporalClusterSpec.JobSchedulinginternal/resource/persistence/schema_setup_job_builder.go— tolerations/affinity on the job pod templatezz_generated.deepcopy.go,config/crd/bases, chart CRD,docs/api/v1beta1.mdinternal/resource/persistence/schema_setup_job_builder_test.go— unit tests (unset / empty / tolerations only / affinity only / both, plus nil-safety)docs/features/job-scheduling.md+mkdocs.ymlnav +CHANGELOG.mdVerification
go build ./...✓go vet ./...✓gofmtclean ✓make manifests+make api-docsregenerated and consistent (CRD and docs contain no drift)go test ./api/... ./internal/... ./controllers/...— all ok (incl. full envtest controller suite, 7.5s, and the newTestSchemaJobBuilderScheduling)Live-cluster verification on
bne1-cluster1was not possible for this run: the host's container runtime is down (containerdpanics on a corrupt bbolt metadata DB,dockercannot connect), so the operator image could not be built/loaded. The change is additive (optional field) and the envtest suite exercises the reconcile path; the new unit test asserts the scheduling fields land on the Job pod template.Note: Jobs are immutable, so changing
spec.jobSchedulingapplies to jobs created afterwards; an already-pending job must be deleted for new constraints to take effect. This is documented.