-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Schema addition of valuesObject
breaks kubernetes_manifest
resource due to ambiguity
#16115
Comments
Here's my take at an alternate solution that solves the patching functionality issue without ambiguity in the main Application schema (by essentially moving it elsewhere): What if the addition was in the form of an additional CRD? A theoreticaly Pros:
|
Once/if hashicorp/terraform-provider-kubernetes#2410 gets fixed, this may render this issue moot. |
Seems like there's a PR out; hashicorp/terraform-provider-kubernetes#2437 |
Having the same issue, with the following definition:
any Ideas on a workaround? Error:
|
@GuerreiroLeonardo ATM there is none. IMO the way to go is to push for hashicorp/terraform-provider-kubernetes#2437 to get merged. |
hashicorp/terraform-provider-kubernetes#2437 got merged! 🎉 🎉 Hopefully this will come to a k8s provider release soon.
I have another take 😄 I've looked into this issue, and think the right way to handle this is not to add another CRD - rather that we should use the tools that we already have at our disposal. A similar effect to what you propose can be achieved by using the Github Terraform Provider (hopefully there are similar Terraform providers for other SCMs). With this you can keep Helm values out of Application Specs. locals {
helm_values = {
foo = "bar"
bla = {
one = "two"
two = "aaa"
}
}
}
# Multiple Application Sources with Helm value files from external Git repository
resource "argocd_application" "multiple_sources" {
metadata {
name = "helm-app-with-external-values"
namespace = "argocd"
}
spec {
project = "default"
source {
repo_url = "https://charts.helm.sh/stable"
chart = "wordpress"
target_revision = "9.0.3"
helm {
value_files = ["$values/${github_repository_file.foo.file}"]
}
}
source {
repo_url = github_repository.foo.http_clone_url
target_revision = "HEAD"
ref = "values"
}
destination {
server = "https://kubernetes.default.svc"
namespace = "default"
}
}
}
resource "github_repository" "foo" {
name = "tf-test"
auto_init = true
}
resource "github_repository_file" "foo" {
repository = github_repository.foo.name
branch = "main"
file = "foo/values.yaml"
content = yamlencode(local.helm_values)
commit_message = "Managed by Terraform"
commit_author = "Terraform User"
commit_email = "[email protected]"
overwrite_on_create = true
} |
We've talked through this in person before, so you know I think abiguity in your existing (or really any) CRD schema is the fundamental problem here. The "do it in github" solution presents a number of fundamentally github-flavored problems. The github provider isn't a first class citizen at github; it's written by one dev in her spare time who happens to work there. As such, it suffers from the following issues:
I know these things because we've made extensive use of that provider in other contexts and I am full of regret. 😅 |
Did it make it into recent argocd versions as of now? |
@andrii-korotkov-verkada the underlying Terraform ambiguity issue is likely resolved with version As for the stuff @jcogilvie is commenting on, this has no current resolution and is still up for debate. |
Checklist:
argocd version
.Describe the bug
The addition of
valuesObject
to theApplication
CRD in this change has used the flagx-kubernetes-preserve-unknown-fields: true
. This is problematic for trying to represent the CRD schema in rigorously typed languages such as terraform.In particular, the ambiguity of the
valuesObject
CRD schema addition renders ourApplication
objects incompatible with terraform'skubernetes_manifest
resources. The bug linked shows that tf will attempt to delete and recreate the manifest any time something changes, which is obviously not ideal; worse still, my own code doesn't even get that far. It just crashes withFailed to transform Object element into Object element type
. (Terraform bug nonsense omitted since this is the argo repo.)This is problematic for our infra-as-code, so I'm stuck running argo on v2.7 CRDs until something changes.
I submit that such a change (i.e. introducing ambiguity) should not be allowed without a CRD version increment, even if it's technically just additive. However, we are where we are, and there's no going back now, so I have a suggestion for a go-forward solution that I'll leave in a comment below.
To Reproduce
Try to deploy this in terraform against argo 2.8+:
Redeploy it against the argo 2.7 CRD schema and watch it succeed.
Expected behavior
The schema is not ambiguous.
Screenshots
Version
I'm not using the CLI, but here's the json from the GUI:
The text was updated successfully, but these errors were encountered: