Skip to content

Commit

Permalink
[Azure] Allow to set 'region' parameter in config
Browse files Browse the repository at this point in the history
  • Loading branch information
JosepSampe committed Apr 29, 2023
1 parent e8852a3 commit eebc908
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 21 deletions.
2 changes: 1 addition & 1 deletion docs/source/compute_config/aws_ec2.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ aws_ec2:

|Group|Key|Default|Mandatory|Additional info|
|---|---|---|---|---|
|aws_ec2 | region | |yes | Region name, for example: `eu-west-1` |
|aws_ec2 | region | |yes | Region name, for example: `eu-west-1`. Lithops will use the `region` set under the `aws` section if it is not set here |
|aws_ec2 | iam_role | | yes | IAM EC2 role name. You can find it in the [IAM Console page](https://console.aws.amazon.com/iamv2/home#/roles). Create a new EC2 role if it does not exist|
|aws_ec2 | vpc_id | | no | VPC id. You can find all the available VPCs in the [VPC Console page](https://console.aws.amazon.com/vpc/v2/home#vpcs:) |
|aws_ec2 | subnet_id | | no | Subnet id. You can find all the available Subnets in the [VPC Console page](https://console.aws.amazon.com/vpc/v2/home#subnets:) |
Expand Down
2 changes: 1 addition & 1 deletion docs/source/compute_config/aws_lambda.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ aws_lambda:
| Group | Key | Default | Mandatory | Additional info |
|------------|---------------------|---------|-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| aws_lambda | execution_role | | yes | ARN of the execution role created at step 3. You can find it in the Role page at the *Roles* list in the *IAM* section (e.g. `arn:aws:iam::1234567890:role/lithops-execution-role` |
| aws_lambda | region | | no | Region where the S3 bucket is located and where Lambda functions will be invoked (e.g. `us-east-1`). Lithops will use the region set under the `aws` section if it is not set here |
| aws_lambda | region | | no | Region where the S3 bucket is located and where Lambda functions will be invoked (e.g. `us-east-1`). Lithops will use the `region` set under the `aws` section if it is not set here |
| aws_lambda | max_workers | 1000 | no | Max number of workers per `FunctionExecutor()` |
| aws_lambda | worker_processes | 1 | no | Number of Lithops processes within a given worker. This can be used to parallelize function activations within a worker |
| aws_lambda | runtime | | no | Docker image name |
Expand Down
20 changes: 14 additions & 6 deletions docs/source/compute_config/azure_containers.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,25 @@ az containerapp env create --name lithops --resource-group LithopsResourceGroup
lithops:
backend : azure_containers
azure:
region: <LOCATION>
resource_group: <RESOURCE_GROUP_NAME>
azure_storage:
storage_account_name: <STORAGE_ACCOUNT_NAME>
storage_account_key: <STORAGE_ACCOUNT_KEY>
azure_containers:
region: <LOCATION>
resource_group: <RESOURCE_GROUP_NAME>
```

## Summary of configuration keys for Azure

### Azure

|Group|Key|Default|Mandatory|Additional info|
|---|---|---|---|---|
|azure| region | |yes | Azure location for the services to be deployed, for example: `westeurope`|
|azure| resource_group | | yes | Name of a resource group, for example: `LithopsResourceGroup` |
|azure| subscription_id | |no | Subscription ID from your account. Find it [here](https://portal.azure.com/#view/Microsoft_Azure_Billing/SubscriptionsBlade)|

### Azure Storage

|Group|Key|Default|Mandatory|Additional info|
Expand All @@ -85,8 +93,8 @@ az containerapp env create --name lithops --resource-group LithopsResourceGroup

|Group|Key|Default|Mandatory|Additional info|
|---|---|---|---|---|
|azure_containers| resource_group | |yes | Name of the resource group used in the step 5 of the installation. |
|azure_containers| region | |yes | The location where you created the `lithops` Container APP environment. For example: `westeurope`|
|azure_containers| resource_group | |no | Name of a resource group, for example: `LithopsResourceGroup`. Lithops will use the `resource_group` set under the `azure` section if it is not set here |
|azure_containers| region | |no | The location where you created the `lithops` Container APP environment. For example: `westeurope`. Lithops will use the `region` set under the `azure` section if it is not set here|
|azure_containers| environment | lithops |no | The environemnt name you created in the step 5 of the installation |
|azure_containers | docker_server | index.docker.io |no | Docker server URL |
|azure_containers | docker_user | |no | Docker hub username |
Expand Down
20 changes: 14 additions & 6 deletions docs/source/compute_config/azure_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,25 @@ az login
lithops:
backend : azure_functions
azure:
region: <LOCATION>
resource_group: <RESOURCE_GROUP_NAME>
azure_storage:
storage_account_name: <STORAGE_ACCOUNT_NAME>
storage_account_key: <STORAGE_ACCOUNT_KEY>
azure_functions:
region: <CONSUMPTION_PLAN_LOCATION>
resource_group: <RESOURCE_GROUP_NAME>
```

## Summary of configuration keys for Azure

### Azure

|Group|Key|Default|Mandatory|Additional info|
|---|---|---|---|---|
|azure| region | |yes | Azure location for the services to be deployed, for example: `westeurope`|
|azure| resource_group | | yes | Name of a resource group, for example: `LithopsResourceGroup` |
|azure| subscription_id | |no | Subscription ID from your account. Find it [here](https://portal.azure.com/#view/Microsoft_Azure_Billing/SubscriptionsBlade)|

## Azure Storage

|Group|Key|Default|Mandatory|Additional info|
Expand All @@ -81,8 +89,8 @@ az login

|Group|Key|Default|Mandatory|Additional info|
|---|---|---|---|---|
|azure_functions| resource_group | |yes | Name of the resource group used in the step 5 of the installation. |
|azure_functions| region | |yes | The location of the consumption plan for the runtime. Use `az functionapp list-consumption-locations` to view the available locations. For example: `westeurope`|
|azure_functions| resource_group | |no | Name of a resource group, for example: `LithopsResourceGroup`. Lithops will use the `resource_group` set under the `azure` section if it is not set here |
|azure_functions| region | |no | The location of the consumption plan for the runtime. Use `az functionapp list-consumption-locations` to view the available locations. For example: `westeurope`. Lithops will use the `region` set under the `azure` section if it is not set here|
|azure_functions | max_workers | 1000 | no | Max number of parallel workers. Altough Azure limits the number of workrs to 200, it is convenient to keep this value high|
|azure_functions | worker_processes | 1 | no | Number of Lithops processes within a given worker. This can be used to parallelize function activations within a worker |
|azure_functions| runtime | |no | Runtime name already deployed in the service|
Expand Down
10 changes: 5 additions & 5 deletions docs/source/compute_config/code_engine.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ In this step you are required to install IBM Cloud CLI tool, Code Engine plugin
```yaml
lithops:
backend: code_engine
ibm:
iam_api_key: <IAM_API_KEY>
region : <REGION>
code_engine:
namespace : <NAMESPACE>
region : <REGION>
```
## Runtime
Expand Down Expand Up @@ -124,15 +124,15 @@ code_engine:
|Group|Key|Default|Mandatory|Additional info|
|---|---|---|---|---|
|ibm | iam_api_key | |yes | IBM Cloud IAM API key to authenticate against IBM services. Obtain the key [here](https://cloud.ibm.com/iam/apikeys) |
|ibm | region | |no | IBM Region. One of: `eu-gb`, `eu-de`, `us-south`, `us-east`, `br-sao`, `ca-tor`, `jp-tok`, `jp-osa`, `au-syd` |
|ibm | region | |yes | IBM Region. One of: `eu-gb`, `eu-de`, `us-south`, `us-east`, `br-sao`, `ca-tor`, `jp-tok`, `jp-osa`, `au-syd` |
|ibm | resource_group_id | | no | Resource group id from your IBM Cloud account. Get it from [here](https://cloud.ibm.com/account/resource-groups) |
## Code Engine:
|Group|Key|Default|Mandatory|Additional info|
|---|---|---|---|---|
|code_engine | namespace | |yes | Namespace name|
|code_engine | region | | yes | Cluster region. One of: `eu-gb`, `eu-de`, `us-south`, `us-east`, `br-sao`, `ca-tor`, `jp-tok`, `jp-osa`, `au-syd`. Lithops will use the region set under the `ibm` section if it is not set here |
|code_engine | region | | no | Cluster region. One of: `eu-gb`, `eu-de`, `us-south`, `us-east`, `br-sao`, `ca-tor`, `jp-tok`, `jp-osa`, `au-syd`. Lithops will use the `region` set under the `ibm` section if it is not set here |
|code_engine | docker_server | docker.io |no | Docker server URL |
|code_engine | docker_user | |no | Docker hub username |
|code_engine | docker_password | |no | Login to your docker hub account and generate a new access token [here](https://hub.docker.com/settings/security)|
Expand Down
2 changes: 1 addition & 1 deletion docs/source/compute_config/ibm_cf.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Lithops with *IBM Cloud Functions* as compute backend.
|---|---|---|---|---|
|ibm_cf| namespace | |no | Value of CURRENT NAMESPACE from [here](https://cloud.ibm.com/functions/namespace-settings). Lithops will automatically create a new namespace if not provided. Alternatively provide a `namespace` name and `namespace_id` of an existsing namespace |
|ibm_cf| namespace_id | |no | Value of 'GUID' from [here](https://cloud.ibm.com/functions/namespace-settings). Provide it if you want to use an existsing `namespace`|
|ibm_cf | region | |no | Service region. One of: `jp-tok`, `au-syd`, `eu-gb`, `eu-de`, `us-south`, `us-east`. Lithops will use the region set under the `ibm` section if it is not set here |
|ibm_cf | region | |no | Service region. One of: `jp-tok`, `au-syd`, `eu-gb`, `eu-de`, `us-south`, `us-east`. Lithops will use the `region` set under the `ibm` section if it is not set here |
|ibm_cf| endpoint | |no | IBM Cloud Functions endpoint (if region not provided). Make sure to use https:// prefix, for example: https://us-east.functions.cloud.ibm.com |
|ibm_cf | max_workers | 1200 | no | Max number of workers per `FunctionExecutor()`|
|ibm_cf | worker_processes | 1 | no | Number of Lithops processes within a given worker. This can be used to parallelize function activations within a worker |
Expand Down
2 changes: 1 addition & 1 deletion docs/source/compute_config/ibm_vpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ ibm_vpc:

|Group|Key|Default|Mandatory|Additional info|
|---|---|---|---|---|
|ibm_vpc | region | |no | VPC Region. For example `us-south`. Choose one region from [here](https://cloud.ibm.com/docs/vpc?topic=vpc-service-endpoints-for-vpc). Lithops will use the region set under the `ibm` section if it is not set here |
|ibm_vpc | region | |no | VPC Region. For example `us-south`. Choose one region from [here](https://cloud.ibm.com/docs/vpc?topic=vpc-service-endpoints-for-vpc). Lithops will use the `region` set under the `ibm` section if it is not set here |
|ibm_vpc | vpc_id | | no | VPC id of an existing VPC. Get it from [here](https://cloud.ibm.com/vpc-ext/network/vpcs) |
|ibm_vpc | vpc_name | | no | VPC name of an existing VPC (if `vpc_id` is not provided) |
|ibm_vpc | security_group_id | | no | Security group id of an existing VPC. Get it from [here](https://cloud.ibm.com/vpc-ext/network/securityGroups)|
Expand Down
7 changes: 7 additions & 0 deletions lithops/serverless/backends/azure_containers/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#

import os
import copy

from lithops.constants import TEMP_DIR

FH_ZIP_LOCATION = os.path.join(os.getcwd(), 'lithops_azure_ca.zip')
Expand Down Expand Up @@ -152,6 +154,11 @@ def load_config(config_data):
if 'azure_storage' not in config_data or not config_data['azure_storage']:
raise Exception("'azure_storage' section is mandatory in the configuration")

if 'azure' in config_data and config_data['azure'] is not None:
temp = copy.deepcopy(config_data['azure_containers'])
config_data['azure_containers'].update(config_data['azure'])
config_data['azure_containers'].update(temp)

if not config_data['azure_containers']:
raise Exception("'azure_containers' section is mandatory in the configuration")

Expand Down
7 changes: 7 additions & 0 deletions lithops/serverless/backends/azure_functions/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#

import os
import copy

from lithops.constants import TEMP_DIR

BUILD_DIR = os.path.join(TEMP_DIR, 'AzureRuntimeBuild')
Expand Down Expand Up @@ -143,6 +145,11 @@ def load_config(config_data):
if 'azure_storage' not in config_data or not config_data['azure_storage']:
raise Exception("'azure_storage' section is mandatory in the configuration")

if 'azure' in config_data and config_data['azure'] is not None:
temp = copy.deepcopy(config_data['azure_functions'])
config_data['azure_functions'].update(config_data['azure'])
config_data['azure_functions'].update(temp)

if not config_data['azure_functions']:
raise Exception("'azure_functions' section is mandatory in the configuration")

Expand Down

0 comments on commit eebc908

Please sign in to comment.