Provide way to name port when using 'oc expose' so get service/protocol DNS SRV entries. #18822
Labels
kind/feature
Categorizes issue or PR as related to a new feature.
lifecycle/frozen
Indicates that an issue or PR should not be auto-closed due to staleness.
lifecycle/stale
Denotes an issue or PR has remained open with no activity and has become stale.
priority/P2
sig/networking
It is not possible using
oc expose dc
to create a headless service definition which correctly sets up DNS SRV entries of the form:This is because you can't name the port definition created from the command line and a sensible default is not added when creating a headless service.
Version
Steps To Reproduce
Run:
There is no
spec.ports.name
field and so the required DNS SRV entries are not created. If you add aname
field with valuemyservice
, then you can lookup:It is important that the full version is added because some services rely on being able to extract the port number from the SRV entry. Without the name for the port, the SRV entry created and which can be queried using
blog-django-py-metrics
has port set to 0. There is no protocol specific entry.There are probably two alternatives to having an option to provide a name.
The first is do like
oc expose
when not setting--cluster-ip
toNone
.In that case it generates:
So gives it a generated name.
This would result in DNS SRV entries, but the name you need to use is clumsy. That is, have to use:
Works but duplicates protocol name.
The
-tcp
suffix was probably added to avoid error:when try to set it to just
8081
for name. IOW, will not accept just an integer.The second alternative is that even if the port isn't named, create a DNS SRV entry anyway, where the service name is set to the port number. This means you could query on:
BTW, you can't even create a definition using
oc create service clusterip
, as it will fail when you supply--port
option at same time as--clusterip=None
.All up, support in this area for setting up headless service entries where want DNS SRV entries of form
_service._proto.name
from the command line could be better. Have no choice but to resort to using raw resource definitions andoc create -f
.The text was updated successfully, but these errors were encountered: