-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
gavinbunney/kubectl provider used in vpc-cni-custom-networking is behaving inconsistently #1675
Comments
I too was severely hit by this. |
Have you tried If this is an okay approach I would be happy to make a PR with changes. |
helm_release is somewhat limited (you either go with any-resource helm chart or you face the limitations around templating) and has some other bugs linked to it as well (sporadic random changes for example). Original linked issue has been adressed in my fork (https://github.com/alekc/terraform-provider-kubectl/releases/tag/v2.0.2), you can replace provider definition and have a go, it should be completely compatible (and as a side effect several other bugs like wait for deletion has been fixed and released as well). |
@fbozic I've been experimenting with helm_release and it has worked out quite well. There might be hidden issues I have not uncovered but so far so good. I am inclined to removing kubectl and replacing with helm_release and a local chart. Let me know if you are still open to a PR with a caveat that it would have to done across the board for all examples we have today in this repo. |
@askulkarni2 I'll try to open a PR next week once I'm back from PTO. |
Just wondering... Anything preventing to use the kubernetes_manifest from the official kubernetes provider https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/manifest ? 🤔 |
CRD has to be on a cluster during the terraform plan. That is not the case with |
Oh right. Thanks @fbozic. |
We will be working on updating the examples provided here shortly. The approach we will be using is as follows:
|
@bryantbiggs I've started working on a fix for this in the forked repo. Are you going to pick this up and should I stop working on that? |
We ended up just applying the cni configs in the inputs for the EKS addon additional logic here to create them conditionally but the idea is you can feed them into |
Description
There is a bug in
gavinbunney/kubectl
provider which is used invpc-cni-custom-networking
example. The bug seems to be happening only on K8s version 1.27. Also, it looks like that provider is not maintained anymore (example 1, example 2, example 3).I was following vpc-cni-custom-networking example and I've made no changes to the relevant code,
gavinbunney/kubectl
provider andkubectl_manifest
resources.I've created a new EKS v1.27 cluster with
terraform apply
successfully. Then I rankubectl get eniconfigs.crd.k8s.amazonaws.com
to inspect created ENIConfigs and the manifests looked okay. Then I ranterraform plan
to check if terraform state is in sync. Terraform state was not in sync, terraform wanted to create those ENIConfigs. I've attached terraform debug logs which state that ENIConfigs resources are being removed from the state because they couldn't be found. Trying to import back those resources fails. After some timeterraform plan
will produce no changes again (~20,30 minutes after the last interaction witheniconfigs.crd.k8s.amazonaws.com
overkubectl
).I've found a similar solution which is using
hashicorp/helm
provider and an empty generic helm chart. I can open PR with this change for vpc-cni-custom-networking example if it makes sense to switch providers.Old code:
New code:
Versions
Module version [Required]:
I'm using only examples from this repository. Here is permalink: https://github.com/aws-ia/terraform-aws-eks-blueprints/tree/a3138bd8ee2dba924e01a3fc265b84402a0246bc/examples/vpc-cni-custom-networking
Terraform version:
Reproduction Code [Required]
terraform apply
kubectl get eniconfigs.crd.k8s.amazonaws.com
terraform plan
-> kubectl resources are dropped from the stateExpected behaviour
terraform plan
is consistent every time and ENIConfigs do not disappear from the state.Actual behaviour
terraform plan
is not consistent every time and ENIConfigs disappear from the state.Terminal Output Screenshot(s)
Terraform plan debug logs (just the interesting part):
Additional context
The text was updated successfully, but these errors were encountered: