-
Notifications
You must be signed in to change notification settings - Fork 263
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
Add support for setting gke intranode visibility #747
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -606,6 +606,44 @@ func TestAccContainerCluster_withLegacyAbac(t *testing.T) { | |
}) | ||
} | ||
|
||
func TestAccContainerCluster_withIntraNodeVisibility(t *testing.T) { | ||
t.Parallel() | ||
|
||
clusterName := fmt.Sprintf("cluster-test-%s", acctest.RandString(10)) | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
CheckDestroy: testAccCheckContainerClusterDestroy, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccContainerCluster_withIntraNodeVisibility(clusterName), | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttr("google_container_cluster.with_intranode_visibility", "enable_intranode_visibility", "true"), | ||
), | ||
}, | ||
{ | ||
ResourceName: "google_container_cluster.with_intranode_visibility", | ||
ImportStateIdPrefix: "us-central1-a/", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
{ | ||
Config: testAccContainerCluster_updateIntraNodeVisibility(clusterName), | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttr("google_container_cluster.with_intranode_visibility", "enable_intranode_visibility", "false"), | ||
), | ||
}, | ||
{ | ||
ResourceName: "google_container_cluster.with_intranode_visibility", | ||
ImportStateIdPrefix: "us-central1-a/", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
/* | ||
Since GKE disables legacy ABAC by default in Kubernetes version 1.8+, and the default Kubernetes | ||
version for GKE is also 1.8+, this test will ensure that legacy ABAC is disabled by default to be | ||
|
@@ -635,6 +673,34 @@ func TestAccContainerCluster_withDefaultLegacyAbac(t *testing.T) { | |
}) | ||
} | ||
|
||
/* | ||
Since GKE disables Intra Node Visibility by default, this test will ensure that Intra Node Visibility is disabled by default to be | ||
more consistent with default settings in the Cloud Console | ||
*/ | ||
func TestAccContainerCluster_withDefaultIntraNodeVisibility(t *testing.T) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this field is marked as |
||
t.Parallel() | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
CheckDestroy: testAccCheckContainerClusterDestroy, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccContainerCluster_defaultIntraNodeVisibility(acctest.RandString(10)), | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttr("google_container_cluster.default_intranode_visibility", "enable_intranode_visibility", "false"), | ||
), | ||
}, | ||
{ | ||
ResourceName: "google_container_cluster.default_intranode_visibility", | ||
ImportStateIdPrefix: "us-central1-a/", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func TestAccContainerCluster_withVersion(t *testing.T) { | ||
t.Parallel() | ||
|
||
|
@@ -2203,6 +2269,37 @@ resource "google_container_cluster" "with_legacy_abac" { | |
}`, clusterName) | ||
} | ||
|
||
func testAccContainerCluster_defaultIntraNodeVisibility(clusterName string) string { | ||
return fmt.Sprintf(` | ||
resource "google_container_cluster" "default_intranode_visibility" { | ||
name = "cluster-test-%s" | ||
zone = "us-central1-a" | ||
initial_node_count = 1 | ||
}`, clusterName) | ||
} | ||
|
||
func testAccContainerCluster_withIntraNodeVisibility(clusterName string) string { | ||
return fmt.Sprintf(` | ||
resource "google_container_cluster" "with_intranode_visibility" { | ||
name = "cluster-test-%s" | ||
zone = "us-central1-a" | ||
initial_node_count = 1 | ||
|
||
enable_intranode_visibility = true | ||
}`, clusterName) | ||
} | ||
|
||
func testAccContainerCluster_updateIntraNodeVisibility(clusterName string) string { | ||
return fmt.Sprintf(` | ||
resource "google_container_cluster" "with_intranode_visibility" { | ||
name = "cluster-test-%s" | ||
zone = "us-central1-a" | ||
initial_node_count = 1 | ||
|
||
enable_intranode_visibility = false | ||
}`, clusterName) | ||
} | ||
|
||
func testAccContainerCluster_withVersion(clusterName string) string { | ||
return fmt.Sprintf(` | ||
data "google_container_engine_versions" "central1a" { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this ForceSendFields is working as intended. There is no
Enabled
in theEnableIntraNodeVisibility
object so it is ignored. However since this is in Create andfalse
is the default there is no need to force send a falsey value.