Skip to content

Ensure dependent resources exist before creating job - #352

Merged
brandond merged 3 commits into
k3s-io:masterfrom
brandond:apply-job-last
Sep 2, 2026
Merged

Ensure dependent resources exist before creating job#352
brandond merged 3 commits into
k3s-io:masterfrom
brandond:apply-job-last

Conversation

@brandond

@brandond brandond commented Sep 1, 2026

Copy link
Copy Markdown
Member

Description:

Do not create job if dependent resources (values secret, content configmap, serviceaccount, clusterrolebinding) cannot be created.

Adds a test that blocks configmap and serviceaccount creation with ValidatingAdmissionPolicy, and ensures that the job is not created until the policy is deleted and the required resources can be created successfully.

Manual two-stage apply requires switching the OnChange handler from GeneratingHandler to StatusHandler, and configuring and running the Apply ourselves instead of just returning an object list and letting Wrangler muddle through it.

This also converts over to running tests with ginkgo directly, as recommended by that project.

Linked Issue:

@brandond
brandond force-pushed the apply-job-last branch 9 times, most recently from 9db48f1 to 5625a7e Compare September 2, 2026 03:53
@brandond
brandond requested a review from a team September 2, 2026 03:55
@brandond brandond changed the title Ensure configmap and secret exist before returning early for job status Ensure dependent resources exist before creating job Sep 2, 2026
@brandond
brandond force-pushed the apply-job-last branch 2 times, most recently from 167ea91 to 8a6c574 Compare September 2, 2026 05:56
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Apply sorts objects by GVK and applies them in groups by type, so we cannot simply pass the job last and rely on it returning early from an error if some resources cannot be created. We need to explicitly ensure their existence first, and sync the job separately.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
@brandond
brandond merged commit 5adc1f3 into k3s-io:master Sep 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants