Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
121bdd5
windows eks test
XinRanZhAWS Sep 25, 2024
b721e44
remove some comments
XinRanZhAWS Sep 25, 2024
38703b5
Dotnet Windows EKS on One Region
XinRanZhAWS Sep 25, 2024
fc38a5b
Dotnet Windows EKS on One Region
XinRanZhAWS Sep 25, 2024
bb552f7
Windows EKS Initiate
XinRanZhAWS Sep 25, 2024
41be43d
Remove Over-Length Windows Account ID
XinRanZhAWS Sep 25, 2024
8819fc9
Remove Over-Length Windows Account ID
XinRanZhAWS Sep 25, 2024
a585335
Initiate Windows Terraform
XinRanZhAWS Sep 25, 2024
912f40f
Patching Windows Account ID
XinRanZhAWS Sep 25, 2024
1cee4ac
change taint
XinRanZhAWS Sep 26, 2024
4d158cb
Change the Cluster That Be use By Windows EKS
XinRanZhAWS Sep 26, 2024
d9ad7ed
Add NodeSelector for windows EKS
XinRanZhAWS Sep 26, 2024
6e82e1d
Add NodeSelector for windows EKS
XinRanZhAWS Sep 26, 2024
db7f22b
Add NodeSelector for windows EKS
XinRanZhAWS Sep 26, 2024
c85dd88
change back to use original cluster
XinRanZhAWS Sep 26, 2024
c002bd8
Change Toleration
XinRanZhAWS Sep 26, 2024
d5dd66b
Revert "Dotnet Windows EKS on One Region"
XinRanZhAWS Sep 26, 2024
394b42c
Revert "Dotnet Windows EKS on One Region"
XinRanZhAWS Sep 26, 2024
95d66cf
Build Windows Docker Image
XinRanZhAWS Sep 26, 2024
a953583
Build Windows Docker Image
XinRanZhAWS Sep 26, 2024
a549ce0
Build Windows Docker Image
XinRanZhAWS Sep 26, 2024
78bf129
Build Windows Docker Image
XinRanZhAWS Sep 26, 2024
f054bc5
Revert "Revert "Dotnet Windows EKS on One Region""
XinRanZhAWS Sep 26, 2024
6c521a2
Revert "Revert "Dotnet Windows EKS on One Region""
XinRanZhAWS Sep 26, 2024
0aef348
Do Not Use Windows For Traffic Generator
XinRanZhAWS Sep 26, 2024
4048824
Seperate File for Windows Docker
XinRanZhAWS Sep 26, 2024
09728a7
Revert "Build Windows Docker Image"
XinRanZhAWS Sep 26, 2024
c390e4e
Revert "Build Windows Docker Image"
XinRanZhAWS Sep 26, 2024
984aad8
Revert "Build Windows Docker Image"
XinRanZhAWS Sep 26, 2024
eacfe19
Revert "Build Windows Docker Image"
XinRanZhAWS Sep 26, 2024
ba80c73
Revert "remove some comments"
XinRanZhAWS Sep 26, 2024
7f1d386
Prepare to run on US-EAST-1 REGION
XinRanZhAWS Sep 26, 2024
89b8c49
Create New Canary for Dotnet Windows
XinRanZhAWS Sep 26, 2024
c3947f6
Revert "Dotnet Windows EKS on One Region"
XinRanZhAWS Sep 26, 2024
ba736a2
Revert "Dotnet Windows EKS on One Region"
XinRanZhAWS Sep 26, 2024
6719797
Remove Windows out of Linux EKS Canary
XinRanZhAWS Sep 26, 2024
ff8303b
Rename Dotnet Windows EKS Canary
XinRanZhAWS Sep 26, 2024
2f635ce
Use Correct Account and Region
XinRanZhAWS Sep 26, 2024
b89a99f
Remove unneeded test code
XinRanZhAWS Sep 27, 2024
57fe660
Revert "Remove unneeded test code"
XinRanZhAWS Sep 27, 2024
05d5e76
Use Manual Created EKS on Test Region
XinRanZhAWS Sep 27, 2024
0647c70
Remove Test Code
XinRanZhAWS Sep 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/dotnet-eks-windows-canary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
## SPDX-License-Identifier: Apache-2.0

