Allow a post sync Argo CD hook via argocd.argoproj.io/hook: PostSync annotation. That would trigger the workflow after any manifests changes were applied by Argo CD. That means, in cases like, for example, we add a new notebook to the image and update the workflow to actually execute it, we can rerun the workflow automatically immediately the manifests changes are discovered and successfully applied by Argo CD.
This PR:
moves the CronWorkflow content into a WorkflowTemplate
creates a new CronWorkflow that references the WorkflowTemplate from above
creates a Workflow submitted by Argo CD as a post sync hook that also references the same WorkflowTemplate
Be advised:
Currently deployed Argo backend version (2.8.2) doesn't support workflowTemplateRef, once that is available the whole workflows can be simplified to:
Also note, the kustomizaton.yaml trick to support generateName in the hook manifest's metadata and scrub name the, comes from https://github.com/argoproj/argo-cd/issues/1639 . It allows the resources to be buildable via kustomize (name required) while allowing to generate name on the fly and not enforce it in the manifests (since that would allow only a single resource of that name present).
Allow a post sync Argo CD hook via
argocd.argoproj.io/hook: PostSync
annotation. That would trigger the workflow after any manifests changes were applied by Argo CD. That means, in cases like, for example, we add a new notebook to the image and update the workflow to actually execute it, we can rerun the workflow automatically immediately the manifests changes are discovered and successfully applied by Argo CD.This PR:
CronWorkflow
content into aWorkflowTemplate
CronWorkflow
that references theWorkflowTemplate
from aboveWorkflow
submitted by Argo CD as a post sync hook that also references the sameWorkflowTemplate
Be advised: Currently deployed Argo backend version (2.8.2) doesn't support
workflowTemplateRef
, once that is available the whole workflows can be simplified to:compared to this bulky implementation here:
Also note, the
kustomizaton.yaml
trick to supportgenerateName
in the hook manifest's metadata and scrubname
the, comes from https://github.com/argoproj/argo-cd/issues/1639 . It allows the resources to be buildable via kustomize (name required) while allowing to generate name on the fly and not enforce it in the manifests (since that would allow only a single resource of that name present).