diff --git a/.github/workflows/pr-all-checks-passed.yml b/.github/workflows/pr-all-checks-passed.yml index 7037fd02e..520ec24ed 100644 --- a/.github/workflows/pr-all-checks-passed.yml +++ b/.github/workflows/pr-all-checks-passed.yml @@ -15,6 +15,7 @@ on: workflows: ["PR Integration"] types: - completed + - requested jobs: all-checks: @@ -25,6 +26,6 @@ jobs: steps: - uses: wechuli/allcheckspassed@2e5e8bbc775f5680ed5d02e3a22e2fc7219792ac with: - delay: '5' + delay: '0' retries: '30' polling_interval: '1' diff --git a/.testcoverage.yml b/.testcoverage.yml index d9c63ab6b..a154dbb4c 100644 --- a/.testcoverage.yml +++ b/.testcoverage.yml @@ -45,7 +45,7 @@ override: path: ^internal/resourcelock$ - threshold: 84 path: ^internal/webhookcert$ - - threshold: 87 + - threshold: 85 path: ^webhook/logpipeline/v1alpha1$ - threshold: 84 path: ^webhook/logpipeline/v1beta1$ diff --git a/docs/user/integration/jaeger/README.md b/docs/user/integration/jaeger/README.md index ee55b8fd0..22ecb3870 100644 --- a/docs/user/integration/jaeger/README.md +++ b/docs/user/integration/jaeger/README.md @@ -154,7 +154,7 @@ Jaeger can be provided as a data source integrated into Grafana. For example, it ### Authentication By itself, Jaeger does not provide authentication mechanisms. To secure Jaeger, follow the instructions provided in the [Jaeger documentation -](https://www.jaegertracing.io/docs/latest/security/#browser-to-ui). +](https://www.jaegertracing.io/docs/2.0/faq/#how-do-i-configure-authentication-for-jaeger-ui). ### Expose Jaeger diff --git a/go.mod b/go.mod index 84b6fa21c..0f42a57dc 100644 --- a/go.mod +++ b/go.mod @@ -8,17 +8,17 @@ require ( github.com/google/go-cmp v0.6.0 github.com/google/uuid v1.6.0 github.com/onsi/ginkgo/v2 v2.22.0 - github.com/onsi/gomega v1.35.1 + github.com/onsi/gomega v1.36.0 github.com/prometheus/client_golang v1.20.5 github.com/prometheus/client_model v0.6.1 github.com/prometheus/common v0.60.1 - github.com/stretchr/testify v1.9.0 + github.com/stretchr/testify v1.10.0 go.opentelemetry.io/collector/pdata v1.20.0 go.uber.org/zap v1.27.0 google.golang.org/protobuf v1.35.2 gopkg.in/yaml.v3 v3.0.1 - istio.io/api v1.24.0 - istio.io/client-go v1.24.0 + istio.io/api v1.24.1 + istio.io/client-go v1.24.1 k8s.io/api v0.31.3 k8s.io/apiextensions-apiserver v0.31.3 k8s.io/apimachinery v0.31.3 diff --git a/go.sum b/go.sum index 891c4c418..8d840e55d 100644 --- a/go.sum +++ b/go.sum @@ -83,8 +83,8 @@ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/onsi/ginkgo/v2 v2.22.0 h1:Yed107/8DjTr0lKCNt7Dn8yQ6ybuDRQoMGrNFKzMfHg= github.com/onsi/ginkgo/v2 v2.22.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo= -github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4= -github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= +github.com/onsi/gomega v1.36.0 h1:Pb12RlruUtj4XUuPUqeEWc6j5DkVVVA49Uf6YLfC95Y= +github.com/onsi/gomega v1.36.0/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -111,8 +111,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -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/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -189,10 +189,10 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -istio.io/api v1.24.0 h1:KH1Xxha9HAFekQILzdHpRF9AB4RY13/Sdi3rmHQWoQI= -istio.io/api v1.24.0/go.mod h1:MQnRok7RZ20/PE56v0LxmoWH0xVxnCQPNuf9O7PAN1I= -istio.io/client-go v1.24.0 h1:30Qmx12lJCB5xeJuyodPSWh848b2PvgCubdPTazG1eU= -istio.io/client-go v1.24.0/go.mod h1:sCDBDJWQGJQz/1t3CHwUTDE5V7Nk6pFFkqBwhIg+LrI= +istio.io/api v1.24.1 h1:jF1I+ABGVS7ImVKzaAeiXHkFEbfXN2IEKDGJTw5UX0w= +istio.io/api v1.24.1/go.mod h1:MQnRok7RZ20/PE56v0LxmoWH0xVxnCQPNuf9O7PAN1I= +istio.io/client-go v1.24.1 h1:m1hYt+S7zZZpiWHVnJkp9SFfQ9EApBhKL0LUaviKh9c= +istio.io/client-go v1.24.1/go.mod h1:sCDBDJWQGJQz/1t3CHwUTDE5V7Nk6pFFkqBwhIg+LrI= k8s.io/api v0.31.3 h1:umzm5o8lFbdN/hIXbrK9oRpOproJO62CV1zqxXrLgk8= k8s.io/api v0.31.3/go.mod h1:UJrkIp9pnMOI9K2nlL6vwpxRzzEX5sWgn8kGQe92kCE= k8s.io/apiextensions-apiserver v0.31.3 h1:+GFGj2qFiU7rGCsA5o+p/rul1OQIq6oYpQw4+u+nciE= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 7f15fd669..e9db19c8e 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -4,9 +4,9 @@ go 1.23.1 require ( github.com/bombsimon/wsl/v4 v4.4.1 - github.com/golangci/golangci-lint v1.62.0 + github.com/golangci/golangci-lint v1.62.2 github.com/google/yamlfmt v0.14.0 - github.com/k3d-io/k3d/v5 v5.7.4 + github.com/k3d-io/k3d/v5 v5.7.5 github.com/kyma-project/kyma/hack/table-gen v0.0.0-20240626075036-d374ec55c335 github.com/mikefarah/yq/v4 v4.44.5 github.com/onsi/ginkgo/v2 v2.22.0 @@ -24,10 +24,10 @@ require ( github.com/Abirdcfly/dupword v0.1.3 // indirect github.com/Antonboom/errname v1.0.0 // indirect github.com/Antonboom/nilnil v1.0.0 // indirect - github.com/Antonboom/testifylint v1.5.0 // indirect + github.com/Antonboom/testifylint v1.5.2 // indirect github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c // indirect - github.com/Crocmagnon/fatcontext v0.5.2 // indirect + github.com/Crocmagnon/fatcontext v0.5.3 // indirect github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 // indirect github.com/Masterminds/semver/v3 v3.3.0 // indirect @@ -179,7 +179,7 @@ require ( github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect - github.com/mgechev/revive v1.5.0 // indirect + github.com/mgechev/revive v1.5.1 // indirect github.com/miekg/pkcs11 v1.1.1 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect @@ -199,14 +199,14 @@ require ( github.com/narqo/go-badge v0.0.0-20230821190521-c9a75c019a59 // indirect github.com/nishanths/exhaustive v0.12.0 // indirect github.com/nishanths/predeclared v0.2.2 // indirect - github.com/nunnatsa/ginkgolinter v0.18.0 // indirect + github.com/nunnatsa/ginkgolinter v0.18.3 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0 // indirect github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/polyfloyd/go-errorlint v1.6.0 // indirect + github.com/polyfloyd/go-errorlint v1.7.0 // indirect github.com/prometheus/client_golang v1.19.1 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.55.0 // indirect @@ -247,7 +247,7 @@ require ( github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect github.com/stretchr/objx v0.5.2 // indirect - github.com/stretchr/testify v1.9.0 // indirect + github.com/stretchr/testify v1.10.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/tdakkota/asciicheck v0.2.0 // indirect github.com/tetafro/godot v1.4.18 // indirect @@ -259,7 +259,7 @@ require ( github.com/ultraware/funlen v0.1.0 // indirect github.com/ultraware/whitespace v0.1.1 // indirect github.com/uudashr/gocognit v1.1.3 // indirect - github.com/uudashr/iface v1.2.0 // indirect + github.com/uudashr/iface v1.2.1 // indirect github.com/vbatts/tar-split v0.11.3 // indirect github.com/x448/float16 v0.8.4 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect @@ -290,7 +290,7 @@ require ( go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect golang.org/x/crypto v0.29.0 // indirect golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect - golang.org/x/exp/typeparams v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp/typeparams v0.0.0-20241108190413-2d47ceb2692f // indirect golang.org/x/image v0.18.0 // indirect golang.org/x/mod v0.22.0 // indirect golang.org/x/net v0.31.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index c82da63cf..de822bc79 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -12,16 +12,16 @@ github.com/Antonboom/errname v1.0.0 h1:oJOOWR07vS1kRusl6YRSlat7HFnb3mSfMl6sDMRoT github.com/Antonboom/errname v1.0.0/go.mod h1:gMOBFzK/vrTiXN9Oh+HFs+e6Ndl0eTFbtsRTSRdXyGI= github.com/Antonboom/nilnil v1.0.0 h1:n+v+B12dsE5tbAqRODXmEKfZv9j2KcTBrp+LkoM4HZk= github.com/Antonboom/nilnil v1.0.0/go.mod h1:fDJ1FSFoLN6yoG65ANb1WihItf6qt9PJVTn/s2IrcII= -github.com/Antonboom/testifylint v1.5.0 h1:dlUIsDMtCrZWUnvkaCz3quJCoIjaGi41GzjPBGkkJ8A= -github.com/Antonboom/testifylint v1.5.0/go.mod h1:wqaJbu0Blb5Wag2wv7Z5xt+CIV+eVLxtGZrlK13z3AE= +github.com/Antonboom/testifylint v1.5.2 h1:4s3Xhuv5AvdIgbd8wOOEeo0uZG7PbDKQyKY5lGoQazk= +github.com/Antonboom/testifylint v1.5.2/go.mod h1:vxy8VJ0bc6NavlYqjZfmp6EfqXMtBgQ4+mhCojwC1P8= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs= github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= -github.com/Crocmagnon/fatcontext v0.5.2 h1:vhSEg8Gqng8awhPju2w7MKHqMlg4/NI+gSDHtR3xgwA= -github.com/Crocmagnon/fatcontext v0.5.2/go.mod h1:87XhRMaInHP44Q7Tlc7jkgKKB7kZAOPiDkFMdKCC+74= +github.com/Crocmagnon/fatcontext v0.5.3 h1:zCh/wjc9oyeF+Gmp+V60wetm8ph2tlsxocgg/J0hOps= +github.com/Crocmagnon/fatcontext v0.5.3/go.mod h1:XoCQYY1J+XTfyv74qLXvNw4xFunr3L1wkopIIKG7wGM= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 h1:/fTUt5vmbkAcMBt4YQiuC23cV0kEsN1MVMNqeOW43cU= @@ -286,8 +286,8 @@ github.com/golangci/go-printf-func-name v0.1.0 h1:dVokQP+NMTO7jwO4bwsRwLWeudOVUP github.com/golangci/go-printf-func-name v0.1.0/go.mod h1:wqhWFH5mUdJQhweRnldEywnR5021wTdZSNgwYceV14s= github.com/golangci/gofmt v0.0.0-20240816233607-d8596aa466a9 h1:/1322Qns6BtQxUZDTAT4SdcoxknUki7IAoK4SAXr8ME= github.com/golangci/gofmt v0.0.0-20240816233607-d8596aa466a9/go.mod h1:Oesb/0uFAyWoaw1U1qS5zyjCg5NP9C9iwjnI4tIsXEE= -github.com/golangci/golangci-lint v1.62.0 h1:/G0g+bi1BhmGJqLdNQkKBWjcim8HjOPc4tsKuHDOhcI= -github.com/golangci/golangci-lint v1.62.0/go.mod h1:jtoOhQcKTz8B6dGNFyfQV3WZkQk+YvBDewDtNpiAJts= +github.com/golangci/golangci-lint v1.62.2 h1:b8K5K9PN+rZN1+mKLtsZHz2XXS9aYKzQ9i25x3Qnxxw= +github.com/golangci/golangci-lint v1.62.2/go.mod h1:ILWWyeFUrctpHVGMa1dg2xZPKoMUTc5OIMgW7HZr34g= github.com/golangci/misspell v0.6.0 h1:JCle2HUTNWirNlDIAUO44hUsKhOFqGPoC4LZxlaSXDs= github.com/golangci/misspell v0.6.0/go.mod h1:keMNyY6R9isGaSAu+4Q8NMBwMPkh15Gtc8UCVoDtAWo= github.com/golangci/modinfo v0.3.4 h1:oU5huX3fbxqQXdfspamej74DFX0kyGLkw1ppvXoJ8GA= @@ -399,8 +399,8 @@ github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8/go.mod h1:vgyd7OREkbtVE github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julz/importas v0.1.0 h1:F78HnrsjY3cR7j0etXy5+TU1Zuy7Xt08X/1aJnH5xXY= github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= -github.com/k3d-io/k3d/v5 v5.7.4 h1:L7Ix6zFMqjoPuEJ5dctLb7kCFXXlF5js6I7bm+tEgo0= -github.com/k3d-io/k3d/v5 v5.7.4/go.mod h1:bFlhRV/R1cPT42ZZzQAHPHUF33CbCT8VSbjtjTr3J1Y= +github.com/k3d-io/k3d/v5 v5.7.5 h1:rLzUV1XmCLfFkHZEU1YocnGGo2ccHAvCj79tC0yncdI= +github.com/k3d-io/k3d/v5 v5.7.5/go.mod h1:bFlhRV/R1cPT42ZZzQAHPHUF33CbCT8VSbjtjTr3J1Y= github.com/karamaru-alpha/copyloopvar v1.1.0 h1:x7gNyKcC2vRBO1H2Mks5u1VxQtYvFiym7fCjIP8RPos= github.com/karamaru-alpha/copyloopvar v1.1.0/go.mod h1:u7CIfztblY0jZLOQZgH3oYsJzpC2A7S6u/lfgSXHy0k= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -472,8 +472,8 @@ github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6T github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-sqlite3 v1.6.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mgechev/revive v1.5.0 h1:oaSmjA7rP8+HyoRuCgC531VHwnLH1AlJdjj+1AnQceQ= -github.com/mgechev/revive v1.5.0/go.mod h1:L6T3H8EoerRO86c7WuGpvohIUmiploGiyoYbtIWFmV8= +github.com/mgechev/revive v1.5.1 h1:hE+QPeq0/wIzJwOphdVyUJ82njdd8Khp4fUIHGZHW3M= +github.com/mgechev/revive v1.5.1/go.mod h1:lC9AhkJIBs5zwx8wkudyHrU+IJkrEKmpCmGMnIJPk4o= github.com/miekg/pkcs11 v1.0.2/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= github.com/miekg/pkcs11 v1.1.1 h1:Ugu9pdy6vAYku5DEpVWVFPYnzV+bxB+iRdbuFSu7TvU= github.com/miekg/pkcs11 v1.1.1/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= @@ -523,8 +523,8 @@ github.com/nishanths/exhaustive v0.12.0 h1:vIY9sALmw6T/yxiASewa4TQcFsVYZQQRUQJhK github.com/nishanths/exhaustive v0.12.0/go.mod h1:mEZ95wPIZW+x8kC4TgC+9YCUgiST7ecevsVDTgc2obs= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/nunnatsa/ginkgolinter v0.18.0 h1:ZXO1wKhPg3A6LpbN5dMuqwhfOjN5c3ous8YdKOuqk9k= -github.com/nunnatsa/ginkgolinter v0.18.0/go.mod h1:vPrWafSULmjMGCMsfGA908if95VnHQNAahvSBOjTuWs= +github.com/nunnatsa/ginkgolinter v0.18.3 h1:WgS7X3zzmni3vwHSBhvSgqrRgUecN6PQUcfB0j1noDw= +github.com/nunnatsa/ginkgolinter v0.18.3/go.mod h1:BE1xyB/PNtXXG1azrvrqJW5eFH0hSRylNzFy8QHPwzs= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= @@ -565,8 +565,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/polyfloyd/go-errorlint v1.6.0 h1:tftWV9DE7txiFzPpztTAwyoRLKNj9gpVm2cg8/OwcYY= -github.com/polyfloyd/go-errorlint v1.6.0/go.mod h1:HR7u8wuP1kb1NeN1zqTd1ZMlqUKPPHF+Id4vIPvDqVw= +github.com/polyfloyd/go-errorlint v1.7.0 h1:Zp6lzCK4hpBDj8y8a237YK4EPrMXQWvOe3nGoH4pFrU= +github.com/polyfloyd/go-errorlint v1.7.0/go.mod h1:dGWKu85mGHnegQ2SWpEybFityCg3j7ZbwsVUxAOk9gY= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= github.com/prometheus/client_golang v0.9.0-pre1.0.20180209125602-c332b6f63c06/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -698,8 +698,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -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/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/tdakkota/asciicheck v0.2.0 h1:o8jvnUANo0qXtnslk2d3nMKTFNlOnJjRrNcj0j9qkHM= @@ -727,8 +727,8 @@ github.com/ultraware/whitespace v0.1.1/go.mod h1:XcP1RLD81eV4BW8UhQlpaR+SDc2givT github.com/urfave/cli v1.22.12/go.mod h1:sSBEIC79qR6OvcmsD4U3KABeOTxDqQtdDnaFuUN30b8= github.com/uudashr/gocognit v1.1.3 h1:l+a111VcDbKfynh+airAy/DJQKaXh2m9vkoysMPSZyM= github.com/uudashr/gocognit v1.1.3/go.mod h1:aKH8/e8xbTRBwjbCkwZ8qt4l2EpKXl31KMHgSS+lZ2U= -github.com/uudashr/iface v1.2.0 h1:ECJjh5q/1Zmnv/2yFpWV6H3oMg5+Mo+vL0aqw9Gjazo= -github.com/uudashr/iface v1.2.0/go.mod h1:Ux/7d/rAF3owK4m53cTVXL4YoVHKNqnoOeQHn2xrlp0= +github.com/uudashr/iface v1.2.1 h1:vHHyzAUmWZ64Olq6NZT3vg/z1Ws56kyPdBOd5kTXDF8= +github.com/uudashr/iface v1.2.1/go.mod h1:4QvspiRd3JLPAEXBQ9AiZpLbJlrWWgRChOKDJEuQTdg= github.com/vbatts/tar-split v0.11.3 h1:hLFqsOLQ1SsppQNTMpkpPXClLDfC2A3Zgy9OUU+RVck= github.com/vbatts/tar-split v0.11.3/go.mod h1:9QlHN18E+fEH7RdG+QAJJcuya3rqT7eXSTY7wGrAokY= github.com/vektra/mockery/v2 v2.49.0 h1:KFJKqRa0zd4h+ntM+JFr9Z6fIz++CUgAAogPWnwTwJY= @@ -818,8 +818,8 @@ golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWB golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= -golang.org/x/exp/typeparams v0.0.0-20240909161429-701f63a606c0 h1:bVwtbF629Xlyxk6xLQq2TDYmqP0uiWaet5LwRebuY0k= -golang.org/x/exp/typeparams v0.0.0-20240909161429-701f63a606c0/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/exp/typeparams v0.0.0-20241108190413-2d47ceb2692f h1:WTyX8eCCyfdqiPYkRGm0MqElSfYFH3yR1+rl/mct9sA= +golang.org/x/exp/typeparams v0.0.0-20241108190413-2d47ceb2692f/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/image v0.18.0 h1:jGzIakQa/ZXI1I0Fxvaa9W7yP25TqT6cHIHn+6CqvSQ= golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= diff --git a/main.go b/main.go index 76fc0108d..83df59bfb 100644 --- a/main.go +++ b/main.go @@ -322,15 +322,8 @@ func run() error { return fmt.Errorf("failed to enable webhook server: %w", err) } - mgr.GetWebhookServer().Register("/validate-logpipeline", &webhook.Admission{ - Handler: logpipelinewebhookv1alpha1.NewValidatingWebhookHandler(mgr.GetClient(), scheme), - }) - mgr.GetWebhookServer().Register("/validate-logparser", &webhook.Admission{ - Handler: logparserwebhookv1alpha1.NewValidatingWebhookHandler(scheme), - }) - - if err := setupMutatingWebhooks(mgr); err != nil { - return fmt.Errorf("failed to setup mutating webhooks: %w", err) + if err := setupAdmissionsWebhooks(mgr); err != nil { + return fmt.Errorf("failed to setup admission webhooks: %w", err) } mgr.GetWebhookServer().Register("/api/v2/alerts", selfmonitorwebhook.NewHandler( @@ -347,37 +340,39 @@ func run() error { return nil } -func setupMutatingWebhooks(mgr manager.Manager) error { - if err := metricpipelinewebhookv1alpha1.SetupMetricPipelineWebhookWithManager(mgr); err != nil { +func setupAdmissionsWebhooks(mgr manager.Manager) error { + if err := metricpipelinewebhookv1alpha1.SetupWithManager(mgr); err != nil { return fmt.Errorf("failed to setup metric pipeline v1alpha1 webhook: %w", err) } if featureflags.IsEnabled(featureflags.V1Beta1) { - if err := metricpipelinewebhookv1beta1.SetupMetricPipelineWebhookWithManager(mgr); err != nil { + if err := metricpipelinewebhookv1beta1.SetupWithManager(mgr); err != nil { return fmt.Errorf("failed to setup metric pipeline v1beta1 webhook: %w", err) } } - if err := tracepipelinewebhookv1alpha1.SetupTracePipelineWebhookWithManager(mgr); err != nil { + if err := tracepipelinewebhookv1alpha1.SetupWithManager(mgr); err != nil { return fmt.Errorf("failed to setup trace pipeline v1alpha1 webhook: %w", err) } if featureflags.IsEnabled(featureflags.V1Beta1) { - if err := tracepipelinewebhookv1beta1.SetupTracePipelineWebhookWithManager(mgr); err != nil { + if err := tracepipelinewebhookv1beta1.SetupWithManager(mgr); err != nil { return fmt.Errorf("failed to setup trace pipeline v1beta1 webhook: %w", err) } } - if err := logpipelinewebhookv1alpha1.SetupLogPipelineWebhookWithManager(mgr); err != nil { + if err := logpipelinewebhookv1alpha1.SetupWithManager(mgr); err != nil { return fmt.Errorf("failed to setup log pipeline v1alpha1 webhook: %w", err) } if featureflags.IsEnabled(featureflags.V1Beta1) { - if err := logpipelinewebhookv1beta1.SetupLogPipelineWebhookWithManager(mgr); err != nil { + if err := logpipelinewebhookv1beta1.SetupWithManager(mgr); err != nil { return fmt.Errorf("failed to setup log pipeline v1beta1 webhook: %w", err) } } + logparserwebhookv1alpha1.SetupWithManager(mgr) + return nil } diff --git a/webhook/logparser/v1alpha1/setup.go b/webhook/logparser/v1alpha1/setup.go new file mode 100644 index 000000000..ed87d3adb --- /dev/null +++ b/webhook/logparser/v1alpha1/setup.go @@ -0,0 +1,12 @@ +package v1alpha1 + +import ( + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/webhook" +) + +func SetupWithManager(mgr ctrl.Manager) { + mgr.GetWebhookServer().Register("/validate-logparser", &webhook.Admission{ + Handler: newValidateHandler(mgr.GetScheme()), + }) +} diff --git a/webhook/logparser/v1alpha1/webhook.go b/webhook/logparser/v1alpha1/validate_handler.go similarity index 75% rename from webhook/logparser/v1alpha1/webhook.go rename to webhook/logparser/v1alpha1/validate_handler.go index 1854db6da..538231e69 100644 --- a/webhook/logparser/v1alpha1/webhook.go +++ b/webhook/logparser/v1alpha1/validate_handler.go @@ -11,17 +11,17 @@ import ( telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" ) -type ValidatingWebhookHandler struct { +type validateHandler struct { decoder admission.Decoder } -func NewValidatingWebhookHandler(scheme *runtime.Scheme) *ValidatingWebhookHandler { - return &ValidatingWebhookHandler{ +func newValidateHandler(scheme *runtime.Scheme) *validateHandler { + return &validateHandler{ decoder: admission.NewDecoder(scheme), } } -func (v *ValidatingWebhookHandler) Handle(ctx context.Context, req admission.Request) admission.Response { +func (v *validateHandler) Handle(ctx context.Context, req admission.Request) admission.Response { log := logf.FromContext(ctx) logParser := &telemetryv1alpha1.LogParser{} diff --git a/webhook/logpipeline/v1alpha1/defaulter.go b/webhook/logpipeline/v1alpha1/defaulter.go index 5723568b1..ef2e95520 100644 --- a/webhook/logpipeline/v1alpha1/defaulter.go +++ b/webhook/logpipeline/v1alpha1/defaulter.go @@ -5,30 +5,20 @@ import ( "fmt" "k8s.io/apimachinery/pkg/runtime" - ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/webhook" telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" ) // +kubebuilder:object:generate=false -var _ webhook.CustomDefaulter = &LogPipelineDefaulter{} +var _ webhook.CustomDefaulter = &defaulter{} -type LogPipelineDefaulter struct { +type defaulter struct { ApplicationInputEnabled bool ApplicationInputKeepOriginalBody bool } -func SetupLogPipelineWebhookWithManager(mgr ctrl.Manager) error { - return ctrl.NewWebhookManagedBy(mgr).For(&telemetryv1alpha1.LogPipeline{}). - WithDefaulter(&LogPipelineDefaulter{ - ApplicationInputEnabled: true, - ApplicationInputKeepOriginalBody: true, - }). - Complete() -} - -func (ld LogPipelineDefaulter) Default(ctx context.Context, obj runtime.Object) error { +func (ld defaulter) Default(ctx context.Context, obj runtime.Object) error { pipeline, ok := obj.(*telemetryv1alpha1.LogPipeline) if !ok { return fmt.Errorf("expected an LogPipeline object but got %T", obj) @@ -39,7 +29,7 @@ func (ld LogPipelineDefaulter) Default(ctx context.Context, obj runtime.Object) return nil } -func (ld LogPipelineDefaulter) applyDefaults(pipeline *telemetryv1alpha1.LogPipeline) { +func (ld defaulter) applyDefaults(pipeline *telemetryv1alpha1.LogPipeline) { if pipeline.Spec.Input.Application != nil { if pipeline.Spec.Input.Application.Enabled == nil { pipeline.Spec.Input.Application.Enabled = &ld.ApplicationInputEnabled diff --git a/webhook/logpipeline/v1alpha1/defaulter_test.go b/webhook/logpipeline/v1alpha1/defaulter_test.go index 6937c5857..3fe183adf 100644 --- a/webhook/logpipeline/v1alpha1/defaulter_test.go +++ b/webhook/logpipeline/v1alpha1/defaulter_test.go @@ -11,7 +11,7 @@ import ( ) func TestDefault(t *testing.T) { - defaulter := LogPipelineDefaulter{ + sut := defaulter{ ApplicationInputEnabled: true, ApplicationInputKeepOriginalBody: true, } @@ -67,7 +67,7 @@ func TestDefault(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - err := defaulter.Default(context.Background(), tt.input) + err := sut.Default(context.Background(), tt.input) assert.NoError(t, err) assert.Equal(t, tt.expected, tt.input) }) diff --git a/webhook/logpipeline/v1alpha1/files_validator_test.go b/webhook/logpipeline/v1alpha1/files_validator_test.go index 79b6331e8..f1f7e7f11 100644 --- a/webhook/logpipeline/v1alpha1/files_validator_test.go +++ b/webhook/logpipeline/v1alpha1/files_validator_test.go @@ -23,7 +23,7 @@ func TestDuplicateFileName(t *testing.T) { fakeClient := fake.NewClientBuilder().WithScheme(scheme).WithObjects(&existingPipeline).Build() - sut := NewValidatingWebhookHandler(fakeClient, scheme) + sut := newValidateHandler(fakeClient, scheme) newPipeline := testutils.NewLogPipelineBuilder().WithName("bar").WithFile("f1.json", "").Build() @@ -41,7 +41,7 @@ func TestDuplicateFileNameInSamePipeline(t *testing.T) { fakeClient := fake.NewClientBuilder().WithScheme(scheme).WithObjects().Build() - sut := NewValidatingWebhookHandler(fakeClient, scheme) + sut := newValidateHandler(fakeClient, scheme) newPipeline := testutils.NewLogPipelineBuilder().WithName("foo").WithFile("f1.json", "").WithFile("f1.json", "").Build() @@ -61,7 +61,7 @@ func TestValidateUpdatePipeline(t *testing.T) { fakeClient := fake.NewClientBuilder().WithScheme(scheme).WithObjects(&existingPipeline).Build() - sut := NewValidatingWebhookHandler(fakeClient, scheme) + sut := newValidateHandler(fakeClient, scheme) newPipeline := testutils.NewLogPipelineBuilder().WithName("foo").WithFile("f1.json", "").Build() diff --git a/webhook/logpipeline/v1alpha1/max_pipelines_validator_test.go b/webhook/logpipeline/v1alpha1/max_pipelines_validator_test.go index 74107f40e..bcbf6f07a 100644 --- a/webhook/logpipeline/v1alpha1/max_pipelines_validator_test.go +++ b/webhook/logpipeline/v1alpha1/max_pipelines_validator_test.go @@ -23,7 +23,7 @@ func TestValidateFirstPipeline(t *testing.T) { fakeClient := fake.NewClientBuilder().WithScheme(scheme).WithObjects().Build() - sut := NewValidatingWebhookHandler(fakeClient, scheme) + sut := newValidateHandler(fakeClient, scheme) newPipeline := testutils.NewLogPipelineBuilder().Build() @@ -46,7 +46,7 @@ func TestValidateLimitNotExceeded(t *testing.T) { fakeClient := fake.NewClientBuilder().WithScheme(scheme).WithObjects(existingPipelines...).Build() - sut := NewValidatingWebhookHandler(fakeClient, scheme) + sut := newValidateHandler(fakeClient, scheme) newPipeline := testutils.NewLogPipelineBuilder().Build() @@ -69,7 +69,7 @@ func TestValidateLimitExceeded(t *testing.T) { fakeClient := fake.NewClientBuilder().WithScheme(scheme).WithObjects(existingPipelines...).Build() - sut := NewValidatingWebhookHandler(fakeClient, scheme) + sut := newValidateHandler(fakeClient, scheme) newPipeline := testutils.NewLogPipelineBuilder().Build() @@ -89,7 +89,7 @@ func TestValidateUpdate(t *testing.T) { fakeClient := fake.NewClientBuilder().WithScheme(scheme).WithObjects(&existingPipeline).Build() - sut := NewValidatingWebhookHandler(fakeClient, scheme) + sut := newValidateHandler(fakeClient, scheme) response := sut.Handle(context.Background(), admissionRequestFrom(t, existingPipeline)) diff --git a/webhook/logpipeline/v1alpha1/setup.go b/webhook/logpipeline/v1alpha1/setup.go new file mode 100644 index 000000000..3c793a36d --- /dev/null +++ b/webhook/logpipeline/v1alpha1/setup.go @@ -0,0 +1,25 @@ +package v1alpha1 + +import ( + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/webhook" + + telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" +) + +func SetupWithManager(mgr ctrl.Manager) error { + if err := ctrl.NewWebhookManagedBy(mgr).For(&telemetryv1alpha1.LogPipeline{}). + WithDefaulter(&defaulter{ + ApplicationInputEnabled: true, + ApplicationInputKeepOriginalBody: true, + }). + Complete(); err != nil { + return err + } + + mgr.GetWebhookServer().Register("/validate-logpipeline", &webhook.Admission{ + Handler: newValidateHandler(mgr.GetClient(), mgr.GetScheme()), + }) + + return nil +} diff --git a/webhook/logpipeline/v1alpha1/spec_validator_test.go b/webhook/logpipeline/v1alpha1/spec_validator_test.go index eec8fa9de..51fbd03c7 100644 --- a/webhook/logpipeline/v1alpha1/spec_validator_test.go +++ b/webhook/logpipeline/v1alpha1/spec_validator_test.go @@ -181,7 +181,7 @@ func TestValidateLogPipelineSpec(t *testing.T) { fakeClient := fake.NewClientBuilder().WithScheme(scheme).WithObjects().Build() - sut := NewValidatingWebhookHandler(fakeClient, scheme) + sut := newValidateHandler(fakeClient, scheme) response := sut.Handle(context.Background(), admissionRequestFrom(t, *tt.logPipeline)) diff --git a/webhook/logpipeline/v1alpha1/handler.go b/webhook/logpipeline/v1alpha1/validate_handler.go similarity index 86% rename from webhook/logpipeline/v1alpha1/handler.go rename to webhook/logpipeline/v1alpha1/validate_handler.go index 8f3103241..839d82a56 100644 --- a/webhook/logpipeline/v1alpha1/handler.go +++ b/webhook/logpipeline/v1alpha1/validate_handler.go @@ -15,22 +15,22 @@ import ( logpipelineutils "github.com/kyma-project/telemetry-manager/internal/utils/logpipeline" ) -type ValidatingWebhookHandler struct { +type validateHandler struct { client client.Client decoder admission.Decoder } -func NewValidatingWebhookHandler( +func newValidateHandler( client client.Client, scheme *runtime.Scheme, -) *ValidatingWebhookHandler { - return &ValidatingWebhookHandler{ +) *validateHandler { + return &validateHandler{ client: client, decoder: admission.NewDecoder(scheme), } } -func (h *ValidatingWebhookHandler) Handle(ctx context.Context, req admission.Request) admission.Response { +func (h *validateHandler) Handle(ctx context.Context, req admission.Request) admission.Response { log := logf.FromContext(ctx) logPipeline := &telemetryv1alpha1.LogPipeline{} @@ -64,7 +64,7 @@ func (h *ValidatingWebhookHandler) Handle(ctx context.Context, req admission.Req return admission.Allowed("LogPipeline validation successful") } -func (h *ValidatingWebhookHandler) validateLogPipeline(ctx context.Context, logPipeline *telemetryv1alpha1.LogPipeline) error { +func (h *validateHandler) validateLogPipeline(ctx context.Context, logPipeline *telemetryv1alpha1.LogPipeline) error { log := logf.FromContext(ctx) var logPipelines telemetryv1alpha1.LogPipelineList diff --git a/webhook/logpipeline/v1alpha1/handler_test.go b/webhook/logpipeline/v1alpha1/validate_handler_test.go similarity index 97% rename from webhook/logpipeline/v1alpha1/handler_test.go rename to webhook/logpipeline/v1alpha1/validate_handler_test.go index 43e2addda..d16ac8c4c 100644 --- a/webhook/logpipeline/v1alpha1/handler_test.go +++ b/webhook/logpipeline/v1alpha1/validate_handler_test.go @@ -27,7 +27,7 @@ func TestHandle(t *testing.T) { logPipeline := testutils.NewLogPipelineBuilder().WithName("custom-output").WithCustomOutput("Name stdout").Build() fakeClient := fake.NewClientBuilder().WithScheme(scheme).WithObjects().Build() - sut := NewValidatingWebhookHandler(fakeClient, scheme) + sut := newValidateHandler(fakeClient, scheme) response := sut.Handle(context.Background(), admissionRequestFrom(t, logPipeline)) @@ -97,7 +97,7 @@ func TestHandle(t *testing.T) { fakeClient := fake.NewClientBuilder().WithScheme(scheme).WithObjects().Build() - sut := NewValidatingWebhookHandler(fakeClient, scheme) + sut := newValidateHandler(fakeClient, scheme) response := sut.Handle(context.Background(), admissionRequestFrom(t, logPipeline)) require.Equal(t, tt.allowed, response.Allowed) diff --git a/webhook/logpipeline/v1alpha1/variable_validator_test.go b/webhook/logpipeline/v1alpha1/variable_validator_test.go index 33d411245..02311bef6 100644 --- a/webhook/logpipeline/v1alpha1/variable_validator_test.go +++ b/webhook/logpipeline/v1alpha1/variable_validator_test.go @@ -27,7 +27,7 @@ func TestVariableNotGloballyUnique(t *testing.T) { fakeClient := fake.NewClientBuilder().WithScheme(scheme).WithObjects(&existingPipeline).Build() - sut := NewValidatingWebhookHandler(fakeClient, scheme) + sut := newValidateHandler(fakeClient, scheme) newPipeline := testutils.NewLogPipelineBuilder(). WithName("log-pipeline-2"). @@ -48,7 +48,7 @@ func TestVariableValidator(t *testing.T) { fakeClient := fake.NewClientBuilder().WithScheme(scheme).WithObjects().Build() - sut := NewValidatingWebhookHandler(fakeClient, scheme) + sut := newValidateHandler(fakeClient, scheme) newPipeline := testutils.NewLogPipelineBuilder(). WithName("log-pipeline-2"). diff --git a/webhook/logpipeline/v1beta1/defaulter.go b/webhook/logpipeline/v1beta1/defaulter.go index 58777f017..a590cb2dc 100644 --- a/webhook/logpipeline/v1beta1/defaulter.go +++ b/webhook/logpipeline/v1beta1/defaulter.go @@ -5,32 +5,21 @@ import ( "fmt" "k8s.io/apimachinery/pkg/runtime" - ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/webhook" telemetryv1beta1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1beta1" ) // +kubebuilder:object:generate=false -var _ webhook.CustomDefaulter = &LogPipelineDefaulter{} +var _ webhook.CustomDefaulter = &defaulter{} -type LogPipelineDefaulter struct { +type defaulter struct { RuntimeInputEnabled bool RuntimeInputKeepOriginalBody bool DefaultOTLPOutputProtocol telemetryv1beta1.OTLPProtocol } -func SetupLogPipelineWebhookWithManager(mgr ctrl.Manager) error { - return ctrl.NewWebhookManagedBy(mgr).For(&telemetryv1beta1.LogPipeline{}). - WithDefaulter(&LogPipelineDefaulter{ - RuntimeInputEnabled: true, - RuntimeInputKeepOriginalBody: true, - DefaultOTLPOutputProtocol: telemetryv1beta1.OTLPProtocolGRPC, - }). - Complete() -} - -func (ld LogPipelineDefaulter) Default(ctx context.Context, obj runtime.Object) error { +func (ld defaulter) Default(ctx context.Context, obj runtime.Object) error { pipeline, ok := obj.(*telemetryv1beta1.LogPipeline) if !ok { return fmt.Errorf("expected an LogPipeline object but got %T", obj) @@ -41,7 +30,7 @@ func (ld LogPipelineDefaulter) Default(ctx context.Context, obj runtime.Object) return nil } -func (ld LogPipelineDefaulter) applyDefaults(pipeline *telemetryv1beta1.LogPipeline) { +func (ld defaulter) applyDefaults(pipeline *telemetryv1beta1.LogPipeline) { if pipeline.Spec.Input.Runtime != nil { if pipeline.Spec.Input.Runtime.Enabled == nil { pipeline.Spec.Input.Runtime.Enabled = &ld.RuntimeInputEnabled diff --git a/webhook/logpipeline/v1beta1/defaulter_test.go b/webhook/logpipeline/v1beta1/defaulter_test.go index 785f0e95d..c458749e8 100644 --- a/webhook/logpipeline/v1beta1/defaulter_test.go +++ b/webhook/logpipeline/v1beta1/defaulter_test.go @@ -11,7 +11,7 @@ import ( ) func TestDefault(t *testing.T) { - defaulter := LogPipelineDefaulter{ + sut := defaulter{ RuntimeInputEnabled: true, RuntimeInputKeepOriginalBody: true, DefaultOTLPOutputProtocol: telemetryv1beta1.OTLPProtocolGRPC, @@ -87,7 +87,7 @@ func TestDefault(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - err := defaulter.Default(context.Background(), tt.input) + err := sut.Default(context.Background(), tt.input) assert.NoError(t, err) assert.Equal(t, tt.expected, tt.input) }) diff --git a/webhook/logpipeline/v1beta1/setup.go b/webhook/logpipeline/v1beta1/setup.go new file mode 100644 index 000000000..151188899 --- /dev/null +++ b/webhook/logpipeline/v1beta1/setup.go @@ -0,0 +1,17 @@ +package v1beta1 + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + telemetryv1beta1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1beta1" +) + +func SetupWithManager(mgr ctrl.Manager) error { + return ctrl.NewWebhookManagedBy(mgr).For(&telemetryv1beta1.LogPipeline{}). + WithDefaulter(&defaulter{ + RuntimeInputEnabled: true, + RuntimeInputKeepOriginalBody: true, + DefaultOTLPOutputProtocol: telemetryv1beta1.OTLPProtocolGRPC, + }). + Complete() +} diff --git a/webhook/metricpipeline/v1alpha1/defaulter.go b/webhook/metricpipeline/v1alpha1/defaulter.go index b52eb1ebe..3f36701ef 100644 --- a/webhook/metricpipeline/v1alpha1/defaulter.go +++ b/webhook/metricpipeline/v1alpha1/defaulter.go @@ -5,22 +5,21 @@ import ( "fmt" "k8s.io/apimachinery/pkg/runtime" - ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/webhook" telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" ) // +kubebuilder:object:generate=false -var _ webhook.CustomDefaulter = &MetricPipelineDefaulter{} +var _ webhook.CustomDefaulter = &defaulter{} -type MetricPipelineDefaulter struct { +type defaulter struct { ExcludeNamespaces []string - RuntimeInputResources RuntimeInputResourceDefaults + RuntimeInputResources runtimeInputResourceDefaults DefaultOTLPOutputProtocol string } -type RuntimeInputResourceDefaults struct { +type runtimeInputResourceDefaults struct { Pod bool Container bool Node bool @@ -31,26 +30,7 @@ type RuntimeInputResourceDefaults struct { Job bool } -func SetupMetricPipelineWebhookWithManager(mgr ctrl.Manager) error { - return ctrl.NewWebhookManagedBy(mgr).For(&telemetryv1alpha1.MetricPipeline{}). - WithDefaulter(&MetricPipelineDefaulter{ - ExcludeNamespaces: []string{"kyma-system", "kube-system", "istio-system", "compass-system"}, - RuntimeInputResources: RuntimeInputResourceDefaults{ - Pod: true, - Container: true, - Node: true, - Volume: true, - DaemonSet: true, - Deployment: true, - StatefulSet: true, - Job: true, - }, - DefaultOTLPOutputProtocol: telemetryv1alpha1.OTLPProtocolGRPC, - }). - Complete() -} - -func (md MetricPipelineDefaulter) Default(ctx context.Context, obj runtime.Object) error { +func (md defaulter) Default(ctx context.Context, obj runtime.Object) error { pipeline, ok := obj.(*telemetryv1alpha1.MetricPipeline) if !ok { return fmt.Errorf("expected an MetricPipeline object but got %T", obj) @@ -61,7 +41,7 @@ func (md MetricPipelineDefaulter) Default(ctx context.Context, obj runtime.Objec return nil } -func (md MetricPipelineDefaulter) applyDefaults(pipeline *telemetryv1alpha1.MetricPipeline) { +func (md defaulter) applyDefaults(pipeline *telemetryv1alpha1.MetricPipeline) { if pipeline.Spec.Input.Prometheus != nil && pipeline.Spec.Input.Prometheus.Namespaces == nil { pipeline.Spec.Input.Prometheus.Namespaces = &telemetryv1alpha1.NamespaceSelector{ Exclude: md.ExcludeNamespaces, @@ -89,7 +69,7 @@ func (md MetricPipelineDefaulter) applyDefaults(pipeline *telemetryv1alpha1.Metr } } -func (md MetricPipelineDefaulter) applyRuntimeInputResourceDefaults(pipeline *telemetryv1alpha1.MetricPipeline) { +func (md defaulter) applyRuntimeInputResourceDefaults(pipeline *telemetryv1alpha1.MetricPipeline) { if pipeline.Spec.Input.Runtime.Resources == nil { pipeline.Spec.Input.Runtime.Resources = &telemetryv1alpha1.MetricPipelineRuntimeInputResources{} } diff --git a/webhook/metricpipeline/v1alpha1/defaulter_test.go b/webhook/metricpipeline/v1alpha1/defaulter_test.go index 1e50b608b..b4e443bb9 100644 --- a/webhook/metricpipeline/v1alpha1/defaulter_test.go +++ b/webhook/metricpipeline/v1alpha1/defaulter_test.go @@ -11,9 +11,9 @@ import ( ) func TestDefault(t *testing.T) { - defaulter := MetricPipelineDefaulter{ + sut := defaulter{ ExcludeNamespaces: []string{"kyma-system", "kube-system", "istio-system", "compass-system"}, - RuntimeInputResources: RuntimeInputResourceDefaults{ + RuntimeInputResources: runtimeInputResourceDefaults{ Pod: true, Container: true, Node: true, @@ -233,7 +233,7 @@ func TestDefault(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - err := defaulter.Default(context.Background(), tt.input) + err := sut.Default(context.Background(), tt.input) assert.NoError(t, err) assert.Equal(t, tt.expected, tt.input) }) diff --git a/webhook/metricpipeline/v1alpha1/setup.go b/webhook/metricpipeline/v1alpha1/setup.go new file mode 100644 index 000000000..c19091d12 --- /dev/null +++ b/webhook/metricpipeline/v1alpha1/setup.go @@ -0,0 +1,26 @@ +package v1alpha1 + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" +) + +func SetupWithManager(mgr ctrl.Manager) error { + return ctrl.NewWebhookManagedBy(mgr).For(&telemetryv1alpha1.MetricPipeline{}). + WithDefaulter(&defaulter{ + ExcludeNamespaces: []string{"kyma-system", "kube-system", "istio-system", "compass-system"}, + RuntimeInputResources: runtimeInputResourceDefaults{ + Pod: true, + Container: true, + Node: true, + Volume: true, + DaemonSet: true, + Deployment: true, + StatefulSet: true, + Job: true, + }, + DefaultOTLPOutputProtocol: telemetryv1alpha1.OTLPProtocolGRPC, + }). + Complete() +} diff --git a/webhook/metricpipeline/v1beta1/defaulter.go b/webhook/metricpipeline/v1beta1/defaulter.go index 1a5e456bd..20235195c 100644 --- a/webhook/metricpipeline/v1beta1/defaulter.go +++ b/webhook/metricpipeline/v1beta1/defaulter.go @@ -5,22 +5,21 @@ import ( "fmt" "k8s.io/apimachinery/pkg/runtime" - ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/webhook" telemetryv1beta1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1beta1" ) // +kubebuilder:object:generate=false -var _ webhook.CustomDefaulter = &MetricPipelineDefaulter{} +var _ webhook.CustomDefaulter = &defaulter{} -type MetricPipelineDefaulter struct { +type defaulter struct { ExcludeNamespaces []string - RuntimeInputResources RuntimeInputResourceDefaults + RuntimeInputResources runtimeInputResourceDefaults DefaultOTLPOutputProtocol telemetryv1beta1.OTLPProtocol } -type RuntimeInputResourceDefaults struct { +type runtimeInputResourceDefaults struct { Pod bool Container bool Node bool @@ -31,26 +30,7 @@ type RuntimeInputResourceDefaults struct { Job bool } -func SetupMetricPipelineWebhookWithManager(mgr ctrl.Manager) error { - return ctrl.NewWebhookManagedBy(mgr).For(&telemetryv1beta1.MetricPipeline{}). - WithDefaulter(&MetricPipelineDefaulter{ - ExcludeNamespaces: []string{"kyma-system", "kube-system", "istio-system", "compass-system"}, - RuntimeInputResources: RuntimeInputResourceDefaults{ - Pod: true, - Container: true, - Node: true, - Volume: true, - DaemonSet: true, - Deployment: true, - StatefulSet: true, - Job: true, - }, - DefaultOTLPOutputProtocol: telemetryv1beta1.OTLPProtocolGRPC, - }). - Complete() -} - -func (md MetricPipelineDefaulter) Default(ctx context.Context, obj runtime.Object) error { +func (md defaulter) Default(ctx context.Context, obj runtime.Object) error { pipeline, ok := obj.(*telemetryv1beta1.MetricPipeline) if !ok { return fmt.Errorf("expected an MetricPipeline object but got %T", obj) @@ -61,7 +41,7 @@ func (md MetricPipelineDefaulter) Default(ctx context.Context, obj runtime.Objec return nil } -func (md MetricPipelineDefaulter) applyDefaults(pipeline *telemetryv1beta1.MetricPipeline) { +func (md defaulter) applyDefaults(pipeline *telemetryv1beta1.MetricPipeline) { if pipeline.Spec.Input.Prometheus != nil && pipeline.Spec.Input.Prometheus.Namespaces == nil { pipeline.Spec.Input.Prometheus.Namespaces = &telemetryv1beta1.NamespaceSelector{ Exclude: md.ExcludeNamespaces, @@ -89,7 +69,7 @@ func (md MetricPipelineDefaulter) applyDefaults(pipeline *telemetryv1beta1.Metri } } -func (md MetricPipelineDefaulter) applyRuntimeInputResourceDefaults(pipeline *telemetryv1beta1.MetricPipeline) { +func (md defaulter) applyRuntimeInputResourceDefaults(pipeline *telemetryv1beta1.MetricPipeline) { if pipeline.Spec.Input.Runtime.Resources == nil { pipeline.Spec.Input.Runtime.Resources = &telemetryv1beta1.MetricPipelineRuntimeInputResources{} } diff --git a/webhook/metricpipeline/v1beta1/defaulter_test.go b/webhook/metricpipeline/v1beta1/defaulter_test.go index 668e5980c..237011805 100644 --- a/webhook/metricpipeline/v1beta1/defaulter_test.go +++ b/webhook/metricpipeline/v1beta1/defaulter_test.go @@ -11,9 +11,9 @@ import ( ) func TestDefault(t *testing.T) { - defaulter := MetricPipelineDefaulter{ + sut := defaulter{ ExcludeNamespaces: []string{"kyma-system", "kube-system", "istio-system", "compass-system"}, - RuntimeInputResources: RuntimeInputResourceDefaults{ + RuntimeInputResources: runtimeInputResourceDefaults{ Pod: true, Container: true, Node: true, @@ -233,7 +233,7 @@ func TestDefault(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - err := defaulter.Default(context.Background(), tt.input) + err := sut.Default(context.Background(), tt.input) assert.NoError(t, err) assert.Equal(t, tt.expected, tt.input) }) diff --git a/webhook/metricpipeline/v1beta1/setup.go b/webhook/metricpipeline/v1beta1/setup.go new file mode 100644 index 000000000..96a1b8dd2 --- /dev/null +++ b/webhook/metricpipeline/v1beta1/setup.go @@ -0,0 +1,26 @@ +package v1beta1 + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + telemetryv1beta1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1beta1" +) + +func SetupWithManager(mgr ctrl.Manager) error { + return ctrl.NewWebhookManagedBy(mgr).For(&telemetryv1beta1.MetricPipeline{}). + WithDefaulter(&defaulter{ + ExcludeNamespaces: []string{"kyma-system", "kube-system", "istio-system", "compass-system"}, + RuntimeInputResources: runtimeInputResourceDefaults{ + Pod: true, + Container: true, + Node: true, + Volume: true, + DaemonSet: true, + Deployment: true, + StatefulSet: true, + Job: true, + }, + DefaultOTLPOutputProtocol: telemetryv1beta1.OTLPProtocolGRPC, + }). + Complete() +} diff --git a/webhook/tracepipeline/v1alpha1/defaulter.go b/webhook/tracepipeline/v1alpha1/defaulter.go index 5ee8d711a..7cb340c76 100644 --- a/webhook/tracepipeline/v1alpha1/defaulter.go +++ b/webhook/tracepipeline/v1alpha1/defaulter.go @@ -5,28 +5,19 @@ import ( "fmt" "k8s.io/apimachinery/pkg/runtime" - ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/webhook" telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" ) // +kubebuilder:object:generate=false -var _ webhook.CustomDefaulter = &TracePipelineDefaulter{} +var _ webhook.CustomDefaulter = &defaulter{} -type TracePipelineDefaulter struct { +type defaulter struct { DefaultOTLPOutputProtocol string } -func SetupTracePipelineWebhookWithManager(mgr ctrl.Manager) error { - return ctrl.NewWebhookManagedBy(mgr).For(&telemetryv1alpha1.TracePipeline{}). - WithDefaulter(&TracePipelineDefaulter{ - DefaultOTLPOutputProtocol: telemetryv1alpha1.OTLPProtocolGRPC, - }). - Complete() -} - -func (td TracePipelineDefaulter) Default(ctx context.Context, obj runtime.Object) error { +func (td defaulter) Default(ctx context.Context, obj runtime.Object) error { pipeline, ok := obj.(*telemetryv1alpha1.TracePipeline) if !ok { return fmt.Errorf("expected an TracePipeline object but got %T", obj) @@ -37,7 +28,7 @@ func (td TracePipelineDefaulter) Default(ctx context.Context, obj runtime.Object return nil } -func (td TracePipelineDefaulter) applyDefaults(pipeline *telemetryv1alpha1.TracePipeline) { +func (td defaulter) applyDefaults(pipeline *telemetryv1alpha1.TracePipeline) { if pipeline.Spec.Output.OTLP != nil && pipeline.Spec.Output.OTLP.Protocol == "" { pipeline.Spec.Output.OTLP.Protocol = td.DefaultOTLPOutputProtocol } diff --git a/webhook/tracepipeline/v1alpha1/defaulter_test.go b/webhook/tracepipeline/v1alpha1/defaulter_test.go index 31aa25bae..bdbcde90d 100644 --- a/webhook/tracepipeline/v1alpha1/defaulter_test.go +++ b/webhook/tracepipeline/v1alpha1/defaulter_test.go @@ -10,7 +10,7 @@ import ( ) func TestDefault(t *testing.T) { - defaulter := TracePipelineDefaulter{ + sut := defaulter{ DefaultOTLPOutputProtocol: telemetryv1alpha1.OTLPProtocolGRPC, } @@ -63,7 +63,7 @@ func TestDefault(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - err := defaulter.Default(context.Background(), tt.input) + err := sut.Default(context.Background(), tt.input) assert.NoError(t, err) assert.Equal(t, tt.expected, tt.input) }) diff --git a/webhook/tracepipeline/v1alpha1/setup.go b/webhook/tracepipeline/v1alpha1/setup.go new file mode 100644 index 000000000..9c2f3f784 --- /dev/null +++ b/webhook/tracepipeline/v1alpha1/setup.go @@ -0,0 +1,15 @@ +package v1alpha1 + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" +) + +func SetupWithManager(mgr ctrl.Manager) error { + return ctrl.NewWebhookManagedBy(mgr).For(&telemetryv1alpha1.TracePipeline{}). + WithDefaulter(&defaulter{ + DefaultOTLPOutputProtocol: telemetryv1alpha1.OTLPProtocolGRPC, + }). + Complete() +} diff --git a/webhook/tracepipeline/v1beta1/defaulter.go b/webhook/tracepipeline/v1beta1/defaulter.go index a0d11bed4..06d11866d 100644 --- a/webhook/tracepipeline/v1beta1/defaulter.go +++ b/webhook/tracepipeline/v1beta1/defaulter.go @@ -5,28 +5,19 @@ import ( "fmt" "k8s.io/apimachinery/pkg/runtime" - ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/webhook" telemetryv1beta1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1beta1" ) // +kubebuilder:object:generate=false -var _ webhook.CustomDefaulter = &TracePipelineDefaulter{} +var _ webhook.CustomDefaulter = &defaulter{} -type TracePipelineDefaulter struct { +type defaulter struct { DefaultOTLPOutputProtocol telemetryv1beta1.OTLPProtocol } -func SetupTracePipelineWebhookWithManager(mgr ctrl.Manager) error { - return ctrl.NewWebhookManagedBy(mgr).For(&telemetryv1beta1.TracePipeline{}). - WithDefaulter(&TracePipelineDefaulter{ - DefaultOTLPOutputProtocol: telemetryv1beta1.OTLPProtocolGRPC, - }). - Complete() -} - -func (td TracePipelineDefaulter) Default(ctx context.Context, obj runtime.Object) error { +func (td defaulter) Default(ctx context.Context, obj runtime.Object) error { pipeline, ok := obj.(*telemetryv1beta1.TracePipeline) if !ok { return fmt.Errorf("expected an TracePipeline object but got %T", obj) @@ -37,7 +28,7 @@ func (td TracePipelineDefaulter) Default(ctx context.Context, obj runtime.Object return nil } -func (td TracePipelineDefaulter) applyDefaults(pipeline *telemetryv1beta1.TracePipeline) { +func (td defaulter) applyDefaults(pipeline *telemetryv1beta1.TracePipeline) { if pipeline.Spec.Output.OTLP != nil && pipeline.Spec.Output.OTLP.Protocol == "" { pipeline.Spec.Output.OTLP.Protocol = td.DefaultOTLPOutputProtocol } diff --git a/webhook/tracepipeline/v1beta1/defaulter_test.go b/webhook/tracepipeline/v1beta1/defaulter_test.go index d93596607..4388cfb43 100644 --- a/webhook/tracepipeline/v1beta1/defaulter_test.go +++ b/webhook/tracepipeline/v1beta1/defaulter_test.go @@ -10,7 +10,7 @@ import ( ) func TestDefault(t *testing.T) { - defaulter := TracePipelineDefaulter{ + sut := defaulter{ DefaultOTLPOutputProtocol: telemetryv1beta1.OTLPProtocolGRPC, } @@ -63,7 +63,7 @@ func TestDefault(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - err := defaulter.Default(context.Background(), tt.input) + err := sut.Default(context.Background(), tt.input) assert.NoError(t, err) assert.Equal(t, tt.expected, tt.input) }) diff --git a/webhook/tracepipeline/v1beta1/setup.go b/webhook/tracepipeline/v1beta1/setup.go new file mode 100644 index 000000000..fae3453aa --- /dev/null +++ b/webhook/tracepipeline/v1beta1/setup.go @@ -0,0 +1,15 @@ +package v1beta1 + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + telemetryv1beta1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1beta1" +) + +func SetupWithManager(mgr ctrl.Manager) error { + return ctrl.NewWebhookManagedBy(mgr).For(&telemetryv1beta1.TracePipeline{}). + WithDefaulter(&defaulter{ + DefaultOTLPOutputProtocol: telemetryv1beta1.OTLPProtocolGRPC, + }). + Complete() +}