From 87793b89acbd3148cc1d750e63b090a0cc2991ea Mon Sep 17 00:00:00 2001 From: rohow Date: Wed, 14 Aug 2024 14:11:36 +0800 Subject: [PATCH] =?UTF-8?q?feat(halo):=20=E5=A2=9E=E5=8A=A0halo=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=20&=20=E4=BC=98=E5=8C=96apps=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/apps/halo/helmchart.yaml | 61 +++++++++++++++++++ apps/apps/halo/ingress-static.yaml | 30 +++++++++ apps/apps/namespaces.yaml | 4 ++ .../data/cloudnative-pg/cnpg-cluster-hk.yaml | 0 .../data/cloudnative-pg/cnpg-cluster-sh.yaml | 0 .../data/cloudnative-pg/helmchart.yaml | 0 .../data/cloudnative-pg/loadbalancer-hk.yaml | 0 .../data/cloudnative-pg/loadbalancer-sh.yaml | 0 apps/{ => infra}/data/milvus/helmchart.yaml | 0 .../{ => infra}/data/milvus/loadbalancer.yaml | 0 apps/{ => infra}/data/namespaces.yaml | 0 .../configmap-pgpool-script.yaml | 0 .../data/postgresql-ha/helmchart.yaml | 0 .../data/postgresql-ha/loadbalancer.yaml | 0 apps/{ => infra}/data/redis/helmchart.yaml | 0 .../devops/cert-manager/helmchart-dnspod.yaml | 0 .../devops/cert-manager/helmchart.yaml | 0 .../devops/gitea/configmap-custom.yaml | 0 apps/{ => infra}/devops/gitea/helmchart.yaml | 11 ++-- .../devops/gitea/ingress-static.yaml | 4 +- .../devops/gitea/loadbalancer-ssh.yaml | 0 apps/{ => infra}/devops/namespaces.yaml | 0 .../monitor/crowdsec/helmchart.yaml | 0 .../monitor/loki/helmchart-loki.yaml | 0 .../monitor/loki/helmchart-promtail.yaml | 0 apps/{ => infra}/monitor/namespaces.yaml | 0 .../monitor/prometheus/helmchart.yaml | 0 .../monitor/prometheus/ingress-static.yaml | 4 +- .../net/certs/certificate-dev-cm.yaml | 0 .../net/certs/certificate-fillcode-com.yaml | 0 apps/{ => infra}/net/namespaces.yaml | 0 apps/{ => infra}/net/nginx/helmchart.yaml | 0 apps/{ => infra}/net/proxy/todo.yaml | 0 apps/{ => infra}/net/tailscale/helmchart.yaml | 0 apps/{ => infra}/net/xray/xray.yaml | 0 35 files changed, 105 insertions(+), 9 deletions(-) create mode 100644 apps/apps/halo/helmchart.yaml create mode 100644 apps/apps/halo/ingress-static.yaml create mode 100644 apps/apps/namespaces.yaml rename apps/{ => infra}/data/cloudnative-pg/cnpg-cluster-hk.yaml (100%) rename apps/{ => infra}/data/cloudnative-pg/cnpg-cluster-sh.yaml (100%) rename apps/{ => infra}/data/cloudnative-pg/helmchart.yaml (100%) rename apps/{ => infra}/data/cloudnative-pg/loadbalancer-hk.yaml (100%) rename apps/{ => infra}/data/cloudnative-pg/loadbalancer-sh.yaml (100%) rename apps/{ => infra}/data/milvus/helmchart.yaml (100%) rename apps/{ => infra}/data/milvus/loadbalancer.yaml (100%) rename apps/{ => infra}/data/namespaces.yaml (100%) rename apps/{ => infra}/data/postgresql-ha/configmap-pgpool-script.yaml (100%) rename apps/{ => infra}/data/postgresql-ha/helmchart.yaml (100%) rename apps/{ => infra}/data/postgresql-ha/loadbalancer.yaml (100%) rename apps/{ => infra}/data/redis/helmchart.yaml (100%) rename apps/{ => infra}/devops/cert-manager/helmchart-dnspod.yaml (100%) rename apps/{ => infra}/devops/cert-manager/helmchart.yaml (100%) rename apps/{ => infra}/devops/gitea/configmap-custom.yaml (100%) rename apps/{ => infra}/devops/gitea/helmchart.yaml (94%) rename apps/{ => infra}/devops/gitea/ingress-static.yaml (86%) rename apps/{ => infra}/devops/gitea/loadbalancer-ssh.yaml (100%) rename apps/{ => infra}/devops/namespaces.yaml (100%) rename apps/{ => infra}/monitor/crowdsec/helmchart.yaml (100%) rename apps/{ => infra}/monitor/loki/helmchart-loki.yaml (100%) rename apps/{ => infra}/monitor/loki/helmchart-promtail.yaml (100%) rename apps/{ => infra}/monitor/namespaces.yaml (100%) rename apps/{ => infra}/monitor/prometheus/helmchart.yaml (100%) rename apps/{ => infra}/monitor/prometheus/ingress-static.yaml (86%) rename apps/{ => infra}/net/certs/certificate-dev-cm.yaml (100%) rename apps/{ => infra}/net/certs/certificate-fillcode-com.yaml (100%) rename apps/{ => infra}/net/namespaces.yaml (100%) rename apps/{ => infra}/net/nginx/helmchart.yaml (100%) rename apps/{ => infra}/net/proxy/todo.yaml (100%) rename apps/{ => infra}/net/tailscale/helmchart.yaml (100%) rename apps/{ => infra}/net/xray/xray.yaml (100%) diff --git a/apps/apps/halo/helmchart.yaml b/apps/apps/halo/helmchart.yaml new file mode 100644 index 0000000..ea783f4 --- /dev/null +++ b/apps/apps/halo/helmchart.yaml @@ -0,0 +1,61 @@ +apiVersion: helm.cattle.io/v1 +kind: HelmChart +metadata: + name: halo + namespace: apps +spec: + repo: https://halo-sigs.github.io/charts/ + chart: halo + targetNamespace: apps + version: 1.1.0 + valuesContent: |- + affinity: + podAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + podAffinityTerm: + labelSelector: + matchLabels: + cnpg.io/cluster: cnpg-cluster-hk + role: primary + topologyKey: kubernetes.io/hostname + namespaceSelector: {} + nodeAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + preference: + matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - greenhk + image: + repository: halohub/halo-pro + tag: 2.18.0 + mysql: + enabled: false + postgresql: + enabled: false + externalDatabase: + platform: postgresql + host: cnpg-cluster-hk-rw.infra-data + port: 5432 + user: app + password: nyrHzh9WWlDZzvVw7bDFo74gKb9zsls0Sy7OwRTDWiRTNPQQQkW85taUFAoX2AIC + database: halo + service: + type: ClusterIP + ingress: + enabled: true + ingressClassName: nginx + annotations: + nginx.ingress.kubernetes.io/proxy-body-size: "50m" + hostname: dev.cm + path: / + pathType: Prefix + haloUsername: rohow + extraEnvVars: + - name: HALO_EXTERNAL_URL + value: https://dev.cm + + diff --git a/apps/apps/halo/ingress-static.yaml b/apps/apps/halo/ingress-static.yaml new file mode 100644 index 0000000..c3099a5 --- /dev/null +++ b/apps/apps/halo/ingress-static.yaml @@ -0,0 +1,30 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: halo-static + namespace: apps + annotations: + nginx.ingress.kubernetes.io/use-regex: "true" + nginx.ingress.kubernetes.io/proxy-buffering: "on" + nginx.ingress.kubernetes.io/configuration-snippet: | + proxy_cache cache; + proxy_cache_valid 200 302 7d; + proxy_cache_valid 404 10m; + proxy_cache_valid any 1h; + proxy_cache_use_stale error timeout updating http_404 http_500 http_502 http_503 http_504; + proxy_cache_bypass $http_x_purge; + proxy_ignore_headers Cache-Control; + add_header X-Cache-Status $upstream_cache_status; +spec: + ingressClassName: nginx + rules: + - host: dev.cm + http: + paths: + - path: /(.*\.(css|js|png|jpg|jpeg|gif|svg|webp|ico|woff|woff2|ttf|eot)|avatars/[^/]+)$ + pathType: ImplementationSpecific + backend: + service: + name: halo + port: + number: 80 diff --git a/apps/apps/namespaces.yaml b/apps/apps/namespaces.yaml new file mode 100644 index 0000000..f05026e --- /dev/null +++ b/apps/apps/namespaces.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: apps diff --git a/apps/data/cloudnative-pg/cnpg-cluster-hk.yaml b/apps/infra/data/cloudnative-pg/cnpg-cluster-hk.yaml similarity index 100% rename from apps/data/cloudnative-pg/cnpg-cluster-hk.yaml rename to apps/infra/data/cloudnative-pg/cnpg-cluster-hk.yaml diff --git a/apps/data/cloudnative-pg/cnpg-cluster-sh.yaml b/apps/infra/data/cloudnative-pg/cnpg-cluster-sh.yaml similarity index 100% rename from apps/data/cloudnative-pg/cnpg-cluster-sh.yaml rename to apps/infra/data/cloudnative-pg/cnpg-cluster-sh.yaml diff --git a/apps/data/cloudnative-pg/helmchart.yaml b/apps/infra/data/cloudnative-pg/helmchart.yaml similarity index 100% rename from apps/data/cloudnative-pg/helmchart.yaml rename to apps/infra/data/cloudnative-pg/helmchart.yaml diff --git a/apps/data/cloudnative-pg/loadbalancer-hk.yaml b/apps/infra/data/cloudnative-pg/loadbalancer-hk.yaml similarity index 100% rename from apps/data/cloudnative-pg/loadbalancer-hk.yaml rename to apps/infra/data/cloudnative-pg/loadbalancer-hk.yaml diff --git a/apps/data/cloudnative-pg/loadbalancer-sh.yaml b/apps/infra/data/cloudnative-pg/loadbalancer-sh.yaml similarity index 100% rename from apps/data/cloudnative-pg/loadbalancer-sh.yaml rename to apps/infra/data/cloudnative-pg/loadbalancer-sh.yaml diff --git a/apps/data/milvus/helmchart.yaml b/apps/infra/data/milvus/helmchart.yaml similarity index 100% rename from apps/data/milvus/helmchart.yaml rename to apps/infra/data/milvus/helmchart.yaml diff --git a/apps/data/milvus/loadbalancer.yaml b/apps/infra/data/milvus/loadbalancer.yaml similarity index 100% rename from apps/data/milvus/loadbalancer.yaml rename to apps/infra/data/milvus/loadbalancer.yaml diff --git a/apps/data/namespaces.yaml b/apps/infra/data/namespaces.yaml similarity index 100% rename from apps/data/namespaces.yaml rename to apps/infra/data/namespaces.yaml diff --git a/apps/data/postgresql-ha/configmap-pgpool-script.yaml b/apps/infra/data/postgresql-ha/configmap-pgpool-script.yaml similarity index 100% rename from apps/data/postgresql-ha/configmap-pgpool-script.yaml rename to apps/infra/data/postgresql-ha/configmap-pgpool-script.yaml diff --git a/apps/data/postgresql-ha/helmchart.yaml b/apps/infra/data/postgresql-ha/helmchart.yaml similarity index 100% rename from apps/data/postgresql-ha/helmchart.yaml rename to apps/infra/data/postgresql-ha/helmchart.yaml diff --git a/apps/data/postgresql-ha/loadbalancer.yaml b/apps/infra/data/postgresql-ha/loadbalancer.yaml similarity index 100% rename from apps/data/postgresql-ha/loadbalancer.yaml rename to apps/infra/data/postgresql-ha/loadbalancer.yaml diff --git a/apps/data/redis/helmchart.yaml b/apps/infra/data/redis/helmchart.yaml similarity index 100% rename from apps/data/redis/helmchart.yaml rename to apps/infra/data/redis/helmchart.yaml diff --git a/apps/devops/cert-manager/helmchart-dnspod.yaml b/apps/infra/devops/cert-manager/helmchart-dnspod.yaml similarity index 100% rename from apps/devops/cert-manager/helmchart-dnspod.yaml rename to apps/infra/devops/cert-manager/helmchart-dnspod.yaml diff --git a/apps/devops/cert-manager/helmchart.yaml b/apps/infra/devops/cert-manager/helmchart.yaml similarity index 100% rename from apps/devops/cert-manager/helmchart.yaml rename to apps/infra/devops/cert-manager/helmchart.yaml diff --git a/apps/devops/gitea/configmap-custom.yaml b/apps/infra/devops/gitea/configmap-custom.yaml similarity index 100% rename from apps/devops/gitea/configmap-custom.yaml rename to apps/infra/devops/gitea/configmap-custom.yaml diff --git a/apps/devops/gitea/helmchart.yaml b/apps/infra/devops/gitea/helmchart.yaml similarity index 94% rename from apps/devops/gitea/helmchart.yaml rename to apps/infra/devops/gitea/helmchart.yaml index 49291a5..801a3f1 100644 --- a/apps/devops/gitea/helmchart.yaml +++ b/apps/infra/devops/gitea/helmchart.yaml @@ -12,7 +12,8 @@ spec: affinity: podAffinity: preferredDuringSchedulingIgnoredDuringExecution: - - podAffinityTerm: + - weight: 1 + podAffinityTerm: labelSelector: matchLabels: cnpg.io/cluster: cnpg-cluster-sh @@ -20,16 +21,16 @@ spec: app.kubernetes.io/name: redis app.kubernetes.io/component: master topologyKey: kubernetes.io/hostname - weight: 1 + namespaceSelector: {} nodeAffinity: preferredDuringSchedulingIgnoredDuringExecution: - - preference: + - weight: 1 + preference: matchExpressions: - key: kubernetes.io/hostname operator: In values: - - homea - weight: 1 + - homea redis-cluster: enabled: false postgresql-ha: diff --git a/apps/devops/gitea/ingress-static.yaml b/apps/infra/devops/gitea/ingress-static.yaml similarity index 86% rename from apps/devops/gitea/ingress-static.yaml rename to apps/infra/devops/gitea/ingress-static.yaml index 98b19f3..e9d6164 100644 --- a/apps/devops/gitea/ingress-static.yaml +++ b/apps/infra/devops/gitea/ingress-static.yaml @@ -8,7 +8,7 @@ metadata: nginx.ingress.kubernetes.io/proxy-buffering: "on" nginx.ingress.kubernetes.io/configuration-snippet: | proxy_cache cache; - proxy_cache_valid 200 302 1d; + proxy_cache_valid 200 302 7d; proxy_cache_valid 404 10m; proxy_cache_valid any 1h; proxy_cache_use_stale error timeout updating http_404 http_500 http_502 http_503 http_504; @@ -21,7 +21,7 @@ spec: - host: git.dev.cm http: paths: - - path: /(assets|avatars)/.* + - path: /(.*\.(css|js|png|jpg|jpeg|gif|svg|webp|ico|woff|woff2|ttf|eot)|avatars/[^/]+)$ pathType: ImplementationSpecific backend: service: diff --git a/apps/devops/gitea/loadbalancer-ssh.yaml b/apps/infra/devops/gitea/loadbalancer-ssh.yaml similarity index 100% rename from apps/devops/gitea/loadbalancer-ssh.yaml rename to apps/infra/devops/gitea/loadbalancer-ssh.yaml diff --git a/apps/devops/namespaces.yaml b/apps/infra/devops/namespaces.yaml similarity index 100% rename from apps/devops/namespaces.yaml rename to apps/infra/devops/namespaces.yaml diff --git a/apps/monitor/crowdsec/helmchart.yaml b/apps/infra/monitor/crowdsec/helmchart.yaml similarity index 100% rename from apps/monitor/crowdsec/helmchart.yaml rename to apps/infra/monitor/crowdsec/helmchart.yaml diff --git a/apps/monitor/loki/helmchart-loki.yaml b/apps/infra/monitor/loki/helmchart-loki.yaml similarity index 100% rename from apps/monitor/loki/helmchart-loki.yaml rename to apps/infra/monitor/loki/helmchart-loki.yaml diff --git a/apps/monitor/loki/helmchart-promtail.yaml b/apps/infra/monitor/loki/helmchart-promtail.yaml similarity index 100% rename from apps/monitor/loki/helmchart-promtail.yaml rename to apps/infra/monitor/loki/helmchart-promtail.yaml diff --git a/apps/monitor/namespaces.yaml b/apps/infra/monitor/namespaces.yaml similarity index 100% rename from apps/monitor/namespaces.yaml rename to apps/infra/monitor/namespaces.yaml diff --git a/apps/monitor/prometheus/helmchart.yaml b/apps/infra/monitor/prometheus/helmchart.yaml similarity index 100% rename from apps/monitor/prometheus/helmchart.yaml rename to apps/infra/monitor/prometheus/helmchart.yaml diff --git a/apps/monitor/prometheus/ingress-static.yaml b/apps/infra/monitor/prometheus/ingress-static.yaml similarity index 86% rename from apps/monitor/prometheus/ingress-static.yaml rename to apps/infra/monitor/prometheus/ingress-static.yaml index 817037d..8eaaa43 100644 --- a/apps/monitor/prometheus/ingress-static.yaml +++ b/apps/infra/monitor/prometheus/ingress-static.yaml @@ -8,7 +8,7 @@ metadata: nginx.ingress.kubernetes.io/proxy-buffering: "on" nginx.ingress.kubernetes.io/configuration-snippet: | proxy_cache cache; - proxy_cache_valid 200 302 1d; + proxy_cache_valid 200 302 7d; proxy_cache_valid 404 10m; proxy_cache_valid any 1h; proxy_cache_use_stale error timeout updating http_404 http_500 http_502 http_503 http_504; @@ -21,7 +21,7 @@ spec: - host: monitor.dev.cm http: paths: - - path: /(public|avatar)/.* + - path: /(.*\.(css|js|png|jpg|jpeg|gif|svg|webp|ico|woff|woff2|ttf|eot)|avatars/[^/]+)$ pathType: ImplementationSpecific backend: service: diff --git a/apps/net/certs/certificate-dev-cm.yaml b/apps/infra/net/certs/certificate-dev-cm.yaml similarity index 100% rename from apps/net/certs/certificate-dev-cm.yaml rename to apps/infra/net/certs/certificate-dev-cm.yaml diff --git a/apps/net/certs/certificate-fillcode-com.yaml b/apps/infra/net/certs/certificate-fillcode-com.yaml similarity index 100% rename from apps/net/certs/certificate-fillcode-com.yaml rename to apps/infra/net/certs/certificate-fillcode-com.yaml diff --git a/apps/net/namespaces.yaml b/apps/infra/net/namespaces.yaml similarity index 100% rename from apps/net/namespaces.yaml rename to apps/infra/net/namespaces.yaml diff --git a/apps/net/nginx/helmchart.yaml b/apps/infra/net/nginx/helmchart.yaml similarity index 100% rename from apps/net/nginx/helmchart.yaml rename to apps/infra/net/nginx/helmchart.yaml diff --git a/apps/net/proxy/todo.yaml b/apps/infra/net/proxy/todo.yaml similarity index 100% rename from apps/net/proxy/todo.yaml rename to apps/infra/net/proxy/todo.yaml diff --git a/apps/net/tailscale/helmchart.yaml b/apps/infra/net/tailscale/helmchart.yaml similarity index 100% rename from apps/net/tailscale/helmchart.yaml rename to apps/infra/net/tailscale/helmchart.yaml diff --git a/apps/net/xray/xray.yaml b/apps/infra/net/xray/xray.yaml similarity index 100% rename from apps/net/xray/xray.yaml rename to apps/infra/net/xray/xray.yaml