Skip to content

Commit 7755d6c

Browse files
committed
Add common labels to pod affinity/anti-affinity label selector
1 parent 6f82073 commit 7755d6c

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

pkg/transformers/labelsandannotationsconfig.go

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,32 @@ var defaultLabelsPathConfigs = []PathConfig{
5252
Path: []string{"spec", "template", "metadata", "labels"},
5353
CreateIfNotPresent: true,
5454
},
55+
{
56+
GroupVersionKind: &schema.GroupVersionKind{Group: "apps", Kind: "Deployment"},
57+
Path: []string{"spec", "template", "spec", "affinity", "podAffinity",
58+
"preferredDuringSchedulingIgnoredDuringExecution",
59+
"podAffinityTerm", "labelSelector", "matchLabels"},
60+
CreateIfNotPresent: false,
61+
},
62+
{
63+
GroupVersionKind: &schema.GroupVersionKind{Group: "apps", Kind: "Deployment"},
64+
Path: []string{"spec", "template", "spec", "affinity", "podAffinity",
65+
"requiredDuringSchedulingIgnoredDuringExecution", "labelSelector", "matchLabels"},
66+
CreateIfNotPresent: false,
67+
},
68+
{
69+
GroupVersionKind: &schema.GroupVersionKind{Group: "apps", Kind: "Deployment"},
70+
Path: []string{"spec", "template", "spec", "affinity", "podAntiAffinity",
71+
"preferredDuringSchedulingIgnoredDuringExecution",
72+
"podAffinityTerm", "labelSelector", "matchLabels"},
73+
CreateIfNotPresent: false,
74+
},
75+
{
76+
GroupVersionKind: &schema.GroupVersionKind{Group: "apps", Kind: "Deployment"},
77+
Path: []string{"spec", "template", "spec", "affinity", "podAntiAffinity",
78+
"requiredDuringSchedulingIgnoredDuringExecution", "labelSelector", "matchLabels"},
79+
CreateIfNotPresent: false,
80+
},
5581
{
5682
GroupVersionKind: &schema.GroupVersionKind{Kind: "ReplicaSet"},
5783
Path: []string{"spec", "selector", "matchLabels"},
@@ -82,6 +108,32 @@ var defaultLabelsPathConfigs = []PathConfig{
82108
Path: []string{"spec", "template", "metadata", "labels"},
83109
CreateIfNotPresent: true,
84110
},
111+
{
112+
GroupVersionKind: &schema.GroupVersionKind{Group: "apps", Kind: "StatefulSet"},
113+
Path: []string{"spec", "template", "spec", "affinity", "podAffinity",
114+
"preferredDuringSchedulingIgnoredDuringExecution",
115+
"podAffinityTerm", "labelSelector", "matchLabels"},
116+
CreateIfNotPresent: false,
117+
},
118+
{
119+
GroupVersionKind: &schema.GroupVersionKind{Group: "apps", Kind: "StatefulSet"},
120+
Path: []string{"spec", "template", "spec", "affinity", "podAffinity",
121+
"requiredDuringSchedulingIgnoredDuringExecution", "labelSelector", "matchLabels"},
122+
CreateIfNotPresent: false,
123+
},
124+
{
125+
GroupVersionKind: &schema.GroupVersionKind{Group: "apps", Kind: "StatefulSet"},
126+
Path: []string{"spec", "template", "spec", "affinity", "podAntiAffinity",
127+
"preferredDuringSchedulingIgnoredDuringExecution",
128+
"podAffinityTerm", "labelSelector", "matchLabels"},
129+
CreateIfNotPresent: false,
130+
},
131+
{
132+
GroupVersionKind: &schema.GroupVersionKind{Group: "apps", Kind: "StatefulSet"},
133+
Path: []string{"spec", "template", "spec", "affinity", "podAntiAffinity",
134+
"requiredDuringSchedulingIgnoredDuringExecution", "labelSelector", "matchLabels"},
135+
CreateIfNotPresent: false,
136+
},
85137
{
86138
GroupVersionKind: &schema.GroupVersionKind{Group: "batch", Kind: "Job"},
87139
Path: []string{"spec", "selector", "matchLabels"},

0 commit comments

Comments
 (0)