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

Fix node spec podLabels bug #184

Merged
merged 1 commit into from
Sep 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions controllers/druid/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1268,17 +1268,16 @@ func makeLabelsForDruid(druid *v1alpha1.Druid) map[string]string {
}

// makeLabelsForDruid returns the labels for selecting the resources
// belonging to the given druid CR name.
// belonging to the given druid CR name. adds labels from both node &
// cluster specs. node spec labels will take precedence over clusters labels
func makeLabelsForNodeSpec(nodeSpec *v1alpha1.DruidNodeSpec, m *v1alpha1.Druid, clusterName, nodeSpecUniqueStr string) map[string]string {
var labels = map[string]string{}

// if both labels are present at both cluster and node spec
// labels should be merged.
if nodeSpec.PodLabels != nil && m.Spec.PodLabels != nil {
labels = nodeSpec.PodLabels
for k, v := range m.Spec.PodLabels {
labels[k] = v
}

for k, v := range m.Spec.PodLabels {
for k, v := range nodeSpec.PodLabels {
labels[k] = v
}

Expand Down