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

Extra labels #13

Merged
merged 10 commits into from
Jul 21, 2021
Merged

Extra labels #13

merged 10 commits into from
Jul 21, 2021

Conversation

raresfirebolt
Copy link
Owner

@raresfirebolt raresfirebolt commented Jul 20, 2021

add suupport for extraPodLabels

@@ -26,6 +26,9 @@ spec:
app: {{ template "timescaledb.fullname" . }}
release: {{ .Release.Name }}
timescaleNodeType: access
{{ with .Values.accessNode.extraPodLabels -}}
{{ toYaml . }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

indentation

      {{- with .Values.accessNode.extraPodLabels }}
      {{ toYaml . | nindent 6/8}}
      {{- end }}

Copy link
Owner Author

@raresfirebolt raresfirebolt Jul 21, 2021

Choose a reason for hiding this comment

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

tested and renders correctly:

helm template timescaledb -f values.yaml -s templates/statefulset-timescaledb-accessnode.yaml .  
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: timescaledb-access
  labels:
    app: timescaledb
    chart: timescaledb-multinode-0.9.0
    release: timescaledb
    heritage: Helm
spec:
  serviceName: timescaledb-access
  replicas: 1
  podManagementPolicy: Parallel
  selector:
    matchLabels:
      app: timescaledb
      release: timescaledb
      timescaleNodeType: access
  template:
    metadata:
      name: timescaledb-access
      labels:
        app: timescaledb
        release: timescaledb
        timescaleNodeType: access
        app.kubernetes.io/part-of: globalcatalog

Copy link
Collaborator

Choose a reason for hiding this comment

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

(us-east-1.playground):/tmp/timescaledb-kubernetes/charts/timescaledb-multinode$ git diff
diff --git a/charts/timescaledb-multinode/templates/statefulset-timescaledb-accessnode.yaml b/charts/timescaledb-multinode/templates/statefulset-timescaledb-accessnode.yaml
index 55ab134..467c6fa 100644
--- a/charts/timescaledb-multinode/templates/statefulset-timescaledb-accessnode.yaml
+++ b/charts/timescaledb-multinode/templates/statefulset-timescaledb-accessnode.yaml
@@ -26,8 +26,8 @@ spec:
         app: {{ template "timescaledb.fullname" . }}
         release: {{ .Release.Name }}
         timescaleNodeType: access
-        {{ with .Values.accessNode.extraPodLabels -}}
-        {{ toYaml . }}
+        {{- with .Values.accessNode.extraPodLabels }}
+        {{- toYaml . | nindent 8 }}
         {{- end }}
     spec:
       serviceAccountName: {{ template "timescaledb.serviceAccountName" . }}
diff --git a/charts/timescaledb-multinode/values.yaml b/charts/timescaledb-multinode/values.yaml
index f264fb6..e269647 100644
--- a/charts/timescaledb-multinode/values.yaml
+++ b/charts/timescaledb-multinode/values.yaml
@@ -35,7 +35,9 @@ env:
     value: /var/lib/postgresql/pgdata

 accessNode:
-  extraPodLabels: {}
+  extraPodLabels:
+    test: one
+    another: test
   #enable external access using LoadBalancer
   service:
     type: LoadBalancer
(us-east-1.playground):/tmp/timescaledb-kubernetes/charts/timescaledb-multinode$ helm template . | grep test -A 2 -B 2
        release: RELEASE-NAME
        timescaleNodeType: access
        another: test
        test: one
    spec:
      serviceAccountName: RELEASE-NAME-timescaledb
(us-east-1.playground):/tmp/timescaledb-kubernetes/charts/timescaledb-multinode$ git checkout templates/statefulset-timescaledb-accessnode.yaml
Updated 1 path from the index
(us-east-1.playground):/tmp/timescaledb-kubernetes/charts/timescaledb-multinode$ git diff
diff --git a/charts/timescaledb-multinode/values.yaml b/charts/timescaledb-multinode/values.yaml
index f264fb6..e269647 100644
--- a/charts/timescaledb-multinode/values.yaml
+++ b/charts/timescaledb-multinode/values.yaml
@@ -35,7 +35,9 @@ env:
     value: /var/lib/postgresql/pgdata

 accessNode:
-  extraPodLabels: {}
+  extraPodLabels:
+    test: one
+    another: test
   #enable external access using LoadBalancer
   service:
     type: LoadBalancer
(us-east-1.playground):/tmp/timescaledb-kubernetes/charts/timescaledb-multinode$ helm template . | grep test -A 2 -B 2
Error: YAML parse error on timescaledb-multinode/templates/statefulset-timescaledb-accessnode.yaml: error converting YAML to JSON: yaml: line 31: mapping values are not allowed in this context

Use --debug flag to render out invalid YAML

@@ -27,7 +27,7 @@ spec:
release: {{ .Release.Name }}
timescaleNodeType: access
{{ with .Values.accessNode.extraPodLabels -}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
{{ with .Values.accessNode.extraPodLabels -}}
{{- with .Values.accessNode.extraPodLabels }}

- should be on the left side, not on the right to reduce confusion
that's probably the reason this odd thing is working

Copy link
Owner Author

Choose a reason for hiding this comment

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

moved the - but it's the same correct render

Also tried with but still renders correctly

       {{- if .Values.dataNode.extraPodLabels }}
       {{ toYaml .Values.dataNode.extraPodLabels }}
       {{- end }}

Copy link
Collaborator

Choose a reason for hiding this comment

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

move - to the left

@@ -27,7 +27,7 @@ spec:
release: {{ .Release.Name }}
timescaleNodeType: access
{{ with .Values.accessNode.extraPodLabels -}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

move - to the left

raresfirebolt and others added 2 commits July 21, 2021 12:36
committed by mistake
@raresfirebolt raresfirebolt merged commit 32127da into access_and_data_node_configs Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants