Compare commits

..

1 Commits

Author SHA1 Message Date
0c811fb09f chore(deps): update kubezero-ci-dependencies 2025-02-27 03:02:35 +00:00
13 changed files with 186 additions and 52 deletions

View File

@ -2,7 +2,7 @@ apiVersion: v2
name: envoy-ratelimit name: envoy-ratelimit
description: Envoy gobal ratelimiting service - part of KubeZero description: Envoy gobal ratelimiting service - part of KubeZero
type: application type: application
version: 0.1.2 version: 0.1.0
home: https://kubezero.com home: https://kubezero.com
icon: https://cdn.zero-downtime.net/assets/kubezero/logo-small-64.png icon: https://cdn.zero-downtime.net/assets/kubezero/logo-small-64.png
keywords: keywords:

View File

@ -0,0 +1,106 @@
{{- if .Values.metrics.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: ratelimit-statsd-exporter-config
namespace: {{ .Release.Namespace }}
labels:
{{- include "kubezero-lib.labels" . | nindent 4 }}
data:
config.yaml: |
defaults:
ttl: 1m # Resets the metrics every minute
mappings:
- match:
"ratelimit.service.rate_limit.*.*.near_limit"
name: "ratelimit_service_rate_limit_near_limit"
timer_type: "histogram"
labels:
domain: "$1"
key1: "$2"
- match:
"ratelimit.service.rate_limit.*.*.over_limit"
name: "ratelimit_service_rate_limit_over_limit"
timer_type: "histogram"
labels:
domain: "$1"
key1: "$2"
- match:
"ratelimit.service.rate_limit.*.*.total_hits"
name: "ratelimit_service_rate_limit_total_hits"
timer_type: "histogram"
labels:
domain: "$1"
key1: "$2"
- match:
"ratelimit.service.rate_limit.*.*.within_limit"
name: "ratelimit_service_rate_limit_within_limit"
timer_type: "histogram"
labels:
domain: "$1"
key1: "$2"
- match:
"ratelimit.service.rate_limit.*.*.*.near_limit"
name: "ratelimit_service_rate_limit_near_limit"
timer_type: "histogram"
labels:
domain: "$1"
key1: "$2"
key2: "$3"
- match:
"ratelimit.service.rate_limit.*.*.*.over_limit"
name: "ratelimit_service_rate_limit_over_limit"
timer_type: "histogram"
labels:
domain: "$1"
key1: "$2"
key2: "$3"
- match:
"ratelimit.service.rate_limit.*.*.*.total_hits"
name: "ratelimit_service_rate_limit_total_hits"
timer_type: "histogram"
labels:
domain: "$1"
key1: "$2"
key2: "$3"
- match:
"ratelimit.service.rate_limit.*.*.*.within_limit"
name: "ratelimit_service_rate_limit_within_limit"
timer_type: "histogram"
labels:
domain: "$1"
key1: "$2"
key2: "$3"
- match:
"ratelimit.service.call.should_rate_limit.*"
name: "ratelimit_service_should_rate_limit_error"
match_metric_type: counter
labels:
err_type: "$1"
- match:
"ratelimit_server.*.total_requests"
name: "ratelimit_service_total_requests"
match_metric_type: counter
labels:
grpc_method: "$1"
- match:
"ratelimit_server.*.response_time"
name: "ratelimit_service_response_time_seconds"
timer_type: histogram
labels:
grpc_method: "$1"
- match:
"ratelimit.service.config_load_success"
name: "ratelimit_service_config_load_success"
match_metric_type: counter
ttl: 3m
- match:
"ratelimit.service.config_load_error"
name: "ratelimit_service_config_load_error"
match_metric_type: counter
ttl: 3m
- match: "."
match_type: "regex"
action: "drop"
name: "dropped"
{{- end }}

View File

@ -16,7 +16,7 @@ spec:
app: ratelimit app: ratelimit
spec: spec:
containers: containers:
- image: {{ .Values.image.repository }}:{{ .Values.image.tag }} - image: envoyproxy/ratelimit:b42701cb # 2021/08/12
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
name: ratelimit name: ratelimit
command: ["/bin/ratelimit"] command: ["/bin/ratelimit"]
@ -28,11 +28,13 @@ spec:
- name: REDIS_SOCKET_TYPE - name: REDIS_SOCKET_TYPE
value: tcp value: tcp
- name: REDIS_URL - name: REDIS_URL
value: ratelimit-valkey:6379 value: ratelimit-redis:6379
- name: USE_PROMETHEUS
value: "true"
- name: USE_STATSD - name: USE_STATSD
value: "false" value: "true"
- name: STATSD_HOST
value: "localhost"
- name: STATSD_PORT
value: "9125"
- name: RUNTIME_ROOT - name: RUNTIME_ROOT
value: /data value: /data
- name: RUNTIME_SUBDIRECTORY - name: RUNTIME_SUBDIRECTORY
@ -44,8 +46,8 @@ spec:
- name: LOCAL_CACHE_SIZE_IN_BYTES - name: LOCAL_CACHE_SIZE_IN_BYTES
value: "{{ default 0 .Values.localCacheSize | int }}" value: "{{ default 0 .Values.localCacheSize | int }}"
ports: ports:
- containerPort: 8081
#- containerPort: 8080 #- containerPort: 8080
- containerPort: 8081
#- containerPort: 6070 #- containerPort: 6070
volumeMounts: volumeMounts:
- name: ratelimit-config - name: ratelimit-config
@ -57,7 +59,27 @@ spec:
limits: limits:
cpu: 1 cpu: 1
memory: 256Mi memory: 256Mi
- name: statsd-exporter
image: docker.io/prom/statsd-exporter:v0.21.0
imagePullPolicy: Always
args: ["--statsd.mapping-config=/etc/statsd-exporter/config.yaml"]
ports:
- containerPort: 9125
# - containerPort: 9102
resources:
requests:
cpu: 50m
memory: 32Mi
limits:
cpu: 200m
memory: 64Mi
volumeMounts:
- name: statsd-exporter-config
mountPath: /etc/statsd-exporter
volumes: volumes:
- name: ratelimit-config - name: ratelimit-config
configMap: configMap:
name: ratelimit-config name: ratelimit-config
- name: statsd-exporter-config
configMap:
name: ratelimit-statsd-exporter-config

View File

@ -1,24 +1,24 @@
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: ratelimit-valkey name: ratelimit-redis
namespace: {{ .Release.Namespace }} namespace: {{ .Release.Namespace }}
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
app: ratelimit-valkey app: ratelimit-redis
template: template:
metadata: metadata:
labels: labels:
app: ratelimit-valkey app: ratelimit-redis
spec: spec:
containers: containers:
- image: valkey/valkey:8.1-alpine3.21 - image: redis:6-alpine
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
name: valkey name: redis
ports: ports:
- name: valkey - name: redis
containerPort: 6379 containerPort: 6379
restartPolicy: Always restartPolicy: Always
serviceAccountName: "" serviceAccountName: ""

View File

@ -1,13 +1,13 @@
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: ratelimit-valkey name: ratelimit-redis
namespace: {{ .Release.Namespace }} namespace: {{ .Release.Namespace }}
labels: labels:
app: ratelimit-valkey app: ratelimit-redis
spec: spec:
ports: ports:
- name: valkey - name: redis
port: 6379 port: 6379
selector: selector:
app: ratelimit-valkey app: ratelimit-redis

View File

@ -20,8 +20,8 @@ spec:
# targetPort: 6070 # targetPort: 6070
# protocol: TCP # protocol: TCP
- name: http-monitoring - name: http-monitoring
port: 9090 port: 9102
targetPort: 9090 targetPort: 9102
protocol: TCP protocol: TCP
selector: selector:
app: ratelimit app: ratelimit

View File

@ -1,8 +1,3 @@
image:
repository: envoyproxy/ratelimit
# see: https://hub.docker.com/r/envoyproxy/ratelimit/tags
tag: 80b15778
log: log:
level: warn level: warn
format: json format: json
@ -13,26 +8,19 @@ localCacheSize: 1048576
# Wether to block requests if ratelimiting is down # Wether to block requests if ratelimiting is down
failureModeDeny: false failureModeDeny: false
# rate limit descriptors for each domain # rate limit descriptors for each domain, examples 10 req/s per sourceIP
# - slow: 1 req/s over a minute per sourceIP
descriptors: descriptors:
ingress: ingress:
- key: speed - key: remote_address
value: slow rate_limit:
descriptors: unit: second
- key: remote_address requests_per_unit: 10
rate_limit:
unit: minute
requests_per_unit: 60
privateIngress: privateIngress:
- key: speed - key: remote_address
value: slow rate_limit:
descriptors: unit: second
- key: remote_address requests_per_unit: 10
rate_limit:
unit: minute
requests_per_unit: 60
metrics: metrics:
enabled: false enabled: true

View File

@ -30,7 +30,7 @@ dependencies:
repository: https://aquasecurity.github.io/helm-charts/ repository: https://aquasecurity.github.io/helm-charts/
condition: trivy.enabled condition: trivy.enabled
- name: renovate - name: renovate
version: 39.182.4 version: 39.182.3
repository: https://docs.renovatebot.com/helm-charts repository: https://docs.renovatebot.com/helm-charts
condition: renovate.enabled condition: renovate.enabled
kubeVersion: ">= 1.25.0" kubeVersion: ">= 1.25.0"

View File

@ -16,10 +16,6 @@ gitea:
claimName: data-gitea-0 claimName: data-gitea-0
size: 4Gi size: 4Gi
service:
http:
port: 80
securityContext: securityContext:
allowPrivilegeEscalation: false allowPrivilegeEscalation: false
capabilities: capabilities:
@ -302,7 +298,7 @@ renovate:
LOG_FORMAT: json LOG_FORMAT: json
cronjob: cronjob:
concurrencyPolicy: Forbid concurrencyPolicy: Forbid
jobBackoffLimit: 2 jobBackoffLimit: 3
schedule: "0 3 * * *" schedule: "0 3 * * *"
successfulJobsHistoryLimit: 1 successfulJobsHistoryLimit: 1

View File

@ -16,7 +16,7 @@ dependencies:
version: 0.2.1 version: 0.2.1
repository: https://cdn.zero-downtime.net/charts/ repository: https://cdn.zero-downtime.net/charts/
- name: envoy-ratelimit - name: envoy-ratelimit
version: 0.1.2 version: 0.1.0
repository: https://cdn.zero-downtime.net/charts/ repository: https://cdn.zero-downtime.net/charts/
condition: envoy-ratelimit.enabled condition: envoy-ratelimit.enabled
- name: base - name: base

View File

@ -20,7 +20,7 @@ Kubernetes: `>= 1.30.0-0`
| Repository | Name | Version | | Repository | Name | Version |
|------------|------|---------| |------------|------|---------|
| https://cdn.zero-downtime.net/charts/ | envoy-ratelimit | 0.1.2 | | https://cdn.zero-downtime.net/charts/ | envoy-ratelimit | 0.1.0 |
| https://cdn.zero-downtime.net/charts/ | kubezero-lib | 0.2.1 | | https://cdn.zero-downtime.net/charts/ | kubezero-lib | 0.2.1 |
| https://istio-release.storage.googleapis.com/charts | base | 1.24.3 | | https://istio-release.storage.googleapis.com/charts | base | 1.24.3 |
| https://istio-release.storage.googleapis.com/charts | istiod | 1.24.3 | | https://istio-release.storage.googleapis.com/charts | istiod | 1.24.3 |

View File

@ -56,7 +56,29 @@ kiali-server:
#url: "kiali.example.com" #url: "kiali.example.com"
# for available options see envoy-ratelimit chart
envoy-ratelimit: envoy-ratelimit:
enabled: false enabled: false
log:
level: warn
format: json
# 1MB local cache for already reached limits to reduce calls to Redis
localCacheSize: 1048576
# Wether to block requests if ratelimiting is down
failureModeDeny: false
# rate limit descriptors for each domain, examples 10 req/s per sourceIP
descriptors:
ingress:
- key: remote_address
rate_limit:
unit: second
requests_per_unit: 10
privateIngress:
- key: remote_address
rate_limit:
unit: second
requests_per_unit: 10

View File

@ -28,8 +28,8 @@ kiali-server:
{{- toYaml . | nindent 2 }} {{- toYaml . | nindent 2 }}
{{- end }} {{- end }}
{{- with index .Values "istio" "envoy-ratelimit" }} {{- with .Values.istio.rateLimiting }}
envoy-ratelimit: rateLimiting:
{{- toYaml . | nindent 2 }} {{- toYaml . | nindent 2 }}
{{- end }} {{- end }}
{{- end }} {{- end }}