Skip to content

Commit 4bafcf8

Browse files
committed
Moved useHttp1 to root and renamed to useHttp11
1 parent facdce5 commit 4bafcf8

6 files changed

Lines changed: 15 additions & 42 deletions

File tree

README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,8 @@ This field contains Restate-specific configuration.
364364
|---|---|---|
365365
| `register` | `object` | **Required**. The location of the Restate Admin API to register this deployment against. See details below. |
366366
| `servicePath` | `string` | Optional path to append to the Service url when registering with Restate. |
367-
| `options` | `object` | Optional configuration options for service registration. See details below. |
367+
| `useHttp11` | `boolean` | Force the use of HTTP/1.1 when registering with Restate. Defaults to HTTP/2 if not specified. |
368+
368369

369370
The `register` field must specify exactly one of `cluster`, `service`, or `url`.
370371

@@ -383,12 +384,6 @@ The `register` field must specify exactly one of `cluster`, `service`, or `url`.
383384
| `path` | `string` | An optional URL path to be prepended to admin API paths. Should not end with a `/`. |
384385
| `port` | `integer` | The port on the service that hosts the admin API. Defaults to 9070. |
385386

386-
**`options` Fields**
387-
388-
| Field | Type | Description |
389-
| ----------- | --------- | ----------------------------------------------------------------------------------- |
390-
| `useHttp1` | `boolean` | Force the use of HTTP/1.1 when registering with Restate. Defaults to HTTP/2 if not specified. |
391-
392387
### EKS Pod Identity
393388

394389
[EKS Pod Identity](https://docs.aws.amazon.com/eks/latest/userguide/pod-identities.html) is a convenient way to have a

crd/RestateDeployment.pkl

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,8 @@ class Restate {
6262
/// service will be registered at the root path "/".
6363
servicePath: String?
6464

65-
/// Optional configuration options for service registration
66-
options: Options?
67-
}
68-
69-
/// Optional configuration options for service registration
70-
class Options {
7165
/// Force the use of HTTP/1.1 when registering with Restate
72-
useHttp1: Boolean?
66+
useHttp11: Boolean?
7367
}
7468

7569
/// The location of the Restate Admin API to register this deployment against

crd/restatedeployments.yaml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,10 @@ spec:
108108
description: Optional path to append to the Service url when registering with Restate. If not provided, the service will be registered at the root path "/".
109109
nullable: true
110110
type: string
111-
options:
112-
description: Optional configuration options for service registration
111+
useHttp11:
112+
description: Force the use of HTTP/1.1 when registering with Restate
113113
nullable: true
114-
properties:
115-
useHttp1:
116-
description: Force the use of HTTP/1.1 when registering with Restate
117-
nullable: true
118-
type: boolean
119-
type: object
114+
type: boolean
120115
required:
121116
- register
122117
type: object

src/controllers/restatedeployment/controller.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use crate::controllers::{service_url, Diagnostics, State};
3333
use crate::metrics::Metrics;
3434
use crate::resources::restateclusters::RestateCluster;
3535
use crate::resources::restatedeployments::{
36-
RestateDeployment, RestateDeploymentCondition, RestateDeploymentStatus, RestateOptions,
36+
RestateDeployment, RestateDeploymentCondition, RestateDeploymentStatus,
3737
RESTATE_DEPLOYMENT_FINALIZER,
3838
};
3939
use crate::telemetry;
@@ -313,7 +313,7 @@ impl RestateDeployment {
313313
&ctx.http_client,
314314
&admin_endpoint,
315315
&service_endpoint,
316-
self.spec.restate.options.as_ref().cloned(),
316+
self.spec.restate.use_http11.as_ref().cloned(),
317317
)
318318
.await?;
319319
// if registration succeeded, treat this as an active endpoint
@@ -493,7 +493,7 @@ impl RestateDeployment {
493493
client: &reqwest::Client,
494494
admin_endpoint: &Url,
495495
service_endpoint: &Url,
496-
options: Option<RestateOptions>,
496+
use_http11: Option<bool>,
497497
) -> Result<String> {
498498
debug!("Registering endpoint '{service_endpoint}' to Restate at '{admin_endpoint}'",);
499499

@@ -506,8 +506,8 @@ impl RestateDeployment {
506506
"uri": service_endpoint,
507507
});
508508

509-
if let Some(options) = options {
510-
payload["use_http_11"] = serde_json::Value::Bool(options.use_http1.unwrap_or(false));
509+
if let Some(use_http11) = use_http11 {
510+
payload["use_http_11"] = serde_json::Value::Bool(use_http11);
511511
}
512512

513513
let resp: DeploymentResponse = client

src/controllers/restatedeployment/reconcilers/replicaset.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,9 @@ pub fn generate_pod_template_hash(rsd: &RestateDeployment, pod_template: &str) -
120120
hasher.write(service_path.as_bytes());
121121
}
122122

123-
// if you change the HTTP version option, it creates a new deployment, which means we want a new replicaset too to keep things 1:1
124-
if let Some(options) = &rsd.spec.restate.options {
125-
if let Some(use_http1) = options.use_http1 {
126-
hasher.write(&[if use_http1 { 1 } else { 0 }]);
127-
}
123+
// It's possible that changing this flag will create a new deployment id; by making it part of the replicaset name we guarantee that deployments and replicasets stay 1:1
124+
if let Some(use_http11) = rsd.spec.restate.use_http11 {
125+
hasher.write(&[if use_http11 { 1 } else { 0 }]);
128126
}
129127

130128
if let Some(collision_count) = rsd.status.as_ref().and_then(|s| s.collision_count) {

src/resources/restatedeployments.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,18 +152,9 @@ pub struct RestateSpec {
152152
#[serde(skip_serializing_if = "Option::is_none")]
153153
pub service_path: Option<String>,
154154

155-
/// Optional configuration options for service registration
156-
#[serde(skip_serializing_if = "Option::is_none")]
157-
pub options: Option<RestateOptions>,
158-
}
159-
160-
/// Optional configuration options for service registration
161-
#[derive(Deserialize, Serialize, Clone, Debug, JsonSchema)]
162-
#[serde(rename_all = "camelCase")]
163-
pub struct RestateOptions {
164155
/// Force the use of HTTP/1.1 when registering with Restate
165156
#[serde(skip_serializing_if = "Option::is_none")]
166-
pub use_http1: Option<bool>,
157+
pub use_http11: Option<bool>,
167158
}
168159

169160
/// The location of the Restate Admin API to register this deployment against

0 commit comments

Comments
 (0)