Skip to content

Commit

Permalink
chore: change det deploy aws's default deployment type to simple-rds (#…
Browse files Browse the repository at this point in the history
…10105)

Co-authored-by: Bradley Laney <[email protected]>
  • Loading branch information
corban-beaird and stoksc authored Oct 31, 2024
1 parent 9a30f26 commit f9ac6bc
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 30 deletions.
20 changes: 16 additions & 4 deletions harness/determined/deploy/aws/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,14 +387,26 @@ def deploy_stack(
print()

prompt_needed = True
elif tags[constants.deployment_types.TYPE_TAG_KEY] != deployment_type:
print("Value of --deployment-type has changed!")
prompt_needed = True
else:
if tags[constants.deployment_types.TYPE_TAG_KEY] != deployment_type:
print("Value of --deployment-type has changed!")
prompt_needed = True

if tags[constants.deployment_types.TYPE_TAG_KEY] == "simple":
print()
print(
"Previous value of --deployment-type was 'simple'. This deployment type\n"
"was removed in 0.38.0 because AWS Aurora V1 is EoL. Please follow this\n"
"guide to migrate to RDS:\n"
"\thttps://gist.github.com/rb-determined-ai/"
"bfa10182e53968e00a3c88df624e777e"
)
print()

if prompt_needed:
val = input(
"If --deployment-type has changed, updating the stack may erase the database.\n"
"Are you sure you want to proceed? [y/N]"
"Are you sure you want to proceed? [y/N]\n"
)
if val.lower() != "y":
print("Update canceled.")
Expand Down
6 changes: 1 addition & 5 deletions harness/determined/deploy/aws/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ def error_no_credentials() -> None:

def get_deployment_class(deployment_type: str) -> Type[base.DeterminedDeployment]:
deployment_type_map = {
constants.deployment_types.SIMPLE: simple.Simple,
constants.deployment_types.SIMPLE_RDS: simple.SimpleRDS,
constants.deployment_types.SECURE: secure.Secure,
constants.deployment_types.EFS: vpc.EFS,
Expand Down Expand Up @@ -142,10 +141,7 @@ def deploy_aws(command: str, args: argparse.Namespace) -> None:
):
raise cli.CliError("If a CPU or GPU environment image is specified, both should be.")

if (
args.deployment_type != constants.deployment_types.SIMPLE
or args.deployment_type != constants.deployment_types.SIMPLE_RDS
):
if args.deployment_type != constants.deployment_types.SIMPLE_RDS:
if args.agent_subnet_id is not None:
raise ValueError(
f"The agent-subnet-id can only be set if the deployment-type=simple. "
Expand Down
5 changes: 2 additions & 3 deletions harness/determined/deploy/aws/constants.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
class deployment_types:
SIMPLE = "simple"
SIMPLE_RDS = "simple-rds"
SECURE = "secure"
EFS = "efs"
GENAI = "genai"
FSX = "fsx"
GOVCLOUD = "govcloud"
DEPLOYMENT_TYPES = [SIMPLE, SECURE, EFS, FSX, GOVCLOUD, SIMPLE_RDS, GENAI]
DEPLOYMENT_TYPES = [SIMPLE_RDS, SECURE, EFS, FSX, GOVCLOUD, GENAI]
TYPE_TAG_KEY = "deployment-type"


class defaults:
DEPLOYMENT_TYPE = deployment_types.SIMPLE
DEPLOYMENT_TYPE = deployment_types.SIMPLE_RDS
DB_PASSWORD = "postgres"
REGION = "us-west-2"
STACK_TAG_KEY = "managed-by"
Expand Down
24 changes: 6 additions & 18 deletions harness/determined/deploy/aws/deployment_types/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@
from determined.deploy.aws.deployment_types import base


class Simple(base.DeterminedDeployment):
template = "simple.yaml"
deployment_type = constants.deployment_types.SIMPLE
class SimpleRDS(base.DeterminedDeployment):
template = "simple-rds.yaml"
deployment_type = constants.deployment_types.SIMPLE_RDS

template_parameter_keys = base.COMMON_TEMPLATE_PARAMETER_KEYS + [
constants.cloudformation.PREEMPTION_ENABLED,
constants.cloudformation.RETAIN_LOG_GROUP,
constants.cloudformation.SCHEDULER_TYPE,
constants.cloudformation.SUBNET_ID_KEY,
constants.cloudformation.DB_INSTANCE_TYPE,
constants.cloudformation.DB_SNAPSHOT,
constants.cloudformation.DB_SIZE,
]

def deploy(self, no_prompt: bool, update_terminate_agents: bool) -> None:
Expand All @@ -31,18 +34,3 @@ def deploy(self, no_prompt: bool, update_terminate_agents: bool) -> None:
update_terminate_agents=update_terminate_agents,
)
self.print_results()


class SimpleRDS(Simple):
template = "simple-rds.yaml"
deployment_type = constants.deployment_types.SIMPLE_RDS

template_parameter_keys = base.COMMON_TEMPLATE_PARAMETER_KEYS + [
constants.cloudformation.PREEMPTION_ENABLED,
constants.cloudformation.RETAIN_LOG_GROUP,
constants.cloudformation.SCHEDULER_TYPE,
constants.cloudformation.SUBNET_ID_KEY,
constants.cloudformation.DB_INSTANCE_TYPE,
constants.cloudformation.DB_SNAPSHOT,
constants.cloudformation.DB_SIZE,
]

0 comments on commit f9ac6bc

Please sign in to comment.