Skip to content
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

Do not set default namespace for replication controller and deployment pod templates #275

Merged

Conversation

pdecat
Copy link
Contributor

@pdecat pdecat commented Jan 15, 2019

Replication controller and deployment pod templates currently have their namespace field defaulting to default.

This causes issues when importing replication controllers and deployments with the namespace field not set on the pod spec. On the next terraform plan, a recreation of the controllers is triggered.

This PR changes that.

Terraform Version

# terraform version
Terraform v0.11.11
+ provider.external v1.0.0
+ provider.google v1.20.0
+ provider.google-beta v1.20.0
+ provider.kubernetes v1.5.0
+ provider.template v1.0.0

Affected Resource(s)

  • kubernetes_deployment
  • kubernetes_replication_controller

Plan output

[...]
      spec.0.template.0.metadata.0.name:                                                  "" => <computed>                                                                                
      spec.0.template.0.metadata.0.namespace:                                             "" => "default" (forces new resource)                                                           
      spec.0.template.0.metadata.0.resource_version:                                      "" => <computed>                                                                                
[...]

@ghost ghost added the size/S label Jan 15, 2019
@pdecat
Copy link
Contributor Author

pdecat commented Jan 15, 2019

Note: StatefulSet are not affected because they do not reuse the namespacedMetadataSchema function but have their own podTemplateFields function which does not specifiy the namespace (among others)

https://github.com/terraform-providers/terraform-provider-kubernetes/blob/master/kubernetes/schema_stateful_set_spec.go#L58

@pdecat
Copy link
Contributor Author

pdecat commented Jan 15, 2019

Acceptance tests results with GKE 1.11.6-gke.2 :

# make testacc TEST=./kubernetes TESTARGS='-run=TestAccKubernetes.* -count=1'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./kubernetes -v -run=TestAccKubernetes.* -count=1 -timeout 120m
=== RUN   TestAccKubernetesDataSourceSecret_basic
--- PASS: TestAccKubernetesDataSourceSecret_basic (2.26s)
=== RUN   TestAccKubernetesDataSourceService_basic
--- PASS: TestAccKubernetesDataSourceService_basic (1.35s)
=== RUN   TestAccKubernetesDataSourceStorageClass_basic
--- PASS: TestAccKubernetesDataSourceStorageClass_basic (1.33s)
=== RUN   TestAccKubernetesClusterRoleBinding
--- PASS: TestAccKubernetesClusterRoleBinding (2.05s)
=== RUN   TestAccKubernetesClusterRoleBinding_importBasic
--- PASS: TestAccKubernetesClusterRoleBinding_importBasic (1.31s)
=== RUN   TestAccKubernetesConfigMap_basic
--- PASS: TestAccKubernetesConfigMap_basic (3.92s)
=== RUN   TestAccKubernetesConfigMap_importBasic
--- PASS: TestAccKubernetesConfigMap_importBasic (1.31s)
=== RUN   TestAccKubernetesConfigMap_generatedName
--- PASS: TestAccKubernetesConfigMap_generatedName (1.19s)
=== RUN   TestAccKubernetesConfigMap_importGeneratedName
--- PASS: TestAccKubernetesConfigMap_importGeneratedName (1.29s)
=== RUN   TestAccKubernetesDeployment_basic
--- PASS: TestAccKubernetesDeployment_basic (78.17s)
=== RUN   TestAccKubernetesDeployment_initContainer
--- PASS: TestAccKubernetesDeployment_initContainer (128.98s)
=== RUN   TestAccKubernetesDeployment_importBasic
--- PASS: TestAccKubernetesDeployment_importBasic (118.92s)
=== RUN   TestAccKubernetesDeployment_generatedName
--- PASS: TestAccKubernetesDeployment_generatedName (37.66s)
=== RUN   TestAccKubernetesDeployment_importGeneratedName
--- PASS: TestAccKubernetesDeployment_importGeneratedName (37.80s)
=== RUN   TestAccKubernetesDeployment_with_security_context
--- PASS: TestAccKubernetesDeployment_with_security_context (17.40s)
=== RUN   TestAccKubernetesDeployment_with_container_liveness_probe_using_exec
--- PASS: TestAccKubernetesDeployment_with_container_liveness_probe_using_exec (5.18s)
=== RUN   TestAccKubernetesDeployment_with_container_liveness_probe_using_http_get
--- PASS: TestAccKubernetesDeployment_with_container_liveness_probe_using_http_get (9.30s)
=== RUN   TestAccKubernetesDeployment_with_container_liveness_probe_using_tcp
--- PASS: TestAccKubernetesDeployment_with_container_liveness_probe_using_tcp (9.34s)
=== RUN   TestAccKubernetesDeployment_with_container_lifecycle
--- PASS: TestAccKubernetesDeployment_with_container_lifecycle (9.32s)
=== RUN   TestAccKubernetesDeployment_with_container_security_context
--- PASS: TestAccKubernetesDeployment_with_container_security_context (17.52s)
=== RUN   TestAccKubernetesDeployment_with_volume_mount
--- PASS: TestAccKubernetesDeployment_with_volume_mount (18.32s)
=== RUN   TestAccKubernetesDeployment_with_resource_requirements
--- PASS: TestAccKubernetesDeployment_with_resource_requirements (5.20s)
=== RUN   TestAccKubernetesDeployment_with_empty_dir_volume
--- PASS: TestAccKubernetesDeployment_with_empty_dir_volume (9.31s)
=== RUN   TestAccKubernetesDeploymentUpdate_basic
--- PASS: TestAccKubernetesDeploymentUpdate_basic (166.21s)
=== RUN   TestAccKubernetesHorizontalPodAutoscaler_basic
--- PASS: TestAccKubernetesHorizontalPodAutoscaler_basic (3.05s)
=== RUN   TestAccKubernetesHorizontalPodAutoscaler_generatedName
--- PASS: TestAccKubernetesHorizontalPodAutoscaler_generatedName (1.19s)
=== RUN   TestAccKubernetesHorizontalPodAutoscaler_importBasic
--- PASS: TestAccKubernetesHorizontalPodAutoscaler_importBasic (1.28s)
=== RUN   TestAccKubernetesLimitRange_basic
--- PASS: TestAccKubernetesLimitRange_basic (2.98s)
=== RUN   TestAccKubernetesLimitRange_empty
--- PASS: TestAccKubernetesLimitRange_empty (1.20s)
=== RUN   TestAccKubernetesLimitRange_generatedName
--- PASS: TestAccKubernetesLimitRange_generatedName (1.18s)
=== RUN   TestAccKubernetesLimitRange_typeChange
--- PASS: TestAccKubernetesLimitRange_typeChange (2.08s)
=== RUN   TestAccKubernetesLimitRange_multipleLimits
--- PASS: TestAccKubernetesLimitRange_multipleLimits (1.22s)
=== RUN   TestAccKubernetesLimitRange_importBasic
--- PASS: TestAccKubernetesLimitRange_importBasic (1.34s)
=== RUN   TestAccKubernetesNamespace_basic
--- PASS: TestAccKubernetesNamespace_basic (11.75s)
=== RUN   TestAccKubernetesNamespace_invalidLabelValueType
--- PASS: TestAccKubernetesNamespace_invalidLabelValueType (0.03s)
=== RUN   TestAccKubernetesNamespace_importBasic
--- PASS: TestAccKubernetesNamespace_importBasic (8.18s)
=== RUN   TestAccKubernetesNamespace_generatedName
--- PASS: TestAccKubernetesNamespace_generatedName (8.10s)
=== RUN   TestAccKubernetesNamespace_withSpecialCharacters
--- PASS: TestAccKubernetesNamespace_withSpecialCharacters (8.07s)
=== RUN   TestAccKubernetesNamespace_importGeneratedName
--- PASS: TestAccKubernetesNamespace_importGeneratedName (8.18s)
=== RUN   TestAccKubernetesNetworkPolicy_basic
--- PASS: TestAccKubernetesNetworkPolicy_basic (4.86s)
=== RUN   TestAccKubernetesNetworkPolicy_withEgressAtCreation
--- PASS: TestAccKubernetesNetworkPolicy_withEgressAtCreation (1.19s)
=== RUN   TestAccKubernetesNetworkPolicy_importBasic
--- PASS: TestAccKubernetesNetworkPolicy_importBasic (1.31s)
=== RUN   TestAccKubernetesPersistentVolumeClaim_basic
--- PASS: TestAccKubernetesPersistentVolumeClaim_basic (4.05s)
=== RUN   TestAccKubernetesPersistentVolumeClaim_googleCloud_importBasic
--- FAIL: TestAccKubernetesPersistentVolumeClaim_googleCloud_importBasic (0.35s)
    testing.go:538: Step 0 error: Error applying: 1 error occurred:
                * google_compute_disk.test: 1 error occurred:
                * google_compute_disk.test: Get https://www.googleapis.com/compute/v1/projects/cloudpublic-sandbox/zones/us-east1-b?alt=json&prettyPrint=false: oauth2: cannot fetch token: 400 Bad Request
        Response: {
          "error": "invalid_grant",
          "error_description": "Bad Request"
        }




