Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ metadata:
name: monitoring-pmm3
spec:
ports:
- name: mongodb
- appProtocol: mongo
name: mongodb
port: 27019
protocol: TCP
targetPort: 27019
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ metadata:
name: some-name
spec:
ports:
- name: mongodb
- appProtocol: mongo
name: mongodb
port: 27017
protocol: TCP
targetPort: 27017
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ metadata:
name: some-name
spec:
ports:
- name: mongodb
- appProtocol: mongo
name: mongodb
port: 27017
protocol: TCP
targetPort: 27017
Expand Down
14 changes: 12 additions & 2 deletions pkg/psmdb/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ func Service(cr *api.PerconaServerMongoDB, replset *api.ReplsetSpec) *corev1.Ser
svc.Labels[k] = v
}
}

if cr.CompareVersion("1.22.0") >= 0 {
appProtocol := "mongo"
for _, v := range svc.Spec.Ports {
v.AppProtocol = &appProtocol
}
}
return svc
}

Expand Down Expand Up @@ -127,7 +132,12 @@ func ExternalService(cr *api.PerconaServerMongoDB, replset *api.ReplsetSpec, pod
default:
svc.Spec.Type = corev1.ServiceTypeClusterIP
}

if cr.CompareVersion("1.22.0") >= 0 {
appProtocol := "mongo"
for _, v := range svc.Spec.Ports {
v.AppProtocol = &appProtocol
}
}
return svc
}

Expand Down