terraform-google-kubernetes-engine icon indicating copy to clipboard operation
terraform-google-kubernetes-engine copied to clipboard

"controlplanerevisions.mesh.cloud.google.com" not found

Open richiefrich opened this issue 3 years ago • 11 comments

TL;DR

When installing from scratch ASM version 21.2.0 I get the following

module.asm-primary.module.cpr.module.gcloud_kubectl.null_resource.run_command[0] (local-exec): Ensuring ControlPlaneRevision exists in cluster... attempt 1

module.asm-primary.module.cpr.module.gcloud_kubectl.null_resource.run_command[0] (local-exec): Error from server (NotFound): customresourcedefinitions.apiextensions.k8s.io "controlplanerevisions.mesh.cloud.google.com" not found

Expected behavior

I would expect that customresourcedefinitions.apiextensions.k8s.io to be there.

Observed behavior

No response

Terraform Configuration

module "asm-primary" {
  source                    = "terraform-google-modules/kubernetes-engine/google//modules/asm"
  version                   = "21.2.0"
  project_id                = var.project_id
  cluster_name              = module.primary-cluster.name
  cluster_location          = module.primary-cluster.location
}


### Terraform Version

```sh
terraform version
Terraform v1.1.9

Additional information

No response

richiefrich avatar Jun 22 '22 15:06 richiefrich

Also I do have all the prerequisites

Enable the mesh.googleapis.com service Enable the servicemesh feature on the cluster hub Register target cluster to the servicemesh-enabled hub

richiefrich avatar Jun 22 '22 15:06 richiefrich

I guess my question is do I need to update my hub module to the hub-fleet module? As I am using version 20.0.0 and not the same version as ASM module

module "hub-primary" {
  source                            = "terraform-google-modules/kubernetes-engine/google//modules/hub"
  version                           = "20.0.0"

  cluster_name                      = module.primary-cluster.name
  cluster_endpoint                  = module.primary-cluster.endpoint
  enable_gke_hub_registration       = var.enable_gke_hub_registration
  gke_hub_membership_name           = "${module.primary-cluster.name}-membership"
  hub_project_id                    = var.project_id
  location                          = module.primary-cluster.location
  project_id                        = var.project_id
  labels                            = "name=value"

  sa_private_key                    = google_service_account_key.hub-sa-key-01.private_key
  use_existing_sa                   = true
}

richiefrich avatar Jun 22 '22 15:06 richiefrich

I downgraded and got version 19.0.0 installed but now i upgrade and I get this error.

module.asm-primary.module.cpr.module.gcloud_kubectl.null_resource.run_command[0] (local-exec): error: resource mapping not found for name: "asm-managed-stable" namespace: "istio-system" from "STDIN": no matches for kind "ControlPlaneRevision" in version "mesh.cloud.google.com/v1beta1"

I am not sure howto upgrade this..

richiefrich avatar Jun 22 '22 18:06 richiefrich

20.0.0 does not use the fleet_id even if configured. So that version is bugged. Getting joined to the fleet is what provided the ControlPlaneRevision resource. I'm getting stuck with it applying/updating the manifest but it never provisions so I'm trying to figure that out. It sounds like there are supposed to be mesh_id labels on the relevant clusters that the new ASM module approach isn't doing, but I'm not sure if that is actually needed or what else might be wrong.

brantgurga avatar Jun 23 '22 01:06 brantgurga

Thanks for the report @richiefrich. What version of kubectl are you using? The module should poll a few times CPR to get created. /cc @Monkeyanator

bharathkkb avatar Jun 23 '22 01:06 bharathkkb

@bharathkkb it does poll but it never finds it.. when I do attach it manually I get this new error.

module.asm-primary.module.cpr.module.gcloud_kubectl.null_resource.run_command[0] (local-exec): error: resource mapping not found for name: "asm-managed-stable" namespace: "istio-system" from "STDIN": no matches for kind "ControlPlaneRevision" in version "mesh.cloud.google.com/v1beta1"

I am not sure howto update this CRD because I have version controlplanerevisions mesh.cloud.google.com/v1alpha1 true ControlPlaneRevision

so how do I get the "mesh.cloud.google.com/v1beta1"

Thanks everyone!

@bharathkkb What version of kubectl are you using?

Client Version: version.Info{Major:"1", Minor:"21+", GitVersion:"v1.21.9-dispatcher", GitCommit:"2a8027f41d28b788b001389f3091c245cd0a9a60", GitTreeState:"clean", BuildDate:"2022-01-21T20:26:49Z", GoVersion:"go1.16.12", Compiler:"gc", Platform:"linux/amd64"}

richiefrich avatar Jun 23 '22 15:06 richiefrich

If the mesh feature is enabled and the cluster is registered to the enabled fleet it should be possible to use v1beta1 or v1alpha1 ControlPlaneRevision resource. Might help debug to post output of kubectl describe crd controlplanerevisions.mesh.cloud.google.com here. Could also dive deeper if you post the membership name and UUID.

Monkeyanator avatar Jul 06 '22 23:07 Monkeyanator

@Monkeyanator

I believe this is what you are asking for. membership name: prd-01-membership mesh_id : proj-163808677114

kubectl describe crd controlplanerevisions.mesh.cloud.google.com

Name:         controlplanerevisions.mesh.cloud.google.com
Namespace:
Labels:       <none>
Annotations:  controller-gen.kubebuilder.io/version: (unknown)
API Version:  apiextensions.k8s.io/v1
Kind:         CustomResourceDefinition
Metadata:
  Creation Timestamp:  2022-06-22T17:36:40Z
  Generation:          2
  Managed Fields:
    API Version:  apiextensions.k8s.io/v1

Shows a lot of output if you wanted more of it?

richiefrich avatar Jul 12 '22 17:07 richiefrich

Ok well I just tried again, and I was able to install it, so you can close this. Thanks for all the support, If this happens again I will open a new ticket

richiefrich avatar Aug 01 '22 17:08 richiefrich

I just encountered this issue the same error

ahsan518 avatar Aug 17 '22 03:08 ahsan518

I have found out if you dont switch to hub to fleet it will not make the CRD

kubectl describe crd controlplanerevisions.mesh.cloud.google.com
Error from server (NotFound): customresourcedefinitions.apiextensions.k8s.io "controlplanerevisions.mesh.cloud.google.com" not found

After I ran the fleet command the CRD was there.


gcloud container fleet memberships register --gke-cluster=us-central1-a/uat-01 --enable-workload-identity uat-01-membership

richiefrich avatar Aug 19 '22 09:08 richiefrich

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] avatar Oct 18 '22 23:10 github-actions[bot]

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] avatar Jan 16 '23 23:01 github-actions[bot]