Skip to content

Commit

Permalink
chore(bors): merge pull request #419
Browse files Browse the repository at this point in the history
419: feat(json_fmt): helm changes to enable json support r=abhilashshetty04 a=abhilashshetty04

base.loging.format= json|pretty|compact . 

ansi colour can be disabled also. Its enabled by default.

Co-authored-by: Abhilash Shetty <[email protected]>
  • Loading branch information
mayastor-bors and abhilashshetty04 committed Mar 19, 2024
2 parents c63fe2c + c995699 commit 3770e19
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 17 deletions.
4 changes: 3 additions & 1 deletion chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ This removes all the Kubernetes components associated with the chart and deletes
| base.&ZeroWidthSpace;default_req_timeout | Request timeout for rest & core agents | `"5s"` |
| base.&ZeroWidthSpace;imagePullSecrets.&ZeroWidthSpace;enabled | Enable imagePullSecrets for pulling our container images | `false` |
| base.&ZeroWidthSpace;jaeger.&ZeroWidthSpace;enabled | Enable jaeger tracing | `false` |
| base.&ZeroWidthSpace;logSilenceLevel | Silence specific module components | `nil` |
| base.&ZeroWidthSpace;logging.&ZeroWidthSpace;color | Enable ansi color code for Pod StdOut/StdErr | `true` |
| base.&ZeroWidthSpace;logging.&ZeroWidthSpace;format | Valid values for format are pretty, json and compact | `"pretty"` |
| base.&ZeroWidthSpace;logging.&ZeroWidthSpace;silenceLevel | Silence specific module components | `nil` |
| base.&ZeroWidthSpace;metrics.&ZeroWidthSpace;enabled | Enable the metrics exporter | `true` |
| crds.&ZeroWidthSpace;enabled | Install CRDs | `true` |
| crds.&ZeroWidthSpace;jaeger.&ZeroWidthSpace;enabled | Install Jaeger CRDs | `false` |
Expand Down
8 changes: 8 additions & 0 deletions chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ Usage:
{{- include "coreListUniq" . | split "," | len -}}
{{- end -}}

{{- define "logFormat" -}}
{{- if (regexMatch "^((json|pretty|compact))$" .Values.base.logging.format) -}}
{{- print .Values.base.logging.format -}}
{{- else -}}
{{- fail "invalid logging format. valid values are json, pretty, compact" -}}
{{- end -}}
{{- end -}}