=== RUN   TestAccKubernetesPersistentVolumeClaim_googleCloud_volumeMatch
--- FAIL: TestAccKubernetesPersistentVolumeClaim_googleCloud_volumeMatch (0.16s)
    testing.go:538: Step 0 error: Error applying: 1 error occurred:
                * google_compute_disk.test: 1 error occurred:
                * google_compute_disk.test: Get https://www.googleapis.com/compute/v1/projects/cloudpublic-sandbox/zones/us-east1-b?alt=json&prettyPrint=false: oauth2: cannot fetch token: 400 Bad Request
        Response: {
          "error": "invalid_grant",
          "error_description": "Bad Request"
        }




=== RUN   TestAccKubernetesPersistentVolumeClaim_googleCloud_volumeUpdate
--- FAIL: TestAccKubernetesPersistentVolumeClaim_googleCloud_volumeUpdate (0.14s)
    testing.go:538: Step 0 error: Error applying: 1 error occurred:
                * google_compute_disk.test: 1 error occurred:
                * google_compute_disk.test: Get https://www.googleapis.com/compute/v1/projects/cloudpublic-sandbox/zones/us-east1-b?alt=json&prettyPrint=false: oauth2: cannot fetch token: 400 Bad Request
        Response: {
          "error": "invalid_grant",
          "error_description": "Bad Request"
        }




=== RUN   TestAccKubernetesPersistentVolumeClaim_googleCloud_storageClass
--- PASS: TestAccKubernetesPersistentVolumeClaim_googleCloud_storageClass (11.07s)
=== RUN   TestAccKubernetesPersistentVolume_googleCloud_basic
--- FAIL: TestAccKubernetesPersistentVolume_googleCloud_basic (0.15s)
    testing.go:538: Step 0 error: Error applying: 1 error occurred:
                * google_compute_disk.test: 1 error occurred:
                * google_compute_disk.test: Get https://www.googleapis.com/compute/v1/projects/cloudpublic-sandbox/zones/us-east1-b?alt=json&prettyPrint=false: oauth2: cannot fetch token: 400 Bad Request
        Response: {
          "error": "invalid_grant",
          "error_description": "Bad Request"
        }




=== RUN   TestAccKubernetesPersistentVolume_aws_basic
--- SKIP: TestAccKubernetesPersistentVolume_aws_basic (0.00s)
    provider_test.go:195: The environment variables AWS_DEFAULT_REGION, AWS_ZONE, AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be set to run AWS tests - skipping
=== RUN   TestAccKubernetesPersistentVolume_googleCloud_importBasic
--- FAIL: TestAccKubernetesPersistentVolume_googleCloud_importBasic (0.11s)
    testing.go:538: Step 0 error: Error applying: 1 error occurred:
                * google_compute_disk.test: 1 error occurred:
                * google_compute_disk.test: Get https://www.googleapis.com/compute/v1/projects/cloudpublic-sandbox/zones/us-east1-b?alt=json&prettyPrint=false: oauth2: cannot fetch token: 400 Bad Request
        Response: {
          "error": "invalid_grant",
          "error_description": "Bad Request"
        }




=== RUN   TestAccKubernetesPersistentVolume_googleCloud_volumeSource
--- FAIL: TestAccKubernetesPersistentVolume_googleCloud_volumeSource (0.14s)
    testing.go:538: Step 0 error: Error applying: 1 error occurred:
                * google_compute_disk.test: 1 error occurred:
                * google_compute_disk.test: Get https://www.googleapis.com/compute/v1/projects/cloudpublic-sandbox/zones/us-east1-b?alt=json&prettyPrint=false: oauth2: cannot fetch token: 400 Bad Request
        Response: {
          "error": "invalid_grant",
          "error_description": "Bad Request"
        }




=== RUN   TestAccKubernetesPersistentVolume_hostPath_volumeSource
--- PASS: TestAccKubernetesPersistentVolume_hostPath_volumeSource (3.05s)
=== RUN   TestAccKubernetesPersistentVolume_local_volumeSource
--- PASS: TestAccKubernetesPersistentVolume_local_volumeSource (3.09s)
=== RUN   TestAccKubernetesPersistentVolume_cephFsSecretRef
--- PASS: TestAccKubernetesPersistentVolume_cephFsSecretRef (1.55s)
=== RUN   TestAccKubernetesPersistentVolume_storageClass
--- FAIL: TestAccKubernetesPersistentVolume_storageClass (0.81s)
    testing.go:538: Step 0 error: Error applying: 1 error occurred:
                * google_compute_disk.test: 1 error occurred:
                * google_compute_disk.test: Get https://www.googleapis.com/compute/v1/projects/cloudpublic-sandbox/zones/us-east1-b?alt=json&prettyPrint=false: oauth2: cannot fetch token: 400 Bad Request
        Response: {
          "error": "invalid_grant",
          "error_description": "Bad Request"
        }




=== RUN   TestAccKubernetesPersistentVolume_hostPath_nodeAffinity
--- PASS: TestAccKubernetesPersistentVolume_hostPath_nodeAffinity (7.44s)
=== RUN   TestAccKubernetesPod_basic
--- PASS: TestAccKubernetesPod_basic (63.89s)
=== RUN   TestAccKubernetesPod_initContainer_updateForcesNew
--- PASS: TestAccKubernetesPod_initContainer_updateForcesNew (53.96s)
=== RUN   TestAccKubernetesPod_updateArgsForceNew
--- PASS: TestAccKubernetesPod_updateArgsForceNew (92.47s)
=== RUN   TestAccKubernetesPod_updateEnvForceNew
--- PASS: TestAccKubernetesPod_updateEnvForceNew (51.54s)
=== RUN   TestAccKubernetesPod_importBasic
--- PASS: TestAccKubernetesPod_importBasic (11.44s)
=== RUN   TestAccKubernetesPod_with_pod_security_context
--- PASS: TestAccKubernetesPod_with_pod_security_context (8.82s)
=== RUN   TestAccKubernetesPod_with_container_liveness_probe_using_exec
--- PASS: TestAccKubernetesPod_with_container_liveness_probe_using_exec (49.62s)
=== RUN   TestAccKubernetesPod_with_container_liveness_probe_using_http_get
--- PASS: TestAccKubernetesPod_with_container_liveness_probe_using_http_get (7.06s)
=== RUN   TestAccKubernetesPod_with_container_liveness_probe_using_tcp
--- PASS: TestAccKubernetesPod_with_container_liveness_probe_using_tcp (19.23s)
=== RUN   TestAccKubernetesPod_with_container_lifecycle
--- PASS: TestAccKubernetesPod_with_container_lifecycle (21.06s)
=== RUN   TestAccKubernetesPod_with_container_security_context
--- PASS: TestAccKubernetesPod_with_container_security_context (7.13s)
=== RUN   TestAccKubernetesPod_with_volume_mount
--- PASS: TestAccKubernetesPod_with_volume_mount (21.82s)
=== RUN   TestAccKubernetesPod_with_cfg_map_volume_mount
--- PASS: TestAccKubernetesPod_with_cfg_map_volume_mount (20.12s)
=== RUN   TestAccKubernetesPod_with_resource_requirements
--- PASS: TestAccKubernetesPod_with_resource_requirements (7.03s)
=== RUN   TestAccKubernetesPod_with_empty_dir_volume
--- PASS: TestAccKubernetesPod_with_empty_dir_volume (7.12s)
=== RUN   TestAccKubernetesPod_with_secret_vol_items
--- PASS: TestAccKubernetesPod_with_secret_vol_items (7.88s)
=== RUN   TestAccKubernetesPod_gke_with_nodeSelector
--- PASS: TestAccKubernetesPod_gke_with_nodeSelector (19.40s)
=== RUN   TestAccKubernetesReplicationController_deprecated_basic
--- PASS: TestAccKubernetesReplicationController_deprecated_basic (115.78s)
=== RUN   TestAccKubernetesReplicationController_deprecated_initContainer
--- PASS: TestAccKubernetesReplicationController_deprecated_initContainer (114.95s)
=== RUN   TestAccKubernetesReplicationController_deprecated_importBasic
--- PASS: TestAccKubernetesReplicationController_deprecated_importBasic (114.94s)
=== RUN   TestAccKubernetesReplicationController_deprecated_generatedName
--- PASS: TestAccKubernetesReplicationController_deprecated_generatedName (1.58s)
=== RUN   TestAccKubernetesReplicationController_deprecated_importGeneratedName
--- PASS: TestAccKubernetesReplicationController_deprecated_importGeneratedName (1.79s)
=== RUN   TestAccKubernetesReplicationController_deprecated_with_security_context
--- PASS: TestAccKubernetesReplicationController_deprecated_with_security_context (1.74s)
=== RUN   TestAccKubernetesReplicationController_deprecated_with_container_liveness_probe_using_exec
--- PASS: TestAccKubernetesReplicationController_deprecated_with_container_liveness_probe_using_exec (1.56s)
=== RUN   TestAccKubernetesReplicationController_deprecated_with_container_liveness_probe_using_http_get
--- PASS: TestAccKubernetesReplicationController_deprecated_with_container_liveness_probe_using_http_get (1.55s)
=== RUN   TestAccKubernetesReplicationController_deprecated_with_container_liveness_probe_using_tcp
--- PASS: TestAccKubernetesReplicationController_deprecated_with_container_liveness_probe_using_tcp (1.54s)
=== RUN   TestAccKubernetesReplicationController_deprecated_with_container_lifecycle
--- PASS: TestAccKubernetesReplicationController_deprecated_with_container_lifecycle (1.56s)
=== RUN   TestAccKubernetesReplicationController_deprecated_with_container_security_context
--- PASS: TestAccKubernetesReplicationController_deprecated_with_container_security_context (1.56s)
=== RUN   TestAccKubernetesReplicationController_deprecated_with_volume_mount
--- PASS: TestAccKubernetesReplicationController_deprecated_with_volume_mount (2.44s)
=== RUN   TestAccKubernetesReplicationController_deprecated_with_resource_requirements
--- PASS: TestAccKubernetesReplicationController_deprecated_with_resource_requirements (1.68s)
=== RUN   TestAccKubernetesReplicationController_deprecated_with_empty_dir_volume
--- PASS: TestAccKubernetesReplicationController_deprecated_with_empty_dir_volume (1.57s)
=== RUN   TestAccKubernetesReplicationController_basic
--- PASS: TestAccKubernetesReplicationController_basic (116.04s)
=== RUN   TestAccKubernetesReplicationController_initContainer
--- PASS: TestAccKubernetesReplicationController_initContainer (114.79s)
=== RUN   TestAccKubernetesReplicationController_importBasic
--- PASS: TestAccKubernetesReplicationController_importBasic (114.96s)
=== RUN   TestAccKubernetesReplicationController_generatedName
--- PASS: TestAccKubernetesReplicationController_generatedName (1.56s)
=== RUN   TestAccKubernetesReplicationController_importGeneratedName
--- PASS: TestAccKubernetesReplicationController_importGeneratedName (1.70s)
=== RUN   TestAccKubernetesReplicationController_with_security_context
--- PASS: TestAccKubernetesReplicationController_with_security_context (1.59s)
=== RUN   TestAccKubernetesReplicationController_with_container_liveness_probe_using_exec
--- PASS: TestAccKubernetesReplicationController_with_container_liveness_probe_using_exec (1.56s)
=== RUN   TestAccKubernetesReplicationController_with_container_liveness_probe_using_http_get
--- PASS: TestAccKubernetesReplicationController_with_container_liveness_probe_using_http_get (1.58s)
=== RUN   TestAccKubernetesReplicationController_with_container_liveness_probe_using_tcp
--- PASS: TestAccKubernetesReplicationController_with_container_liveness_probe_using_tcp (1.58s)
=== RUN   TestAccKubernetesReplicationController_with_container_lifecycle
--- PASS: TestAccKubernetesReplicationController_with_container_lifecycle (1.58s)
=== RUN   TestAccKubernetesReplicationController_with_container_security_context
--- PASS: TestAccKubernetesReplicationController_with_container_security_context (1.60s)
=== RUN   TestAccKubernetesReplicationController_with_volume_mount
--- PASS: TestAccKubernetesReplicationController_with_volume_mount (2.46s)
=== RUN   TestAccKubernetesReplicationController_with_resource_requirements
--- PASS: TestAccKubernetesReplicationController_with_resource_requirements (1.63s)
=== RUN   TestAccKubernetesReplicationController_with_empty_dir_volume
--- PASS: TestAccKubernetesReplicationController_with_empty_dir_volume (2.53s)
=== RUN   TestAccKubernetesResourceQuota_basic
--- PASS: TestAccKubernetesResourceQuota_basic (3.83s)
=== RUN   TestAccKubernetesResourceQuota_generatedName
--- PASS: TestAccKubernetesResourceQuota_generatedName (1.28s)
=== RUN   TestAccKubernetesResourceQuota_withScopes
--- PASS: TestAccKubernetesResourceQuota_withScopes (2.41s)
=== RUN   TestAccKubernetesResourceQuota_importBasic
--- PASS: TestAccKubernetesResourceQuota_importBasic (1.48s)
=== RUN   TestAccKubernetesRoleBinding_basic
--- PASS: TestAccKubernetesRoleBinding_basic (2.10s)
=== RUN   TestAccKubernetesRoleBinding_importBasic
--- PASS: TestAccKubernetesRoleBinding_importBasic (1.30s)
=== RUN   TestAccKubernetesRole_basic
--- PASS: TestAccKubernetesRole_basic (2.07s)
=== RUN   TestAccKubernetesRole_importBasic
--- PASS: TestAccKubernetesRole_importBasic (1.29s)
=== RUN   TestAccKubernetesRole_generatedName
--- PASS: TestAccKubernetesRole_generatedName (1.18s)
=== RUN   TestAccKubernetesSecret_basic
--- PASS: TestAccKubernetesSecret_basic (4.83s)
=== RUN   TestAccKubernetesSecret_importBasic
--- PASS: TestAccKubernetesSecret_importBasic (1.34s)
=== RUN   TestAccKubernetesSecret_generatedName
--- PASS: TestAccKubernetesSecret_generatedName (1.17s)
=== RUN   TestAccKubernetesSecret_importGeneratedName
--- PASS: TestAccKubernetesSecret_importGeneratedName (1.28s)
=== RUN   TestAccKubernetesSecret_binaryData
--- PASS: TestAccKubernetesSecret_binaryData (2.30s)
=== RUN   TestAccKubernetesServiceAccount_basic
--- PASS: TestAccKubernetesServiceAccount_basic (2.84s)
=== RUN   TestAccKubernetesServiceAccount_automount
--- PASS: TestAccKubernetesServiceAccount_automount (2.95s)
=== RUN   TestAccKubernetesServiceAccount_update
--- PASS: TestAccKubernetesServiceAccount_update (4.14s)
=== RUN   TestAccKubernetesServiceAccount_generatedName
--- PASS: TestAccKubernetesServiceAccount_generatedName (1.33s)
=== RUN   TestAccKubernetesService_basic
--- PASS: TestAccKubernetesService_basic (2.28s)
=== RUN   TestAccKubernetesService_loadBalancer
--- PASS: TestAccKubernetesService_loadBalancer (59.04s)
=== RUN   TestAccKubernetesService_nodePort
--- PASS: TestAccKubernetesService_nodePort (1.28s)
=== RUN   TestAccKubernetesService_noTargetPort
--- PASS: TestAccKubernetesService_noTargetPort (98.49s)
=== RUN   TestAccKubernetesService_stringTargetPort
--- PASS: TestAccKubernetesService_stringTargetPort (108.77s)
=== RUN   TestAccKubernetesService_externalName
--- PASS: TestAccKubernetesService_externalName (1.17s)
=== RUN   TestAccKubernetesService_importBasic
--- PASS: TestAccKubernetesService_importBasic (1.33s)
=== RUN   TestAccKubernetesService_generatedName
--- PASS: TestAccKubernetesService_generatedName (1.17s)
=== RUN   TestAccKubernetesService_importGeneratedName
--- PASS: TestAccKubernetesService_importGeneratedName (1.30s)
=== RUN   TestAccKubernetesStatefulSet_basic
--- PASS: TestAccKubernetesStatefulSet_basic (1.37s)
=== RUN   TestAccKubernetesStatefulSet_basic_idempotency
--- PASS: TestAccKubernetesStatefulSet_basic_idempotency (1.90s)
=== RUN   TestAccKubernetesStatefulSet_update_image
--- PASS: TestAccKubernetesStatefulSet_update_image (2.40s)
=== RUN   TestAccKubernetesStatefulSet_update_template_selector_labels
--- PASS: TestAccKubernetesStatefulSet_update_template_selector_labels (2.55s)
=== RUN   TestAccKubernetesStatefulSet_update_replicas
--- PASS: TestAccKubernetesStatefulSet_update_replicas (2.35s)
=== RUN   TestAccKubernetesStatefulSet_update_rolling_update_partition
--- PASS: TestAccKubernetesStatefulSet_update_rolling_update_partition (2.39s)
=== RUN   TestAccKubernetesStatefulSet_update_update_strategy_on_delete
--- PASS: TestAccKubernetesStatefulSet_update_update_strategy_on_delete (2.40s)
=== RUN   TestAccKubernetesStatefulSet_update_update_strategy_rolling_update
--- PASS: TestAccKubernetesStatefulSet_update_update_strategy_rolling_update (2.27s)
=== RUN   TestAccKubernetesStatefulSet_update_pod_template_container_port
--- PASS: TestAccKubernetesStatefulSet_update_pod_template_container_port (2.55s)
=== RUN   TestAccKubernetesStorageClass_basic
--- PASS: TestAccKubernetesStorageClass_basic (3.18s)
=== RUN   TestAccKubernetesStorageClass_importBasic
--- PASS: TestAccKubernetesStorageClass_importBasic (1.34s)
=== RUN   TestAccKubernetesStorageClass_generatedName
--- PASS: TestAccKubernetesStorageClass_generatedName (1.15s)
=== RUN   TestAccKubernetesStorageClass_importGeneratedName
--- PASS: TestAccKubernetesStorageClass_importGeneratedName (1.26s)
FAIL
FAIL    github.com/terraform-providers/terraform-provider-kubernetes/kubernetes 2324.054s
make: *** [GNUmakefile:17: testacc] Error 1

