This is an automated email from the ASF dual-hosted git repository.
hsluoyz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/casbin-gateway.git
The following commit(s) were added to refs/heads/master by this push:
new bbbcb49 chore: remove Kubernetes deployment files
bbbcb49 is described below
commit bbbcb4993ef64bfad4433767521594c53c2c8319
Author: Yang Luo <[email protected]>
AuthorDate: Mon Aug 17 12:38:24 2026 +0800
chore: remove Kubernetes deployment files
---
README.md | 35 +++--
k8s/.env.example | 30 ----
k8s/README.md | 374 -------------------------------------------------
k8s/configmap.yaml | 46 ------
k8s/deploy.sh | 131 -----------------
k8s/deployment.yaml | 121 ----------------
k8s/ingress.yaml | 28 ----
k8s/kustomization.yaml | 22 ---
k8s/namespace.yaml | 5 -
k8s/pvc.yaml | 13 --
k8s/secret.yaml | 12 --
11 files changed, 20 insertions(+), 797 deletions(-)
diff --git a/README.md b/README.md
index 37f39eb..406a66b 100644
--- a/README.md
+++ b/README.md
@@ -1,35 +1,41 @@
<h1 align="center" style="border-bottom: none;">📦⚡️ Casbin Gateway</h1>
<h3 align="center">An open-source Web Application Firewall (WAF) software
developed by Go and React.</h3>
<p align="center">
- <a href="#badge">
- <img alt="semantic-release"
src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg">
+ <a
href="https://github.com/apache/casbin-gateway/actions/workflows/golangci-lint.yml">
+ <img alt="Lint"
src="https://github.com/apache/casbin-gateway/actions/workflows/golangci-lint.yml/badge.svg">
</a>
- <a href="https://hub.docker.com/r/casbin/caswaf">
- <img alt="docker pull casbin/caswaf"
src="https://img.shields.io/docker/pulls/casbin/caswaf.svg">
+ <a
href="https://github.com/apache/casbin-gateway/actions/workflows/build.yml">
+ <img alt="Build"
src="https://github.com/apache/casbin-gateway/actions/workflows/build.yml/badge.svg">
+ </a>
+ <a href="https://pkg.go.dev/github.com/apache/casbin-gateway">
+ <img alt="Go Reference"
src="https://pkg.go.dev/badge/github.com/apache/casbin-gateway.svg">
</a>
<a href="https://github.com/apache/casbin-gateway/releases/latest">
<img alt="GitHub Release"
src="https://img.shields.io/github/v/release/apache/casbin-gateway.svg">
</a>
- <a href="https://hub.docker.com/r/casbin/caswaf">
- <img alt="Docker Image Version (latest semver)"
src="https://img.shields.io/badge/Docker%20Hub-latest-brightgreen">
- </a>
</p>
<p align="center">
- <a href="https://goreportcard.com/report/github.com/apache/casbin-gateway">
- <img alt="Go Report Card"
src="https://goreportcard.com/badge/github.com/apache/casbin-gateway?style=flat-square">
+ <a href="https://hub.docker.com/r/casbin/caswaf">
+ <img alt="docker pull casbin/caswaf"
src="https://img.shields.io/docker/pulls/casbin/caswaf.svg">
+ </a>
+ <a href="https://hub.docker.com/r/casbin/caswaf">
+ <img alt="Docker Image Version (latest semver)"
src="https://img.shields.io/badge/Docker%20Hub-latest-brightgreen">
</a>
<a href="https://github.com/apache/casbin-gateway/blob/master/LICENSE">
- <img
src="https://img.shields.io/github/license/apache/casbin-gateway?style=flat-square"
alt="license">
+ <img alt="license"
src="https://img.shields.io/github/license/apache/casbin-gateway">
</a>
<a href="https://github.com/apache/casbin-gateway/issues">
- <img alt="GitHub issues"
src="https://img.shields.io/github/issues/apache/casbin-gateway?style=flat-square">
+ <img alt="GitHub issues"
src="https://img.shields.io/github/issues/apache/casbin-gateway">
</a>
- <a href="#">
- <img alt="GitHub stars"
src="https://img.shields.io/github/stars/apache/casbin-gateway?style=flat-square">
+ <a href="https://github.com/apache/casbin-gateway/stargazers">
+ <img alt="GitHub stars"
src="https://img.shields.io/github/stars/apache/casbin-gateway">
</a>
<a href="https://github.com/apache/casbin-gateway/network">
- <img alt="GitHub forks"
src="https://img.shields.io/github/forks/apache/casbin-gateway?style=flat-square">
+ <img alt="GitHub forks"
src="https://img.shields.io/github/forks/apache/casbin-gateway">
+ </a>
+ <a href="https://discord.gg/S5UjpzGZjN">
+ <img alt="Discord"
src="https://img.shields.io/discord/1022748306096537660?logo=discord&label=discord&color=5865F2">
</a>
</p>
@@ -57,7 +63,6 @@ Casbin Gateway runs standalone out of the box: it stores its
data in a local SQL
### Deployment Options
-- **[Kubernetes Deployment](k8s/README.md)**: Deploy Casbin Gateway on
Kubernetes with complete manifests and guide
- **Docker Compose**: Use the provided `docker-compose.yml` for quick local
setup
- **Manual Installation**: Build and run from source
diff --git a/k8s/.env.example b/k8s/.env.example
deleted file mode 100644
index 9a0b745..0000000
--- a/k8s/.env.example
+++ /dev/null
@@ -1,30 +0,0 @@
-# Example configuration for Casbin Gateway Kubernetes deployment
-# Copy this file and modify for your environment
-
-# Database Configuration
-CASBIN_GATEWAY_DRIVER_NAME=sqlite
-CASBIN_GATEWAY_DATA_SOURCE_NAME=/data/casbin-gateway.db
-
-# Casdoor Configuration
-CASDOOR_ENDPOINT=http://casdoor.casdoor-system.svc.cluster.local:8000
-CASDOOR_CLIENT_ID=your-client-id-here
-CASDOOR_CLIENT_SECRET=your-client-secret-here
-CASDOOR_ORGANIZATION=built-in
-CASDOOR_APPLICATION=app-casdoor-gateway
-CASDOOR_INSECURE_SKIP_VERIFY=true
-
-# Casbin Gateway Configuration
-CASBIN_GATEWAY_HTTP_PORT=17000
-CASBIN_GATEWAY_RUN_MODE=prod
-
-# Ingress Configuration
-CASBIN_GATEWAY_DOMAIN=casbin-gateway.example.com
-
-# Storage for the SQLite database
-CASBIN_GATEWAY_STORAGE_SIZE=10Gi
-
-# Resources (adjust based on your needs)
-CASBIN_GATEWAY_CPU_REQUEST=100m
-CASBIN_GATEWAY_CPU_LIMIT=1000m
-CASBIN_GATEWAY_MEMORY_REQUEST=256Mi
-CASBIN_GATEWAY_MEMORY_LIMIT=1Gi
diff --git a/k8s/README.md b/k8s/README.md
deleted file mode 100644
index bb4a4c3..0000000
--- a/k8s/README.md
+++ /dev/null
@@ -1,374 +0,0 @@
-# Kubernetes Deployment Guide for Casbin Gateway
-
-This guide provides instructions for deploying Casbin Gateway on Kubernetes.
-
-## Prerequisites
-
-- A running Kubernetes cluster (1.19+)
-- `kubectl` configured to access your cluster
-- A running Casdoor instance (can be in the same cluster or external)
-- Basic understanding of Kubernetes resources
-
-## Architecture
-
-The deployment consists of:
-- **Casbin Gateway Application**: The main WAF application
-- **PersistentVolumeClaim**: Holds the SQLite database at
`/data/casbin-gateway.db`. There is no database server to deploy
-- **Secrets**: Stores sensitive credentials (Casdoor client ID/secret)
-- **ConfigMap**: Contains Casbin Gateway configuration template
-- **Service**: Exposes Casbin Gateway within the cluster
-- **Ingress** (optional): Exposes Casbin Gateway externally
-
-Because SQLite is a single file written by one process, the Deployment stays at
-one replica and uses the `Recreate` strategy. Switch to MySQL or PostgreSQL
(see
-[Using an external database](#using-an-external-database)) before scaling out.
-
-## Quick Start
-
-### 1. Deploy Casdoor (if not already deployed)
-
-Casbin Gateway requires Casdoor for authentication. If you don't have Casdoor
deployed:
-
-```bash
-# Follow Casdoor's Kubernetes deployment guide:
-# https://casdoor.org/docs/deployment/k8s
-```
-
-### 2. Configure Secrets
-
-Edit `k8s/secret.yaml` and update the sensitive credentials:
-
-```yaml
-stringData:
- casdoor-client-id: "YOUR_ACTUAL_CLIENT_ID"
- casdoor-client-secret: "YOUR_ACTUAL_CLIENT_SECRET"
-```
-
-**Important**:
-- **REQUIRED**: You must replace all placeholder values before deployment
-- Get `casdoor-client-id` and `casdoor-client-secret` from your Casdoor
application settings
-- The deployment will fail with validation errors if placeholders are not
replaced
-
-**Security Best Practice**: Never commit actual secrets to version control.
Consider using:
-- [Sealed Secrets](https://github.com/bitnami-labs/sealed-secrets)
-- [External Secrets Operator](https://external-secrets.io/)
-- Cloud provider secret management (AWS Secrets Manager, Azure Key Vault, GCP
Secret Manager)
-
-### 3. Review the data volume
-
-`k8s/pvc.yaml` requests 10Gi of `ReadWriteOnce` storage for the SQLite
database.
-Adjust the size, or add a `storageClassName`, if your cluster has no default
-storage class.
-
-### 4. Configure Casdoor Endpoint (Optional)
-
-If your Casdoor is not at
`http://casdoor.casdoor-system.svc.cluster.local:8000`, edit
`k8s/configmap.yaml`:
-
-```yaml
-casdoorEndpoint: http://your-casdoor-service:port
-```
-
-### 5. Deploy to Kubernetes
-
-**Option A: Using the deployment script (Recommended)**
-
-The easiest way to deploy Casbin Gateway:
-
-```bash
-cd k8s
-chmod +x deploy.sh
-./deploy.sh
-```
-
-The script will:
-- Validate your configuration
-- Create the namespace and the data volume
-- Deploy secrets and configuration
-- Deploy Casbin Gateway application
-- Optionally deploy Ingress
-- Show deployment status
-
-**Option B: Using individual files**
-
-```bash
-# Create the namespace
-kubectl apply -f k8s/namespace.yaml
-
-# Create the volume that holds the SQLite database
-kubectl apply -f k8s/pvc.yaml
-
-# Deploy Secrets
-kubectl apply -f k8s/secret.yaml
-
-# Deploy ConfigMap
-kubectl apply -f k8s/configmap.yaml
-
-# Deploy Casbin Gateway
-kubectl apply -f k8s/deployment.yaml
-
-# (Optional) Deploy Ingress
-kubectl apply -f k8s/ingress.yaml
-```
-
-**Option C: Using Kustomize**
-```bash
-kubectl apply -k k8s/
-```
-
-### 6. Verify Deployment
-
-```bash
-# Check if pods are running
-kubectl get pods -n casbin-gateway
-
-# Check logs
-kubectl logs -f deployment/casbin-gateway -n casbin-gateway
-
-# Check services
-kubectl get svc -n casbin-gateway
-```
-
-### 7. Access Casbin Gateway
-
-If using Ingress:
-```bash
-# Update your DNS or /etc/hosts to point to your ingress controller IP
-# Then access: http://casbin-gateway.example.com
-```
-
-If using port-forward for testing:
-```bash
-kubectl port-forward svc/casbin-gateway 17000:17000 -n casbin-gateway
-# Access: http://localhost:17000
-```
-
-## Configuration Details
-
-### Secrets (`secret.yaml`)
-
-Stores sensitive credentials:
-- `casdoor-client-id`: Casdoor application client ID
-- `casdoor-client-secret`: Casdoor application client secret
-
-**Security Note**: Never commit actual secrets to version control. Use
sealed-secrets, external secret operators, or other secret management solutions
in production.
-
-### ConfigMap (`configmap.yaml`)
-
-Key configuration parameters:
-
-| Parameter | Description | Default |
-|-----------|-------------|---------|
-| `httpport` | Casbin Gateway HTTP port | `17000` |
-| `runmode` | Run mode (dev/prod) | `prod` |
-| `driverName` | Database driver | `sqlite` |
-| `dataSourceName` | SQLite file, or the connection string of a database
server | `/data/casbin-gateway.db` |
-| `dbName` | Database name (unused by SQLite) | `casbin_gateway` |
-| `casdoorEndpoint` | Casdoor API endpoint | Required |
-| `casdoorInsecureSkipVerify` | Skip TLS verification for Casdoor | `true` |
-| `clientId` | Casdoor application client ID | Uses secrets substitution |
-| `clientSecret` | Casdoor application client secret | Uses secrets
substitution |
-| `casdoorOrganization` | Casdoor organization name | `built-in` |
-| `casdoorApplication` | Casdoor application name | Required |
-
-### Data Volume (`pvc.yaml`)
-
-- 10Gi `ReadWriteOnce` claim mounted at `/data`
-- Holds `casbin-gateway.db`, the SQLite database, plus its `-wal` and `-shm`
sidecar files
-- Deleting the claim deletes all Gateway data
-
-### Casbin Gateway Deployment (`deployment.yaml`)
-
-Features:
-- Init container that substitutes secrets into the configuration file
-- TCP-based liveness and readiness probes (no authentication required)
-- Resource limits and requests
-- Configuration mounted from ConfigMap with secret substitution
-- One replica with the `Recreate` strategy, because the SQLite file takes a
- single writer
-
-## Troubleshooting
-
-### Common Issues
-
-#### 1. Pod stuck in `Pending`
-
-**Cause**: The `casbin-gateway-data-pvc` claim is unbound, usually because the
cluster has no default storage class.
-
-**Solution**:
-```bash
-# Check the claim and why it is not bound
-kubectl get pvc -n casbin-gateway
-kubectl describe pvc casbin-gateway-data-pvc -n casbin-gateway
-
-# List the available storage classes, then set storageClassName in k8s/pvc.yaml
-kubectl get storageclass
-```
-
-#### 2. "casdoorsdk.GetCerts() error: Unauthorized operation"
-
-**Cause**: Incorrect Casdoor configuration or credentials
-
-**Solution**:
-1. Verify Casdoor is accessible:
- ```bash
- kubectl run -it --rm debug --image=curlimages/curl --restart=Never -n
casbin-gateway -- \
- curl -v http://casdoor.casdoor-system.svc.cluster.local:8000
- ```
-
-2. Verify `clientId` and `clientSecret` in ConfigMap match your Casdoor
application
-
-3. Ensure the Casdoor application is configured correctly:
- - Organization name matches `casdoorOrganization`
- - Application name matches `casdoorApplication`
- - Client ID and secret are correct
-
-4. Check Casdoor logs for authentication errors
-
-#### 3. Database Connection Issues
-
-The startup summary in the pod log names the database Gateway actually opened,
-and says whether it answered.
-
-**Solution**:
-```bash
-# Confirm the SQLite file is on the volume
-kubectl exec -it deployment/casbin-gateway -n casbin-gateway -- ls -l /data
-
-# For an external database server, test that it is reachable from the pod
-kubectl exec -it deployment/casbin-gateway -n casbin-gateway -- sh
-# Then inside the pod, e.g.:
-# nc -zv mysql.example.com 3306
-```
-
-#### 4. Init Container Stuck
-
-If the `setup-config` init container never finishes:
-```bash
-# Check init container logs
-kubectl logs -n casbin-gateway <pod-name> -c setup-config
-
-# Force restart
-kubectl rollout restart deployment/casbin-gateway -n casbin-gateway
-```
-
-### Viewing Logs
-
-```bash
-# Casbin Gateway logs
-kubectl logs -f deployment/casbin-gateway -n casbin-gateway
-
-# All logs in namespace
-kubectl logs -f -n casbin-gateway --all-containers=true
-```
-
-## Production Recommendations
-
-1. **Use an External Database**: The SQLite default is fine for a single
replica. For production, consider a managed MySQL or PostgreSQL service (AWS
RDS, Google Cloud SQL, etc.) — see [Using an external
database](#using-an-external-database)
-
-2. **Configure TLS**:
- - Set `casdoorInsecureSkipVerify = false`
- - Use proper TLS certificates for Casdoor
-
-3. **Resource Limits**: Adjust resource limits based on your traffic:
- ```yaml
- resources:
- requests:
- memory: "512Mi"
- cpu: "500m"
- limits:
- memory: "2Gi"
- cpu: "2000m"
- ```
-
-4. **High Availability**:
- - Move to an external database first: more than one replica cannot share
the SQLite file
- - Then increase replicas for Casbin Gateway
- - Use database replication or a managed service
- - Configure proper health checks
-
-5. **Monitoring**: Set up monitoring and alerting:
- - Prometheus metrics
- - Application logs
- - Resource usage
-
-6. **Backup**: Regular backups of the database. For SQLite that is the
`casbin-gateway-data-pvc` volume:
- ```bash
- kubectl exec deployment/casbin-gateway -n casbin-gateway -- tar cf - /data
> casbin-gateway-data.tar
- ```
-
-7. **Security**:
- - Use Kubernetes Secrets for sensitive data
- - Enable RBAC
- - Network policies to restrict traffic
- - Regular security updates
-
-## Updating Casbin Gateway
-
-```bash
-# Update the image version in deployment.yaml, then:
-kubectl set image deployment/casbin-gateway
casbin-gateway=casbin/caswaf:NEW_VERSION -n casbin-gateway
-
-# Or apply updated deployment
-kubectl apply -f k8s/deployment.yaml
-
-# Check rollout status
-kubectl rollout status deployment/casbin-gateway -n casbin-gateway
-```
-
-## Uninstall
-
-```bash
-# Delete all resources
-kubectl delete -f k8s/ingress.yaml
-kubectl delete -f k8s/deployment.yaml
-kubectl delete -f k8s/configmap.yaml
-kubectl delete -f k8s/secret.yaml
-
-# Deleting the claim destroys the SQLite database
-kubectl delete -f k8s/pvc.yaml
-
-# Or delete the entire namespace
-kubectl delete namespace casbin-gateway
-```
-
-## Advanced Configuration
-
-### Using an external database
-
-Edit `configmap.yaml`:
-```yaml
-driverName = mysql
-dataSourceName = root:password@tcp(external-mysql.example.com:3306)/
-dbName = casbin_gateway
-```
-
-Gateway creates `dbName` on first start if it does not exist. Once the data no
-longer lives on the volume you can drop the `data` volume and its mount from
-`deployment.yaml`, stop deploying `pvc.yaml`, and raise `replicas`.
-
-### Using Redis for Sessions
-
-Edit `configmap.yaml`:
-```yaml
-redisEndpoint: redis-host:6379
-```
-
-### Custom Domain
-
-Edit `ingress.yaml`:
-```yaml
-spec:
- rules:
- - host: waf.yourdomain.com
-```
-
-## Support
-
-For issues and questions:
-- GitHub Issues: https://github.com/apache/casbin-gateway/issues
-- Documentation: https://caswaf.org
-- Casdoor Documentation: https://casdoor.org
-
-## License
-
-Apache-2.0
diff --git a/k8s/configmap.yaml b/k8s/configmap.yaml
deleted file mode 100644
index 5f6facc..0000000
--- a/k8s/configmap.yaml
+++ /dev/null
@@ -1,46 +0,0 @@
----
-apiVersion: v1
-kind: ConfigMap
-metadata:
- name: casbin-gateway-config
- namespace: casbin-gateway
-data:
- app.conf: |
- appname = casbin-gateway
- httpport = 17000
- runmode = prod
- SessionOn = true
- copyrequestbody = true
- # A SQLite file on the PersistentVolumeClaim. For MySQL, set
- # driverName = mysql and dataSourceName = root:PASSWORD@tcp(host:3306)/
- driverName = sqlite
- dataSourceName = /data/casbin-gateway.db
- dbName = casbin_gateway
- redisEndpoint =
- gatewayEnabled = false
- gatewayHttpPort = 80
- gatewayHttpsPort = 443
- httpProxy = ""
- # Update this if your Casdoor is deployed elsewhere
- # Format: http://service-name.namespace.svc.cluster.local:port
- casdoorEndpoint = http://casdoor.casdoor-system.svc.cluster.local:8000
- casdoorInsecureSkipVerify = true
- clientId = "CLIENT_ID_PLACEHOLDER"
- clientSecret = "CLIENT_SECRET_PLACEHOLDER"
- casdoorOrganization = "built-in"
- casdoorApplication = "app-casdoor-gateway"
- isDemoMode = false
- appDir = "/app"
- dbRegionId = ""
- dbAccessKeyId = ""
- dbAccessKeySecret = ""
- dbInstanceId = ""
- dbHost = ""
- dbUser = ""
- dbPass = ""
- clientIdPrefix = ""
- clientSecretPrefix = ""
- language = "en"
- appMap =
- acmeEmail = ""
- acmePrivateKey = ""
diff --git a/k8s/deploy.sh b/k8s/deploy.sh
deleted file mode 100755
index 269dbb4..0000000
--- a/k8s/deploy.sh
+++ /dev/null
@@ -1,131 +0,0 @@
-#!/bin/bash
-# Quick deployment script for Casbin Gateway on Kubernetes
-# This script helps you deploy Casbin Gateway with proper configuration
-# Usage: ./deploy.sh [--auto-ingress|--no-ingress]
-
-set -euo pipefail
-
-# Colors for output
-RED='\033[0;31m'
-GREEN='\033[0;32m'
-YELLOW='\033[1;33m'
-NC='\033[0m' # No Color
-
-# Parse command line arguments
-AUTO_INGRESS=""
-while [[ $# -gt 0 ]]; do
- case $1 in
- --auto-ingress)
- AUTO_INGRESS="yes"
- shift
- ;;
- --no-ingress)
- AUTO_INGRESS="no"
- shift
- ;;
- *)
- echo -e "${RED}Unknown option: $1${NC}"
- echo "Usage: $0 [--auto-ingress|--no-ingress]"
- exit 1
- ;;
- esac
-done
-
-echo -e "${GREEN}Casbin Gateway Kubernetes Deployment Script${NC}"
-echo "==========================================="
-echo
-
-# Check if kubectl is installed
-if ! command -v kubectl &> /dev/null; then
- echo -e "${RED}Error: kubectl is not installed${NC}"
- exit 1
-fi
-
-# Check if we're in the k8s directory
-if [ ! -f "secret.yaml" ] || [ ! -f "deployment.yaml" ] || [ ! -f "pvc.yaml"
]; then
- echo -e "${RED}Error: Please run this script from the k8s directory${NC}"
- exit 1
-fi
-
-echo -e "${YELLOW}Step 1: Checking configuration...${NC}"
-
-# Check if secrets have been configured
-if grep -q "CHANGEME_INSECURE_DEFAULT_REPLACE_THIS" secret.yaml; then
- echo -e "${RED}Error: Secrets have not been configured!${NC}"
- echo "Please edit k8s/secret.yaml and replace all placeholder values with
your actual credentials:"
- echo " - casdoor-client-id"
- echo " - casdoor-client-secret"
- exit 1
-fi
-
-echo -e "${GREEN}✓ Configuration looks good${NC}"
-echo
-
-echo -e "${YELLOW}Step 2: Creating the namespace and the data volume...${NC}"
-kubectl apply -f namespace.yaml
-kubectl apply -f pvc.yaml
-echo -e "${GREEN}✓ Namespace and data volume created${NC}"
-echo
-
-echo -e "${YELLOW}Step 3: Deploying Casbin Gateway configuration...${NC}"
-kubectl apply -f secret.yaml
-kubectl apply -f configmap.yaml
-echo -e "${GREEN}✓ Configuration deployed${NC}"
-echo
-
-echo -e "${YELLOW}Step 4: Deploying Casbin Gateway application...${NC}"
-kubectl apply -f deployment.yaml
-
-echo "Waiting for Casbin Gateway to be ready..."
-kubectl wait --for=condition=ready pod -l app=casbin-gateway -n casbin-gateway
--timeout=300s || {
- echo -e "${RED}Warning: Casbin Gateway took longer than expected to
start${NC}"
- echo "Check logs with: kubectl logs -n casbin-gateway -l
app=casbin-gateway"
-}
-echo -e "${GREEN}✓ Casbin Gateway is deployed${NC}"
-echo
-
-# Handle Ingress deployment
-if [ -z "$AUTO_INGRESS" ]; then
- # Interactive mode - only ask if terminal is interactive
- if [ -t 0 ]; then
- read -p "Do you want to deploy the Ingress? (y/N): " deploy_ingress
- if [[ $deploy_ingress =~ ^[Yy]$ ]]; then
- AUTO_INGRESS="yes"
- else
- AUTO_INGRESS="no"
- fi
- else
- echo -e "${YELLOW}Non-interactive mode detected, skipping Ingress
deployment${NC}"
- echo "Use --auto-ingress flag to deploy Ingress automatically"
- AUTO_INGRESS="no"
- fi
-fi
-
-if [ "$AUTO_INGRESS" = "yes" ]; then
- echo -e "${YELLOW}Step 5: Deploying Ingress...${NC}"
- kubectl apply -f ingress.yaml
- echo -e "${GREEN}✓ Ingress deployed${NC}"
- echo
- echo -e "${YELLOW}Note: Update your DNS or /etc/hosts to point to your
ingress controller IP${NC}"
-else
- echo -e "${YELLOW}Skipping Ingress deployment${NC}"
- echo
- echo "You can access Casbin Gateway using port-forward:"
- echo " kubectl port-forward svc/casbin-gateway 17000:17000 -n
casbin-gateway"
- echo " Then access: http://localhost:17000"
-fi
-
-echo
-echo -e "${GREEN}Deployment Summary:${NC}"
-echo "==================="
-kubectl get all -n casbin-gateway
-
-echo
-echo -e "${GREEN}✓ Casbin Gateway deployment completed successfully!${NC}"
-echo
-echo "Useful commands:"
-echo " View pods: kubectl get pods -n casbin-gateway"
-echo " View services: kubectl get svc -n casbin-gateway"
-echo " View logs: kubectl logs -f deployment/casbin-gateway -n
casbin-gateway"
-echo " Port forward: kubectl port-forward svc/casbin-gateway 17000:17000
-n casbin-gateway"
-echo " Delete all: kubectl delete namespace casbin-gateway"
diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml
deleted file mode 100644
index 6338750..0000000
--- a/k8s/deployment.yaml
+++ /dev/null
@@ -1,121 +0,0 @@
----
-apiVersion: apps/v1
-kind: Deployment
-metadata:
- name: casbin-gateway
- namespace: casbin-gateway
-spec:
- replicas: 1
- # The old pod has to release the SQLite file before the new one starts.
- strategy:
- type: Recreate
- selector:
- matchLabels:
- app: casbin-gateway
- template:
- metadata:
- labels:
- app: casbin-gateway
- spec:
- initContainers:
- - name: setup-config
- image: busybox:1.36
- command:
- - sh
- - -c
- - |
- # Define placeholder values for validation
- PLACEHOLDER="CHANGEME_INSECURE_DEFAULT_REPLACE_THIS"
-
- # Validate that secrets have been replaced
- if [ "$CASDOOR_CLIENT_ID" = "$PLACEHOLDER" ]; then
- echo "ERROR: Casdoor client ID has not been configured!"
- echo "Please update k8s/secret.yaml with your actual Casdoor
client ID"
- exit 1
- fi
- if [ "$CASDOOR_CLIENT_SECRET" = "$PLACEHOLDER" ]; then
- echo "ERROR: Casdoor client secret has not been configured!"
- echo "Please update k8s/secret.yaml with your actual Casdoor
client secret"
- exit 1
- fi
-
- # All validations passed, proceed with configuration
- cp /tmp/config/app.conf /conf-out/app.conf
- sed -i "s/CLIENT_ID_PLACEHOLDER/${CASDOOR_CLIENT_ID}/g"
/conf-out/app.conf
- sed -i "s/CLIENT_SECRET_PLACEHOLDER/${CASDOOR_CLIENT_SECRET}/g"
/conf-out/app.conf
- echo "Configuration prepared successfully"
- env:
- - name: CASDOOR_CLIENT_ID
- valueFrom:
- secretKeyRef:
- name: casbin-gateway-secrets
- key: casdoor-client-id
- - name: CASDOOR_CLIENT_SECRET
- valueFrom:
- secretKeyRef:
- name: casbin-gateway-secrets
- key: casdoor-client-secret
- volumeMounts:
- - name: config-template
- mountPath: /tmp/config
- - name: config
- mountPath: /conf-out
- containers:
- - name: casbin-gateway
- image: casbin/caswaf:latest
- ports:
- - containerPort: 17000
- name: http
- protocol: TCP
- env:
- - name: TZ
- value: "UTC"
- volumeMounts:
- - name: config
- mountPath: /conf
- - name: data
- mountPath: /data
- livenessProbe:
- tcpSocket:
- port: 17000
- initialDelaySeconds: 60
- periodSeconds: 10
- timeoutSeconds: 5
- failureThreshold: 3
- readinessProbe:
- tcpSocket:
- port: 17000
- initialDelaySeconds: 30
- periodSeconds: 5
- timeoutSeconds: 3
- failureThreshold: 3
- resources:
- requests:
- memory: "256Mi"
- cpu: "100m"
- limits:
- memory: "1Gi"
- cpu: "1000m"
- volumes:
- - name: config-template
- configMap:
- name: casbin-gateway-config
- - name: config
- emptyDir: {}
- - name: data
- persistentVolumeClaim:
- claimName: casbin-gateway-data-pvc
----
-apiVersion: v1
-kind: Service
-metadata:
- name: casbin-gateway
- namespace: casbin-gateway
-spec:
- selector:
- app: casbin-gateway
- ports:
- - port: 17000
- targetPort: 17000
- name: http
- type: ClusterIP
diff --git a/k8s/ingress.yaml b/k8s/ingress.yaml
deleted file mode 100644
index b2d2b38..0000000
--- a/k8s/ingress.yaml
+++ /dev/null
@@ -1,28 +0,0 @@
----
-apiVersion: networking.k8s.io/v1
-kind: Ingress
-metadata:
- name: casbin-gateway-ingress
- namespace: casbin-gateway
- annotations:
- nginx.ingress.kubernetes.io/rewrite-target: /
- # Add SSL redirect if needed
- # nginx.ingress.kubernetes.io/ssl-redirect: "true"
-spec:
- ingressClassName: nginx
- rules:
- - host: casbin-gateway.example.com # Change this to your domain
- http:
- paths:
- - path: /
- pathType: Prefix
- backend:
- service:
- name: casbin-gateway
- port:
- number: 17000
- # Uncomment and configure TLS if you have certificates
- # tls:
- # - hosts:
- # - casbin-gateway.example.com
- # secretName: casbin-gateway-tls
diff --git a/k8s/kustomization.yaml b/k8s/kustomization.yaml
deleted file mode 100644
index 8f6a6ec..0000000
--- a/k8s/kustomization.yaml
+++ /dev/null
@@ -1,22 +0,0 @@
----
-apiVersion: kustomize.config.k8s.io/v1beta1
-kind: Kustomization
-
-namespace: casbin-gateway
-
-resources:
- - namespace.yaml
- - pvc.yaml
- - secret.yaml
- - configmap.yaml
- - deployment.yaml
- - ingress.yaml
-
-# You can customize common labels here
-commonLabels:
- app.kubernetes.io/name: casbin-gateway
- app.kubernetes.io/part-of: casbin-gateway
-
-# You can add configuration transformers here
-# For example, to change the namespace:
-# namespace: my-custom-namespace
diff --git a/k8s/namespace.yaml b/k8s/namespace.yaml
deleted file mode 100644
index 5d0986f..0000000
--- a/k8s/namespace.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-apiVersion: v1
-kind: Namespace
-metadata:
- name: casbin-gateway
diff --git a/k8s/pvc.yaml b/k8s/pvc.yaml
deleted file mode 100644
index 1341f61..0000000
--- a/k8s/pvc.yaml
+++ /dev/null
@@ -1,13 +0,0 @@
----
-# Holds the SQLite database at /data/casbin-gateway.db.
-apiVersion: v1
-kind: PersistentVolumeClaim
-metadata:
- name: casbin-gateway-data-pvc
- namespace: casbin-gateway
-spec:
- accessModes:
- - ReadWriteOnce
- resources:
- requests:
- storage: 10Gi
diff --git a/k8s/secret.yaml b/k8s/secret.yaml
deleted file mode 100644
index 8f6326c..0000000
--- a/k8s/secret.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
----
-apiVersion: v1
-kind: Secret
-metadata:
- name: casbin-gateway-secrets
- namespace: casbin-gateway
-type: Opaque
-stringData:
- # Casdoor credentials - REQUIRED: Replace these with your actual values
before deployment
- # Get these from your Casdoor application settings
- casdoor-client-id: "CHANGEME_INSECURE_DEFAULT_REPLACE_THIS"
- casdoor-client-secret: "CHANGEME_INSECURE_DEFAULT_REPLACE_THIS"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]