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

Honor publishNotReadyAddresses flag for non headless services #3216

Closed
gk-fschubert opened this issue Nov 15, 2024 · 6 comments · Fixed by #3219
Closed

Honor publishNotReadyAddresses flag for non headless services #3216

gk-fschubert opened this issue Nov 15, 2024 · 6 comments · Fixed by #3219
Assignees
Labels
bug Something isn't working

Comments

@gk-fschubert
Copy link

What happened:
normal services which have the flag "publishNotReadyAddresses: true" defined does not get reflected on the exported services.

What you expected to happen:
The settings defined for a service which I want to export should get reflected on exported service.

It seems to be that this has been done for headless services: #2646
But not for non-headless services. Or a least the configuration item is missing in the exported service.

How to reproduce it (as minimally and precisely as possible):

  1. Deployment of nginx with a readiness probe which never get's true
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: nginx
  name: nginx-deployment
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
        - image: nginx:1.14.2
          imagePullPolicy: IfNotPresent
          name: nginx
          ports:
            - containerPort: 80
              protocol: TCP
          readinessProbe:
            exec:
              command:
                - /bin/bash
                - -ec
                - asdkjfhasdfkj
  1. Service with publishNotReadyAddresses=true
apiVersion: v1
kind: Service
metadata:
  name: nginx
  namespace: default
spec:
  publishNotReadyAddresses: true
  selector:
    app: nginx
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
  1. export the service with subclt
subctl  export service nginx -n default  

Result:
Exported service does not get the flag publishNotReadyAddresses: true

Environment:
subctl version: v0.18.0

@gk-fschubert gk-fschubert added the bug Something isn't working label Nov 15, 2024
@tpantelis
Copy link
Contributor

This flag only applies to non headless services

Exported service does not get the flag publishNotReadyAddresses: true

What behavior are you expecting wrt exported service?

@gk-fschubert
Copy link
Author

This flag only applies to non headless services

It should apply for both or do I miss something?

Exported service does not get the flag publishNotReadyAddresses: true

What behavior are you expecting wrt exported service?

The exported service need the same flag as the service which submariner should export in order to have a consistent behaviour.

@tpantelis
Copy link
Contributor

tpantelis commented Nov 15, 2024

This flag only applies to non headless services

It should apply for both or do I miss something?

Actually I meant to say it "only applies to headless services"

Per the definition of the publishNotReadyAddresses flag in the K8s docs:

The primary use case for setting this field is for a StatefulSet's Headless Service to propagate SRV DNS records for its Pods for the purpose of peer discovery.

So for headless services, we have a use case for this flag and we implemented it.

For ClusterIP (ie non-headless) services we don't publish the local pod endpoint IPs to other clusters in the EndpointSlices - we only publish the service's cluster IP along with the ready state determined from the readiness of the underlying pod endpoints. So we are already technically publishing not-ready-addresses for ClusterIP services even though the semantics of the publishNotReadyAddresses flag doesn't really apply.

Exported service does not get the flag publishNotReadyAddresses: true

What behavior are you expecting wrt exported service?

The exported service need the same flag as the service which submariner should export in order to have a consistent behaviour.

I'm not following here. The publishNotReadyAddresses flag is on the Service resource. We don't actually export a Service resource instance - we export a ServiceImport along with EndpointSlices. So, for ClusterIP services, where are you expecting the flag to be propagated and what behavior are you expecting? Or, to rephrase, what behavior is missing or what problem did you observe that led you to report this issue?

@gk-fschubert
Copy link
Author

I'm not following here. The publishNotReadyAddresses flag is on the Service resource. We don't actually export a Service resource instance - we export a ServiceImport along with EndpointSlices. So, for ClusterIP services, where are you expecting the flag to be propagated and what behavior are you expecting?

Ok then may I don't know the exact component which is causing issues here.
Yes technically the IP address is published before the pod is ready. But the service will not be able to forward traffic if there is no ready pod in it.

What I mean is:
When I create a clusterIP service with "publishNotReadyAddresses: true" and then export that with subctl a new service get's created.
That new service e.g. "submariner-lpq6zr4tl4o5qvrv2t7o3l3gawkagast" does not have the value "publishNotReadyAddresses" at all and thus is not forwarding traffic to a non-ready pod.

Or, to rephrase, what behavior is missing or what problem did you observe that led you to report this issue?

I want to run a Cassandra database across multiple k8s clusters and because they have overlapping CIDR networks, Globalnet is used.
Each Cassandra rack (only one server per rack) get's a service which will exported over submariner which they then use as broadcast address.
And each rack have to be reachable before the pod is ready.

@tpantelis
Copy link
Contributor

That new service e.g. "submariner-lpq6zr4tl4o5qvrv2t7o3l3gawkagast" does not have the value "publishNotReadyAddresses" at all and thus is not forwarding traffic to a non-ready pod.

Ok - that's an internal local service created by Globalnet, I believe to handle ingress traffic for the global IP and route to the exported service's pods @aswinsuryan. It's not actually exported to other clusters - I was confused by the terminology. We can certainly propagate the publishNotReadyAddresses flag from the exported service here. Have/can you verify that setting this flag on the internal service addresses the problem you're seeing?

@gk-fschubert
Copy link
Author

gk-fschubert commented Nov 15, 2024

I was confused by the terminology

Sorry!

Have/can you verify that setting this flag on the internal service addresses the problem you're seeing?

Yes. But it get's automatically reverted

@tpantelis tpantelis self-assigned this Nov 15, 2024
@tpantelis tpantelis moved this to Todo in Submariner 0.20 Nov 15, 2024
tpantelis added a commit to tpantelis/submariner that referenced this issue Nov 18, 2024
Fixes submariner-io#3216

Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
tpantelis added a commit to tpantelis/submariner that referenced this issue Nov 18, 2024
Fixes submariner-io#3216

Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
@github-project-automation github-project-automation bot moved this from In Review to Done in Submariner 0.20 Nov 18, 2024
tpantelis added a commit to tpantelis/submariner that referenced this issue Nov 18, 2024
Fixes submariner-io#3216

Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
tpantelis added a commit to tpantelis/submariner that referenced this issue Nov 18, 2024
Fixes submariner-io#3216

Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
tpantelis added a commit that referenced this issue Nov 19, 2024
Fixes #3216

Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
tpantelis added a commit that referenced this issue Nov 19, 2024
Fixes #3216

Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants