From 97bd3548191392c544ffc7b7f0c111d821f67bbd Mon Sep 17 00:00:00 2001 From: Remy MACHAVOINE Date: Tue, 4 Nov 2025 16:34:54 +0100 Subject: [PATCH 1/2] feat: add private network to function and container --- README.md | 6 ++++++ deploy/lib/createContainers.js | 8 ++++++++ deploy/lib/createFunctions.js | 8 ++++++++ 3 files changed, 22 insertions(+) diff --git a/README.md b/README.md index af159f1a..b8e05ed7 100644 --- a/README.md +++ b/README.md @@ -179,6 +179,9 @@ functions: input: key-a: "value-a" key-b: "value-b" + + # ID of the private network to attach the function to + privateNetworkId: "3fd741d4-f686-4afc-bcea-d720c695748f" ``` ### Container-specific configuration @@ -264,6 +267,9 @@ custom: # Deprecated: number of simultaneous requests to handle # Please use scalingOption of type concurrentRequests instead # maxConcurrency: 20 + + # ID of the private network to attach the container to + privateNetworkId: "3fd741d4-f686-4afc-bcea-d720c695748f" ``` ## Supported commands diff --git a/deploy/lib/createContainers.js b/deploy/lib/createContainers.js index 03158761..51e1562c 100644 --- a/deploy/lib/createContainers.js +++ b/deploy/lib/createContainers.js @@ -154,6 +154,7 @@ module.exports = { sandbox: container.sandbox, health_check: adaptHealthCheckToAPI(container.healthCheck), scaling_option: adaptScalingOptionToAPI(container.scalingOption), + private_network_id: container.privateNetworkId, }; // checking if there is custom_domains set on container creation. @@ -177,6 +178,12 @@ module.exports = { }, async updateSingleContainer(container, foundContainer) { + let privateNetworkId = container.privateNetworkId; + const hasToDeletePrivateNetwork = foundContainer.private_network_id && !container.privateNetworkId; + if (hasToDeletePrivateNetwork) { + privateNetworkId = ""; + } + const params = { redeploy: false, environment_variables: container.env, @@ -201,6 +208,7 @@ module.exports = { sandbox: container.sandbox, health_check: adaptHealthCheckToAPI(container.healthCheck), scaling_option: adaptScalingOptionToAPI(container.scalingOption), + private_network_id: privateNetworkId, }; // note about maxConcurrency deprecation diff --git a/deploy/lib/createFunctions.js b/deploy/lib/createFunctions.js index a4a4cdaf..474b76f9 100644 --- a/deploy/lib/createFunctions.js +++ b/deploy/lib/createFunctions.js @@ -183,6 +183,7 @@ Runtime lifecycle doc : https://www.scaleway.com/en/docs/compute/functions/refer domain_name: func.domain_name, http_option: func.httpOption, sandbox: func.sandbox, + private_network_id: func.privateNetworkId, }; const availableRuntimes = await this.listRuntimes(); @@ -208,6 +209,12 @@ Runtime lifecycle doc : https://www.scaleway.com/en/docs/compute/functions/refer }, async updateSingleFunction(func, foundFunc) { + let privateNetworkId = func.privateNetworkId; + const hasToDeletePrivateNetwork = foundFunc.private_network_id && !func.privateNetworkId; + if (hasToDeletePrivateNetwork) { + privateNetworkId = ""; + } + const params = { redeploy: false, environment_variables: func.env, @@ -226,6 +233,7 @@ Runtime lifecycle doc : https://www.scaleway.com/en/docs/compute/functions/refer domain_name: func.domain_name, http_option: func.httpOption, sandbox: func.sandbox, + private_network_id: privateNetworkId, }; const availableRuntimes = await this.listRuntimes(); From 87ce1ee689f692c27193b0fec5dba692377f0228 Mon Sep 17 00:00:00 2001 From: Remy MACHAVOINE Date: Tue, 4 Nov 2025 16:54:27 +0100 Subject: [PATCH 2/2] lint --- README.md | 2 +- deploy/lib/createContainers.js | 3 ++- deploy/lib/createFunctions.js | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b8e05ed7..ece9a70c 100644 --- a/README.md +++ b/README.md @@ -179,7 +179,7 @@ functions: input: key-a: "value-a" key-b: "value-b" - + # ID of the private network to attach the function to privateNetworkId: "3fd741d4-f686-4afc-bcea-d720c695748f" ``` diff --git a/deploy/lib/createContainers.js b/deploy/lib/createContainers.js index 51e1562c..b2272295 100644 --- a/deploy/lib/createContainers.js +++ b/deploy/lib/createContainers.js @@ -179,7 +179,8 @@ module.exports = { async updateSingleContainer(container, foundContainer) { let privateNetworkId = container.privateNetworkId; - const hasToDeletePrivateNetwork = foundContainer.private_network_id && !container.privateNetworkId; + const hasToDeletePrivateNetwork = + foundContainer.private_network_id && !container.privateNetworkId; if (hasToDeletePrivateNetwork) { privateNetworkId = ""; } diff --git a/deploy/lib/createFunctions.js b/deploy/lib/createFunctions.js index 474b76f9..e48b471d 100644 --- a/deploy/lib/createFunctions.js +++ b/deploy/lib/createFunctions.js @@ -210,7 +210,8 @@ Runtime lifecycle doc : https://www.scaleway.com/en/docs/compute/functions/refer async updateSingleFunction(func, foundFunc) { let privateNetworkId = func.privateNetworkId; - const hasToDeletePrivateNetwork = foundFunc.private_network_id && !func.privateNetworkId; + const hasToDeletePrivateNetwork = + foundFunc.private_network_id && !func.privateNetworkId; if (hasToDeletePrivateNetwork) { privateNetworkId = ""; }