TFRTenant Deployment
Deploy TFRTenant tenant environment.
Overview
TFRTenant is a namespace-scoped resource that creates tenant-isolated environments and middleware instances:
- Namespace - Tenant-dedicated namespace
- PostgreSQL - Database cluster via CloudNativePG
- MinIO - Object storage instance
- Redis - Caching service
- RabbitMQ - Message queue
- Grafana - Monitoring dashboard (optional)
- Jaeger - Distributed tracing (optional)
TFRTenant depends on Operators installed by TFRCluster. Ensure TFRCluster status is Available before deployment.
Configuration
Core Fields
| Field | Description | Example |
|---|---|---|
name | TFRTenant resource name | enaic |
namespace | Tenant namespace (auto-created) | staging-tenant |
tenantType | Tenant type | enterprise, personal |
storage | Storage configuration | See below |
imagePullSecrets | Private registry credentials reference | See below |
Storage Configuration
storage:
enabled: true
storageClass: "cbs" # TKE uses cbs, Kind uses standard
defaultSize: "10Gi" # Default storage size for components
- Tencent Cloud TKE:
cbs(Cloud Block Storage) - Kind / Docker Desktop:
standard - Shared Cache: Requires RWX-capable storage class (e.g.,
cfs)
Private Registry Credentials
Reference Secret created by TFRCluster:
imagePullSecrets:
- secretName: "tfrs-private-registry"
sourceNamespace: "tfr-image-credentials"
Component Configuration
Each component supports independent storage and credential configuration, inheriting tenant-level config when not specified:
postgresql:
enabled: false # Enable component-level config
username: "" # Defaults to TFRobotID
password: "" # Auto-generated by default
storage:
storageClass: "" # Inherits from tenant-level
defaultSize: "10Gi"
grafana:
enabled: true
adminUser: "admin"
adminPassword: "admin" # Use strong password in production
Example Configurations
Project provides example configurations:
chart/tfrtenant/values-staging.yaml- Staging environmentchart/tfrtenant/values-prod.yaml- Production environmentchart/tfrtenant/values-kind.yaml- Local development environment
Kustomize Deployment
Create CR Manifest
# tfrtenant-staging.yaml
apiVersion: infra.tfrobotserver.cn/v1
kind: TFRTenant
metadata:
name: enaic
spec:
# Tenant type (Required)
tenantType: enterprise
# Tenant namespace (Required)
namespace: staging-tenant
# Storage configuration
storage:
storageClass: "cbs" # TKE uses cbs, Kind uses standard
defaultSize: "10Gi"
# Private registry credentials (Reference Secret created by TFRCluster)
imagePullSecrets:
- secretName: "tfrs-private-registry"
sourceNamespace: "tfr-image-credentials"
# Grafana configuration
grafana:
adminUser: "admin"
adminPassword: "your-secure-password" # Use strong password in production
tenantTypeandnamespaceare required fields- The
enabledfield in Helm values files is for Chart rendering logic, not needed in CR - Full field reference:
config/samples/infra_v1_tfrtenant.yaml
Deploy
kubectl apply -f tfrtenant-staging.yaml
# tfrtenant.infra.tfrobotserver.cn/enaic created
Verify
kubectl get tfrtenant
kubectl get tfrtenant enaic -o json | jq '.status.components | to_entries[] | "\(.key): \(.value.state)"'
Real-time deployment monitoring
while true; do clear; echo "--- $(date +%H:%M:%S) ---"; \
echo "=== Conditions ==="; \
kubectl get tfrtenant enaic -o json 2>/dev/null \
| jq -r '.status.conditions[]? | "\(.type): \(.status) - \(.message)"'; \
echo; echo "=== Components ==="; \
kubectl get tfrtenant enaic -o json 2>/dev/null \
| jq -r '.status.components // {} | to_entries[] | "\(.key): \(.value.state)"'; \
echo; echo "=== Pods ==="; \
kubectl get pods -n staging-tenant 2>/dev/null; \
sleep 10; done
Press Ctrl+C to exit.
Determine Deployment Completion
TFRTenant indicates deployment status via the Ready condition in status.conditions:
# Check Ready condition
kubectl get tfrtenant enaic -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}'
# True = deployment complete, False = deploying or failed
# Automation script: wait for deployment to complete (10 minute timeout)
kubectl wait tfrtenant enaic --for=condition=Ready --timeout=600s
Uninstall
kubectl delete tfrtenant enaic
Helm Deployment
Deploy
Install from OCI registry
helm install tfrtenant oci://helm.cnb.cool/turingfocus/tfrs-operator/tfrtenant \
--version 0.1.0 \
--set name=enaic \
--set namespace=staging-tenant \
--set storage.enabled=true \
--set storage.storageClass=cbs \
--set grafana.enabled=true
Install with values file
helm install tfrtenant oci://helm.cnb.cool/turingfocus/tfrs-operator/tfrtenant \
--version 0.1.0 \
-f values-staging.yaml
Install from local source
helm install tfrtenant ./chart/tfrtenant \
-f chart/tfrtenant/values-staging.yaml
TFRTenant is a cluster-scoped resource, no need to specify --namespace. The tenant namespace is specified by the namespace field, and the Controller creates it automatically.
Verify
# Check TFRTenant status
kubectl get tfrtenant
# Wait for deployment to complete (10 minute timeout)
kubectl wait tfrtenant enaic --for=condition=Available --timeout=600s
# View components in tenant namespace
kubectl get pods -n staging-tenant
Real-time deployment monitoring
while true; do clear; echo "--- $(date +%H:%M:%S) ---"; \
echo "=== Conditions ==="; \
kubectl get tfrtenant enaic -o json 2>/dev/null \
| jq -r '.status.conditions[]? | "\(.type): \(.status) - \(.message)"'; \
echo; echo "=== Components ==="; \
kubectl get tfrtenant enaic -o json 2>/dev/null \
| jq -r '.status.components // {} | to_entries[] | "\(.key): \(.value.state)"'; \
echo; echo "=== Pods ==="; \
kubectl get pods -n staging-tenant 2>/dev/null; \
sleep 10; done
Press Ctrl+C to exit.
Determine Deployment Completion
TFRTenant indicates deployment status via the Ready condition in status.conditions:
# Check Ready condition
kubectl get tfrtenant enaic -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}'
# True = deployment complete, False = deploying or failed
# Automation script: wait for deployment to complete (10 minute timeout)
kubectl wait tfrtenant enaic --for=condition=Ready --timeout=600s
Uninstall
helm uninstall tfrtenant
Uninstalling TFRTenant will delete the tenant namespace and all its resources (databases, storage, etc.). Ensure important data is backed up.