Skip to content

Secure, Fast, and Extensible Sandbox runtime for AI agents.

6.3 KB
Raw Blame
{{/*
fast-sandbox control-plane namespaces, ServiceAccounts, ClusterRoles and
ClusterRoleBindings.

These are the permission layer of the sandbox.fast.io API (mirroring the
kustomize output of fast-sandbox config/ at the pinned commit); the workloads
that bind to these ServiceAccounts live in the fast-sandbox chart. Resource
names are fixed so the fast-sandbox chart can reference them by name.

The upstream fast-sandbox-proxy RBAC is intentionally omitted: OpenSandbox
deployments reach fastlets through the ingress gateway's direct route
resolution and do not deploy the central sandbox-proxy. The standalone
janitor DaemonSet (containerd runtimes) is omitted for the same reason;
the firecracker-runtime pod's janitor sidecar uses the runtime
ServiceAccount above.
*/}}
{{- if .Values.fastSandbox.namespaces.createSystem }}
---
# The shared system namespace hosts the fast-sandbox control-plane
# ServiceAccounts installed below and doubles as the release namespace of
# the controller/server charts. Creating it here lets the documented
# per-component install order work without a preceding
# `kubectl create namespace` or --create-namespace (rendered-manifest
# flows driven by kubectl apply have no namespace bootstrap at all).
# Set fastSandbox.namespaces.createSystem=false when the namespace already
# exists and is managed externally; a pre-existing namespace without Helm
# ownership metadata cannot be adopted into this release.
#
# The namespace carries helm.sh/resource-policy: keep: uninstalling the base
# release must not destroy the shared system namespace together with the
# controller/server workloads running in it. Delete it manually once nothing
# needs it anymore.
apiVersion: v1
kind: Namespace
metadata:
  name: {{ .Values.fastSandbox.namespaces.system }}
  annotations:
    helm.sh/resource-policy: keep
  labels:
    {{- include "opensandbox-base.labels" . | nindent 4 }}
    app.kubernetes.io/component: fast-sandbox
{{- end }}
{{- if .Values.fastSandbox.namespaces.create }}
---
# Only the dataplane namespace is chart-created alongside the system
# namespace above.
#
# The namespace carries helm.sh/resource-policy: keep: uninstalling the base
# release must not destroy the dataplane namespace together with every
# fast-sandbox object and fastlet Pod in it (same policy as the CRDs).
# Delete it manually when its data is no longer needed.
apiVersion: v1
kind: Namespace
metadata:
  name: {{ .Values.fastSandbox.namespaces.resources }}
  annotations:
    helm.sh/resource-policy: keep
  labels:
    {{- include "opensandbox-base.labels" . | nindent 4 }}
    app.kubernetes.io/component: fast-sandbox
{{- end }}
{{- if .Values.fastSandbox.rbac.create }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: fast-sandbox-controller
  namespace: {{ .Values.fastSandbox.namespaces.system }}
  labels:
    {{- include "opensandbox-base.labels" . | nindent 4 }}
    app.kubernetes.io/component: fast-sandbox
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: fast-sandbox-fastpath
  namespace: {{ .Values.fastSandbox.namespaces.system }}
  labels:
    {{- include "opensandbox-base.labels" . | nindent 4 }}
    app.kubernetes.io/component: fast-sandbox
---
# Grants the controller-manager everything it needs to reconcile Sandboxes,
# Pools, Templates and Snapshots and to schedule fastlet Pods.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: fast-sandbox-controller
  labels:
    {{- include "opensandbox-base.labels" . | nindent 4 }}
    app.kubernetes.io/component: fast-sandbox
rules:
- apiGroups:
  - ""
  resources:
  - pods
  - nodes
  verbs:
  - get
  - list
  - watch
  - create
  - update
  - patch
  - delete
- apiGroups:
  - ""
  resources:
  - configmaps
  - secrets
  verbs:
  - get
  - list
  - watch
  - create
  - update
  - patch
  - delete
- apiGroups:
  - ""
  resources:
  - serviceaccounts
  verbs:
  - get
  - create
- apiGroups:
  - rbac.authorization.k8s.io
  resources:
  - roles
  - rolebindings
  verbs:
  - get
  - list
  - watch
  - create
  - update
- apiGroups:
  - ""
  resources:
  - events
  verbs:
  - create
  - patch
  - update
- apiGroups:
  - node.k8s.io
  resources:
  - runtimeclasses
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - sandbox.fast.io
  resources:
  - sandboxes
  - sandboxpools
  - sandboxtemplates
  - sandboxsnapshots
  - sandboxes/status
  - sandboxpools/status
  - sandboxtemplates/status
  - sandboxsnapshots/status
  verbs:
  - get
  - list
  - watch
  - create
  - update
  - patch
  - delete
- apiGroups:
  - coordination.k8s.io
  resources:
  - leases
  verbs:
  - get
  - list
  - watch
  - create
  - update
  - patch
  - delete
---
# Grants the FastPath gRPC API read access to Pools, Sandboxes and Snapshots.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: fast-sandbox-fastpath
  labels:
    {{- include "opensandbox-base.labels" . | nindent 4 }}
    app.kubernetes.io/component: fast-sandbox
rules:
- apiGroups:
  - ""
  resources:
  - pods
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - sandbox.fast.io
  resources:
  - sandboxpools
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - sandbox.fast.io
  resources:
  - sandboxes
  - sandboxes/status
  verbs:
  - get
  - list
  - watch
  - create
  - update
  - patch
  - delete
- apiGroups:
  - sandbox.fast.io
  resources:
  - sandboxsnapshots
  - sandboxsnapshots/status
  verbs:
  - get
  - list
  - watch
  - create
  - update
  - patch
  - delete
- apiGroups:
  - ""
  resources:
  - secrets
  verbs:
  - get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: fast-sandbox-controller
  labels:
    {{- include "opensandbox-base.labels" . | nindent 4 }}
    app.kubernetes.io/component: fast-sandbox
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: fast-sandbox-controller
subjects:
- kind: ServiceAccount
  name: fast-sandbox-controller
  namespace: {{ .Values.fastSandbox.namespaces.system }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: fast-sandbox-fastpath
  labels:
    {{- include "opensandbox-base.labels" . | nindent 4 }}
    app.kubernetes.io/component: fast-sandbox
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: fast-sandbox-fastpath
subjects:
- kind: ServiceAccount
  name: fast-sandbox-fastpath
  namespace: {{ .Values.fastSandbox.namespaces.system }}
{{- end }}