Open-source inference server and production cluster for all the models your agent needs.
Python bgecolbertdata-pipelinedeep-learningembeddingsinferenceinference-serverinformation-retrievalllmmlmlopsnatural-language-processingnlppythonrerankingretrievalretrieval-augmented-generationsemantic-searchspladevector-search
{{- $root := . -}}
{{- if eq (include "sie-cluster.worker.remoteNetworkPolicyEnabled" $root) "true" }}
{{- $policy := dig "remote" "networkPolicy" dict $root.Values.workers -}}
{{- $dnsTo := dig "dnsTo" list $policy -}}
{{- if not (and (kindIs "slice" $dnsTo) $dnsTo) -}}
{{- fail "workers.remote.networkPolicy.dnsTo needs at least one peer: the cluster resolver the remote lanes may query." -}}
{{- end -}}
{{- include "sie-cluster.networkPolicy.validatePeers" (dict "peers" $dnsTo "path" "workers.remote.networkPolicy.dnsTo") -}}
{{- range $index, $rule := (default list $policy.extraEgress) }}
{{- if not (and (kindIs "map" $rule) $rule.to $rule.ports) }}
{{- fail (printf "workers.remote.networkPolicy.extraEgress[%d] needs a non-empty to and ports: a rule without them admits every destination or every port." $index) }}
{{- end }}
{{- include "sie-cluster.networkPolicy.validatePeers" (dict "peers" $rule.to "path" (printf "workers.remote.networkPolicy.extraEgress[%d].to" $index)) }}
{{- include "sie-cluster.networkPolicy.validatePorts" (dict "ports" $rule.ports "path" (printf "workers.remote.networkPolicy.extraEgress[%d].ports" $index)) }}
{{- end }}
{{- $deniedV4 := list }}
{{- $deniedV6 := list }}
{{- range $cidr := (include "sie-cluster.worker.remoteDeniedCidrs" $root | fromJsonArray) }}
{{- if contains ":" $cidr }}
{{- $deniedV6 = append $deniedV6 $cidr }}
{{- else }}
{{- $deniedV4 = append $deniedV4 $cidr }}
{{- end }}
{{- end }}
{{- $allowed := list }}
{{- range $index, $cidr := (default list $policy.allowedCidrs) }}
{{- $field := printf "workers.remote.networkPolicy.allowedCidrs[%d]" $index }}
{{- if not (kindIs "string" $cidr) }}
{{- fail (printf "%s must be a CIDR string" $field) }}
{{- end }}
{{- if contains ":" $cidr }}
{{- if ne $cidr "::/0" }}
{{- fail (printf "%s: the only IPv6 entry is ::/0, which carries every denied IPv6 range as an exception. Admit a narrower IPv6 destination with extraEgress." $field) }}
{{- end }}
{{- range $deniedCidr := $deniedV6 }}
{{- $denied := include "sie-cluster.cidr.ipv6" (dict "cidr" $deniedCidr "field" "a denied range") | fromJson }}
{{- if eq (int $denied.prefix) 0 }}
{{- fail (printf "%s lies inside the denied range %s. Admit a private destination with extraEgress." $field $deniedCidr) }}
{{- end }}
{{- end }}
{{- $allowed = append $allowed (dict "cidr" $cidr "except" $deniedV6) }}
{{- else }}
{{- $block := include "sie-cluster.cidr.ipv4" (dict "cidr" $cidr "field" $field) | fromJson }}
{{- $except := list }}
{{- range $deniedCidr := $deniedV4 }}
{{- $denied := include "sie-cluster.cidr.ipv4" (dict "cidr" $deniedCidr "field" "a denied range") | fromJson }}
{{- if eq (include "sie-cluster.cidr.ipv4Within" (dict "inner" $block "outer" $denied)) "true" }}
{{- fail (printf "%s lies inside the denied range %s. Admit a private destination with extraEgress." $field $deniedCidr) }}
{{- else if eq (include "sie-cluster.cidr.ipv4Within" (dict "inner" $denied "outer" $block)) "true" }}
{{- $except = append $except $deniedCidr }}
{{- end }}
{{- end }}
{{- $allowed = append $allowed (dict "cidr" $cidr "except" $except) }}
{{- end }}
{{- end }}
{{- /* The ports of what the lane connects to directly: 443, and each upstream's
explicit port, or its proxy's when a proxy carries its traffic. A URL
without a port adds nothing, and a loopback upstream needs no egress. */ -}}
{{- $ports := list 443 }}
{{- range $name, $upstream := (default dict $root.Values.upstreams) }}
{{- $url := $upstream.proxy_url | default $upstream.base_url | toString }}
{{- $authority := regexReplaceAll "^[A-Za-z]+://([^/]*).*$" $url "${1}" }}
{{- if not (regexMatch "(?i)^(localhost|127\\.[0-9.]+|\\[::1\\])(:[0-9]*)?$" $authority) }}
{{- with regexFind ":[0-9]+$" $authority }}
{{- $port := trimPrefix ":" . | atoi }}
{{- if not (has $port $ports) }}
{{- $ports = append $ports $port }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- $maxWorkerChildCount := int (include "sie-cluster.worker.maxChildCount" $root) }}
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{ include "sie-cluster.fullname" $root }}-worker-remote
namespace: {{ include "sie-cluster.namespace" $root }}
labels:
{{- include "sie-cluster.worker.labels" $root | nindent 4 }}
spec:
podSelector:
matchLabels:
{{- include "sie-cluster.worker.selectorLabels" $root | nindent 6 }}
sie.superlinked.com/bundle: remote
policyTypes:
- Ingress
- Egress
ingress:
- from:
- podSelector:
matchLabels:
{{- include "sie-cluster.gateway.selectorLabels" $root | nindent 14 }}
{{- if include "sie-cluster.workers.authEnforced" $root }}
- podSelector:
matchLabels:
{{- include "sie-cluster.workers.authTestSelectorLabels" $root | nindent 14 }}
{{- end }}
ports:
{{- range $i := until $maxWorkerChildCount }}
- port: {{ add $root.Values.workers.common.port $i }}
protocol: TCP
{{- end }}
egress:
- to:
{{- toYaml $dnsTo | nindent 8 }}
ports:
- port: 53
protocol: UDP
- port: 53
protocol: TCP
{{- if $root.Values.nats.install }}
- to:
- podSelector:
matchLabels:
app.kubernetes.io/name: nats
app.kubernetes.io/instance: {{ $root.Release.Name }}
ports:
- port: 4222
protocol: TCP
{{- end }}
- to:
- podSelector:
matchLabels:
{{- include "sie-cluster.config.selectorLabels" $root | nindent 14 }}
- podSelector:
matchLabels:
{{- include "sie-cluster.gateway.selectorLabels" $root | nindent 14 }}
ports:
- port: 8080
protocol: TCP
{{- if eq (include "sie-cluster.otel.collectorEnabled" $root) "true" }}
- to:
- podSelector:
matchLabels:
{{- include "sie-cluster.selectorLabels" $root | nindent 14 }}
app.kubernetes.io/component: otel-collector
ports:
- port: 4327
protocol: TCP
{{- end }}
{{- if $root.Values.observability.tracing.tempo.install }}
- to:
- podSelector:
matchLabels:
app.kubernetes.io/name: tempo
app.kubernetes.io/instance: {{ $root.Release.Name }}
ports:
- port: 4317
protocol: TCP
{{- end }}
{{- with $allowed }}
- to:
{{- range $block := . }}
- ipBlock:
cidr: {{ $block.cidr | quote }}
{{- with $block.except }}
except:
{{- toYaml . | nindent 14 }}
{{- end }}
{{- end }}
ports:
{{- range $port := $ports }}
- port: {{ $port }}
protocol: TCP
{{- end }}
{{- end }}
{{- with $policy.extraEgress }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}