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

v1.2 backports #2958

Merged
merged 11 commits into from
Sep 30, 2024
Merged

v1.2 backports #2958

merged 11 commits into from
Sep 30, 2024

Conversation

tpapagian and others added 10 commits September 27, 2024 15:11
[ upstream commit 62957f1 ]

These include the number of retries and the delay between them.

New command line arguments to do that:
      --event-cache-retries int                   Number of retries for event cache (default 15)
      --event-cache-retry-delay int               Delay in seconds between event cache retries (default 2)

Signed-off-by: Anastasios Papagiannis <tasos.papagiannnis@gmail.com>
Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
[ upstream commit aab03fe ]

The previous patch makes EventCache configurable. This allows to reduce
some delays in the tests.

Signed-off-by: Anastasios Papagiannis <tasos.papagiannnis@gmail.com>
Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
[ upstream commit 451f921 ]

Signed-off-by: Anastasios Papagiannis <tasos.papagiannnis@gmail.com>
Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
[ upstream commit 5c838d5 ]

This commit refactors the watcher code. It adds an error value (unused
for now), and creates a new internal newK8sWatcher function. These two
changes are going to be used by subsequent patches.

Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
[ upstream commit ebd7e43 ]

Add a containerIDKey function for getting the container key from the
full container id. It is intended for a subsequent patch.

Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
[ upstream commit 2c3ea83 ]

This does not change the semantics of the function. It is intended for a
subsequent patch.

Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
[ upstream commit 7043d06 ]

This commit ads a test where a lookup for a pod via its container id happens
after the pod was deleted. This case, might happen if a pod is started and
deleted from the cache before user-space gets a chance to associate a pod with
an exec event.

Example:
go test ./pkg/watcher -test.run TestFastK8s -test.v
=== RUN   TestFastK8s
    watcher_test.go:32: time="2024-09-17T13:38:51+02:00" level=info msg="Initialized informer cache" count=0 informer=pod

    watcher_test.go:95: adding pod
    watcher_test.go:103: deleting pod
    watcher_test.go:108:
                Error Trace:    /home/kkourt/src/tetragon/pkg/watcher/watcher_test.go:108
                Error:          Should be true
                Test:           TestFastK8s
                Messages:       deleted pod should be found

Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
[ upstream commit 27df62b ]

This commit adds an LRU cache that holds container ids for deleted pods.
It is used to do pod association for pods that are deleted, and are no
longer available in the pod cache.

TestFastK8s now succeeds.

Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
[ upstream commit 3cefc44 ]

Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
[ upstream commit b90d908 ]

syscall64 type allows a bit to be set to distinguish between 32- and
64-bit syscalls. Currently, the only operators that work are InMap and
NotInMap. This commit extends support for other operations as well: EQ,
NEQ, MASK, GT, LT.

Using the MASK operator specifically, allows us to write policies for
all 32-bit syscalls.

For example:

apiVersion: cilium.io/v1alpha1
kind: TracingPolicy
metadata:
  name: syscalls32bit
spec:
  tracepoints:
  - subsystem: raw_syscalls
    event: sys_enter
    args:
    - index: 4
      type: syscall64
    selectors:
    - matchArgs:
      - index: 0
        operator: Mask
        values:
        - "2147483648" # IS_32BIT

Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
@kkourt kkourt requested review from a team and mtardy as code owners September 27, 2024 13:14
@kkourt kkourt added the release-note/minor This PR introduces a minor user-visible change label Sep 27, 2024
[ upstream commit c35738c ]

In 62957f104 we changed the
Retries and RetryDelay from var to const. This patch reverst that change
as we may need to adjust them based on the test needs.

Signed-off-by: Anastasios Papagiannis <tasos.papagiannnis@gmail.com>
Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
@kkourt kkourt added the kind/backport This PR provides functionality previously merged into master. label Sep 27, 2024
@kkourt kkourt merged commit 1c18ad9 into v1.2 Sep 30, 2024
44 checks passed
@kkourt kkourt deleted the pr/kkourt/v1.2-backports-20240927 branch September 30, 2024 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/backport This PR provides functionality previously merged into master. release-note/minor This PR introduces a minor user-visible change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants