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

fix(init): Include separate optional param for custom location namespace. #36

Merged
merged 3 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion azext_edge/edge/commands_edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def init(
cluster_name: str,
resource_group_name: str,
cluster_namespace: str = "default",
custom_location_namespace: Optional[str] = None,
pas_version: str = DeployablePasVersions.v012.value,
custom_location_name: Optional[str] = None,
show_pas_version: Optional[bool] = None,
Expand Down Expand Up @@ -91,6 +92,9 @@ def init(
if not custom_location_name:
custom_location_name = f"{cluster_name_lowered}-azedge-init"

if not custom_location_namespace:
custom_location_namespace = cluster_namespace

if not processor_instance_name:
processor_instance_name = f"{cluster_name_lowered}-azedge-init-proc"
processor_instance_name = processor_instance_name.replace("_", "-")
Expand All @@ -106,7 +110,7 @@ def init(
cluster_name=cluster_name,
cluster_namespace=cluster_namespace,
custom_location_name=custom_location_name,
custom_location_namespace=cluster_namespace,
custom_location_namespace=custom_location_namespace,
resource_group_name=resource_group_name,
pas_version=pas_version,
location=location,
Expand Down
14 changes: 10 additions & 4 deletions azext_edge/edge/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,24 @@ def load_iotedge_arguments(self, _):
context.argument(
"custom_location_name",
options_list=["--custom-location"],
help="The custom location name corresponding to the PAS deployment. If no custom location name is provided"
" one will be generated in the form '{cluster_name}-azedge-init'.",
help="The custom location name corresponding to PAS solution deployment. "
"If no custom location name is provided one will be generated in the form '{cluster_name}-azedge-init'.",
)
context.argument(
"custom_location_namespace",
options_list=["--custom-location-namespace", "--cln"],
help="The namespace associated with the custom location mapped to the cluster. Must be lowercase. "
"If not provided cluster namespace will be used.",
)
context.argument(
"cluster_namespace",
options_list=["--cluster-namespace"],
help="The cluster namespace PAS resources will be deployed to. Must be lowercase.",
help="The cluster namespace PAS infrastructure will be deployed to. Must be lowercase.",
)
context.argument(
"location",
options_list=["--location"],
help="The location that will be used for provisioned collateral. "
help="The ARM location that will be used for provisioned ARM collateral. "
"If not provided the resource group location will be used.",
)
context.argument(
Expand Down
2 changes: 1 addition & 1 deletion azext_edge/edge/providers/support/bluefin.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


BLUEFIN_APP_LABEL = (
"app in (bluefin-reader-worker,bluefin-refdata-store,bf-instance-nats-box"
"app in (bluefin-reader-worker,bluefin-refdata-store,bf-instance-nats-box,nats"
",bluefin-scheduler,bluefin-runner-worker,bluefin-portal,bluefin-api-proxy)"
)
BLUEFIN_RELEASE_LABEL = "release in (bf-instance)"
Expand Down
10 changes: 8 additions & 2 deletions azext_edge/tests/edge/init/test_init_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


@pytest.mark.parametrize(
"cluster_name,cluster_namespace,rg,custom_location_name,location,pas_version,"
"cluster_name,cluster_namespace,rg,custom_location_name,custom_location_namespace,location,pas_version,"
"processor_instance_name,simulate_plc,opcua_discovery_endpoint,create_sync_rules,"
"custom_version,target_name",
[
Expand All @@ -27,6 +27,7 @@
generate_generic_id(), # cluster_namespace
generate_generic_id(), # rg
generate_generic_id(), # custom_location_name
generate_generic_id(), # custom_location_namespace
generate_generic_id(), # location
DeployablePasVersions.v012.value,
generate_generic_id(), # processor_instance_name
Expand All @@ -41,6 +42,7 @@
"default", # cluster_namespace
generate_generic_id(), # rg
None, # custom_location_name
None, # custom_location_namespace
None, # location
DeployablePasVersions.v012.value,
None, # processor_instance_name
Expand All @@ -59,6 +61,7 @@ def test_init_show_template(
cluster_namespace,
rg,
custom_location_name,
custom_location_namespace,
location,
pas_version,
processor_instance_name,
Expand All @@ -75,6 +78,7 @@ def test_init_show_template(
cluster_namespace=cluster_namespace,
resource_group_name=rg,
custom_location_name=custom_location_name,
custom_location_namespace=custom_location_namespace,
location=location,
processor_instance_name=processor_instance_name,
simulate_plc=simulate_plc,
Expand Down Expand Up @@ -105,6 +109,7 @@ def test_init_show_template(
cluster_name=cluster_name,
cluster_namespace=cluster_namespace,
custom_location_name=custom_location_name,
custom_location_namespace=custom_location_namespace,
pas_version=pas_version,
processor_instance_name=processor_instance_name,
simulate_plc=simulate_plc,
Expand Down Expand Up @@ -135,6 +140,7 @@ def assert_resources(
cluster_name: str,
cluster_namespace: str,
custom_location_name: str,
custom_location_namespace: str,
pas_version: str,
processor_instance_name: Optional[str] = None,
simulate_plc: Optional[bool] = None,
Expand Down Expand Up @@ -185,7 +191,7 @@ def assert_resources(
custom_location=next(iter(custom_locations.values())),
name=custom_location_name,
cluster_name=cluster_name,
namespace=cluster_namespace,
namespace=custom_location_namespace or cluster_namespace,
depends_on=cluster_extension_ids,
cluster_ext_ids=cluster_extension_ids,
)
Expand Down