Only some unrelated TestAccKubernetesPersistentVolume_googleCloud_.* tests are failing.

pdecat added a commit to pdecat/terraform-provider-kubernetes that referenced this pull request Jan 15, 2019
@pdecat
Copy link
Contributor Author

pdecat commented Jan 15, 2019

Those errors were caused by expired Application Default Credentials from November 2016 (fixed withrm ~/.config/gcloud/application_default_credentials.json ; gcloud auth application-default login).

All acceptance tests with GKE 1.11.6-gke.2 now pass:

# make testacc TEST=./kubernetes TESTARGS='-run=TestAccKubernetes.* -count=1'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./kubernetes -v -run=TestAccKubernetes.* -count=1 -timeout 120m
=== RUN   TestAccKubernetesDataSourceSecret_basic
--- PASS: TestAccKubernetesDataSourceSecret_basic (1.63s)
=== RUN   TestAccKubernetesDataSourceService_basic
--- PASS: TestAccKubernetesDataSourceService_basic (1.28s)
=== RUN   TestAccKubernetesDataSourceStorageClass_basic
--- PASS: TestAccKubernetesDataSourceStorageClass_basic (1.27s)
=== RUN   TestAccKubernetesClusterRoleBinding
--- PASS: TestAccKubernetesClusterRoleBinding (2.02s)
=== RUN   TestAccKubernetesClusterRoleBinding_importBasic
--- PASS: TestAccKubernetesClusterRoleBinding_importBasic (1.26s)
=== RUN   TestAccKubernetesConfigMap_basic
--- PASS: TestAccKubernetesConfigMap_basic (3.77s)
=== RUN   TestAccKubernetesConfigMap_importBasic
--- PASS: TestAccKubernetesConfigMap_importBasic (1.26s)
=== RUN   TestAccKubernetesConfigMap_generatedName
--- PASS: TestAccKubernetesConfigMap_generatedName (1.13s)
=== RUN   TestAccKubernetesConfigMap_importGeneratedName
--- PASS: TestAccKubernetesConfigMap_importGeneratedName (1.26s)
=== RUN   TestAccKubernetesDeployment_basic
--- PASS: TestAccKubernetesDeployment_basic (37.77s)
=== RUN   TestAccKubernetesDeployment_initContainer
--- PASS: TestAccKubernetesDeployment_initContainer (78.23s)
=== RUN   TestAccKubernetesDeployment_importBasic
--- PASS: TestAccKubernetesDeployment_importBasic (78.26s)
=== RUN   TestAccKubernetesDeployment_generatedName
--- PASS: TestAccKubernetesDeployment_generatedName (9.27s)
=== RUN   TestAccKubernetesDeployment_importGeneratedName
--- PASS: TestAccKubernetesDeployment_importGeneratedName (17.58s)
=== RUN   TestAccKubernetesDeployment_with_security_context
--- PASS: TestAccKubernetesDeployment_with_security_context (17.39s)
=== RUN   TestAccKubernetesDeployment_with_container_liveness_probe_using_exec
--- PASS: TestAccKubernetesDeployment_with_container_liveness_probe_using_exec (17.37s)
=== RUN   TestAccKubernetesDeployment_with_container_liveness_probe_using_http_get
--- PASS: TestAccKubernetesDeployment_with_container_liveness_probe_using_http_get (17.39s)
=== RUN   TestAccKubernetesDeployment_with_container_liveness_probe_using_tcp
--- PASS: TestAccKubernetesDeployment_with_container_liveness_probe_using_tcp (9.26s)
=== RUN   TestAccKubernetesDeployment_with_container_lifecycle
--- PASS: TestAccKubernetesDeployment_with_container_lifecycle (9.26s)
=== RUN   TestAccKubernetesDeployment_with_container_security_context
--- PASS: TestAccKubernetesDeployment_with_container_security_context (9.33s)
=== RUN   TestAccKubernetesDeployment_with_volume_mount
--- PASS: TestAccKubernetesDeployment_with_volume_mount (10.10s)
=== RUN   TestAccKubernetesDeployment_with_resource_requirements
--- PASS: TestAccKubernetesDeployment_with_resource_requirements (9.26s)
=== RUN   TestAccKubernetesDeployment_with_empty_dir_volume
--- PASS: TestAccKubernetesDeployment_with_empty_dir_volume (9.26s)
=== RUN   TestAccKubernetesDeploymentUpdate_basic
--- PASS: TestAccKubernetesDeploymentUpdate_basic (75.14s)
=== RUN   TestAccKubernetesHorizontalPodAutoscaler_basic
--- PASS: TestAccKubernetesHorizontalPodAutoscaler_basic (2.90s)
=== RUN   TestAccKubernetesHorizontalPodAutoscaler_generatedName
--- PASS: TestAccKubernetesHorizontalPodAutoscaler_generatedName (1.14s)
=== RUN   TestAccKubernetesHorizontalPodAutoscaler_importBasic
--- PASS: TestAccKubernetesHorizontalPodAutoscaler_importBasic (1.26s)
=== RUN   TestAccKubernetesLimitRange_basic
--- PASS: TestAccKubernetesLimitRange_basic (2.92s)
=== RUN   TestAccKubernetesLimitRange_empty
--- PASS: TestAccKubernetesLimitRange_empty (1.13s)
=== RUN   TestAccKubernetesLimitRange_generatedName
--- PASS: TestAccKubernetesLimitRange_generatedName (1.13s)
=== RUN   TestAccKubernetesLimitRange_typeChange
--- PASS: TestAccKubernetesLimitRange_typeChange (2.03s)
=== RUN   TestAccKubernetesLimitRange_multipleLimits
--- PASS: TestAccKubernetesLimitRange_multipleLimits (1.15s)
=== RUN   TestAccKubernetesLimitRange_importBasic
--- PASS: TestAccKubernetesLimitRange_importBasic (1.26s)
=== RUN   TestAccKubernetesNamespace_basic
--- PASS: TestAccKubernetesNamespace_basic (11.52s)
=== RUN   TestAccKubernetesNamespace_invalidLabelValueType
--- PASS: TestAccKubernetesNamespace_invalidLabelValueType (0.02s)
=== RUN   TestAccKubernetesNamespace_importBasic
--- PASS: TestAccKubernetesNamespace_importBasic (8.14s)
=== RUN   TestAccKubernetesNamespace_generatedName
--- PASS: TestAccKubernetesNamespace_generatedName (8.01s)
=== RUN   TestAccKubernetesNamespace_withSpecialCharacters
--- PASS: TestAccKubernetesNamespace_withSpecialCharacters (8.03s)
=== RUN   TestAccKubernetesNamespace_importGeneratedName
--- PASS: TestAccKubernetesNamespace_importGeneratedName (8.14s)
=== RUN   TestAccKubernetesNetworkPolicy_basic
--- PASS: TestAccKubernetesNetworkPolicy_basic (4.71s)
=== RUN   TestAccKubernetesNetworkPolicy_withEgressAtCreation
--- PASS: TestAccKubernetesNetworkPolicy_withEgressAtCreation (1.16s)
=== RUN   TestAccKubernetesNetworkPolicy_importBasic
--- PASS: TestAccKubernetesNetworkPolicy_importBasic (1.27s)
=== RUN   TestAccKubernetesPersistentVolumeClaim_basic
--- PASS: TestAccKubernetesPersistentVolumeClaim_basic (4.16s)
=== RUN   TestAccKubernetesPersistentVolumeClaim_googleCloud_importBasic
--- PASS: TestAccKubernetesPersistentVolumeClaim_googleCloud_importBasic (28.87s)
=== RUN   TestAccKubernetesPersistentVolumeClaim_googleCloud_volumeMatch
--- PASS: TestAccKubernetesPersistentVolumeClaim_googleCloud_volumeMatch (31.35s)
=== RUN   TestAccKubernetesPersistentVolumeClaim_googleCloud_volumeUpdate
--- PASS: TestAccKubernetesPersistentVolumeClaim_googleCloud_volumeUpdate (37.42s)
=== RUN   TestAccKubernetesPersistentVolumeClaim_googleCloud_storageClass
--- PASS: TestAccKubernetesPersistentVolumeClaim_googleCloud_storageClass (14.17s)
=== RUN   TestAccKubernetesPersistentVolume_googleCloud_basic
--- PASS: TestAccKubernetesPersistentVolume_googleCloud_basic (30.04s)
=== RUN   TestAccKubernetesPersistentVolume_aws_basic
--- SKIP: TestAccKubernetesPersistentVolume_aws_basic (0.00s)
    provider_test.go:195: The environment variables AWS_DEFAULT_REGION, AWS_ZONE, AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be set to run AWS tests - skipping
