Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Harmonize Envoy CLI and Configuration Files with Director Component for Consistency #1284

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
c125a29
Clean envoy CLI & config
refai06 Jan 6, 2025
176d6e6
Merge branch 'securefederatedai:develop' into Envoy-CLI-and-Config-cl…
refai06 Jan 7, 2025
1f2f598
Cleanup federatedruntime testcase-config
refai06 Jan 7, 2025
5fefd5a
Merge branch 'securefederatedai:develop' into Envoy-CLI-and-Config-cl…
refai06 Jan 9, 2025
5f7bbe8
Update files
refai06 Jan 10, 2025
762c234
Merge branch 'securefederatedai:develop' into Envoy-CLI-and-Config-cl…
refai06 Jan 10, 2025
5a3b4e8
Merge branch 'securefederatedai:develop' into Envoy-CLI-and-Config-cl…
refai06 Jan 12, 2025
f00ce2a
Merge branch 'securefederatedai:develop' into Envoy-CLI-and-Config-cl…
refai06 Jan 14, 2025
3d0b44a
Merge branch 'develop' into Envoy-CLI-and-Config-cleanup
refai06 Jan 16, 2025
781e3b9
Envoy execption-handling
refai06 Jan 16, 2025
61cc9c1
Merge branch 'securefederatedai:develop' into Envoy-CLI-and-Config-cl…
refai06 Jan 17, 2025
9f60b9e
Update error messages
refai06 Jan 17, 2025
9c6f0dc
Merge branch 'securefederatedai:develop' into Envoy-CLI-and-Config-cl…
refai06 Jan 17, 2025
268b3e7
Documentation update for recent change
refai06 Jan 17, 2025
343182f
Merge branch 'securefederatedai:develop' into Envoy-CLI-and-Config-cl…
refai06 Jan 20, 2025
7a735da
Fix code format
refai06 Jan 20, 2025
b6822ec
Document Update
refai06 Jan 21, 2025
203d417
Merge branch 'securefederatedai:develop' into Envoy-CLI-and-Config-cl…
refai06 Jan 22, 2025
5d4f208
Merge branch 'securefederatedai:develop' into Envoy-CLI-and-Config-cl…
refai06 Jan 24, 2025
bdf1da2
Merge branch 'securefederatedai:develop' into Envoy-CLI-and-Config-cl…
refai06 Jan 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions docs/about/features_index/workflowinterface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -342,37 +342,43 @@ An example configuration file `director_config.yaml` is shown below:

**Envoy: Participating nodes in the Federation**

The `fx envoy start` command is used to start the Envoy. You can run it with or without TLS, depending on your setup.
The :code:`fx envoy start` command is used to start the Envoy. You can run it with or without TLS, depending on your setup.

**With TLS:**
Use the following command:

.. code-block:: shell

$ fx envoy start -n <envoy_name> -ec <path_to_envoy_config_yaml_file> -dh <director_host> -dp <director_port> -rc <root_certificate_path> -pk <private_key_path> -oc <api_certificate_path>
$ fx envoy start -n <envoy_name> -c <path_to_envoy_config_yaml_file> -rc <root_certificate_path> -pk <private_key_path> -oc <api_certificate_path>

**Without TLS:**
Use the following command:

.. code-block:: shell

$ fx envoy start -n <envoy_name> --disable-tls -ec <path_to_envoy_config_yaml_file>
$ fx envoy start -n <envoy_name> --disable-tls -c <path_to_envoy_config_yaml_file>

**Explanation of Command Options**

- `-n <envoy_name>`: Specifies the name of the Envoy.
- `-ec <path_to_envoy_config_yaml_file>`: Path to the Envoy's configuration file.
- `-dh <director_host>`: Hostname or IP address of the Director.
- `-dp <director_port>`: Port on which the Director is running.
- `-c <path_to_envoy_config_yaml_file>`: Path to the Envoy's configuration file.
- `-rc <root_certificate_path>`: Path to the root certificate (used with TLS).
- `-pk <private_key_path>`: Path to the private key file (used with TLS).
- `-oc <api_certificate_path>`: Path to the API certificate file (used with TLS).
- `--disable-tls`: Disables TLS encryption.

The Envoy configuration file includes details about the private attributes. An example configuration file :code:`envoy_config.yaml` for :code:`envoy_one` is shown below:
The Envoy configuration file includes details of director_host, director_port and private attributes. An example configuration file :code:`envoy_config.yaml` for :code:`settings` and :code:`envoy_one` is shown below:

- Hostname (`director_host`)
- Port (`director_port`)
- Private attributes for envoy_one

.. code-block:: yaml

settings:
director_host: localhost
director_port: 50050

envoy_one:
private_attributes: private_attributes.envoy_one_attrs

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
settings:
director_host: localhost
director_port: 50050

Portland:
private_attributes: private_attributes.portland_attrs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -e
ENVOY_NAME=$1
ENVOY_CONF=$2

