|
| 1 | +{{- if .Values.meshPolicies.enabled }} |
| 2 | +# ============================================================================= |
| 3 | +# RAG-stack AuthorizationPolicies (migrated from terraform istio_policies.tf). |
| 4 | +# Default mesh policy is deny-all where sidecars are present; these explicitly |
| 5 | +# allow the traffic flows the stack needs. |
| 6 | +# ============================================================================= |
| 7 | + |
| 8 | +# --- Milvus internal traffic (ml-infra) --- |
| 9 | +apiVersion: security.istio.io/v1beta1 |
| 10 | +kind: AuthorizationPolicy |
| 11 | +metadata: |
| 12 | + name: allow-milvus-standalone |
| 13 | + namespace: {{ .Values.namespaces.mlInfra }} |
| 14 | + labels: |
| 15 | + {{- include "gateway-guardrails.labels" . | nindent 4 }} |
| 16 | +spec: |
| 17 | + selector: |
| 18 | + matchLabels: |
| 19 | + app.kubernetes.io/name: milvus |
| 20 | + component: standalone |
| 21 | + action: ALLOW |
| 22 | + rules: |
| 23 | + - to: |
| 24 | + - operation: |
| 25 | + ports: ["19530", "9091"] |
| 26 | +--- |
| 27 | +apiVersion: security.istio.io/v1beta1 |
| 28 | +kind: AuthorizationPolicy |
| 29 | +metadata: |
| 30 | + name: allow-milvus-etcd |
| 31 | + namespace: {{ .Values.namespaces.mlInfra }} |
| 32 | + labels: |
| 33 | + {{- include "gateway-guardrails.labels" . | nindent 4 }} |
| 34 | +spec: |
| 35 | + selector: |
| 36 | + matchLabels: |
| 37 | + app.kubernetes.io/name: etcd |
| 38 | + action: ALLOW |
| 39 | + rules: |
| 40 | + - to: |
| 41 | + - operation: |
| 42 | + ports: ["2379", "2380"] |
| 43 | +--- |
| 44 | +apiVersion: security.istio.io/v1beta1 |
| 45 | +kind: AuthorizationPolicy |
| 46 | +metadata: |
| 47 | + name: allow-milvus-minio |
| 48 | + namespace: {{ .Values.namespaces.mlInfra }} |
| 49 | + labels: |
| 50 | + {{- include "gateway-guardrails.labels" . | nindent 4 }} |
| 51 | +spec: |
| 52 | + selector: |
| 53 | + matchLabels: |
| 54 | + app: minio |
| 55 | + action: ALLOW |
| 56 | + rules: |
| 57 | + - to: |
| 58 | + - operation: |
| 59 | + ports: ["9000", "9001"] |
| 60 | +--- |
| 61 | +# --- Cross-namespace traffic --- |
| 62 | +# docs-agent/mcp-server -> ml-infra/milvus (vector DB queries) |
| 63 | +apiVersion: security.istio.io/v1beta1 |
| 64 | +kind: AuthorizationPolicy |
| 65 | +metadata: |
| 66 | + name: allow-mcp-to-milvus |
| 67 | + namespace: {{ .Values.namespaces.mlInfra }} |
| 68 | + labels: |
| 69 | + {{- include "gateway-guardrails.labels" . | nindent 4 }} |
| 70 | +spec: |
| 71 | + selector: |
| 72 | + matchLabels: |
| 73 | + app.kubernetes.io/name: milvus |
| 74 | + component: standalone |
| 75 | + action: ALLOW |
| 76 | + rules: |
| 77 | + - from: |
| 78 | + - source: |
| 79 | + namespaces: ["{{ .Values.namespaces.docsAgent }}"] |
| 80 | + to: |
| 81 | + - operation: |
| 82 | + ports: ["19530"] |
| 83 | +--- |
| 84 | +# docs-agent/kagent -> ml-infra/qwen-llm (LLM inference) |
| 85 | +apiVersion: security.istio.io/v1beta1 |
| 86 | +kind: AuthorizationPolicy |
| 87 | +metadata: |
| 88 | + name: allow-kagent-to-llm |
| 89 | + namespace: {{ .Values.namespaces.mlInfra }} |
| 90 | + labels: |
| 91 | + {{- include "gateway-guardrails.labels" . | nindent 4 }} |
| 92 | +spec: |
| 93 | + selector: |
| 94 | + matchLabels: |
| 95 | + serving.kserve.io/inferenceservice: qwen-llm |
| 96 | + action: ALLOW |
| 97 | + rules: |
| 98 | + - from: |
| 99 | + - source: |
| 100 | + namespaces: ["{{ .Values.namespaces.docsAgent }}", "{{ .Values.namespaces.istioSystem }}"] |
| 101 | + to: |
| 102 | + - operation: |
| 103 | + ports: ["8080", "8012"] |
| 104 | +--- |
| 105 | +# docs-agent/kagent -> docs-agent/mcp-server (MCP tool calls) |
| 106 | +apiVersion: security.istio.io/v1beta1 |
| 107 | +kind: AuthorizationPolicy |
| 108 | +metadata: |
| 109 | + name: allow-kagent-to-mcp |
| 110 | + namespace: {{ .Values.namespaces.docsAgent }} |
| 111 | + labels: |
| 112 | + {{- include "gateway-guardrails.labels" . | nindent 4 }} |
| 113 | +spec: |
| 114 | + selector: |
| 115 | + matchLabels: |
| 116 | + app: mcp-kubeflow-docs |
| 117 | + action: ALLOW |
| 118 | + rules: |
| 119 | + - from: |
| 120 | + - source: |
| 121 | + namespaces: ["{{ .Values.namespaces.docsAgent }}"] |
| 122 | + to: |
| 123 | + - operation: |
| 124 | + ports: ["8000"] |
| 125 | +--- |
| 126 | +# KFP pipeline pods (kubeflow ns) -> ml-infra/milvus (RAG ingestion) |
| 127 | +apiVersion: security.istio.io/v1beta1 |
| 128 | +kind: AuthorizationPolicy |
| 129 | +metadata: |
| 130 | + name: allow-kubeflow-to-milvus |
| 131 | + namespace: {{ .Values.namespaces.mlInfra }} |
| 132 | + labels: |
| 133 | + {{- include "gateway-guardrails.labels" . | nindent 4 }} |
| 134 | +spec: |
| 135 | + selector: |
| 136 | + matchLabels: |
| 137 | + app.kubernetes.io/name: milvus |
| 138 | + component: standalone |
| 139 | + action: ALLOW |
| 140 | + rules: |
| 141 | + - from: |
| 142 | + - source: |
| 143 | + namespaces: ["{{ .Values.namespaces.kubeflow }}"] |
| 144 | + to: |
| 145 | + - operation: |
| 146 | + ports: ["19530"] |
| 147 | +--- |
| 148 | +# docs-agent/mcp-server -> ml-infra/embeddings-service (query-time embeddings) |
| 149 | +apiVersion: security.istio.io/v1beta1 |
| 150 | +kind: AuthorizationPolicy |
| 151 | +metadata: |
| 152 | + name: allow-mcp-to-embeddings |
| 153 | + namespace: {{ .Values.namespaces.mlInfra }} |
| 154 | + labels: |
| 155 | + {{- include "gateway-guardrails.labels" . | nindent 4 }} |
| 156 | +spec: |
| 157 | + selector: |
| 158 | + matchLabels: |
| 159 | + serving.kserve.io/inferenceservice: embeddings-service |
| 160 | + action: ALLOW |
| 161 | + rules: |
| 162 | + - from: |
| 163 | + - source: |
| 164 | + namespaces: ["{{ .Values.namespaces.docsAgent }}", "{{ .Values.namespaces.istioSystem }}"] |
| 165 | + to: |
| 166 | + - operation: |
| 167 | + ports: ["8080", "80", "8012"] |
| 168 | +--- |
| 169 | +# kubeflow/pipeline pods -> ml-infra/embeddings-service (index-time embeddings) |
| 170 | +apiVersion: security.istio.io/v1beta1 |
| 171 | +kind: AuthorizationPolicy |
| 172 | +metadata: |
| 173 | + name: allow-kubeflow-to-embeddings |
| 174 | + namespace: {{ .Values.namespaces.mlInfra }} |
| 175 | + labels: |
| 176 | + {{- include "gateway-guardrails.labels" . | nindent 4 }} |
| 177 | +spec: |
| 178 | + selector: |
| 179 | + matchLabels: |
| 180 | + serving.kserve.io/inferenceservice: embeddings-service |
| 181 | + action: ALLOW |
| 182 | + rules: |
| 183 | + - from: |
| 184 | + - source: |
| 185 | + namespaces: ["{{ .Values.namespaces.kubeflow }}", "{{ .Values.namespaces.istioSystem }}"] |
| 186 | + to: |
| 187 | + - operation: |
| 188 | + ports: ["8080", "80", "8012"] |
| 189 | +{{- end }} |
0 commit comments