terraform-provider-flux icon indicating copy to clipboard operation
terraform-provider-flux copied to clipboard

Unable to install Flux in k8s 1.19

Open mvoitko opened this issue 2 years ago • 8 comments

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)
╵

mvoitko avatar Jan 21 '22 12:01 mvoitko

Did the kubectl provider switched to server-side apply?

stefanprodan avatar Jan 21 '22 12:01 stefanprodan

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

mvoitko avatar Jan 24 '22 13:01 mvoitko

@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

kingdonb avatar Jan 24 '22 16:01 kingdonb

@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 avatar Jan 24 '22 23:01 mvoitko

@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?

mvoitko avatar Jan 26 '22 10:01 mvoitko

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

stefanprodan avatar Jan 26 '22 10:01 stefanprodan

@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.

mvoitko avatar Jan 26 '22 12:01 mvoitko

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

stefanprodan avatar Jan 26 '22 12:01 stefanprodan