Skip to content

Commit

Permalink
feat(cli): add support for specifying replicas during deploy
Browse files Browse the repository at this point in the history
Enhanced deployment commands to include the `replicas` option for the
Torii service. Updated relevant CLI arguments and GraphQL schemas to
handle this new input.
  • Loading branch information
steebchen committed Feb 20, 2025
1 parent db88b3d commit cc2657d
Show file tree
Hide file tree
Showing 6 changed files with 256 additions and 30 deletions.
9 changes: 4 additions & 5 deletions cli/src/command/deployments/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ pub struct CreateArgs {
#[arg(help = "Deployment tier.")]
pub tier: Tier,

#[arg(long, default_value = "1")]
#[arg(help = "The number of replicas to deploy.")]
pub replicas: Option<i64>,

#[arg(long)]
#[arg(help = "The list of regions to deploy to.")]
#[arg(value_name = "regions")]
Expand Down Expand Up @@ -68,6 +64,7 @@ impl CreateArgs {
network: config.network.clone(),
saya: Some(config.saya),
}),
torii: None,
}
}
CreateServiceCommands::Torii(config) => {
Expand All @@ -85,6 +82,9 @@ impl CreateArgs {
version: config.version.clone(),
config: slot::read::base64_encode_string(&service_config),
katana: None,
torii: Some(ToriiCreateInput {
replicas: config.replicas,
}),
}
}
};
Expand All @@ -101,7 +101,6 @@ impl CreateArgs {
tier,
service,
wait: Some(true),
replicas: self.replicas,
regions: self.regions.clone(),
});

Expand Down
8 changes: 8 additions & 0 deletions cli/src/command/deployments/services/torii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ pub struct ToriiCreateArgs {
#[arg(help = "Service version to use.")]
pub version: Option<String>,

#[arg(long, default_value = "1")]
#[arg(help = "The number of replicas to deploy.")]
pub replicas: Option<i64>,

#[command(flatten)]
pub torii_args: ToriiArgs,
}
Expand All @@ -20,6 +24,10 @@ pub struct ToriiUpdateArgs {
#[arg(help = "Service version to use.")]
pub version: Option<String>,

#[arg(long)]
#[arg(help = "The number of replicas to deploy.")]
pub replicas: Option<i64>,

#[command(flatten)]
pub torii_args: ToriiArgs,
}
5 changes: 4 additions & 1 deletion cli/src/command/deployments/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ impl UpdateArgs {
type_: DeploymentService::katana,
version: config.version.clone(),
config: Some(slot::read::base64_encode_string(&service_config)),
torii: None,
}
}
UpdateServiceCommands::Torii(config) => {
Expand All @@ -66,6 +67,9 @@ impl UpdateArgs {
type_: DeploymentService::torii,
version: config.version.clone(),
config: Some(slot::read::base64_encode_string(&service_config)),
torii: Some(ToriiUpdateInput {
replicas: config.replicas,
}),
}
}
};
Expand All @@ -82,7 +86,6 @@ impl UpdateArgs {
project: self.project.clone(),
tier,
service,
replicas: self.replicas,
wait: Some(true),
});

Expand Down
260 changes: 240 additions & 20 deletions slot/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6294,6 +6294,16 @@
"name": "KatanaCreateInput",
"ofType": null
}
},
{
"defaultValue": null,
"description": null,
"name": "torii",
"type": {
"kind": "INPUT_OBJECT",
"name": "ToriiCreateInput",
"ofType": null
}
}
],
"interfaces": [],
Expand Down Expand Up @@ -6396,6 +6406,18 @@
"ofType": null
}
},
{
"args": [],
"deprecationReason": null,
"description": "Optional comment for transaction reason",
"isDeprecated": false,
"name": "comment",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
{
"args": [],
"deprecationReason": null,
Expand Down Expand Up @@ -7047,6 +7069,172 @@
"ofType": null
}
},
{
"defaultValue": null,
"description": "comment field predicates",
"name": "comment",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
{
"defaultValue": null,
"description": null,
"name": "commentNEQ",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
{
"defaultValue": null,
"description": null,
"name": "commentIn",
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
}
}
},
{
"defaultValue": null,
"description": null,
"name": "commentNotIn",
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
}
}
},
{
"defaultValue": null,
"description": null,
"name": "commentGT",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
{
"defaultValue": null,
"description": null,
"name": "commentGTE",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
{
"defaultValue": null,
"description": null,
"name": "commentLT",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
{
"defaultValue": null,
"description": null,
"name": "commentLTE",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
{
"defaultValue": null,
"description": null,
"name": "commentContains",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
{
"defaultValue": null,
"description": null,
"name": "commentHasPrefix",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
{
"defaultValue": null,
"description": null,
"name": "commentHasSuffix",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
{
"defaultValue": null,
"description": null,
"name": "commentIsNil",
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
}
},
{
"defaultValue": null,
"description": null,
"name": "commentNotNil",
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
}
},
{
"defaultValue": null,
"description": null,
"name": "commentEqualFold",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
{
"defaultValue": null,
"description": null,
"name": "commentContainsFold",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
{
"defaultValue": null,
"description": "created_at field predicates",
Expand Down Expand Up @@ -12706,16 +12894,6 @@
"ofType": null
}
},
{
"defaultValue": null,
"description": null,
"name": "replicas",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
},
{
"defaultValue": null,
"description": null,
Expand Down Expand Up @@ -12789,16 +12967,6 @@
"ofType": null
}
},
{
"defaultValue": null,
"description": null,
"name": "replicas",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
},
{
"defaultValue": null,
"description": null,
Expand Down Expand Up @@ -19523,6 +19691,48 @@
"name": "TokenPair",
"possibleTypes": []
},
{
"description": null,
"enumValues": [],
"fields": [],
"inputFields": [
{
"defaultValue": null,
"description": null,
"name": "replicas",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
}
],
"interfaces": [],
"kind": "INPUT_OBJECT",
"name": "ToriiCreateInput",
"possibleTypes": []
},
{
"description": null,
"enumValues": [],
"fields": [],
"inputFields": [
{
"defaultValue": null,
"description": null,
"name": "replicas",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
}
],
"interfaces": [],
"kind": "INPUT_OBJECT",
"name": "ToriiUpdateInput",
"possibleTypes": []
},
{
"description": null,
"enumValues": [],
Expand Down Expand Up @@ -19592,6 +19802,16 @@
"name": "String",
"ofType": null
}
},
{
"defaultValue": null,
"description": null,
"name": "torii",
"type": {
"kind": "INPUT_OBJECT",
"name": "ToriiUpdateInput",
"ofType": null
}
}
],
"interfaces": [],
Expand Down
Loading

0 comments on commit cc2657d

Please sign in to comment.