From 4ef33194a11fe0ee427e2f239beb95d86c7596a2 Mon Sep 17 00:00:00 2001 From: rohow Date: Tue, 23 Jul 2024 16:02:38 +0800 Subject: [PATCH] =?UTF-8?q?feat(nginx):=20=E7=BC=93=E5=AD=98=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/devops/gitea/helmchart.yaml | 10 +++++++ ...{ingress-http.yaml => ingress-static.yaml} | 25 ++-------------- apps/monitor/crowdsec/helmchart.yaml | 2 ++ apps/monitor/prometheus/helmchart.yaml | 6 ++-- apps/monitor/prometheus/ingress-static.yaml | 30 +++++++++++++++++++ 5 files changed, 47 insertions(+), 26 deletions(-) rename apps/devops/gitea/{ingress-http.yaml => ingress-static.yaml} (66%) create mode 100644 apps/monitor/prometheus/ingress-static.yaml diff --git a/apps/devops/gitea/helmchart.yaml b/apps/devops/gitea/helmchart.yaml index 8a31733..49291a5 100644 --- a/apps/devops/gitea/helmchart.yaml +++ b/apps/devops/gitea/helmchart.yaml @@ -36,6 +36,16 @@ spec: enabled: false image: tag: 1.22.0 + ingress: + enabled: true + className: nginx + annotations: + nginx.ingress.kubernetes.io/proxy-body-size: "50m" + hosts: + - host: git.dev.cm + paths: + - path: / + pathType: Prefix gitea: config: APP_NAME: Git.dev.cm diff --git a/apps/devops/gitea/ingress-http.yaml b/apps/devops/gitea/ingress-static.yaml similarity index 66% rename from apps/devops/gitea/ingress-http.yaml rename to apps/devops/gitea/ingress-static.yaml index 8d96add..98b19f3 100644 --- a/apps/devops/gitea/ingress-http.yaml +++ b/apps/devops/gitea/ingress-static.yaml @@ -1,28 +1,7 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: gitea-http - namespace: infra-devops - annotations: - nginx.ingress.kubernetes.io/proxy-body-size: "50m" -spec: - ingressClassName: nginx - rules: - - host: git.dev.cm - http: - paths: - - pathType: Prefix - path: "/" - backend: - service: - name: gitea-http - port: - number: 3000 ---- -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: gitea-http-static + name: gitea-static namespace: infra-devops annotations: nginx.ingress.kubernetes.io/use-regex: "true" @@ -48,4 +27,4 @@ spec: service: name: gitea-http port: - number: 3000 \ No newline at end of file + number: 3000 diff --git a/apps/monitor/crowdsec/helmchart.yaml b/apps/monitor/crowdsec/helmchart.yaml index 17f9334..06998ad 100644 --- a/apps/monitor/crowdsec/helmchart.yaml +++ b/apps/monitor/crowdsec/helmchart.yaml @@ -25,6 +25,8 @@ spec: agent: nodeSelector: svccontroller.k3s.cattle.io/enablelb: "true" + # 由于使用了loki搜集日志 此处不再需要 所以使用此标签 禁用所有的agent + crowdsec/enabled: "true" acquisition: - namespace: infra-net podName: ingress-nginx-controller-* diff --git a/apps/monitor/prometheus/helmchart.yaml b/apps/monitor/prometheus/helmchart.yaml index df9bcfd..bee29b1 100644 --- a/apps/monitor/prometheus/helmchart.yaml +++ b/apps/monitor/prometheus/helmchart.yaml @@ -75,7 +75,7 @@ spec: podMonitorSelectorNilUsesHelmValues: false ruleSelectorNilUsesHelmValues: false ingress: - enabled: true + enabled: false ingressClassName: nginx hosts: - monitor.dev.cm @@ -97,9 +97,9 @@ spec: storage: 10Gi routePrefix: /alertmanager ingress: - enabled: true + enabled: false ingressClassName: nginx hosts: - monitor.dev.cm paths: - - /alertmanager \ No newline at end of file + - /alertmanager diff --git a/apps/monitor/prometheus/ingress-static.yaml b/apps/monitor/prometheus/ingress-static.yaml new file mode 100644 index 0000000..817037d --- /dev/null +++ b/apps/monitor/prometheus/ingress-static.yaml @@ -0,0 +1,30 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: grafana-static + namespace: infra-monitor + 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 1d; + 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: monitor.dev.cm + http: + paths: + - path: /(public|avatar)/.* + pathType: ImplementationSpecific + backend: + service: + name: prometheus-grafana + port: + number: 80