Repository navigation
[CWS] Introduce CWS K8S User Session tracking context - #18620
Conversation
4a98976 to
9b85b48
Compare
Bloop Bleep... Dogbot HereRegression Detector ResultsRun ID: 0fd65884-1980-48f2-bbf1-7819f3d5bd0e ExplanationA regression test is an integrated performance test for Because a target's optimization goal performance in each experiment will vary somewhat each time it is run, we can only estimate mean differences in optimization goal relative to the baseline target. We express these differences as a percentage change relative to the baseline target, denoted "Δ mean %". These estimates are made to a precision that balances accuracy and cost control. We represent this precision as a 90.00% confidence interval denoted "Δ mean % CI": there is a 90.00% chance that the true value of "Δ mean %" is in that interval. We decide whether a change in performance is a "regression" -- a change worth investigating further -- if both of the following two criteria are true:
The table below, if present, lists those experiments that have experienced a statistically significant change in mean optimization goal performance between baseline and comparison SHAs with 90.00% confidence OR have been detected as newly erratic. Negative values of "Δ mean %" mean that baseline is faster, whereas positive values of "Δ mean %" mean that comparison is faster. Results that do not exhibit more than a ±5.00% change in their mean optimization goal are discarded. An experiment is erratic if its coefficient of variation is greater than 0.1. The abbreviated table will be omitted if no interesting change is observed. No interesting changes in experiment optimization goals with confidence ≥ 90.00% and |Δ mean %| ≥ 5.00%. Fine details of change detection per experiment.
|
9b85b48 to
c3fd273
Compare
rtrieu
left a comment
There was a problem hiding this comment.
Suggestion to change all instances of "Groups" and "Username" to all lowercase.
1d9cd3c to
6a67528
Compare
6a67528 to
1d20fe6
Compare
ff206fd to
02277f8
Compare
730a195 to
31e3bad
Compare
22a723c to
980f767
Compare
chouquette
left a comment
There was a problem hiding this comment.
LGTM, the few cosmetic comments can be addressed in a followup PR :)
There was a problem hiding this comment.
You could also add go_deps here and drop the redefinition in the inheriting jobs
There was a problem hiding this comment.
This could be defined in .cws_instrumentation-build_common (ditto for the arm64 job)
There was a problem hiding this comment.
This could also be in .cws_instrumentation-build_common
There was a problem hiding this comment.
You could explicitly reference the jobs that create the docker images here with needs: so that the jobs start ASAP instead of waiting for all stages prior to deploy_cws_instrumentation to complete
You'll need to specify artifacts: false to ensure you don't try to download the artifacts, even though I suppose there are none to download
What does this PR do?
This PR introduces a User Sesison resolver for CWS (see below for an exaplaination about what it is, and why we introduced it). This new resolver is made of 3 different parts:
datadog-cws-instrumentation) and a mount points to this volume in all the containers of the pod. It will also introduce a new init container with a mount point to the same volume. On init, this container will copycws-instrumentation(see below) to the volume.cws-instrumentationwith the K8S context as argument, and then the user command.cws-instrumentationis a new command in/cmdwhich is called (thanks to the previous step) before any command is run in an instrumented pod. This binary will forward the k8s context it received as argument to the CWS agent using an eRPC call.sequenceDiagram autonumber participant D as Dev1 participant API as API server participant AC as CWS Admission Controller participant C as Container1 participant CWS as CWS agent API->>+AC: A new deployment is scheduled Note left of AC: A new volume is mounted in<br/>all containers Note left of AC: An init container is added to inject <br/>`cws-instrumentation` in the volume AC-->>-API: OK D->>+API: kubectl exec bash API->>+AC: "Dev1" wants to run "bash"<br/>in "Container1" Note left of AC: "bash" is replaced with<br/>"/cws/cws-instrumentation {credentials} bash" AC-->>-API: OK API->>+C: "/cws/cws-instrumentation {credentials} bash" activate C C->>+CWS: eRPC: store {credentials}<br/>for current session CWS-->>C: OK C->>C: exec "bash" C-->>D: Interractive session opened Note over D,C: User session D->>C: exit Note left of CWS: session {credentials}<br/>cleared C-->>D: OK deactivate C deactivate CWS deactivate APIMotivation
Currently, when CWS events are emitted, only the host user is reported (i.e.
rootor local Unix users). Although this is an interesting piece of context for services or applications that might run as privileged users, it doesn't really help understand what's happening when a developer or sysadmin run commands in production remotely. These commands are usually flagged by our default rules, and the lack of context make them harder to investigate. For Kubernetes environment, this PR introduces an additional piece of context for these events: the content of the v1.UserInfo structure. When Kubernetes is properly configured, CWS events will now contain the K8s username, UID and groups of the user that ran the commands remotely.Additional Notes
cws-instrumentationimage is stored in Dockerhub, but if this feature gets more traction, we will publish the image to more image registry.changelog.Describe how to test/QA your changes
To QA this feature:
kubectl exec your_pod -- bashYou should have generated a CWS event with your K8S user context.
Reviewer's Checklist
Triagemilestone is set.major_changelabel if your change either has a major impact on the code base, is impacting multiple teams or is changing important well-established internals of the Agent. This label will be use during QA to make sure each team pay extra attention to the changed behavior. For any customer facing change use a releasenote.changelog/no-changeloglabel has been applied.qa/skip-qalabel is not applied.team/..label has been applied, indicating the team(s) that should QA this change.need-change/operatorandneed-change/helmlabels have been applied.k8s/<min-version>label, indicating the lowest Kubernetes version compatible with this feature.