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:
- 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.
- 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:
- 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>
- If the
ObjectMeta.name is specified then we should check for uniqueness and create the services with the names specified
Ref:
getServiceName
We currently need multiple services for the
router, oneClusterIPservice for the ingress, and oneheadlessservice for DNS based service discovery. Although the CRD accepts multiple services, we encountered the following problems:ObjectMeta.namespecified then we default tonodeSpecUniqueStr. This means even if we have multiple services specified we only create one service withnodeSpecUniqueStr.getServiceNameexpects 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:
ObjectMeta.nameis not specified, then the operator should create unique names for the services, maybe start withserviceNameof the statefulset and for each subsequent service doserviceName + <ordinal>ObjectMeta.nameis specified then we should check for uniqueness and create the services with the names specifiedRef:
getServiceName