From 701fb2e9c135b5bd36c9654d8b732436eabf2f13 Mon Sep 17 00:00:00 2001 From: younsl Date: Wed, 8 Jul 2026 00:29:50 +0900 Subject: [PATCH 1/3] feat(helm): add extraObjects for arbitrary manifests Add a top-level `extraObjects` value that renders arbitrary user-supplied Kubernetes manifests within the kagent chart. Each entry is processed through `tpl`, so values may reference the release context (e.g. release name, namespace, chart helpers). Both map and multi-line string entries are supported. This lets users manage companion resources such as ExternalSecret, HTTPRoute, or NetworkPolicy in the same chart lifecycle without maintaining a separate chart. When `extraObjects` is empty (the default), no additional documents are rendered, so existing installs are unaffected. Covered by a helm-unittest suite. Signed-off-by: younsl --- helm/kagent/templates/extra-objects.yaml | 12 ++++ helm/kagent/tests/extra-objects_test.yaml | 87 +++++++++++++++++++++++ helm/kagent/values.yaml | 29 ++++++++ 3 files changed, 128 insertions(+) create mode 100644 helm/kagent/templates/extra-objects.yaml create mode 100644 helm/kagent/tests/extra-objects_test.yaml diff --git a/helm/kagent/templates/extra-objects.yaml b/helm/kagent/templates/extra-objects.yaml new file mode 100644 index 000000000..8781d157d --- /dev/null +++ b/helm/kagent/templates/extra-objects.yaml @@ -0,0 +1,12 @@ +# Render arbitrary user-supplied manifests so resources such as ExternalSecret, +# HTTPRoute, or NetworkPolicy can be managed within the same chart lifecycle. +# Each entry is processed through `tpl`, so values may reference the release +# context (e.g. {{ include "kagent.fullname" . }} or .Release.Namespace). +{{- range .Values.extraObjects }} +--- +{{- if typeIs "string" . }} +{{ tpl . $ }} +{{- else }} +{{ tpl (toYaml .) $ }} +{{- end }} +{{- end }} diff --git a/helm/kagent/tests/extra-objects_test.yaml b/helm/kagent/tests/extra-objects_test.yaml new file mode 100644 index 000000000..552ba97a0 --- /dev/null +++ b/helm/kagent/tests/extra-objects_test.yaml @@ -0,0 +1,87 @@ +suite: test extra objects +templates: + - extra-objects.yaml +tests: + - it: should not render anything when extraObjects is empty + asserts: + - hasDocuments: + count: 0 + + - it: should render a map entry as a manifest + set: + extraObjects: + - apiVersion: v1 + kind: ConfigMap + metadata: + name: extra-cm + data: + foo: bar + asserts: + - hasDocuments: + count: 1 + - isKind: + of: ConfigMap + - equal: + path: metadata.name + value: extra-cm + - equal: + path: data.foo + value: bar + + - it: should render multiple entries as separate documents + set: + extraObjects: + - apiVersion: v1 + kind: ConfigMap + metadata: + name: extra-cm-1 + - apiVersion: v1 + kind: Secret + metadata: + name: extra-secret-1 + asserts: + - hasDocuments: + count: 2 + + - it: should evaluate tpl expressions against the release context in map entries + release: + name: my-release + namespace: my-namespace + set: + extraObjects: + - apiVersion: v1 + kind: ConfigMap + metadata: + name: '{{ include "kagent.fullname" . }}-extra' + namespace: '{{ .Release.Namespace }}' + asserts: + - equal: + path: metadata.name + value: my-release-extra + - equal: + path: metadata.namespace + value: my-namespace + + - it: should render and template a multi-line string entry + release: + name: my-release + set: + extraObjects: + - | + apiVersion: v1 + kind: ConfigMap + metadata: + name: {{ include "kagent.fullname" . }}-str + data: + release: {{ .Release.Name }} + asserts: + - hasDocuments: + count: 1 + - isKind: + of: ConfigMap + - equal: + path: metadata.name + value: my-release-str + - equal: + path: data.release + value: my-release diff --git a/helm/kagent/values.yaml b/helm/kagent/values.yaml index 5fbe1bd0e..e34be925c 100644 --- a/helm/kagent/values.yaml +++ b/helm/kagent/values.yaml @@ -854,3 +854,32 @@ otel: endpoint: "" timeout: 15000 # milliseconds insecure: true + +# ============================================================================== +# EXTRA OBJECTS +# ============================================================================== + +# -- Additional arbitrary Kubernetes manifests to deploy alongside the chart. +# Each list entry is rendered through `tpl`, so values may reference the release +# context (e.g. `{{ include "kagent.fullname" . }}`, `{{ .Release.Namespace }}`). +# Both map and multi-line string entries are supported. Use this to manage +# resources such as ExternalSecret, HTTPRoute, or NetworkPolicy within the same +# chart lifecycle without maintaining a separate chart. +# @default -- `[]` +extraObjects: [] + # - apiVersion: external-secrets.io/v1 + # kind: ExternalSecret + # metadata: + # name: '{{ include "kagent.fullname" . }}-openai' + # namespace: '{{ .Release.Namespace }}' + # spec: + # secretStoreRef: + # name: aws-secretsmanager + # kind: ClusterSecretStore + # target: + # name: kagent-openai + # data: + # - secretKey: OPENAI_API_KEY + # remoteRef: + # key: prod/kagent/openai + # property: api_key From 3647384c13386b07de4e7783c3faf7b0b5dc8cda Mon Sep 17 00:00:00 2001 From: Younsung Lee Date: Wed, 8 Jul 2026 00:49:49 +0900 Subject: [PATCH 2/3] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Younsung Lee --- helm/kagent/templates/extra-objects.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/kagent/templates/extra-objects.yaml b/helm/kagent/templates/extra-objects.yaml index 8781d157d..782ed5485 100644 --- a/helm/kagent/templates/extra-objects.yaml +++ b/helm/kagent/templates/extra-objects.yaml @@ -1,7 +1,7 @@ # Render arbitrary user-supplied manifests so resources such as ExternalSecret, # HTTPRoute, or NetworkPolicy can be managed within the same chart lifecycle. # Each entry is processed through `tpl`, so values may reference the release -# context (e.g. {{ include "kagent.fullname" . }} or .Release.Namespace). +# context (e.g. {{ "{{ include \"kagent.fullname\" . }}" }} or {{ "{{ .Release.Namespace }}" }}). {{- range .Values.extraObjects }} --- {{- if typeIs "string" . }} From 06e7444c69d6628d86bd0eebe280e14a9006361a Mon Sep 17 00:00:00 2001 From: younsl Date: Wed, 8 Jul 2026 20:46:56 +0900 Subject: [PATCH 3/3] docs(helm): align extraObjects default style Signed-off-by: younsl --- helm/kagent/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/kagent/values.yaml b/helm/kagent/values.yaml index e34be925c..587f344cf 100644 --- a/helm/kagent/values.yaml +++ b/helm/kagent/values.yaml @@ -865,7 +865,7 @@ otel: # Both map and multi-line string entries are supported. Use this to manage # resources such as ExternalSecret, HTTPRoute, or NetworkPolicy within the same # chart lifecycle without maintaining a separate chart. -# @default -- `[]` +# @default -- [] extraObjects: [] # - apiVersion: external-secrets.io/v1 # kind: ExternalSecret