=== RUN   TestAccKubernetesPersistentVolume_googleCloud_importBasic
--- PASS: TestAccKubernetesPersistentVolume_googleCloud_importBasic (26.70s)
=== RUN   TestAccKubernetesPersistentVolume_googleCloud_volumeSource
--- PASS: TestAccKubernetesPersistentVolume_googleCloud_volumeSource (28.80s)
=== RUN   TestAccKubernetesPersistentVolume_hostPath_volumeSource
--- PASS: TestAccKubernetesPersistentVolume_hostPath_volumeSource (3.02s)
=== RUN   TestAccKubernetesPersistentVolume_local_volumeSource
--- PASS: TestAccKubernetesPersistentVolume_local_volumeSource (3.01s)
=== RUN   TestAccKubernetesPersistentVolume_cephFsSecretRef
--- PASS: TestAccKubernetesPersistentVolume_cephFsSecretRef (1.51s)
=== RUN   TestAccKubernetesPersistentVolume_storageClass
--- PASS: TestAccKubernetesPersistentVolume_storageClass (29.09s)
=== RUN   TestAccKubernetesPersistentVolume_hostPath_nodeAffinity
--- PASS: TestAccKubernetesPersistentVolume_hostPath_nodeAffinity (6.07s)
=== RUN   TestAccKubernetesPod_basic
--- PASS: TestAccKubernetesPod_basic (13.45s)
=== RUN   TestAccKubernetesPod_initContainer_updateForcesNew
--- PASS: TestAccKubernetesPod_initContainer_updateForcesNew (34.17s)
=== RUN   TestAccKubernetesPod_updateArgsForceNew
--- PASS: TestAccKubernetesPod_updateArgsForceNew (80.48s)
=== RUN   TestAccKubernetesPod_updateEnvForceNew
--- PASS: TestAccKubernetesPod_updateEnvForceNew (27.83s)
=== RUN   TestAccKubernetesPod_importBasic
--- PASS: TestAccKubernetesPod_importBasic (11.23s)
=== RUN   TestAccKubernetesPod_with_pod_security_context
--- PASS: TestAccKubernetesPod_with_pod_security_context (7.00s)
=== RUN   TestAccKubernetesPod_with_container_liveness_probe_using_exec
--- PASS: TestAccKubernetesPod_with_container_liveness_probe_using_exec (39.46s)
=== RUN   TestAccKubernetesPod_with_container_liveness_probe_using_http_get
--- PASS: TestAccKubernetesPod_with_container_liveness_probe_using_http_get (11.15s)
=== RUN   TestAccKubernetesPod_with_container_liveness_probe_using_tcp
--- PASS: TestAccKubernetesPod_with_container_liveness_probe_using_tcp (6.15s)
=== RUN   TestAccKubernetesPod_with_container_lifecycle
--- PASS: TestAccKubernetesPod_with_container_lifecycle (12.84s)
=== RUN   TestAccKubernetesPod_with_container_security_context
--- PASS: TestAccKubernetesPod_with_container_security_context (12.85s)
=== RUN   TestAccKubernetesPod_with_volume_mount
--- PASS: TestAccKubernetesPod_with_volume_mount (7.83s)
=== RUN   TestAccKubernetesPod_with_cfg_map_volume_mount
--- PASS: TestAccKubernetesPod_with_cfg_map_volume_mount (7.95s)
=== RUN   TestAccKubernetesPod_with_resource_requirements
--- PASS: TestAccKubernetesPod_with_resource_requirements (11.10s)
=== RUN   TestAccKubernetesPod_with_empty_dir_volume
--- PASS: TestAccKubernetesPod_with_empty_dir_volume (7.01s)
=== RUN   TestAccKubernetesPod_with_secret_vol_items
--- PASS: TestAccKubernetesPod_with_secret_vol_items (11.98s)
=== RUN   TestAccKubernetesPod_gke_with_nodeSelector
--- PASS: TestAccKubernetesPod_gke_with_nodeSelector (7.18s)
=== RUN   TestAccKubernetesReplicationController_deprecated_basic
--- PASS: TestAccKubernetesReplicationController_deprecated_basic (115.68s)
=== RUN   TestAccKubernetesReplicationController_deprecated_initContainer
--- PASS: TestAccKubernetesReplicationController_deprecated_initContainer (115.15s)
=== RUN   TestAccKubernetesReplicationController_deprecated_importBasic
--- PASS: TestAccKubernetesReplicationController_deprecated_importBasic (114.83s)
=== RUN   TestAccKubernetesReplicationController_deprecated_generatedName
--- PASS: TestAccKubernetesReplicationController_deprecated_generatedName (1.51s)
=== RUN   TestAccKubernetesReplicationController_deprecated_importGeneratedName
--- PASS: TestAccKubernetesReplicationController_deprecated_importGeneratedName (1.66s)
=== RUN   TestAccKubernetesReplicationController_deprecated_with_security_context
--- PASS: TestAccKubernetesReplicationController_deprecated_with_security_context (1.51s)
=== RUN   TestAccKubernetesReplicationController_deprecated_with_container_liveness_probe_using_exec
--- PASS: TestAccKubernetesReplicationController_deprecated_with_container_liveness_probe_using_exec (1.53s)
=== RUN   TestAccKubernetesReplicationController_deprecated_with_container_liveness_probe_using_http_get
--- PASS: TestAccKubernetesReplicationController_deprecated_with_container_liveness_probe_using_http_get (1.52s)
=== RUN   TestAccKubernetesReplicationController_deprecated_with_container_liveness_probe_using_tcp
--- PASS: TestAccKubernetesReplicationController_deprecated_with_container_liveness_probe_using_tcp (1.51s)
=== RUN   TestAccKubernetesReplicationController_deprecated_with_container_lifecycle
--- PASS: TestAccKubernetesReplicationController_deprecated_with_container_lifecycle (1.52s)
=== RUN   TestAccKubernetesReplicationController_deprecated_with_container_security_context
--- PASS: TestAccKubernetesReplicationController_deprecated_with_container_security_context (1.52s)
=== RUN   TestAccKubernetesReplicationController_deprecated_with_volume_mount
--- PASS: TestAccKubernetesReplicationController_deprecated_with_volume_mount (2.38s)
=== RUN   TestAccKubernetesReplicationController_deprecated_with_resource_requirements
--- PASS: TestAccKubernetesReplicationController_deprecated_with_resource_requirements (1.51s)
=== RUN   TestAccKubernetesReplicationController_deprecated_with_empty_dir_volume
--- PASS: TestAccKubernetesReplicationController_deprecated_with_empty_dir_volume (1.51s)
=== RUN   TestAccKubernetesReplicationController_basic
--- PASS: TestAccKubernetesReplicationController_basic (115.73s)
=== RUN   TestAccKubernetesReplicationController_initContainer
--- PASS: TestAccKubernetesReplicationController_initContainer (114.90s)
=== RUN   TestAccKubernetesReplicationController_importBasic
--- PASS: TestAccKubernetesReplicationController_importBasic (114.85s)
=== RUN   TestAccKubernetesReplicationController_generatedName
--- PASS: TestAccKubernetesReplicationController_generatedName (1.53s)
=== RUN   TestAccKubernetesReplicationController_importGeneratedName
--- PASS: TestAccKubernetesReplicationController_importGeneratedName (1.69s)
=== RUN   TestAccKubernetesReplicationController_with_security_context
--- PASS: TestAccKubernetesReplicationController_with_security_context (1.52s)
=== RUN   TestAccKubernetesReplicationController_with_container_liveness_probe_using_exec
--- PASS: TestAccKubernetesReplicationController_with_container_liveness_probe_using_exec (1.52s)
=== RUN   TestAccKubernetesReplicationController_with_container_liveness_probe_using_http_get
--- PASS: TestAccKubernetesReplicationController_with_container_liveness_probe_using_http_get (1.53s)
=== RUN   TestAccKubernetesReplicationController_with_container_liveness_probe_using_tcp
--- PASS: TestAccKubernetesReplicationController_with_container_liveness_probe_using_tcp (1.52s)
=== RUN   TestAccKubernetesReplicationController_with_container_lifecycle
--- PASS: TestAccKubernetesReplicationController_with_container_lifecycle (1.54s)
=== RUN   TestAccKubernetesReplicationController_with_container_security_context
--- PASS: TestAccKubernetesReplicationController_with_container_security_context (1.52s)
=== RUN   TestAccKubernetesReplicationController_with_volume_mount
--- PASS: TestAccKubernetesReplicationController_with_volume_mount (2.35s)
=== RUN   TestAccKubernetesReplicationController_with_resource_requirements
--- PASS: TestAccKubernetesReplicationController_with_resource_requirements (1.54s)
=== RUN   TestAccKubernetesReplicationController_with_empty_dir_volume
--- PASS: TestAccKubernetesReplicationController_with_empty_dir_volume (1.53s)
=== RUN   TestAccKubernetesResourceQuota_basic
--- PASS: TestAccKubernetesResourceQuota_basic (3.21s)
=== RUN   TestAccKubernetesResourceQuota_generatedName
--- PASS: TestAccKubernetesResourceQuota_generatedName (1.26s)
=== RUN   TestAccKubernetesResourceQuota_withScopes
--- PASS: TestAccKubernetesResourceQuota_withScopes (2.35s)
=== RUN   TestAccKubernetesResourceQuota_importBasic
--- PASS: TestAccKubernetesResourceQuota_importBasic (1.37s)
=== RUN   TestAccKubernetesRoleBinding_basic
--- PASS: TestAccKubernetesRoleBinding_basic (2.00s)
=== RUN   TestAccKubernetesRoleBinding_importBasic
--- PASS: TestAccKubernetesRoleBinding_importBasic (1.26s)
=== RUN   TestAccKubernetesRole_basic
--- PASS: TestAccKubernetesRole_basic (2.04s)
=== RUN   TestAccKubernetesRole_importBasic
--- PASS: TestAccKubernetesRole_importBasic (1.28s)
=== RUN   TestAccKubernetesRole_generatedName
--- PASS: TestAccKubernetesRole_generatedName (1.14s)
=== RUN   TestAccKubernetesSecret_basic
--- PASS: TestAccKubernetesSecret_basic (4.73s)
=== RUN   TestAccKubernetesSecret_importBasic
--- PASS: TestAccKubernetesSecret_importBasic (1.25s)
=== RUN   TestAccKubernetesSecret_generatedName
--- PASS: TestAccKubernetesSecret_generatedName (1.15s)
=== RUN   TestAccKubernetesSecret_importGeneratedName
--- PASS: TestAccKubernetesSecret_importGeneratedName (1.25s)
=== RUN   TestAccKubernetesSecret_binaryData
--- PASS: TestAccKubernetesSecret_binaryData (2.24s)
=== RUN   TestAccKubernetesServiceAccount_basic
--- PASS: TestAccKubernetesServiceAccount_basic (2.14s)
=== RUN   TestAccKubernetesServiceAccount_automount
--- PASS: TestAccKubernetesServiceAccount_automount (2.18s)
=== RUN   TestAccKubernetesServiceAccount_update
--- PASS: TestAccKubernetesServiceAccount_update (4.01s)
=== RUN   TestAccKubernetesServiceAccount_generatedName
--- PASS: TestAccKubernetesServiceAccount_generatedName (1.25s)
=== RUN   TestAccKubernetesService_basic
--- PASS: TestAccKubernetesService_basic (2.18s)
=== RUN   TestAccKubernetesService_loadBalancer
--- PASS: TestAccKubernetesService_loadBalancer (58.97s)
=== RUN   TestAccKubernetesService_nodePort
--- PASS: TestAccKubernetesService_nodePort (1.15s)
=== RUN   TestAccKubernetesService_noTargetPort
--- PASS: TestAccKubernetesService_noTargetPort (98.48s)
=== RUN   TestAccKubernetesService_stringTargetPort
--- PASS: TestAccKubernetesService_stringTargetPort (98.47s)
=== RUN   TestAccKubernetesService_externalName
--- PASS: TestAccKubernetesService_externalName (1.14s)
=== RUN   TestAccKubernetesService_importBasic
--- PASS: TestAccKubernetesService_importBasic (1.27s)
=== RUN   TestAccKubernetesService_generatedName
--- PASS: TestAccKubernetesService_generatedName (1.14s)
=== RUN   TestAccKubernetesService_importGeneratedName
--- PASS: TestAccKubernetesService_importGeneratedName (1.26s)
=== RUN   TestAccKubernetesStatefulSet_basic
--- PASS: TestAccKubernetesStatefulSet_basic (1.32s)
=== RUN   TestAccKubernetesStatefulSet_basic_idempotency
--- PASS: TestAccKubernetesStatefulSet_basic_idempotency (1.84s)
=== RUN   TestAccKubernetesStatefulSet_update_image
--- PASS: TestAccKubernetesStatefulSet_update_image (2.50s)
=== RUN   TestAccKubernetesStatefulSet_update_template_selector_labels
--- PASS: TestAccKubernetesStatefulSet_update_template_selector_labels (2.59s)
=== RUN   TestAccKubernetesStatefulSet_update_replicas
--- PASS: TestAccKubernetesStatefulSet_update_replicas (2.23s)
=== RUN   TestAccKubernetesStatefulSet_update_rolling_update_partition
--- PASS: TestAccKubernetesStatefulSet_update_rolling_update_partition (2.22s)
=== RUN   TestAccKubernetesStatefulSet_update_update_strategy_on_delete
--- PASS: TestAccKubernetesStatefulSet_update_update_strategy_on_delete (2.27s)
=== RUN   TestAccKubernetesStatefulSet_update_update_strategy_rolling_update
--- PASS: TestAccKubernetesStatefulSet_update_update_strategy_rolling_update (2.22s)
=== RUN   TestAccKubernetesStatefulSet_update_pod_template_container_port
--- PASS: TestAccKubernetesStatefulSet_update_pod_template_container_port (2.50s)
=== RUN   TestAccKubernetesStorageClass_basic
--- PASS: TestAccKubernetesStorageClass_basic (3.15s)
=== RUN   TestAccKubernetesStorageClass_importBasic
--- PASS: TestAccKubernetesStorageClass_importBasic (1.27s)
=== RUN   TestAccKubernetesStorageClass_generatedName
--- PASS: TestAccKubernetesStorageClass_generatedName (1.13s)
=== RUN   TestAccKubernetesStorageClass_importGeneratedName
--- PASS: TestAccKubernetesStorageClass_importGeneratedName (1.26s)
PASS
ok      github.com/terraform-providers/terraform-provider-kubernetes/kubernetes 2092.788s

