diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 7ae62ef1de..751ed9f0e0 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -79,6 +79,7 @@ jobs: with: ContainerRepositoryNameAndTag: "cwagent-integration-test:${{ github.sha }}" BucketKey: "integration-test/binary/${{ github.sha }}" + PackageBucketKey: "integration-test/packaging/${{ github.sha }}" BuildAndUploadITAR: uses: ./.github/workflows/test-build.yml diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 89455f5761..3716d9cdd0 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -41,3 +41,4 @@ jobs: with: ContainerRepositoryNameAndTag: "nightly-build:latest" BucketKey: "nightly-build/latest" + PackageBucketKey: "nightly-build/latest" diff --git a/.github/workflows/soak-test.yml b/.github/workflows/soak-test.yml index 0239941e52..abb9529cdc 100644 --- a/.github/workflows/soak-test.yml +++ b/.github/workflows/soak-test.yml @@ -58,6 +58,7 @@ jobs: with: ContainerRepositoryNameAndTag: "cwagent-integration-test:${{ github.sha }}" BucketKey: "integration-test/binary/${{ github.sha }}" + PackageBucketKey: "integration-test/packaging/${{ github.sha }}" DeploySoakTest: name: "DeploySoakTest" diff --git a/.github/workflows/test-build-docker.yml b/.github/workflows/test-build-docker.yml index ef5d71c8d9..abfeb60fec 100644 --- a/.github/workflows/test-build-docker.yml +++ b/.github/workflows/test-build-docker.yml @@ -22,6 +22,10 @@ on: description: "S3 URI to upload artifacts into." required: true type: string + PackageBucketKey: + description: "Integration tests put the MSI and PKG in a different bucket path than the binaries." + required: true + type: string workflow_call: inputs: ContainerRepositoryNameAndTag: @@ -38,6 +42,10 @@ on: description: "S3 URI to upload artifacts into." required: true type: string + PackageBucketKey: + description: "Integration tests put the MSI and PKG in a different bucket path than the binaries." + required: true + type: string jobs: MakeBinary: @@ -86,7 +94,26 @@ jobs: aws s3 cp s3://${{ secrets.S3_INTEGRATION_BUCKET }}/${{ inputs.BucketKey }}/linux/amd64/amazon-cloudwatch-agent.deb amd64/amazon-cloudwatch-agent.deb aws s3 cp s3://${{ secrets.S3_INTEGRATION_BUCKET }}/${{ inputs.BucketKey }}/linux/arm64/amazon-cloudwatch-agent.deb arm64/amazon-cloudwatch-agent.deb - - name: Build Cloudwatch Agent Image + - name: Get ECR Repo name + id: repo_name + env: + ContainerRepositoryNameAndTag: ${{ inputs.ContainerRepositoryNameAndTag }} + run: | + RepoName=`echo $ContainerRepositoryNameAndTag | awk -F: '{print $1}'` + echo "::set-output name=ContainerRepositoryName::$RepoName" + + - name: Build Cloudwatch Agent Image amd64 + uses: docker/build-push-action@v4 + if: contains(inputs.BucketKey, 'test') == false || steps.cached_container.outputs.cache-hit == false + with: + file: amazon-cloudwatch-container-insights/cloudwatch-agent-dockerfile/localdeb/Dockerfile + context: . + push: true + tags: | + ${{ steps.login-ecr.outputs.registry }}/${{ steps.repo_name.outputs.ContainerRepositoryName }}:linux-amd64 + platforms: linux/amd64 + + - name: Build Cloudwatch Agent Image arm64 uses: docker/build-push-action@v4 if: contains(inputs.BucketKey, 'test') == false || steps.cached_container.outputs.cache-hit == false with: @@ -94,5 +121,318 @@ jobs: context: . push: true tags: | - ${{ steps.login-ecr.outputs.registry }}/${{ inputs.ContainerRepositoryNameAndTag }} - platforms: linux/amd64, linux/arm64 \ No newline at end of file + ${{ steps.login-ecr.outputs.registry }}/${{ steps.repo_name.outputs.ContainerRepositoryName }}:linux-arm64 + platforms: linux/arm64 + + MakeMSIZip: + name: 'MakeMSIZip' + runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + steps: + - uses: actions/checkout@v3 + with: + repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} + + - name: Set up Go 1.x + uses: actions/setup-go@v4 + with: + go-version: ~1.21.1 + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ secrets.TERRAFORM_AWS_ASSUME_ROLE }} + aws-region: us-west-2 + + - name: Cache win zip + id: cached_win_zip + uses: actions/cache@v3 + with: + key: "cached_win_zip_${{ github.sha }}_${{ inputs.PackageBucketKey }}_${{ inputs.Bucket }}_${{ inputs.BucketKey }}" + path: go.mod + + - name: Copy binary + if: contains(inputs.BucketKey, 'test') == false || steps.cached_win_zip.outputs.cache-hit == false + run: | + aws s3 cp s3://${{ secrets.S3_INTEGRATION_BUCKET }}/${{ inputs.BucketKey }} . --recursive + - name: Unzip + if: contains(inputs.BucketKey, 'test') == false || steps.cached_win_zip.outputs.cache-hit == false + run: | + sudo apt install unzip + unzip windows/amd64/amazon-cloudwatch-agent.zip -d windows-agent + - name: Create msi dep folder and copy deps + if: contains(inputs.BucketKey, 'test') == false || steps.cached_win_zip.outputs.cache-hit == false + run: | + export version=$(cat CWAGENT_VERSION) + echo cw agent version $version + mkdir msi_dep + cp -r msi/tools/. msi_dep/ + cp -r windows-agent/amazon-cloudwatch-agent/. msi_dep/ + go run msi/tools/msiversion/msiversionconverter.go $version msi_dep/amazon-cloudwatch-agent.wxs '' + go run msi/tools/msiversion/msiversionconverter.go $version msi_dep/manifest.json __VERSION__ + + - name: Zip + if: contains(inputs.BucketKey, 'test') == false || steps.cached_win_zip.outputs.cache-hit == false + run: | + sudo apt install zip + zip buildMSI.zip msi_dep/* + + - name: Upload zip + if: contains(inputs.BucketKey, 'test') == false || steps.cached_win_zip.outputs.cache-hit == false + run: aws s3 cp buildMSI.zip s3://${{ secrets.S3_INTEGRATION_BUCKET }}/${{ inputs.BucketKey }}/buildMSI.zip + + BuildMSI-2022: + name: 'BuildMSI-2022' + runs-on: windows-latest + needs: [ MakeMSIZip ] + permissions: + id-token: write + contents: read + steps: + - uses: actions/checkout@v3 + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ secrets.TERRAFORM_AWS_ASSUME_ROLE }} + aws-region: us-west-2 + + - name: Cache msi + id: cached_msi + uses: actions/cache@v3 + with: + key: "cached_msi_${{ github.sha }}" + path: go.mod + + # Using the env variable returns "" for bucket name thus use the secret + - name: Copy msi + if: contains(inputs.BucketKey, 'test') == false || steps.cached_msi.outputs.cache-hit == false + run: aws s3 cp s3://${{ secrets.S3_INTEGRATION_BUCKET }}/${{ inputs.BucketKey }}/buildMSI.zip . + + - name: Create msi + if: contains(inputs.BucketKey, 'test') == false || steps.cached_msi.outputs.cache-hit == false + run: | + curl -OLS https://github.com/wixtoolset/wix3/releases/download/wix314rtm/wix314.exe + .\wix314.exe /install /quiet /norestart + $wixToolsetBinPath = ";C:\Program Files (x86)\WiX Toolset v3.14\bin;" + $env:PATH = $env:PATH + $wixToolsetBinPath + Expand-Archive buildMSI.zip -Force + cd buildMSI/msi_dep + .\create_msi.ps1 "nosha" ${{ secrets.S3_INTEGRATION_BUCKET }}/${{ inputs.PackageBucketKey }} + + - name: clean ecr login credential cache + if: contains(inputs.BucketKey, 'test') == false || steps.cached_msi.outputs.cache-hit == false + run : | + echo '{"auths": {"https://index.docker.io/v1/": {}}, "HttpHeaders": { "User-Agent": "Docker-Client/19.03.12 (windows)"}}' > ~/.docker/config.json + + - name: Login ECR + if: contains(inputs.BucketKey, 'test') == false || steps.cached_msi.outputs.cache-hit == false + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + # Build dir is ignored in our .dockerignore thus need to copy to another dir. + - name: Copy Binary For Agent Image Build + if: contains(inputs.BucketKey, 'test') == false || steps.cached_msi.outputs.cache-hit == false + run: | + pwd + mkdir amd64 + cp -r buildMSI/msi_dep/amazon-cloudwatch-agent.msi amd64/ + + - name: Get ECR Repo name + id: repo_name + env: + ContainerRepositoryNameAndTag: ${{ inputs.ContainerRepositoryNameAndTag }} + run: | + $splitArray = $env:ContainerRepositoryNameAndTag.Split(":")[0] + Write-Output "::set-output name=ContainerRepositoryName::$splitArray" + + - name: Build Windows Cloudwatch Agent Image + env: + REGISTRY: ${{ steps.login-ecr.outputs.registry }} + REPOSITORY: ${{ steps.repo_name.outputs.ContainerRepositoryName }}:2022 + if: contains(inputs.BucketKey, 'test') == false || steps.cached_msi.outputs.cache-hit == false + run: | + Write-Output "$env:REGISTRY/$env:REPOSITORY" + docker build --platform windows/amd64 -f ./amazon-cloudwatch-container-insights/cloudwatch-agent-dockerfile/localmsi/Dockerfile.Windows . -t $env:REGISTRY/$env:REPOSITORY + docker push $env:REGISTRY/$env:REPOSITORY + + BuildMSI-2019: + name: 'BuildMSI-2019' + runs-on: windows-2019 + needs: [MakeMSIZip] + permissions: + id-token: write + contents: read + steps: + - uses: actions/checkout@v3 + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ secrets.TERRAFORM_AWS_ASSUME_ROLE }} + aws-region: us-west-2 + + - name: Cache msi + id: cached_msi + uses: actions/cache@v3 + with: + key: "cached_msi_${{ github.sha }}" + path: go.mod + + # Using the env variable returns "" for bucket name thus use the secret + - name: Copy msi + if: contains(inputs.BucketKey, 'test') == false || steps.cached_msi.outputs.cache-hit == false + run: aws s3 cp s3://${{ secrets.S3_INTEGRATION_BUCKET }}/${{ inputs.BucketKey }}/buildMSI.zip . + + - name: Create msi + if: contains(inputs.BucketKey, 'test') == false || steps.cached_msi.outputs.cache-hit == false + run : | + curl -OLS https://github.com/wixtoolset/wix3/releases/download/wix314rtm/wix314.exe + .\wix314.exe /install /quiet /norestart + $wixToolsetBinPath = ";C:\Program Files (x86)\WiX Toolset v3.14\bin;" + $env:PATH = $env:PATH + $wixToolsetBinPath + Expand-Archive buildMSI.zip -Force + cd buildMSI/msi_dep + .\create_msi.ps1 "nosha" ${{ secrets.S3_INTEGRATION_BUCKET }}/${{ inputs.PackageBucketKey }} + + - name: clean ecr login credential cache + if: contains(inputs.BucketKey, 'test') == false || steps.cached_msi.outputs.cache-hit == false + run : | + echo '{"auths": {"https://index.docker.io/v1/": {}}, "HttpHeaders": { "User-Agent": "Docker-Client/19.03.12 (windows)"}}' > ~/.docker/config.json + + - name: Login ECR + if: contains(inputs.BucketKey, 'test') == false || steps.cached_msi.outputs.cache-hit == false + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + # Build dir is ignored in our .dockerignore thus need to copy to another dir. + - name: Copy Binary For Agent Image Build + if: contains(inputs.BucketKey, 'test') == false || steps.cached_msi.outputs.cache-hit == false + run: | + pwd + mkdir amd64 + cp -r buildMSI/msi_dep/amazon-cloudwatch-agent.msi amd64/ + + - name: Get ECR Repo name + id: repo_name + env: + ContainerRepositoryNameAndTag: ${{ inputs.ContainerRepositoryNameAndTag }} + run: | + $splitArray = $env:ContainerRepositoryNameAndTag.Split(":")[0] + Write-Output "::set-output name=ContainerRepositoryName::$splitArray" + + - name: Build Windows Cloudwatch Agent Image + env: + REGISTRY: ${{ steps.login-ecr.outputs.registry }} + REPOSITORY: ${{ steps.repo_name.outputs.ContainerRepositoryName }}:2019 + if: contains(inputs.BucketKey, 'test') == false || steps.cached_msi.outputs.cache-hit == false + run: | + Write-Output "$env:REGISTRY/$env:REPOSITORY" + docker build --platform windows/amd64 -f ./amazon-cloudwatch-container-insights/cloudwatch-agent-dockerfile/localmsi/Dockerfile.Windows --build-arg IMAGE_TAG=ltsc2019 . -t $env:REGISTRY/$env:REPOSITORY + docker push $env:REGISTRY/$env:REPOSITORY + + CreateContainerManifest: + name: 'CreateManifest' + needs: ['BuildMSI-2019', 'BuildMSI-2022', 'MakeBinary'] + runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Install rpm + run: sudo apt install rpm + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ secrets.TERRAFORM_AWS_ASSUME_ROLE }} + aws-region: us-west-2 + + - name: Login ECR + if: contains(inputs.BucketKey, 'test') == false || steps.cached_binaries.outputs.cache-hit == false + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Set up Docker Buildx + if: contains(inputs.BucketKey, 'test') == false || steps.cached_binaries.outputs.cache-hit == false + uses: docker/setup-buildx-action@v1 + + - name: Get ECR Repo name + id: repo_name + env: + ContainerRepositoryNameAndTag: ${{ inputs.ContainerRepositoryNameAndTag }} + run: | + RepoName=`echo $ContainerRepositoryNameAndTag | awk -F: '{print $1}'` + echo "::set-output name=ContainerRepositoryName::$RepoName" + + - name: Create manifest and push + env: + REGISTRY: ${{ steps.login-ecr.outputs.registry }} + OrigREPOSITORY: ${{ inputs.ContainerRepositoryNameAndTag }} + REPOSITORY: ${{ steps.repo_name.outputs.ContainerRepositoryName }} + REPOSITORYWindows: ${{ steps.repo_name.outputs.ContainerRepositoryName }}:windows + REPO2022: ${{ steps.repo_name.outputs.ContainerRepositoryName }}:2022 + REPO2019: ${{ steps.repo_name.outputs.ContainerRepositoryName }}:2019 + REPOLinuxAmd: ${{ steps.repo_name.outputs.ContainerRepositoryName }}:linux-amd64 + REPOLinuxArm: ${{ steps.repo_name.outputs.ContainerRepositoryName }}:linux-arm64 + if: contains(inputs.BucketKey, 'test') == false || steps.cached_binaries.outputs.cache-hit == false + run: | + docker manifest create $REGISTRY/$REPOSITORYWindows --amend $REGISTRY/$REPO2022 --amend $REGISTRY/$REPO2019 + docker manifest push $REGISTRY/$REPOSITORYWindows + + docker buildx imagetools inspect --raw $REGISTRY/$REPOLinuxAmd | jq '.manifests[0]' > linux-amd.json + docker buildx imagetools inspect --raw $REGISTRY/$REPOLinuxArm | jq '.manifests[0]' > linux-arm.json + docker buildx imagetools inspect --raw $REGISTRY/$REPOSITORYWindows | jq '.manifests[0]' > 2019.json + docker buildx imagetools inspect --raw $REGISTRY/$REPOSITORYWindows | jq '.manifests[1]' > 2022.json + + docker buildx imagetools create -f linux-amd.json -f linux-arm.json -f 2019.json -f 2022.json --tag $REGISTRY/$OrigREPOSITORY + + #GH actions set up gpg only works on ubuntu as of this commit date + GPGSignWindowsPackage: + name: 'GPGSignWindowsPackage' + runs-on: ubuntu-latest + needs: [ BuildMSI-2022 ] + permissions: + id-token: write + contents: read + steps: + - uses: actions/checkout@v3 + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ secrets.TERRAFORM_AWS_ASSUME_ROLE }} + aws-region: us-west-2 + + - name: Cache sig + id: cached_sig + uses: actions/cache@v3 + with: + key: "cached_sig_${{ github.sha }}" + path: go.mod + + - name: Download from s3 + if: contains(inputs.BucketKey, 'test') == false || steps.cached_sig.outputs.cache-hit == false + run: | + mkdir -p packages/amd64 + mkdir packages/arm64 + aws s3 cp s3://${{ secrets.S3_INTEGRATION_BUCKET }}/${{ inputs.PackageBucketKey }}/amazon-cloudwatch-agent.msi ./packages/amazon-cloudwatch-agent.msi + - name: Import GPG Key + uses: crazy-max/ghaction-import-gpg@v5 + with: + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.PASSPHRASE }} + + - name: Sign Build Files + run: for f in $(find packages/); do if [ ! -d $f ]; then echo "Signing file $f" && gpg --detach-sign $f ; fi ; done + + - name: Upload to s3 + if: contains(inputs.BucketKey, 'test') == false || steps.cached_sig.outputs.cache-hit == false + run: | + aws s3 cp packages/amazon-cloudwatch-agent.msi.sig s3://${{ secrets.S3_INTEGRATION_BUCKET }}/${{ inputs.PackageBucketKey }}/amazon-cloudwatch-agent.msi.sig diff --git a/.github/workflows/test-build-packages.yml b/.github/workflows/test-build-packages.yml index 9ffb19d33d..d42960bcd7 100644 --- a/.github/workflows/test-build-packages.yml +++ b/.github/workflows/test-build-packages.yml @@ -60,65 +60,6 @@ on: type: string jobs: - MakeMSIZip: - name: 'MakeMSIZip' - runs-on: ubuntu-latest - permissions: - id-token: write - contents: read - steps: - - uses: actions/checkout@v3 - with: - repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} - - - name: Set up Go 1.x - uses: actions/setup-go@v4 - with: - go-version: ~1.21.1 - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v2 - with: - role-to-assume: ${{ inputs.TerraformAWSAssumeRole }} - aws-region: ${{ inputs.Region }} - - - name: Cache win zip - id: cached_win_zip - uses: actions/cache@v3 - with: - key: "cached_win_zip_${{ github.sha }}_${{ inputs.PackageBucketKey }}_${{ inputs.Bucket }}_${{ inputs.BucketKey }}" - path: go.mod - - - name: Copy binary - if: contains(inputs.BucketKey, 'test') == false || steps.cached_win_zip.outputs.cache-hit == false - run: | - aws s3 cp s3://${{ inputs.Bucket }}/${{ inputs.BucketKey }} . --recursive - - name: Unzip - if: contains(inputs.BucketKey, 'test') == false || steps.cached_win_zip.outputs.cache-hit == false - run: | - sudo apt install unzip - unzip windows/amd64/amazon-cloudwatch-agent.zip -d windows-agent - - name: Create msi dep folder and copy deps - if: contains(inputs.BucketKey, 'test') == false || steps.cached_win_zip.outputs.cache-hit == false - run: | - export version=$(cat CWAGENT_VERSION) - echo cw agent version $version - mkdir msi_dep - cp -r msi/tools/. msi_dep/ - cp -r windows-agent/amazon-cloudwatch-agent/. msi_dep/ - go run msi/tools/msiversion/msiversionconverter.go $version msi_dep/amazon-cloudwatch-agent.wxs '' - go run msi/tools/msiversion/msiversionconverter.go $version msi_dep/manifest.json __VERSION__ - - - name: Zip - if: contains(inputs.BucketKey, 'test') == false || steps.cached_win_zip.outputs.cache-hit == false - run: | - sudo apt install zip - zip buildMSI.zip msi_dep/* - - - name: Upload zip - if: contains(inputs.BucketKey, 'test') == false || steps.cached_win_zip.outputs.cache-hit == false - run: aws s3 cp buildMSI.zip s3://${{ inputs.Bucket }}/${{ inputs.BucketKey }}/buildMSI.zip - MakeMacPkg: name: 'MakeMacPkg' runs-on: macos-11 @@ -194,50 +135,11 @@ jobs: cd arm64 ./create_pkg.sh ${{ inputs.Bucket }}/${{ inputs.PackageBucketKey }} "nosha" arm64 - BuildMSI: - name: 'BuildMSI' - runs-on: windows-latest - needs: [ MakeMSIZip ] - permissions: - id-token: write - contents: read - steps: - - uses: actions/checkout@v3 - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v2 - with: - role-to-assume: ${{ inputs.TerraformAWSAssumeRole }} - aws-region: ${{ inputs.Region }} - - - name: Cache msi - id: cached_msi - uses: actions/cache@v3 - with: - key: "cached_msi_${{ github.sha }}" - path: go.mod - - # Using the env variable returns "" for bucket name thus use the secret - - name: Copy msi - if: contains(inputs.BucketKey, 'test') == false || steps.cached_msi.outputs.cache-hit == false - run: aws s3 cp s3://${{ inputs.Bucket }}/${{ inputs.BucketKey }}/buildMSI.zip . - - - name: Create msi - if: contains(inputs.BucketKey, 'test') == false || steps.cached_msi.outputs.cache-hit == false - run: | - curl -OLS https://github.com/wixtoolset/wix3/releases/download/wix3111rtm/wix311.exe - .\wix311.exe /install /quiet /norestart - $wixToolsetBinPath = ";C:\Program Files (x86)\WiX Toolset v3.11\bin;" - $env:PATH = $env:PATH + $wixToolsetBinPath - Expand-Archive buildMSI.zip -Force - cd buildMSI/msi_dep - .\create_msi.ps1 "nosha" ${{ inputs.Bucket }}/${{ inputs.PackageBucketKey }} - #GH actions set up gpg only works on ubuntu as of this commit date - GPGSignMacAndWindowsPackage: - name: 'SignMacAndWindowsPackage' + GPGSignMacPackage: + name: 'GPGSignMacPackage' runs-on: ubuntu-latest - needs: [ BuildMSI, MakeMacPkg ] + needs: [ MakeMacPkg ] permissions: id-token: write contents: read @@ -262,7 +164,6 @@ jobs: run: | mkdir -p packages/amd64 mkdir packages/arm64 - aws s3 cp s3://${{ inputs.Bucket }}/${{ inputs.PackageBucketKey }}/amazon-cloudwatch-agent.msi ./packages/amazon-cloudwatch-agent.msi aws s3 cp s3://${{ inputs.Bucket }}/${{ inputs.PackageBucketKey }}/amd64/amazon-cloudwatch-agent.pkg ./packages/amd64/amazon-cloudwatch-agent.pkg aws s3 cp s3://${{ inputs.Bucket }}/${{ inputs.PackageBucketKey }}/arm64/amazon-cloudwatch-agent.pkg ./packages/arm64/amazon-cloudwatch-agent.pkg - name: Import GPG Key @@ -277,6 +178,5 @@ jobs: - name: Upload to s3 if: contains(inputs.BucketKey, 'test') == false || steps.cached_sig.outputs.cache-hit == false run: | - aws s3 cp packages/amazon-cloudwatch-agent.msi.sig s3://${{ inputs.Bucket }}/${{ inputs.PackageBucketKey }}/amazon-cloudwatch-agent.msi.sig aws s3 cp packages/amd64/amazon-cloudwatch-agent.pkg.sig s3://${{ inputs.Bucket }}/${{ inputs.PackageBucketKey }}/amd64/amazon-cloudwatch-agent.pkg.sig aws s3 cp packages/arm64/amazon-cloudwatch-agent.pkg.sig s3://${{ inputs.Bucket }}/${{ inputs.PackageBucketKey }}/arm64/amazon-cloudwatch-agent.pkg.sig diff --git a/Makefile b/Makefile index 88dbbaf30c..986a2de49b 100644 --- a/Makefile +++ b/Makefile @@ -30,6 +30,7 @@ IMAGE_REPO = cloudwatch-agent IMAGE_TAG = $(VERSION) IMAGE = $(IMAGE_REGISTRY)/$(IMAGE_REPO):$(IMAGE_TAG) DOCKER_BUILD_FROM_SOURCE = docker build -t $(IMAGE) -f ./amazon-cloudwatch-container-insights/cloudwatch-agent-dockerfile/source/Dockerfile +DOCKER_WINDOWS_BUILD_FROM_SOURCE = docker build -t $(IMAGE) -f ./amazon-cloudwatch-container-insights/cloudwatch-agent-dockerfile/source/Dockerfile.Windows CW_AGENT_IMPORT_PATH=github.com/aws/amazon-cloudwatch-agent ALL_SRC := $(shell find . -name '*.go' -type f | sort) @@ -109,6 +110,11 @@ build-for-docker-amd64: $(LINUX_AMD64_BUILD)/start-amazon-cloudwatch-agent github.com/aws/amazon-cloudwatch-agent/cmd/start-amazon-cloudwatch-agent $(LINUX_AMD64_BUILD)/config-translator github.com/aws/amazon-cloudwatch-agent/cmd/config-translator +build-for-docker-windows-amd64: + $(WIN_BUILD)/amazon-cloudwatch-agent.exe github.com/aws/amazon-cloudwatch-agent/cmd/amazon-cloudwatch-agent + $(WIN_BUILD)/start-amazon-cloudwatch-agent.exe github.com/aws/amazon-cloudwatch-agent/cmd/start-amazon-cloudwatch-agent + $(WIN_BUILD)/config-translator.exe github.com/aws/amazon-cloudwatch-agent/cmd/config-translator + build-for-docker-arm64: $(LINUX_ARM64_BUILD)/amazon-cloudwatch-agent github.com/aws/amazon-cloudwatch-agent/cmd/amazon-cloudwatch-agent $(LINUX_ARM64_BUILD)/start-amazon-cloudwatch-agent github.com/aws/amazon-cloudwatch-agent/cmd/start-amazon-cloudwatch-agent @@ -126,6 +132,13 @@ docker-build-arm64: build-for-docker-arm64 docker-push: docker push $(IMAGE) +build-for-docker-fast-windows-amd64: build-for-docker-windows-amd64 + rm -rf tmp + mkdir -p tmp/windows_amd64 + cp build/bin/windows_amd64/* tmp/windows_amd64 + docker build --platform windows/amd64 -f amazon-cloudwatch-container-insights/cloudwatch-agent-dockerfile/localbin/Dockerfile.Windows . -t amazon-cloudwatch-agent + rm -rf tmp + install-goimports: GOBIN=$(TOOLS_BIN_DIR) go install golang.org/x/tools/cmd/goimports @@ -315,3 +328,9 @@ dockerized-build: # Use vendor instead of proxy when building w/ vendor folder dockerized-build-vendor: $(DOCKER_BUILD_FROM_SOURCE) --build-arg GO111MODULE=off . + +.PHONY: dockerized-windows-build +dockerized-windows-build: + $(DOCKER_WINDOWS_BUILD_FROM_SOURCE) . + @echo Built image: + @echo $(IMAGE) \ No newline at end of file diff --git a/amazon-cloudwatch-container-insights/cloudwatch-agent-dockerfile/localbin/Dockerfile.Windows b/amazon-cloudwatch-container-insights/cloudwatch-agent-dockerfile/localbin/Dockerfile.Windows new file mode 100644 index 0000000000..2fcd11d577 --- /dev/null +++ b/amazon-cloudwatch-container-insights/cloudwatch-agent-dockerfile/localbin/Dockerfile.Windows @@ -0,0 +1,22 @@ +# This Dockerfile can be used for building Windows Server 2019, 2022 Container images. + +# Build Container image from binary in local +ARG TAG=ltsc2022 +ARG TARGETARCH=amd64 +ARG CONTAINER_CLOUDWATCHAGENT_PATH=C:\\Program\ Files\\Amazon\\AmazonCloudWatchAgent\\ +ARG CONTAINER_CLOUDWATCHAGENT_DATA_PATH=C:\\ProgramData\\Amazon\\AmazonCloudWatchAgent\\ + +FROM mcr.microsoft.com/windows/servercore:$TAG as runtime + +ARG CONTAINER_CLOUDWATCHAGENT_PATH +ARG CONTAINER_CLOUDWATCHAGENT_DATA_PATH +ARG TARGETARCH + +RUN Powershell -Command New-Item -ItemType Directory -Path $Env:CONTAINER_CLOUDWATCHAGENT_PATH -Force +RUN Powershell -Command New-Item -ItemType Directory -Path $Env:CONTAINER_CLOUDWATCHAGENT_DATA_PATH -Force +WORKDIR $CONTAINER_CLOUDWATCHAGENT_PATH + +COPY "./tmp/windows_${TARGETARCH}" $CONTAINER_CLOUDWATCHAGENT_PATH + +ENV RUN_IN_CONTAINER="True" +CMD ["start-amazon-cloudwatch-agent.exe"] \ No newline at end of file diff --git a/amazon-cloudwatch-container-insights/cloudwatch-agent-dockerfile/localmsi/Dockerfile.Windows b/amazon-cloudwatch-container-insights/cloudwatch-agent-dockerfile/localmsi/Dockerfile.Windows new file mode 100644 index 0000000000..be00aff3dc --- /dev/null +++ b/amazon-cloudwatch-container-insights/cloudwatch-agent-dockerfile/localmsi/Dockerfile.Windows @@ -0,0 +1,20 @@ +# This Dockerfile can be used for building Windows Server 2019, 2022 Container images. + +# Build Container image from msi installer +ARG IMAGE_TAG=ltsc2022 +ARG BUILD_IMAGE=mcr.microsoft.com/windows/servercore:$IMAGE_TAG +ARG TARGETARCH=amd64 +ARG CONTAINER_CLOUDWATCHAGENT_PATH=C:\\Program\ Files\\Amazon\\AmazonCloudWatchAgent\\ + +FROM $BUILD_IMAGE + +ARG TARGETARCH +ARG CONTAINER_CLOUDWATCHAGENT_PATH + +COPY ${TARGETARCH}/amazon-cloudwatch-agent.msi C:\\tmp\\amazon-cloudwatch-agent.msi +RUN msiexec /i C:\\tmp\\amazon-cloudwatch-agent.msi + +WORKDIR $CONTAINER_CLOUDWATCHAGENT_PATH + +ENV RUN_IN_CONTAINER="True" +CMD ["start-amazon-cloudwatch-agent.exe"] diff --git a/amazon-cloudwatch-container-insights/cloudwatch-agent-dockerfile/source/Dockerfile.Windows b/amazon-cloudwatch-container-insights/cloudwatch-agent-dockerfile/source/Dockerfile.Windows new file mode 100644 index 0000000000..507df88de4 --- /dev/null +++ b/amazon-cloudwatch-container-insights/cloudwatch-agent-dockerfile/source/Dockerfile.Windows @@ -0,0 +1,45 @@ +# This Dockerfile can be used for building Windows Server 2019, 2022 Container images. + +ARG TAG=ltsc2022 +ARG TARGETARCH=amd64 +ARG CONTAINER_CLOUDWATCHAGENT_PATH=C:\\Program\ Files\\Amazon\\AmazonCloudWatchAgent\\ +ARG GO_IMAGE=golang:latest + +# Build CW agent inside Windows golang container +FROM $GO_IMAGE as builder + +ARG TARGETARCH + +RUN New-Item -ItemType Directory -Path "C:\go\src\github.com\aws\amazon-cloudwatch-agent" -Force +WORKDIR "C:\go\src\github.com\aws\amazon-cloudwatch-agent" + +ENV GOPROXY=direct +ARG GO111MODULE="on" +ENV GO111MODULE=${GO111MODULE} + +COPY go.mod "C:\go\src\github.com\aws\amazon-cloudwatch-agent" +COPY go.sum "C:\go\src\github.com\aws\amazon-cloudwatch-agent" +RUN go mod download -x + +COPY . "C:\go\src\github.com\aws\amazon-cloudwatch-agent" + +# Install chocolatey and make +RUN Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) +RUN choco install make + +# Run make and build CW agent inside container +RUN make build-for-docker-windows-${env:TARGETARCH} + +# Build target CW agent container image for Windows +FROM mcr.microsoft.com/windows/servercore:$TAG + +ARG CONTAINER_CLOUDWATCHAGENT_PATH +ARG TARGETARCH + +RUN Powershell -Command New-Item -ItemType Directory -Path $env:CONTAINER_CLOUDWATCHAGENT_PATH -Force +WORKDIR $CONTAINER_CLOUDWATCHAGENT_PATH + +COPY --from=builder C:\\go\\src\\github.com\\aws\\amazon-cloudwatch-agent\\build\\bin\\windows_$TARGETARCH\\ $CONTAINER_CLOUDWATCHAGENT_PATH + +ENV RUN_IN_CONTAINER="True" +CMD ["start-amazon-cloudwatch-agent.exe"] \ No newline at end of file diff --git a/cfg/envconfig/envconfig.go b/cfg/envconfig/envconfig.go index 67e85a8021..a0cd44327c 100644 --- a/cfg/envconfig/envconfig.go +++ b/cfg/envconfig/envconfig.go @@ -5,29 +5,31 @@ package envconfig import ( "os" + "runtime" "strconv" "sync" ) const ( //the following are the names of environment variables - HTTP_PROXY = "HTTP_PROXY" - HTTPS_PROXY = "HTTPS_PROXY" - NO_PROXY = "NO_PROXY" - AWS_CA_BUNDLE = "AWS_CA_BUNDLE" - AWS_SDK_LOG_LEVEL = "AWS_SDK_LOG_LEVEL" - CWAGENT_USER_AGENT = "CWAGENT_USER_AGENT" - CWAGENT_LOG_LEVEL = "CWAGENT_LOG_LEVEL" - CWAGENT_USAGE_DATA = "CWAGENT_USAGE_DATA" - IMDS_NUMBER_RETRY = "IMDS_NUMBER_RETRY" - RunInContainer = "RUN_IN_CONTAINER" - RunInAWS = "RUN_IN_AWS" - RunWithIRSA = "RUN_WITH_IRSA" - UseDefaultConfig = "USE_DEFAULT_CONFIG" - HostName = "HOST_NAME" - PodName = "POD_NAME" - HostIP = "HOST_IP" - CWConfigContent = "CW_CONFIG_CONTENT" + HTTP_PROXY = "HTTP_PROXY" + HTTPS_PROXY = "HTTPS_PROXY" + NO_PROXY = "NO_PROXY" + AWS_CA_BUNDLE = "AWS_CA_BUNDLE" + AWS_SDK_LOG_LEVEL = "AWS_SDK_LOG_LEVEL" + CWAGENT_USER_AGENT = "CWAGENT_USER_AGENT" + CWAGENT_LOG_LEVEL = "CWAGENT_LOG_LEVEL" + CWAGENT_USAGE_DATA = "CWAGENT_USAGE_DATA" + IMDS_NUMBER_RETRY = "IMDS_NUMBER_RETRY" + RunInContainer = "RUN_IN_CONTAINER" + RunAsHostProcessContainer = "RUN_AS_HOST_PROCESS_CONTAINER" + RunInAWS = "RUN_IN_AWS" + RunWithIRSA = "RUN_WITH_IRSA" + UseDefaultConfig = "USE_DEFAULT_CONFIG" + HostName = "HOST_NAME" + PodName = "POD_NAME" + HostIP = "HOST_IP" + CWConfigContent = "CW_CONFIG_CONTENT" ) const ( @@ -57,3 +59,10 @@ func IsUsageDataEnabled() bool { func IsRunningInContainer() bool { return os.Getenv(RunInContainer) == TrueValue } + +func IsWindowsHostProcessContainer() bool { + if runtime.GOOS == "windows" && os.Getenv(RunInContainer) == TrueValue && os.Getenv(RunAsHostProcessContainer) == TrueValue { + return true + } + return false +} diff --git a/cmd/start-amazon-cloudwatch-agent/path_windows.go b/cmd/start-amazon-cloudwatch-agent/path_windows.go index 19c01a2ef7..8337a6f0ee 100644 --- a/cmd/start-amazon-cloudwatch-agent/path_windows.go +++ b/cmd/start-amazon-cloudwatch-agent/path_windows.go @@ -10,25 +10,44 @@ import ( "fmt" "io" "log" + "os" "os/exec" "github.com/aws/amazon-cloudwatch-agent/tool/paths" + "github.com/aws/amazon-cloudwatch-agent/translator/config" ) func startAgent(writer io.WriteCloser) error { - if err := writer.Close(); err != nil { - log.Printf("E! Cannot close the log file, ERROR is %v \n", err) + + if os.Getenv(config.RUN_IN_CONTAINER) != config.RUN_IN_CONTAINER_TRUE { + if err := writer.Close(); err != nil { + log.Printf("E! Cannot close the log file, ERROR is %v \n", err) + return err + } + cmd := exec.Command( + paths.AgentBinaryPath, + "-config", paths.TomlConfigPath, + "-envconfig", paths.EnvConfigPath, + "-otelconfig", paths.YamlConfigPath, + ) + stdoutStderr, err := cmd.CombinedOutput() + // log file is closed, so use fmt here + fmt.Printf("%s \n", stdoutStderr) + return err + } else { + cmd := exec.Command( + paths.AgentBinaryPath, + "-config", paths.TomlConfigPath, + "-envconfig", paths.EnvConfigPath, + "-otelconfig", paths.YamlConfigPath, + "-console", "true", + ) + cmd.Stdin = os.Stdin + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + err := cmd.Run() + fmt.Printf("%s \n", err) return err } - cmd := exec.Command( - paths.AgentBinaryPath, - "-config", paths.TomlConfigPath, - "-envconfig", paths.EnvConfigPath, - "-otelconfig", paths.YamlConfigPath, - ) - stdoutStderr, err := cmd.CombinedOutput() - // log file is closed, so use fmt here - fmt.Printf("%s \n", stdoutStderr) - return err } diff --git a/go.mod b/go.mod index 8beac47726..8b9a47ef42 100644 --- a/go.mod +++ b/go.mod @@ -7,38 +7,39 @@ replace github.com/influxdata/telegraf => github.com/aws/telegraf v0.10.2-0.2023 // Replace with https://github.com/amazon-contributing/opentelemetry-collector-contrib, there are no requirements for all receivers/processors/exporters // to be all replaced since there are some changes that will always be from upstream replace ( - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awscloudwatchlogsexporter => github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awscloudwatchlogsexporter v0.0.0-20240301221517-9cb314e7d27b - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsemfexporter => github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsemfexporter v0.0.0-20240301221517-9cb314e7d27b - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter => github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.0.0-20240301221517-9cb314e7d27b + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awscloudwatchlogsexporter => github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awscloudwatchlogsexporter v0.0.0-20240307151043-a7e0c68e9895 + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsemfexporter => github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsemfexporter v0.0.0-20240307151043-a7e0c68e9895 + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter => github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.0.0-20240307151043-a7e0c68e9895 ) -replace github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsproxy => github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsproxy v0.0.0-20240301221517-9cb314e7d27b +replace github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsproxy => github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsproxy v0.0.0-20240307151043-a7e0c68e9895 replace ( - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil v0.0.0-20240301221517-9cb314e7d27b - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/containerinsight v0.0.0-20240301221517-9cb314e7d27b - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/cwlogs => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/cwlogs v0.0.0-20240301221517-9cb314e7d27b - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/k8s => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/k8s v0.0.0-20240301221517-9cb314e7d27b - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/proxy => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/proxy v0.0.0-20240301221517-9cb314e7d27b - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray v0.0.0-20240301221517-9cb314e7d27b + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil v0.0.0-20240307151043-a7e0c68e9895 + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/containerinsight v0.0.0-20240307151043-a7e0c68e9895 + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/cwlogs => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/cwlogs v0.0.0-20240307151043-a7e0c68e9895 + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/k8s => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/k8s v0.0.0-20240307151043-a7e0c68e9895 + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/proxy => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/proxy v0.0.0-20240307151043-a7e0c68e9895 + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray v0.0.0-20240307151043-a7e0c68e9895 + github.com/open-telemetry/opentelemetry-collector-contrib/internal/kubelet => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/kubelet v0.0.0-20240307151043-a7e0c68e9895 ) replace ( - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza => github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/stanza v0.0.0-20240301221517-9cb314e7d27b + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza => github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/stanza v0.0.0-20240307151043-a7e0c68e9895 // Replace with contrib to revert upstream change https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/20519 - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus => github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/translator/prometheus v0.0.0-20240301221517-9cb314e7d27b + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus => github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/translator/prometheus v0.0.0-20240307151043-a7e0c68e9895 ) -replace github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor => github.com/amazon-contributing/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.0.0-20240301221517-9cb314e7d27b +replace github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor => github.com/amazon-contributing/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.0.0-20240307151043-a7e0c68e9895 replace ( - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver => github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.0.0-20240301221517-9cb314e7d27b - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsxrayreceiver => github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.0.0-20240301221517-9cb314e7d27b - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver => github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.0.0-20240301221517-9cb314e7d27b + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver => github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.0.0-20240307151043-a7e0c68e9895 + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsxrayreceiver => github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.0.0-20240307151043-a7e0c68e9895 + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver => github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.0.0-20240307151043-a7e0c68e9895 ) // Omit fields in HTTPClientSettings. Pending fix for https://github.com/open-telemetry/opentelemetry-collector/issues/8627 -replace go.opentelemetry.io/collector/config/confighttp => github.com/amazon-contributing/opentelemetry-collector-contrib/config/confighttp v0.0.0-20240301221517-9cb314e7d27b +replace go.opentelemetry.io/collector/config/confighttp => github.com/amazon-contributing/opentelemetry-collector-contrib/config/confighttp v0.0.0-20240307151043-a7e0c68e9895 // Temporary fix, pending PR https://github.com/shirou/gopsutil/pull/957 replace github.com/shirou/gopsutil/v3 => github.com/aws/telegraf/patches/gopsutil/v3 v3.0.0-20231109213610-a8c21c54a2be // indirect @@ -184,6 +185,7 @@ require ( github.com/Azure/go-autorest/tracing v0.6.0 // indirect github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.20.0 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/Microsoft/hcsshim v0.11.4 // indirect github.com/Showmax/go-fqdn v1.0.0 // indirect github.com/alecthomas/participle v0.4.1 // indirect github.com/alecthomas/participle/v2 v2.1.0 // indirect @@ -211,7 +213,9 @@ require ( github.com/checkpoint-restore/go-criu/v5 v5.3.0 // indirect github.com/cilium/ebpf v0.9.1 // indirect github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 // indirect + github.com/containerd/cgroups v1.1.0 // indirect github.com/containerd/console v1.0.3 // indirect + github.com/containerd/containerd v1.7.7 // indirect github.com/containerd/ttrpc v1.2.2 // indirect github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect @@ -421,6 +425,7 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect k8s.io/klog v1.0.0 // indirect k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect + k8s.io/kubelet v0.28.3 // indirect k8s.io/utils v0.0.0-20230711102312-30195339c3c7 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.3.0 // indirect diff --git a/go.sum b/go.sum index e104a0946c..ad1dec8e29 100644 --- a/go.sum +++ b/go.sum @@ -103,6 +103,8 @@ github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go github.com/Mellanox/rdmamap v0.0.0-20191106181932-7c3c4763a6ee h1:atI/FFjXh6hIVlPE1Jup9m8N4B9q/OSbMUe2EBahs+w= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8= +github.com/Microsoft/hcsshim v0.11.4/go.mod h1:smjE4dvqPX9Zldna+t5FG3rnoHhaB7QYxPRqGcpAD9w= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= @@ -134,44 +136,46 @@ github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk5 github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= github.com/aliyun/alibaba-cloud-sdk-go v1.61.1483 h1:J8HaD+Zpfi1gcel3HCKpoHHEsrcuRrZlSnx7R9SCf5I= -github.com/amazon-contributing/opentelemetry-collector-contrib/config/confighttp v0.0.0-20240301221517-9cb314e7d27b h1:JbyxYa3c8PQRpQZpEekKvWMTk2iSiT/M79WikF7vQQQ= -github.com/amazon-contributing/opentelemetry-collector-contrib/config/confighttp v0.0.0-20240301221517-9cb314e7d27b/go.mod h1:3sU3HgF5wc32CVljnzGo4Fn/9+T0N1Z6tCJyKdW2MvM= -github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awscloudwatchlogsexporter v0.0.0-20240301221517-9cb314e7d27b h1:ejIXrN48i5YDshcb+Kwy5IPgwfHvkUXMfdxzjbvVOMU= -github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awscloudwatchlogsexporter v0.0.0-20240301221517-9cb314e7d27b/go.mod h1:9L23Mib5WjvuWRMmLyZrH+OJyeDz0fEZ9e2ummzZlgU= -github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsemfexporter v0.0.0-20240301221517-9cb314e7d27b h1:82/jRNSmc+EzC63bGqfjFDSsQjPWU8OwxoJd9jpIJqI= -github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsemfexporter v0.0.0-20240301221517-9cb314e7d27b/go.mod h1:wTGyQcKa708Ci78kpp+YNr4budNC5QRQ2tiD7LXFRwY= -github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.0.0-20240301221517-9cb314e7d27b h1:Q8OMVsAYFNVBZaxDXj2ZudGWZLeqx8kddMlAGY3GWIw= -github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.0.0-20240301221517-9cb314e7d27b/go.mod h1:n5I9WMdSLqf1nngS88/Os8Ts2xF+jd0RxGVfEP46Xsk= +github.com/amazon-contributing/opentelemetry-collector-contrib/config/confighttp v0.0.0-20240307151043-a7e0c68e9895 h1:CBsPE92FzZk4+u6jffBCbMlELzSKHxsv0ifQAb7v/8U= +github.com/amazon-contributing/opentelemetry-collector-contrib/config/confighttp v0.0.0-20240307151043-a7e0c68e9895/go.mod h1:3sU3HgF5wc32CVljnzGo4Fn/9+T0N1Z6tCJyKdW2MvM= +github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awscloudwatchlogsexporter v0.0.0-20240307151043-a7e0c68e9895 h1:pBOwGUnkkqjh56jU2Qp7sXmvn7geqNt2+tsPeoKiSzE= +github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awscloudwatchlogsexporter v0.0.0-20240307151043-a7e0c68e9895/go.mod h1:9L23Mib5WjvuWRMmLyZrH+OJyeDz0fEZ9e2ummzZlgU= +github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsemfexporter v0.0.0-20240307151043-a7e0c68e9895 h1:JKbCBTbf0yjIGY/FMxsWd0VPOFsGhna2XGbXU7dHAds= +github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsemfexporter v0.0.0-20240307151043-a7e0c68e9895/go.mod h1:wTGyQcKa708Ci78kpp+YNr4budNC5QRQ2tiD7LXFRwY= +github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.0.0-20240307151043-a7e0c68e9895 h1:dt+bYS+rR9sXRrFot3uzfVeDTfZXy4FLGJwdc+k3YhE= +github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.0.0-20240307151043-a7e0c68e9895/go.mod h1:n5I9WMdSLqf1nngS88/Os8Ts2xF+jd0RxGVfEP46Xsk= github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsmiddleware v0.0.0-20240301221517-9cb314e7d27b h1:HC4A222OXGHCZBqeYgF3Gn7b4Slhbqdq9eb3xqmfiyE= github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsmiddleware v0.0.0-20240301221517-9cb314e7d27b/go.mod h1:5JOe6ISApVHBIsZuLb8ppaY06ujDcHCxYJE5wCymNoI= -github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsproxy v0.0.0-20240301221517-9cb314e7d27b h1:zVFqhr3y62aiZLtYQhUNekx9FOZjt9d5vXZm/zNq9Wc= -github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsproxy v0.0.0-20240301221517-9cb314e7d27b/go.mod h1:9EAh+a7cph0PYSAW5xTv9HGMdWopom2dFUJd1AgwMNc= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil v0.0.0-20240301221517-9cb314e7d27b h1:6Zpwt33dpmekzVpel7D/QazzIQE6I9FSN75e5FTkVYE= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil v0.0.0-20240301221517-9cb314e7d27b/go.mod h1:Mpe0DhouTXYDk/DyFDyQbjKpVxRTqahohQT5lidS2jY= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/containerinsight v0.0.0-20240301221517-9cb314e7d27b h1:FCzUDb9pW2vnoqoTeGjsx/kGP2qIpESCJfvR6OF+j+U= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/containerinsight v0.0.0-20240301221517-9cb314e7d27b/go.mod h1:Xg5sUWQEuVshBnsZB7wxGDLf5DfzAqnFZGVbMHvoaj8= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/cwlogs v0.0.0-20240301221517-9cb314e7d27b h1:xNzkwWOjoLUiEzeOEZx/mtpnEXLh08eAjPyCCO7NreU= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/cwlogs v0.0.0-20240301221517-9cb314e7d27b/go.mod h1:YNWxiYSLiIxOmw5hmA6jSnK8KVyru1JLX1OQeUCtCf8= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/k8s v0.0.0-20240301221517-9cb314e7d27b h1:l3uTt3PUxGpypKwU0YudxWILtybWpCoijoWW0c4FdhY= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/k8s v0.0.0-20240301221517-9cb314e7d27b/go.mod h1:RNHBmikDFzPQ8GbL/UtLxiJ7xqbK5RrFsfUSnIjJJlE= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/proxy v0.0.0-20240301221517-9cb314e7d27b h1:3N0egSY+PxUT/wPil7ccBH3eayLuZVuTTfLIAXJHElI= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/proxy v0.0.0-20240301221517-9cb314e7d27b/go.mod h1:UIrDCIdIOYvs4RAPPEz5p4nSKVw0aFLa5BrKo5ww0Is= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray v0.0.0-20240301221517-9cb314e7d27b h1:6yMzkipSRWcMpQzyrgdLUw6da8nKn5+4/75zpcP8ibg= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray v0.0.0-20240301221517-9cb314e7d27b/go.mod h1:D6lmFdWbpYRttNnfkZJSs2ZZcAUGfe96/Vrm8tiK3Tw= +github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsproxy v0.0.0-20240307151043-a7e0c68e9895 h1:jFSolrIFIRVIg7FwdakSiwF0tEavMftoGLOzGMp3f7g= +github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsproxy v0.0.0-20240307151043-a7e0c68e9895/go.mod h1:9EAh+a7cph0PYSAW5xTv9HGMdWopom2dFUJd1AgwMNc= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil v0.0.0-20240307151043-a7e0c68e9895 h1:tq+B0/AA3hnPphCyQQfCvNQslcLlyXX36ZnfA7Zc4T8= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil v0.0.0-20240307151043-a7e0c68e9895/go.mod h1:Mpe0DhouTXYDk/DyFDyQbjKpVxRTqahohQT5lidS2jY= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/containerinsight v0.0.0-20240307151043-a7e0c68e9895 h1:/lIztwfa5VfUlabRYtJdi1owjIMvWvOh9txG/DICW6k= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/containerinsight v0.0.0-20240307151043-a7e0c68e9895/go.mod h1:Xg5sUWQEuVshBnsZB7wxGDLf5DfzAqnFZGVbMHvoaj8= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/cwlogs v0.0.0-20240307151043-a7e0c68e9895 h1:S58dr07tn1N64/Bouy+Dnn0Xs9UO+UzBEDPmTQ3hYmk= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/cwlogs v0.0.0-20240307151043-a7e0c68e9895/go.mod h1:YNWxiYSLiIxOmw5hmA6jSnK8KVyru1JLX1OQeUCtCf8= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/k8s v0.0.0-20240307151043-a7e0c68e9895 h1:H/AcFg+Um8y8WXimLdp9W4ngo4k6UqXylalHD/DlP8M= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/k8s v0.0.0-20240307151043-a7e0c68e9895/go.mod h1:sozgSumYwFh3hQvqqzwBrMFJP6fDop1Coqh9iDJvRdU= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/proxy v0.0.0-20240307151043-a7e0c68e9895 h1:M9EhSRMmwdj2+jKsxqSAifmK8WG7H1KNJsntr/e4Yao= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/proxy v0.0.0-20240307151043-a7e0c68e9895/go.mod h1:UIrDCIdIOYvs4RAPPEz5p4nSKVw0aFLa5BrKo5ww0Is= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray v0.0.0-20240307151043-a7e0c68e9895 h1:w2PdwJJODCtveSCkIN8f/eyi2FSW1bdhrojl3EUEAAk= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray v0.0.0-20240307151043-a7e0c68e9895/go.mod h1:D6lmFdWbpYRttNnfkZJSs2ZZcAUGfe96/Vrm8tiK3Tw= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/kubelet v0.0.0-20240307151043-a7e0c68e9895 h1:huam+wCUedMSkAcSx7CK8lK/HgLTKocaJVajxbcvIYo= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/kubelet v0.0.0-20240307151043-a7e0c68e9895/go.mod h1:diyxQYYQtcsGG0zvLkWg4UTCb4hiXMb1usZS/vaC3Uw= github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20240301221517-9cb314e7d27b h1:96/K8X5jsdpzbJqTqbOuSR04zjlvrtUvxdxlxT4u9iM= github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20240301221517-9cb314e7d27b/go.mod h1:t/hYoRTnlPuRjh8y0BwVGgNvNIXpU2QJME5YVppUUHQ= -github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/stanza v0.0.0-20240301221517-9cb314e7d27b h1:Mlj7UkmzRGqoQAAfqN74BTtZzXans4a6X/Lveu76ydE= -github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/stanza v0.0.0-20240301221517-9cb314e7d27b/go.mod h1:7uCHpcHoawJsqoyPLxaFROWsZXPSF6/op3Hmw4pV4WE= -github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/translator/prometheus v0.0.0-20240301221517-9cb314e7d27b h1:yOA5poXBCcbcchcGRQYEL5pHUrwqJlZKz7Hs9J7mIP4= -github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/translator/prometheus v0.0.0-20240301221517-9cb314e7d27b/go.mod h1:HXv8nyJ+RUHGLZMPbaPFnWKonYWNTJfZ9ZUudqtwudw= -github.com/amazon-contributing/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.0.0-20240301221517-9cb314e7d27b h1:HSD0iQwUJuRO1iXMxxZQ80WZF3Re/Y+ctm11kujMpr8= -github.com/amazon-contributing/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.0.0-20240301221517-9cb314e7d27b/go.mod h1:L4/sIFbml9J28qd8i2aJGztmCg2FCCtfTdwikpu4JEs= -github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.0.0-20240301221517-9cb314e7d27b h1:BpHUBQvrBwqD/sl+4pus6Jk2q+vPQNk2Y9d4AAJGXd8= -github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.0.0-20240301221517-9cb314e7d27b/go.mod h1:Cs6HCNy7eQcEkyqAoX8HRqkRrExKA31Sc7DIOJKoGRQ= -github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.0.0-20240301221517-9cb314e7d27b h1:JFW+DadLtUQC1LiuFLn7EQpOkxsf7fTRmTJeGS1/lc4= -github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.0.0-20240301221517-9cb314e7d27b/go.mod h1:4IMYeZjU+IgZdXHuiLOIVtdp42lrMjk+rtlQpENeGSM= -github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.0.0-20240301221517-9cb314e7d27b h1:I3Rws21xhtovJPhB60wSLzmhaN7ASWvOyO2vIysc0U8= -github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.0.0-20240301221517-9cb314e7d27b/go.mod h1:fnNxw30DVmpiS3tt1nUETZH3g/boGnBLx7+hYwYd9EU= +github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/stanza v0.0.0-20240307151043-a7e0c68e9895 h1:ShbtYj3FM0zg9C4sNB34+2gFS8u9vpE5xrxOj/3xRVQ= +github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/stanza v0.0.0-20240307151043-a7e0c68e9895/go.mod h1:7uCHpcHoawJsqoyPLxaFROWsZXPSF6/op3Hmw4pV4WE= +github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/translator/prometheus v0.0.0-20240307151043-a7e0c68e9895 h1:BKPYgPw84l+JtFcKA+7pAPVbrdhpqd25t8rnzZ5uSDU= +github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/translator/prometheus v0.0.0-20240307151043-a7e0c68e9895/go.mod h1:HXv8nyJ+RUHGLZMPbaPFnWKonYWNTJfZ9ZUudqtwudw= +github.com/amazon-contributing/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.0.0-20240307151043-a7e0c68e9895 h1:ziYgKYh/PJj57fzvGni5yuL7fYfW3m8BorHOr8bg8aU= +github.com/amazon-contributing/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.0.0-20240307151043-a7e0c68e9895/go.mod h1:L4/sIFbml9J28qd8i2aJGztmCg2FCCtfTdwikpu4JEs= +github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.0.0-20240307151043-a7e0c68e9895 h1:BjOOvGmM58UOSvNY5lQXTR9+rr3WcpWWihrbv4YjyNo= +github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.0.0-20240307151043-a7e0c68e9895/go.mod h1:DcP/1ryOlCCS68y72PCTfCipvVvx7sWv0QYSc8sVbIg= +github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.0.0-20240307151043-a7e0c68e9895 h1:wbNMNtrLNJu/c0oY1XVe3bmC2EHqy1zXxznq5QfuOjM= +github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.0.0-20240307151043-a7e0c68e9895/go.mod h1:4IMYeZjU+IgZdXHuiLOIVtdp42lrMjk+rtlQpENeGSM= +github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.0.0-20240307151043-a7e0c68e9895 h1:Zam1wzMPDYcvREmzxv+IhCgxKT4usfj/IK2rRg8/TME= +github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.0.0-20240307151043-a7e0c68e9895/go.mod h1:fnNxw30DVmpiS3tt1nUETZH3g/boGnBLx7+hYwYd9EU= github.com/amir/raidman v0.0.0-20170415203553-1ccc43bfb9c9 h1:FXrPTd8Rdlc94dKccl7KPmdmIbVh/OjelJ8/vgMRzcQ= github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= github.com/antchfx/jsonquery v1.1.5 h1:1YWrNFYCcIuJPIjFeOP5b6TXbLSUYY8qqxWbuZOB1qE= @@ -293,8 +297,12 @@ github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnht github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k= github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= +github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= github.com/containerd/console v1.0.3 h1:lIr7SlA5PxZyMV30bDW0MGbiOPXwc63yRuCP0ARubLw= github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= +github.com/containerd/containerd v1.7.7 h1:QOC2K4A42RQpcrZyptP6z9EJZnlHfHJUfZrAAHe15q4= +github.com/containerd/containerd v1.7.7/go.mod h1:3c4XZv6VeT9qgf9GMTxNTMFxGJrGpI2vz1yk4ye+YY8= github.com/containerd/ttrpc v1.2.2 h1:9vqZr0pxwOF5koz6N0N3kJ0zDHokrcPxIR/ZR2YFtOs= github.com/containerd/ttrpc v1.2.2/go.mod h1:sIT6l32Ph/H9cvnJsfXM5drIVzTr5A2flTf1G5tYZak= github.com/containerd/typeurl v1.0.2 h1:Chlt8zIieDbzQFzXzAeBEF92KhExuE4p9p92/QmY7aY= @@ -922,8 +930,6 @@ github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.89. github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.89.0/go.mod h1:/fuCFCuI8B9ViltKiw2xZEKdTEcEZMbPAajRfJqF9mg= github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig v0.89.0 h1:LP0znKNQsJHqWVRKTzZcgnJEQv4730XBe1tzTFkVHQE= github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig v0.89.0/go.mod h1:1mxlOOYVp1/QGKM13X1m1ZUJa0GJ2Lvz/URC9d8FC1s= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/kubelet v0.89.0 h1:bWeWdtqT+GryeILIJ64eChhgkVoj4Ireczxr9C1hWKg= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/kubelet v0.89.0/go.mod h1:JszEiY5P2i7sL6LAsic+TM/C3FWHRL0wbazfVmIdPE0= github.com/open-telemetry/opentelemetry-collector-contrib/internal/metadataproviders v0.89.0 h1:NElphJJuMTt/LBFULiN4IuMWKwNWBxb+SgWBWE7V4BU= github.com/open-telemetry/opentelemetry-collector-contrib/internal/metadataproviders v0.89.0/go.mod h1:B13GrpB/gdZKCOk1e40uIDefGxZI7745nxhBZ28MwAw= github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden v0.89.0 h1:GAI5zG4W6wo20qVLvZjamskPYh7JEPEPMboElWxWzQE= @@ -1802,6 +1808,8 @@ k8s.io/klog/v2 v2.100.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7/go.mod h1:wXW5VT87nVfh/iLV8FpR2uDvrFyomxbtb1KivDbvPTE= k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 h1:LyMgNKD2P8Wn1iAwQU5OhxCKlKJy0sHc+PcDwFB24dQ= k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9/go.mod h1:wZK2AVp1uHCp4VamDVgBP2COHZjqD1T68Rf0CM3YjSM= +k8s.io/kubelet v0.28.3 h1:bp/uIf1R5F61BlFvFtzc4PDEiK7TtFcw3wFJlc0V0LM= +k8s.io/kubelet v0.28.3/go.mod h1:E3NHYbp/v45Ao6AD0EOZnqO3L0R6Haks6Nm0+bnFwtU= k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20230711102312-30195339c3c7 h1:ZgnF1KZsYxWIifwSNZFZgNtWE89WI5yiP5WwlfDoIyc= k8s.io/utils v0.0.0-20230711102312-30195339c3c7/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= diff --git a/tool/paths/paths.go b/tool/paths/paths.go index 26543934fb..dc612bdf39 100644 --- a/tool/paths/paths.go +++ b/tool/paths/paths.go @@ -10,8 +10,6 @@ const ( YAML = "amazon-cloudwatch-agent.yaml" ENV = "env-config.json" AGENT_LOG_FILE = "amazon-cloudwatch-agent.log" - //TODO this CONFIG_DIR_IN_CONTAINER should change to something indicate dir, keep it for now to avoid break testing - CONFIG_DIR_IN_CONTAINER = "/etc/cwagentconfig" ) var ( diff --git a/tool/paths/paths_unix.go b/tool/paths/paths_unix.go index c59c70232a..a99a39a4a9 100644 --- a/tool/paths/paths_unix.go +++ b/tool/paths/paths_unix.go @@ -16,6 +16,8 @@ const ( AgentBinaryName = "amazon-cloudwatch-agent" WizardBinaryName = "amazon-cloudwatch-agent-config-wizard" AgentStartName = "amazon-cloudwatch-agent-ctl" + //TODO this CONFIG_DIR_IN_CONTAINER should change to something indicate dir, keep it for now to avoid break testing + CONFIG_DIR_IN_CONTAINER = "/etc/cwagentconfig" ) func init() { diff --git a/tool/paths/paths_windows.go b/tool/paths/paths_windows.go index 69c51ac889..2d8eca162b 100644 --- a/tool/paths/paths_windows.go +++ b/tool/paths/paths_windows.go @@ -9,6 +9,8 @@ package paths import ( "os" "path/filepath" + + "github.com/aws/amazon-cloudwatch-agent/cfg/envconfig" ) const ( @@ -21,6 +23,8 @@ const ( AgentStartName = "amazon-cloudwatch-agent-ctl.ps1" ) +var CONFIG_DIR_IN_CONTAINER = filepath.Join(os.Getenv("ProgramFiles"), AgentDir, "cwagentconfig") + func init() { programFiles := os.Getenv("ProgramFiles") var programData string @@ -31,6 +35,12 @@ func init() { programData = filepath.Join(os.Getenv("ALLUSERSPROFILE"), "Application Data") } + if envconfig.IsWindowsHostProcessContainer() { + CONFIG_DIR_IN_CONTAINER = filepath.Join(os.Getenv("CONTAINER_SANDBOX_MOUNT_POINT"), "Program Files", AgentDir, "cwagentconfig", "cwagentconfig.json") + programFiles = filepath.Join(os.Getenv("CONTAINER_SANDBOX_MOUNT_POINT"), "Program Files") + programData = filepath.Join(os.Getenv("CONTAINER_SANDBOX_MOUNT_POINT"), "ProgramData") + } + AgentRootDir := filepath.Join(programFiles, AgentDir) AgentConfigDir := filepath.Join(programData, AgentDir) JsonConfigPath = filepath.Join(AgentConfigDir, JSON) diff --git a/translator/cmdutil/translatorutil.go b/translator/cmdutil/translatorutil.go index 70f54e4499..c2f7357287 100644 --- a/translator/cmdutil/translatorutil.go +++ b/translator/cmdutil/translatorutil.go @@ -13,6 +13,7 @@ import ( "github.com/xeipuuv/gojsonschema" "go.opentelemetry.io/collector/confmap" + "github.com/aws/amazon-cloudwatch-agent/cfg/envconfig" "github.com/aws/amazon-cloudwatch-agent/translator" "github.com/aws/amazon-cloudwatch-agent/translator/config" "github.com/aws/amazon-cloudwatch-agent/translator/context" @@ -129,21 +130,26 @@ func GenerateMergedJsonConfigMap(ctx *context.Context) (map[string]interface{}, fmt.Printf("Cannot access %v: %v \n", path, err) return err } - if info.Mode()&os.ModeSymlink != 0 { - log.Printf("Find symbolic link %s \n", path) - path, err := filepath.EvalSymlinks(path) - if err != nil { - log.Printf("Symbolic link %v will be ignored due to err: %v. \n", path, err) - return nil + if envconfig.IsWindowsHostProcessContainer() { + log.Printf("Skipping checking symbolic link for Windows host process containers %s. \n"+ + "These symbolic links are skipped as valuating symlinks is common failures for Windows containers", path) + } else { + if info.Mode()&os.ModeSymlink != 0 { + log.Printf("Find symbolic link %s \n", path) + path, err := filepath.EvalSymlinks(path) + if err != nil { + log.Printf("Symbolic link %v will be ignored due to err: %v. \n", path, err) + return nil + } + info, err = os.Stat(path) + if err != nil { + log.Printf("Path %v will be ignored due to err: %v. \n", path, err) + } } - info, err = os.Stat(path) - if err != nil { - log.Printf("Path %v will be ignored due to err: %v. \n", path, err) + if info.IsDir() { + return nil } } - if info.IsDir() { - return nil - } if filepath.Ext(path) == context.TmpFileSuffix { // .tmp files