lablup / lablup/backend.ai

Allow adding multiple CIDR-based announce-ip of wsproxy coordinator in the webserver

Open
#1,903 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
17h 7m
Merged PRs (30d)
358

Description

In some customer sites, there are two groups of users who connects from different networks (e.g., internal & public) and the wsproxy address must be differentiated for each group of users.

We need to provide an option to configure additional CIDR-based wsproxy address announcements.

Currently, `[service].wsproxy.url` is configured in `webserver.conf` and this value is propagated and rendered to `config.toml` and `config_ini.toml` which are fetched by the WebUI.

Let's keep the existing configuration to work as "0.0.0.0/0" fallback option and allow addition of CIDR prefix based mappings:

## For wsproxy v1 (used in all-in-one dev setup)

**Before: (webserver.conf)**

```toml
[service]
wsproxy.url = "example.com:5050"
```

**After: (webserver.conf)**

```toml
[service]
wsproxy.url = "example.com:5050" # serves as "0.0.0.0/0" fallback

[service.wsproxy.prefixed-urls]
"10.123.0.0/16" = "example.internal:5051"
"192.168.0.0/24" = "example2.internal:5051"
```

This will be parsed like:

```python
{'service': {'wsproxy': {'prefixed-urls': {'10.123.0.0/16': 'example.internal:5051',
'192.168.0.0/24': 'example2.internal:5051'},
'url': 'example.com:5050'}}}
```

## For wsproxy v2 (used in production and large-scale deployments)

We need to extend the `scaling_groups` table definition to hold a mapping of CIDR-prefixes to wsproxy URLs. This per-resource-group setting is used by the manager's `start_service` API which is usually invoked via the webserver. Fortunately the webserver already provides the actual client IP address via the `X-Forwarded-For` header, so that the manager could reply with the appropriate mapping.

JIRA Issue: BA-150

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.