diff --git a/.gitignore b/.gitignore index 59272dd..69f4d06 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,8 @@ credentials.auto.tfvars !**/.local/.gitkeep ansible.log + +.idea +data-*/ +*-amd64 +*-arm64 \ No newline at end of file diff --git a/go/map_cast/go.sum b/go/map_cast/go.sum new file mode 100644 index 0000000..e04d29f --- /dev/null +++ b/go/map_cast/go.sum @@ -0,0 +1,24 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/trivago/tgo v1.0.7 h1:uaWH/XIy9aWYWpjm2CU3RpcqZXmX2ysQ9/Go+d9gyrM= +github.com/trivago/tgo v1.0.7/go.mod h1:w4dpD+3tzNIIiIfkWWa85w5/B77tlvdZckQ+6PkFnhc= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/grafana-alloy/reload-issue/main.river b/grafana-alloy/reload-issue/main.river new file mode 100644 index 0000000..08b7c1f --- /dev/null +++ b/grafana-alloy/reload-issue/main.river @@ -0,0 +1,22 @@ +import.file "metadata" { + filename = "metadata.river" + detector = "poll" + poll_frequency = "86400s" +} + +metadata.config "this" {} + +import.file "module" { + filename = "module.river" + detector = "poll" + poll_frequency = "86400s" +} + +module.config "this" { + external_labels = { + direct = metadata.config.this.direct, + coalesce = metadata.config.this.coalesce, + nonsensitive = metadata.config.this.nonsensitive, + opsstack = metadata.config.this.opsstack, + } +} diff --git a/grafana-alloy/reload-issue/metadata.river b/grafana-alloy/reload-issue/metadata.river new file mode 100644 index 0000000..1503502 --- /dev/null +++ b/grafana-alloy/reload-issue/metadata.river @@ -0,0 +1,23 @@ +declare "config" { + remote.http "test" { + url = "http://localhost:8000/test.txt" + poll_frequency = "5s" + poll_timeout = "1s" + } + + export "direct" { + value = remote.http.test.content + } + + export "coalesce" { + value = coalesce(remote.http.test.content, "unset") + } + + export "nonsensitive" { + value = nonsensitive(remote.http.test.content) + } + + export "opsstack" { + value = coalesce(env("OPSSTACK_AGENT_ROLE"), to_lower(join(json_path(nonsensitive(remote.http.test.content), "$.tagsList[?(@.name=='cdt-opsstack-role')].value"), "")), "none") + } +} \ No newline at end of file diff --git a/grafana-alloy/reload-issue/module.river b/grafana-alloy/reload-issue/module.river new file mode 100644 index 0000000..3438b24 --- /dev/null +++ b/grafana-alloy/reload-issue/module.river @@ -0,0 +1,35 @@ +declare "config" { + + argument "external_labels" { + optional = true + default = {} + } + + prometheus.exporter.self "alloy" {} + + prometheus.scrape "alloy" { + targets = prometheus.exporter.self.alloy.targets + forward_to = [prometheus.relabel.alloy.receiver] + } + + prometheus.relabel "alloy" { + forward_to = [] + + rule { + target_label = "direct" + replacement = argument.external_labels.value.direct + } + rule { + target_label = "coalesce" + replacement = argument.external_labels.value.coalesce + } + rule { + target_label = "nonsensitive" + replacement = argument.external_labels.value.nonsensitive + } + rule { + target_label = "opsstack" + replacement = argument.external_labels.value.opsstack + } + } +} \ No newline at end of file diff --git a/grafana-alloy/reload-issue/test.txt b/grafana-alloy/reload-issue/test.txt new file mode 100644 index 0000000..56d42f9 --- /dev/null +++ b/grafana-alloy/reload-issue/test.txt @@ -0,0 +1 @@ +{"tagsList":[{"name":"cdt-opsstack-role","value":"3"}]} \ No newline at end of file diff --git a/helm-chart-examples/default/Chart.yaml b/helm-chart-examples/default/Chart.yaml new file mode 100644 index 0000000..51045b3 --- /dev/null +++ b/helm-chart-examples/default/Chart.yaml @@ -0,0 +1,3 @@ +apiVersion: v2 +name: printf +version: 1.0.0 diff --git a/helm-chart-examples/default/templates/values.yaml b/helm-chart-examples/default/templates/values.yaml new file mode 100644 index 0000000..7a4bbd4 --- /dev/null +++ b/helm-chart-examples/default/templates/values.yaml @@ -0,0 +1,3 @@ +--- +demo: | + {{ (get .Values.not "a" ).a | default "default" }} \ No newline at end of file diff --git a/helm-chart-examples/default/values.yaml b/helm-chart-examples/default/values.yaml new file mode 100644 index 0000000..1d69460 --- /dev/null +++ b/helm-chart-examples/default/values.yaml @@ -0,0 +1,11 @@ +a: + b: + c: + d: + e: Hello + +cert-manager: + serviceAccount: + annotations: + "azure.workload.identity/client-id": ABCD + diff --git a/test.txt b/test.txt new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/test.txt @@ -0,0 +1 @@ +2 diff --git a/win-linux/Dockerfile b/win-linux/Dockerfile new file mode 100644 index 0000000..a2c9a46 --- /dev/null +++ b/win-linux/Dockerfile @@ -0,0 +1,45 @@ +FROM debian:12 + +ARG DEBIAN_FRONTEND=noninteractive +ARG WINE_VERSION=9.6~bookworm-1 +ARG WINE_MONO_VERSION=9.0.0 +ARG DOTNET_VERSION=8.0.204 +ARG DOTNET_DOWNLOAD_URL=https://download.visualstudio.microsoft.com/download/pr/7ec1e77e-07d3-43b6-a688-847507046206/d83ec453d53a308d9f614de81b152594/dotnet-sdk-8.0.204-win-x86.exe + +ENV WINEPATH="C:\\users\\wix\\.dotnet\\tools" \ + WINEPREFIX="/home/wix/.wine" \ + WINEARCH=win32 \ + WINEDEBUG=-all \ + DOTNET_CLI_TELEMETRY_OPTOUT=1 \ + DOTNET_GENERATE_ASPNET_CERTIFICATE=false + +RUN set -ex \ + && dpkg --add-architecture i386 \ + && apt-get update -qq \ + && apt-get install --no-install-recommends ca-certificates curl xauth xvfb xz-utils -qqy \ + && curl -sSfLo /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key \ + && curl -sSfLo /etc/apt/sources.list.d/winehq-bookworm.sources https://dl.winehq.org/wine-builds/debian/dists/bookworm/winehq-bookworm.sources \ + && apt-get update -qq && apt-get install --no-install-recommends winehq-staging=${WINE_VERSION} -qqy \ + && useradd -m wix \ + && apt-get clean autoclean && apt-get autoremove --yes && rm -rf /var/lib/{apt,dpkg,cache,log}/ \ + && mkdir -p /opt/wine/mono/ && chown -R wix:wix /opt/wine/mono/ \ + \ + # https://github.com/dotnet/runtime/issues/98441 + && printf '#!/bin/sh\nexec script --return --quiet -c "wine dotnet $*" /dev/null' > /usr/local/bin/dotnet \ + && printf '#!/bin/sh\nexec wine wix.exe $@' > /usr/local/bin/wix.exe \ + && chmod +x /usr/local/bin/dotnet /usr/local/bin/wix.exe \ + && ln -sf /usr/local/bin/wix.exe /usr/local/bin/wix + +USER wix + + +RUN set -ex \ + && curl -sSfLo /tmp/wine-mono-${WINE_MONO_VERSION}-x86.tar.xz https://dl.winehq.org/wine/wine-mono/${WINE_MONO_VERSION}/wine-mono-${WINE_MONO_VERSION}-x86.tar.xz \ + && tar -xf /tmp/wine-mono-${WINE_MONO_VERSION}-x86.tar.xz -C /opt/wine/mono/ \ + && rm -f /tmp/wine-mono-${WINE_MONO_VERSION}-x86.tar.xz \ + && curl -sSfLo /tmp/dotnet-sdk-${DOTNET_VERSION}-win-x86.exe ${DOTNET_DOWNLOAD_URL} \ + && xvfb-run sh -c "wineboot --init && wine /tmp/dotnet-sdk-${DOTNET_VERSION}-win-x86.exe /q /norestart" \ + && rm -f /tmp/dotnet-sdk-${DOTNET_VERSION}-win-x86.exe \ + && dotnet tool install --global wix && wine wix.exe --version \ + && wix extension add -g WixToolset.Util.wixext \ + && wix extension add -g WixToolset.UI.wixext