## This workflow aims to run the Application Signals DotNet end-to-end tests as a canary to
## test the artifacts for Application Signals enablement. It will deploy a sample app and remote
## service onto an EKS cluster, call the APIs, and validate the generated telemetry,
## including logs, metrics, and traces.
name: Dotnet EKS Windows Enablement Canary Testing
on:
schedule:
- cron: '* */1 * * *' # run the workflow every one hour
workflow_dispatch: # be able to run the workflow on demand

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false

permissions:
id-token: write
contents: read


jobs:
eks-windows:
strategy:
fail-fast: false
matrix:
aws-region: ['us-east-1']
uses: ./.github/workflows/dotnet-eks-windows-test.yml
secrets: inherit
with:
aws-region: ${{ matrix.aws-region }}
test-cluster-name: 'eks-windows-manual'
caller-workflow-name: 'appsignals-dotnet-windows-e2e-eks-canary-test'
442 changes: 442 additions & 0 deletions .github/workflows/dotnet-eks-windows-test.yml

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions sample-apps/dotnet/asp_frontend_service/Dockerfile_Windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0-windowsservercore-ltsc2022 AS build-env
WORKDIR /app
COPY . ./
RUN dotnet publish asp_frontend_service/asp_frontend_service.csproj -c Release -o out

FROM mcr.microsoft.com/dotnet/aspnet:8.0-windowsservercore-ltsc2022
WORKDIR /app
EXPOSE 8080
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "asp_frontend_service.dll"]
11 changes: 11 additions & 0 deletions sample-apps/dotnet/asp_remote_service/Dockerfile_Windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0-windowsservercore-ltsc2022 AS build-env
WORKDIR /app
COPY . ./
RUN dotnet publish asp_remote_service/asp_remote_service.csproj -c Release -o out

FROM mcr.microsoft.com/dotnet/aspnet:8.0-windowsservercore-ltsc2022
WORKDIR /app
ENV ASPNETCORE_URLS=http://+:8081
EXPOSE 8081
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "asp_remote_service.dll"]
29 changes: 29 additions & 0 deletions sample-apps/dotnet/docker-compose-windows.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
version: '3'
services:
asp_frontend_service:
image: dotnetsampleapp/frontend-service
dns:
- "8.8.8.8"
- "8.8.6.6"
build:
context: .
dockerfile: asp_frontend_service/Dockerfile
container_name: asp_frontend_service
restart: always
ports:
- "8080:8080"

asp_remote_service:
image: dotnetsampleapp/remote-service
dns:
- "8.8.8.8"
- "8.8.6.6"
build:
context: .
dockerfile: asp_remote_service/Dockerfile
container_name: asp_remote_service
restart: always
ports:
- "8081:8081"
19 changes: 19 additions & 0 deletions terraform/dotnet/eks/windows/kubeconfig.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!-- TODO: Check if this repository can be refactored with a common kubeconfig.tpl file -->
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: ${CA_DATA}
server: ${SERVER_ENDPOINT}
name: ${CLUSTER_NAME}
contexts:
- context:
cluster: ${CLUSTER_NAME}
user: terraform_user
name: ${CLUSTER_NAME}
current-context: ${CLUSTER_NAME}
kind: Config
preferences: {}
users:
- name: terraform_user
user:
token: ${TOKEN}
266 changes: 266 additions & 0 deletions terraform/dotnet/eks/windows/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
# ------------------------------------------------------------------------
# Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license" file accompanying this file. This file 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.
# -------------------------------------------------------------------------

terraform {
required_providers {
aws = {
source = "hashicorp/aws"
}

kubernetes = {
source = "hashicorp/kubernetes"
version = ">= 2.16.1"
}

kubectl = {
source = "gavinbunney/kubectl"
version = ">= 1.7.0"
}
}
}

provider "aws" {
region = var.aws_region
}

# get eks cluster
data "aws_eks_cluster" "testing_cluster" {
name = var.eks_cluster_name
}
data "aws_eks_cluster_auth" "testing_cluster" {
name = var.eks_cluster_name
}

# set up kubectl
provider "kubernetes" {
host = data.aws_eks_cluster.testing_cluster.endpoint
cluster_ca_certificate = base64decode(data.aws_eks_cluster.testing_cluster.certificate_authority[0].data)
token = data.aws_eks_cluster_auth.testing_cluster.token
}

