mirror of
https://github.com/NVIDIA/OpenShell.git
synced 2026-10-16 05:20:22 +08:00
36 lines
1.2 KiB
YAML
36 lines
1.2 KiB
YAML
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
{{- if .Values.networkPolicy.enabled }}
|
|
# NetworkPolicy restricting SSH ingress on sandbox pods to the gateway pod.
|
|
# Sandbox pods are dynamically created by the server and labelled with
|
|
# openshell.ai/managed-by=openshell. This policy ensures only the gateway
|
|
# (openshell server) pod can reach the sandbox SSH port (2222), blocking
|
|
# lateral movement from other in-cluster workloads.
|
|
apiVersion: networking.k8s.io/v1
|
|
kind: NetworkPolicy
|
|
metadata:
|
|
name: {{ include "openshell.fullname" . }}-sandbox-ssh
|
|
namespace: {{ include "openshell.sandboxNamespace" . }}
|
|
labels:
|
|
{{- include "openshell.labels" . | nindent 4 }}
|
|
spec:
|
|
podSelector:
|
|
matchLabels:
|
|
openshell.ai/managed-by: openshell
|
|
policyTypes:
|
|
- Ingress
|
|
ingress:
|
|
- from:
|
|
- namespaceSelector:
|
|
matchLabels:
|
|
kubernetes.io/metadata.name: {{ .Release.Namespace }}
|
|
podSelector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: {{ include "openshell.name" . }}
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
ports:
|
|
- protocol: TCP
|
|
port: 2222
|
|
{{- end }}
|