Skip to content

Commit 226984b

Browse files
authored
[feat] windows golang update (#969)
[comment]: # (Note that your PR title should follow the conventional commit format: https://conventionalcommits.org/en/v1.0.0/#summary) # PR Description [comment]: # (The below checklist is for PRs adding new features. If a box is not checked, add a reason why it's not needed.) # New Feature Checklist - [ ] List telemetry added about the feature. - [ ] Link to the one-pager about the feature. - [ ] List any tasks necessary for release (3P docs, AKS RP chart changes, etc.) after merging the PR. - [ ] Attach results of scale and perf testing. [comment]: # (The below checklist is for code changes. Not all boxes necessarily need to be checked. Build, doc, and template changes do not need to fill out the checklist.) # Tests Checklist - [ ] Have end-to-end Ginkgo tests been run on your cluster and passed? To bootstrap your cluster to run the tests, follow [these instructions](/otelcollector/test/README.md#bootstrap-a-dev-cluster-to-run-ginkgo-tests). - Labels used when running the tests on your cluster: - [ ] `operator` - [ ] `windows` - [ ] `arm64` - [ ] `arc-extension` - [ ] `fips` - [ ] Have new tests been added? For features, have tests been added for this feature? For fixes, is there a test that could have caught this issue and could validate that the fix works? - [ ] Is a new scrape job needed? - [ ] The scrape job was added to the folder [test-cluster-yamls](/otelcollector/test/test-cluster-yamls/) in the correct configmap or as a CR. - [ ] Was a new test label added? - [ ] A string constant for the label was added to [constants.go](/otelcollector/test/utils/constants.go). - [ ] The label and description was added to the [test README](/otelcollector/test/README.md). - [ ] The label was added to this [PR checklist](/.github/pull_request_template). - [ ] The label was added as needed to [testkube-test-crs.yaml](/otelcollector/test/testkube/testkube-test-crs.yaml). - [ ] Are additional API server permissions needed for the new tests? - [ ] These permissions have been added to [api-server-permissions.yaml](/otelcollector/test/testkube/api-server-permissions.yaml). - [ ] Was a new test suite (a new folder under `/tests`) added? - [ ] The new test suite is included in [testkube-test-crs.yaml](/otelcollector/test/testkube/testkube-test-crs.yaml).
1 parent 75ad587 commit 226984b

33 files changed

+997
-3233
lines changed

.pipelines/azure-pipeline-build.yml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ trigger:
22
branches:
33
include:
44
- main
5+
56
pr:
67
autoCancel: true
78
branches:

AddonArmTemplate/FullAzureMonitorMetricsProfile.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -553,4 +553,4 @@
553553
}
554554
}
555555
]
556-
}
556+
}

internal/grafana_uami/action.ps1

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# ARMClient doc: https://github.com/projectkudu/ARMClient
2+
# ARMClient login
3+
4+
$grafanaResourceId="/subscriptions/{sub_id}/resourceGroups/{rg_name}/providers/Microsoft.Dashboard/grafana/{name}"
5+
$grafanaApiVersion="2023-10-01-preview"
6+
7+
armclient get "$($grafanaResourceId)?api-version=$($grafanaApiVersion)"
8+
9+
Write-Output "Add user-assigned managed identity to Grafana"
10+
armclient patch "$($grafanaResourceId)?api-version=$($grafanaApiVersion)" patch-add-umi.json -verbose
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"identity": {
3+
"type": "UserAssigned",
4+
"userAssignedIdentities": {
5+
"/subscriptions/{sub_id}/resourceGroups/{rg_name}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{name}": {}
6+
}
7+
}
8+
}
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
shared/process_utilities_windows.go
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
shared/process_utilities_linux.go

otelcollector/build/windows/Dockerfile

+5-34
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ ENV APPLICATIONINSIGHTS_AUTH_USNAT ZTliNjRmZmUtZDZlYi0xYjczLThjYWQtNDU2OTFjN2FhN
2323
ENV TELEMETRY_DISABLED false
2424

2525
COPY ./build/windows/scripts/setup.ps1 $tmpdir/scripts/
26-
COPY ./build/windows/scripts/main.ps1 $tmpdir/scripts/
2726
COPY ./build/windows/scripts/filesystemwatcher.ps1 $tmpdir/scripts/
28-
COPY ./build/windows/scripts/livenessprobe.cmd $tmpdir/microsoft/scripts/
29-
30-
COPY ./configmapparser/*.rb $tmpdir/microsoft/configmapparser/
27+
RUN mkdir "C:\\opt\\microsoft\\configmapparser"
28+
RUN mkdir "C:\\opt\\microsoft\\scripts"
3129
COPY ./configmapparser/default-prom-configs/*.yml $tmpdir/microsoft/otelcollector/default-prom-configs/
3230
COPY ./opentelemetry-collector-builder/otelcollector.exe ./opentelemetry-collector-builder/collector-config-default.yml ./opentelemetry-collector-builder/collector-config-template.yml $tmpdir/microsoft/otelcollector/
3331
COPY ./prom-config-validator-builder/promconfigvalidator.exe $tmpdir/
@@ -36,40 +34,13 @@ COPY ./telegraf/telegraf-prometheus-collector-windows.conf $tmpdir/telegraf/
3634
COPY ./fluent-bit/fluent-bit-windows.conf $tmpdir/fluent-bit/
3735
COPY ./fluent-bit/fluent-bit-parsers.conf $tmpdir/fluent-bit/
3836
COPY ./fluent-bit/src/out_appinsights.so $tmpdir/fluent-bit/bin/
37+
COPY ./main/main.exe $tmpdir/microsoft
3938
COPY ./react /Users/ContainerAdministrator/Documents/static/react
4039
COPY ./LICENSE $tmpdir/microsoft
4140
COPY ./NOTICE $tmpdir/microsoft
4241

43-
# Do not split this into multiple RUN!
44-
# Docker creates a layer for every RUN-Statement
45-
ENV chocolateyVersion "1.4.0"
46-
RUN powershell -Command "Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
47-
# Fluentd depends on cool.io whose fat gem is only available for Ruby < 2.5, so need to specify --platform ruby when install Ruby > 2.5 and install msys2 to get dev tools
48-
RUN choco install -y ruby --version 2.6.5.1 --params "'/InstallDir:C:\ruby26'" \
49-
&& choco install -y msys2 --version 20211130.0.0 --params "'/NoPath /NoUpdate /InstallDir:C:\ruby26\msys64'" \
50-
&& choco install -y vim
51-
52-
# gangams - optional MSYS2 update via ridk failing in merged docker file so skipping that since we dont need optional update
53-
RUN refreshenv \
54-
&& ridk install 3 \
55-
&& echo gem: --no-document >> C:\ProgramData\gemrc \
56-
&& gem install cool.io -v 1.5.4 --platform ruby \
57-
&& gem install oj -v 3.3.10 \
58-
&& gem install json -v 2.2.0 \
59-
&& gem install fluentd -v 1.12.2 \
60-
&& gem install win32-service -v 1.0.1 \
61-
&& gem install win32-ipc -v 0.7.0 \
62-
&& gem install win32-event -v 0.6.3 \
63-
&& gem install windows-pr -v 1.2.6 \
64-
&& gem install tomlrb -v 1.3.0 \
65-
&& gem install deep_merge -v 1.2.1\
66-
&& gem install colorize\
67-
&& gem sources --clear-all
68-
69-
# Remove gem cache and chocolatey
70-
RUN powershell -Command "Remove-Item -Force C:\ruby26\lib\ruby\gems\2.6.0\cache\*.gem; Remove-Item -Recurse -Force 'C:\ProgramData\chocolatey'"
71-
7242
SHELL ["powershell"]
7343
RUN ./opt/scripts/setup.ps1
7444

75-
ENTRYPOINT ["powershell", "C:\\opt\\scripts\\main.ps1"]
45+
# Run the Go executable, entrypoint
46+
ENTRYPOINT ["powershell", "C:\\opt\\microsoft\\main.exe"]

otelcollector/build/windows/scripts/main.ps1

-491
This file was deleted.

otelcollector/build/windows/scripts/setup.ps1

-9
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,6 @@ catch {
7272
}
7373
Write-Host ('Finished downloading Telegraf')
7474
############################################################################################
75-
#Remove gemfile.lock for http_parser gem 0.6.0
76-
#see - https://github.com/fluent/fluentd/issues/3374 https://github.com/tmm1/http_parser.rb/issues/70
77-
$gemfile = "\ruby26\lib\ruby\gems\2.6.0\gems\http_parser.rb-0.6.0\Gemfile.lock"
78-
$gemfileFullPath = $Env:SYSTEMDRIVE + "\" + $gemfile
79-
If (Test-Path -Path $gemfile ) {
80-
Write-Host ("Renaming unused gemfile.lock for http_parser 0.6.0")
81-
Rename-Item -Path $gemfileFullPath -NewName "renamed_Gemfile_lock.renamed"
82-
}
83-
############################################################################################
8475
Write-Host ('Installing GenevaMonitoringAgent');
8576
try {
8677
$genevamonitoringagentUri = 'https://github.com/Azure/prometheus-collector/releases/download/Promtheus-MA-Windows-4.1.2024/GenevaMonitoringAgent.46.15.4.zip'

otelcollector/configmapparser/ConfigParseErrorLogger.rb

-45
This file was deleted.

0 commit comments

Comments
 (0)