Fix sync wave ordering - dbinit wave 0, deployment wave 1
- 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
This commit is contained in:
commit
911f8d28a1
42
.gitignore
vendored
Normal file
42
.gitignore
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# Build outputs
|
||||||
|
build/
|
||||||
|
target/
|
||||||
|
*.class
|
||||||
|
*.jar
|
||||||
|
*.war
|
||||||
|
*.ear
|
||||||
|
|
||||||
|
# IDE
|
||||||
|
.idea/
|
||||||
|
*.iml
|
||||||
|
.vscode/
|
||||||
|
.settings/
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
|
||||||
|
# OS
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Temporary files
|
||||||
|
*.tmp
|
||||||
|
*.bak
|
||||||
|
*.swp
|
||||||
|
*~
|
||||||
|
|
||||||
|
# Helm
|
||||||
|
*.tgz
|
||||||
|
charts/*.tgz
|
||||||
|
|
||||||
|
# Environment
|
||||||
|
.env
|
||||||
|
.env.local
|
||||||
|
|
||||||
|
# Secrets (never commit)
|
||||||
|
secrets/
|
||||||
|
*.pem
|
||||||
|
*.key
|
||||||
|
*-credentials.json
|
||||||
288
README.md
Normal file
288
README.md
Normal file
@ -0,0 +1,288 @@
|
|||||||
|
# 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
|
||||||
123
catalog-info.yaml
Normal file
123
catalog-info.yaml
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
apiVersion: backstage.io/v1alpha1
|
||||||
|
kind: Component
|
||||||
|
metadata:
|
||||||
|
name: hades-service
|
||||||
|
title: Hades V2 Authentication Service
|
||||||
|
description: Authentication and Authorization Service providing user management, OAuth/SAML integration, ACL-based access control, and multi-tenant context management
|
||||||
|
annotations:
|
||||||
|
backstage.io/techdocs-ref: dir:.
|
||||||
|
github.com/project-slug: yourorg/hades-service
|
||||||
|
# Argo Workflows annotation for environment provisioning
|
||||||
|
argo-workflows.cnoe.io/label-selector: "service=hades-service"
|
||||||
|
# ArgoCD annotations
|
||||||
|
argocd/app-name: hades-service
|
||||||
|
# Kubernetes annotations - Using kubernetes-id with commonLabels
|
||||||
|
backstage.io/kubernetes-id: hades-service
|
||||||
|
# Helm chart annotations for environment provisioning
|
||||||
|
helm.cnoe.io/git-repo: https://gitea.cnoe.localtest.me:8443/giteaAdmin/hades-chart.git
|
||||||
|
helm.cnoe.io/chart-path: hades
|
||||||
|
helm.cnoe.io/values-file: values-dev.yaml
|
||||||
|
helm.cnoe.io/available-values-files: '["values.yaml", "values-dev.yaml", "values-local.yaml"]'
|
||||||
|
helm.cnoe.io/dependencies: '{"mysql": {"name": "MySQL Database", "required": false, "default": true}}'
|
||||||
|
tags:
|
||||||
|
- java
|
||||||
|
- authentication
|
||||||
|
- authorization
|
||||||
|
- servlet
|
||||||
|
- tomcat
|
||||||
|
- oauth
|
||||||
|
- saml
|
||||||
|
- acl
|
||||||
|
links:
|
||||||
|
- url: https://wiki.company.com/hades
|
||||||
|
title: Documentation
|
||||||
|
icon: docs
|
||||||
|
- url: https://grafana.company.com/d/hades
|
||||||
|
title: Grafana Dashboard
|
||||||
|
icon: dashboard
|
||||||
|
- url: https://sentry.io/hades
|
||||||
|
title: Error Tracking
|
||||||
|
icon: alert
|
||||||
|
spec:
|
||||||
|
type: service
|
||||||
|
lifecycle: experimental
|
||||||
|
owner: user1
|
||||||
|
dependsOn:
|
||||||
|
- resource:default/hades-database
|
||||||
|
providesApis:
|
||||||
|
- hades-api
|
||||||
|
consumesApis: []
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: backstage.io/v1alpha1
|
||||||
|
kind: API
|
||||||
|
metadata:
|
||||||
|
name: hades-api
|
||||||
|
title: Hades Authentication API
|
||||||
|
description: REST API for authentication and authorization operations
|
||||||
|
tags:
|
||||||
|
- rest
|
||||||
|
- authentication
|
||||||
|
links:
|
||||||
|
- url: https://api-docs.company.com/hades
|
||||||
|
title: API Documentation
|
||||||
|
spec:
|
||||||
|
type: openapi
|
||||||
|
lifecycle: experimental
|
||||||
|
owner: user1
|
||||||
|
definition: |
|
||||||
|
openapi: 3.0.0
|
||||||
|
info:
|
||||||
|
title: Hades V2 API
|
||||||
|
version: 3.0.0
|
||||||
|
description: Authentication and Authorization Service
|
||||||
|
paths:
|
||||||
|
/authenticate:
|
||||||
|
post:
|
||||||
|
summary: Authenticate user
|
||||||
|
description: Authenticate a user with username/password
|
||||||
|
operationId: authenticate
|
||||||
|
tags:
|
||||||
|
- Authentication
|
||||||
|
/authorize:
|
||||||
|
post:
|
||||||
|
summary: Authorize token
|
||||||
|
description: Validate and authorize an authentication token
|
||||||
|
operationId: authorize
|
||||||
|
tags:
|
||||||
|
- Authorization
|
||||||
|
/users:
|
||||||
|
get:
|
||||||
|
summary: List users
|
||||||
|
description: Get list of users
|
||||||
|
operationId: listUsers
|
||||||
|
tags:
|
||||||
|
- Users
|
||||||
|
post:
|
||||||
|
summary: Create user
|
||||||
|
description: Create a new user
|
||||||
|
operationId: createUser
|
||||||
|
tags:
|
||||||
|
- Users
|
||||||
|
/schedulerService/jobTrigger:
|
||||||
|
get:
|
||||||
|
summary: Health check
|
||||||
|
description: Service health check endpoint
|
||||||
|
operationId: healthCheck
|
||||||
|
tags:
|
||||||
|
- Monitoring
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: backstage.io/v1alpha1
|
||||||
|
kind: Resource
|
||||||
|
metadata:
|
||||||
|
name: hades-database
|
||||||
|
title: Hades Database
|
||||||
|
description: MySQL database for Hades service
|
||||||
|
tags:
|
||||||
|
- database
|
||||||
|
- mysql
|
||||||
|
spec:
|
||||||
|
type: database
|
||||||
|
owner: user1
|
||||||
|
dependsOn: []
|
||||||
1
helm
Submodule
1
helm
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit f52bd12a9af6b44277d1277b505691511e92eca6
|
||||||
4
mkdocs.yml
Normal file
4
mkdocs.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
site_name: Hades V2 Authentication Service
|
||||||
|
docs_dir: docs
|
||||||
|
plugins:
|
||||||
|
- techdocs-core
|
||||||
Loading…
x
Reference in New Issue
Block a user