Skip to content
Merged
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
8 changes: 8 additions & 0 deletions charts/apache/docs/networking.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ networkPolicy:
enabled: true
allowDns: true
allowInternet: false
extraEgress:
- to:
- ipBlock:
cidr: 10.0.0.0/8
ports:
- protocol: TCP
port: 443
```

When `allowInternet=true`, the chart allows both `0.0.0.0/0` and `::/0` so IPv4, IPv6, and dual-stack clusters behave consistently.
Use `extraEgress` for complete additional egress rules with `to` and `ports`.
36 changes: 18 additions & 18 deletions charts/apache/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
Apache HTTP Server has been installed
=====================================

Installation summary
--------------------
1. Installation summary
=======================
Release: {{ .Release.Name }}
Namespace: {{ .Release.Namespace }}
Chart version: {{ .Chart.Version }}
Expand All @@ -17,8 +17,8 @@ Service type: {{ .Values.service.type }}
Service port: {{ .Values.service.port }}
Container port: {{ .Values.containerPorts.http }}

Access Apache
-------------
2. Access
=========
Port-forward the Service:

kubectl port-forward svc/{{ include "apache.fullname" . }} -n {{ .Release.Namespace }} 8080:{{ .Values.service.port }}
Expand All @@ -32,8 +32,8 @@ Cluster-local endpoints:
http://{{ include "apache.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.port }}/
http://{{ include "apache.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.port }}/healthz

Content source
--------------
3. Content
==========
{{- if .Values.content.existingConfigMap }}
The web root is mounted from this existing ConfigMap:

Expand All @@ -50,8 +50,8 @@ Rendered content file count:
{{ len .Values.content.files }}
{{- end }}

Security summary
----------------
4. Credentials and security
===========================
Non-root runtime: enabled
Read-only root filesystem: {{ .Values.securityContext.readOnlyRootFilesystem }}
Run as user: {{ .Values.securityContext.runAsUser }}
Expand All @@ -65,8 +65,8 @@ Basic Auth Secret:
{{ include "apache.basicAuthSecretName" . }}
{{- end }}

Routing summary
---------------
5. Configuration summary
========================
Ingress: {{ ternary "enabled" "disabled" .Values.ingress.enabled }}
Gateway API HTTPRoute: {{ ternary "enabled" "disabled" .Values.gateway.enabled }}
NetworkPolicy: {{ ternary "enabled" "disabled" .Values.networkPolicy.enabled }}
Expand All @@ -88,8 +88,8 @@ Gateway hostnames:
{{- end }}
{{- end }}

Observability summary
---------------------
6. Observability
================
Metrics sidecar: {{ ternary "enabled" "disabled" .Values.metrics.enabled }}
ServiceMonitor: {{ ternary "enabled" "disabled" .Values.metrics.serviceMonitor.enabled }}
{{- if .Values.metrics.enabled }}
Expand All @@ -102,8 +102,8 @@ Apache server-status path:
{{ .Values.serverStatus.path }}
{{- end }}

Validate the deployment
-----------------------
7. Validation commands
======================
Run the Helm test:

helm test {{ .Release.Name }} -n {{ .Release.Namespace }}
Expand All @@ -122,8 +122,8 @@ Probe the health endpoint through a temporary curl pod:
kubectl run {{ .Release.Name }}-curl -n {{ .Release.Namespace }} --rm -i --restart=Never --image=curlimages/curl:8.17.0 -- \
curl -fsS http://{{ include "apache.fullname" . }}:{{ .Values.service.port }}/healthz

Troubleshooting
---------------
8. Troubleshooting
==================
Inspect Apache logs:

kubectl logs -n {{ .Release.Namespace }} deploy/{{ include "apache.fullname" . }} -c apache --since=10m
Expand Down Expand Up @@ -151,8 +151,8 @@ Common checks:
4. If Gateway routing fails, check parentRefs, listener hostnames, and GatewayClass readiness.
5. If NetworkPolicy is enabled, confirm your CNI enforces policies and selectors match the caller.

Documentation
-------------
9. Resources
============
Chart docs:

https://helmforge.dev/docs/charts/apache
Expand Down
3 changes: 3 additions & 0 deletions charts/apache/templates/networkpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,8 @@ spec:
{{- with .Values.networkPolicy.egress.extraRules }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.networkPolicy.egress.extraEgress }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
24 changes: 24 additions & 0 deletions charts/apache/tests/networkpolicy_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,27 @@ tests:
path: spec.ingress
- exists:
path: spec.egress

- it: should render canonical extra egress rules
set:
networkPolicy.enabled: true
networkPolicy.egress.enabled: true
networkPolicy.egress.allowDns: false
networkPolicy.egress.allowInternet: false
networkPolicy.egress.extraEgress:
- to:
- ipBlock:
cidr: 10.0.0.0/8
ports:
- protocol: TCP
port: 443
asserts:
- contains:
path: spec.egress
content:
to:
- ipBlock:
cidr: 10.0.0.0/8
ports:
- protocol: TCP
port: 443
21 changes: 21 additions & 0 deletions charts/apache/tests/test_connection_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# SPDX-License-Identifier: Apache-2.0
suite: Helm Test
templates:
- test-connection.yaml
release:
name: test
namespace: default
tests:
- it: should render helm test pod
asserts:
- isKind:
of: Pod
- equal:
path: metadata.name
value: test-apache-test-connection
- equal:
path: metadata.annotations["helm.sh/hook"]
value: test
- matchRegex:
path: spec.containers[0].command[2]
pattern: "/healthz"
4 changes: 3 additions & 1 deletion charts/apache/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,10 @@ networkPolicy:
allowDns: true
# -- Allow general IPv4 and IPv6 internet egress.
allowInternet: true
# -- Extra egress rules.
# -- Extra egress rules kept for backward compatibility.
extraRules: []
# -- Extra egress rules using the canonical HelmForge value.
extraEgress: []

serviceAccount:
# -- Create a dedicated ServiceAccount.
Expand Down