@pdecat
Copy link
Contributor Author

pdecat commented Jan 16, 2019

Note: StatefulSet are not affected because they do not reuse the namespacedMetadataSchema function but have their own podTemplateFields function which does not specifiy the namespace (among others)

https://github.com/terraform-providers/terraform-provider-kubernetes/blob/master/kubernetes/schema_stateful_set_spec.go#L58

@alexsomesan What do you think about that part?
Should kubernetes_replication_controller and kubernetes_deployment resources converge with kubernetes_stateful_set and also omit the name, generate_name and namespace attributes on pod templates and use the podTemplateFields() instead of namespacedMetadataSchema()?

@pdecat pdecat force-pushed the fix-replication-controller-template branch from d1b0b0e to 00a265a Compare January 22, 2019 15:06
pdecat added a commit to pdecat/terraform-provider-kubernetes that referenced this pull request Jan 22, 2019
@pdecat pdecat force-pushed the fix-replication-controller-template branch from 00a265a to 7ff8ee6 Compare January 31, 2019 14:27
pdecat added a commit to pdecat/terraform-provider-kubernetes that referenced this pull request Jan 31, 2019
CHANGELOG.md Outdated
@@ -1,4 +1,9 @@
## 1.6.0 (Unreleased)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just stumbled upon this:

