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

Initial definition of a Safer Cluster module. #272

Merged
merged 4 commits into from
Nov 26, 2019

Conversation

mmontan
Copy link
Contributor

@mmontan mmontan commented Sep 30, 2019

Still TODO:

  • add documentation;
  • add settings for customizing the project holding GCR

@mmontan
Copy link
Contributor Author

mmontan commented Sep 30, 2019

I can't find details about the concourse-ci/lint-tests failure. "make -s" is successful.

How can I get the logs?

@morgante
Copy link
Contributor

morgante commented Oct 4, 2019

@mmontan You can ignore the (legacy) Concourse tests, but please do try to get the Cloud Build triggers working. You should have access to Cloud Build logs, but if not please ping me.

The PR adds a new "safer" GKE module. The module includes hardening
suggestions from multiple sources.
@mmontan
Copy link
Contributor Author

mmontan commented Oct 7, 2019

The Cloud Build triggers are working now.

Copy link

@onetwopunch onetwopunch left a comment

Choose a reason for hiding this comment

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

In general, I think that instead of making a specific safer_cluster by wrapping the beta_private_cluster, we should be just making the beta_private_cluster secure by default by updating necessary variable defaults. Could you please give some reasoning or justification as to why we need this "safer" wrapper module as opposed to making the exising module(s) secure by default?

subnetwork = var.subnetwork
ip_range_pods = var.ip_range_pods
ip_range_services = var.ip_range_services
master_ipv4_cidr_block = "172.16.0.0/28"

Choose a reason for hiding this comment

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

This should be a variable instead of being hard-coded to allow users to pass in their own master CIDR block

http_load_balancing = var.http_load_balancing

// Disable the dashboard. It creates risk by running as a very sensitive user.
kubernetes_dashboard = false

Choose a reason for hiding this comment

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

This is unnecessary since kubernetes_dashboard is false by default.

// policies should be under the control of a cental cluster management team,
// rather than individual teams.
network_policy = true
network_policy_provider = "CALICO"

Choose a reason for hiding this comment

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

Unnecessary since network_policy_provider is "CALICO" by default

// destroying the cluster.
remove_default_node_pool = true

disable_legacy_metadata_endpoints = true

Choose a reason for hiding this comment

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

disable_legacy_metadata_endpoints is already true by default

node_pools_tags = var.node_pools_tags

// TODO(mmontan): we generally considered applying
// just the cloud-platofrm scope and use Cloud IAM

Choose a reason for hiding this comment

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

typo: s/cloud-platofrm/cloud-platform/

upstream_nameservers = var.upstream_nameservers

// We should use IP Alias.
configure_ip_masq = false

Choose a reason for hiding this comment

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

configure_ip_masq is already false by default


The module defines a safer configuration for a GKE cluster.

TODO(mmontan): add documentation for the module.

Choose a reason for hiding this comment

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

Please add your README from #281 into this PR

// All applications shuold run with an identity defined via Workload Identity anyway.
// - Use a service account passed as a parameter to the module, in case the user
// wants to maintain control of their service accounts.
create_service_account = length(var.compute_engine_service_account) > 0 ? false : true

Choose a reason for hiding this comment

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

Instead of using length here, prefer comparing it with its default value. Such as:

var.compute_engine_service_account == "" ? false : true

database_encryption = var.database_encryption

// We suggest to define policies about which images can run on a cluster.
enable_binary_authorization = true

Choose a reason for hiding this comment

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

It's worth noting that since you are using the beta-private-cluster, this field enable_binary_authorization is actually not implemented yet, it's just a stub so it doesn't do anything

}]

resource_usage_export_dataset_id = var.resource_usage_export_dataset_id
node_metadata = "SECURE"

Choose a reason for hiding this comment

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

node_metadata is already "SECURE" by default

mmontan and others added 2 commits October 24, 2019 17:03
The PR adds a new "safer" GKE module. The module includes hardening
suggestions from multiple sources.
@bharathkkb
Copy link
Member

Hi @mmontan is this being worked on?
I can help with finishing this up
+@aaron-lane

@bharathkkb bharathkkb self-assigned this Nov 8, 2019
@morgante
Copy link
Contributor

morgante commented Nov 8, 2019

@bharathkkb Go ahead and take this over.

@bharathkkb bharathkkb mentioned this pull request Nov 11, 2019
@mmontan
Copy link
Contributor Author

mmontan commented Nov 11, 2019

@bharathkkb Thank you for taking this over!

@aaron-lane aaron-lane merged commit d60fb28 into terraform-google-modules:master Nov 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants