Skip to content

HDDS-13992. Support additional annotations for pods#22

Merged
adoroszlai merged 3 commits intoapache:mainfrom
chehsunliu:main
Nov 23, 2025
Merged

HDDS-13992. Support additional annotations for pods#22
adoroszlai merged 3 commits intoapache:mainfrom
chehsunliu:main

Conversation

@chehsunliu
Copy link
Contributor

What changes were proposed in this pull request?

Support configuring additional pod annotations via values.yaml. This allows users to customize annotations such as those used to control Istio sidecar resources:

apiVersion: apps/v1
kind: StatefulSet
spec:
  template:
    metadata:
      annotations:
        sidecar.istio.io/proxyCPU: 100m
        sidecar.istio.io/proxyCPULimit: 200m
        sidecar.istio.io/proxyMemory: 128Mi
        sidecar.istio.io/proxyMemoryLimit: 256Mi 

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-13992

How was this patch tested?

  1. Test that the rendered templates aren't changed with default values
# Before making any code change
$ helm template charts/ozone > /tmp/ozone.v0.yaml

# After this change
$ helm template charts/ozone > /tmp/ozone.v1.yaml

$ diff -u /tmp/ozone.*.yaml
# No diff
  1. Test that templates are correct with provided annotations
$ helm template charts/ozone \
    --set "datanode.podAnnotations.sidecar\\.istio\\.io/proxyCPU=100m" \
    --set "datanode.podAnnotations.sidecar\\.istio\\.io/proxyCPULimit=200m" \
    --set "om.podAnnotations.sidecar\\.istio\\.io/proxyCPU=110m" \
    --set "om.podAnnotations.sidecar\\.istio\\.io/proxyCPULimit=210m" \
    --set "s3g.podAnnotations.sidecar\\.istio\\.io/proxyCPU=120m" \
    --set "s3g.podAnnotations.sidecar\\.istio\\.io/proxyCPULimit=220m" \
    --set "scm.podAnnotations.sidecar\\.istio\\.io/proxyCPU=130m" \
    --set "scm.podAnnotations.sidecar\\.istio\\.io/proxyCPULimit=230m" \
    > /tmp/ozone.v1.yaml

$ diff -u /tmp/ozone.*.yaml

Output

--- /tmp/ozone.v0.yaml	2025-11-23 17:43:24
+++ /tmp/ozone.v1.yaml	2025-11-23 18:33:31
@@ -234,16 +234,18 @@
     matchLabels:
       app.kubernetes.io/name: ozone
       app.kubernetes.io/instance: release-name
       app.kubernetes.io/component: datanode
   template:
     metadata:
       annotations:
         checksum/config: 6d1d3f4f11b1bab096dd5d48cebba6471332987371961847c439d6a9cb229678
+        sidecar.istio.io/proxyCPU: 100m
+        sidecar.istio.io/proxyCPULimit: 200m
       labels:
         app.kubernetes.io/name: ozone
         app.kubernetes.io/instance: release-name
         app.kubernetes.io/component: datanode
     spec:
       containers:
         - name: datanode
           image: "apache/ozone:2.0.0"
@@ -313,16 +315,18 @@
     matchLabels:
       app.kubernetes.io/name: ozone
       app.kubernetes.io/instance: release-name
       app.kubernetes.io/component: om
   template:
     metadata:
       annotations:
         checksum/config: 6d1d3f4f11b1bab096dd5d48cebba6471332987371961847c439d6a9cb229678
+        sidecar.istio.io/proxyCPU: 110m
+        sidecar.istio.io/proxyCPULimit: 210m
       labels:
         app.kubernetes.io/name: ozone
         app.kubernetes.io/instance: release-name
         app.kubernetes.io/component: om
     spec:
       containers:
         - name: om
           image: "apache/ozone:2.0.0"
@@ -398,16 +402,18 @@
     matchLabels:
       app.kubernetes.io/name: ozone
       app.kubernetes.io/instance: release-name
       app.kubernetes.io/component: s3g
   template:
     metadata:
       annotations:
         checksum/config: 6d1d3f4f11b1bab096dd5d48cebba6471332987371961847c439d6a9cb229678
+        sidecar.istio.io/proxyCPU: 120m
+        sidecar.istio.io/proxyCPULimit: 220m
       labels:
         app.kubernetes.io/name: ozone
         app.kubernetes.io/instance: release-name
         app.kubernetes.io/component: s3g
     spec:
       containers:
         - name: s3g
           image: "apache/ozone:2.0.0"
@@ -479,16 +485,18 @@
     matchLabels:
       app.kubernetes.io/name: ozone
       app.kubernetes.io/instance: release-name
       app.kubernetes.io/component: scm
   template:
     metadata:
       annotations:
         checksum/config: 6d1d3f4f11b1bab096dd5d48cebba6471332987371961847c439d6a9cb229678
+        sidecar.istio.io/proxyCPU: 130m
+        sidecar.istio.io/proxyCPULimit: 230m
       labels:
         app.kubernetes.io/name: ozone
         app.kubernetes.io/instance: release-name
         app.kubernetes.io/component: scm
     spec:
       initContainers:
         - name: init
           image: "apache/ozone:2.0.0"

peter-lee-appier

This comment was marked as abuse.

Copy link
Member

@peterxcli peterxcli left a comment

Choose a reason for hiding this comment

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

Thanks for this great improvement. LGTM +1

@adoroszlai
Copy link
Contributor

@dnskr @Tejaskriya would you like to take a look?

Copy link
Contributor

@dnskr dnskr left a comment

Choose a reason for hiding this comment

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

Looks good overall!

I've suggested a couple of minor formatting points that would help with consistency and readability. Also, based on the use case described, I would suggest adding a common podAnnotations property similar to env and envFrom.

Comment on lines +43 to +45
{{- with .Values.datanode.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{{- with .Values.datanode.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.datanode.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}

nit: I suggest adding two spaces to follow the project's formatting approach.

Comment on lines +43 to +45
{{- with .Values.om.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{{- with .Values.om.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.om.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}

nit: I suggest adding two spaces to follow the project's formatting approach.

Comment on lines +43 to +45
{{- with .Values.s3g.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{{- with .Values.s3g.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.s3g.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}

nit: I suggest adding two spaces to follow the project's formatting approach.

Comment on lines +43 to +45
{{- with .Values.scm.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{{- with .Values.scm.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.scm.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}

nit: I suggest adding two spaces to follow the project's formatting approach.

@chehsunliu
Copy link
Contributor Author

Test the precedence with this command instead:

$ helm template charts/ozone \
    --set "podAnnotations.sidecar\\.istio\\.io/proxyCPU=100m" \
    --set "datanode.podAnnotations.sidecar\\.istio\\.io/proxyCPULimit=200m" \
    --set "om.podAnnotations.sidecar\\.istio\\.io/proxyCPULimit=210m" \
    --set "s3g.podAnnotations.sidecar\\.istio\\.io/proxyCPU=120m" \
    --set "s3g.podAnnotations.sidecar\\.istio\\.io/proxyCPULimit=220m" \
    --set "scm.podAnnotations.sidecar\\.istio\\.io/proxyCPU=130m" \
    --set "scm.podAnnotations.sidecar\\.istio\\.io/proxyCPULimit=230m" \
    > /tmp/ozone.v1.yaml

Output:

--- /tmp/ozone.v0.yaml	2025-11-23 17:43:24
+++ /tmp/ozone.v1.yaml	2025-11-23 21:31:24
@@ -234,16 +234,18 @@
     matchLabels:
       app.kubernetes.io/name: ozone
       app.kubernetes.io/instance: release-name
       app.kubernetes.io/component: datanode
   template:
     metadata:
       annotations:
         checksum/config: 6d1d3f4f11b1bab096dd5d48cebba6471332987371961847c439d6a9cb229678
+        sidecar.istio.io/proxyCPU: 100m
+        sidecar.istio.io/proxyCPULimit: 200m
       labels:
         app.kubernetes.io/name: ozone
         app.kubernetes.io/instance: release-name
         app.kubernetes.io/component: datanode
     spec:
       containers:
         - name: datanode
           image: "apache/ozone:2.0.0"
@@ -313,16 +315,18 @@
     matchLabels:
       app.kubernetes.io/name: ozone
       app.kubernetes.io/instance: release-name
       app.kubernetes.io/component: om
   template:
     metadata:
       annotations:
         checksum/config: 6d1d3f4f11b1bab096dd5d48cebba6471332987371961847c439d6a9cb229678
+        sidecar.istio.io/proxyCPU: 100m
+        sidecar.istio.io/proxyCPULimit: 210m
       labels:
         app.kubernetes.io/name: ozone
         app.kubernetes.io/instance: release-name
         app.kubernetes.io/component: om
     spec:
       containers:
         - name: om
           image: "apache/ozone:2.0.0"
@@ -398,16 +402,18 @@
     matchLabels:
       app.kubernetes.io/name: ozone
       app.kubernetes.io/instance: release-name
       app.kubernetes.io/component: s3g
   template:
     metadata:
       annotations:
         checksum/config: 6d1d3f4f11b1bab096dd5d48cebba6471332987371961847c439d6a9cb229678
+        sidecar.istio.io/proxyCPU: 120m
+        sidecar.istio.io/proxyCPULimit: 220m
       labels:
         app.kubernetes.io/name: ozone
         app.kubernetes.io/instance: release-name
         app.kubernetes.io/component: s3g
     spec:
       containers:
         - name: s3g
           image: "apache/ozone:2.0.0"
@@ -479,16 +485,18 @@
     matchLabels:
       app.kubernetes.io/name: ozone
       app.kubernetes.io/instance: release-name
       app.kubernetes.io/component: scm
   template:
     metadata:
       annotations:
         checksum/config: 6d1d3f4f11b1bab096dd5d48cebba6471332987371961847c439d6a9cb229678
+        sidecar.istio.io/proxyCPU: 130m
+        sidecar.istio.io/proxyCPULimit: 230m
       labels:
         app.kubernetes.io/name: ozone
         app.kubernetes.io/instance: release-name
         app.kubernetes.io/component: scm
     spec:
       initContainers:
         - name: init
           image: "apache/ozone:2.0.0"

Copy link
Contributor

@dnskr dnskr left a comment

Choose a reason for hiding this comment

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

The changes look great. Thanks for the contribution and for addressing the comments!

@adoroszlai adoroszlai merged commit 6c1a77b into apache:main Nov 23, 2025
1 check passed
@adoroszlai
Copy link
Contributor

Thanks @chehsunliu for the patch, @dnskr, @peterxcli for the review.

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.

5 participants