Add trafficSampleRate field to TapConfig

This commit is contained in:
M. Mert Yildiran
2024-01-10 18:51:52 +03:00
parent db51e6dbc2
commit 8ba3e603a4
4 changed files with 35 additions and 2 deletions

View File

@@ -159,6 +159,7 @@ type TapConfig struct {
Capabilities CapabilitiesConfig `yaml:"capabilities" json:"capabilities"` Capabilities CapabilitiesConfig `yaml:"capabilities" json:"capabilities"`
GlobalFilter string `yaml:"globalFilter" json:"globalFilter"` GlobalFilter string `yaml:"globalFilter" json:"globalFilter"`
Metrics MetricsConfig `yaml:"metrics" json:"metrics"` Metrics MetricsConfig `yaml:"metrics" json:"metrics"`
TrafficSampleRate int `yaml:"trafficSampleRate" json:"trafficSampleRate" default:"100"`
} }
func (config *TapConfig) PodRegex() *regexp.Regexp { func (config *TapConfig) PodRegex() *regexp.Regexp {

View File

@@ -17,3 +17,4 @@ data:
TELEMETRY_DISABLED: '{{ not .Values.tap.telemetry.enabled | ternary "true" "" }}' TELEMETRY_DISABLED: '{{ not .Values.tap.telemetry.enabled | ternary "true" "" }}'
REPLAY_DISABLED: '{{ .Values.tap.replayDisabled | ternary "true" "" }}' REPLAY_DISABLED: '{{ .Values.tap.replayDisabled | ternary "true" "" }}'
GLOBAL_FILTER: '{{ .Values.tap.globalFilter }}' GLOBAL_FILTER: '{{ .Values.tap.globalFilter }}'
TRAFFIC_SAMPLE_RATE: '{{ .Values.tap.trafficSampleRate }}'

View File

@@ -39,8 +39,8 @@ tap:
requests: requests:
cpu: 50m cpu: 50m
memory: 50Mi memory: 50Mi
serviceMesh: false serviceMesh: true
tls: false tls: true
ignoreTainted: false ignoreTainted: false
labels: {} labels: {}
annotations: {} annotations: {}
@@ -93,6 +93,7 @@ tap:
globalFilter: "" globalFilter: ""
metrics: metrics:
port: 49100 port: 49100
trafficSampleRate: 100
logs: logs:
file: "" file: ""
kube: kube:

View File

@@ -102,6 +102,7 @@ data:
TELEMETRY_DISABLED: '' TELEMETRY_DISABLED: ''
REPLAY_DISABLED: '' REPLAY_DISABLED: ''
GLOBAL_FILTER: '' GLOBAL_FILTER: ''
TRAFFIC_SAMPLE_RATE: '100'
--- ---
# Source: kubeshark/templates/02-cluster-role.yaml # Source: kubeshark/templates/02-cluster-role.yaml
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
@@ -248,6 +249,29 @@ spec:
app.kubeshark.co/app: front app.kubeshark.co/app: front
type: ClusterIP type: ClusterIP
--- ---
# Source: kubeshark/templates/16-worker-service-metrics.yaml
kind: Service
apiVersion: v1
metadata:
name: kubeshark-worker-metrics
namespace: default
annotations:
prometheus.io/scrape: 'true'
prometheus.io/port: '49100'
spec:
selector:
app.kubeshark.co/app: worker
helm.sh/chart: kubeshark-52.0.0
app.kubernetes.io/name: kubeshark
app.kubernetes.io/instance: kubeshark
app.kubernetes.io/version: "52.0.0"
app.kubernetes.io/managed-by: Helm
ports:
- name: metrics
protocol: TCP
port: 49100
targetPort: 49100
---
# Source: kubeshark/templates/09-worker-daemon-set.yaml # Source: kubeshark/templates/09-worker-daemon-set.yaml
apiVersion: apps/v1 apiVersion: apps/v1
kind: DaemonSet kind: DaemonSet
@@ -291,12 +315,18 @@ spec:
- any - any
- -port - -port
- '30001' - '30001'
- -metrics-port
- '49100'
- -servicemesh - -servicemesh
- -procfs - -procfs
- /hostproc - /hostproc
image: 'docker.io/kubeshark/worker:v52.0.0' image: 'docker.io/kubeshark/worker:v52.0.0'
imagePullPolicy: Always imagePullPolicy: Always
name: sniffer name: sniffer
ports:
- containerPort: 49100
protocol: TCP
name: metrics
env: env:
- name: POD_NAME - name: POD_NAME
valueFrom: valueFrom: