Skip to content

Commit

Permalink
Merge pull request #16 from osuAkatsuki/drop-old
Browse files Browse the repository at this point in the history
drop old logs & disable monitoring setup
  • Loading branch information
infernalfire72 authored Jan 30, 2025
2 parents a0773c8 + 4abd32c commit 08f66bd
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 24 deletions.
76 changes: 54 additions & 22 deletions .github/workflows/grafana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ env:
REDIS_PORT: ${{ secrets.REDIS_PORT }}

jobs:
production-deploy:
alloy-production-deploy:
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
helm repo add grafana https://grafana.github.io/helm-charts
helm repo update
- name: Generate helm values for alloy and k8s-monitor
- name: Generate helm values for alloy
run: |
envsubst < k8s/grafana-alloy.yaml > alloy-values.yaml
envsubst < k8s/grafana-k8s-monitor.yaml > k8s-monitoring-values.yaml
Expand All @@ -61,16 +61,6 @@ jobs:
grafana-alloy \
grafana/alloy
- name: Show manifest diff since previous k8s-monitor release
run: |
helm diff upgrade \
--version ^1 \
--allow-unreleased \
--color=true \
--values k8s-monitoring-values.yaml \
grafana-k8s-monitoring \
grafana/k8s-monitoring
- name: Deploy Alloy to production cluster
run: |
helm upgrade \
Expand All @@ -82,13 +72,55 @@ jobs:
grafana-alloy \
grafana/alloy
- name: Deploy k8s-monitor to production cluster
run: |
helm upgrade \
--install \
--version ^1 \
--atomic \
--wait --timeout 20m \
--values k8s-monitoring-values.yaml \
grafana-k8s-monitoring \
grafana/k8s-monitoring
# monitoring-production-deploy:
# runs-on: ubuntu-latest

# steps:
# - name: Check out latest commit
# uses: actions/checkout@v3

# - name: Get kubeconfig from github secrets
# run: |
# mkdir -p $HOME/.kube
# echo "${{ secrets.KUBECONFIG }}" > $HOME/.kube/config
# sudo chown $(id -u):$(id -g) $HOME/.kube/config
# chmod 600 $HOME/.kube/config

# - name: Install helm
# uses: azure/setup-helm@v3
# with:
# version: "latest"
# id: install

# - name: Install helm-diff
# run: helm plugin install https://github.com/databus23/helm-diff

# - name: Add Grafana Helm Charts Repository
# run: |
# helm repo add grafana https://grafana.github.io/helm-charts
# helm repo update

# - name: Generate helm values for k8s-monitor
# run: |
# envsubst < k8s/grafana-k8s-monitor.yaml > k8s-monitoring-values.yaml

# - name: Show manifest diff since previous k8s-monitor release
# run: |
# helm diff upgrade \
# --version ^1 \
# --allow-unreleased \
# --color=true \
# --values k8s-monitoring-values.yaml \
# grafana-k8s-monitoring \
# grafana/k8s-monitoring

# - name: Deploy k8s-monitor to production cluster
# run: |
# helm upgrade \
# --install \
# --version ^1 \
# --atomic \
# --wait --timeout 10m \
# --values k8s-monitoring-values.yaml \
# grafana-k8s-monitoring \
# grafana/k8s-monitoring
10 changes: 8 additions & 2 deletions k8s/grafana-alloy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,15 @@ alloy:
}
}
forward_to = [loki.write.drop_old.receiver]
}
loki.process "drop_old" {
forward_to = [loki.write.default.receiver]
stage.drop {
older_than = "1h"
drop_counter_reason = "too old"
}
}
loki.source.kubernetes_events "cluster_events" {
Expand All @@ -122,8 +130,6 @@ alloy:
]
}
// loki.process receives log entries from other loki components, applies one or more processing stages,
// and forwards the results to the list of receivers in the component's arguments.
loki.process "cluster_events" {
forward_to = [loki.write.default.receiver]
Expand Down

0 comments on commit 08f66bd

Please sign in to comment.