Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

Cannot create REST client: no client config on Plan #217

Open
spam-n-eggs opened this issue May 24, 2021 · 3 comments
Open

Cannot create REST client: no client config on Plan #217

spam-n-eggs opened this issue May 24, 2021 · 3 comments
Labels
bug Something isn't working progressive-apply

Comments

@spam-n-eggs
Copy link

spam-n-eggs commented May 24, 2021

Terraform, Provider, Kubernetes versions

Terraform version: v0.14.9
Provider version:  v0.4.1
Kubernetes version: v1.21.0

Affected Resource(s)

Terraform Configuration Files

provider "kind" {}

provider "kubernetes-alpha" {
    host = kind_cluster.dominion_testing.endpoint
    client_certificate = kind_cluster.dominion_testing.client_certificate
    client_key = kind_cluster.dominion_testing.client_key
    cluster_ca_certificate = kind_cluster.dominion_testing.cluster_ca_certificate
}

provider "helm" {
    kubernetes {
        host = kind_cluster.dominion_testing.endpoint
        client_certificate = kind_cluster.dominion_testing.client_certificate
        client_key = kind_cluster.dominion_testing.client_key
        cluster_ca_certificate = kind_cluster.dominion_testing.cluster_ca_certificate
    }
}

resource "kind_cluster" "dominion_testing" {
    name = "dominion-testing"
    kind_config {
        api_version = "kind.x-k8s.io/v1alpha4"
        kind = "Cluster"
        networking {
            api_server_address = var.api_server_address
        }
        node {
            role = "control-plane"
            extra_port_mappings {
                container_port = 30777
                host_port = 30777
            }
        }
    }
}

resource "kubernetes_manifest" "kubeless_functions_crd" {
  depends_on = [
      kind_cluster.dominion_testing
    ]
  provider = kubernetes-alpha
  manifest = {
    apiVersion = "apiextensions.k8s.io/v1beta1"
    kind = "CustomResourceDefinition"
    metadata = {
      name = "functions.kubeless.io"
    }
    spec = {
      group = "kubeless.io"
      names = {
        kind = "Function"
        plural = "functions"
        singular = "function"
      } 
      scope = "Namespaced"
      version = "v1beta1"
    }
  }
}

resource "kubernetes_manifest" "kubeless_trigger_cron_crd" {
  depends_on = [
      kind_cluster.dominion_testing
    ]
  provider = kubernetes-alpha
  manifest = {
    apiVersion= "apiextensions.k8s.io/v1beta1"
    kind= "CustomResourceDefinition"
    metadata = {
      name = "cronjobtriggers.kubeless.io"
    }
    spec = {
      group= "kubeless.io"
        names = {
          kind= "CronJobTrigger"
          plural= "cronjobtriggers"
          singular= "cronjobtrigger"
        }
      scope="Namespaced"
      version="v1beta1"
    }
  } 
}

resource "kubernetes_manifest" "kubeless_trigger_http_crd" {
  depends_on = [
      kind_cluster.dominion_testing
    ]
  provider = kubernetes-alpha
  manifest = {
    apiVersion= "apiextensions.k8s.io/v1beta1"
    kind= "CustomResourceDefinition"
    metadata = {
      name= "httptriggers.kubeless.io"
    }
    spec = {
      group= "kubeless.io"
      names = {
        kind= "HTTPTrigger"
        plural= "httptriggers"
        singular= "httptrigger"
      }
      scope= "Namespaced"
      version= "v1beta1"
    }
  }
}
# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key.

Debug Output

https://gist.github.com/spam-n-eggs/0ccefde28ea8de7249619f13d57c8314

Panic Output

Steps to Reproduce

  1. terraform plan

Expected Behavior

What should have happened?
A plan should have been produced

Actual Behavior

What actually happened?
The error message is returned:


  on kubeless.tf line 353, in resource "kubernetes_manifest" "kubeless_trigger_http_crd":
 353: resource "kubernetes_manifest" "kubeless_trigger_http_crd" {

cannot create REST client: no client config

Important Factoids

Running on Alpine Linux v3.13

References

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@spam-n-eggs spam-n-eggs added the bug Something isn't working label May 24, 2021
@Dids
Copy link

Dids commented May 26, 2021

Same thing when supplying a non-existing config_path instead (eg. generated by Terraform).
Looks like this provider doesn't wait for any of the data to be available, unlike the kubernetes provider?

@Fichtme
Copy link

Fichtme commented May 28, 2021

I've the same issue. The only way you can bypass this issue atm. is to deploy the cluster first.

Or im doing it also wrong 😂

@jamiegwatkin
Copy link

Same issue here, I'm using the terraform-aws-modules which works well with the official kubernetes when following the recommended provider setup:

provider "kubernetes" {
  host                   = data.aws_eks_cluster.cluster.endpoint
  cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data)
  token                  = data.aws_eks_cluster_auth.cluster.token
  load_config_file       = false
}

This doesn't work with kubernetes-alpha though.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working progressive-apply
Projects
None yet
Development

No branches or pull requests

5 participants