diff --git a/go.mod b/go.mod index 6f8e574..6a0f4c3 100644 --- a/go.mod +++ b/go.mod @@ -13,11 +13,12 @@ require ( github.com/swaggo/gin-swagger v1.5.3 github.com/swaggo/swag v1.8.10 go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.39.0 - go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.40.0 + go.opentelemetry.io/otel v1.14.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.13.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.13.0 - go.opentelemetry.io/otel/sdk v1.13.0 - go.opentelemetry.io/otel/trace v1.13.0 + go.opentelemetry.io/otel/sdk v1.14.0 + go.opentelemetry.io/otel/trace v1.14.0 golang.org/x/exp v0.0.0-20230304125523-9ff063c70017 k8s.io/api v0.26.2 k8s.io/apimachinery v0.26.2 @@ -25,6 +26,11 @@ require ( sigs.k8s.io/controller-runtime v0.14.5 ) +require ( + github.com/felixge/httpsnoop v1.0.3 // indirect + go.opentelemetry.io/otel/metric v0.37.0 // indirect +) + require ( github.com/KyleBanks/depth v1.2.1 // indirect github.com/benbjohnson/clock v1.3.0 // indirect @@ -77,7 +83,7 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.9 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.9.0 // indirect diff --git a/go.sum b/go.sum index a519c95..2dfbeaf 100644 --- a/go.sum +++ b/go.sum @@ -61,7 +61,6 @@ github.com/bytedance/sonic v1.8.0/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZX github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -101,6 +100,8 @@ github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCv github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch/v5 v5.6.0 h1:b91NhWfaz02IuVxO9faSllyAtNXHMPkC5J8sJCLunww= github.com/evanphx/json-patch/v5 v5.6.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4= +github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= +github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/flowstack/go-jsonschema v0.1.1/go.mod h1:yL7fNggx1o8rm9RlgXv7hTBWxdBM0rVwpMwimd3F3N0= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= @@ -112,8 +113,6 @@ github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm github.com/gin-gonic/contrib v0.0.0-20221130124618-7e01895a63f2 h1:dyuNlYlG1faymw39NdJddnzJICy6587tiGSVioWhYoE= github.com/gin-gonic/contrib v0.0.0-20221130124618-7e01895a63f2/go.mod h1:iqneQ2Df3omzIVTkIfn7c1acsVnMGiSLn4XF5Blh3Yg= github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= -github.com/gin-gonic/gin v1.8.2 h1:UzKToD9/PoFj/V4rvlKqTRKnQYyz8Sc1MJlv4JHPtvY= -github.com/gin-gonic/gin v1.8.2/go.mod h1:qw5AYuDrzRTnhvusDsrov+fDIxp9Dleuu12h8nfB398= github.com/gin-gonic/gin v1.9.0 h1:OjyFBKICoexlu99ctXNR2gg+c5pKrKMuyjgARg9qeY8= github.com/gin-gonic/gin v1.9.0/go.mod h1:W1Me9+hsUSyj3CePGrd1/QrKJMSJ1Tu/0hFEH89961k= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -134,38 +133,29 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/go-logr/zapr v1.2.3 h1:a9vnzlIBPQBBkeaR9IuMUfmVOrQlkoC4YfPoFkX3T7A= github.com/go-logr/zapr v1.2.3/go.mod h1:eIauM6P8qSvTw5o2ez6UEAfGjQKrxQTl5EoK+Qa2oG4= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= -github.com/go-openapi/jsonreference v0.20.0 h1:MYlu0sBgChmCfJxxUKZ8g1cPWFOB37YSZqewK7OKeyA= github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo= github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I= -github.com/go-openapi/spec v0.20.7 h1:1Rlu/ZrOCCob0n+JKKJAWhNWMPW8bOZRg8FJaY+0SKI= -github.com/go-openapi/spec v0.20.7/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= github.com/go-openapi/spec v0.20.8 h1:ubHmXNY3FCIOinT8RNrrPfGc9t7I1qhPtdOGoG2AxRU= github.com/go-openapi/spec v0.20.8/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= -github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= -github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= -github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= -github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= -github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= github.com/go-playground/validator/v10 v10.11.2 h1:q3SHpufmypg+erIExEKUmsgmhDTyhcJ38oeKGACXohU= github.com/go-playground/validator/v10 v10.11.2/go.mod h1:NieE624vt4SCTJtD87arVLvdmjPAeV8BQlHtMnw9D7s= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= @@ -243,7 +233,6 @@ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.0 h1:1JYBfzqrWPcCclBwxFCPAou9n+q86mfnu7NAeHfte7A= @@ -381,8 +370,8 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 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 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/swaggo/files v0.0.0-20220728132757-551d4a08d97a/go.mod h1:lKJPbtWzJ9JhsTN1k1gZgleJWY/cqq0psdoMmaThG3w= github.com/swaggo/files v1.0.0 h1:1gGXVIeUFCS/dta17rnP0iOpr6CXFwKD7EO5ID233e4= github.com/swaggo/files v1.0.0/go.mod h1:N59U6URJLyU1PQgFqPM7wXLMhJx7QAolnvfQkqO13kc= @@ -395,8 +384,6 @@ github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= -github.com/ugorji/go/codec v1.2.8 h1:sgBJS6COt0b/P40VouWKdseidkDgHxYGm0SAglUHfP0= -github.com/ugorji/go/codec v1.2.8/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/ugorji/go/codec v1.2.9 h1:rmenucSohSTiyL09Y+l2OCk+FrMxGMzho2+tjr5ticU= github.com/ugorji/go/codec v1.2.9/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= @@ -416,24 +403,26 @@ go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.39.0 h1:Z5u7efQA5B3/aa2riKHeorvROjmhhXOTRtP4nVtkIJA= go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.39.0/go.mod h1:dbx2pPD/jZWsnCz7ogHKY2mmHHnRU4bkjOVsw1V8x/o= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.40.0 h1:lE9EJyw3/JhrjWH/hEy9FptnalDQgj7vpbgC2KCCCxE= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.40.0/go.mod h1:pcQ3MM3SWvrA71U4GDqv9UFDJ3HQsW7y5ZO3tDTlUdI= go.opentelemetry.io/contrib/propagators/b3 v1.14.0 h1:0SBc35DESy/YXShxFtu3634OwcEWJoGzSA8Hx/NbOo8= go.opentelemetry.io/otel v1.7.0/go.mod h1:5BdUoMIz5WEs0vt0CUEMtSSaTSHBBVwrhnz7+nrD5xk= -go.opentelemetry.io/otel v1.13.0 h1:1ZAKnNQKwBBxFtww/GwxNUyTf0AxkZzrukO8MeXqe4Y= -go.opentelemetry.io/otel v1.13.0/go.mod h1:FH3RtdZCzRkJYFTCsAKDy9l/XYjMdNv6QrkFFB8DvVg= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 h1:pa05sNT/P8OsIQ8mPZKTIyiBuzS/xDGLVx+DCt0y6Vs= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0/go.mod h1:rqbht/LlhVBgn5+k3M5QK96K5Xb0DvXpMJ5SFQpY6uw= +go.opentelemetry.io/otel v1.14.0 h1:/79Huy8wbf5DnIPhemGB+zEPVwnN6fuQybr/SRXa6hM= +go.opentelemetry.io/otel v1.14.0/go.mod h1:o4buv+dJzx8rohcUeRmWUZhqupFvzWis188WlggnNeU= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 h1:/fXHZHGvro6MVqV34fJzDhi7sHGpX3Ej/Qjmfn003ho= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0/go.mod h1:UFG7EBMRdXyFstOwH028U0sVf+AvukSGhF0g8+dmNG8= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.13.0 h1:Any/nVxaoMq1T2w0W85d6w5COlLuCCgOYKQhJJWEMwQ= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.13.0/go.mod h1:46vAP6RWfNn7EKov73l5KBFlNxz8kYlxR1woU+bJ4ZY= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.11.2 h1:Us8tbCmuN16zAnK5TC69AtODLycKbwnskQzaB6DfFhc= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.11.2/go.mod h1:GZWSQQky8AgdJj50r1KJm8oiQiIPaAX7uZCFQX9GzC8= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.13.0 h1:Ntu7izEOIRHEgQNjbGc7j3eNtYMAiZfElJJ4JiiRDH4= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.13.0/go.mod h1:wZ9SAjm2sjw3vStBhlCfMZWZusyOQrwrHOFo00jyMC4= +go.opentelemetry.io/otel/metric v0.37.0 h1:pHDQuLQOZwYD+Km0eb657A25NaRzy0a+eLyKfDXedEs= +go.opentelemetry.io/otel/metric v0.37.0/go.mod h1:DmdaHfGt54iV6UKxsV9slj2bBRJcKC1B1uvDLIioc1s= go.opentelemetry.io/otel/sdk v1.7.0/go.mod h1:uTEOTwaqIVuTGiJN7ii13Ibp75wJmYUDe374q6cZwUU= -go.opentelemetry.io/otel/sdk v1.13.0 h1:BHib5g8MvdqS65yo2vV1s6Le42Hm6rrw08qU6yz5JaM= -go.opentelemetry.io/otel/sdk v1.13.0/go.mod h1:YLKPx5+6Vx/o1TCUYYs+bpymtkmazOMT6zoRrC7AQ7I= +go.opentelemetry.io/otel/sdk v1.14.0 h1:PDCppFRDq8A1jL9v6KMI6dYesaq+DFcDZvjsoGvxGzY= +go.opentelemetry.io/otel/sdk v1.14.0/go.mod h1:bwIC5TjrNG6QDCHNWvW4HLHtUQ4I+VQDsnjhvyZCALM= go.opentelemetry.io/otel/trace v1.7.0/go.mod h1:fzLSB9nqR2eXzxPXb2JW9IKE+ScyXA48yyE4TNvoHqU= -go.opentelemetry.io/otel/trace v1.13.0 h1:CBgRZ6ntv+Amuj1jDsMhZtlAPT6gbyIRdaIzFhfBSdY= -go.opentelemetry.io/otel/trace v1.13.0/go.mod h1:muCvmmO9KKpvuXSf3KKAXXB2ygNYHQ+ZfI5X08d3tds= +go.opentelemetry.io/otel/trace v1.14.0 h1:wp2Mmvj41tDsyAJXiWDWpfNsOiIyd38fy85pyKcFq/M= +go.opentelemetry.io/otel/trace v1.14.0/go.mod h1:8avnQLK+CG77yNLUae4ea2JDQ6iT+gozhnZjy/rw9G8= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= @@ -458,9 +447,6 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8= -golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80= golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -473,14 +459,6 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20230203172020-98cc5a0785f9 h1:frX3nT9RkKybPnjyI+yvZh6ZucTZatCCEm9D47sZ2zo= -golang.org/x/exp v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= -golang.org/x/exp v0.0.0-20230206171751-46f607a40771 h1:xP7rWLUr1e1n2xkK5YB4LI0hPEy3LJC6Wk+D4pGlOJg= -golang.org/x/exp v0.0.0-20230206171751-46f607a40771/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= -golang.org/x/exp v0.0.0-20230210204819-062eb4c674ab h1:628ME69lBm9C6JY2wXhAph/yjN3jezx1z7BIDLUwxjo= -golang.org/x/exp v0.0.0-20230210204819-062eb4c674ab/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= -golang.org/x/exp v0.0.0-20230213192124-5e25df0256eb h1:PaBZQdo+iSDyHT053FjUCgZQ/9uqVwPOcl7KSWhKn6w= -golang.org/x/exp v0.0.0-20230213192124-5e25df0256eb/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/exp v0.0.0-20230304125523-9ff063c70017 h1:3Ea9SZLCB0aRIhSEjM+iaGIlzzeDJdpi579El/YIhEE= golang.org/x/exp v0.0.0-20230304125523-9ff063c70017/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= @@ -505,7 +483,6 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA= golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -541,12 +518,9 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= -golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -556,8 +530,6 @@ golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4Iltr golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.3.0 h1:6l90koy8/LaBLmLu8jpHeHexzMwEita0zFfYlggy2F8= -golang.org/x/oauth2 v0.3.0/go.mod h1:rQrIauxkUhJ6CuwEXwymO2/eh4xz2ZWF1nBkcxS+tGk= golang.org/x/oauth2 v0.5.0 h1:HuArIo48skDwlrvM3sEdHXElYslAMsf3KwRkkW4MC4s= golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -623,15 +595,11 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= -golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.4.0 h1:O7UWfv5+A2qiuulQk30kVinPoMtoIPeVaKLEgLpVkvg= -golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -643,8 +611,6 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= -golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -698,8 +664,6 @@ golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.4.0 h1:7mTAgkunk3fr4GAloyyCasadO6h9zSsQZbwvcaIciV4= -golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -764,8 +728,6 @@ google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef h1:uQ2vjV/sHTsWSqdKeLqmwitzgvjMl7o4IdtHwUDXSJY= -google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/genproto v0.0.0-20230216225411-c8e22ba71e44 h1:EfLuoKW5WfkgVdDy7dTK8qSbH37AX5mj/MFh+bGPz14= google.golang.org/genproto v0.0.0-20230216225411-c8e22ba71e44/go.mod h1:8B0gmkoRebU8ukX6HP+4wrVQUY1+6PkQ44BSyIlflHA= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -784,8 +746,6 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.52.3 h1:pf7sOysg4LdgBqduXveGKrcEwbStiK2rtfghdzlUYDQ= -google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -836,46 +796,26 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/api v0.26.1 h1:f+SWYiPd/GsiWwVRz+NbFyCgvv75Pk9NK6dlkZgpCRQ= -k8s.io/api v0.26.1/go.mod h1:xd/GBNgR0f707+ATNyPmQ1oyKSgndzXij81FzWGsejg= k8s.io/api v0.26.2 h1:dM3cinp3PGB6asOySalOZxEG4CZ0IAdJsrYZXE/ovGQ= k8s.io/api v0.26.2/go.mod h1:1kjMQsFE+QHPfskEcVNgL3+Hp88B80uj0QtSOlj8itU= -k8s.io/apiextensions-apiserver v0.26.0 h1:Gy93Xo1eg2ZIkNX/8vy5xviVSxwQulsnUdQ00nEdpDo= -k8s.io/apiextensions-apiserver v0.26.0/go.mod h1:7ez0LTiyW5nq3vADtK6C3kMESxadD51Bh6uz3JOlqWQ= k8s.io/apiextensions-apiserver v0.26.1 h1:cB8h1SRk6e/+i3NOrQgSFij1B2S0Y0wDoNl66bn8RMI= k8s.io/apiextensions-apiserver v0.26.1/go.mod h1:AptjOSXDGuE0JICx/Em15PaoO7buLwTs0dGleIHixSM= -k8s.io/apimachinery v0.26.1 h1:8EZ/eGJL+hY/MYCNwhmDzVqq2lPl3N3Bo8rvweJwXUQ= -k8s.io/apimachinery v0.26.1/go.mod h1:tnPmbONNJ7ByJNz9+n9kMjNP8ON+1qoAIIC70lztu74= k8s.io/apimachinery v0.26.2 h1:da1u3D5wfR5u2RpLhE/ZtZS2P7QvDgLZTi9wrNZl/tQ= k8s.io/apimachinery v0.26.2/go.mod h1:ats7nN1LExKHvJ9TmwootT00Yz05MuYqPXEXaVeOy5I= -k8s.io/client-go v0.26.1 h1:87CXzYJnAMGaa/IDDfRdhTzxk/wzGZ+/HUQpqgVSZXU= -k8s.io/client-go v0.26.1/go.mod h1:IWNSglg+rQ3OcvDkhY6+QLeasV4OYHDjdqeWkDQZwGE= k8s.io/client-go v0.26.2 h1:s1WkVujHX3kTp4Zn4yGNFK+dlDXy1bAAkIl+cFAiuYI= k8s.io/client-go v0.26.2/go.mod h1:u5EjOuSyBa09yqqyY7m3abZeovO/7D/WehVVlZ2qcqU= -k8s.io/component-base v0.26.0 h1:0IkChOCohtDHttmKuz+EP3j3+qKmV55rM9gIFTXA7Vs= -k8s.io/component-base v0.26.0/go.mod h1:lqHwlfV1/haa14F/Z5Zizk5QmzaVf23nQzCwVOQpfC8= k8s.io/component-base v0.26.1 h1:4ahudpeQXHZL5kko+iDHqLj/FSGAEUnSVO0EBbgDd+4= k8s.io/component-base v0.26.1/go.mod h1:VHrLR0b58oC035w6YQiBSbtsf0ThuSwXP+p5dD/kAWU= -k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4= -k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/klog/v2 v2.90.0 h1:VkTxIV/FjRXn1fgNNcKGM8cfmL1Z33ZjXRTVxKCoF5M= k8s.io/klog/v2 v2.90.0/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= -k8s.io/kube-openapi v0.0.0-20221207184640-f3cff1453715 h1:tBEbstoM+K0FiBV5KGAKQ0kuvf54v/hwpldiJt69w1s= -k8s.io/kube-openapi v0.0.0-20221207184640-f3cff1453715/go.mod h1:+Axhij7bCpeqhklhUTe3xmOn6bWxolyZEeyaFpjGtl4= k8s.io/kube-openapi v0.0.0-20230217203603-ff9a8e8fa21d h1:oFDpQ7FfzinCtrFOl4izwOWsdTprlS2A9IXBENMW0UA= k8s.io/kube-openapi v0.0.0-20230217203603-ff9a8e8fa21d/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0= -k8s.io/utils v0.0.0-20221128185143-99ec85e7a448 h1:KTgPnR10d5zhztWptI952TNtt/4u5h3IzDXkdIMuo2Y= -k8s.io/utils v0.0.0-20221128185143-99ec85e7a448/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY= k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -sigs.k8s.io/controller-runtime v0.14.1 h1:vThDes9pzg0Y+UbCPY3Wj34CGIYPgdmspPm2GIpxpzM= -sigs.k8s.io/controller-runtime v0.14.1/go.mod h1:GaRkrY8a7UZF0kqFFbUKG7n9ICiTY5T55P1RiE3UZlU= -sigs.k8s.io/controller-runtime v0.14.4 h1:Kd/Qgx5pd2XUL08eOV2vwIq3L9GhIbJ5Nxengbd4/0M= -sigs.k8s.io/controller-runtime v0.14.4/go.mod h1:WqIdsAY6JBsjfc/CqO0CORmNtoCtE4S6qbPc9s68h+0= sigs.k8s.io/controller-runtime v0.14.5 h1:6xaWFqzT5KuAQ9ufgUaj1G/+C4Y1GRkhrxl+BJ9i+5s= sigs.k8s.io/controller-runtime v0.14.5/go.mod h1:WqIdsAY6JBsjfc/CqO0CORmNtoCtE4S6qbPc9s68h+0= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= diff --git a/pkg/client/authenticated_shortlink_client.go b/pkg/client/authenticated_shortlink_client.go index 199d9b1..1289aac 100644 --- a/pkg/client/authenticated_shortlink_client.go +++ b/pkg/client/authenticated_shortlink_client.go @@ -4,9 +4,12 @@ import ( "context" "github.com/cedi/urlshortener/api/v1alpha1" + "github.com/cedi/urlshortener/pkg/model" + "github.com/go-logr/logr" + "github.com/pkg/errors" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" - "golang.org/x/exp/slices" ) type ShortlinkClientAuth struct { @@ -27,6 +30,8 @@ func (c *ShortlinkClientAuth) List(ct context.Context, username string) (*v1alph ctx, span := c.tracer.Start(ct, "ShortlinkClientAuth.List") defer span.End() + span.SetAttributes(attribute.String("username", username)) + list, err := c.client.List(ctx) if err != nil { return nil, err @@ -51,13 +56,15 @@ func (c *ShortlinkClientAuth) Get(ct context.Context, username string, name stri ctx, span := c.tracer.Start(ct, "ShortlinkClientAuth.Get") defer span.End() + span.SetAttributes(attribute.String("username", username)) + shortLink, err := c.client.Get(ctx, name) if err != nil { - return nil, err + return nil, errors.Wrap(err, "Unable to get shortlink") } if !shortLink.IsOwnedBy(username) { - return nil, nil + return nil, model.NewNotAllowedError(username, "delete", shortLink.Name) } return shortLink, nil @@ -67,8 +74,9 @@ func (c *ShortlinkClientAuth) Create(ct context.Context, username string, shortL ctx, span := c.tracer.Start(ct, "ShortlinkClientAuth.Create") defer span.End() - shortLink.Spec.Owner = username + span.SetAttributes(attribute.String("username", username)) + shortLink.Spec.Owner = username return c.client.Create(ctx, shortLink) } @@ -76,12 +84,10 @@ func (c *ShortlinkClientAuth) Update(ct context.Context, username string, shortL ctx, span := c.tracer.Start(ct, "ShortlinkClientAuth.Update") defer span.End() - // When someone updates a shortlink and removes himself as the owner - // add him to the CoOwner - if shortLink.Spec.Owner != username { - if !slices.Contains(shortLink.Spec.CoOwners, username) { - shortLink.Spec.CoOwners = append(shortLink.Spec.CoOwners, username) - } + span.SetAttributes(attribute.String("username", username)) + + if !shortLink.IsOwnedBy(username) { + return model.NewNotAllowedError(username, "delete", shortLink.Name) } if err := c.client.Update(ctx, shortLink); err != nil { @@ -96,8 +102,10 @@ func (c *ShortlinkClientAuth) Delete(ct context.Context, username string, shortL ctx, span := c.tracer.Start(ct, "ShortlinkClientAuth.Update") defer span.End() + span.SetAttributes(attribute.String("username", username)) + if !shortLink.IsOwnedBy(username) { - return nil + return model.NewNotAllowedError(username, "delete", shortLink.Name) } return c.client.Delete(ctx, shortLink) diff --git a/pkg/client/shortlink_client.go b/pkg/client/shortlink_client.go index e8ed9a1..444e6a8 100644 --- a/pkg/client/shortlink_client.go +++ b/pkg/client/shortlink_client.go @@ -104,7 +104,7 @@ func (c *ShortlinkClient) ListNamespaced(ct context.Context, namespace string) ( } func (c *ShortlinkClient) Update(ct context.Context, shortlink *v1alpha1.ShortLink) error { - ctx, span := c.tracer.Start(ct, "ShortlinkClient.Save", trace.WithAttributes(attribute.String("shortlink", shortlink.ObjectMeta.Name), attribute.String("namespace", shortlink.ObjectMeta.Namespace))) + ctx, span := c.tracer.Start(ct, "ShortlinkClient.Update", trace.WithAttributes(attribute.String("shortlink", shortlink.ObjectMeta.Name), attribute.String("namespace", shortlink.ObjectMeta.Namespace))) defer span.End() if err := c.client.Update(ctx, shortlink); err != nil { @@ -116,7 +116,7 @@ func (c *ShortlinkClient) Update(ct context.Context, shortlink *v1alpha1.ShortLi } func (c *ShortlinkClient) UpdateStatus(ct context.Context, shortlink *v1alpha1.ShortLink) error { - ctx, span := c.tracer.Start(ct, "ShortlinkClient.SaveStatus", trace.WithAttributes(attribute.String("shortlink", shortlink.ObjectMeta.Name), attribute.String("namespace", shortlink.ObjectMeta.Namespace))) + ctx, span := c.tracer.Start(ct, "ShortlinkClient.UpdateStatus", trace.WithAttributes(attribute.String("shortlink", shortlink.ObjectMeta.Name), attribute.String("namespace", shortlink.ObjectMeta.Namespace))) defer span.End() err := c.client.Status().Update(ctx, shortlink) @@ -128,7 +128,7 @@ func (c *ShortlinkClient) UpdateStatus(ct context.Context, shortlink *v1alpha1.S } func (c *ShortlinkClient) IncrementInvocationCount(ct context.Context, shortlink *v1alpha1.ShortLink) error { - ctx, span := c.tracer.Start(ct, "ShortlinkClient.SaveStatus", trace.WithAttributes(attribute.String("shortlink", shortlink.ObjectMeta.Name), attribute.String("namespace", shortlink.ObjectMeta.Namespace))) + ctx, span := c.tracer.Start(ct, "ShortlinkClient.IncrementInvocationCount", trace.WithAttributes(attribute.String("shortlink", shortlink.ObjectMeta.Name), attribute.String("namespace", shortlink.ObjectMeta.Namespace))) defer span.End() shortlink.Status.Count = shortlink.Status.Count + 1 @@ -141,7 +141,6 @@ func (c *ShortlinkClient) IncrementInvocationCount(ct context.Context, shortlink return nil } -// Delete deletes a Shortlink object func (c *ShortlinkClient) Delete(ct context.Context, shortlink *v1alpha1.ShortLink) error { ctx, span := c.tracer.Start(ct, "ShortlinkClient.Delete", trace.WithAttributes(attribute.String("name", shortlink.Name), attribute.String("namespace", shortlink.Namespace))) defer span.End() diff --git a/pkg/controller/handle_create_shortlink.go b/pkg/controller/handle_create_shortlink.go index 437e260..3deeddf 100644 --- a/pkg/controller/handle_create_shortlink.go +++ b/pkg/controller/handle_create_shortlink.go @@ -36,28 +36,39 @@ import ( // @Tags api/v1/ // @Router /api/v1/shortlink/{shortlink} [post] // @Security bearerAuth -func (s *ShortlinkController) HandleCreateShortLink(c *gin.Context) { - shortlinkName := c.Param("shortlink") - contentType := c.Request.Header.Get("accept") +func (s *ShortlinkController) HandleCreateShortLink(ct *gin.Context) { + shortlinkName := ct.Param("shortlink") + contentType := ct.Request.Header.Get("accept") - // Call the HTML method of the Context to render a template - ctx, span := s.tracer.Start(c.Request.Context(), "ShortlinkController.HandleGetShortLink", trace.WithAttributes(attribute.String("shortlink", shortlinkName), attribute.String("accepted_content_type", contentType))) - defer span.End() + ctx := ct.Request.Context() + span := trace.SpanFromContext(ctx) - bearerToken := c.Request.Header.Get("Authorization") + // Check if the span was sampled and is recording the data + if !span.IsRecording() { + ctx, span = s.tracer.Start(ctx, "ShortlinkController.HandleCreateShortLink") + defer span.End() + } + + span.SetAttributes( + attribute.String("shortlink", shortlinkName), + attribute.String("content_type", contentType), + attribute.String("referrer", ct.Request.Referer()), + ) + + bearerToken := ct.Request.Header.Get("Authorization") bearerToken = strings.TrimPrefix(bearerToken, "Bearer") bearerToken = strings.TrimPrefix(bearerToken, "token") if len(bearerToken) == 0 { err := fmt.Errorf("no credentials provided") span.RecordError(err) - ginReturnError(c, http.StatusUnauthorized, contentType, err.Error()) + ginReturnError(ct, http.StatusUnauthorized, contentType, err.Error()) return } githubUser, err := getGitHubUserInfo(ctx, bearerToken) if err != nil { span.RecordError(err) - ginReturnError(c, http.StatusUnauthorized, contentType, err.Error()) + ginReturnError(ct, http.StatusUnauthorized, contentType, err.Error()) return } @@ -68,29 +79,29 @@ func (s *ShortlinkController) HandleCreateShortLink(c *gin.Context) { Spec: v1alpha1.ShortLinkSpec{}, } - jsonData, err := io.ReadAll(c.Request.Body) + jsonData, err := io.ReadAll(ct.Request.Body) if err != nil { observability.RecordError(span, s.log, err, "Failed to read request-body") - ginReturnError(c, http.StatusInternalServerError, contentType, err.Error()) + ginReturnError(ct, http.StatusInternalServerError, contentType, err.Error()) return } if err := json.Unmarshal([]byte(jsonData), &shortlink.Spec); err != nil { observability.RecordError(span, s.log, err, "Failed to read spec-json") - ginReturnError(c, http.StatusInternalServerError, contentType, err.Error()) + ginReturnError(ct, http.StatusInternalServerError, contentType, err.Error()) return } if err := s.authenticatedClient.Create(ctx, githubUser.Login, &shortlink); err != nil { observability.RecordError(span, s.log, err, "Failed to create ShortLink") - ginReturnError(c, http.StatusInternalServerError, contentType, err.Error()) + ginReturnError(ct, http.StatusInternalServerError, contentType, err.Error()) return } if contentType == ContentTypeTextPlain { - c.Data(http.StatusOK, contentType, []byte(fmt.Sprintf("%s: %s\n", shortlink.Name, shortlink.Spec.Target))) + ct.Data(http.StatusOK, contentType, []byte(fmt.Sprintf("%s: %s\n", shortlink.Name, shortlink.Spec.Target))) } else if contentType == ContentTypeApplicationJSON { - c.JSON(http.StatusOK, ShortLink{ + ct.JSON(http.StatusOK, ShortLink{ Name: shortlink.Name, Spec: shortlink.Spec, Status: shortlink.Status, diff --git a/pkg/controller/handle_delete_shortlink.go b/pkg/controller/handle_delete_shortlink.go index fc95c9c..7285ec8 100644 --- a/pkg/controller/handle_delete_shortlink.go +++ b/pkg/controller/handle_delete_shortlink.go @@ -26,29 +26,39 @@ import ( // @Tags api/v1/ // @Router /api/v1/shortlink/{shortlink} [delete] // @Security bearerAuth -func (s *ShortlinkController) HandleDeleteShortLink(c *gin.Context) { - shortlinkName := c.Param("shortlink") +func (s *ShortlinkController) HandleDeleteShortLink(ct *gin.Context) { + shortlinkName := ct.Param("shortlink") + contentType := ct.Request.Header.Get("accept") - contentType := c.Request.Header.Get("accept") + ctx := ct.Request.Context() + span := trace.SpanFromContext(ctx) - // Call the HTML method of the Context to render a template - ctx, span := s.tracer.Start(c.Request.Context(), "ShortlinkController.HandleGetShortLink", trace.WithAttributes(attribute.String("shortlink", shortlinkName), attribute.String("accepted_content_type", contentType))) - defer span.End() + // Check if the span was sampled and is recording the data + if !span.IsRecording() { + ctx, span = s.tracer.Start(ctx, "ShortlinkController.HandleDeleteShortLink") + defer span.End() + } + + span.SetAttributes( + attribute.String("shortlink", shortlinkName), + attribute.String("content_type", contentType), + attribute.String("referrer", ct.Request.Referer()), + ) - bearerToken := c.Request.Header.Get("Authorization") + bearerToken := ct.Request.Header.Get("Authorization") bearerToken = strings.TrimPrefix(bearerToken, "Bearer") bearerToken = strings.TrimPrefix(bearerToken, "token") if len(bearerToken) == 0 { err := fmt.Errorf("no credentials provided") span.RecordError(err) - ginReturnError(c, http.StatusUnauthorized, contentType, err.Error()) + ginReturnError(ct, http.StatusUnauthorized, contentType, err.Error()) return } githubUser, err := getGitHubUserInfo(ctx, bearerToken) if err != nil { span.RecordError(err) - ginReturnError(c, http.StatusUnauthorized, contentType, err.Error()) + ginReturnError(ct, http.StatusUnauthorized, contentType, err.Error()) return } @@ -62,13 +72,13 @@ func (s *ShortlinkController) HandleDeleteShortLink(c *gin.Context) { statusCode = http.StatusNotFound } - ginReturnError(c, statusCode, contentType, err.Error()) + ginReturnError(ct, statusCode, contentType, err.Error()) return } // When shortlink was not found if shortlink == nil { - ginReturnError(c, http.StatusNotFound, contentType, "Shortlink not found") + ginReturnError(ct, http.StatusNotFound, contentType, "Shortlink not found") return } @@ -81,7 +91,7 @@ func (s *ShortlinkController) HandleDeleteShortLink(c *gin.Context) { observability.RecordError(span, s.log, err, "Failed to delete ShortLink") - ginReturnError(c, statusCode, contentType, err.Error()) + ginReturnError(ct, statusCode, contentType, err.Error()) return } } diff --git a/pkg/controller/handle_get_shortlink.go b/pkg/controller/handle_get_shortlink.go index e99ae69..141084d 100644 --- a/pkg/controller/handle_get_shortlink.go +++ b/pkg/controller/handle_get_shortlink.go @@ -26,29 +26,39 @@ import ( // @Tags api/v1/ // @Router /api/v1/shortlink/{shortlink} [get] // @Security bearerAuth -func (s *ShortlinkController) HandleGetShortLink(c *gin.Context) { - shortlinkName := c.Param("shortlink") +func (s *ShortlinkController) HandleGetShortLink(ct *gin.Context) { + shortlinkName := ct.Param("shortlink") + contentType := ct.Request.Header.Get("accept") - contentType := c.Request.Header.Get("accept") + ctx := ct.Request.Context() + span := trace.SpanFromContext(ctx) - // Call the HTML method of the Context to render a template - ctx, span := s.tracer.Start(c.Request.Context(), "ShortlinkController.HandleGetShortLink", trace.WithAttributes(attribute.String("shortlink", shortlinkName), attribute.String("accepted_content_type", contentType))) - defer span.End() + // Check if the span was sampled and is recording the data + if !span.IsRecording() { + ctx, span = s.tracer.Start(ctx, "ShortlinkController.HandleGetShortLink") + defer span.End() + } + + span.SetAttributes( + attribute.String("shortlink", shortlinkName), + attribute.String("content_type", contentType), + attribute.String("referrer", ct.Request.Referer()), + ) - bearerToken := c.Request.Header.Get("Authorization") + bearerToken := ct.Request.Header.Get("Authorization") bearerToken = strings.TrimPrefix(bearerToken, "Bearer") bearerToken = strings.TrimPrefix(bearerToken, "token") if len(bearerToken) == 0 { err := fmt.Errorf("no credentials provided") span.RecordError(err) - ginReturnError(c, http.StatusUnauthorized, contentType, err.Error()) + ginReturnError(ct, http.StatusUnauthorized, contentType, err.Error()) return } githubUser, err := getGitHubUserInfo(ctx, bearerToken) if err != nil { span.RecordError(err) - ginReturnError(c, http.StatusUnauthorized, contentType, err.Error()) + ginReturnError(ct, http.StatusUnauthorized, contentType, err.Error()) return } @@ -62,14 +72,14 @@ func (s *ShortlinkController) HandleGetShortLink(c *gin.Context) { statusCode = http.StatusNotFound } - ginReturnError(c, statusCode, contentType, err.Error()) + ginReturnError(ct, statusCode, contentType, err.Error()) return } if contentType == ContentTypeTextPlain { - c.Data(http.StatusOK, contentType, []byte(shortlink.Spec.Target)) + ct.Data(http.StatusOK, contentType, []byte(shortlink.Spec.Target)) } else if contentType == ContentTypeApplicationJSON { - c.JSON(http.StatusOK, ShortLink{ + ct.JSON(http.StatusOK, ShortLink{ Name: shortlink.Name, Spec: shortlink.Spec, Status: shortlink.Status, diff --git a/pkg/controller/handle_list_shortlink.go b/pkg/controller/handle_list_shortlink.go index c8af549..af859cb 100644 --- a/pkg/controller/handle_list_shortlink.go +++ b/pkg/controller/handle_list_shortlink.go @@ -25,29 +25,38 @@ import ( // @Tags api/v1/ // @Router /api/v1/shortlink/ [get] // @Security bearerAuth -func (s *ShortlinkController) HandleListShortLink(c *gin.Context) { - contentType := c.Request.Header.Get("accept") +func (s *ShortlinkController) HandleListShortLink(ct *gin.Context) { + contentType := ct.Request.Header.Get("accept") - trace.SpanFromContext(c) + // Extract span from the request context + ctx := ct.Request.Context() + span := trace.SpanFromContext(ctx) - // Call the HTML method of the Context to render a template - ctx, span := s.tracer.Start(c.Request.Context(), "ShortlinkController.HandleListShortLink", trace.WithAttributes(attribute.String("accepted_content_type", contentType))) - defer span.End() + // Check if the span was sampled and is recording the data + if !span.IsRecording() { + ctx, span = s.tracer.Start(ctx, "ShortlinkController.HandleDeleteShortLink") + defer span.End() + } + + span.SetAttributes( + attribute.String("content_type", contentType), + attribute.String("referrer", ct.Request.Referer()), + ) - bearerToken := c.Request.Header.Get("Authorization") + bearerToken := ct.Request.Header.Get("Authorization") bearerToken = strings.TrimPrefix(bearerToken, "Bearer") bearerToken = strings.TrimPrefix(bearerToken, "token") if len(bearerToken) == 0 { err := fmt.Errorf("no credentials provided") span.RecordError(err) - ginReturnError(c, http.StatusUnauthorized, contentType, err.Error()) + ginReturnError(ct, http.StatusUnauthorized, contentType, err.Error()) return } githubUser, err := getGitHubUserInfo(ctx, bearerToken) if err != nil { span.RecordError(err) - ginReturnError(c, http.StatusUnauthorized, contentType, err.Error()) + ginReturnError(ct, http.StatusUnauthorized, contentType, err.Error()) return } @@ -61,7 +70,7 @@ func (s *ShortlinkController) HandleListShortLink(c *gin.Context) { statusCode = http.StatusNotFound } - ginReturnError(c, statusCode, contentType, err.Error()) + ginReturnError(ct, statusCode, contentType, err.Error()) return } @@ -76,12 +85,12 @@ func (s *ShortlinkController) HandleListShortLink(c *gin.Context) { } if contentType == ContentTypeApplicationJSON { - c.JSON(http.StatusOK, targetList) + ct.JSON(http.StatusOK, targetList) } else if contentType == ContentTypeTextPlain { shortLinks := "" for _, shortlink := range targetList { shortLinks += fmt.Sprintf("%s: %s\n", shortlink.Name, shortlink.Spec.Target) } - c.Data(http.StatusOK, contentType, []byte(shortLinks)) + ct.Data(http.StatusOK, contentType, []byte(shortLinks)) } } diff --git a/pkg/controller/handle_shortlink.go b/pkg/controller/handle_shortlink.go index 61e8c59..c2ab5f4 100644 --- a/pkg/controller/handle_shortlink.go +++ b/pkg/controller/handle_shortlink.go @@ -31,27 +31,35 @@ import ( // @Failure 500 {object} int "InternalServerError" // @Tags default // @Router /{shortlink} [get] -func (s *ShortlinkController) HandleShortLink(c *gin.Context) { - shortlinkName := c.Param("shortlink") +func (s *ShortlinkController) HandleShortLink(ct *gin.Context) { + shortlinkName := ct.Param("shortlink") - // Call the HTML method of the Context to render a template - ctx, span := s.tracer.Start(c.Request.Context(), "ShortlinkController.HandleShortLink", trace.WithAttributes(attribute.String("shortlink", shortlinkName))) - defer span.End() + ctx := ct.Request.Context() + span := trace.SpanFromContext(ctx) - span.AddEvent("shortlink", trace.WithAttributes(attribute.String("shortlink", shortlinkName))) + // Check if the span was sampled and is recording the data + if !span.IsRecording() { + ctx, span = s.tracer.Start(ctx, "ShortlinkController.HandleShortLink") + defer span.End() + } + + span.SetAttributes( + attribute.String("shortlink", shortlinkName), + attribute.String("referrer", ct.Request.Referer()), + ) - c.Header("Cache-Control", "public, max-age=900, stale-if-error=3600") // max-age = 15min; stale-if-error = 1h + ct.Header("Cache-Control", "public, max-age=900, stale-if-error=3600") // max-age = 15min; stale-if-error = 1h shortlink, err := s.client.Get(ctx, shortlinkName) if err != nil { if strings.Contains(err.Error(), "not found") { observability.RecordError(span, s.log, err, "Path not found") - span.SetAttributes(attribute.String("path", c.Request.URL.Path)) + span.SetAttributes(attribute.String("path", ct.Request.URL.Path)) - c.HTML(http.StatusNotFound, "404.html", gin.H{}) + ct.HTML(http.StatusNotFound, "404.html", gin.H{}) } else { observability.RecordError(span, s.log, err, "Failed to get ShortLink") - c.HTML(http.StatusInternalServerError, "500.html", gin.H{}) + ct.HTML(http.StatusInternalServerError, "500.html", gin.H{}) } return } @@ -75,19 +83,14 @@ func (s *ShortlinkController) HandleShortLink(c *gin.Context) { if shortlink.Spec.Code != 200 { // Redirect - c.Redirect(shortlink.Spec.Code, target) + ct.Redirect(shortlink.Spec.Code, target) } else { // Redirect via JS/HTML - c.HTML( - // Set the HTTP status to 200 (OK) + ct.HTML( http.StatusOK, - - // Use the index.html template "redirect.html", - - // Pass the data that the page uses (in this case, 'title') gin.H{ - "redirectFrom": c.Request.URL.Path, + "redirectFrom": ct.Request.URL.Path, "redirectTo": target, "redirectAfter": shortlink.Spec.RedirectAfter, }, @@ -95,5 +98,5 @@ func (s *ShortlinkController) HandleShortLink(c *gin.Context) { } // Increase hit counter - s.client.IncrementInvocationCount(ctx, shortlink) + s.client.IncrementInvocationCount(ct, shortlink) } diff --git a/pkg/controller/handle_update_shortlink.go b/pkg/controller/handle_update_shortlink.go index 1ecb52b..04ea8b5 100644 --- a/pkg/controller/handle_update_shortlink.go +++ b/pkg/controller/handle_update_shortlink.go @@ -31,29 +31,38 @@ import ( // @Tags api/v1/ // @Router /api/v1/shortlink/{shortlink} [put] // @Security bearerAuth -func (s *ShortlinkController) HandleUpdateShortLink(c *gin.Context) { - shortlinkName := c.Param("shortlink") +func (s *ShortlinkController) HandleUpdateShortLink(ct *gin.Context) { + shortlinkName := ct.Param("shortlink") + contentType := ct.Request.Header.Get("accept") - contentType := c.Request.Header.Get("accept") + ctx := ct.Request.Context() + span := trace.SpanFromContext(ctx) - // Call the HTML method of the Context to render a template - ctx, span := s.tracer.Start(c.Request.Context(), "ShortlinkController.HandleGetShortLink", trace.WithAttributes(attribute.String("shortlink", shortlinkName), attribute.String("accepted_content_type", contentType))) - defer span.End() + // Check if the span was sampled and is recording the data + if !span.IsRecording() { + ctx, span = s.tracer.Start(ctx, "ShortlinkController.HandleShortLink") + defer span.End() + } + + span.SetAttributes( + attribute.String("shortlink", shortlinkName), + attribute.String("referrer", ct.Request.Referer()), + ) - bearerToken := c.Request.Header.Get("Authorization") + bearerToken := ct.Request.Header.Get("Authorization") bearerToken = strings.TrimPrefix(bearerToken, "Bearer") bearerToken = strings.TrimPrefix(bearerToken, "token") if len(bearerToken) == 0 { err := fmt.Errorf("no credentials provided") span.RecordError(err) - ginReturnError(c, http.StatusUnauthorized, contentType, err.Error()) + ginReturnError(ct, http.StatusUnauthorized, contentType, err.Error()) return } githubUser, err := getGitHubUserInfo(ctx, bearerToken) if err != nil { span.RecordError(err) - ginReturnError(c, http.StatusUnauthorized, contentType, err.Error()) + ginReturnError(ct, http.StatusUnauthorized, contentType, err.Error()) return } @@ -67,30 +76,30 @@ func (s *ShortlinkController) HandleUpdateShortLink(c *gin.Context) { statusCode = http.StatusNotFound } - ginReturnError(c, statusCode, contentType, err.Error()) + ginReturnError(ct, statusCode, contentType, err.Error()) return } // When shortlink was not found if shortlink == nil { - ginReturnError(c, http.StatusNotFound, contentType, "Shortlink not found") + ginReturnError(ct, http.StatusNotFound, contentType, "Shortlink not found") return } shortlinkSpec := v1alpha1.ShortLinkSpec{} - jsonData, err := ioutil.ReadAll(c.Request.Body) + jsonData, err := ioutil.ReadAll(ct.Request.Body) if err != nil { observability.RecordError(span, s.log, err, "Failed to read request-body") - ginReturnError(c, http.StatusInternalServerError, contentType, err.Error()) + ginReturnError(ct, http.StatusInternalServerError, contentType, err.Error()) return } if err := json.Unmarshal([]byte(jsonData), &shortlinkSpec); err != nil { observability.RecordError(span, s.log, err, "Failed to read ShortLink Spec JSON") - ginReturnError(c, http.StatusInternalServerError, contentType, err.Error()) + ginReturnError(ct, http.StatusInternalServerError, contentType, err.Error()) return } @@ -99,9 +108,9 @@ func (s *ShortlinkController) HandleUpdateShortLink(c *gin.Context) { if err := s.authenticatedClient.Update(ctx, githubUser.Login, shortlink); err != nil { observability.RecordError(span, s.log, err, "Failed to update ShortLink") - ginReturnError(c, http.StatusInternalServerError, contentType, err.Error()) + ginReturnError(ct, http.StatusInternalServerError, contentType, err.Error()) return } - ginReturnError(c, http.StatusOK, contentType, "") + ginReturnError(ct, http.StatusOK, contentType, "") } diff --git a/pkg/controller/helper.go b/pkg/controller/helper.go index 536690b..ebc8cce 100644 --- a/pkg/controller/helper.go +++ b/pkg/controller/helper.go @@ -10,6 +10,7 @@ import ( "github.com/cedi/urlshortener/api/v1alpha1" "github.com/gin-gonic/gin" "github.com/pkg/errors" + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" ) const ( @@ -50,7 +51,7 @@ func ginReturnError(c *gin.Context, statusCode int, contentType string, err stri func getGitHubUserInfo(c context.Context, bearerToken string) (*GithubUser, error) { // prepare request to GitHubs User endpoint - req, err := http.NewRequest(http.MethodGet, "https://api.github.com/user", nil) + req, err := http.NewRequestWithContext(c, http.MethodGet, "https://api.github.com/user", nil) if err != nil { return nil, errors.Wrap(err, "Failed to build request to fetch GitHub API") } @@ -60,7 +61,9 @@ func getGitHubUserInfo(c context.Context, bearerToken string) (*GithubUser, erro req.Header.Add("Authorization", "token "+bearerToken) // Perform request - client := &http.Client{} + client := &http.Client{ + Transport: otelhttp.NewTransport(http.DefaultTransport), + } resp, err := client.Do(req) if err != nil { return nil, errors.Wrap(err, "Failed to fetch UserInfo from GitHub API") @@ -69,7 +72,7 @@ func getGitHubUserInfo(c context.Context, bearerToken string) (*GithubUser, erro // If request was unsuccessful, we error out if resp.StatusCode != 200 { - return nil, fmt.Errorf("Bad credentials") + return nil, fmt.Errorf("bad credentials") } // If successful, we read the response body diff --git a/pkg/model/notallowed_error.go b/pkg/model/notallowed_error.go new file mode 100644 index 0000000..f113065 --- /dev/null +++ b/pkg/model/notallowed_error.go @@ -0,0 +1,25 @@ +package model + +import "fmt" + +type NotAllowedError struct { + Username string + Operation string + ShortlinkName string +} + +func NewNotAllowedError(username, operation, shortlinkName string) *NotAllowedError { + return &NotAllowedError{ + Username: username, + Operation: operation, + ShortlinkName: shortlinkName, + } +} + +func (e *NotAllowedError) Error() string { + return fmt.Sprintf("Operation '%s' for user '%s' is not allowed for ShortLink '%s'", + e.Operation, + e.Username, + e.ShortlinkName, + ) +} diff --git a/pkg/observability/opentelemetry.go b/pkg/observability/opentelemetry.go index 506f213..86e83c8 100644 --- a/pkg/observability/opentelemetry.go +++ b/pkg/observability/opentelemetry.go @@ -37,7 +37,7 @@ func InitTracer(serviceName, serviceVersion string) (*sdkTrace.TracerProvider, t client := otlptracehttp.NewClient(otlpOptions...) - otlptracehttpExporter, err := otlptrace.New(context.TODO(), client) + otlptracehttpExporter, err := otlptrace.New(context.Background(), client) if err != nil { return nil, nil, errors.Wrap(err, "failed creating OTLP trace exporter") } @@ -47,12 +47,21 @@ func InitTracer(serviceName, serviceVersion string) (*sdkTrace.TracerProvider, t return nil, nil, err } - resources := resource.NewWithAttributes( - semconv.SchemaURL, - semconv.ServiceNameKey.String(serviceName), - semconv.ServiceVersionKey.String(serviceVersion), - semconv.ServiceInstanceIDKey.String(hostname), + resources, err := resource.New( + context.Background(), + resource.WithFromEnv(), // pull attributes from OTEL_RESOURCE_ATTRIBUTES and OTEL_SERVICE_NAME environment variables + resource.WithOS(), // This option configures a set of Detectors that discover OS information + resource.WithContainer(), // This option configures a set of Detectors that discover container information + resource.WithHost(), // This option configures a set of Detectors that discover host information + resource.WithAttributes( + semconv.ServiceNameKey.String(serviceName), + semconv.ServiceVersionKey.String(serviceVersion), + semconv.ServiceInstanceIDKey.String(hostname), + ), ) + if err != nil { + return nil, nil, errors.Wrap(err, "failed to build resources") + } traceProvider := sdkTrace.NewTracerProvider( flow.WithBatcher(otlptracehttpExporter), @@ -67,7 +76,7 @@ func InitTracer(serviceName, serviceVersion string) (*sdkTrace.TracerProvider, t ) otel.SetTracerProvider(traceProvider) - otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{})) + otel.SetTextMapPropagator(propagation.TraceContext{}) return traceProvider, trace, nil }