To keep the CHANGELOG up to date, we recommend updating the CHANGELOG after every set of commits that change the project. Never include CHANGELOG updates in a pull request. If you do, it will very likely cause a merge conflict with other pull requests. Instead, make the pull request without CHANGELOG updates, and add to the CHANGELOG only after merge.

@alexsomesan Should I drop that change from the PR?

@pdecat pdecat force-pushed the fix-replication-controller-template branch from 7ff8ee6 to d038dfd Compare February 5, 2019 21:55
pdecat added a commit to pdecat/terraform-provider-kubernetes that referenced this pull request Feb 5, 2019
@pdecat pdecat force-pushed the fix-replication-controller-template branch from d038dfd to b75b5cd Compare February 5, 2019 23:23
pdecat added a commit to pdecat/terraform-provider-kubernetes that referenced this pull request Feb 5, 2019
@pdecat pdecat force-pushed the fix-replication-controller-template branch from b75b5cd to ad7f1a1 Compare February 8, 2019 14:42
pdecat added a commit to pdecat/terraform-provider-kubernetes that referenced this pull request Feb 8, 2019
@pdecat pdecat force-pushed the fix-replication-controller-template branch from ad7f1a1 to bda0d2e Compare February 19, 2019 10:50
pdecat added a commit to pdecat/terraform-provider-kubernetes that referenced this pull request Feb 19, 2019
@pdecat
Copy link
Contributor Author

