Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[K8S][HELM] Align Helm templates with formatting approach #6492

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dnskr
Copy link
Contributor

@dnskr dnskr commented Jun 20, 2024

🔍 Description

Issue References 🔗

There are few formatting misalignments in the Helm chart.

Describe Your Solution 🔧

The PR aligns the chart templates formatting without any functional changes.

Types of changes 🔖

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Test Plan 🧪

Test 1

All templates (and rendered labels) are correct with default chart values:

helm template --debug charts/kyuubi

Test 2

Templates kyuubi-alert.yaml, kyuubi-podmonitor.yaml and kyuubi-servicemonitor.yaml are correct with additionally provided values:

helm template --debug charts/kyuubi -f values-monitoring.yaml -s templates/kyuubi-alert.yaml -s templates/kyuubi-podmonitor.yaml -s templates/kyuubi-servicemonitor.yaml

File values-monitoring.yaml used for testing

metricsReporters: PROMETHEUS

podMonitor:
  enabled: true
  podMetricsEndpoint:
    - port: web

serviceMonitor:
  enabled: true
  endpoints:
    - port: web
  labels:
    first: label1
    second: label2

prometheusRule:
  enabled: true
  groups:
    - name: ./example.rules
      rules:
        - alert: ExampleAlert
          expr: vector(1)

Checklist 📝

Be nice. Be informative.

@@ -20,9 +20,7 @@ apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: {{ .Release.Name }}
labels:
{{- include "kyuubi.labels" . | nindent 4 }}
labels: {{- include "kyuubi.labels" . | nindent 4 }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, but the previous one is more intuitive for me, since the rendered result of template

  labels:
    {{- include "kyuubi.labels" . | nindent 4 }}

is something like

  labels:
    label1: value1
    label2: value2

any specify reason to use the proposed one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no specific reason, rather than following one style across all templates. The idea is to keep templates more compact if it is possible. We use this formatting style in many places, for instance:

rules: {{- toYaml .Values.rbac.rules | nindent 2 }}
annotations: {{- toYaml . | nindent 4 }}
sessionAffinityConfig: {{- toYaml . | nindent 4 }}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree to unify the style, but lean to invert the style.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no strong convention at the moment as far as I know, so both approaches are valid. Personally I prefer more compact style, because from my experience it's more convenient to read and review the code, especially if a template has many lines. One argument here might be that Bitnami uses this approach as well for all their charts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants