tars2k8s-cli
v2.0.2
Published
CLI tool for Tars to Kubernetes deployment automation
Downloads
57
Maintainers
Readme
@tengits/tars2k8s
CLI tool for automating Tars to Kubernetes deployment workflows.
Installation
npm install -g @tengits/tars2k8sUsage
Initialize Configuration
tars2k8s initThis creates .tars2k8s/deploy-config.yaml in your project.
Generate Tars Configuration
tars2k8s conf
tars2k8s conf --module <module-name>Generate Dockerfiles
tars2k8s docker
tars2k8s docker --module <module-name>Build Docker Images
tars2k8s build --version v1.0.0
tars2k8s build --version v1.0.0 --module <module-name> --pushGenerate Helm Charts
tars2k8s helm
tars2k8s helm --module <module-name>Configuration
Edit .tars2k8s/deploy-config.yaml:
project:
tarsAppName: MyApp
k8sAppName: my-app
docker:
registry:
url: docker.io
username: user
token: token
harborNameSpace: mynamespace
imagePrefix: prefix
autoLogin: true
services:
- moduleName: my-service
serverName: MyServer
servants:
- name: MyObj
port: 10001
protocol: tars
build:
- commonModule: commonFeatures
- ✅ Auto-detect Java/Node.js projects
- ✅ Generate Tars configuration files
- ✅ Generate Dockerfiles
- ✅ Build and push Docker images
- ✅ Generate Helm charts with best practices
- ✅ Multi-port support
- ✅ Health probes
- ✅ Resource limits
- ✅ Persistent volumes
- ✅ Frontend multi-environment support - ConfigMap env injection for entrypoint.sh compatibility
Frontend Multi-Environment Deployment
For frontend projects using entrypoint.sh to generate runtime config from environment variables:
Quick Start
# Generate Helm chart with env config support
tars2k8s helm --module frontend --env-config
# Or manually create values files
cat > values-test.yaml <<EOF
env:
REACT_APP_PRE_RELEASE: "test"
REACT_APP_API_URL: "https://test-api.example.com"
EOF
# Deploy to test environment
helm install myapp-test . -f values-test.yaml -n my-namespaceEnvironment Variables
The Helm chart creates a ConfigMap with your environment variables and injects them via envFrom:
# In values.yaml
env:
REACT_APP_PRE_RELEASE: "dev"
REACT_APP_API_URL: "https://api.example.com"These variables are then read by entrypoint.sh to generate the runtime config:
#!/bin/sh
# entrypoint.sh example
env | grep "^REACT_APP_" | while read -r line; do
# Process and write to config file
done
exec "$@"Multi-Environment Example
# Test environment
helm install tymh-test . -f values-test.yaml -n cf-jtlab-prod
# Pre-release environment
helm install tymh-pre . -f values-pre.yaml -n cf-jtlab-prod
# Production environment
helm install tymh-prod . -f values-prod.yaml -n cf-jtlab-prodSee templates/helm-frontend/README.md for detailed documentation.
License
ISC
