fluxcd / terraform-provider-flux

Terraform and OpenTofu provider for bootstrapping Flux
https://registry.terraform.io/providers/fluxcd/flux/latest
Apache License 2.0
347 stars 89 forks source link

Unable to install Flux in k8s 1.19 #241

Closed mvoitko closed 2 months ago

mvoitko commented 2 years ago

Kubenetes version: 1.19

Suggested solution is to specify the default value for protocol as mentioned in https://github.com/kubernetes-sigs/structured-merge-diff/issues/130

╷
│ Error: API response status: Failure
│ 
│   with kubernetes_manifest.flux["apps/v1/deployment/flux-system/helm-controller"],
│   on flux.tf line 42, in resource "kubernetes_manifest" "flux":
│   42: resource "kubernetes_manifest" "flux" {
│ 
│ failed to create typed patch object: .spec.template.spec.containers[name="manager"].ports: element 0: associative list with keys has an element that omits key field "protocol" (and doesn't have default value)
╵
╷
│ Error: API response status: Failure
│ 
│   with kubernetes_manifest.flux["apps/v1/deployment/flux-system/kustomize-controller"],
│   on flux.tf line 42, in resource "kubernetes_manifest" "flux":
│   42: resource "kubernetes_manifest" "flux" {
│ 
│ failed to create typed patch object: .spec.template.spec.containers[name="manager"].ports: element 0: associative list with keys has an element that omits key field "protocol" (and doesn't have default value)
╵
╷
│ Error: API response status: Failure
│ 
│   with kubernetes_manifest.flux["apps/v1/deployment/flux-system/notification-controller"],
│   on flux.tf line 42, in resource "kubernetes_manifest" "flux":
│   42: resource "kubernetes_manifest" "flux" {
│ 
│ failed to create typed patch object: .spec.template.spec.containers[name="manager"].ports: element 0: associative list with keys has an element that omits key field "protocol" (and doesn't have default value)
╵
╷
│ Error: API response status: Failure
│ 
│   with kubernetes_manifest.flux["apps/v1/deployment/flux-system/source-controller"],
│   on flux.tf line 42, in resource "kubernetes_manifest" "flux":
│   42: resource "kubernetes_manifest" "flux" {
│ 
│ failed to create typed patch object: .spec.template.spec.containers[name="manager"].ports: element 0: associative list with keys has an element that omits key field "protocol" (and doesn't have default value)
╵
stefanprodan commented 2 years ago

Did the kubectl provider switched to server-side apply?

mvoitko commented 2 years ago

@stefanprodan I use the official Kubernetes provider for Terraform. How can I switch to the server-side apply?

kingdonb commented 2 years ago

@mvoitko I'm unsure of how to answer that, but YSK that Flux 0.26 is coming soon which drops support for K8s 1.19.

It does look like terraform-provider-kubernetes is migrating/migrated to Server-Side Apply according to these notes. It seems to have been this way for at least 6 months: https://github.com/hashicorp/terraform-provider-kubernetes/commit/fc8ad5fdb5e7a1d8ca2bf7deb6750fbe3fc1ae9f

mvoitko commented 2 years ago

@stefanprodan @kingdonb @phillebaba I have dived into the release notes and the code. The Kubernetes provider is ok and kunernetes_manifest uses the server-side apply by default. The problem is actually with the kustomizations from flux, more precisely the lines missing the value for the protocol in manager config of:

The problem appeared because the more strict validation for CRD was introduced in k8s

mvoitko commented 2 years ago

@stefanprodan Could you please tell me what's the flow of the release? When will be the next release of the controllers and when terraform-rpovider-flux could do the next release with the new versions of the controllers?

stefanprodan commented 2 years ago

Next release will drop support for Kubernetes 1.19 as it has reached end-of-life months ago. Flux 0.26.0 release can be tracked here: https://github.com/fluxcd/flux2/issues/2308

mvoitko commented 2 years ago

@stefanprodan But can I use some specific commit from master for the terraform provider flux? The thing is that I want to deploy kubeflow with manifests with flux. And the kubeflow supports only k8s 1.19. The flux installation is broken for k8s 1.19.

stefanprodan commented 2 years ago

The flux installation is not broken on 1.19, this provider uses kubectl not the official Kubernetes provider for Terraform.

See the examples please https://github.com/fluxcd/terraform-provider-flux/blob/main/examples/github/main.tf#L31

swade1987 commented 2 months ago

Hi @mvoitko 👋

I hope you are doing well! As part of our ongoing effort to maintain and improve the quality of our project, I've been reviewing open issues and came across the one you've reported. First off, thank you for taking the time to contribute by reporting this issue; your input is crucial to us.

Upon reviewing the details of your issue, I noticed that it involves the use of a resource or feature that has yet to be supported since the 1.0.0 release of our project, which was approximately 9 months ago. This might be a key factor in the challenges you're experiencing. We understand that changes and deprecations can impact your work, and we're here to help navigate these transitions. If there are specific reasons you've continued using this unsupported resource or if there's any way we can assist in migrating to a supported alternative, please let us know.

Additionally, to ensure the efficient management of our issue tracker and to focus on issues that are actively affecting our community, we have implemented a policy for issues that remain inactive. If there is no activity on this issue within the next 3 weeks, we will consider the issue inactive and close it for you. This doesn't mean your issue is not important to us, but rather that we aim to keep our focus on actively pursued concerns. Of course, if the issue continues or if you have further updates in the future, feel free to reopen the issue or create a new one.

Thank you once again for your contribution to our project. Your feedback not only helps us improve but also supports the broader community in overcoming similar challenges. We look forward to hearing from you and hope to resolve any outstanding concerns together.

Best regards,

Steve