terraform-provider-kubernetes
terraform-provider-kubernetes copied to clipboard
kubernetes_deployment does not support namespace_selector for pod_anti_affinity
Description
It looks like neither kubernetes_deployment nor kubernetes_deployment_v1 support the namespace_selector field for pod_anti_affinity (and possibly for pod_affinity). This is unfortunate, because it is the only way to specify a match in "all namespaces" (by passing an empty selector).
Potential Terraform Configuration
resource "kubernetes_deployment" "my_app" {
...
spec {
...
template {
...
spec {
...
affinity {
pod_anti_affinity {
required_during_scheduling_ignored_during_execution {
label_selector {
match_expressions {
key = "app"
operator = "In"
values = ["my-app"]
}
}
namespace_selector = {} # TODO this does not work
topology_key = "kubernetes.io/hostname"
}
}
}
...
References
n / a
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
@alexsomesan, I can see other resources already have support for namespace_selector, are you be open to a PR for this enhancement?
Marking this issue as stale due to inactivity. If this issue receives no comments in the next 30 days it will automatically be closed. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. This helps our maintainers find and focus on the active issues. Maintainers may also remove the stale label at their discretion. Thank you!
I can confirm that also in pod_affinity the block namespace_selector isn't recognized.
The block namespace_selector isn't recognized also under deployment.spec.template.spec.affinity.pod_affinity.preferred_during_scheduling_ignored_during_execution.pod_affinity_term.
Hello, is there any plan to implement this ?
just noticed this PR: https://github.com/hashicorp/terraform-provider-kubernetes/pull/2020
@Nox-404 it seems like the author of #2020 is taking some time to respond. You are more than welcome to grab what they've worked on and make the requested changes to get this merged