terraform-google-kubernetes-engine icon indicating copy to clipboard operation
terraform-google-kubernetes-engine copied to clipboard

Add Event Filtering for Notifications in Kubernetes Engine Module

Open aminelaabi opened this issue 1 year ago • 3 comments

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

aminelaabi avatar Jan 11 '24 13:01 aminelaabi

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

github-actions[bot] avatar Mar 11 '24 23:03 github-actions[bot]

I'm currently working on the issue

aminelaabi avatar Mar 12 '24 21:03 aminelaabi

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.

onuki-yoshihisa avatar May 09 '24 04:05 onuki-yoshihisa