fx envoy start -n "$ENVOY_NAME" --disable-tls --envoy-config-path "$ENVOY_CONF" -dh localhost -dp 50050
fx envoy start -n "$ENVOY_NAME" --disable-tls -c "$ENVOY_CONF"
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
settings:
director_host: localhost
director_port: 50050

Seattle:
private_attributes: private_attributes.seattle_attrs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -e
ENVOY_NAME=$1
ENVOY_CONF=$2

fx envoy start -n "$ENVOY_NAME" --disable-tls --envoy-config-path "$ENVOY_CONF" -dh localhost -dp 50050
fx envoy start -n "$ENVOY_NAME" --disable-tls -c "$ENVOY_CONF"
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
settings:
director_host: localhost
director_port: 50050

Bangalore:
callable_func:
settings:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -e
ENVOY_NAME=$1
ENVOY_CONF=$2

fx envoy start -n "$ENVOY_NAME" --disable-tls --envoy-config-path "$ENVOY_CONF" -dh localhost -dp 50050
fx envoy start -n "$ENVOY_NAME" --disable-tls -c "$ENVOY_CONF"
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
settings:
director_host: localhost
director_port: 50050

Chandler:
callable_func:
settings:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -e
ENVOY_NAME=$1
ENVOY_CONF=$2

fx envoy start -n "$ENVOY_NAME" --disable-tls --envoy-config-path "$ENVOY_CONF" -dh localhost -dp 50050
fx envoy start -n "$ENVOY_NAME" --disable-tls -c "$ENVOY_CONF"
59 changes: 33 additions & 26 deletions openfl/experimental/workflow/interface/cli/envoy.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from dynaconf import Validator

from openfl.experimental.workflow.component.envoy import Envoy
from openfl.utilities import click_types, merge_configs
from openfl.utilities import is_fqdn, merge_configs
from openfl.utilities.path_check import is_directory_traversal

