diff --git a/charts/opencut/README.md b/charts/opencut/README.md index 68e4fd7af..92c0a70a5 100644 --- a/charts/opencut/README.md +++ b/charts/opencut/README.md @@ -72,6 +72,15 @@ gateway: - opencut.example.com ``` +NetworkPolicy can append full custom web egress rules while keeping the generated +DNS, database, Redis HTTP bridge, and HTTPS egress rules: + +```yaml +networkPolicy: + enabled: true + extraEgress: [] +``` + ## Documentation - [Design](DESIGN.md) @@ -113,10 +122,10 @@ helm unittest charts/opencut kubeconform -strict -summary rendered.yaml ``` -### 🟢 Security Scan: `opencut` +### Security Scan: `opencut` | Framework | Score | -|---|---| +| --- | --- | | MITRE + NSA + SOC2 | **92.85354%** | -> ✅ Security posture acceptable. +Security posture: acceptable. diff --git a/charts/opencut/ci/ci-values.yaml b/charts/opencut/ci/ci-values.yaml index 8498a89d6..ee49e7e80 100644 --- a/charts/opencut/ci/ci-values.yaml +++ b/charts/opencut/ci/ci-values.yaml @@ -7,10 +7,9 @@ opencut: freesoundApiKey: ci-api-key service: - ipFamilyPolicy: PreferDualStack + ipFamilyPolicy: SingleStack ipFamilies: - IPv4 - - IPv6 ingress: enabled: true diff --git a/charts/opencut/templates/NOTES.txt b/charts/opencut/templates/NOTES.txt index 3b3ecef04..3a6cb354e 100644 --- a/charts/opencut/templates/NOTES.txt +++ b/charts/opencut/templates/NOTES.txt @@ -1,9 +1,6 @@ {{/* SPDX-License-Identifier: Apache-2.0 */}} -============================================================================= -OpenCut deployed successfully! -============================================================================= +1. Access -ACCESS: {{- if .Values.ingress.enabled }} {{- range .Values.ingress.hosts }} {{ ternary "https" "http" (eq (include "opencut.ingressHostHasTls" (dict "root" $ "host" .host)) "true") }}://{{ .host }} @@ -17,12 +14,14 @@ ACCESS: Open: http://localhost:3000 {{- end }} -SERVICE: +2. Service + Internal: {{ include "opencut.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.port }} Health: /api/health Image: {{ include "opencut.image" . }} -DATABASE: +3. Database + {{- if .Values.postgresql.enabled }} PostgreSQL: bundled HelmForge subchart Service: {{ include "opencut.databaseHost" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ dig "service" "port" 5432 .Values.postgresql }} @@ -31,7 +30,8 @@ DATABASE: Host: {{ .Values.database.external.host }}:{{ .Values.database.external.port }} {{- end }} -REDIS: +4. Redis + {{- if .Values.redisHttp.enabled }} {{- if .Values.redis.enabled }} Redis: bundled HelmForge subchart @@ -46,7 +46,8 @@ REDIS: Redis HTTP endpoint: external ({{ .Values.redisHttp.external.url }}) {{- end }} -OPERATIONS: +5. Operations + Run Helm tests: helm test {{ .Release.Name }} -n {{ .Release.Namespace }} @@ -54,12 +55,14 @@ OPERATIONS: kubectl get pods -n {{ .Release.Namespace }} -l app.kubernetes.io/instance={{ .Release.Name }} kubectl logs -n {{ .Release.Namespace }} deploy/{{ include "opencut.fullname" . }} -PRODUCTION REMINDERS: +6. Production Reminders + 1. Set opencut.siteUrl and opencut.betterAuthSecret explicitly. 2. Use existingSecret or External Secrets for database and Redis credentials. 3. Enable persistence, resources, NetworkPolicy, and external TLS before exposing publicly. -DOCUMENTATION: +7. Documentation + Chart: https://helmforge.dev/docs/charts/opencut Source: https://github.com/helmforgedev/charts/tree/main/charts/opencut OpenCut: https://github.com/OpenCut-app/OpenCut diff --git a/charts/opencut/templates/networkpolicy.yaml b/charts/opencut/templates/networkpolicy.yaml index 196594874..eaac2c265 100644 --- a/charts/opencut/templates/networkpolicy.yaml +++ b/charts/opencut/templates/networkpolicy.yaml @@ -38,6 +38,9 @@ spec: {{- with .Values.networkPolicy.egress }} {{- toYaml . | nindent 4 }} {{- end }} + {{- with .Values.networkPolicy.extraEgress }} + {{- toYaml . | nindent 4 }} + {{- end }} {{- if .Values.redisHttp.enabled }} --- apiVersion: networking.k8s.io/v1 diff --git a/charts/opencut/tests/networkpolicy_test.yaml b/charts/opencut/tests/networkpolicy_test.yaml index a6a5c0fba..0c464b3f1 100644 --- a/charts/opencut/tests/networkpolicy_test.yaml +++ b/charts/opencut/tests/networkpolicy_test.yaml @@ -157,6 +157,32 @@ tests: value: 8443 documentIndex: 0 + - it: should append extra web egress rules to the defaults + set: + networkPolicy.enabled: true + networkPolicy.extraEgress: + - to: + - ipBlock: + cidr: 10.80.0.0/16 + ports: + - protocol: TCP + port: 443 + asserts: + - contains: + path: spec.egress[0].ports + content: + protocol: UDP + port: 53 + documentIndex: 0 + - equal: + path: spec.egress[2].to[0].ipBlock.cidr + value: 10.80.0.0/16 + documentIndex: 0 + - equal: + path: spec.egress[2].ports[0].port + value: 443 + documentIndex: 0 + - it: should append custom web ingress rules without dropping the default web port set: networkPolicy.enabled: true diff --git a/charts/opencut/tests/test_connection_test.yaml b/charts/opencut/tests/test_connection_test.yaml deleted file mode 100644 index 9465e4d10..000000000 --- a/charts/opencut/tests/test_connection_test.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -suite: Helm Test -templates: - - templates/tests/test-connection.yaml -release: - name: test - namespace: default -tests: - - it: should keep helm test pod name within DNS label length - set: - fullnameOverride: opencut-with-a-very-long-name-that-fills-the-dns-label-limit - asserts: - - matchRegex: - path: metadata.name - pattern: "^.{1,63}$" - - matchRegex: - path: metadata.name - pattern: "-test$" diff --git a/charts/opencut/values.schema.json b/charts/opencut/values.schema.json index 3611e6837..d865fbcf1 100644 --- a/charts/opencut/values.schema.json +++ b/charts/opencut/values.schema.json @@ -185,7 +185,16 @@ "pathType": { "type": "string", "enum": ["Exact", "PathPrefix", "RegularExpression"] } } }, - "networkPolicy": { "type": "object" }, + "networkPolicy": { + "type": "object", + "additionalProperties": true, + "properties": { + "enabled": { "type": "boolean" }, + "ingress": { "type": "array", "items": { "type": "object" } }, + "egress": { "type": "array", "items": { "type": "object" } }, + "extraEgress": { "type": "array", "items": { "type": "object" } } + } + }, "autoscaling": { "type": "object" }, "pdb": { "type": "object" }, "probes": { "type": "object" }, diff --git a/charts/opencut/values.yaml b/charts/opencut/values.yaml index a62a3844f..1b3ed61e9 100644 --- a/charts/opencut/values.yaml +++ b/charts/opencut/values.yaml @@ -398,6 +398,8 @@ networkPolicy: ingress: [] # -- Additional egress rules appended to the OpenCut web policy. egress: [] + # -- Additional full egress rules appended to the OpenCut web policy. + extraEgress: [] # ============================================================================= # Autoscaling and Availability