Skip to content

Conversation

@Fredi-raspall
Copy link
Contributor

@Fredi-raspall Fredi-raspall commented Dec 30, 2025

The goal of this PR is to make it easy to create k8s-like configurations and run dataplane without k8s infrastructure. This is convenient for early testing when developing new features.

This PR contains 4 parts:

  1. the addition of a small crate k8s-sample-derive that allows deriving a trait called Sample.
  2. the definition of the Sample trait and its implementation for the types that the dataplane CRD depends on. The goal of the trait is to allow creating "sample" YAML / JSON config files for manual testing.
  3. the addition of crate k8s-sample-crds which creates sample files automatically.
  4. the implementation of k8s-less (kubeless) mode with which dataplane can be configured by detecting changes in a configurable directory: any yaml/json file dropped or modified in that directory will be picked by dataplane which will deserialize it and use it as configuration. The k8s-less mode is enabled when dataplane is launched with cmd line arg --config-dir DIRECTORY, where DIRECTORY is the directory to drop the configs to.

@Fredi-raspall Fredi-raspall requested a review from a team as a code owner December 30, 2025 12:27
Adds a small crate with a procedural macro to derive trait "Sample".
The trait is meant to allow building sample json/yaml files for
the main gateay CRD. Trait "Sample" is introduced later, outside of
this crate.

Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
Add a vanilla implementation of the Sample trait for the
primitive / basic types that the generated rust types for the
CRDs depend on.

Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
Modify build.rs to derive trait Sample for the autogenerated
types to represent CRDs, recursively.

By automatically deriving Sample, we make sure that samples will
be aligned when the CRD definitions change.

Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
The function will be used to create sample json and yaml files
to be used as templates for manual testing.

Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
Adds crate k8s-sample-crds which, at build time, uses the utils in
k8s-intf to generate json/yaml "samples" (templates) that are
up-to-date with the CRD definitions in k8s-intf.

Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
Adds a new crate to support kubeless mode (k8s-less), where
dataplane learns its configuration by monitoring changes in files
inside a directory (using inotify) that contain the gateway spec
in yaml or json.

This mode of operation may be used only for testing or development.
Therefore, we implement it  outside of the k8s-intf crate.

Files that change in (or get added to) the watched directory get
read and their contents (yaml or json) deserialized into a crd
spec. From that spec, a GatewayAgent object (representing the main
CRD) is built and passed to a user-provided callback.

This crate attempts to mimic k8s-intf and deals only with:
  - the watching of files in a directory using inotify
  - the deserialization of those files into the GatewayAgent type.

It does not attempt to populate/build any of the configuration
types in crate dataplane-config.

Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
Adds --config-dir cmd line option to specify the directory in k8s-
less mode and augments the ConfigServerSection to include it.

Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
Add a k8s-less client that watches the config directory and uses
the config client to request the config processor to apply a new
config.

Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants