Closed jarpat closed 2 years ago
@thpang This is still a WIP, running into some timing issues that I am working on resolving
Running into some timing issues with the service account and secret creation. Currently testing adding a couple of depends_on
so that the order is sa>sa secret>kubeconfig sa
Error: Provider produced inconsistent result after apply
anymore Timing issues retrieving the token & ca.crt during initial secret creation
data "kubernetes_secret" "sa_secret"
call after the secret is initially created. The behavior I have been consistently seeing in the debug log is that after resource "kubernetes_secret" "sa_secret"
creates the secret, the Kubernetes API's response (from GET /api/v1/namespaces/kube-system/secrets/jarpatgcpb-sa-secret
) does NOT have a data field (which contains the required ca.crt + token values). data "kubernetes_secret" "sa_secret"
call right after the secret is created results in a kubernetes API response that actually has a populated data field.
Background:
Starting from Kubernetes version
1.24.0
service account token is not automatically generated, thus it has to be created separately. The following resources were updated by the providerhashicorp/kubernetes
to handle this change inv2.13.0
:d/kubernetes_service_account
,r/kubernetes_default_service_account
,r/kubernetes_service_account
. For Kubernetes clusters running v1.24+default_secret_name
will be empty. A warning message will be printed once any of the above resources are in use.Changes
terraform-google-modules/kubernetes-engine/google//modules/private-cluster
had to be updated to 15.0.2, since its version constraint allows support forhashicorp/kubernetes
version ~> 2.0. The older 14.3.0 did not allow it.hashicorp/kubernetes
to 2.13.0load_config_file
from the provider parameters, that feature was deprecated inhashicorp/kubernetes
v2 and we were setting that value to false anyways so that behavior was not being used.Tests
More details and artifacst in interal tickets
Peformed the following
create_static_kubeconfig=false
and verifed that the code workflow to create a provider based kube config was not modifed. I was able to use the provider based kube config to view cluster resources.