From 04b8ccebb123100ab73eb7a84f0f441c4003c1a8 Mon Sep 17 00:00:00 2001 From: Martin <43972560+Mortom123@users.noreply.github.com> Date: Mon, 15 Jan 2024 16:53:56 +0100 Subject: [PATCH] Resource specs for Init Containers (#428) * add missing section in values.yaml for pulsar_metadata resources * add resources to all init containers and an additional section to specify them in values.yaml * increase memory defaults for init containers * remove empty lines * Add newline to end of file --- .../templates/autorecovery-statefulset.yaml | 1 + .../bookkeeper-cluster-initialize.yaml | 1 + .../templates/bookkeeper-statefulset.yaml | 1 + .../pulsar/templates/broker-statefulset.yaml | 2 ++ .../pulsar/templates/proxy-statefulset.yaml | 2 ++ .../templates/pulsar-cluster-initialize.yaml | 3 ++ charts/pulsar/values.yaml | 30 +++++++++++++++++++ 7 files changed, 40 insertions(+) diff --git a/charts/pulsar/templates/autorecovery-statefulset.yaml b/charts/pulsar/templates/autorecovery-statefulset.yaml index 3d3b4ce..2aa4f13 100644 --- a/charts/pulsar/templates/autorecovery-statefulset.yaml +++ b/charts/pulsar/templates/autorecovery-statefulset.yaml @@ -111,6 +111,7 @@ spec: - name: pulsar-bookkeeper-verify-clusterid image: "{{ template "pulsar.imageFullName" (dict "image" .Values.images.autorecovery "root" .) }}" imagePullPolicy: {{ .Values.images.autorecovery.pullPolicy }} + resources: {{ toYaml .Values.initContainer_resources.verify_cluster_id | nindent 10 }} command: ["sh", "-c"] args: - > diff --git a/charts/pulsar/templates/bookkeeper-cluster-initialize.yaml b/charts/pulsar/templates/bookkeeper-cluster-initialize.yaml index 24aae92..009556d 100644 --- a/charts/pulsar/templates/bookkeeper-cluster-initialize.yaml +++ b/charts/pulsar/templates/bookkeeper-cluster-initialize.yaml @@ -47,6 +47,7 @@ spec: - name: wait-zookeeper-ready image: "{{ template "pulsar.imageFullName" (dict "image" .Values.images.bookie "root" .) }}" imagePullPolicy: {{ .Values.images.bookie.pullPolicy }} + resources: {{ toYaml .Values.initContainer_resources.zookeeper_ready | nindent 10 }} command: ["sh", "-c"] args: - >- diff --git a/charts/pulsar/templates/bookkeeper-statefulset.yaml b/charts/pulsar/templates/bookkeeper-statefulset.yaml index a81245c..c513198 100644 --- a/charts/pulsar/templates/bookkeeper-statefulset.yaml +++ b/charts/pulsar/templates/bookkeeper-statefulset.yaml @@ -112,6 +112,7 @@ spec: - name: pulsar-bookkeeper-verify-clusterid image: "{{ template "pulsar.imageFullName" (dict "image" .Values.images.bookie "root" .) }}" imagePullPolicy: {{ .Values.images.bookie.pullPolicy }} + resources: {{ toYaml .Values.initContainer_resources.verify_cluster_id | nindent 10 }} command: ["sh", "-c"] args: # only reformat bookie if bookkeeper is running without persistence diff --git a/charts/pulsar/templates/broker-statefulset.yaml b/charts/pulsar/templates/broker-statefulset.yaml index b436cfc..5f3c452 100644 --- a/charts/pulsar/templates/broker-statefulset.yaml +++ b/charts/pulsar/templates/broker-statefulset.yaml @@ -110,6 +110,7 @@ spec: - name: wait-zookeeper-ready image: "{{ template "pulsar.imageFullName" (dict "image" .Values.images.broker "root" .) }}" imagePullPolicy: {{ .Values.images.broker.pullPolicy }} + resources: {{ toYaml .Values.initContainer_resources.zookeeper_ready | nindent 10 }} command: ["sh", "-c"] args: - >- @@ -134,6 +135,7 @@ spec: - name: wait-bookkeeper-ready image: "{{ template "pulsar.imageFullName" (dict "image" .Values.images.broker "root" .) }}" imagePullPolicy: {{ .Values.images.broker.pullPolicy }} + resources: {{ toYaml .Values.initContainer_resources.bookkeeper_ready | nindent 10 }} command: ["sh", "-c"] args: - > diff --git a/charts/pulsar/templates/proxy-statefulset.yaml b/charts/pulsar/templates/proxy-statefulset.yaml index d50559c..2335d69 100644 --- a/charts/pulsar/templates/proxy-statefulset.yaml +++ b/charts/pulsar/templates/proxy-statefulset.yaml @@ -110,6 +110,7 @@ spec: - name: wait-zookeeper-ready image: "{{ template "pulsar.imageFullName" (dict "image" .Values.images.proxy "root" .) }}" imagePullPolicy: {{ .Values.images.proxy.pullPolicy }} + resources: {{ toYaml .Values.initContainer_resources.zookeeper_ready | nindent 10 }} command: ["sh", "-c"] args: - >- @@ -128,6 +129,7 @@ spec: - name: wait-broker-ready image: "{{ template "pulsar.imageFullName" (dict "image" .Values.images.proxy "root" .) }}" imagePullPolicy: {{ .Values.images.proxy.pullPolicy }} + resources: {{ toYaml .Values.initContainer_resources.broker_ready | nindent 10 }} command: ["sh", "-c"] args: - >- diff --git a/charts/pulsar/templates/pulsar-cluster-initialize.yaml b/charts/pulsar/templates/pulsar-cluster-initialize.yaml index 813950b..2fdaa33 100644 --- a/charts/pulsar/templates/pulsar-cluster-initialize.yaml +++ b/charts/pulsar/templates/pulsar-cluster-initialize.yaml @@ -44,6 +44,7 @@ spec: - name: wait-cs-ready image: "{{ template "pulsar.imageFullName" (dict "image" .Values.pulsar_metadata.image "root" .) }}" imagePullPolicy: {{ .Values.pulsar_metadata.image.pullPolicy }} + resources: {{ toYaml .Values.initContainer_resources.cs_ready | nindent 10 }} command: ["sh", "-c"] args: - >- @@ -54,6 +55,7 @@ spec: - name: wait-zookeeper-ready image: "{{ template "pulsar.imageFullName" (dict "image" .Values.pulsar_metadata.image "root" .) }}" imagePullPolicy: {{ .Values.pulsar_metadata.image.pullPolicy }} + resources: {{ toYaml .Values.initContainer_resources.zookeeper_ready | nindent 10 }} command: ["sh", "-c"] args: - >- @@ -72,6 +74,7 @@ spec: - name: pulsar-bookkeeper-verify-clusterid image: "{{ template "pulsar.imageFullName" (dict "image" .Values.pulsar_metadata.image "root" .) }}" imagePullPolicy: {{ .Values.pulsar_metadata.image.pullPolicy }} + resources: {{ toYaml .Values.initContainer_resources.verify_cluster_id | nindent 10 }} command: ["sh", "-c"] args: - > diff --git a/charts/pulsar/values.yaml b/charts/pulsar/values.yaml index 3798685..5125954 100644 --- a/charts/pulsar/values.yaml +++ b/charts/pulsar/values.yaml @@ -677,6 +677,12 @@ pulsar_metadata: configurationStoreMetadataPrefix: "" configurationStorePort: 2181 + # resources for bin/pulsar initialize-cluster-metadata + resources: +# requests: +# memory: 512Mi +# cpu: 1 + ## optional you can specify tolerations and nodeSelectors for all init jobs (pulsar-init & bookkeeper-init) # tolerations: [] # - key: "someKey" @@ -1151,3 +1157,27 @@ job: ttl: enabled: false secondsAfterFinished: 3600 + +# This section is intended for cluster providers where all containers, including init containers, +# need to provide the number of resources they are going to use. +initContainer_resources: + zookeeper_ready: + requests: + memory: 256Mi + cpu: 0.1 + cs_ready: + requests: + memory: 256Mi + cpu: 0.1 + verify_cluster_id: + requests: + memory: 256Mi + cpu: 0.1 + broker_ready: + requests: + memory: 256Mi + cpu: 0.1 + bookkeeper_ready: + requests: + memory: 256Mi + cpu: 0.1