Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ jobs:
run: |
helm unittest helm/kagent
helm unittest helm/tools/querydoc
helm unittest helm/tools/grafana-mcp

ui-tests:
runs-on: ubuntu-latest
Expand Down
5 changes: 2 additions & 3 deletions helm/kagent/tests/postgresql_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,8 @@ tests:
- contains:
path: spec.template.spec.containers[0].securityContext.capabilities.drop
content: ALL
- equal:
path: spec.template.spec.containers[0].securityContext.seccompProfile.type
value: RuntimeDefault
- isNull:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why was this changed?

Copy link
Copy Markdown
Contributor Author

@marcofranssen marcofranssen May 19, 2026

Choose a reason for hiding this comment

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

because it is set at the entire Pod level, which applies it already to all containers in that pod. meaning it would not show up as a separate container context setting.

path: spec.template.spec.containers[0].securityContext.seccompProfile

- it: should allow bundled postgres pod security context override
template: postgresql.yaml
Expand Down
31 changes: 30 additions & 1 deletion helm/kagent/tests/security-context_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,24 @@ tests:
- equal:
path: spec.template.spec.securityContext.runAsNonRoot
value: true
- equal:
path: spec.template.spec.securityContext.seccompProfile.type
value: RuntimeDefault

- it: should apply default container security context to controller
template: controller-deployment.yaml
asserts:
- equal:
path: spec.template.spec.containers[0].securityContext.readOnlyRootFilesystem
value: true
- equal:
path: spec.template.spec.containers[0].securityContext.allowPrivilegeEscalation
value: false
- contains:
path: spec.template.spec.containers[0].securityContext.capabilities.drop
content: ALL
- isNull:
path: spec.template.spec.containers[0].securityContext.seccompProfile

- it: should allow controller pod security context override
template: controller-deployment.yaml
Expand Down Expand Up @@ -87,12 +98,30 @@ tests:
# =============================================================================
# UI Security Context Tests
# =============================================================================
- it: should apply UI-specific container security context override
- it: should apply default pod security context to UI
template: ui-deployment.yaml
asserts:
- equal:
path: spec.template.spec.securityContext.runAsNonRoot
value: true
- equal:
path: spec.template.spec.securityContext.seccompProfile.type
value: RuntimeDefault

- it: should apply default container security context to UI
template: ui-deployment.yaml
asserts:
- equal:
path: spec.template.spec.containers[0].securityContext.readOnlyRootFilesystem
value: true
- equal:
path: spec.template.spec.containers[0].securityContext.allowPrivilegeEscalation
value: false
- contains:
path: spec.template.spec.containers[0].securityContext.capabilities.drop
content: ALL
- isNull:
path: spec.template.spec.containers[0].securityContext.seccompProfile

- it: should have nextjs-cache volume for UI
template: ui-deployment.yaml
Expand Down
23 changes: 17 additions & 6 deletions helm/kagent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,17 @@ labels: {}
# -- Security context for all pods
podSecurityContext:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
# fsGroup: 2000

# -- Security context for all containers
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
# capabilities:
# drop:
# - ALL
capabilities:
drop:
- ALL
# runAsUser: 1000

# ==============================================================================
Expand Down Expand Up @@ -117,8 +120,6 @@ database:
capabilities:
drop:
- ALL
seccompProfile:
type: RuntimeDefault

# ==============================================================================
# RBAC CONFIGURATION
Expand Down Expand Up @@ -398,6 +399,16 @@ kagent-tools:
enabled: true
nameOverride: tools
replicaCount: 1
podSecurityContext:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
resources:
requests:
cpu: 50m
Expand All @@ -407,7 +418,7 @@ kagent-tools:
tools:
loglevel: "debug"
metrics:
port: 8085 # Use a different port than the main service port (8084) to avoid duplicate port definitions
port: 8085 # Use a different port than the main service port (8084) to avoid duplicate port definitions

