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

Network Policies require to_pod_labels which should be optional #240

Open
vrabbi opened this issue Aug 18, 2023 · 2 comments
Open

Network Policies require to_pod_labels which should be optional #240

vrabbi opened this issue Aug 18, 2023 · 2 comments
Labels
bug Bug

Comments

@vrabbi
Copy link

vrabbi commented Aug 18, 2023

Describe the bug

TMC allows for not defining a pod selector to apply a network policy to which in turn means it applies to all pods in the relevant namespace/workspace. the TMC resource requires supplying the to_pod_labels field and it is a map type, however when providing an empty map eg to_pod_labels = {} this fails as well as it complains about requiring the data structure to be an array in the API but it is being passed a value of null.

Reproduction steps

  1. create a network policy resource as such:
resource "tanzu-mission-control_network_policy" "kube_system_egress" {
  name = "allow-egress-to-kube-system"

  scope {
    workspace {
      workspace = "saample"
    }
  }

  spec {
    input {
      custom_egress {
        rules {
          ports {
            port = "53"
            protocol = "TCP"
          }
          ports {
            port = "53"
            protocol = "UDP"
          }
          rule_spec {
            custom_selector {
              namespace_selector = {
                "kubernetes.io/metadata.name" = "kube-system"
              }
            }
          }
        }
      }
    }
  }
}
  1. when this fails try adding the following under custom_egress and see it fail again with a different error:
        to_pod_labels = {}
  1. Add an actual label and see that it works
        to_pod_labels = {"demo" = "true"}

Expected behavior

network policy should allow not specifying the to_pod_labels and or allow an empty selector

Additional context

No response

@vrabbi vrabbi added the bug Bug label Aug 18, 2023
@ramya-bangera
Copy link
Contributor

@vrabbi - This is a known issue and tracked already in our Jira

@ramya-bangera
Copy link
Contributor

@vrabbi - I have tagged you in the Jira ticket

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug
Projects
None yet
Development

No branches or pull requests

2 participants