-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Race Condition Issue: Assign Order of Execution to Certain Components. #5820
Comments
This issue is currently awaiting triage. SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
Honestly, I don’t think this is doable with just Kustomize. It’s great for templating and patching, but managing deployment order isn’t really in its thing. If you really need to enforce order, you might look at using Helm—which has some hooks for ordering—or Argo CD, where you can set up sync waves to control what gets deployed when. A native dependsOn solution in Kustomize seems out of scope. |
^I generally agree with @isarns . It seems more like the job for an operator or scheduling plugin of some sort. Some slightly out-of-the-box suggestions that might suit use-cases similar to yours: Job creates depending resource
Job creates required resourcethis is unlikely to work for
I've personally used a very similar pattern to gracefully handle sync delays for secrets from a shared vault in a home-grown controller. For Homegrown controllerIf this is a common pattern for you or your org, you could write a custom controller that handles both the zip upload and the creation of the |
Summary
There are occations where the order of deployment of components (of kind such as Job, CloudFunctionsFunction, etc.) matters. Find a way to indicate in the
kustomize.yaml
file in which order certain components should be deployed.Description
Lets assume you're trying to deploy a Cloud Function using the CRD
CloudFunctionsFunction
of apiVersioncloudfunctions.cnrm.cloud.google.com/v1beta1
.This component requires that either:
Regredably, the repository where the code resides isn't accessable by
CloudFunctionsFunctions
; therefore, you can only follow the "Zip file" approach. This increases the complexity because we want to have everything in one place.We tried a solution by:
ConfigMap
of apiVersionv1
Job
of apiVersionbatch/v1
to (1) copy the code inside a zip file and (2) save the zip file into a storage bucket.CloudFunctionFunction
uses the zip file from the storage bucketThe Problem
The problem is the order of execution. Kustomize sometimes deployes the
CloudFunctionsFunctions
prior theJob
zippnig and storing the code from theConfigMap
. TheCloudFunctionsFunction
will deploy "succesfully" but fail to run due the ZIP file been missing, then it doesn't try again to get it. This is a race condition issue.Proposed Solutions
The following are some solutions to this issue:
dependsOn
.job.yaml: Order: "1"
Definition of Done
Provide a mechanism that allows to indicate the order of deployment of all or certain components. Ensuring that some components will be deployed prior to other components.
The text was updated successfully, but these errors were encountered: