- Removed hook: Sync annotation from dbinit (was causing it to run before MySQL) - dbinit Job: wave 0 (same as MySQL, wait-for-db handles timing) - Deployment: wave 1 (starts after dbinit completes) - Fixes: db init job starting before mysql pod
289 lines
5.9 KiB
Markdown
289 lines
5.9 KiB
Markdown
# Hades V2 - Authentication & Authorization Service
|
|
|
|
Hades is a Java-based authentication and authorization service providing:
|
|
- User authentication (username/password, OAuth, SAML)
|
|
- Token-based authorization with ACL
|
|
- User and entity management
|
|
- Multi-tenant context management
|
|
- Integration with external identity providers
|
|
|
|
## Quick Start
|
|
|
|
### Deploy with Backstage
|
|
|
|
1. **Create Test Environment:**
|
|
- Navigate to Backstage → Environments (`/environment`)
|
|
- Click "Create Environment"
|
|
- Select `hades-service`
|
|
- Choose resource size and TTL
|
|
- Click "Create Environment"
|
|
|
|
2. **Access the Service:**
|
|
```bash
|
|
# Get the service URL
|
|
kubectl get service -n <your-namespace>
|
|
|
|
# Health check
|
|
curl http://<service-url>/schedulerService/jobTrigger?jsonQuery=%7B%22application%22%3A%22nagios%22%2C%22jobName%22%3A%22monitoring_scheduler_svc%22%7D
|
|
```
|
|
|
|
### Deploy with Helm
|
|
|
|
```bash
|
|
# Add Helm repository (if using a chart repository)
|
|
helm repo add hades https://charts.company.com
|
|
|
|
# Install Hades
|
|
helm install hades ./helm/hades \
|
|
--namespace hades \
|
|
--create-namespace \
|
|
--set image.tag=1764243003606
|
|
|
|
# Upgrade
|
|
helm upgrade hades ./helm/hades \
|
|
--namespace hades \
|
|
--set image.tag=latest
|
|
|
|
# Uninstall
|
|
helm uninstall hades --namespace hades
|
|
```
|
|
|
|
### Deploy with ArgoCD
|
|
|
|
```bash
|
|
# Create ArgoCD Application
|
|
kubectl apply -f - <<EOF
|
|
apiVersion: argoproj.io/v1alpha1
|
|
kind: Application
|
|
metadata:
|
|
name: hades
|
|
namespace: argocd
|
|
spec:
|
|
project: default
|
|
source:
|
|
repoURL: https://cnoe.localtest.me:8443/gitea/giteaAdmin/hades-service
|
|
path: helm/hades
|
|
targetRevision: HEAD
|
|
destination:
|
|
server: https://kubernetes.default.svc
|
|
namespace: hades
|
|
syncPolicy:
|
|
automated:
|
|
prune: true
|
|
selfHeal: true
|
|
syncOptions:
|
|
- CreateNamespace=true
|
|
EOF
|
|
```
|
|
|
|
## Configuration
|
|
|
|
### Helm Values
|
|
|
|
Key configuration options in `helm/hades/values.yaml`:
|
|
|
|
```yaml
|
|
# Docker image
|
|
image:
|
|
repository: localhost:5001/europe-west1-docker.pkg.dev/os-docker-images/onlinesales/prod/services/java/hadesv2
|
|
tag: "1764243003606"
|
|
|
|
# Resources
|
|
resources:
|
|
limits:
|
|
cpu: 2000m
|
|
memory: 2Gi
|
|
requests:
|
|
cpu: 500m
|
|
memory: 512Mi
|
|
|
|
# Database connection
|
|
database:
|
|
host: "mysql.default.svc.cluster.local"
|
|
port: "3306"
|
|
name: "hades"
|
|
username: "hades_user"
|
|
password: "changeme"
|
|
|
|
# Custom configuration files
|
|
config:
|
|
enabled: true
|
|
files:
|
|
hades.cfg: |
|
|
# Your Hades configuration
|
|
hibernate.cfg.xml: |
|
|
<!-- Hibernate configuration -->
|
|
```
|
|
|
|
### Environment Variables
|
|
|
|
The service supports the following environment variables:
|
|
|
|
- `JAVA_OPTS`: JVM options (default: `-Xms512m -Xmx2048m`)
|
|
- `CATALINA_OPTS`: Tomcat options (default: `-Dconfig.path=/app/config`)
|
|
- `DB_HOST`: Database host
|
|
- `DB_PORT`: Database port
|
|
- `DB_NAME`: Database name
|
|
- `DB_USERNAME`: Database username
|
|
- `DB_PASSWORD`: Database password
|
|
|
|
## API Endpoints
|
|
|
|
### Authentication
|
|
|
|
```bash
|
|
# Authenticate user
|
|
POST /authenticate
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"username": "user@example.com",
|
|
"password": "password123"
|
|
}
|
|
```
|
|
|
|
### Authorization
|
|
|
|
```bash
|
|
# Authorize token
|
|
POST /authorize
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"token": "your-auth-token"
|
|
}
|
|
```
|
|
|
|
### Health Check
|
|
|
|
```bash
|
|
# Health check
|
|
GET /schedulerService/jobTrigger?jsonQuery=%7B%22application%22%3A%22nagios%22%2C%22jobName%22%3A%22monitoring_scheduler_svc%22%7D
|
|
```
|
|
|
|
## Development
|
|
|
|
### Local Development
|
|
|
|
```bash
|
|
# Build the application
|
|
cd /path/to/hades/source
|
|
ant setup
|
|
|
|
# Build Docker image
|
|
docker build -t hades:local .
|
|
|
|
# Run locally
|
|
docker run -p 8080:8080 hades:local
|
|
```
|
|
|
|
### Testing
|
|
|
|
```bash
|
|
# Run unit tests
|
|
ant unittest
|
|
|
|
# Test deployment
|
|
helm lint helm/hades
|
|
|
|
# Dry run
|
|
helm install hades ./helm/hades --dry-run --debug
|
|
```
|
|
|
|
## Monitoring
|
|
|
|
### Metrics
|
|
|
|
The service exposes metrics at:
|
|
- Health: `/schedulerService/jobTrigger`
|
|
- Application logs: Container stdout/stderr
|
|
|
|
### Grafana Dashboards
|
|
|
|
View metrics in Grafana:
|
|
- [Hades Service Dashboard](https://grafana.company.com/d/hades)
|
|
|
|
### Alerts
|
|
|
|
Key alerts configured:
|
|
- Service unavailable (5xx errors)
|
|
- High response time (> 2s)
|
|
- Database connection failures
|
|
- Memory usage > 80%
|
|
|
|
## Troubleshooting
|
|
|
|
### Pod not starting
|
|
|
|
```bash
|
|
# Check pod status
|
|
kubectl get pods -n <namespace>
|
|
|
|
# Check logs
|
|
kubectl logs -f <pod-name> -n <namespace>
|
|
|
|
# Describe pod
|
|
kubectl describe pod <pod-name> -n <namespace>
|
|
```
|
|
|
|
### Database connection issues
|
|
|
|
```bash
|
|
# Check database connectivity
|
|
kubectl exec -it <pod-name> -n <namespace> -- curl mysql:3306
|
|
|
|
# Check database credentials
|
|
kubectl get secret <secret-name> -n <namespace> -o yaml
|
|
```
|
|
|
|
### Health check failing
|
|
|
|
```bash
|
|
# Test health endpoint
|
|
kubectl exec -it <pod-name> -n <namespace> -- curl localhost:8080/schedulerService/jobTrigger?jsonQuery=%7B%22application%22%3A%22nagios%22%2C%22jobName%22%3A%22monitoring_scheduler_svc%22%7D
|
|
```
|
|
|
|
## Architecture
|
|
|
|
```
|
|
┌─────────────────┐
|
|
│ Load Balancer │
|
|
└────────┬────────┘
|
|
│
|
|
▼
|
|
┌─────────────────┐
|
|
│ Ingress/Service│
|
|
└────────┬────────┘
|
|
│
|
|
▼
|
|
┌─────────────────┐
|
|
│ Hades Pods │
|
|
│ (Tomcat 9) │
|
|
└────────┬────────┘
|
|
│
|
|
▼
|
|
┌─────────────────┐
|
|
│ MySQL Database │
|
|
└─────────────────┘
|
|
```
|
|
|
|
## Security
|
|
|
|
- Passwords hashed with BCrypt
|
|
- Token-based authentication
|
|
- ACL-based authorization
|
|
- CAPTCHA support for brute-force protection
|
|
- IP-based access control
|
|
- SAML/OAuth integration
|
|
|
|
## Support
|
|
|
|
- **Documentation**: https://wiki.company.com/hades
|
|
- **Issues**: https://github.com/yourorg/hades-service/issues
|
|
- **Slack**: #hades-support
|
|
- **Email**: platform-team@company.com
|
|
|
|
## License
|
|
|
|
Proprietary - © Your Company
|