Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuke compression filter #1086

Merged
merged 5 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@ name = "read_write"
harness = false
test = false

[[bench]]
name = "compression"
harness = false
test = false

# [[bench]]
# name = "cluster_map"
# harness = false
Expand Down Expand Up @@ -109,7 +104,6 @@ hyper-rustls = { version = "0.27", default-features = false, features = [
] }
ipnetwork = "0.20.0"
k8s-openapi.workspace = true
lz4_flex = { version = "0.11", default-features = false }
maxminddb = "0.24.0"
notify = "7.0.0"
num_cpus = "1.16.0"
Expand All @@ -128,7 +122,6 @@ serde_json.workspace = true
serde_regex = "1.1.0"
serde_stacker = "0.1.11"
serde_yaml = "0.9.34"
snap = "1.1.1"
socket2.workspace = true
stable-eyre = "0.2.2"
thiserror.workspace = true
Expand Down
85 changes: 0 additions & 85 deletions benches/compression.rs

This file was deleted.

42 changes: 14 additions & 28 deletions benches/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,34 +156,20 @@ struct Listener {
impl GenResource for Listener {
fn generate(&mut self, _slim: bool) -> prost_types::Any {
use quilkin::filters::{self, StaticFilter};
let filters = [
quilkin::config::Filter {
name: filters::capture::Capture::NAME.into(),
label: None,
config: Some(
serde_json::to_value(&filters::capture::Config {
metadata_key: "boop".into(),
strategy: filters::capture::Strategy::Suffix(filters::capture::Suffix {
size: 3,
remove: true,
}),
})
.unwrap(),
),
},
quilkin::config::Filter {
name: filters::compress::Compress::NAME.into(),
label: Some("a label".into()),
config: Some(
serde_json::to_value(filters::compress::Config {
mode: filters::compress::Mode::Lz4,
on_read: filters::compress::Action::Decompress,
on_write: filters::compress::Action::Compress,
})
.unwrap(),
),
},
];
let filters = [quilkin::config::Filter {
name: filters::capture::Capture::NAME.into(),
label: None,
config: Some(
serde_json::to_value(&filters::capture::Config {
metadata_key: "boop".into(),
strategy: filters::capture::Strategy::Suffix(filters::capture::Suffix {
size: 3,
remove: true,
}),
})
.unwrap(),
),
}];

Resource::FilterChain(quilkin::net::cluster::proto::FilterChain {
filters: filters
Expand Down
1 change: 0 additions & 1 deletion crates/proto-gen/gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ fn execute(which: &str) {
"relay/v1alpha1/relay",
"config/v1alpha1/config",
"filters/capture/v1alpha1/capture",
"filters/compress/v1alpha1/compress",
"filters/concatenate/v1alpha1/concatenate",
"filters/debug/v1alpha1/debug",
"filters/drop/v1alpha1/drop",
Expand Down
1 change: 0 additions & 1 deletion crates/quilkin-proto/src/generated/quilkin/filters.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
pub mod capture;
pub mod compress;
pub mod concatenate;
pub mod debug;
pub mod drop;
Expand Down

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
- [Configuration File](./services/proxy/configuration.md)
- [Filters](./services/proxy/filters.md)
- [Capture](./services/proxy/filters/capture.md)
- [Compress](./services/proxy/filters/compress.md)
- [Concatenate](./services/proxy/filters/concatenate.md)
- [Debug](./services/proxy/filters/debug.md)
- [Drop](./services/proxy/filters/drop.md)
Expand Down
28 changes: 2 additions & 26 deletions docs/src/deployment/quickstarts/agones-xonotic-sidecar.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,33 +63,9 @@ Run the following to delete the Fleet and the accompanying ConfigMap:
kubectl delete -f https://raw.githubusercontent.com/googleforgames/quilkin/{{GITHUB_REF_NAME}}/examples/agones-xonotic-sidecar/sidecar.yaml
```

## 6. Agones Fleet, but with Compression
## 6. Play Xonotic, through Quilkin

Let's take this one step further and compress the data between the Xonotic client and the server, without having to
change either of them!

Let's create a new Xonotic Fleet on our Agones cluster, but this time configured such that Quilkin will decompress
packets that are incoming.

Run the following:

```shell
kubectl apply -f https://raw.githubusercontent.com/googleforgames/quilkin/{{GITHUB_REF_NAME}}/examples/agones-xonotic-sidecar/sidecar-compress.yaml
```

This will implement the [Compress](../../services/proxy/filters/compress.md) filter in our Quilkin sidecar proxy in our new
Fleet.

Now you can run `kubectl get gameservers` until all your Agones `GameServers` are marked as `Ready` like so:

```shell
$ kubectl get gameservers
NAME STATE ADDRESS PORT NODE AGE
xonotic-sidecar-compress-htc2x-84mzm Ready 34.94.107.201 7534 gke-agones-default-pool-0f7d8adc-7w3c 7m25s
xonotic-sidecar-compress-htc2x-sdp4k Ready 34.94.107.201 7592 gke-agones-default-pool-0f7d8adc-7w3c 7m25s
```

## 4. Play Xonotic, through Quilkin
Note: compression has been removed.

What we will do in this step, is run Quilkin locally as a client-side proxy to compress the UDP data before it is
sent up to our Xonotic servers that are expecting compressed data.
Expand Down
10 changes: 4 additions & 6 deletions docs/src/services/proxy/filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@ Quilkin lets us specify any number of filters and connect them in a sequence to
As an example, say we would like to perform the following steps in our processing pipeline to the packets we receive.

* Append a predetermined byte to the packet.
* Compress the packet.
* Do not forward (drop) the packet if its compressed length is over 512 bytes.
* Do not forward (drop) the packet if its length is over 512 bytes.

We would create a filter corresponding to each step either by leveraging any [existing filters](#built-in-filters)
that do what we want or and connect them to form the following filter chain:

```bash
append | compress | drop
append | drop
```

When Quilkin consults our filter chain, it feeds the received packet into `append` and forwards the packet it receives (if any) from `drop` - i.e the output of `append` becomes the `input` into `compress` and so on in that order.
When Quilkin consults our filter chain, it feeds the received packet into `append` and forwards the packet it receives (if any) from `drop` - i.e the output of `append` becomes the `input` into `drop` and so on in that order.

There are a few things we note here:

Expand Down Expand Up @@ -90,8 +89,7 @@ Quilkin includes several filters out of the box.
| Filter | Description |
|----------------------------------------------------|-------------------------------------------------------------------------------------------------------------|
| [Capture] | Capture specific bytes from a packet and store them in [filter dynamic metadata](#filter-dynamic-metadata). |
| [Compress](./filters/compress.md) | Compress and decompress packets data. |
| [Concatenate](./filters/concatenate.md) | Add authentication tokens to packets. |
| [Concatenate](./filters/concatenate.md) | Add authentication tokens to packets. |
| [Debug](./filters/debug.md) | Logs every packet. |
| [Drop](./filters/drop.md) | Drop all packets |
| [Firewall](./filters/firewall.md) | Allowing/blocking traffic by IP and port. |
Expand Down
Loading
Loading