kurtosis-tech / kurtosis

A platform for packaging and launching ephemeral backend stacks with a focus on approachability for the average developer.
https://docs.kurtosistech.com/
Apache License 2.0
353 stars 52 forks source link

Add k8s/docker labels to deployed services #1585

Closed bsamuels453 closed 11 months ago

bsamuels453 commented 11 months ago

Background & motivation

[Attacknet] We're trying to use chaos-mesh against a kubernetes workload deployed by Kurtosis. Chaos-mesh can target pods based on the pods name, labels, annotations, and fields.

We have a use case where we want to be able to target a subset of pods with a chaos-mesh fault, such as targeting all prysm pods in an ethereum devnet, or targeting based off some other criteria.

Without this additional metadata, we will have to encode the metadata into pod names and try to extract it on the fly.

Desired behaviour

Update the Plan.add_service/Plan.add_services API to accept a key/value dict of metadata. This metadata should be attached to kubernetes pods as labels. I think docker has a label abstraction that this can apply to as well.

Example: we call Plan.add_service with a metadata dict of the following:

{
  "nodeType": "execution",
  "client": "prysm",
  "connectedElClient": "geth",
  "clientVersion": "4.0.5"
}

When Kurtosis spins up the pod for the service, it would contain the following additional labels:

labels:
  kurtosistech.com/meta/nodeType: execution
  kurtosistech.com/meta/client: prysm
  kurtosistech.com/meta/connectedElClient: geth
  kurtosistech.com/meta/clientVersion: 4.0.5

How important is this to you?

Nice to have; this feature would make using Kurtosis more enjoyable.

What area of the product does this pertain to?

Other: anything not covered by the above

leeederek commented 11 months ago

Thanks for filing, we're tracking this internally and will let you know if we got questions!