Files
homelab/.gitea/scripts/README.md
AB from home.homenet 7b169b8e6d
All checks were successful
Update Kubernetes Services Wiki / Generate and Update K8s Wiki (push) Successful in 9s
Added wiki generator
2025-09-16 16:35:11 +03:00

91 lines
2.6 KiB
Markdown

# Wiki Generators for Homelab
Automated Wiki page generation scripts for documenting homelab infrastructure.
## 1. Authentik Applications Wiki Generator
Generates a Wiki page with all applications managed by Authentik from Terraform configuration.
### Files:
- `generate-apps-wiki.py` - Generates Applications.md from Terraform output
- `process-terraform-output.py` - Processes Terraform JSON output
### Workflow:
- **Trigger**: Push to `main` branch with Terraform changes
- **Workflow**: `.gitea/workflows/authentik-apps.yaml`
- **Output**: Applications Wiki page
## 2. Kubernetes Services Wiki Generator
Analyzes k8s/ directory and generates comprehensive documentation for all Kubernetes services.
### Files:
- `generate-k8s-wiki.py` - Main script for analyzing k8s services
### Features:
- **Service Types**: Detects Helm Charts, Kustomize, and YAML manifests
- **ArgoCD Integration**: Shows auto-sync status and project info
- **Service Discovery**: Lists all services, ingresses, and external secrets
- **Categorization**: Groups by apps, core, games categories
- **Detailed Analysis**: Shows deployments, containers, files
### Workflow:
- **Trigger**: Changes in `k8s/` directory
- **Workflow**: `.gitea/workflows/k8s-wiki.yaml`
- **Output**: Kubernetes-Services Wiki page
## GitHub Secrets Configuration
Required secrets in repository settings:
```
GT_URL=https://gt.hexor.cy
GT_WIKI_TOKEN=your_gitea_access_token
GT_OWNER=your_username
GT_REPO=homelab
```
## Generated Wiki Pages Structure
### Applications Page
- Table with icons (32x32), external/internal URLs
- Statistics by type (Proxy vs OAuth2)
- Grouping by categories (Core, Tools, Media, etc.)
### Kubernetes Services Page
- Overview table with service types and status
- Detailed sections by category
- ArgoCD integration status
- Service discovery information
## Local Testing
### Authentik Apps:
```bash
cd terraform/authentik
terraform output -json > terraform-output.json
python3 ../../.gitea/scripts/process-terraform-output.py terraform-output.json processed-output.json
python3 ../../.gitea/scripts/generate-apps-wiki.py processed-output.json
```
### K8s Services:
```bash
pip install pyyaml
python3 .gitea/scripts/generate-k8s-wiki.py k8s/ Kubernetes-Services.md
```
## Troubleshooting
### Common Issues:
1. **Terraform output parsing errors**
- Check for [command] prefix in output
- Verify JSON structure with debug mode
2. **Wiki upload failures**
- Verify Gitea token permissions
- Check network connectivity to Gitea instance
3. **YAML parsing errors in k8s analysis**
- Ensure valid YAML syntax in k8s files
- Check PyYAML installation