diff --git a/.github/workflows/dss-deploy.yml b/.github/workflows/dss-deploy.yml deleted file mode 100644 index 7b20dc265..000000000 --- a/.github/workflows/dss-deploy.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Deploy DSS -on: - workflow_dispatch: {} - pull_request: {} -jobs: - deploy: - name: Deploy DSS to AWS - runs-on: ubuntu-latest - if: github.repository == 'interuss/dss' || github.repository == 'Orbitalize/dss' - concurrency: - group: dss-deploy-aws - cancel-in-progress: false - permissions: - id-token: write - contents: read - steps: - - name: Job information - run: | - echo "Job information" - echo "Trigger: ${{ github.event_name }}" - echo "Host: ${{ runner.os }}" - echo "Repository: ${{ github.repository }}" - echo "Branch: ${{ github.ref }}" - docker images - - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: arn:aws:iam::301042233698:role/InterUSSGithubCI - aws-region: us-east-1 - mask-aws-account-id: true - role-duration-seconds: 1800 - - - name: Caller Id - run: | - aws sts get-caller-identity - - - name: Test Deployment Scenario AWS-1 - shell: bash - working-directory: ./deploy/operations/ - env: - COMPOSE_PROFILES: aws-1 - run: | - docker compose up --exit-code-from ci-aws-1 diff --git a/.gitignore b/.gitignore index a24e88084..9268591f8 100644 --- a/.gitignore +++ b/.gitignore @@ -128,7 +128,4 @@ test/e2e_test_result go # vscode files -.vscode - -# terraform -.terraform* \ No newline at end of file +.vscode \ No newline at end of file diff --git a/deploy/infrastructure/dependencies/terraform-aws-kubernetes/cluster.tf b/deploy/infrastructure/dependencies/terraform-aws-kubernetes/cluster.tf index 1c5153026..dfca0743f 100644 --- a/deploy/infrastructure/dependencies/terraform-aws-kubernetes/cluster.tf +++ b/deploy/infrastructure/dependencies/terraform-aws-kubernetes/cluster.tf @@ -1,11 +1,11 @@ resource "aws_eks_cluster" "kubernetes_cluster" { name = var.cluster_name role_arn = aws_iam_role.dss-cluster.arn - + vpc_config { subnet_ids = aws_subnet.dss[*].id endpoint_public_access = true - public_access_cidrs = [ + public_access_cidrs = [ "0.0.0.0/0" ] } @@ -26,7 +26,7 @@ resource "aws_eks_node_group" "eks_node_group" { node_role_arn = aws_iam_role.dss-cluster-node-group.arn disk_size = 100 node_group_name_prefix = aws_eks_cluster.kubernetes_cluster.name - instance_types = [ + instance_types = [ var.aws_instance_type ] diff --git a/deploy/infrastructure/dependencies/terraform-aws-kubernetes/ebs.tf b/deploy/infrastructure/dependencies/terraform-aws-kubernetes/ebs.tf index dc7eefd8b..eedf02822 100644 --- a/deploy/infrastructure/dependencies/terraform-aws-kubernetes/ebs.tf +++ b/deploy/infrastructure/dependencies/terraform-aws-kubernetes/ebs.tf @@ -1,3 +1,12 @@ +data "tls_certificate" "cluster_oidc_provider" { + url = aws_eks_cluster.kubernetes_cluster.identity[0].oidc[0].issuer +} + +resource "aws_iam_openid_connect_provider" "cluster_provider" { + client_id_list = ["sts.amazonaws.com"] + thumbprint_list = data.tls_certificate.cluster_oidc_provider.certificates[*].sha1_fingerprint + url = data.tls_certificate.cluster_oidc_provider.url +} resource "aws_eks_addon" "aws-ebs-csi-driver" { addon_name = "aws-ebs-csi-driver" diff --git a/deploy/infrastructure/dependencies/terraform-aws-kubernetes/iam.tf b/deploy/infrastructure/dependencies/terraform-aws-kubernetes/iam.tf index 00131e28c..6eabc6ead 100644 --- a/deploy/infrastructure/dependencies/terraform-aws-kubernetes/iam.tf +++ b/deploy/infrastructure/dependencies/terraform-aws-kubernetes/iam.tf @@ -7,24 +7,22 @@ locals { } resource "aws_iam_role" "dss-cluster" { - // EKS does not support a path in the role arn name = "${var.cluster_name}-dss-cluster" - assume_role_policy = jsonencode( - { - "Version" : "2012-10-17", - "Statement" : [ - { - "Effect" : "Allow", - "Principal" : { - "Service" : "eks.amazonaws.com" - }, - "Action" : "sts:AssumeRole" - } - ] - }) - - permissions_boundary = var.aws_iam_permissions_boundary + assume_role_policy = < kubectl create secret -n VAR_NAMESPACE docker-registry VAR_DOCKER_IMAGE_PULL_SECRET \ - --docker-server=DOCKER_REGISTRY_SERVER \ - --docker-username=DOCKER_USER \ - --docker-password=DOCKER_PASSWORD \ - --docker-email=DOCKER_EMAIL - - Replace `VAR_DOCKER_IMAGE_PULL_SECRET` with the secret name (for instance: `private-registry-credentials`). - For docker hub private repository, use `docker.io` as `DOCKER_REGISTRY_SERVER` and an - [access token](https://hub.docker.com/settings/security) as `DOCKER_PASSWORD`. - - Example: docker-registry - EOT - default = "" -} - -variable "authorization" { - type = object({ - public_key_pem_path = optional(string) - jwks = optional(object({ - endpoint = string - key_id = string - })) - }) - description = <_", - and the = character is not allowed. However, any unique (among all other participating - DSS instances) value is acceptable. - - Example: - EOT -} - -variable "crdb_external_nodes" { - type = list(string) - description = <<-EOT - Fully-qualified domain name of existing CRDB nodes outside of the cluster if you are joining an existing pool. - Example: ["0.db.dss.example.com", "1.db.dss.example.com", "2.db.dss.example.com"] - EOT - default = [] -} - -variable "kubernetes_namespace" { - type = string - description = <<-EOT - Namespace where to deploy Kubernetes resources. Only default is supported at the moment. - - Example: `default` - EOT - - default = "default" - - # TODO: Adapt current deployment scripts in /build/deploy to support default is supported for the moment. - validation { - condition = var.kubernetes_namespace == "default" - error_message = "Only default namespace is supported at the moment" - } -} - diff --git a/deploy/operations/docker-compose.yaml b/deploy/operations/docker-compose.yaml deleted file mode 100644 index 4618089db..000000000 --- a/deploy/operations/docker-compose.yaml +++ /dev/null @@ -1,15 +0,0 @@ -services: - ci-aws-1: - build: . - image: interuss-deploy - profiles: ["aws-1"] - command: operations/ci/aws-1/test.sh - working_dir: /opt/dss - environment: - - AWS_ACCESS_KEY_ID - - AWS_SECRET_ACCESS_KEY - - AWS_SESSION_TOKEN - volumes: - - type: bind - source: ../ - target: /opt/dss/