Skip to content
This repository was archived by the owner on Sep 1, 2026. It is now read-only.
This repository was archived by the owner on Sep 1, 2026. It is now read-only.

Handle multiple services gracefully #236

Open

Description

@SatyaKuppam

We currently need multiple services for the router, one ClusterIP service for the ingress, and one headless service for DNS based service discovery. Although the CRD accepts multiple services, we encountered the following problems:

  1. if there is no ObjectMeta.name specified then we default to nodeSpecUniqueStr. This means even if we have multiple services specified we only create one service with nodeSpecUniqueStr.
  2. To get around the problem in (1), we tried creating each service with its own unique name. This fails because getServiceName expects a template and not the actual service names.

Example Error from Sprintf:
DEBUG events Error creating object [druid-staging-aep-druid-router%!(EXTRA string=druid-staging-aep-druid-router)] in namespace [*v1.Service:druid-clusters] due to [Service "druid-staging-aep-druid-router%!(EXTRA string=druid-staging-aep-druid-router)" is invalid: [metadata.name: Invalid value: "druid-staging-aep-druid-router%!(EXTRA string=druid-staging-aep-druid-router)": must be no more than 63 characters, metadata.name: Invalid value: "druid-staging-aep-druid-router%!(EXTRA string=druid-staging-aep-druid-router)": a DNS-1035 label must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character (e.g. 'my-name', or 'abc-123', regex used for validation is '[a-z]([-a-z0-9]*[a-z0-9])?')]] {"type": "Warning", "object": {"kind":"Druid","namespace":"druid-clusters","name":"staging-aep-druid","uid":"2ea6e0e2-bbc0-413c-9a0f-db77e04bd372","apiVersion":"druid.apache.org/v1alpha1","resourceVersion":"7937315961"}, "reason": "DruidOperatorCreateFail"}

Ideal behaviour in my opinion is:

  1. if no ObjectMeta.name is not specified, then the operator should create unique names for the services, maybe start with serviceName of the statefulset and for each subsequent service do serviceName + <ordinal>
  2. If the ObjectMeta.name is specified then we should check for uniqueness and create the services with the names specified

Ref:

  1. getServiceName

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions