Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to change the service name for the Listener Service #1078

Open
hardillb opened this issue Oct 18, 2024 · 9 comments
Open

Unable to change the service name for the Listener Service #1078

hardillb opened this issue Oct 18, 2024 · 9 comments
Labels
help wanted Extra attention is needed #triage/stale

Comments

@hardillb
Copy link

Describe the bug

Setting metadata.name in the listenersServiceTemplate doesn't change the service name

  listenersServiceTemplate:
    metadata:
      name: mqtt-service
    spec:
      type: LoadBalancer

To Reproduce
Steps to reproduce the behavior:

  • Install the operator
  • create a new broker with name entry in metadata section of listenersServiceTemplate

Expected behavior
The ability to rename the listeners service

Anything else we need to know?:

Environment details::

  • Kubernetes version: 1.24
  • Cloud-provider/provisioner: microK8s
  • emqx-operator version: 2.2.24
  • Install method: helm
@hardillb hardillb added the bug Something isn't working label Oct 18, 2024
@Rory-Z
Copy link
Member

Rory-Z commented Oct 21, 2024

Hi @hardillb EMQX operator did this on purpose, like the .spec.template.metadata in deployment.

@Rory-Z Rory-Z added help wanted Extra attention is needed and removed bug Something isn't working labels Oct 21, 2024
@hardillb
Copy link
Author

If there are metadata fields that can not be set/overridden then they should be documented. At the moment the docs imply that any metadatacan be set.

Is there a way to get a different service name? This makes it very hard to use emqx as a drop in replacement for an existing broker.

@hardillb
Copy link
Author

OK, so I've worked out that the services are all prefixed with the metadata.name from the emqx object which sort of makes sense, but it would be nice to also have custom names.

Also it would be nice to be able to mark some listeners as not exported to the LoadBalancer, but still available internally (but this is a separate feature request).

@Rory-Z
Copy link
Member

Rory-Z commented Oct 22, 2024

OK, so I've worked out that the services are all prefixed with the metadata.name from the emqx object which sort of makes sense, but it would be nice to also have custom names.

Yes, and also you can set custom labels for different service, is it make sense for you ?

@Rory-Z
Copy link
Member

Rory-Z commented Oct 22, 2024

Also it would be nice to be able to mark some listeners as not exported to the LoadBalancer, but still available internally (but this is a separate feature request).

Could you please talk this feature request ? Is it means you want to set some EMQX's listener, but you don't want to export it to K8s service ? I have some confuse, because in K8s, the best way to access pod's port is by service, because pod is not a stateful object, it will be re-scheduling in anytime.

@hardillb
Copy link
Author

Yes, and also you can set custom labels for different service, is it make sense for you ?

Can you point to the documentation for that please.

Could you please talk this feature request ? Is it means you want to set some EMQX's listener, but you don't want to export it to K8s service ?

I mean that I want to expose some listeners outside of k8s via a LoadBalancer service and. Some just internally say via a ClusterIP service.

E.g. I want to make just a TLS listener available to external clients, but provide a none TLS listener to clients inside the cluster

@Rory-Z
Copy link
Member

Rory-Z commented Oct 24, 2024

Yes, and also you can set custom labels for different service, is it make sense for you ?

Can you point to the documentation for that please.

Like this:

apiVersion: apps.emqx.io/v2beta1
kind: EMQX
metadata:
  name: emqx
spec:
  image: emqx:5
  listenersServiceTemplate:
    metadata:
      labels:
        my-service: "my-listeners-service"
  dashboardServiceTemplate:
    metadata:
      labels:
        my-service: "my-dashboard-service"

And then, you can get service by kubectl

$ kubectl get svc -l 'my-service=my-listeners-service'
NAME             TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                               AGE
emqx-listeners   ClusterIP   10.101.163.27   <none>        8883/TCP,1883/TCP,8083/TCP,8084/TCP   35s
$ kubectl get svc -l 'my-service=my-dashboard-service'
NAME             TYPE        CLUSTER-IP    EXTERNAL-IP   PORT(S)     AGE
emqx-dashboard   ClusterIP   10.98.60.14   <none>        18083/TCP   40s

@Rory-Z
Copy link
Member

Rory-Z commented Oct 24, 2024

E.g. I want to make just a TLS listener available to external clients, but provide a none TLS listener to clients inside the cluster

I'm sorry EMQX operator can not do this now, but maybe you can use emqx-listeners service for clients that inside the cluster, and create new service by yourself for clients that outside the cluster, I think it will be work.

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed #triage/stale
Projects
None yet
Development

No branches or pull requests

2 participants