terraform-google-modules / terraform-google-kubernetes-engine

Configures opinionated GKE clusters
https://registry.terraform.io/modules/terraform-google-modules/kubernetes-engine/google
Apache License 2.0
1.14k stars 1.17k forks source link

Add Event Filtering for Notifications in Kubernetes Engine Module #1840

Closed aminelaabi closed 2 months ago

aminelaabi commented 8 months ago

TL;DR

The current Kubernetes Engine module lacks the ability to directly filter events when configuring cluster notifications. This can lead to increased costs when using Pub/Sub to filter events externally. To address this, I propose adding the ability to configure event filters directly within the Kubernetes Engine module.

Terraform Resources

The notification_config block supports:

pubsub (Required) - The pubsub config for the cluster's upgrade notifications.
The pubsub block supports:

enabled (Required) - Whether or not the notification config is enabled

topic (Optional) - The pubsub topic to push upgrade notifications to. Must be in the same project as the cluster. Must be in the format: projects/{project}/topics/{topic}.

filter (Optional) - Choose what type of notifications you want to receive. If no filters are applied, you'll receive all notification types. Structure is documented below.

notification_config {
  pubsub {
    enabled = true
    topic = google_pubsub_topic.notifications.id
  }
}
Copy
The filter block supports:

event_type (Optional) - Can be used to filter what notifications are sent. Accepted values are UPGRADE_AVAILABLE_EVENT, UPGRADE_EVENT and SECURITY_BULLETIN_EVENT. See Filtering notifications for more details.

https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#filter

Detailed design

## Proposed Feature:

**Event Filtering Options:**
Allow users to specify an input filter as a list of strings when configuring cluster notifications. The filter should support the following values:
- `UpgradeEvent`
- `SecurityBulletinEvent`
- `UpgradeAvailableEvent`

## Additional Context:

The current workaround involves filtering events externally using Pub/Sub, which can be less cost-effective. Providing a direct option to filter events within the Kubernetes Engine module would enhance usability and cost efficiency.

## Example Configuration:

module "gke" {
  source = "terraform-google-modules/kubernetes-engine/google//modules/private-cluster"

  # Other configuration options...

  notification_config_topic = "projects/{project}/topics/{topic}"
  filter = ["UpgradeEvent", "SecurityBulletinEvent", "UpgradeAvailableEvent"]
}

Additional information

No response

github-actions[bot] commented 6 months ago

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

aminelaabi commented 6 months ago

I'm currently working on the issue

onuki-yoshihisa commented 5 months ago

I am also having the same problem. When I make changes in the UI and then try to apply terraform, the filter part comes out with the difference.

github-actions[bot] commented 2 months ago

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