diff --git a/.gitignore b/.gitignore index f38815b..d821fb2 100644 --- a/.gitignore +++ b/.gitignore @@ -114,9 +114,8 @@ ipython_config.py # Coverage .coverage -infra/.terraform/* -infra/*.tfstate* -infra/cluster_autoscaler.yml -infra/.terraform.lock.hcl -infra/covalent-eks-cluster_config -infra/.tfvars +.terraform +*.tfstate* +*.terraform.lock.hcl +covalent-eks-cluster_config +*.tfvars diff --git a/CHANGELOG.md b/CHANGELOG.md index 5df9487..13d28ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [UNRELEASED] +## Changed + +- Changed the folder structure for the terraform files matching standard plugin folder format +- Minor code changes to kubernetes yml files + ## [0.2.0] - 2023-09-20 ### Changed diff --git a/Makefile b/Makefile index 575aa44..548da69 100644 --- a/Makefile +++ b/Makefile @@ -5,8 +5,8 @@ all: @echo "To tear down infrastructure, use 'make clean'." deploy: - (cd infra && bash ./deploy-eks.sh) + (cd covalent_kubernetes_plugin/assets/infra && bash ./deploy-eks.sh) clean: - (cd infra && terraform destroy -auto-approve -state $(HOME)/.cache/covalent/terraform.tfstate) - rm -f infra/cluster_autoscaler.yml + (cd covalent_kubernetes_plugin/assets/infra && terraform destroy -auto-approve -state $(HOME)/.cache/covalent/terraform.tfstate) + rm -f covalent_kubernetes_plugin/infra/templates/cluster_autoscaler.yml diff --git a/infra/covalent_eks.tf b/covalent_kubernetes_plugin/assets/infra/covalent_eks.tf similarity index 99% rename from infra/covalent_eks.tf rename to covalent_kubernetes_plugin/assets/infra/covalent_eks.tf index 90d4998..f8149e1 100644 --- a/infra/covalent_eks.tf +++ b/covalent_kubernetes_plugin/assets/infra/covalent_eks.tf @@ -18,7 +18,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = "~> 4.23" + version = "5.17.0" } } } @@ -83,6 +83,7 @@ resource "aws_ecr_repository" "ecr_repository" { resource "aws_s3_bucket" "s3_bucket" { bucket = var.aws_s3_bucket + force_destroy = true } data "aws_iam_policy_document" "s3_access_document" { diff --git a/infra/deploy-eks.sh b/covalent_kubernetes_plugin/assets/infra/deploy-eks.sh similarity index 100% rename from infra/deploy-eks.sh rename to covalent_kubernetes_plugin/assets/infra/deploy-eks.sh diff --git a/infra/eks-admin-service-account.yaml b/covalent_kubernetes_plugin/assets/infra/eks-admin-service-account.yaml similarity index 100% rename from infra/eks-admin-service-account.yaml rename to covalent_kubernetes_plugin/assets/infra/eks-admin-service-account.yaml diff --git a/infra/outputs.tf b/covalent_kubernetes_plugin/assets/infra/outputs.tf similarity index 100% rename from infra/outputs.tf rename to covalent_kubernetes_plugin/assets/infra/outputs.tf diff --git a/infra/sample_job.yaml b/covalent_kubernetes_plugin/assets/infra/sample_job.yaml similarity index 94% rename from infra/sample_job.yaml rename to covalent_kubernetes_plugin/assets/infra/sample_job.yaml index de9f7d5..42ac3cf 100644 --- a/infra/sample_job.yaml +++ b/covalent_kubernetes_plugin/assets/infra/sample_job.yaml @@ -21,8 +21,8 @@ metadata: spec: template: spec: + restartPolicy: Never containers: - name: covalent-k8s-test - image: "hello-world:latest" - restartPolicy: Never - backoffLimit: 4 + image: hello-world:latest + backoffLimit: 4 \ No newline at end of file diff --git a/infra/templates/cluster_autoscaler.yml b/covalent_kubernetes_plugin/assets/infra/templates/cluster_autoscaler.yml similarity index 100% rename from infra/templates/cluster_autoscaler.yml rename to covalent_kubernetes_plugin/assets/infra/templates/cluster_autoscaler.yml diff --git a/infra/templates/config.tpl b/covalent_kubernetes_plugin/assets/infra/templates/config.tpl similarity index 100% rename from infra/templates/config.tpl rename to covalent_kubernetes_plugin/assets/infra/templates/config.tpl diff --git a/infra/variables.tf b/covalent_kubernetes_plugin/assets/infra/variables.tf similarity index 100% rename from infra/variables.tf rename to covalent_kubernetes_plugin/assets/infra/variables.tf diff --git a/covalent_kubernetes_plugin/k8s.py b/covalent_kubernetes_plugin/k8s.py index 3e281ff..d743aca 100644 --- a/covalent_kubernetes_plugin/k8s.py +++ b/covalent_kubernetes_plugin/k8s.py @@ -220,11 +220,12 @@ def _format_exec_script( # Execution preamble exec_script = """ -import os -import cloudpickle as pickle -local_func_filename = os.path.join("{docker_working_dir}", "{func_filename}") -local_result_filename = os.path.join("{docker_working_dir}", "{result_filename}") + import os + import cloudpickle as pickle + + local_func_filename = os.path.join("{docker_working_dir}", "{func_filename}") + local_result_filename = os.path.join("{docker_working_dir}", "{result_filename}") """.format( docker_working_dir=docker_working_dir, @@ -449,6 +450,7 @@ def _package_and_upload( raise Exception(proc.stderr.decode("utf-8")) else: app_log.debug("Uploading image to ECR.") + app_log.debug(f"the image URI is {image_uri}") response = docker_client.images.push(image_uri, tag=image_tag) app_log.debug(f"Response: {response}") diff --git a/infra/defaults.tfvars b/infra/defaults.tfvars deleted file mode 100644 index 1f72766..0000000 --- a/infra/defaults.tfvars +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright 2021 Agnostiq Inc. -# -# This file is part of Covalent. -# -# Licensed under the Apache License 2.0 (the "License"). A copy of the -# License may be obtained with this software package or at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Use of this file is prohibited except in compliance with the License. -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -name = "covalent-eks" -aws_region = "us-east-1" -aws_ecr_repo = "covalent-eks-task" -aws_s3_bucket = "covalent-eks-task" -vpc_cidr = "10.0.0.0/16" -instance_types = ["t2.medium"] -disk_size = 8 -min_size = 1 -max_size = 6 -desired_size = 2 diff --git a/requirements.txt b/requirements.txt index d7432e0..4d83dc8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -covalent==0.177.0.post1.dev1 +covalent==0.220.0.post2 docker==6.0.0 kubernetes==24.2.0