-
Notifications
You must be signed in to change notification settings - Fork 46
Added Sysdig agent support and testing automations #315
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
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
001da86
Sysdig agent support and testing automations
manuelbcd ec7546a
Fix namespaces
manuelbcd ff486a2
Fix namespace
manuelbcd a43487a
Switched sysdig agent driver to ebpf
manuelbcd dc143f4
Fixed namespace from tests
manuelbcd 1014b44
Fix namespace test.sh
manuelbcd 308057d
Increasing sleep timer for tests
manuelbcd bb08da2
Fix test service account
manuelbcd 1212d27
Modified test sleep parameter
manuelbcd 64019ac
Prepared test job for multiple pods
manuelbcd 94c4e57
Raised test sleep time to allow capturing e2e detections
manuelbcd 783e6d1
Remove ebpf connection strategy by default
manuelbcd e79b195
Changed the detection message for e2e events
manuelbcd 9ea1588
Increasing the time of the e2e test at server msgtype level
manuelbcd b0d1cc9
Tuning e2e event checker to 100 secs
manuelbcd 8e4d608
Sleep values optimization
manuelbcd 4bce866
Test optimization
manuelbcd 1cedcee
E2e test - ine tuning
manuelbcd ed80420
Convert job in a cronjob
manuelbcd cc1df9f
Fixed job to cronjob for tests
manuelbcd dea4247
Switched to ebpf again for better compatibility
manuelbcd 51a87b0
backoffLimit rearranged
manuelbcd 88c02cf
rearranged cronjob activeDeadlineSeconds
manuelbcd df34652
Changed criteria for connection validation. New criteria works even f…
manuelbcd c22800b
Comment fix
manuelbcd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
eks-anywhere-common/Addons/Partner/Sysdig/external-secret.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
# 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
35
eks-anywhere-common/Testers/Sysdig/sysdig-test-configmap.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "to collector at host" <<< "$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
30
eks-anywhere-common/Testers/Sysdig/sysdig-test-cronjob.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 * * *" | ||
jobTemplate: | ||
spec: | ||
backoffLimit: 1 | ||
activeDeadlineSeconds: 1000 | ||
template: | ||
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
26
eks-anywhere-common/Testers/Sysdig/sysdig-testjob-role.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.