diff --git a/.github/workflows/amazon-cloudwatch-observability-helm-integration-test.yaml b/.github/workflows/amazon-cloudwatch-observability-helm-integration-test.yaml index 0d2a1a2..b881d5c 100644 --- a/.github/workflows/amazon-cloudwatch-observability-helm-integration-test.yaml +++ b/.github/workflows/amazon-cloudwatch-observability-helm-integration-test.yaml @@ -78,4 +78,116 @@ jobs: retry_wait_seconds: 5 command: | cd integration-tests/amazon-cloudwatch-observability/terraform/helm + terraform destroy --auto-approve + + HelmChartsIntegrationTestWindows-2022: + name: HelmChartsIntegrationTestWindows-2022 + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Generate testing id + run: echo TESTING_ID="${{ github.run_id }}-${{ github.run_number }}" >> $GITHUB_ENV + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + aws-region: ${{ env.AWS_DEFAULT_REGION }} + + # local directory to store the kubernetes config + - name: Create kubeconfig directory + run: mkdir -p ${{ github.workspace }}/../../../.kube + + - name: Set KUBECONFIG environment variable + run: echo KUBECONFIG="${{ github.workspace }}/../../../.kube/config" >> $GITHUB_ENV + + - name: Verify Terraform version + run: terraform --version + + - name: Terraform apply + uses: nick-fields/retry@v2 + with: + max_attempts: 1 + timeout_minutes: 60 # EKS takes about 20 minutes to spin up a cluster and service on the cluster + retry_wait_seconds: 5 + command: | + cd integration-tests/amazon-cloudwatch-observability/terraform/helm-windows + terraform init + if terraform apply -auto-approve \ + -var="windows_os_version=WINDOWS_CORE_2022_x86_64" -var="kube_dir=${{ github.workspace }}/../../../.kube"; then + terraform destroy -auto-approve + else + terraform destroy -auto-approve && exit 1 + fi + + - name: Terraform destroy + if: ${{ cancelled() || failure() }} + uses: nick-fields/retry@v2 + with: + max_attempts: 3 + timeout_minutes: 8 + retry_wait_seconds: 5 + command: | + cd integration-tests/amazon-cloudwatch-observability/terraform/helm-windows + terraform destroy --auto-approve + + HelmChartsIntegrationTestWindows-2019: + name: HelmChartsIntegrationTestWindows-2019 + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Generate testing id + run: echo TESTING_ID="${{ github.run_id }}-${{ github.run_number }}" >> $GITHUB_ENV + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + aws-region: ${{ env.AWS_DEFAULT_REGION }} + + # local directory to store the kubernetes config + - name: Create kubeconfig directory + run: mkdir -p ${{ github.workspace }}/../../../.kube + + - name: Set KUBECONFIG environment variable + run: echo KUBECONFIG="${{ github.workspace }}/../../../.kube/config" >> $GITHUB_ENV + + - name: Verify Terraform version + run: terraform --version + + - name: Terraform apply + uses: nick-fields/retry@v2 + with: + max_attempts: 1 + timeout_minutes: 60 # EKS takes about 20 minutes to spin up a cluster and service on the cluster + retry_wait_seconds: 5 + command: | + cd integration-tests/amazon-cloudwatch-observability/terraform/helm-windows + terraform init + if terraform apply -auto-approve \ + -var="windows_os_version=WINDOWS_CORE_2019_x86_64" -var="kube_dir=${{ github.workspace }}/../../../.kube"; then + terraform destroy -auto-approve + else + terraform destroy -auto-approve && exit 1 + fi + + - name: Terraform destroy + if: ${{ cancelled() || failure() }} + uses: nick-fields/retry@v2 + with: + max_attempts: 3 + timeout_minutes: 8 + retry_wait_seconds: 5 + command: | + cd integration-tests/amazon-cloudwatch-observability/terraform/helm-windows terraform destroy --auto-approve \ No newline at end of file diff --git a/integration-tests/amazon-cloudwatch-observability/terraform/helm-windows/main.tf b/integration-tests/amazon-cloudwatch-observability/terraform/helm-windows/main.tf new file mode 100644 index 0000000..09c24d2 --- /dev/null +++ b/integration-tests/amazon-cloudwatch-observability/terraform/helm-windows/main.tf @@ -0,0 +1,235 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +module "common" { + source = "../common" +} + +module "basic_components" { + source = "../basic_components" +} + +locals { + aws_eks = "aws eks --region ${var.region}" + cluster_name = var.cluster_name != "" ? var.cluster_name : "cwagent-operator-helm-integ" +} + +data "aws_eks_cluster_auth" "this" { + name = aws_eks_cluster.this.name +} + +data "aws_caller_identity" "account_id" {} + +data "aws_eks_cluster" "eks_windows_cluster_ca" { + name = aws_eks_cluster.this.name +} + +output "account_id" { + value = data.aws_caller_identity.account_id.account_id +} + +resource "aws_eks_cluster" "this" { + name = "${local.cluster_name}-${module.common.testing_id}" + role_arn = module.basic_components.role_arn + version = var.k8s_version + vpc_config { + subnet_ids = module.basic_components.public_subnet_ids + security_group_ids = [module.basic_components.security_group] + } +} + +## EKS Cluster Addon + +resource "aws_eks_addon" "eks_windows_addon" { + cluster_name = aws_eks_cluster.this.name + addon_name = "vpc-cni" +} + +## Enable VPC CNI Windows Support + +resource "kubernetes_config_map_v1_data" "amazon_vpc_cni_windows" { + depends_on = [ + aws_eks_cluster.this, + aws_eks_addon.eks_windows_addon + ] + metadata { + name = "amazon-vpc-cni" + namespace = "kube-system" + } + + force = true + + data = { + enable-windows-ipam : "true" + } +} + +## AWS CONFIGMAP + +resource "kubernetes_config_map" "configmap" { + data = { + "mapRoles" = <