diff --git a/chart/README.md b/chart/README.md index 9b4bcbc88..a08ab8a63 100644 --- a/chart/README.md +++ b/chart/README.md @@ -215,6 +215,7 @@ This removes all the Kubernetes components associated with the chart and deletes | io_engine.​target.​nvmf.​ptpl | Reservations Persist Through Power Loss State | `true` | | io_engine.​target.​nvmf.​rdma | Enable RDMA Capability of Mayastor nvmf target to take RDMA connections if the cluster nodes have RDMA device(s) configured from RNIC. |
{
"enabled":false
}
| | io_engine.​tolerations | Set tolerations, overrides global | `[]` | +| ipFamily | IP family for services and bind addresses. Valid values: "ipv4", "ipv6", "both" (default). | `"both"` | | localpv-provisioner.​enabled | Enables the openebs dynamic-localpv-provisioner. If disabled, modify etcd and loki storage class accordingly. | `true` | | localpv-provisioner.​hostpathClass.​enabled | Enable default hostpath localpv StorageClass. | `false` | | localpv-provisioner.​localpv.​priorityClassName | Set the PriorityClass for the LocalPV Hostpath provisioner Deployment. | `"{{ .Release.Name }}-cluster-critical"` | diff --git a/chart/templates/_helpers.tpl b/chart/templates/_helpers.tpl index 502015ce9..76803fb59 100644 --- a/chart/templates/_helpers.tpl +++ b/chart/templates/_helpers.tpl @@ -400,3 +400,38 @@ Usage: {{- end -}} {{- end -}} {{- end }} + +{{/* +Generates ipFamilyPolicy and ipFamilies for Service specs based on the global ipFamily setting. +Valid values: "ipv4", "ipv6", "both" +*/}} +{{- define "service_ip_family" -}} +{{- if eq .Values.ipFamily "ipv4" }} +ipFamilyPolicy: SingleStack +ipFamilies: + - IPv4 +{{- else if eq .Values.ipFamily "ipv6" }} +ipFamilyPolicy: SingleStack +ipFamilies: + - IPv6 +{{- else if eq .Values.ipFamily "both" }} +ipFamilyPolicy: PreferDualStack +ipFamilies: + - IPv4 + - IPv6 +{{- else }} +{{- fail (printf "invalid ipFamily value %q -- valid values: ipv4, ipv6, both" .Values.ipFamily) -}} +{{- end -}} +{{- end -}} + +{{/* +Returns the bind address based on ipFamily, formatted for use in a "host:port" string. +ipv4 → "0.0.0.0", ipv6 or both → "[::]" (brackets per RFC 3986, required by parsers like Rust's SocketAddr). +*/}} +{{- define "bind_address" -}} +{{- if eq .Values.ipFamily "ipv4" -}} +0.0.0.0 +{{- else -}} +[::] +{{- end -}} +{{- end -}} diff --git a/chart/templates/mayastor/agents/core/agent-core-deployment.yaml b/chart/templates/mayastor/agents/core/agent-core-deployment.yaml index 0f06aa1f1..bb14ecb50 100644 --- a/chart/templates/mayastor/agents/core/agent-core-deployment.yaml +++ b/chart/templates/mayastor/agents/core/agent-core-deployment.yaml @@ -53,7 +53,7 @@ spec: {{- end }} - "--cache-period={{ .Values.base.cache_poll_period }}"{{ if .Values.base.jaeger.enabled }} - "--jaeger={{ include "jaeger_url" . }}"{{ end }} - - "--grpc-server-addr=[::]:50051" + - "--grpc-server-addr={{ include "bind_address" . }}:50051" - "--pool-commitment={{ .Values.agents.core.capacity.thin.poolCommitment }}" - "--snapshot-commitment={{ .Values.agents.core.capacity.thin.snapshotCommitment }}" - "--volume-commitment-initial={{ .Values.agents.core.capacity.thin.volumeCommitmentInitial }}" @@ -107,7 +107,7 @@ spec: image: "{{ .Values.image.registry }}/{{ .Values.image.repo }}/{{ include "image_prefix" . }}-agent-ha-cluster:{{ default .Values.image.tag .Values.image.repoTags.controlPlane }}" imagePullPolicy: {{ .Values.image.pullPolicy }} args: - - "-g=[::]:50052" + - "-g={{ include "bind_address" . }}:50052" - "--store=http://{{ include "etcdUrl" . }}" - "--core-grpc=https://{{ .Release.Name }}-agent-core:50051"{{ if .Values.base.jaeger.enabled }} - "--jaeger={{ include "jaeger_url" . }}"{{ end }}{{ if .Values.eventing.enabled }} diff --git a/chart/templates/mayastor/agents/core/agent-core-service.yaml b/chart/templates/mayastor/agents/core/agent-core-service.yaml index 52b39a445..ccafc4a48 100644 --- a/chart/templates/mayastor/agents/core/agent-core-service.yaml +++ b/chart/templates/mayastor/agents/core/agent-core-service.yaml @@ -7,6 +7,7 @@ metadata: {{ include "label_prefix" . }}/release: {{ .Release.Name }} {{ include "label_prefix" . }}/version: {{ .Chart.Version }} spec: + {{- include "service_ip_family" . | nindent 2 }} selector: app: agent-core {{ include "label_prefix" . }}/release: {{ .Release.Name }} diff --git a/chart/templates/mayastor/apis/api-rest-deployment.yaml b/chart/templates/mayastor/apis/api-rest-deployment.yaml index 715d686cb..6b15b035e 100644 --- a/chart/templates/mayastor/apis/api-rest-deployment.yaml +++ b/chart/templates/mayastor/apis/api-rest-deployment.yaml @@ -47,7 +47,8 @@ spec: args: - "--dummy-certificates" - "--no-auth" - - "--http=[::]:8081" + - "--https={{ include "bind_address" . }}:8080" + - "--http={{ include "bind_address" . }}:8081" - "--request-timeout={{ .Values.base.default_req_timeout }}"{{ if .Values.base.jaeger.enabled }} - "--jaeger={{ include "jaeger_url" . }}"{{ end }} - "--core-grpc=https://{{ .Release.Name }}-agent-core:50051" diff --git a/chart/templates/mayastor/apis/api-rest-service.yaml b/chart/templates/mayastor/apis/api-rest-service.yaml index 37671f005..fbfe2f47f 100644 --- a/chart/templates/mayastor/apis/api-rest-service.yaml +++ b/chart/templates/mayastor/apis/api-rest-service.yaml @@ -7,6 +7,7 @@ metadata: {{ include "label_prefix" . }}/release: {{ .Release.Name }} {{ include "label_prefix" . }}/version: {{ .Chart.Version }} spec: + {{- include "service_ip_family" . | nindent 2 }} type: {{ .Values.apis.rest.service.type }} selector: app: api-rest diff --git a/chart/templates/mayastor/io/io-engine-daemonset.yaml b/chart/templates/mayastor/io/io-engine-daemonset.yaml index 2e848ebf0..a9d71ac18 100644 --- a/chart/templates/mayastor/io/io-engine-daemonset.yaml +++ b/chart/templates/mayastor/io/io-engine-daemonset.yaml @@ -159,7 +159,7 @@ spec: protocol: TCP name: metrics args: - - "--metrics-endpoint=[::]:{{ default 9502 .Values.base.metrics.port }}" + - "--metrics-endpoint={{ include "bind_address" . }}:{{ default 9502 .Values.base.metrics.port }}" - "--grpc-port={{ default 10124 .Values.io_engine.port }}" - "--fmt-style={{ include "logFormat" . }}" - "--ansi-colors={{ .Values.base.logging.color }}" diff --git a/chart/templates/mayastor/metrics/metrics-exporter-io-engine-service.yaml b/chart/templates/mayastor/metrics/metrics-exporter-io-engine-service.yaml index 286a7089c..92d9c82af 100644 --- a/chart/templates/mayastor/metrics/metrics-exporter-io-engine-service.yaml +++ b/chart/templates/mayastor/metrics/metrics-exporter-io-engine-service.yaml @@ -8,6 +8,7 @@ metadata: {{ include "label_prefix" . }}/release: {{ .Release.Name }} {{ include "label_prefix" . }}/version: {{ .Chart.Version }} spec: + {{- include "service_ip_family" . | nindent 2 }} ports: - name: metrics port: 9502 diff --git a/chart/templates/mayastor/obs/stats-service.yaml b/chart/templates/mayastor/obs/stats-service.yaml index 8a85a1ec0..147cf79ed 100644 --- a/chart/templates/mayastor/obs/stats-service.yaml +++ b/chart/templates/mayastor/obs/stats-service.yaml @@ -8,6 +8,7 @@ metadata: {{ include "label_prefix" . }}/release: {{ .Release.Name }} {{ include "label_prefix" . }}/version: {{ .Chart.Version }} spec: + {{- include "service_ip_family" . | nindent 2 }} ports: - port: 9090 name: https diff --git a/chart/values.yaml b/chart/values.yaml index 943c0b691..bc370b6b9 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -55,6 +55,8 @@ earlyEvictionTolerations: # If any component has tolerations set, then it would override this value. # For external components like etcd, jaeger and loki, tolerations can only be set at component level. tolerations: [ ] +# -- IP family for services and bind addresses. Valid values: "ipv4", "ipv6", "both" (default). +ipFamily: "both" base: # -- Request timeout for rest & core agents default_req_timeout: 5s