Skip to content

[BUG][Opensearch] masterService default breaks fullnameOverride #725

@berimbolo13

Description

@berimbolo13

Describe the bug

When using fullnameOverride, service names and discovery still use the default masterService value instead of respecting fullnameOverride.

The masterService template correctly handles fullnameOverride:

{{- define "opensearch.masterService" -}}
{{- if empty .Values.masterService -}}
{{- if empty .Values.fullnameOverride -}}
{{- if empty .Values.nameOverride -}}
{{ .Values.clusterName }}-master
{{- else -}}
{{ .Values.nameOverride }}-master
{{- end -}}
{{- else -}}
{{ .Values.fullnameOverride }}
{{- end -}}
{{- else -}}
{{ .Values.masterService }}
{{- end -}}
{{- end -}}

However, values.yaml defaults masterService to a non-empty value:

masterService: "opensearch-cluster-master"

Since it's not empty, the if empty .Values.masterService condition is always false and the fullnameOverride logic is never reached.

To Reproduce

helm template opensearch opensearch/opensearch --set fullnameOverride=opensearch | grep -E "kind: Service" -A3 | grep "name:"

Output:

  name: opensearch-cluster-master
  name: opensearch-cluster-master-headless

The fullnameOverride=opensearch is ignored.

Expected behaviour

Services should be named opensearch and opensearch-headless.

Proposed fix

Change the default masterService in values.yaml from "opensearch-cluster-master" to "", allowing the template to derive it from fullnameOverride when set.

Chart Name

opensearch (version 3.4.0)

Additional context

Related to #92 and PR #185, which fixed the template logic but didn't address the default value.


I'm happy to submit a PR with the fix if this approach is acceptable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions