fix: specs equals ignores replicas

This commit is contained in:
Pavel Sviderski
2025-03-01 22:31:18 +10:00
parent 435a794fa5
commit 52117954a8
+5
View File
@@ -44,8 +44,13 @@ func (s *ServiceSpec) Validate() error {
return nil return nil
} }
// Equals returns true if the service spec is equal to the given spec ignoring the number of replicas.
func (s *ServiceSpec) Equals(spec ServiceSpec) bool { func (s *ServiceSpec) Equals(spec ServiceSpec) bool {
// TODO: ignore order of ports. // TODO: ignore order of ports.
sCopy := *s
// Ignore the number of replicas when comparing.
sCopy.Replicas = 0
spec.Replicas = 0
return reflect.DeepEqual(*s, spec) return reflect.DeepEqual(*s, spec)
} }