From 76bbda3c3d5e90bdcc366f600c43b6e8bba8162b Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Fri, 3 Apr 2026 16:05:52 +0800 Subject: [PATCH] refactor(gitops): normalize apps and services layout --- .../pre/stunnel-client-pre-kustomization.yaml | 2 +- .../prod/observability-kustomization.yaml | 2 +- .../stunnel-client-prod-kustomization.yaml | 2 +- .../observability-agent/kustomization.yaml | 4 - apps/monitor/observability-agent/release.yaml | 101 ------------------ infra/infrastructure/kustomization.yaml | 5 - infra/infrastructure/repositories.yaml | 8 -- repo/helm/kustomization.yaml | 4 - repo/helm/stable.yaml | 8 -- services/cache/redis/kustomization.yaml | 5 - services/cache/redis/release.yaml | 38 ------- services/database/mongodb/kustomization.yaml | 5 - services/database/mongodb/release.yaml | 42 -------- .../object-storage/minio/kustomization.yaml | 5 - services/object-storage/minio/release.yaml | 37 ------- .../observability/kustomization.yaml | 0 .../observability-stack/helmrelease.yaml | 0 .../observability-stack/kustomization.yaml | 0 .../observability-stack/oci-repository.yaml | 0 .../observability-stack/values.yaml | 0 .../observability/repositories.yaml | 0 .../stunnel-client/base/kustomization.yaml | 0 .../base/stunnel-client-configmap.yaml | 0 .../base/stunnel-client-deployment.yaml | 0 .../base/stunnel-client-service.yaml | 0 .../stunnel-client/pre/kustomization.yaml | 0 .../stunnel-client/prod/kustomization.yaml | 0 sync/config.yaml | 35 ------ 28 files changed, 3 insertions(+), 300 deletions(-) delete mode 100644 apps/monitor/observability-agent/kustomization.yaml delete mode 100644 apps/monitor/observability-agent/release.yaml delete mode 100644 infra/infrastructure/kustomization.yaml delete mode 100644 infra/infrastructure/repositories.yaml delete mode 100644 repo/helm/kustomization.yaml delete mode 100644 repo/helm/stable.yaml delete mode 100644 services/cache/redis/kustomization.yaml delete mode 100644 services/cache/redis/release.yaml delete mode 100644 services/database/mongodb/kustomization.yaml delete mode 100644 services/database/mongodb/release.yaml delete mode 100644 services/object-storage/minio/kustomization.yaml delete mode 100644 services/object-storage/minio/release.yaml rename {infra => services}/observability/kustomization.yaml (100%) rename {apps/monitor => services/observability}/observability-stack/helmrelease.yaml (100%) rename {apps/monitor => services/observability}/observability-stack/kustomization.yaml (100%) rename {apps/monitor => services/observability}/observability-stack/oci-repository.yaml (100%) rename {apps/monitor => services/observability}/observability-stack/values.yaml (100%) rename {infra => services}/observability/repositories.yaml (100%) rename {apps/core => services}/stunnel-client/base/kustomization.yaml (100%) rename {apps/core => services}/stunnel-client/base/stunnel-client-configmap.yaml (100%) rename {apps/core => services}/stunnel-client/base/stunnel-client-deployment.yaml (100%) rename {apps/core => services}/stunnel-client/base/stunnel-client-service.yaml (100%) rename {apps/core => services}/stunnel-client/pre/kustomization.yaml (100%) rename {apps/core => services}/stunnel-client/prod/kustomization.yaml (100%) delete mode 100644 sync/config.yaml diff --git a/apps/clusters/pre/stunnel-client-pre-kustomization.yaml b/apps/clusters/pre/stunnel-client-pre-kustomization.yaml index b941009..3af92c6 100644 --- a/apps/clusters/pre/stunnel-client-pre-kustomization.yaml +++ b/apps/clusters/pre/stunnel-client-pre-kustomization.yaml @@ -11,6 +11,6 @@ spec: sourceRef: kind: GitRepository name: platform-config - path: ./apps/core/stunnel-client/pre + path: ./services/stunnel-client/pre dependsOn: - name: stunnel-server diff --git a/apps/clusters/prod/observability-kustomization.yaml b/apps/clusters/prod/observability-kustomization.yaml index 1cfdab3..3b4e5df 100644 --- a/apps/clusters/prod/observability-kustomization.yaml +++ b/apps/clusters/prod/observability-kustomization.yaml @@ -11,4 +11,4 @@ spec: sourceRef: kind: GitRepository name: platform-config - path: ./apps/monitor/observability-stack + path: ./services/observability diff --git a/apps/clusters/prod/stunnel-client-prod-kustomization.yaml b/apps/clusters/prod/stunnel-client-prod-kustomization.yaml index 9d9c56b..71519dc 100644 --- a/apps/clusters/prod/stunnel-client-prod-kustomization.yaml +++ b/apps/clusters/prod/stunnel-client-prod-kustomization.yaml @@ -11,6 +11,6 @@ spec: sourceRef: kind: GitRepository name: platform-config - path: ./apps/core/stunnel-client/prod + path: ./services/stunnel-client/prod dependsOn: - name: stunnel-server diff --git a/apps/monitor/observability-agent/kustomization.yaml b/apps/monitor/observability-agent/kustomization.yaml deleted file mode 100644 index 6f38018..0000000 --- a/apps/monitor/observability-agent/kustomization.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: - - release.yaml diff --git a/apps/monitor/observability-agent/release.yaml b/apps/monitor/observability-agent/release.yaml deleted file mode 100644 index 7c2ebc1..0000000 --- a/apps/monitor/observability-agent/release.yaml +++ /dev/null @@ -1,101 +0,0 @@ -apiVersion: source.toolkit.fluxcd.io/v1beta2 -kind: HelmRepository -metadata: - name: stable - namespace: monitoring -spec: - interval: 10m - url: https://charts.onwalk.net/ ---- -apiVersion: helm.toolkit.fluxcd.io/v2beta1 -kind: HelmRelease -metadata: - name: observabilityagent - namespace: monitoring -spec: - chart: - spec: - chart: observabilityagent - version: "0.1.7" - sourceRef: - kind: HelmRepository - name: stable - namespace: monitoring - interval: 1m - values: - fluent-bit: - enabled: false - telegraf: - enabled: true - config: - agent: - interval: "10s" - round_interval: true - metric_batch_size: 1000 - metric_buffer_limit: 10000 - collection_jitter: "0s" - flush_interval: "10s" - flush_jitter: "0s" - precision: "" - debug: false - quiet: false - logfile: "" - hostname: "$HOSTNAME" - omit_hostname: true - processors: - - enum: - mapping: - field: "status" - dest: "status_code" - value_mappings: - healthy: 1 - problem: 2 - critical: 3 - outputs: - - influxdb: - urls: - - "https://influxdb.svc-dev.ink" - database: "telegraf" - inputs: - - net: - interfaces: * - - statsd: - service_address: ":8125" - percentiles: - - 50 - - 95 - - 99 - metric_separator: "_" - allowed_pending_messages: 10000 - percentile_limit: 1000 - deepflow-agent: - enabled: true - deepflowServerNodeIPS: - - 10.0.1.3 - deepflowK8sClusterID: d-rUJ4CUKMUt - prometheus: - enabled: true - server: - name: agent - retention: "30m" - extraFlags: - - web.enable-lifecycle - - enable-feature=expand-external-labels - remoteWrite: - - name: remote_prometheus - url: 'https://prometheus.svc-dev.ink/api/v1/write' - persistentVolume: - enabled: false - alertmanager: - enabled: false - prometheus-pushgateway: - enabled: false - kube-state-metrics: - enabled: false - prometheus-node-exporter: - enabled: false - promtail: - enabled: true - config: - clients: - - url: https://loki.svc-dev.ink/loki/api/v1/push diff --git a/infra/infrastructure/kustomization.yaml b/infra/infrastructure/kustomization.yaml deleted file mode 100644 index 293848d..0000000 --- a/infra/infrastructure/kustomization.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: - - repositories.yaml - - ../../services/database/postgresql diff --git a/infra/infrastructure/repositories.yaml b/infra/infrastructure/repositories.yaml deleted file mode 100644 index 37637f5..0000000 --- a/infra/infrastructure/repositories.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: source.toolkit.fluxcd.io/v1 -kind: HelmRepository -metadata: - name: bitnami - namespace: flux-system -spec: - interval: 10m0s - url: https://charts.bitnami.com/bitnami diff --git a/repo/helm/kustomization.yaml b/repo/helm/kustomization.yaml deleted file mode 100644 index 2f567f1..0000000 --- a/repo/helm/kustomization.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: - - stable.yaml diff --git a/repo/helm/stable.yaml b/repo/helm/stable.yaml deleted file mode 100644 index 1b83e6e..0000000 --- a/repo/helm/stable.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: source.toolkit.fluxcd.io/v1beta2 -kind: HelmRepository -metadata: - name: stable - namespace: monitoring -spec: - interval: 1m - url: https://charts.onwalk.net/ diff --git a/services/cache/redis/kustomization.yaml b/services/cache/redis/kustomization.yaml deleted file mode 100644 index 97d68e5..0000000 --- a/services/cache/redis/kustomization.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -namespace: itsm-dev -resources: - - release.yaml diff --git a/services/cache/redis/release.yaml b/services/cache/redis/release.yaml deleted file mode 100644 index 5ab3cef..0000000 --- a/services/cache/redis/release.yaml +++ /dev/null @@ -1,38 +0,0 @@ -apiVersion: helm.toolkit.fluxcd.io/v2beta2 -kind: HelmRelease -metadata: - name: redis - namespace: itsm-dev -spec: - interval: 1m - chart: - spec: - version: "18.12.1" - chart: redis - sourceRef: - kind: HelmRepository - name: stable - namespace: itsm-dev - interval: 1m - values: - enabled: true - nameOverride: "redis" - architecture: standalone - global: - imageRegistry: "" - redis: - password: "redis" - auth: - enabled: true - sentinel: false - password: "" - master: - persistence: - enabled: false - resources: - requests: - memory: 100Mi - cpu: 100m - limits: - cpu: "200m" - memory: "300Mi" diff --git a/services/database/mongodb/kustomization.yaml b/services/database/mongodb/kustomization.yaml deleted file mode 100644 index 97d68e5..0000000 --- a/services/database/mongodb/kustomization.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -namespace: itsm-dev -resources: - - release.yaml diff --git a/services/database/mongodb/release.yaml b/services/database/mongodb/release.yaml deleted file mode 100644 index 43fb851..0000000 --- a/services/database/mongodb/release.yaml +++ /dev/null @@ -1,42 +0,0 @@ -apiVersion: helm.toolkit.fluxcd.io/v2beta2 -kind: HelmRelease -metadata: - name: mongodb - namespace: itsm-dev -spec: - interval: 1m - chart: - spec: - version: "14.8.3" - chart: mongodb - sourceRef: - kind: HelmRepository - name: stable - namespace: itsm-dev - interval: 1m - values: - enabled: true - nameOverride: "mongodb" - architecture: standalone - useStatefulSet: true - global: - imageRegistry: "" - persistence: - enabled: true - auth: - enabled: true - rootUser: root - rootPassword: "mongodb" - usernames: - - novu - passwords: - - novu - databases: - - novu-db - resources: - requests: - memory: 100Mi - cpu: 100m - limits: - cpu: "500m" - memory: "500Mi" diff --git a/services/object-storage/minio/kustomization.yaml b/services/object-storage/minio/kustomization.yaml deleted file mode 100644 index 97d68e5..0000000 --- a/services/object-storage/minio/kustomization.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -namespace: itsm-dev -resources: - - release.yaml diff --git a/services/object-storage/minio/release.yaml b/services/object-storage/minio/release.yaml deleted file mode 100644 index 02a1380..0000000 --- a/services/object-storage/minio/release.yaml +++ /dev/null @@ -1,37 +0,0 @@ -apiVersion: helm.toolkit.fluxcd.io/v2beta2 -kind: HelmRelease -metadata: - name: minio - namespace: itsm-dev -spec: - interval: 1m - chart: - spec: - version: "5.0.15" - chart: minio - sourceRef: - kind: HelmRepository - name: stable - namespace: itsm-dev - interval: 1m - values: - enabled: true - nameOverride: minio - mode: standalone - replicas: 2 - ingress: - enabled: true - ingressClassName: "nginx" - hosts: - - minio.local - persistence: - enabled: true - size: 10Gi - existingSecret: minio-secret - resources: - requests: - memory: 50Mi - cpu: 50m - limits: - cpu: "100m" - memory: "100Mi" diff --git a/infra/observability/kustomization.yaml b/services/observability/kustomization.yaml similarity index 100% rename from infra/observability/kustomization.yaml rename to services/observability/kustomization.yaml diff --git a/apps/monitor/observability-stack/helmrelease.yaml b/services/observability/observability-stack/helmrelease.yaml similarity index 100% rename from apps/monitor/observability-stack/helmrelease.yaml rename to services/observability/observability-stack/helmrelease.yaml diff --git a/apps/monitor/observability-stack/kustomization.yaml b/services/observability/observability-stack/kustomization.yaml similarity index 100% rename from apps/monitor/observability-stack/kustomization.yaml rename to services/observability/observability-stack/kustomization.yaml diff --git a/apps/monitor/observability-stack/oci-repository.yaml b/services/observability/observability-stack/oci-repository.yaml similarity index 100% rename from apps/monitor/observability-stack/oci-repository.yaml rename to services/observability/observability-stack/oci-repository.yaml diff --git a/apps/monitor/observability-stack/values.yaml b/services/observability/observability-stack/values.yaml similarity index 100% rename from apps/monitor/observability-stack/values.yaml rename to services/observability/observability-stack/values.yaml diff --git a/infra/observability/repositories.yaml b/services/observability/repositories.yaml similarity index 100% rename from infra/observability/repositories.yaml rename to services/observability/repositories.yaml diff --git a/apps/core/stunnel-client/base/kustomization.yaml b/services/stunnel-client/base/kustomization.yaml similarity index 100% rename from apps/core/stunnel-client/base/kustomization.yaml rename to services/stunnel-client/base/kustomization.yaml diff --git a/apps/core/stunnel-client/base/stunnel-client-configmap.yaml b/services/stunnel-client/base/stunnel-client-configmap.yaml similarity index 100% rename from apps/core/stunnel-client/base/stunnel-client-configmap.yaml rename to services/stunnel-client/base/stunnel-client-configmap.yaml diff --git a/apps/core/stunnel-client/base/stunnel-client-deployment.yaml b/services/stunnel-client/base/stunnel-client-deployment.yaml similarity index 100% rename from apps/core/stunnel-client/base/stunnel-client-deployment.yaml rename to services/stunnel-client/base/stunnel-client-deployment.yaml diff --git a/apps/core/stunnel-client/base/stunnel-client-service.yaml b/services/stunnel-client/base/stunnel-client-service.yaml similarity index 100% rename from apps/core/stunnel-client/base/stunnel-client-service.yaml rename to services/stunnel-client/base/stunnel-client-service.yaml diff --git a/apps/core/stunnel-client/pre/kustomization.yaml b/services/stunnel-client/pre/kustomization.yaml similarity index 100% rename from apps/core/stunnel-client/pre/kustomization.yaml rename to services/stunnel-client/pre/kustomization.yaml diff --git a/apps/core/stunnel-client/prod/kustomization.yaml b/services/stunnel-client/prod/kustomization.yaml similarity index 100% rename from apps/core/stunnel-client/prod/kustomization.yaml rename to services/stunnel-client/prod/kustomization.yaml diff --git a/sync/config.yaml b/sync/config.yaml deleted file mode 100644 index 90d5c56..0000000 --- a/sync/config.yaml +++ /dev/null @@ -1,35 +0,0 @@ -- name: Local Config Tasks - tasks: - - name: Install nginx (macOS/Homebrew or Linux/apt) - shell: | - if command -v nginx >/dev/null; then - echo "nginx already installed" - elif command -v brew >/dev/null; then - brew install nginx || echo "brew install failed or not allowed" - elif command -v apt >/dev/null; then - sudo apt update && sudo apt install -y nginx - else - echo "No supported package manager found" - fi - - - name: Update /etc/hosts with test domain - shell: | - if ! grep -q "test.cw-agent.local" /etc/hosts; then - echo "127.0.0.1 test.cw-agent.local" | sudo tee -a /etc/hosts - fi - - - name: Create dummy SSL cert (for test) - shell: | - mkdir -p certs - openssl req -x509 -nodes -days 1 -newkey rsa:2048 \ - -keyout certs/test.key \ - -out certs/test.crt \ - -subj "/CN=test.cw-agent.local" - - - name: Reload nginx (if available) - shell: | - if command -v nginx >/dev/null; then - sudo nginx -s reload || true - elif command -v brew >/dev/null; then - brew services restart nginx || true - fi