Skip to content

Conversation

@Fredi-raspall
Copy link
Contributor

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

Support for kubeless mode.

  • This no longer depends on the Sample work.
  • I also added writing the status to a file in json and yaml.

@Fredi-raspall Fredi-raspall requested a review from a team as a code owner December 30, 2025 12:27
@Fredi-raspall Fredi-raspall mentioned this pull request Dec 30, 2025
@mvachhar mvachhar requested review from Copilot and mvachhar January 5, 2026 17:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces k8s-less mode to enable dataplane operation without Kubernetes infrastructure, facilitating early testing during feature development. The implementation includes a procedural macro for generating sample configurations, utilities for creating sample CRD files, and a file-watching mechanism that detects configuration changes in a designated directory.

Key changes:

  • Added k8s-sample-derive crate with Sample derive macro for automatic sample data generation
  • Implemented k8s-less mode via --config-dir command-line argument with inotify-based file watching
  • Created k8s-sample-crds crate to generate JSON/YAML sample configuration templates

Reviewed changes

Copilot reviewed 23 out of 26 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
mgmt/src/processor/mod.rs Added k8s_less_client module
mgmt/src/processor/launch.rs Integrated k8s-less mode into management startup flow
mgmt/src/processor/k8s_less_client.rs Implemented K8sLess client for file-based configuration
mgmt/Cargo.toml Added k8s-less dependency
k8s-sample-derive/src/lib.rs Implemented Sample derive macro for generating sample data
k8s-sample-derive/Cargo.toml Configured procedural macro crate
k8s-sample-crds/src/lib.rs Added test verifying JSON/YAML sample equivalence
k8s-sample-crds/generated-samples/sample.yaml Generated sample YAML configuration template
k8s-sample-crds/generated-samples/sample.json Generated sample JSON configuration template
k8s-sample-crds/build.rs Build script for automatic sample generation
k8s-sample-crds/Cargo.toml Configured sample generation crate
k8s-less/src/local.rs Implemented inotify-based directory watching and CRD deserialization
k8s-less/src/lib.rs Exposed kubeless_watch_gateway_agent_crd function
k8s-less/Cargo.toml Configured k8s-less crate dependencies
k8s-intf/src/utils.rs Added utilities for loading CRDs from JSON/YAML files
k8s-intf/src/samplegen/sample.rs Defined Sample trait and implementations for primitive types
k8s-intf/src/samplegen/mod.rs Implemented sample file generation logic
k8s-intf/src/lib.rs Exposed samplegen and utils modules
k8s-intf/build.rs Updated build script to derive Sample trait via kopium
k8s-intf/Cargo.toml Added k8s-sample-derive and serde_yaml_ng dependencies
dataplane/src/main.rs Passed config_dir parameter to management initialization
args/src/lib.rs Added config_dir command-line argument and updated configuration structures
Cargo.toml Added k8s-less, k8s-sample-crds, k8s-sample-derive crates and inotify dependency

Copy link
Contributor

@mvachhar mvachhar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the name kubeless rather than k8s-less but not worth the fix. Still thinking about the Sample stuff to see if there is a nicer way to do that. Also, when do all the FIXME's get removed?

@mvachhar
Copy link
Contributor

mvachhar commented Jan 5, 2026

Oh, it looks like something isn't right with the package setup too causing uncommitted changes during build.

@mvachhar
Copy link
Contributor

mvachhar commented Jan 6, 2026

I think the Sample stuff here is a bit controversial and needs discussion. Can we split this out from this PR that adds the inotify stuff? I think it will be straight forward to merge that and remove gRPC while we discuss what is going on with Sample.

@Fredi-raspall
Copy link
Contributor Author

I like the name kubeless rather than k8s-less but not worth the fix. Still thinking about the Sample stuff to see if there is a nicer way to do that. Also, when do all the FIXME's get removed?

I can try to change it. The FIXME's have to be manually removed. That's the point. The Sample trait is to produce sample yaml/json files for testing. It's a template so that we can manually create configs.

@Fredi-raspall Fredi-raspall force-pushed the pr/fredi/k8s-less branch 3 times, most recently from 0a33e9e to 02b1eea Compare January 7, 2026 14:18
@Fredi-raspall Fredi-raspall changed the base branch from main to pr/fredi/k8s-samples January 7, 2026 14:27
@Fredi-raspall Fredi-raspall changed the title K8s-less mode and helpers K8s-less mode Jan 7, 2026
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.

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.

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

Signed-off-by: Fredi Raspall <[email protected]>
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 <[email protected]>
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 <[email protected]>
@Fredi-raspall Fredi-raspall changed the base branch from pr/fredi/k8s-samples to main January 8, 2026 09:37
@Fredi-raspall Fredi-raspall requested a review from mvachhar January 8, 2026 09:48
Add utility functions to save objects in yaml and json.

Signed-off-by: Fredi Raspall <[email protected]>
Move the code to create a GatewayAgentStatus object out of
K8sClient::update_gateway_status() method into a standalone
function so that the same code can be used in kubeless mode.

Signed-off-by: Fredi Raspall <[email protected]>
Augments the k8s-less client to write status in yaml and json
each time a configuration is successfully applied.

In this implementation, the state is serialized in two files:
  - gwstatus.json
  - gwstatus.yaml

within a "state" directory created in the watched directory.
This is to avoid needing to add another cmd line option for
the directory to store the status files, which seems unnecessary
at this point.

Signed-off-by: Fredi Raspall <[email protected]>
Copy link
Contributor

@mvachhar mvachhar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good enough as it is for test and dev.

@mvachhar mvachhar enabled auto-merge January 8, 2026 15:26
@mvachhar mvachhar added the ci:-upgrade Disable VLAB upgrade tests label Jan 8, 2026
@mvachhar
Copy link
Contributor

mvachhar commented Jan 8, 2026

#1165 which is on top of this PR passes all tests so the upgrade failure is very likely spurious. If the upgrade fails again, just close and reopen this PR and add to the merge queue.

auto-merge was automatically disabled January 8, 2026 16:28

Pull request was closed

@Fredi-raspall Fredi-raspall reopened this Jan 8, 2026
@Fredi-raspall Fredi-raspall added this pull request to the merge queue Jan 8, 2026
Merged via the queue into main with commit 857379e Jan 8, 2026
47 of 51 checks passed
@Fredi-raspall Fredi-raspall deleted the pr/fredi/k8s-less branch January 8, 2026 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:-upgrade Disable VLAB upgrade tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants