Skip to content

Commit

Permalink
change private K8s service to be a headless service (#15170)
Browse files Browse the repository at this point in the history
* change private K8s service to be a headless service

* use clusteripnone constant
  • Loading branch information
izabelacg authored and dprotaso committed Jul 10, 2024
1 parent 2156812 commit 6760aa6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/reconciler/serverlessservice/resources/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ func MakePrivateService(sks *v1alpha1.ServerlessService, selector map[string]str
Port: targetPort(sks).IntVal,
TargetPort: targetPort(sks),
}},
Selector: selector,
Selector: selector,
ClusterIP: corev1.ClusterIPNone,
},
}
}
2 changes: 2 additions & 0 deletions pkg/reconciler/serverlessservice/resources/services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func privateSvcMod(s *corev1.Service) {
"app": "sadness",
}
}
s.Spec.ClusterIP = corev1.ClusterIPNone
s.Spec.Ports = append(s.Spec.Ports,
[]corev1.ServicePort{{
Name: servingv1.AutoscalingQueueMetricsPortName,
Expand Down Expand Up @@ -470,6 +471,7 @@ func TestMakePrivateService(t *testing.T) {
s.Labels["ava"] = "adore"
s.Labels[networking.SKSLabelKey] = "dream-tonight-cherub-rock-mayonnaise-hummer-disarm-rocket-soma-quiet"
s.Annotations = map[string]string{"cherub": "rock"}
s.Spec.ClusterIP = corev1.ClusterIPNone
}, privateSvcMod, func(s *corev1.Service) {
// And now patch port to be http2.
s.Spec.Ports[0] = corev1.ServicePort{
Expand Down

0 comments on commit 6760aa6

Please sign in to comment.