From e6008325cf6e03a01b5a1affca1b9f64373b7da8 Mon Sep 17 00:00:00 2001 From: Aurel Canciu Date: Wed, 16 Oct 2024 20:27:24 +0200 Subject: [PATCH] Code review fixes for topology_spread_constraints Signed-off-by: Aurel Canciu --- pkg/operator/contenthash/topology_spread_constraints.go | 5 +---- pkg/operator/contenthash/topology_spread_constraints_test.go | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/pkg/operator/contenthash/topology_spread_constraints.go b/pkg/operator/contenthash/topology_spread_constraints.go index 0f82e7a4..13891bc9 100644 --- a/pkg/operator/contenthash/topology_spread_constraints.go +++ b/pkg/operator/contenthash/topology_spread_constraints.go @@ -20,7 +20,6 @@ package contenthash import ( "crypto/md5" "encoding/hex" - "fmt" "strings" corev1 "k8s.io/api/core/v1" @@ -45,11 +44,9 @@ func TopologySpreadConstraints(in []corev1.TopologySpreadConstraint) string { } writeStringHash(h, StringMap(labelSelectors)) writeStringHash(h, strings.Join(tsc.MatchLabelKeys, "")) - minDomainsSeconds := "nil" if tsc.MinDomains != nil { - minDomainsSeconds = fmt.Sprint(*tsc.MinDomains) + writeStringHash(h, string(*tsc.MinDomains)) } - writeStringHash(h, minDomainsSeconds) if tsc.NodeAffinityPolicy != nil { writeStringHash(h, string(*tsc.NodeAffinityPolicy)) } diff --git a/pkg/operator/contenthash/topology_spread_constraints_test.go b/pkg/operator/contenthash/topology_spread_constraints_test.go index fb9c93c5..723bc347 100644 --- a/pkg/operator/contenthash/topology_spread_constraints_test.go +++ b/pkg/operator/contenthash/topology_spread_constraints_test.go @@ -1,5 +1,5 @@ /* -Copyright 2020 PlanetScale Inc. +Copyright 2024 PlanetScale Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.