diff --git a/docker-compose.yml b/docker-compose.yml index 471ec9a9..909e7c12 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,7 +31,6 @@ services: user: mcu environment: OS_CLIENT_CONFIG_FILE: /home/mcu/credentials/clouds.yaml - MAGIC_CASTLE_ACME_KEY_PEM: /home/mcu/credentials/acme_key.pem cleanup: build: diff --git a/docs/configuration.md b/docs/configuration.md index 95ba8b12..80d8a141 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -19,9 +19,7 @@ An example `configuration.json` is shown below. }, "dns_providers": { "cloudflare": { - "magic_castle_configuration": { - "email": "you@example.com" - }, + "magic_castle_configuration": {}, "environment_variables": { "CLOUDFLARE_API_TOKEN": "EXAMPLE_TOKEN", "CLOUDFLARE_ZONE_API_TOKEN": "EXAMPLE_TOKEN", @@ -30,7 +28,6 @@ An example `configuration.json` is shown below. }, "gcloud": { "magic_castle_configuration": { - "email": "you@example.com", "project": "your-project-id", "zone_name": "your-zone-name" }, @@ -61,13 +58,13 @@ If `auth_type` is set to `"SAML"`, the values contained in `admins` are strings ### `cors_allowed_origins` -A list of origins allowed making HTTP requests to the server. This should be set to the frontend base URL. +A list of origins allowed making HTTP requests to the server. This should be set to the frontend base URL. -For instance, if you are running MC Hub locally, this may be set to `http://localhost:5000`. If you are running an additional Node development server, you can also add its url, which may look like `http://localhost:8080`. +For instance, if you are running MC Hub locally, this may be set to `http://localhost:5000`. If you are running an additional Node development server, you can also add its url, which may look like `http://localhost:8080`. Otherwise, if you are running MC Hub in production, the origin url may look like `https://mc.computecanada.dev` (without an explicit port number). -> Note: The * wildcard origin can be used but is not recommended for security reasons. This way, a malicious web page could view and edit your clusters. +> Note: The \* wildcard origin can be used but is not recommended for security reasons. This way, a malicious web page could view and edit your clusters. ### `domains` diff --git a/mchub/configuration/magic_castle.py b/mchub/configuration/magic_castle.py index 44909ddb..a7462343 100644 --- a/mchub/configuration/magic_castle.py +++ b/mchub/configuration/magic_castle.py @@ -29,5 +29,3 @@ "gcloud": path.join(".", "dns", "gcloud"), }, } - -MAGIC_CASTLE_ACME_KEY_PEM = environ.get("MAGIC_CASTLE_ACME_KEY_PEM", "") diff --git a/mchub/models/cloud/dns_manager.py b/mchub/models/cloud/dns_manager.py index b1b7d087..c7244fff 100644 --- a/mchub/models/cloud/dns_manager.py +++ b/mchub/models/cloud/dns_manager.py @@ -1,5 +1,5 @@ from ... configuration import config -from ... configuration.magic_castle import MAGIC_CASTLE_SOURCE, MAGIC_CASTLE_ACME_KEY_PEM +from ... configuration.magic_castle import MAGIC_CASTLE_SOURCE class DnsManager: @@ -36,8 +36,6 @@ def get_magic_castle_configuration(self): "name": "${module.openstack.cluster_name}", "domain": "${module.openstack.domain}", "public_instances": "${module.openstack.public_instances}", - "ssh_private_key": "${module.openstack.ssh_private_key}", - "sudoer_username": "${module.openstack.accounts.sudoer.username}", } } magic_castle_configuration["dns"].update( @@ -45,8 +43,6 @@ def get_magic_castle_configuration(self): "magic_castle_configuration" ] ) - if MAGIC_CASTLE_ACME_KEY_PEM != "": - magic_castle_configuration["dns"]["acme_key_pem"] = f"${{file(\"{MAGIC_CASTLE_ACME_KEY_PEM}\")}}" return magic_castle_configuration else: diff --git a/mchub/models/cloud/openstack_manager.py b/mchub/models/cloud/openstack_manager.py index 8663c67e..6f191d09 100644 --- a/mchub/models/cloud/openstack_manager.py +++ b/mchub/models/cloud/openstack_manager.py @@ -16,7 +16,7 @@ # Magic Castle requires the following specs for each instance category TAG_MINIMUM_REQUIREMENTS = { "mgmt": { - "ram": 6144, + "ram": 8000, "vcpus": 2 }, "login": { diff --git a/tests/mocks/configuration/config_mock.py b/tests/mocks/configuration/config_mock.py index cd98f0a7..151416f2 100644 --- a/tests/mocks/configuration/config_mock.py +++ b/tests/mocks/configuration/config_mock.py @@ -24,7 +24,7 @@ "dns_providers": { "cf1": { "module": "cloudflare", - "magic_castle_configuration": {"email": "you@example.com"}, + "magic_castle_configuration": {}, "environment_variables": { "CLOUDFLARE_API_TOKEN": "EXAMPLE_TOKEN", "CLOUDFLARE_ZONE_API_TOKEN": "EXAMPLE_TOKEN", @@ -34,7 +34,6 @@ "gcloud1": { "module": "gcloud", "magic_castle_configuration": { - "email": "you@example.com", "project": "your-project-name", "zone_name": "your-zone-name", }, @@ -75,4 +74,3 @@ def config_auth_none_mock(mocker): mocker.patch( "mchub.resources.api_view.config", new=configuration, ) - diff --git a/tests/unit/cloud/test_dns_manager.py b/tests/unit/cloud/test_dns_manager.py index 5a272041..418abbb7 100644 --- a/tests/unit/cloud/test_dns_manager.py +++ b/tests/unit/cloud/test_dns_manager.py @@ -6,6 +6,7 @@ from ... mocks.configuration.config_mock import config_auth_none_mock # noqa; from ... test_helpers import * # noqa; + def test_initialize_disallowed_domain(): with pytest.raises(KeyError): DnsManager("invalid.com") @@ -33,25 +34,19 @@ def test_get_environment_variables_with_dns_provider(): def test_get_magic_castle_configuration_with_dns_provider(): assert DnsManager("calculquebec.cloud").get_magic_castle_configuration() == { "dns": { - "email": "you@example.com", "source": MAGIC_CASTLE_SOURCE["dns"]["cloudflare"], "name": "${module.openstack.cluster_name}", "domain": "${module.openstack.domain}", "public_instances": "${module.openstack.public_instances}", - "ssh_private_key": "${module.openstack.ssh_private_key}", - "sudoer_username": "${module.openstack.accounts.sudoer.username}", } } assert DnsManager("c3.ca").get_magic_castle_configuration() == { "dns": { - "email": "you@example.com", "project": "your-project-name", "zone_name": "your-zone-name", "source": MAGIC_CASTLE_SOURCE["dns"]["gcloud"], "name": "${module.openstack.cluster_name}", "domain": "${module.openstack.domain}", "public_instances": "${module.openstack.public_instances}", - "ssh_private_key": "${module.openstack.ssh_private_key}", - "sudoer_username": "${module.openstack.accounts.sudoer.username}", } }