hashicorp / terraform-provider-kubernetes

Terraform Kubernetes provider
https://www.terraform.io/docs/providers/kubernetes/
Mozilla Public License 2.0
1.59k stars 974 forks source link

As updated the eks version (1.21 to 1.22) we are not able to upgrade ingress. #1994

Open sumit5790 opened 1 year ago

sumit5790 commented 1 year ago

I am getting the issue when updating the ingress as I update my eks cluster from 1.21 to 1.22. error: ╷ │ Error: Plugin error │ │ with kubernetes_manifest.nginx-controller-ingress[0], │ on main.tf line 342, in resource "kubernetes_manifest" "nginx-controller-ingress": │ 342: resource "kubernetes_manifest" "nginx-controller-ingress" { │ │ The plugin returned an unexpected error from │ plugin.(GRPCProvider).UpgradeResourceState: rpc error: code = Unknown desc │ = failed to determine resource GVK: cannot select exact GV from REST mapper ╵ ╷ │ Error: Plugin error │ │ with kubernetes_manifest.opensearch_ingress[0], │ on main.tf line 619, in resource "kubernetes_manifest" "opensearch_ingress": │ 619: resource "kubernetes_manifest" "opensearch_ingress" { │ │ The plugin returned an unexpected error from │ plugin.(GRPCProvider).UpgradeResourceState: rpc error: code = Unknown desc │ = failed to determine resource GVK: cannot select exact GV from REST mapper ╵ the provider I am using:

provider "kubernetes" {
host = data.aws_eks_cluster.eks.endpoint
cluster_ca_certificate = base64decode(data.aws_eks_cluster.eks.certificate_authority[0].data)
token = data.aws_eks_cluster_auth.eks.token
}
provider "helm" {
    kubernetes {
        host = data.aws_eks_cluster.eks.endpoint
        cluster_ca_certificate =             
        base64decode(data.aws_eks_cluster.eks.certificate_authority[0].data)
        token = data.aws_eks_cluster_auth.eks.token
    }
}
#nginx controller
resource "helm_release" "ingress-nginx-controller" {
    count = var.enable_nginx_controller ? 1 : 0
    name = "ingress-nginx-controller"
    namespace = "nginx-ingress"
    repository = "https://kubernetes.github.io/ingress-nginx"
    chart = "ingress-nginx"
    version = "4.3.0"
    create_namespace = true
    values = [
        "${file("${var.nginx_controller_values_path}")}"
    ]
}
BBBmau commented 1 year ago

Hello! Thank you for opening this issue @sumit5790, could you include your kubernetes_manifest resource config. The error that's being outputted shows a manifest issue and not so much a helm_release issue.

pascalstange commented 1 year ago

HI, I'm stuck with solving that issue as well after updating from 1.21 to 1.23.

I'm deploying mongodb-operator with the kubernetes_manifest resource:

locals {
  crd     = yamldecode(file("${path.module}/resources/crd.yaml"))
  manager = yamldecode(file("${path.module}/resources/manager.yaml"))
}

resource "kubernetes_manifest" "crd" {
  manifest = local.crd
}

this is exact the content of crd.yaml

it errors when performing terraform plan with:

│ Error: Plugin error
│ 
│   with module.kubernetes.module.mongodb_operator.kubernetes_manifest.crd,
│   on ../../kubernetes/mongodb-operator/main.tf line 16, in resource "kubernetes_manifest" "crd":
│   16: resource "kubernetes_manifest" "crd" {
│ 
│ The plugin returned an unexpected error from plugin.(*GRPCProvider).UpgradeResourceState: rpc error: code = Unknown desc = failed to determine resource GVK: cannot select exact GV from REST mapper

I was able to validate that the yamldecode is successfully decoding the crd.yaml with terraform console. it outputs valid tf code.

apelisse commented 8 months ago

You're trying to apply a resource type that doesn't exist. Since it says CRD in there, I wouldn't be surprised if you're trying to push a v1beta1 CRD that has been removed from 1.22. https://kubernetes.io/docs/reference/using-api/deprecation-guide/#customresourcedefinition-v122