pdecat commented Feb 19, 2019

Work-around

Define spec.0.template.0.metadata.0.namespace as the empty string "":

resource "kubernetes_replication_controller" "myapp" {
  metadata {
    name      = "myapp"
    namespace = "${var.namespace}"

    labels {
      app = "myapp"
    }
  }
  spec {
    selector {
      name      = "myapp"
    }

    template {
      metadata {
        namespace = ""

[...]

@pdecat
Copy link
Contributor Author

pdecat commented Feb 19, 2019

@alexsomesan as there's a not so shocking work-around, should I close this PR?

@pdecat
Copy link
Contributor Author

pdecat commented Feb 19, 2019

The right thing to do would probably be to address my earlier comment and converge with the other workloads.

@alexsomesan
Copy link
Member

@pdecat In principle I think that's the right approach. I do however have to investigate a little bit to rule out any corner-cases before I fully stand by any decision. I'm working on Pod affinity now, so I can have look at this right after I'm done with that.

@pdecat pdecat force-pushed the fix-replication-controller-template branch from bda0d2e to c0de91c Compare March 6, 2019 08:52
pdecat added a commit to pdecat/terraform-provider-kubernetes that referenced this pull request Mar 6, 2019
@pdecat
Copy link
Contributor Author

pdecat commented Mar 6, 2019

Rebased on master.

@pdecat
Copy link
Contributor Author

pdecat commented Mar 7, 2019

@pdecat In principle I think that's the right approach. I do however have to investigate a little bit to rule out any corner-cases before I fully stand by any decision. I'm working on Pod affinity now, so I can have look at this right after I'm done with that.

I should probably close this one unless you confirm me you'd like to look at this.

@alexsomesan
Copy link
Member

I'm trying to get to it.

@pdecat pdecat force-pushed the fix-replication-controller-template branch from c0de91c to 26e9267 Compare March 13, 2019 10:19
@pdecat pdecat force-pushed the fix-replication-controller-template branch from 9039c74 to d2918ae Compare May 23, 2019 09:03
@pdecat
Copy link
Contributor Author

pdecat commented May 23, 2019

Rebased on master and removed CHANGELOG.md update.

@pdecat pdecat force-pushed the fix-replication-controller-template branch from d2918ae to 679fe98 Compare July 10, 2019 07:23
@pdecat pdecat force-pushed the fix-replication-controller-template branch from 679fe98 to 473b979 Compare July 22, 2019 10:31
@pdecat
Copy link
Contributor Author

pdecat commented Jul 22, 2019

Looks like this PR is still needed, @alexsomesan could you please have a look at it?

@pdecat
Copy link
Contributor Author

pdecat commented Jul 22, 2019

Note: the work-around with an empty namespace described in #275 (comment) is no longer current, the default namespace has to be specified no matter what's the actual namespace:

resource "kubernetes_replication_controller" "myapp" {
  metadata {
    name      = "myapp"
    namespace = "${var.namespace}"

    labels {
      app = "myapp"
    }
  }
  spec {
    selector {
      name      = "myapp"
    }

    template {
      metadata {
        namespace = "default"

[...]

@pdecat pdecat force-pushed the fix-replication-controller-template branch from 473b979 to 5e48e81 Compare September 24, 2019 23:19
@pdecat
Copy link
Contributor Author

pdecat commented Sep 24, 2019

Rebased on master.

@flmmartins
Copy link

Can someone approve this? Please @alexsomesan !! Thanks!

@alexsomesan
Copy link
Member

alexsomesan commented Nov 1, 2019 via email

@abayta
Copy link

abayta commented Nov 5, 2019

Please, can anybody take a look on this?

@alexsomesan alexsomesan force-pushed the fix-replication-controller-template branch from 5e48e81 to 43ba3a0 Compare November 5, 2019 18:41
@alexsomesan
Copy link
Member

rebased on master

Copy link
Member

@alexsomesan alexsomesan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good to me. Running in CI after rebase. Will merge on green

@flmmartins
Copy link

It's almost there! OMG! Please merge!

@alexsomesan
Copy link
Member

Tests still pass. OK to merge.

@alexsomesan alexsomesan merged commit 56b5436 into hashicorp:master Nov 6, 2019
@pdecat pdecat deleted the fix-replication-controller-template branch November 6, 2019 11:30
@pdecat
Copy link
Contributor Author

pdecat commented Nov 6, 2019

Thanks @alexsomesan!

@tdmalone
Copy link
Contributor

Hi @pdecat (cc @alexsomesan),

After updating to v1.10.0 of the provider, which includes this change, I'm now experiencing a recreation of Deployments on every plan, due to the provider wanting to set the previous "default" back to "":

spec.0.template.0.metadata.0.namespace: "default" => "" (forces new resource)

Is that expected? I know I could update my config to now just include 'default' as the namespace, but that also seems counter-intuitive, as these Deployments (and thus the Pods they start) are not located in the default namespace (I didn't even realise you could specify another namespace here!).

Would you suggest updating the config is the best course of action or should this value now also be computed when it exists already? (I'm not sure if that is the correct term, but I think that's how similar issues have been solved in other providers).

@pdecat
Copy link
Contributor Author

pdecat commented Nov 11, 2019

Hi @tdmalone, I was also surprised, but if you check your Deployment raw yaml, you should see it actually has that default value.

@pdecat
Copy link
Contributor Author

pdecat commented Nov 11, 2019

BTW, to avoid complete recreation of the resources, I corrected my Deployments by editing them with kubectl to remove the default namespace from the pod templates.

Also, the fact that the terraform provider wants to recreate Deployments on such changes is tracked by #201

@pdecat
Copy link
Contributor Author

pdecat commented Nov 11, 2019

In fact, #201 should probably be closed and another issue be created when the changes affect the metadata of pod templates in ReplicationController and Deployments (they're the only two resources using namespacedMetadataSchemaIsTemplate(), see #275 (comment)).

@TylerWanner
Copy link

To follow up on @pdecat and @tdmalone , at least on terraform v0.11.14, this change in default behaviour not only forces delete and recreation, but also fails during recreation. The destroy "finishes" before the deployment is actually gone, so an error of "Failed to create deployment: object is being deleted: deployments.apps "deployment" already exists" is easily reproducible during the upgrade to 1.10.0. However, rolling back to 1.9.0 after 1.10.0 changes are applied and fixed does NOT have the same issue.

@pdecat
Copy link
Contributor Author

pdecat commented Nov 11, 2019

Hi @TylerWanner, first of all, as the author of this PR, sorry for any inconvenience this may have caused to your workloads.

You should have been able to actually set the default namespace value that was showing as being removed in the plan to avoid recreation of your Deployment resources. Wasn't it the case? Or are you saying it did not show in the plan?

I believe the second issue about deletion timing out and re-creation happening too early is unrelated to this specific change.

Do you still have the logs of the plan and apply runs?

@ghost ghost locked and limited conversation to collaborators Apr 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants