rdev/scripts/create-credentials-secret.sh
jordan 538ea57ed4 feat: Add claude-config API, security hardening, and testing infrastructure
Claude Config API (v0.6):
- Add CRUD endpoints for commands, skills, and agents
- Commands/skills/agents stored in /workspace/.claude/ (per-project, in git)
- Credentials shared via PVC at /root/.claude/ (shared across pods)
- Use base64 encoding for file writes (prevents shell injection)
- Add content size limits (1MB max)

Security Hardening:
- Add sanitize package for command/prompt validation
- Add rate limiting middleware (token bucket algorithm)
- Add concurrent command limiting
- Add input sanitization to all command handlers
- Gitignore secrets.yaml and credentials.yaml
- Add *.example templates for secrets

Testing Infrastructure:
- Add testutil package with mocks and fixtures
- Add unit tests for auth package (63% coverage)
- Add unit tests for executor (47% coverage)
- Add handler integration tests (40% coverage)
- Add 100% coverage for sanitize, cmdlimit packages
- Add 96% coverage for ratelimit package

Infrastructure:
- Shared Claude credentials PVC (ReadWriteMany)
- Reduced workspace PVC size from 20Gi to 5Gi
- Add init container cleanup before git clone
- Document Longhorn RWX requirements

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 01:29:13 -07:00

38 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# Create Kubernetes secret from local Claude credentials
# Run this after authenticating with `claude` locally
set -e
# Ensure kubeconfig is set
if [[ -z "$KUBECONFIG" ]]; then
echo "Error: KUBECONFIG not set"
echo "Run: export KUBECONFIG=~/.kube/orchard9-k3sf.yaml"
exit 1
fi
# Check if Claude credentials exist
CLAUDE_DIR="$HOME/.claude"
if [[ ! -d "$CLAUDE_DIR" ]]; then
echo "Error: Claude credentials not found at $CLAUDE_DIR"
echo "Run 'claude' first to authenticate"
exit 1
fi
# Create namespace if it doesn't exist
kubectl create namespace rdev --dry-run=client -o yaml | kubectl apply -f -
# Create secret from the .claude directory
echo "Creating claude-credentials secret from $CLAUDE_DIR..."
# We need to create the secret with all files in ~/.claude
kubectl create secret generic claude-credentials \
--namespace=rdev \
--from-file="$CLAUDE_DIR" \
--dry-run=client -o yaml | kubectl apply -f -
echo "Secret created successfully!"
echo ""
echo "Verify with:"
echo " kubectl get secret claude-credentials -n rdev"