There Doesn't Seem To Be A Way To Leverage Argo Workflows To Generate Argocd Applications
There doesn't seem to be a way to leverage argo workflows to generate argocd applications
Argo Workflows and Argo CD are two powerful tools in the Kubernetes ecosystem that enable developers to automate and manage the deployment of applications. Argo Workflows provides a flexible and scalable way to define and execute workflows, while Argo CD provides a declarative way to manage the application's desired state. However, there seems to be a limitation in leveraging Argo Workflows to generate Argo CD applications. In this article, we will explore this limitation and discuss possible workarounds.
Before we dive into the issue, let's make sure we have met the pre-requisites:
- We have double-checked our configuration.
- We have tested with the
:latest
image tag (i.e.quay.io/argoproj/workflow-controller:latest
) and can confirm the issue still exists on:latest
. If not, we have explained why, in detail, in our description below. - We have searched existing issues and could not find a match for this bug.
- We'd like to contribute the fix ourselves (see contributing guide).
We are trying to leverage Argo Workflows to generate Argo CD applications. We are using the Resource template type, with the following conditions:
Resource: &wfv1.ResourceTemplate{
Action: "apply",
Manifest: argoCDAppStr,
SuccessCondition: "status.sync.status == Synced,status.health.status == Healthy",
FailureCondition: "status.health.status notin (Healthy,Progressing,)",
},
However, this can fail if the app was in a prior bad state, as it doesn't reset the condition. We are looking for a recommended way to check if Argo CD is healthy, or should we use a custom container to set this up?
We are using version v3.6.2.
Resource: &wfv1.ResourceTemplate{
Action: "apply",
Manifest: argoCDAppStr,
SuccessCondition: "status.sync.status == Synced,status.health.status == Healthy",
FailureCondition: "status.health.status notin (Healthy,Progressing,)",
},
n/a
n/a
There are a few possible workarounds to this limitation:
- Use a custom container: We can use a custom container to set up the Argo CD application and then use the Resource template type to apply the manifest. This would require us to write a custom container that can set up the Argo CD application.
- Use a separate workflow: We can use a separate workflow to set up the Argo CD application and then use the Resource template type to apply the manifest. This would require us to write a separate workflow that can set up the Argo CD application.
- Use a different template type: We can use a different template type, such as the
wfv1.Template
type, to apply the manifest. This would require us to rewrite the workflow to use thewfv1.Template
type.
In conclusion, there seems to be a limitation in leveraging Argo Workflows to generate Argo CD applications. However, there are a few possible workarounds to this limitation, including using a custom container, a separate workflow, or a different template type. We hope that this article has provided some insight into this limitation and has helped to identify possible solutions.
In the future, we would like to see Argo Workflows provide a more seamless way to generate Argo CD applications. This could be achieved by providing a built-in template type for Argo CD applications or by providing a more flexible way to apply manifests.
- Argo Workflows documentation
- Argo CD documentation
- Contributing guide
Q&A: Leveraging Argo Workflows to Generate Argo CD Applications ===========================================================
Q: What is the limitation in leveraging Argo Workflows to generate Argo CD applications?
A: The limitation is that the Resource template type does not provide a way to reset the condition if the app was in a prior bad state. This can cause the workflow to fail if the app was in a prior bad state.
Q: What are the possible workarounds to this limitation?
A: There are a few possible workarounds to this limitation:
- Use a custom container: We can use a custom container to set up the Argo CD application and then use the Resource template type to apply the manifest. This would require us to write a custom container that can set up the Argo CD application.
- Use a separate workflow: We can use a separate workflow to set up the Argo CD application and then use the Resource template type to apply the manifest. This would require us to write a separate workflow that can set up the Argo CD application.
- Use a different template type: We can use a different template type, such as the
wfv1.Template
type, to apply the manifest. This would require us to rewrite the workflow to use thewfv1.Template
type.
Q: What are the benefits of using a custom container to set up the Argo CD application?
A: The benefits of using a custom container to set up the Argo CD application are:
- Flexibility: We can use a custom container to set up the Argo CD application in a way that is tailored to our specific needs.
- Control: We have full control over the setup of the Argo CD application, which can be beneficial if we need to customize the setup.
- Reusability: We can reuse the custom container to set up multiple Argo CD applications.
Q: What are the benefits of using a separate workflow to set up the Argo CD application?
A: The benefits of using a separate workflow to set up the Argo CD application are:
- Separation of concerns: We can separate the setup of the Argo CD application from the application itself, which can make the code easier to maintain and understand.
- Reusability: We can reuse the separate workflow to set up multiple Argo CD applications.
- Flexibility: We can use a separate workflow to set up the Argo CD application in a way that is tailored to our specific needs.
Q: What are the benefits of using a different template type to apply the manifest?
A: The benefits of using a different template type to apply the manifest are:
- Flexibility: We can use a different template type to apply the manifest in a way that is tailored to our specific needs.
- Control: We have full control over the application of the manifest, which can be beneficial if we need to customize the application.
- Reusability: We can reuse the different template type to apply multiple manifests.
Q: What are the best practices for leveraging Argo Workflows to generate Argo CD applications?
A: The practices for leveraging Argo Workflows to generate Argo CD applications are:
- Use a custom container: We should use a custom container to set up the Argo CD application if we need to customize the setup.
- Use a separate workflow: We should use a separate workflow to set up the Argo CD application if we need to separate the setup from the application itself.
- Use a different template type: We should use a different template type to apply the manifest if we need to customize the application.
Q: What are the common mistakes to avoid when leveraging Argo Workflows to generate Argo CD applications?
A: The common mistakes to avoid when leveraging Argo Workflows to generate Argo CD applications are:
- Not using a custom container: We should use a custom container to set up the Argo CD application if we need to customize the setup.
- Not using a separate workflow: We should use a separate workflow to set up the Argo CD application if we need to separate the setup from the application itself.
- Not using a different template type: We should use a different template type to apply the manifest if we need to customize the application.
In conclusion, leveraging Argo Workflows to generate Argo CD applications can be a powerful way to automate the deployment of applications. However, there are some limitations and best practices to be aware of. By following the best practices and avoiding common mistakes, we can ensure that our Argo Workflows are efficient, scalable, and easy to maintain.