feat: Support service mesh via Linkerd (#8971)

### What changes were proposed in this PR?
Adds support for running the k8s deployment under the
[Linkerd](https://linkerd.io) service mesh, so that traffic between
Texera pods is encrypted with mTLS. This is important for security
because traffic between services (including database credentials and
user data) is currently plain text, and compute units can run arbitrary
code submitted by users. This PR adds the option to use Linkerd, but
does not require it: the changes are only annotations, and if Linkerd is
not installed they have no effect. It is only targeted at k8s
deployments and was tested using RKE2.

To enable it, install Linkerd 2.20 or later in the cluster, skipping its
"Install the Gateway API" step, then install Texera as usual and restart
`linkerd-destination` once. The steps are in the new "Encrypting Traffic
with Linkerd" section of `docs/getting-started/run-on-kubernetes.md`.

To turn the mesh off for a deployment on a cluster that has Linkerd
installed, set `linkerd.io/inject` to `"disabled"` in
`global.linkerd.podAnnotations` in `values.yaml`. This one value
controls every pod.

Changes:
- **Texera services:** the Linkerd annotations are set once in
`global.linkerd.podAnnotations`, and a `texera.annotations` helper adds
them to every Texera template (services, jobs and DaemonSets). Each
template also has a `podAnnotations` option for extra annotations.
- **Third party charts:** set the Linkerd annotations through each
chart's own options, reusing `global.linkerd.podAnnotations` through a
YAML anchor: Postgres, RustFS, LakeFS (also covers the lakefs-setup
job), Lakekeeper (including its DB migration job) and Envoy Gateway
(controller and certgen job).
- **Inbound policy:** pods only accept meshed clients
(`all-authenticated`). The Envoy proxy, the Envoy Gateway controller
(called by the Kubernetes API server) and RustFS (presigned URLs from
browsers) are reached from outside the mesh, so they allow
unauthenticated clients.
- **Gateway:** added an `EnvoyProxy` resource and pointed the Gateway at
it through `infrastructure.parametersRef`, since the Envoy proxy pods
are created by the Envoy Gateway controller and that is the only way to
annotate them.
- **Compute units and JupyterLab:** these pods are created at runtime,
so their namespaces get the annotations (new `namespaceAnnotations`
option) instead of the pods. The pools' ResourceQuota rejects containers
without resource requests, so the namespace annotations also set
requests for the injected Linkerd containers.
- **Native sidecars:** all pods use
`config.linkerd.io/proxy-enable-native-sidecar`. Without this, jobs
never complete because the proxy keeps running, and init containers that
need the network (e.g. waiting for Lakekeeper) fail.
- **Postgres and RustFS:** their ports are marked as opaque so Linkerd
forwards them as plain TCP. Opaque traffic arrives on Linkerd's inbound
port 4143, so the Postgres chart's NetworkPolicy now also allows 4143.
- **Prepullers:** the image prepullers make no connections, so they are
kept out of the mesh, including the curated-image prepullers created by
the compute unit manager.
- **Compute unit metrics:** the compute unit manager now reads metrics
and limits from the compute unit's own container instead of the first
container in the pod, which could be the Linkerd proxy.

Note for upgrades: `helm upgrade` on an existing install fails on the
finished setup Jobs, because a Job's pod template cannot change. Delete
them first or reinstall.

Note for Kata: when Linkerd and Kata (#8572) are used together,
Linkerd's `linkerd-init` container fails inside the VM with `Permission
denied (you must be root)`. It runs as non-root and gets its network
permissions from file capabilities on the `iptables` binary, which
Kata's virtiofs drops by default. This is a host level Kata setting, not
part of this chart. It can be fixed by passing only file capabilities
through, by adding this to `virtio_fs_extra_args` in the Kata
configuration:
```
--xattrmap=:ok:all:security.capability:::bad:all:::
```

### Any related issues, documentation, discussions?
Closes #8970
Discussed in #6059
Has changes suporting #8572

### How was this PR tested?
Tested on a single node RKE2 v1.35.6 cluster with Linkerd edge-26.9.3,
with and without the Texera micro services running in Kata VMs
(`kata-qemu-runtime-rs`):
- Every pod starts with the Linkerd proxy (2/2 ready), including the
pods created at runtime.
- Checked that traffic between services is encrypted using the proxies'
metrics: all connections to other Texera services (including Postgres,
LakeFS and Lakekeeper) report `tls="true"` in addition to packet
sniffing with wireshark.
  ```
kubectl get --raw
"/api/v1/namespaces/<namespace>/pods/<pod>:4191/proxy/metrics" | grep
tcp_open_total
  ```
- The UI works, compute units can be created, and the setup jobs
complete.
- Unmeshed pods are refused (403) by the Texera services, and meshed
pods are accepted.
- With the mesh turned off, no pod gets a proxy and Texera works as
before.
- Compute unit metrics match `kubectl top pod --containers` for the
compute unit's container.
- Added unit tests for the metrics fix and the curated-image prepullers.
`bin/k8s/tests/test_helm_values.sh` passes.

### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 5.5

---------

Signed-off-by: dzueck <dzueck@gmail.com>
Co-authored-by: Matthew B. <mgball@uci.edu>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
29 files changed
tree: bfbe61eeccddd5c6ff0cc03a949b5cbf1ffadace
  1. .github/
  2. .run/
  3. access-control-service/
  4. agent-service/
  5. amber/
  6. bin/
  7. common/
  8. computing-unit-managing-service/
  9. config-service/
  10. docs/
  11. file-service/
  12. frontend/
  13. licenses/
  14. licenses-3rd-party-code/
  15. notebook-migration-service/
  16. project/
  17. pyright-language-service/
  18. result-service/
  19. sql/
  20. texera-helpers/
  21. workflow-compiling-service/
  22. .asf.yaml
  23. .dockerignore
  24. .gitattributes
  25. .gitignore
  26. .jvmopts
  27. .licenserc.yaml
  28. .scalafix.conf
  29. .scalafmt.conf
  30. AGENTS.md
  31. build.sbt
  32. CLAUDE.md
  33. codecov.yml
  34. CONTRIBUTING.md
  35. DISCLAIMER
  36. LICENSE
  37. NOTICE
  38. README.md
  39. SECURITY.md
README.md

Apache Texera (Incubating) is an open-source platform for human-AI collaborative data science using visual workflows. It enables human analysts to construct, execute, and refine data analysis tasks through an intuitive GUI, assisted by AI agents that understand natural-language instructions. Texera is well suited for a wide range of applications, including “AI for Science,” by making advanced AI and data science capabilities accessible to a broader community. It can run on a laptop for local use or be deployed in the cloud to support scalable processing of large datasets.

The platform has the following key features:

  • Natural-language data science through AI agents
  • Intuitive GUI-based workflows for data science
  • Real-time collaboration for workflow editing and execution
  • Runtime debugging and interactive workflow execution
  • Language-agnostic workflow runtime, native support for Python and Java
  • Parallel backend engine for scalable big-data processing
  • Separation of compute and storage for flexible cloud deployment

texera-screenshot

Citation

Please cite Texera as


@article{DBLP:journals/pvldb/WangHNKALLDL24, author = {Zuozhi Wang and Yicong Huang and Shengquan Ni and Avinash Kumar and Sadeem Alsudais and Xiaozhen Liu and Xinyuan Lin and Yunyan Ding and Chen Li}, title = {Texera: {A} System for Collaborative and Interactive Data Analytics Using Workflows}, journal = {Proc. {VLDB} Endow.}, volume = {17}, number = {11}, pages = {3580--3588}, year = {2024}, url = {https://www.vldb.org/pvldb/vol17/p3580-wang.pdf}, timestamp = {Thu, 19 Sep 2024 13:09:37 +0200}, biburl = {https://dblp.org/rec/journals/pvldb/WangHNKALLDL24.bib}, bibsource = {dblp computer science bibliography, https://dblp.org} }