def deploy_env(env_name: str, manifest_dir: str) -> None: docker.login(context=context) _logger.debug("DockerHub and ECR Logged in") cdk_toolkit.deploy(context=context) _logger.debug("CDK Toolkit Stack deployed") env.deploy( context=context, eks_system_masters_roles_changes=changeset.eks_system_masters_roles_changeset if changeset else None, ) _logger.debug("Env Stack deployed") eksctl.deploy_env( context=context, changeset=changeset, ) _logger.debug("EKS Environment Stack deployed") kubectl.deploy_env(context=context) _logger.debug("Kubernetes Environment components deployed") helm.deploy_env(context=context) _logger.debug("Helm Charts installed") k8s_context = utils.get_k8s_context(context=context) kubectl.fetch_kubectl_data(context=context, k8s_context=k8s_context) ContextSerDe.dump_context_to_ssm(context=context) _logger.debug("Updating userpool redirect") _update_userpool_client(context=context) _update_userpool(context=context)
def delete_image(args: Tuple[str, ...]) -> None: _logger.debug("args %s", args) env_name: str = args[0] context: "Context" = ContextSerDe.load_context_from_ssm(env_name=env_name, type=Context) if len(args) == 2: image_name: str = args[1] else: raise ValueError("Unexpected number of values in args.") env.deploy(context=context, add_images=[], remove_images=[image_name], eks_system_masters_roles_changes=None) _logger.debug("Env changes deployed") ecr.delete_repo(repo=f"orbit-{context.name}-{image_name}") _logger.debug("Docker Image Destroyed from ECR")
def deploy_env(args: Tuple[str, ...]) -> None: _logger.debug("args: %s", args) if len(args) == 2: env_name: str = args[0] skip_images_remote_flag: str = str(args[1]) else: raise ValueError("Unexpected number of values in args") context: "Context" = ContextSerDe.load_context_from_ssm(env_name=env_name, type=Context) _logger.debug("Context loaded.") changeset: Optional["Changeset"] = load_changeset_from_ssm( env_name=env_name) _logger.debug("Changeset loaded.") docker.login(context=context) _logger.debug("DockerHub and ECR Logged in") cdk_toolkit.deploy(context=context) _logger.debug("CDK Toolkit Stack deployed") env.deploy( context=context, add_images=[], remove_images=[], eks_system_masters_roles_changes=changeset. eks_system_masters_roles_changeset if changeset else None, ) _logger.debug("Env Stack deployed") if skip_images_remote_flag == "skip-images": _logger.debug("Docker images build skipped") else: deploy_images_remotely(context=context) _logger.debug("Docker Images deployed") eksctl.deploy_env( context=context, changeset=changeset, ) _logger.debug("EKS Environment Stack deployed") kubectl.deploy_env(context=context) _logger.debug("Kubernetes Environment components deployed")
def deploy_env(args: Tuple[str, ...]) -> None: _logger.debug("args: %s", args) if len(args) == 2: env_name: str = args[0] skip_images_remote_flag: str = str(args[1]) else: raise ValueError("Unexpected number of values in args") context: "Context" = ContextSerDe.load_context_from_ssm(env_name=env_name, type=Context) _logger.debug("Context loaded.") changeset: Optional["Changeset"] = load_changeset_from_ssm(env_name=env_name) _logger.debug("Changeset loaded.") docker.login(context=context) _logger.debug("DockerHub and ECR Logged in") cdk_toolkit.deploy(context=context) _logger.debug("CDK Toolkit Stack deployed") env.deploy( context=context, eks_system_masters_roles_changes=changeset.eks_system_masters_roles_changeset if changeset else None, ) _logger.debug("Env Stack deployed") deploy_images_remotely(context=context, skip_images=skip_images_remote_flag == "skip-images") _logger.debug("Docker Images deployed") eksctl.deploy_env( context=context, changeset=changeset, ) _logger.debug("EKS Environment Stack deployed") kubectl.deploy_env(context=context) _logger.debug("Kubernetes Environment components deployed") helm.deploy_env(context=context) _logger.debug("Helm Charts installed") k8s_context = utils.get_k8s_context(context=context) kubectl.fetch_kubectl_data(context=context, k8s_context=k8s_context, include_teams=False) ContextSerDe.dump_context_to_ssm(context=context)
def delete_image(env_name: str, image_name: str) -> None: env.deploy(context=context, eks_system_masters_roles_changes=None) _logger.debug("Env changes deployed") ecr.delete_repo(repo=f"orbit-{context.name}/users/{image_name}") _logger.debug("Docker Image Destroyed from ECR")