Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Sysdig agent support and testing automations #315

Merged
merged 25 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
001da86
Sysdig agent support and testing automations
manuelbcd Nov 14, 2024
ec7546a
Fix namespaces
manuelbcd Nov 15, 2024
ff486a2
Fix namespace
manuelbcd Nov 19, 2024
a43487a
Switched sysdig agent driver to ebpf
manuelbcd Nov 19, 2024
dc143f4
Fixed namespace from tests
manuelbcd Nov 20, 2024
1014b44
Fix namespace test.sh
manuelbcd Nov 21, 2024
308057d
Increasing sleep timer for tests
manuelbcd Nov 21, 2024
bb08da2
Fix test service account
manuelbcd Nov 21, 2024
1212d27
Modified test sleep parameter
manuelbcd Nov 21, 2024
64019ac
Prepared test job for multiple pods
manuelbcd Nov 21, 2024
94c4e57
Raised test sleep time to allow capturing e2e detections
manuelbcd Nov 21, 2024
783e6d1
Remove ebpf connection strategy by default
manuelbcd Nov 21, 2024
e79b195
Changed the detection message for e2e events
manuelbcd Nov 21, 2024
9ea1588
Increasing the time of the e2e test at server msgtype level
manuelbcd Nov 21, 2024
b0d1cc9
Tuning e2e event checker to 100 secs
manuelbcd Nov 21, 2024
8e4d608
Sleep values optimization
manuelbcd Nov 21, 2024
4bce866
Test optimization
manuelbcd Nov 21, 2024
1cedcee
E2e test - ine tuning
manuelbcd Nov 21, 2024
ed80420
Convert job in a cronjob
manuelbcd Nov 21, 2024
cc1df9f
Fixed job to cronjob for tests
manuelbcd Nov 21, 2024
dea4247
Switched to ebpf again for better compatibility
manuelbcd Nov 24, 2024
51a87b0
backoffLimit rearranged
manuelbcd Nov 26, 2024
88c02cf
rearranged cronjob activeDeadlineSeconds
manuelbcd Nov 26, 2024
df34652
Changed criteria for connection validation. New criteria works even f…
manuelbcd Nov 26, 2024
c22800b
Comment fix
manuelbcd Nov 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions eks-anywhere-common/Addons/Partner/Sysdig/external-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: sysdig-secretstore-ekssnow
namespace: sysdig
spec:
refreshInterval: 1m
secretStoreRef:
name: eksa-secret-store #The secret store name we have just created.
kind: ClusterSecretStore
target:
name: sysdig-access-key # Secret name in k8s
data:
- secretKey: secret-sysdig-key # which key it's going to be stored
remoteRef:
key: secret-sysdig-key # Our secret-name goes here
8 changes: 8 additions & 0 deletions eks-anywhere-common/Addons/Partner/Sysdig/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: sysdig
labels:
aws.conformance.vendor: sysdig
aws.conformance.vendor-solution: sysdig-agent
9 changes: 9 additions & 0 deletions eks-anywhere-common/Addons/Partner/Sysdig/sysdig-source.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
metadata:
name: sysdig
namespace: flux-system
spec:
interval: 30s
url: https://charts.sysdig.com
54 changes: 54 additions & 0 deletions eks-anywhere-common/Addons/Partner/Sysdig/sysdig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: sysdig
namespace: sysdig
spec:
chart:
spec:
chart: sysdig-deploy
reconcileStrategy: ChartVersion
sourceRef:
kind: HelmRepository
name: sysdig
namespace: flux-system
version: 1.67.5
interval: 30s
targetNamespace: sysdig
values:
global:
sysdig:
region: us2 # us1 | us2 | us3 | us4 | eu1 | au1
kspm:
deploy: false # Disabled by default to optimize resources. Activating it without the right cluster sizing could lead to instability
clusterConfig:
name: myclusterName # Place here a meaningful cluster name to identify it
agent:
ebpf:
enabled: true
tolerations: [] # Nullifying tolerations disallows the agents from being executed in the Control Plane
# resourceProfile: custom
mikemcd3912 marked this conversation as resolved.
Show resolved Hide resolved
# resources:
# requests:
# cpu:600m
# memory: 1G
# limits:
# cpu: 1500m
# memory: 1G
sysdig:
settings:
collector_port: 6443
nodeAnalyzer:
nodeAnalyzer:
tolerations: [] # Nullifying tolerations disallows the nodeAnalyzers from being executed in the Control Plane
benchmarkRunner:
deploy: false # Benchmark Runner disabled by default
secure:
vulnerabilityManagement:
newEngineOnly: true
valuesFrom:
- kind: Secret
name: sysdig-access-key
valuesKey: secret-sysdig-key
targetPath: global.sysdig.accessKey
35 changes: 35 additions & 0 deletions eks-anywhere-common/Testers/Sysdig/sysdig-test-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: sysdig-test-configmap
namespace: sysdig
data:
test.sh: |-
#!/bin/bash
echo -e "\n # Validation process started #"
kubectl wait pods -n sysdig -l app=sysdig-agent --for condition=Ready --timeout=150s
sleep 90
pods=($(kubectl get pod -l app=sysdig-agent -n sysdig -o jsonpath="{.items[*].metadata.name}"))
for pod in "${pods[@]}"; do
logs=$(kubectl logs -n sysdig $pod --tail -1)
if grep "Communication with server successful" <<< "$logs"
then
echo -e "\n # Sysdig Agent connection with server was success #"
# Let's generate events
history -c # Try to clear bash history
# Check if the above generated event has been successfully captured
sleep 180
logs=$(kubectl logs -n sysdig $pod --tail -1)
if grep "msgtype=31" <<< "$logs"
then
echo -e "\n # Sysdig Agent successfully captured the event #"
exit 0
else
echo -e "\n # Error: Sysdig Agent didn't capture any event #"
exit 1
fi
else
echo -e "\n # Error: Sysdig Agent couldn't connect with the server. Please check egress, region and token #"
exit 1
fi
done;
30 changes: 30 additions & 0 deletions eks-anywhere-common/Testers/Sysdig/sysdig-test-cronjob.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: sysdig-agent-test
namespace: sysdig
spec:
schedule: "0 1 * * *"
backoffLimit: 1
mikemcd3912 marked this conversation as resolved.
Show resolved Hide resolved
jobTemplate:
spec:
template:
activeDeadlineSeconds: 1000
mikemcd3912 marked this conversation as resolved.
Show resolved Hide resolved
spec:
containers:
- name: job
image: 'alpine/k8s:1.26.2'
imagePullPolicy: Always
command:
- /bin/test.sh
volumeMounts:
- name: sysdig-test-configmap-volume
mountPath: /bin/test.sh
readOnly: true
subPath: test.sh
volumes:
- name: sysdig-test-configmap-volume
configMap:
defaultMode: 0700
name: sysdig-test-configmap
restartPolicy: Never
26 changes: 26 additions & 0 deletions eks-anywhere-common/Testers/Sysdig/sysdig-testjob-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: sysdig-agent-role
namespace: sysdig
rules:
- apiGroups: [ "" ]
resources: [ "pods" ]
verbs: [ "get", "watch", "list"]
- apiGroups: [ "" ]
resources: [ "pods/log" ]
verbs: [ "get", "watch", "list" ]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: read-sysdig-agent
namespace: sysdig
subjects:
- kind: User
name: system:serviceaccount:sysdig:default
apiGroup: rbac.authorization.k8s.io
roleRef:
kind: Role
name: sysdig-agent-role
apiGroup: rbac.authorization.k8s.io