Skip to content

Commit

Permalink
Removing duplicate check, and adding changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
JaylonmcShan03 committed Sep 9, 2024
1 parent 3ec2f92 commit 97d5286
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .changelog/2577.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
Added support for `namespace_selector` field in `PodAffinityTerm` to enhance pod affinity and anti-affinity rules, allowing selection of namespaces based on label selectors.
```
6 changes: 2 additions & 4 deletions kubernetes/structure_label_selector.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,13 @@ func expandNamespaceSelector(n []interface{}) *metav1.LabelSelector {
return &metav1.LabelSelector{}
}

in, ok := n[0].(map[string]interface{})
if !ok {
return &metav1.LabelSelector{}
}
in := n[0].(map[string]interface{})

obj := &metav1.LabelSelector{}
if v, ok := in["match_labels"].(map[string]interface{}); ok && len(v) > 0 {
obj.MatchLabels = expandStringMap(v)
}
//We are using labelSelector metav1, due to NamespaceSelector not existing as a type in metav1
if v, ok := in["match_expressions"].([]interface{}); ok && len(v) > 0 {
obj.MatchExpressions = expandLabelSelectorRequirement(v)
}
Expand Down

0 comments on commit 97d5286

Please sign in to comment.