provider "kubectl" {
// Note: copy from eks module. Please avoid use shorted-lived tokens when running locally.
// For more information: https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs#exec-plugins
host = data.aws_eks_cluster.testing_cluster.endpoint
cluster_ca_certificate = base64decode(data.aws_eks_cluster.testing_cluster.certificate_authority[0].data)
token = data.aws_eks_cluster_auth.testing_cluster.token
load_config_file = false
}

data "template_file" "kubeconfig_file" {
template = file("./kubeconfig.tpl")
vars = {
CLUSTER_NAME : var.eks_cluster_context_name
CA_DATA : data.aws_eks_cluster.testing_cluster.certificate_authority[0].data
SERVER_ENDPOINT : data.aws_eks_cluster.testing_cluster.endpoint
TOKEN = data.aws_eks_cluster_auth.testing_cluster.token
}
}

resource "local_file" "kubeconfig" {
content = data.template_file.kubeconfig_file.rendered
filename = "${var.kube_directory_path}/config"
}

### Setting up the sample app on the cluster

resource "kubernetes_deployment" "dotnet_app_deployment" {

metadata {
name = "dotnet-app-deployment-${var.test_id}"
namespace = var.test_namespace
labels = {
app = "dotnet-app"
}
}

spec {
replicas = 1
selector {
match_labels = {
app = "dotnet-app"
}
}
template {
metadata {
labels = {
app = "dotnet-app"
}
annotations = {
# these annotations allow for OTel Dotnet instrumentation
"instrumentation.opentelemetry.io/inject-dotnet": "true"
}
}
spec {
service_account_name = var.service_account_aws_access
toleration {
key = "windows"
operator = "Equal"
value = "true"
effect = "NoSchedule"
}
node_selector = {
"kubernetes.io/os": "windows",
"kubernetes.io/arch": "amd64"
}
container {
name = "back-end"
image = var.dotnet_app_image
image_pull_policy = "Always"
env {
#inject the test id to service name for unique App Signals metrics
name = "OTEL_SERVICE_NAME"
value = "dotnet-application-${var.test_id}"
}
port {
container_port = 8080
}
}
}
}
}
}

resource "kubernetes_service" "dotnet_app_service" {
depends_on = [ kubernetes_deployment.dotnet_app_deployment ]

metadata {
name = "dotnet-app-service"
namespace = var.test_namespace
}
spec {
type = "NodePort"
selector = {
app = "dotnet-app"
}
port {
protocol = "TCP"
port = 8080
target_port = 8080
node_port = 30100
}
}
}

# Set up the remote service

resource "kubernetes_deployment" "dotnet_r_app_deployment" {

metadata {
name = "dotnet-r-app-deployment-${var.test_id}"
namespace = var.test_namespace
labels = {
app = "remote-app"
}
}

spec {
replicas = 1
selector {
match_labels = {
app = "remote-app"
}
}
template {
metadata {
labels = {
app = "remote-app"
}
annotations = {
# these annotations allow for OTel Dotnet instrumentation
"instrumentation.opentelemetry.io/inject-dotnet" = "true"
}
}
spec {
node_selector = {
"kubernetes.io/os": "windows",
"kubernetes.io/arch": "amd64"
}
service_account_name = var.service_account_aws_access
toleration {
key = "windows"
operator = "Equal"
value = "true"
effect = "NoSchedule"
}
container {
name = "back-end"
image = var.dotnet_remote_app_image
image_pull_policy = "Always"
port {
container_port = 8081
}
}
}
}
}
}

resource "kubernetes_service" "dotnet_r_app_service" {
depends_on = [ kubernetes_deployment.dotnet_r_app_deployment ]

metadata {
name = "dotnet-r-app-service"
namespace = var.test_namespace
}
spec {
type = "NodePort"
selector = {
app = "remote-app"
}
port {
protocol = "TCP"
port = 8081
target_port = 8081
node_port = 30101
}
}
}

resource "kubernetes_deployment" "traffic_generator" {
metadata {
name = "traffic-generator"
namespace = var.test_namespace
labels = {
app = "traffic-generator"
}
}
spec {
replicas = 1
selector {
match_labels = {
app = "traffic-generator"
}
}
template {
metadata {
labels = {
app = "traffic-generator"
}
}
spec {
container {
name = "traffic-generator"
image = "${var.account_id}.dkr.ecr.${var.aws_region}.amazonaws.com/e2e-test-resource:traffic-generator"
image_pull_policy = "Always"
env {
name = "ID"
value = var.test_id
}
}
}
}
}
}
Loading