mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-15 14:53:44 +00:00
Chore: add app protocol tweak function
This commit is contained in:
parent
06993afdd6
commit
440d5910f7
@ -117,6 +117,12 @@ func tweakAddDeletionTimestamp(time time.Time) serviceTweak {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func tweakAddAppProtocol(appProtocol string) serviceTweak {
|
||||||
|
return func(s *v1.Service) {
|
||||||
|
s.Spec.Ports[0].AppProtocol = &appProtocol
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Wrap newService so that you don't have to call default arguments again and again.
|
// Wrap newService so that you don't have to call default arguments again and again.
|
||||||
func defaultExternalService() *v1.Service {
|
func defaultExternalService() *v1.Service {
|
||||||
return newService("external-balancer", v1.ServiceTypeLoadBalancer)
|
return newService("external-balancer", v1.ServiceTypeLoadBalancer)
|
||||||
@ -1440,9 +1446,7 @@ func TestNeedsUpdate(t *testing.T) {
|
|||||||
}, {
|
}, {
|
||||||
testName: "If appProtocol is set to a different value",
|
testName: "If appProtocol is set to a different value",
|
||||||
updateFn: func() {
|
updateFn: func() {
|
||||||
protocol := "http"
|
oldSvc = newService("tcp-service", v1.ServiceTypeLoadBalancer, tweakAddPorts(v1.ProtocolTCP, 22), tweakAddAppProtocol("http"))
|
||||||
oldSvc = newService("tcp-service", v1.ServiceTypeLoadBalancer, tweakAddPorts(v1.ProtocolTCP, 22))
|
|
||||||
oldSvc.Spec.Ports[0].AppProtocol = &protocol
|
|
||||||
newSvc = oldSvc.DeepCopy()
|
newSvc = oldSvc.DeepCopy()
|
||||||
newProtocol := "tcp"
|
newProtocol := "tcp"
|
||||||
newSvc.Spec.Ports[0].AppProtocol = &newProtocol
|
newSvc.Spec.Ports[0].AppProtocol = &newProtocol
|
||||||
|
Loading…
Reference in New Issue
Block a user