Skip to content

Commit

Permalink
Added name to service spec (#58)
Browse files Browse the repository at this point in the history
* Added name to service spec

Signed-off-by: Krithika Vijayakumar <[email protected]>

* Added vertexHTTPSPortName

Signed-off-by: Krithika Vijayakumar <[email protected]>
  • Loading branch information
Krithika3 authored Jun 15, 2022
1 parent 270b851 commit fd5b374
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
10 changes: 6 additions & 4 deletions pkg/apis/numaflow/v1alpha1/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,12 @@ const (
// Watermark
EnvWatermarkOn = "NUMAFLOW_WATERMARK_ON"

PathVarRun = "/var/run/numaflow"
VertexMetricsPort = 2469
VertexHTTPSPort = 8443
DaemonServicePort = 4327
PathVarRun = "/var/run/numaflow"
VertexMetricsPort = 2469
VertexMetricsPortName = "metrics"
VertexHTTPSPort = 8443
VertexHTTPSPortName = "https"
DaemonServicePort = 4327

DefaultRequeueAfter = 10 * time.Second

Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/numaflow/v1alpha1/vertex_type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func TestGetVertexReplicas(t *testing.T) {
}

func TestGetHeadlessSvcSpec(t *testing.T) {
s := testVertex.getServiceObj(testVertex.GetHeadlessServiceName(), true, VertexMetricsPort)
s := testVertex.getServiceObj(testVertex.GetHeadlessServiceName(), true, VertexMetricsPort, VertexMetricsPortName)
assert.Equal(t, s.Name, testVertex.GetHeadlessServiceName())
assert.Equal(t, s.Namespace, testVertex.Namespace)
assert.Equal(t, 1, len(s.Spec.Ports))
Expand Down
8 changes: 4 additions & 4 deletions pkg/apis/numaflow/v1alpha1/vertex_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ func (v Vertex) GetHeadlessServiceName() string {
}

func (v Vertex) GetServiceObjs() []*corev1.Service {
svcs := []*corev1.Service{v.getServiceObj(v.GetHeadlessServiceName(), true, VertexMetricsPort)}
svcs := []*corev1.Service{v.getServiceObj(v.GetHeadlessServiceName(), true, VertexMetricsPort, VertexMetricsPortName)}
if x := v.Spec.Source; x != nil && x.HTTP != nil && x.HTTP.Service {
svcs = append(svcs, v.getServiceObj(v.Name, false, VertexHTTPSPort))
svcs = append(svcs, v.getServiceObj(v.Name, false, VertexHTTPSPort, VertexHTTPSPortName))
}
return svcs
}

func (v Vertex) getServiceObj(name string, headless bool, port int) *corev1.Service {
func (v Vertex) getServiceObj(name string, headless bool, port int, servicePortName string) *corev1.Service {
svc := &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Namespace: v.Namespace,
Expand All @@ -96,7 +96,7 @@ func (v Vertex) getServiceObj(name string, headless bool, port int) *corev1.Serv
},
Spec: corev1.ServiceSpec{
Ports: []corev1.ServicePort{
{Port: int32(port), TargetPort: intstr.FromInt(port)},
{Port: int32(port), TargetPort: intstr.FromInt(port), Name: servicePortName},
},
Selector: map[string]string{
KeyPartOf: Project,
Expand Down

0 comments on commit fd5b374

Please sign in to comment.