# ==============================================================================
# PROXY CONFIGURATION
Expand Down
4 changes: 4 additions & 0 deletions helm/tools/grafana-mcp/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ spec:
{{- include "grafana-mcp.selectorLabels" . | nindent 8 }}
spec:
serviceAccountName: {{ include "grafana-mcp.serviceAccountName" . }}
{{- with .Values.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
102 changes: 102 additions & 0 deletions helm/tools/grafana-mcp/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
suite: test grafana-mcp deployment
templates:
- deployment.yaml
- configmap.yaml
- secret.yaml
tests:
- it: should render deployment with default values
template: deployment.yaml
asserts:
- isKind:
of: Deployment
- equal:
path: metadata.name
value: RELEASE-NAME-grafana-mcp
- equal:
path: spec.replicas
value: 1
- hasDocuments:
count: 1

- it: should have correct container name
template: deployment.yaml
asserts:
- equal:
path: spec.template.spec.containers[0].name
value: grafana-mcp

- it: should have correct service account name
template: deployment.yaml
asserts:
- equal:
path: spec.template.spec.serviceAccountName
value: RELEASE-NAME-grafana-mcp

- it: should have correct container port
template: deployment.yaml
asserts:
- equal:
path: spec.template.spec.containers[0].ports[0].containerPort
value: 8000

# =============================================================================
# Security Context Tests
# =============================================================================
- it: should apply default pod security context
template: deployment.yaml
asserts:
- equal:
path: spec.template.spec.securityContext.runAsNonRoot
value: true
- equal:
path: spec.template.spec.securityContext.seccompProfile.type
value: RuntimeDefault

- it: should apply default container security context
template: deployment.yaml
asserts:
- equal:
path: spec.template.spec.containers[0].securityContext.allowPrivilegeEscalation
value: false
- contains:
path: spec.template.spec.containers[0].securityContext.capabilities.drop
content: ALL
- equal:
path: spec.template.spec.containers[0].securityContext.readOnlyRootFilesystem
value: true
- equal:
path: spec.template.spec.containers[0].securityContext.runAsUser
value: 1000
- equal:
path: spec.template.spec.containers[0].securityContext.runAsGroup
value: 999
- isNull:
path: spec.template.spec.containers[0].securityContext.seccompProfile

- it: should allow pod security context override
template: deployment.yaml
set:
podSecurityContext:
runAsNonRoot: true
fsGroup: 2000
asserts:
- equal:
path: spec.template.spec.securityContext.runAsNonRoot
value: true
- equal:
path: spec.template.spec.securityContext.fsGroup
value: 2000

- it: should allow container security context override
template: deployment.yaml
set:
securityContext:
readOnlyRootFilesystem: false
runAsUser: 1000
asserts:
- equal:
path: spec.template.spec.containers[0].securityContext.readOnlyRootFilesystem
value: false
- equal:
path: spec.template.spec.containers[0].securityContext.runAsUser
value: 1000
19 changes: 15 additions & 4 deletions helm/tools/grafana-mcp/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ grafana:
image:
registry: mcp
repository: grafana
pullPolicy: Always
pullPolicy: Always
tag: "latest" # Only latest is available via docker hub at present. See https://github.com/grafana/mcp-grafana/issues/180

nameOverride: ""
Expand All @@ -20,8 +20,20 @@ serviceAccount:
annotations: {}
name: ""

securityContext: {}

podSecurityContext:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault

securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsUser: 1000
runAsGroup: 999

tolerations: []

nodeSelector: {}
Expand Down Expand Up @@ -57,4 +69,3 @@ volumeMounts: []
# Deployment configuration - used to populate the ConfigMap template.
# Add custom configuration values here as needed.
config:

47 changes: 43 additions & 4 deletions helm/tools/querydoc/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,38 @@ tests:
path: spec.template.metadata.labels["app.kubernetes.io/instance"]
value: RELEASE-NAME

- it: should not set pod security context by default
- it: should apply default pod security context
template: deployment.yaml
asserts:
- notExists:
path: spec.template.spec.securityContext
- equal:
path: spec.template.spec.securityContext.runAsNonRoot
value: true
- equal:
path: spec.template.spec.securityContext.seccompProfile.type
value: RuntimeDefault

- it: should apply default container security context
template: deployment.yaml
asserts:
- equal:
path: spec.template.spec.containers[0].securityContext.allowPrivilegeEscalation
value: false
- contains:
path: spec.template.spec.containers[0].securityContext.capabilities.drop
content: ALL
- equal:
path: spec.template.spec.containers[0].securityContext.readOnlyRootFilesystem
value: true
- equal:
path: spec.template.spec.containers[0].securityContext.runAsUser
value: 14000
- equal:
path: spec.template.spec.containers[0].securityContext.runAsGroup
value: 14000
- isNull:
path: spec.template.spec.containers[0].securityContext.seccompProfile

- it: should set pod security context when podSecurityContext is provided
- it: should allow pod security context override
template: deployment.yaml
set:
podSecurityContext:
Expand All @@ -96,6 +121,20 @@ tests:
path: spec.template.spec.securityContext.fsGroup
value: 1000

- it: should allow container security context override
template: deployment.yaml
set:
securityContext:
readOnlyRootFilesystem: false
runAsUser: 1000
asserts:
- equal:
path: spec.template.spec.containers[0].securityContext.readOnlyRootFilesystem
value: false
- equal:
path: spec.template.spec.containers[0].securityContext.runAsUser
value: 1000

- it: should set nodeSelector
template: deployment.yaml
set:
Expand Down
14 changes: 12 additions & 2 deletions helm/tools/querydoc/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,19 @@ serviceAccount:
annotations: {}
name: ""

podSecurityContext: {}
podSecurityContext:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault

securityContext: {}
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsUser: 14000
runAsGroup: 14000

tolerations: []

Expand Down
Loading