Skip to content

Commit

Permalink
bugfix #1340: not compare all svc.spec for user modified scene
Browse files Browse the repository at this point in the history
Signed-off-by: spwangxp <wangshengpeng@cestc.cn>
  • Loading branch information
spwangxp committed Apr 28, 2023
1 parent 2ac09c7 commit 1500e2c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions internal/infrastructure/kubernetes/resource/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ func ExpectedServiceSpec(serviceType *egcfgv1a1.ServiceType) corev1.ServiceSpec
return serviceSpec
}

// CompareSvc Only compare the selector and ports(not include nodePort) in case user have modified for some scene.
// CompareSvc Only compare the type, selector and ports(not include nodePort) in case user have modified for some scene.
func CompareSvc(currentSvc, originalSvc *corev1.Service) bool {
return cmp.Equal(currentSvc.Spec.Selector, originalSvc.Spec.Selector) &&
return cmp.Equal(currentSvc.Spec.Type, originalSvc.Spec.Type) &&
cmp.Equal(currentSvc.Spec.Selector, originalSvc.Spec.Selector) &&
cmp.Equal(currentSvc.Spec.Ports, originalSvc.Spec.Ports, cmpopts.IgnoreFields(corev1.ServicePort{}, "NodePort"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func TestCompareSvc(t *testing.T) {
Selector: map[string]string{
"app": "my-app",
},
Type: "ClusterIP",
Type: "NodePort",
},
},
}, {
Expand Down

0 comments on commit 1500e2c

Please sign in to comment.