{{/* Get a list of cores as a comma-separated list */}}
{{- define "coreListUniq" -}}
{{- if .Values.io_engine.coreList -}}
Expand Down
12 changes: 8 additions & 4 deletions chart/templates/mayastor/agents/core/agent-core-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,16 @@ spec:
- "--events-url=nats://{{ .Release.Name }}-nats:4222"{{ end }}
{{- if not .Values.agents.ha.enabled }}
- "--disable-ha"{{ end }}
- "--fmt-style={{ include "logFormat" . }}"
- "--ansi-colors={{ .Values.base.logging.color }}"
ports:
- containerPort: 50051
env:
- name: RUST_LOG
value: {{ .Values.agents.core.logLevel }}
{{- if default .Values.base.logSilenceLevel .Values.agents.core.logSilenceLevel }}
{{- if default .Values.base.logging.silenceLevel .Values.agents.core.logSilenceLevel }}
- name: RUST_LOG_SILENCE
value: {{ default .Values.base.logSilenceLevel .Values.agents.core.logSilenceLevel }}
value: {{ default .Values.base.logging.silenceLevel .Values.agents.core.logSilenceLevel }}
{{- end }}
- name: MY_POD_NAME
valueFrom:
Expand All @@ -92,14 +94,16 @@ spec:
- "--core-grpc=https://{{ .Release.Name }}-agent-core:50051"{{ if .Values.base.jaeger.enabled }}
- "--jaeger={{ .Values.base.jaeger.agent.name }}:{{ .Values.base.jaeger.agent.port }}"{{ end }}{{ if .Values.eventing.enabled }}
- "--events-url=nats://{{ .Release.Name }}-nats:4222"{{ end }}
- "--ansi-colors={{ .Values.base.logging.color }}"
- "--fmt-style={{ include "logFormat" . }}"
ports:
- containerPort: 50052
env:
- name: RUST_LOG
value: {{ .Values.agents.core.logLevel }}
{{- if default .Values.base.logSilenceLevel .Values.agents.core.logSilenceLevel }}
{{- if default .Values.base.logging.silenceLevel .Values.agents.core.logSilenceLevel }}
- name: RUST_LOG_SILENCE
value: {{ default .Values.base.logSilenceLevel .Values.agents.core.logSilenceLevel }}
value: {{ default .Values.logging.silenceLevel .Values.agents.core.logSilenceLevel }}
{{- end }}
- name: MY_POD_NAME
valueFrom:
Expand Down
6 changes: 4 additions & 2 deletions chart/templates/mayastor/agents/ha/ha-node-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ spec:
env:
- name: RUST_LOG
value: {{ .Values.agents.ha.node.logLevel }}
{{- if default .Values.base.logSilenceLevel .Values.agents.ha.node.logSilenceLevel }}
{{- if default .Values.base.logging.silenceLevel .Values.agents.ha.node.logSilenceLevel }}
- name: RUST_LOG_SILENCE
value: {{ default .Values.base.logSilenceLevel .Values.agents.ha.node.logSilenceLevel }}
value: {{ default .Values.base.logging.silenceLevel .Values.agents.ha.node.logSilenceLevel }}
{{- end }}
- name: MY_NODE_NAME
valueFrom:
Expand All @@ -76,6 +76,8 @@ spec:
- "--cluster-agent=https://{{ .Release.Name }}-agent-core:50052"{{ if .Values.base.jaeger.enabled }}
- "--jaeger={{ .Values.base.jaeger.agent.name }}:{{ .Values.base.jaeger.agent.port }}"{{ end }}{{ if .Values.eventing.enabled }}
- "--events-url=nats://{{ .Release.Name }}-nats:4222"{{ end }}
- "--ansi-colors={{ .Values.base.logging.color }}"
- "--fmt-style={{ include "logFormat" . }}"
volumeMounts:
- name: device
mountPath: /dev
Expand Down
6 changes: 4 additions & 2 deletions chart/templates/mayastor/apis/api-rest-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ spec:
- "--request-timeout={{ .Values.base.default_req_timeout }}"{{ if .Values.base.jaeger.enabled }}
- "--jaeger={{ .Values.base.jaeger.agent.name }}:{{ .Values.base.jaeger.agent.port }}"{{ end }}
- "--core-grpc=https://{{ .Release.Name }}-agent-core:50051"
- "--ansi-colors={{ .Values.base.logging.color }}"
- "--fmt-style={{ include "logFormat" . }}"
ports:
- containerPort: 8080
- containerPort: 8081
env:
- name: RUST_LOG
value: {{ .Values.apis.rest.logLevel }}
{{- if default .Values.base.logSilenceLevel .Values.apis.rest.logSilenceLevel }}
{{- if default .Values.base.logging.silenceLevel .Values.apis.rest.logSilenceLevel }}
- name: RUST_LOG_SILENCE
value: {{ default .Values.base.logSilenceLevel .Values.apis.rest.logSilenceLevel }}
value: {{ default .Values.base.logging.silenceLevel .Values.apis.rest.logSilenceLevel }}
{{- end }}
6 changes: 4 additions & 2 deletions chart/templates/mayastor/csi/csi-controller-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,14 @@ spec:
{{- range $key, $val := .Values.csi.node.topology.segments }}
- "--node-selector={{ $key }}={{ $val }}"
{{- end }}
- "--ansi-colors={{ .Values.base.logging.color }}"
- "--fmt-style={{ include "logFormat" . }}"
env:
- name: RUST_LOG
value: {{ .Values.csi.controller.logLevel }}
{{- if default .Values.base.logSilenceLevel .Values.csi.controller.logSilenceLevel }}
{{- if default .Values.base.logging.silenceLevel .Values.csi.controller.logSilenceLevel }}
- name: RUST_LOG_SILENCE
value: {{ default .Values.base.logSilenceLevel .Values.csi.controller.logSilenceLevel }}
value: {{ default .Values.base.logging.silenceLevel .Values.csi.controller.logSilenceLevel }}
{{- end }}
volumeMounts:
- name: socket-dir
Expand Down
6 changes: 4 additions & 2 deletions chart/templates/mayastor/csi/csi-node-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ spec:
env:
- name: RUST_LOG
value: {{ .Values.csi.node.logLevel }}
{{- if default .Values.base.logSilenceLevel .Values.csi.node.logSilenceLevel }}
{{- if default .Values.base.logging.silenceLevel .Values.csi.node.logSilenceLevel }}
- name: RUST_LOG_SILENCE
value: {{ default .Values.base.logSilenceLevel .Values.csi.node.logSilenceLevel }}
value: {{ default .Values.base.logging.silenceLevel .Values.csi.node.logSilenceLevel }}
{{- end }}
- name: MY_NODE_NAME
valueFrom:
Expand Down Expand Up @@ -93,6 +93,8 @@ spec:
{{- range $key, $val := .Values.csi.node.topology.segments }}
- "--node-selector={{ $key }}={{ $val }}"
{{- end }}
- "--fmt-style={{ include "logFormat" . }}"
- "--ansi-colors={{ .Values.base.logging.color }}"
command:
- csi-node
volumeMounts:
Expand Down
3 changes: 3 additions & 0 deletions chart/templates/mayastor/io/io-engine-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ spec:
- containerPort: 9502
protocol: TCP
name: metrics
args:
- "--fmt-style={{ include "logFormat" . }}"
- "--ansi-colors={{ .Values.base.logging.color }}"
{{- end }}
- name: io-engine
image: "{{ .Values.image.registry }}/{{ .Values.image.repo }}/{{ .Chart.Name }}-io-engine:{{ default .Values.image.tag .Values.image.repoTags.dataPlane }}"
Expand Down
2 changes: 2 additions & 0 deletions chart/templates/mayastor/obs/obs-callhome-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ spec:
- "--namespace={{ .Release.Namespace }}"
- "--release-name={{ .Release.Name }}"
- "--mbus-url=nats://{{ .Release.Name }}-nats:4222"
- "--ansi-colors={{ .Values.base.logging.color }}"
- "--fmt-style={{ include "logFormat" . }}"
ports:
- containerPort: 9090
protocol: TCP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ spec:
- "--request-timeout={{ .Values.base.default_req_timeout }}"
- "--interval={{ .Values.base.cache_poll_period }}"{{ if .Values.base.jaeger.enabled }}
- "--jaeger={{ .Values.base.jaeger.agent.name }}:{{ .Values.base.jaeger.agent.port }}"{{ end }}
- "--ansi-colors={{ .Values.base.logging.color }}"
- "--fmt-style={{ include "logFormat" . }}"
env:
- name: RUST_LOG
value: {{ .Values.operators.pool.logLevel }}
{{- if default .Values.base.logSilenceLevel .Values.operators.pool.logSilenceLevel }}
{{- if default .Values.base.logging.silenceLevel .Values.operators.pool.logSilenceLevel }}
- name: RUST_LOG_SILENCE
value: {{ default .Values.base.logSilenceLevel .Values.operators.pool.logSilenceLevel }}
value: {{ default .Values.base.logging.silenceLevel .Values.operators.pool.logSilenceLevel }}
{{- end }}
- name: MY_POD_NAME
valueFrom:
Expand Down
9 changes: 7 additions & 2 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,13 @@ base:
default_req_timeout: 5s
# -- Cache timeout for core agent & diskpool deployment
cache_poll_period: 30s
# -- Silence specific module components
logSilenceLevel:
logging:
# -- Valid values for format are pretty, json and compact
format: pretty
# -- Enable ansi color code for Pod StdOut/StdErr
color: true
# -- Silence specific module components
silenceLevel:
initContainers:
enabled: true
containers:
Expand Down

0 comments on commit 3770e19

Please sign in to comment.