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

kubernetes_deployment does not support namespace_selector for pod_anti_affinity #1826

Closed
matpen opened this issue Sep 4, 2022 · 10 comments
Closed
Assignees
Labels
enhancement theme/coverage issues that involve improving API coverage for the provider
Milestone

Comments

@matpen
Copy link

matpen commented Sep 4, 2022

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 alexsomesan added the theme/coverage issues that involve improving API coverage for the provider label Sep 7, 2022
@flynnhandley
Copy link

flynnhandley commented Sep 22, 2022

@alexsomesan, I can see other resources already have support for namespace_selector, are you be open to a PR for this enhancement?

@github-actions
Copy link

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!

@github-actions github-actions bot added the stale label Sep 23, 2023
@AlbertoSpinella
Copy link

AlbertoSpinella commented Sep 23, 2023

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.

@github-actions github-actions bot removed the stale label Sep 23, 2023
@Nox-404
Copy link

Nox-404 commented Dec 19, 2023

Hello, is there any plan to implement this ?

@Nox-404
Copy link

Nox-404 commented Dec 19, 2023

just noticed this PR: #2020

@BBBmau
Copy link
Contributor

BBBmau commented Jan 3, 2024

@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

@BBBmau BBBmau added this to the v2.34.0 milestone Oct 11, 2024
@BBBmau
Copy link
Contributor

BBBmau commented Oct 11, 2024

@aayushsss1 this is a good issue to pick up. involves adding a new field which is not blocked by a k8s version block. You're open to work on it since the previous PR was closed a few months back.

@aayushsss1
Copy link
Contributor

@BBBmau sure I'll take a look into this!

@aayushsss1
Copy link
Contributor

@BBBmau It looks like namespace_selector is already supported for pod affinity and pod anti-affinity. Could you please let me know what additional work is required on this? Thanks!

"namespace_selector": {
Type: schema.TypeList,
Description: "A label query over a set of namespaces that matches the namespaceSelector in Kubernetes.",
Optional: true,
Elem: &schema.Resource{
Schema: labelSelectorFields(true),
},
},

@BBBmau
Copy link
Contributor

BBBmau commented Nov 14, 2024

@BBBmau It looks like namespace_selector is already supported for pod affinity and pod anti-affinity. Could you please let me know what additional work is required on this? Thanks!

"namespace_selector": {
Type: schema.TypeList,
Description: "A label query over a set of namespaces that matches the namespaceSelector in Kubernetes.",
Optional: true,
Elem: &schema.Resource{
Schema: labelSelectorFields(true),
},
},

You're right! Just looked and we recently merged this that add support not too long ago #2577

It addressed this issue which is a duplicate of this one. So we can mark this as completed. Thanks for spotting it @aayushsss1 !

@BBBmau BBBmau closed this as completed Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement theme/coverage issues that involve improving API coverage for the provider
Projects
None yet
Development

No branches or pull requests

7 participants