refactor(k8s): Reorganize into 5-layer structure with production kustomizations

This commit is contained in:
Story Crater Bot
2026-07-16 14:28:19 -07:00
parent a81b9b6169
commit 2d7330798b
214 changed files with 405 additions and 885 deletions
@@ -0,0 +1,48 @@
service: argocd
display_name: "Argo CD"
namespace: argocd
service_type: web-app
folder: "Argo CD"
jobs: [argocd-server, argocd-repo-server]
metrics:
prefix: argocd
up_selector: 'job=~"argocd-.*"'
rate:
metric: argocd_http_request_total
labels: [method, path, status]
duration:
metric: argocd_http_request_duration_seconds
type: histogram
unit: s
error:
metric: argocd_http_request_total
filter: 'status=~"5.."'
domain:
- metric: argocd_app_total
kind: gauge
- metric: argocd_app_sync_total
kind: counter
labels: [sync_status]
- metric: argocd_app_health_degraded_total
kind: counter
- metric: argocd_git_sync_total
kind: counter
labels: [git_operation, git_status]
- metric: argocd_reconcile_total
kind: counter
labels: [app_name]
correlation_ids: []
logs:
loki_namespace_selector: 'namespace="argocd"'
alerts:
- name: HighErrorRate
expr_template: rate_error_ratio
threshold: 0.05
for: 10m
severity: warning
- name: AppSyncFailure
expr_template: gauge_above_threshold
metric: argocd_app_health_degraded_total
threshold: 1
for: 10m
severity: warning
@@ -0,0 +1,64 @@
# authentik.descriptor.yaml
# Build input for generating svc-authentik.yaml dashboard ConfigMap
# and svc-authentik-rules.yaml PrometheusRule.
# NOT applied to cluster — this is a reference for Claude's mechanical dashboard generation.
service: authentik
display_name: "Authentik"
namespace: iam
service_type: identity-provider
folder: "Authentik"
jobs:
- authentik-server
- authentik-worker
metrics:
prefix: authentik
up_selector: 'job="authentik-server"'
rate:
metric: authentik_flows_execution_stage_time_count
labels: [flow_slug, stage_name]
duration:
metric: authentik_main_request_duration_seconds
type: histogram
unit: s
error:
metric: authentik_flows_cached
filter: null
domain:
- metric: authentik_outpost_connection
kind: gauge
group_by: [outpost_name, outpost_type]
- metric: authentik_outposts_connected
kind: gauge
- metric: authentik_flows_cached
kind: gauge
- metric: authentik_policies_cached
kind: gauge
- metric: authentik_tasks_queued
kind: gauge
- metric: authentik_admin_workers
kind: gauge
correlation_ids: []
logs:
loki_namespace_selector: 'namespace="iam"'
alerts:
- name: HighErrorRate
expr_template: rate_error_ratio
threshold: 0.05
for: 10m
severity: warning
- name: OutpostDown
expr_template: gauge_below_threshold
metric: authentik_outpost_total_up
threshold: 1
for: 5m
severity: warning
@@ -0,0 +1,39 @@
service: forgejo
display_name: "Forgejo"
namespace: forgejo
service_type: web-app
folder: "Forgejo"
jobs: [forgejo]
metrics:
prefix: forgejo
up_selector: 'job="forgejo"'
rate:
metric: forgejo_http_request_total
labels: [method, status]
duration:
metric: forgejo_http_request_duration_seconds
type: histogram
unit: s
error:
metric: forgejo_http_request_total
filter: 'status=~"5.."'
domain:
- metric: forgejo_repositories_total
kind: gauge
- metric: forgejo_users_total
kind: gauge
- metric: forgejo_git_operations_total
kind: counter
labels: [operation_type]
- metric: forgejo_runner_tasks_total
kind: counter
labels: [status]
correlation_ids: []
logs:
loki_namespace_selector: 'namespace="forgejo"'
alerts:
- name: HighErrorRate
expr_template: rate_error_ratio
threshold: 0.05
for: 10m
severity: warning
@@ -0,0 +1,35 @@
service: grafana
display_name: "Grafana"
namespace: logging
service_type: web-app
folder: "Grafana"
jobs: [grafana]
metrics:
prefix: grafana
up_selector: 'job="grafana"'
rate:
metric: grafana_http_request_total
labels: [handler, status]
duration:
metric: grafana_http_request_duration_seconds
type: histogram
unit: s
error:
metric: grafana_http_request_total
filter: 'status=~"5.."'
domain:
- metric: grafana_dashboard_total
kind: gauge
- metric: grafana_user_total
kind: gauge
- metric: grafana_alerts_total
kind: gauge
correlation_ids: []
logs:
loki_namespace_selector: 'namespace="logging"'
alerts:
- name: HighErrorRate
expr_template: rate_error_ratio
threshold: 0.05
for: 10m
severity: warning
@@ -0,0 +1,68 @@
# minio.descriptor.yaml
# Build input for generating svc-minio.yaml dashboard ConfigMap
# and svc-minio-rules.yaml PrometheusRule.
service: minio
display_name: "MinIO"
namespace: storage
service_type: stateful-store
folder: "MinIO"
jobs:
- minio
metrics:
prefix: minio
up_selector: 'job="minio"'
rate:
metric: minio_s3_requests_total
labels: [method, bucket]
duration:
metric: minio_s3_requests_duration_seconds
type: histogram
unit: s
error:
metric: minio_s3_requests_total
filter: 'error="true"'
domain:
- metric: minio_cluster_capacity_usable_bytes
kind: gauge
- metric: minio_cluster_capacity_raw_total_bytes
kind: gauge
- metric: minio_replication_metrics_failed_byte_count
kind: gauge
- metric: minio_replication_metrics_replicating_byte_count
kind: gauge
- metric: minio_cluster_health_drives_online
kind: gauge
- metric: minio_cluster_health_drives_offline
kind: gauge
correlation_ids: []
logs:
loki_namespace_selector: 'namespace="storage"'
alerts:
- name: HighErrorRate
expr_template: rate_error_ratio
threshold: 0.05
for: 10m
severity: warning
- name: DiskSpaceLow
expr_template: gauge_below_percentage
metric: minio_cluster_capacity_usable_bytes
threshold: 0.1
base_metric: minio_cluster_capacity_raw_total_bytes
for: 5m
severity: critical
- name: ReplicationLag
expr_template: gauge_above_threshold
metric: minio_replication_metrics_replicating_byte_count
threshold: 1073741824
for: 15m
severity: warning
@@ -0,0 +1,74 @@
# story-crater-backend.descriptor.yaml
# Build input for generating svc-story-crater-backend.yaml dashboard ConfigMap
# and svc-story-crater-backend-rules.yaml PrometheusRule.
# NOT applied to cluster — this is a reference for Claude's mechanical dashboard generation.
service: story-crater-backend
display_name: "Story Crater Backend"
namespace: story-crater-backend
service_type: message-worker
folder: "Story Crater Backend"
jobs:
- agent-worker
- check
- edit-collab
- canary
metrics:
prefix: story_crater
up_selector: 'job=~"agent-worker|check|edit-collab|canary"'
rate:
metric: story_crater_messages_handled_total
labels: [agent, queue, status] # status: succeeded | failed
duration:
metric: story_crater_message_handle_duration_ms
type: histogram
unit: ms
error:
metric: story_crater_app_metric_total
filter: 'severity="error"'
domain:
- metric: story_crater_queue_depth
kind: gauge
group_by: [queue]
- metric: story_crater_dedup_redeliveries_total
kind: counter
group_by: [agent, queue]
- metric: story_crater_outbox_publish_lag_ms
kind: histogram
- metric: story_crater_llm_tokens_used_total
kind: counter
group_by: [agent, kind]
- metric: story_crater_llm_call_duration_seconds
kind: histogram
group_by: [agent, model_provider]
- metric: story_crater_check_latency_ms
kind: histogram
slo_ms: 1200
- metric: story_crater_degrade_state
kind: gauge
group_by: [service]
correlation_ids: [session_id, trace_id, tenant]
logs:
loki_namespace_selector: 'namespace="story-crater-backend"'
alerts:
- name: HighErrorRate
expr_template: rate_error_ratio
threshold: 0.05
for: 10m
severity: warning
- name: CheckLatencySLOBreach
expr_template: histogram_quantile_over_threshold
metric: story_crater_check_latency_ms
quantile: 0.95
threshold: 1200
for: 10m
severity: critical
@@ -0,0 +1,63 @@
# story-crater-frontend.descriptor.yaml
# Build input for generating svc-story-crater-frontend.yaml dashboard ConfigMap
# and svc-story-crater-frontend-rules.yaml PrometheusRule.
# NOT applied to cluster — this is a reference for Claude's mechanical dashboard generation.
service: story-crater-frontend
display_name: "Story Crater Frontend"
namespace: story-crater-frontend
service_type: web-app
folder: "Story Crater Frontend"
jobs:
- story-crater-frontend
metrics:
prefix: story_crater_frontend
up_selector: 'job="story-crater-frontend"'
rate:
metric: story_crater_frontend_http_requests_total
labels: [method, route, status]
duration:
metric: story_crater_frontend_http_request_duration_ms
type: histogram
unit: ms
error:
metric: story_crater_frontend_http_requests_total
filter: 'status=~"5.."'
domain:
- metric: story_crater_frontend_web_vitals_lcp_ms
kind: gauge
group_by: [page]
- metric: story_crater_frontend_web_vitals_fid_ms
kind: gauge
group_by: [page]
- metric: story_crater_frontend_web_vitals_cls
kind: gauge
group_by: [page]
- metric: story_crater_frontend_web_vitals_inp_ms
kind: gauge
group_by: [page]
correlation_ids: [] # Frontend doesn't have session_id/trace_id in metrics
logs:
loki_namespace_selector: 'namespace="story-crater-frontend"'
alerts:
- name: HighErrorRate
expr_template: rate_error_ratio
threshold: 0.05
for: 10m
severity: warning
- name: WebVitalsLCPRegression
expr_template: histogram_quantile_over_threshold
metric: story_crater_frontend_web_vitals_lcp_ms
quantile: 0.75
threshold: 2500
for: 10m
severity: warning
@@ -0,0 +1,45 @@
service: vault
display_name: "Vault"
namespace: storage
service_type: stateful-store
folder: "Vault"
jobs: [vault]
metrics:
prefix: vault
up_selector: 'job="vault"'
rate:
metric: vault_core_handle_request_total
labels: [method, path]
duration:
metric: vault_core_handle_request_duration_seconds
type: histogram
unit: s
error:
metric: vault_core_handle_request_total
filter: 'error="true"'
domain:
- metric: vault_core_unsealed
kind: gauge
- metric: vault_core_active
kind: gauge
- metric: vault_core_replication_primary
kind: gauge
- metric: vault_token_total
kind: gauge
- metric: vault_database_connection_close_total
kind: counter
correlation_ids: []
logs:
loki_namespace_selector: 'namespace="iam"'
alerts:
- name: HighErrorRate
expr_template: rate_error_ratio
threshold: 0.05
for: 10m
severity: warning
- name: VaultSealed
expr_template: gauge_below_threshold
metric: vault_core_unsealed
threshold: 1
for: 1m
severity: critical