Skip to main content
Version: Next 🚧

TFRServer Deployment

Deploy TFRServer service instances.

Overview

TFRServer is a namespace-scoped resource deployed in the tenant namespace created by TFRTenant, managing individual TFRobot server instances:

  • API Server - Main service process
  • Worker - Async task processing
  • RobotWorker - Robot task processing
  • Confz Config - Maps 1:1 to TFRobotServer TOML config; user-specified values override system-generated values
  • Secret / ConfigMap - Third-party API Keys and environment variables
Prerequisites

TFRServer depends on the tenant namespace and middleware created by TFRTenant. Ensure TFRTenant status is Available before deployment.


Configuration

Core Fields

FieldDescriptionExample
nameTFRServer resource name (i.e. robotId)friday
namespaceTenant namespace (created by TFRTenant)staging-tenant
confzDataConfz structured configSee below
secretDataSensitive env vars (API Keys, etc.)See below
configDataNon-sensitive env varsSee below

Confz Config

confzData maps 1:1 to TFRobotServer's TOML config. Most fields are dynamically generated by the system (postgresql, redis, celery, cos, grafana, etc.). Typically only the following fields need configuration:

confzData:
admin:
adminSecret: "<admin-secret>"
jwtSecret: "<jwt-signing-secret>"
password: "<argon2-hashed-password>"
robot:
robotId: "friday"
host: "https://staging.turingfocus.cn"
dbSchema: "tfrobot"
sessionSecret: "<session-secret>"
loguru:
level: "INFO"
feature:
uploadFileSizeLimitMb: "50"
System-Generated Fields

postgresql, redis, celery, cos, grafana, otlp configs are auto-generated by the Controller based on TFRTenant middleware status. To override, explicitly specify them in confzData.

Image Configuration (Optional)

apiImage: "docker.cnb.cool/turingfocus/tfrobotv2/tfrobotserver:latest"
workerImage: "docker.cnb.cool/turingfocus/tfrobotv2/tfrobotserver:latest"
robotWorkerImage: "docker.cnb.cool/turingfocus/tfrobotv2/tfrobotserver:latest"
imagePullPolicy: "IfNotPresent"
imagePullSecret: "tfrs-private-registry"

Uses Controller's built-in default images when not specified.

Storage Configuration (Optional)

storage:
storageClass: "cbs"
defaultSize: "10Gi"

Inherits from TFRTenant or TFRCluster config when not specified.


Sample Configs

  • config/samples/tfrobot_v1_tfrserver_staging.yaml - Staging environment (with full field comments)
  • config/samples/tfrobot_v1_tfrserver.yaml - General template (TODO placeholders)

Kustomize Deployment

Create CR Manifest

# tfrserver-staging.yaml
apiVersion: tfrobot.tfrobotserver.cn/v1
kind: TFRServer
metadata:
name: friday
namespace: "staging-tenant"
spec:
confzData:
admin:
adminSecret: "<admin-secret>"
jwtSecret: "<jwt-signing-secret>"
password: "<argon2-hashed-password>"
robot:
robotId: "friday"
host: "https://staging.turingfocus.cn"
dbSchema: "tfrobot"
sessionSecret: "<session-secret>"
loguru:
level: "INFO"
feature:
uploadFileSizeLimitMb: "50"

imagePullSecret: "tfrs-private-registry"

secretData:
OPENAI_API_KEY: "<your-openai-key>"
ANTHROPIC_API_KEY: "<your-anthropic-key>"
# ... other API Keys

configData:
TFS_PROFILE: "tkeprod"
OPENAI_BASE_URL: "https://api.openai-proxy.org/v1"
ANTHROPIC_BASE_URL: "https://api.openai-proxy.org/anthropic"
TOKENIZERS_PARALLELISM: "false"
Full Field Reference

Full staging config example: config/samples/tfrobot_v1_tfrserver_staging.yaml

Deploy

kubectl apply -f tfrserver-staging.yaml
# tfrserver.tfrobot.tfrobotserver.cn/friday created

Verify

# Check TFRServer status
kubectl get tfrserver -n staging-tenant

# Wait for deployment to complete (timeout 10 minutes)
kubectl wait tfrserver friday -n staging-tenant --for=condition=Available --timeout=600s

# Check component status
kubectl get tfrserver friday -n staging-tenant -o jsonpath='{.status.components}' | jq

# Check service URL
kubectl get tfrserver friday -n staging-tenant -o jsonpath='{.status.serviceURL}'

Monitor deployment progress in real-time

watch -n 5 'echo "=== TFRServer Status ===" && \
kubectl get tfrserver friday -n staging-tenant -o jsonpath="{.status.conditions[0].message}" && \
echo && echo && \
echo "=== Pods ===" && \
kubectl get pods -n staging-tenant -l app.kubernetes.io/instance=friday'

Check Deployment Completion

TFRServer uses the Available condition in status.conditions to indicate deployment status:

# Check Available condition
kubectl get tfrserver friday -n staging-tenant -o jsonpath='{.status.conditions[?(@.type=="Available")].status}'
# True = deployment complete, False = deploying or failed

# Automation script: wait for deployment (timeout 10 minutes)
kubectl wait tfrserver friday -n staging-tenant --for=condition=Available --timeout=600s

Uninstall

kubectl delete tfrserver friday -n staging-tenant

Helm Deployment

Deploy

Install from OCI registry

helm install tfrserver oci://helm.cnb.cool/turingfocus/tfrs-operator/tfrserver \
--version 0.2.0-alpha1 \
--namespace staging-tenant \
-f values-staging.yaml

Install with values file

helm install tfrserver oci://helm.cnb.cool/turingfocus/tfrs-operator/tfrserver \
--version 0.2.0-alpha1 \
--namespace staging-tenant \
-f values-staging.yaml \
--set confzData.admin.adminSecret="<SECRET>" \
--set confzData.admin.jwtSecret="<SECRET>"

Install from local source

helm install tfrserver ./chart/tfrserver \
--namespace staging-tenant \
-f chart/tfrserver/values-staging.yaml
Note

TFRServer requires --namespace, which must match the namespace field in the values file — the tenant namespace created by TFRTenant.

Verify

# Check TFRServer status
kubectl get tfrserver -n staging-tenant

# Wait for deployment to complete (timeout 10 minutes)
kubectl wait tfrserver friday -n staging-tenant --for=condition=Available --timeout=600s

# Check component status
kubectl get tfrserver friday -n staging-tenant -o jsonpath='{.status.components}' | jq

# Check service URL
kubectl get tfrserver friday -n staging-tenant -o jsonpath='{.status.serviceURL}'

Monitor deployment progress in real-time

while true; do clear; echo "--- $(date +%H:%M:%S) ---"; \
echo "=== Conditions ==="; \
kubectl get tfrserver friday -n staging-tenant -o json 2>/dev/null \
| jq -r '.status.conditions[]? | "\(.type): \(.status) - \(.message)"'; \
echo; echo "=== Components ==="; \
kubectl get tfrserver friday -n staging-tenant -o json 2>/dev/null \
| jq -r '.status.components // {} | to_entries[] | "\(.key): \(.value.state)"'; \
echo; echo "=== Pods ==="; \
kubectl get pods -n staging-tenant -l app.kubernetes.io/instance=friday 2>/dev/null; \
sleep 10; done

Press Ctrl+C to exit.

Check Deployment Completion

TFRServer uses the Available condition in status.conditions to indicate deployment status:

# Check Available condition
kubectl get tfrserver friday -n staging-tenant -o jsonpath='{.status.conditions[?(@.type=="Available")].status}'
# True = deployment complete, False = deploying or failed

# Automation script: wait for deployment (timeout 10 minutes)
kubectl wait tfrserver friday -n staging-tenant --for=condition=Available --timeout=600s

Uninstall

helm uninstall tfrserver -n staging-tenant
Note

Uninstalling TFRServer removes the service instance and its associated Secrets, ConfigMaps, Jobs, etc. Database data is preserved in TFRTenant's PostgreSQL.