logger = logging.getLogger(__name__)
Expand All @@ -32,32 +32,18 @@ def envoy(context):
@envoy.command(name="start")
@option("-n", "--envoy_name", required=True, help="Current shard name")
@option(
"-dh",
"--director-host",
required=True,
help="The FQDN of the federation director",
type=click_types.FQDN,
)
@option(
"-dp",
"--director-port",
required=True,
help="The federation director port",
type=click.IntRange(1, 65535),
"-c",
"--envoy-config-path",
default="envoy_config.yaml",
help="The envoy config path",
type=ClickPath(exists=True),
)
@option(
"--tls/--disable-tls",
default=True,
is_flag=True,
help="Use TLS or not (By default TLS is enabled)",
)
@option(
"-ec",
"--envoy-config-path",
default="envoy_config.yaml",
help="The envoy config path",
type=ClickPath(exists=True),
)
@option(
"-rc",
"--root-cert-path",
Expand All @@ -84,8 +70,6 @@ def envoy(context):
)
def start_(
envoy_name,
director_host,
director_port,
tls,
envoy_config_path,
root_certificate,
Expand All @@ -96,8 +80,6 @@ def start_(

Args:
envoy_name (str): Name of the Envoy.
director_host (str): The FQDN of the federation director.
director_port (int): The federation director port.
tls (bool): Use TLS or not.
envoy_config_path (str): The envoy config path.
root_certificate (str): Path to a root CA cert.
Expand All @@ -118,6 +100,31 @@ def start_(
"certificate": certificate,
},
validators=[
Validator(
"settings",
must_exist=True,
messages={"must_exist_true": "Missing 'settings' in Envoy Configuration file."},
),
Validator(
"settings.director_host",
must_exist=True,
condition=lambda x: bool(x) and is_fqdn(x),
refai06 marked this conversation as resolved.
Show resolved Hide resolved
messages={
"must_exist_true": "Missing 'director_host' in Envoy Configuration file",
"condition": "Invalid 'director_host' in Envoy Configuration file."
"Must be a valid FQDN",
},
),
Validator(
"settings.director_port",
must_exist=True,
condition=lambda value: isinstance(value, int) and 1024 <= value <= 65535,
messages={
"must_exist_true": "Missing 'director_port' in Envoy Configuration file",
"condition": "Invalid 'director_port' in Envoy Configuration file"
"Must be an integer between 1024 & 65535",
},
),
Validator("params.install_requirements", default=True),
],
)
Expand All @@ -138,8 +145,8 @@ def start_(

envoy = Envoy(
envoy_name=envoy_name,
director_host=director_host,
director_port=director_port,
director_host=config.settings.director_host,
director_port=config.settings.director_port,
envoy_config=Path(envoy_config_path).absolute(),
root_certificate=config.root_certificate,
private_key=config.private_key,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
settings:
director_host: localhost
director_port: 50050

envoy_one:
callable_func:
settings:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -e
ENVOY_NAME=$1
ENVOY_CONF=$2

fx envoy start -n "$ENVOY_NAME" --disable-tls --envoy-config-path "$ENVOY_CONF" -dh localhost -dp 50050
fx envoy start -n "$ENVOY_NAME" --disable-tls -c "$ENVOY_CONF"
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
settings:
director_host: localhost
director_port: 50050

envoy_two:
callable_func:
settings:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -e
ENVOY_NAME=$1
ENVOY_CONF=$2

fx envoy start -n "$ENVOY_NAME" --disable-tls --envoy-config-path "$ENVOY_CONF" -dh localhost -dp 50050
fx envoy start -n "$ENVOY_NAME" --disable-tls -c "$ENVOY_CONF"
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@

settings:
director_host: localhost
director_port: 50050

Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -e
ENVOY_NAME=$1
ENVOY_CONF=$2

fx envoy start -n "$ENVOY_NAME" --disable-tls -dh localhost -dp 50050
fx envoy start -n "$ENVOY_NAME" --disable-tls -c "$ENVOY_CONF"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
settings:
director_host: localhost
director_port: 50050

Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -e
ENVOY_NAME=$1
ENVOY_CONF=$2

fx envoy start -n "$ENVOY_NAME" --disable-tls -dh localhost -dp 50050
fx envoy start -n "$ENVOY_NAME" --disable-tls -c "$ENVOY_CONF"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
settings:
director_host: localhost
director_port: 50050
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -e
ENVOY_NAME=$1
ENVOY_CONF=$2

fx envoy start -n "$ENVOY_NAME" --disable-tls --envoy-config-path "$ENVOY_CONF" -dh localhost -dp 50050
fx envoy start -n "$ENVOY_NAME" --disable-tls -c "$ENVOY_CONF"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
settings:
director_host: localhost
director_port: 50050
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -e
ENVOY_NAME=$1
ENVOY_CONF=$2

fx envoy start -n "$ENVOY_NAME" --disable-tls --envoy-config-path "$ENVOY_CONF" -dh localhost -dp 50050
fx envoy start -n "$ENVOY_NAME" --disable-tls -c "$ENVOY_CONF"
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
settings:
director_host: localhost
director_port: 50050

envoy_one:
callable_func:
settings:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -e
ENVOY_NAME=$1
ENVOY_CONF=$2

fx envoy start -n "$ENVOY_NAME" --disable-tls --envoy-config-path "$ENVOY_CONF" -dh localhost -dp 50050
fx envoy start -n "$ENVOY_NAME" --disable-tls -c "$ENVOY_CONF"
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
settings:
director_host: localhost
director_port: 50050

envoy_two:
callable_func:
settings:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -e
ENVOY_NAME=$1
ENVOY_CONF=$2

fx envoy start -n "$ENVOY_NAME" --disable-tls --envoy-config-path "$ENVOY_CONF" -dh localhost -dp 50050
fx envoy start -n "$ENVOY_NAME" --disable-tls -c "$ENVOY_CONF"
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
settings:
director_host: localhost
director_port: 50050

envoy_one:
callable_func:
settings:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -e
ENVOY_NAME=$1
ENVOY_CONF=$2

fx envoy start -n "$ENVOY_NAME" --disable-tls --envoy-config-path "$ENVOY_CONF" -dh localhost -dp 50050
fx envoy start -n "$ENVOY_NAME" --disable-tls -c "$ENVOY_CONF"
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
settings:
director_host: localhost
director_port: 50050

envoy_two:
callable_func:
settings:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -e
ENVOY_NAME=$1
ENVOY_CONF=$2

fx envoy start -n "$ENVOY_NAME" --disable-tls --envoy-config-path "$ENVOY_CONF" -dh localhost -dp 50050
fx envoy start -n "$ENVOY_NAME" --disable-tls -c "$ENVOY_CONF"
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
settings:
director_host: localhost
director_port: 50050

envoy_one:
private_attributes: private_attributes.collaborator_private_attrs.collaborator_private_attributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -e
ENVOY_NAME=$1
ENVOY_CONF=$2

fx envoy start -n "$ENVOY_NAME" --disable-tls --envoy-config-path "$ENVOY_CONF" -dh localhost -dp 50050
fx envoy start -n "$ENVOY_NAME" --disable-tls -c "$ENVOY_CONF"
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
settings:
director_host: localhost
director_port: 50050

envoy_two:
private_attributes: private_attributes.collaborator_private_attrs.collaborator_private_attributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -e
ENVOY_NAME=$1
ENVOY_CONF=$2

fx envoy start -n "$ENVOY_NAME" --disable-tls --envoy-config-path "$ENVOY_CONF" -dh localhost -dp 50050
fx envoy start -n "$ENVOY_NAME" --disable-tls -c "$ENVOY_CONF"
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
settings:
director_host: localhost
director_port: 50050

envoy_one:
callable_func:
settings:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -e
ENVOY_NAME=$1
ENVOY_CONF=$2

fx envoy start -n "$ENVOY_NAME" --disable-tls --envoy-config-path "$ENVOY_CONF" -dh localhost -dp 50050
fx envoy start -n "$ENVOY_NAME" --disable-tls -c "$ENVOY_CONF"
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
settings:
director_host: localhost
director_port: 50050

envoy_two:
callable_func:
settings:
Expand Down
Loading
Loading