diff --git a/go.mod b/go.mod index 1c51032..3fcd51b 100644 --- a/go.mod +++ b/go.mod @@ -19,6 +19,7 @@ require ( require ( github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/acroca/go-symbols v0.1.1 // indirect github.com/cilium/ebpf v0.12.3 // indirect github.com/containerd/log v0.1.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -48,6 +49,7 @@ require ( github.com/imdario/mergo v0.3.16 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/karrick/godirwalk v1.17.0 // indirect github.com/klauspost/compress v1.17.9 // indirect github.com/klauspost/cpuid/v2 v2.2.8 // indirect github.com/mailru/easyjson v0.7.7 // indirect @@ -60,13 +62,16 @@ require ( github.com/morikuni/aec v1.0.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect + github.com/nsf/gocode v0.0.0-20230322162601-b672b49f3818 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/ramya-rao-a/go-outline v0.0.0-20210608161538-9736a4bde949 // indirect github.com/rs/xid v1.5.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/objx v0.5.2 // indirect + github.com/uudashr/gopkgs v1.3.2 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect go.opentelemetry.io/otel v1.26.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.26.0 // indirect @@ -75,17 +80,18 @@ require ( go.opentelemetry.io/otel/trace v1.26.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/crypto v0.26.0 // indirect + golang.org/x/crypto v0.27.0 // indirect golang.org/x/exp v0.0.0-20240213143201-ec583247a57a // indirect - golang.org/x/mod v0.20.0 // indirect - golang.org/x/net v0.28.0 // indirect + golang.org/x/mod v0.21.0 // indirect + golang.org/x/net v0.29.0 // indirect golang.org/x/oauth2 v0.17.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.23.0 // indirect - golang.org/x/term v0.23.0 // indirect - golang.org/x/text v0.17.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/term v0.24.0 // indirect + golang.org/x/text v0.18.0 // indirect golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.24.0 // indirect + golang.org/x/tools v0.25.0 // indirect + golang.org/x/tools/cmd/guru v0.1.1-deprecated // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect diff --git a/go.sum b/go.sum index 247036d..1475751 100644 --- a/go.sum +++ b/go.sum @@ -5,6 +5,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/acroca/go-symbols v0.1.1 h1:q3IzaMNYocw/Bnc2a8jkXf0hM3+POfLoq30x8HYuaPE= +github.com/acroca/go-symbols v0.1.1/go.mod h1:RKAIDWtcELAw6/wjNJGWRYZ7QEinSWoJeJ2H5cfK6AM= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/celestiaorg/bittwister v0.0.0-20231213180407-65cdbaf5b8c7 h1:nxplQi8wrLMjhu260RuigXylC3pWoDu4OVumPHeojnk= @@ -101,6 +103,8 @@ github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8Hm github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/karrick/godirwalk v1.17.0 h1:b4kY7nqDdioR/6qnbHQyDvmA17u5G1cZ6J+CZXwSWoI= +github.com/karrick/godirwalk v1.17.0/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= @@ -139,6 +143,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= +github.com/nsf/gocode v0.0.0-20230322162601-b672b49f3818 h1:btvxUuer0DCdhu/N5fvMxW759ASqzIsm6cF8D23TNYs= +github.com/nsf/gocode v0.0.0-20230322162601-b672b49f3818/go.mod h1:6Q8/OMaaKAgTX7/jt2bOXVDrm1eJhoNd+iwzghR7jvs= github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY= github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM= github.com/onsi/gomega v1.31.0 h1:54UJxxj6cPInHS3a35wm6BK/F9nHYueZ1NVujHDrnXE= @@ -155,6 +161,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN 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/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/ramya-rao-a/go-outline v0.0.0-20210608161538-9736a4bde949 h1:iaD+iVf9xGfajsJp+zYrg9Lrk6gMJ6/hZHO4cYq5D5o= +github.com/ramya-rao-a/go-outline v0.0.0-20210608161538-9736a4bde949/go.mod h1:9V3eNbj9Z53yO7cKB6cSX9f0O7rYdIiuGBhjA1YsQuw= github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= @@ -181,8 +189,11 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO 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/uudashr/gopkgs v1.3.2 h1:ACme7LZyeSNIRIl9HtAA0RsT0eePUsrkHDVb2+aswhg= +github.com/uudashr/gopkgs v1.3.2/go.mod h1:MtCdKVJkxW7hNKWXPNWfpaeEp8+Ml3Q8myb4yWhn2Hg= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= @@ -212,6 +223,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20240213143201-ec583247a57a h1:HinSgX1tJRX3KsL//Gxynpw5CTOAIPhgL4W8PNiIpVE= golang.org/x/exp v0.0.0-20240213143201-ec583247a57a/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= @@ -220,9 +233,12 @@ golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvx golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 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.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= +golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= 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= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -233,9 +249,12 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= @@ -244,6 +263,7 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= @@ -255,6 +275,8 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -263,10 +285,14 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= +golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= +golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -274,6 +300,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -284,9 +312,14 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= +golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= +golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools/cmd/guru v0.1.1-deprecated h1:WiL3pQGXG71u4N45C0eRkE2IcEMAiQdDZ2H5lGspNjM= +golang.org/x/tools/cmd/guru v0.1.1-deprecated/go.mod h1:yFb7vixnH8+ByFZ63niwlvUUxyTE/6ULZ6AiEHZwlTk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/pkg/k8s/configmap.go b/pkg/k8s/configmap.go index 091cf94..da18a4c 100644 --- a/pkg/k8s/configmap.go +++ b/pkg/k8s/configmap.go @@ -33,6 +33,10 @@ func (c *Client) CreateConfigMap( ctx context.Context, name string, labels, data map[string]string, ) (*v1.ConfigMap, error) { + if c.terminated { + return nil, ErrClientTerminated + } + if err := validateConfigMapName(name); err != nil { return nil, err } diff --git a/pkg/k8s/custom_resource.go b/pkg/k8s/custom_resource.go index f174411..28f9d32 100644 --- a/pkg/k8s/custom_resource.go +++ b/pkg/k8s/custom_resource.go @@ -17,6 +17,9 @@ func (c *Client) CreateCustomResource( gvr *schema.GroupVersionResource, obj *map[string]interface{}, ) error { + if c.terminated { + return ErrClientTerminated + } if err := validateCustomResourceName(name); err != nil { return err } diff --git a/pkg/k8s/daemonset.go b/pkg/k8s/daemonset.go index 8f8c6c3..e0f90ec 100644 --- a/pkg/k8s/daemonset.go +++ b/pkg/k8s/daemonset.go @@ -36,6 +36,9 @@ func (c *Client) CreateDaemonSet( initContainers []v1.Container, containers []v1.Container, ) (*appv1.DaemonSet, error) { + if c.terminated { + return nil, ErrClientTerminated + } if err := validateDaemonSetName(name); err != nil { return nil, err } diff --git a/pkg/k8s/deployment.go b/pkg/k8s/deployment.go index ab26327..1211435 100644 --- a/pkg/k8s/deployment.go +++ b/pkg/k8s/deployment.go @@ -10,6 +10,10 @@ import ( func (c *Client) WaitForDeployment(ctx context.Context, name string) error { for { + if c.terminated { + return ErrClientTerminated + } + deployment, err := c.clientset.AppsV1(). Deployments(c.namespace).Get(ctx, name, metav1.GetOptions{}) if err != nil && !errors.IsNotFound(err) { diff --git a/pkg/k8s/errors.go b/pkg/k8s/errors.go index 6892514..0d0d9ee 100644 --- a/pkg/k8s/errors.go +++ b/pkg/k8s/errors.go @@ -133,6 +133,7 @@ var ( ErrInvalidServiceAccountName = errors.New("InvalidServiceAccountName", "invalid service account name %s: %v") ErrInvalidClusterRoleBindingName = errors.New("InvalidClusterRoleBindingName", "invalid cluster role binding name %s: %v") ErrInvalidServiceName = errors.New("InvalidServiceName", "invalid service name %s: %v") + ErrClientTerminated = errors.New("ClientTerminated", "terminated by user") ErrListingPods = errors.New("ListingPods", "failed to list pods") ErrGetPodStatus = errors.New("GetPodStatus", "failed to get pod status for pod %s") ) diff --git a/pkg/k8s/k8s.go b/pkg/k8s/k8s.go index 4c7450c..94024a7 100644 --- a/pkg/k8s/k8s.go +++ b/pkg/k8s/k8s.go @@ -40,6 +40,7 @@ type Client struct { dynamicClient dynamic.Interface namespace string logger *logrus.Logger + terminated bool // This flag is used to indicate that the process has been terminated by the user // max duration for any pod to be in pending state, otherwise it triggers a notice to be shown maxPendingDuration time.Duration } @@ -87,6 +88,7 @@ func NewClientCustom( dynamicClient: dC, namespace: namespace, logger: logger, + terminated: false, maxPendingDuration: defaultMaxPendingDuration, } kc.namespace = SanitizeName(namespace) @@ -97,6 +99,10 @@ func NewClientCustom( return kc, nil } +func (c *Client) Terminate() { + c.terminated = true +} + func (c *Client) Clientset() kubernetes.Interface { return c.clientset } diff --git a/pkg/k8s/namespace.go b/pkg/k8s/namespace.go index 92caadd..308922e 100644 --- a/pkg/k8s/namespace.go +++ b/pkg/k8s/namespace.go @@ -9,6 +9,9 @@ import ( ) func (c *Client) CreateNamespace(ctx context.Context, name string) error { + if c.terminated { + return ErrClientTerminated + } if err := validateNamespace(name); err != nil { return err } diff --git a/pkg/k8s/networkpolicy.go b/pkg/k8s/networkpolicy.go index 77321aa..71f2064 100644 --- a/pkg/k8s/networkpolicy.go +++ b/pkg/k8s/networkpolicy.go @@ -14,6 +14,9 @@ func (c *Client) CreateNetworkPolicy( ingressSelectorMap, egressSelectorMap map[string]string, ) error { + if c.terminated { + return ErrClientTerminated + } if err := validateNetworkPolicyName(name); err != nil { return err } diff --git a/pkg/k8s/pod.go b/pkg/k8s/pod.go index 10ae7d3..0127d5d 100644 --- a/pkg/k8s/pod.go +++ b/pkg/k8s/pod.go @@ -77,6 +77,9 @@ type File struct { // DeployPod creates a new pod in the namespace that k8s client is initiate with if it doesn't already exist. func (c *Client) DeployPod(ctx context.Context, podConfig PodConfig, init bool) (*v1.Pod, error) { + if c.terminated { + return nil, ErrClientTerminated + } if err := validatePodConfig(podConfig); err != nil { return nil, err } @@ -344,6 +347,9 @@ func (c *Client) PortForwardPod( } func (c *Client) getPod(ctx context.Context, name string) (*v1.Pod, error) { + if c.terminated { + return nil, ErrClientTerminated + } return c.clientset.CoreV1().Pods(c.namespace).Get(ctx, name, metav1.GetOptions{}) } diff --git a/pkg/k8s/pvc.go b/pkg/k8s/pvc.go index a39b2ed..a6a8f5f 100644 --- a/pkg/k8s/pvc.go +++ b/pkg/k8s/pvc.go @@ -16,6 +16,9 @@ func (c *Client) CreatePersistentVolumeClaim( labels map[string]string, size resource.Quantity, ) error { + if c.terminated { + return ErrClientTerminated + } if err := validatePVCName(name); err != nil { return err } diff --git a/pkg/k8s/replicaset.go b/pkg/k8s/replicaset.go index 3749daf..243d56b 100644 --- a/pkg/k8s/replicaset.go +++ b/pkg/k8s/replicaset.go @@ -22,6 +22,9 @@ type ReplicaSetConfig struct { // CreateReplicaSet creates a new replicaSet in namespace that k8s is initialized with if it doesn't already exist. func (c *Client) CreateReplicaSet(ctx context.Context, rsConfig ReplicaSetConfig, init bool) (*appv1.ReplicaSet, error) { + if c.terminated { + return nil, ErrClientTerminated + } if err := validateReplicaSetConfig(rsConfig); err != nil { return nil, err } @@ -118,6 +121,9 @@ func (c *Client) GetFirstPodFromReplicaSet(ctx context.Context, name string) (*v } func (c *Client) getReplicaSet(ctx context.Context, name string) (*appv1.ReplicaSet, error) { + if c.terminated { + return nil, ErrClientTerminated + } return c.clientset.AppsV1().ReplicaSets(c.namespace).Get(ctx, name, metav1.GetOptions{}) } diff --git a/pkg/k8s/role.go b/pkg/k8s/role.go index a3c58dc..ba5a805 100644 --- a/pkg/k8s/role.go +++ b/pkg/k8s/role.go @@ -14,6 +14,9 @@ func (c *Client) CreateRole( labels map[string]string, policyRules []rbacv1.PolicyRule, ) error { + if c.terminated { + return ErrClientTerminated + } if err := validateRoleName(name); err != nil { return err } @@ -47,6 +50,9 @@ func (c *Client) CreateClusterRole( labels map[string]string, policyRules []rbacv1.PolicyRule, ) error { + if c.terminated { + return ErrClientTerminated + } if err := validateClusterRoleName(name); err != nil { return err } diff --git a/pkg/k8s/rolebinding.go b/pkg/k8s/rolebinding.go index 9d7a498..760821f 100644 --- a/pkg/k8s/rolebinding.go +++ b/pkg/k8s/rolebinding.go @@ -14,6 +14,9 @@ func (c *Client) CreateRoleBinding( labels map[string]string, role, serviceAccount string, ) error { + if c.terminated { + return ErrClientTerminated + } if err := validateRoleBindingName(name); err != nil { return err } @@ -60,6 +63,9 @@ func (c *Client) CreateClusterRoleBinding( labels map[string]string, clusterRole, serviceAccount string, ) error { + if c.terminated { + return ErrClientTerminated + } if err := validateClusterRoleBindingName(name); err != nil { return err } diff --git a/pkg/k8s/service.go b/pkg/k8s/service.go index 7650ea6..1e4e4cb 100644 --- a/pkg/k8s/service.go +++ b/pkg/k8s/service.go @@ -14,6 +14,9 @@ import ( ) func (c *Client) GetService(ctx context.Context, name string) (*v1.Service, error) { + if c.terminated { + return nil, ErrClientTerminated + } return c.clientset.CoreV1().Services(c.namespace).Get(ctx, name, metav1.GetOptions{}) } @@ -25,6 +28,9 @@ func (c *Client) CreateService( portsTCP, portsUDP []int, ) (*v1.Service, error) { + if c.terminated { + return nil, ErrClientTerminated + } if err := validateServiceName(name); err != nil { return nil, err } @@ -61,6 +67,9 @@ func (c *Client) PatchService( portsTCP, portsUDP []int, ) (*v1.Service, error) { + if c.terminated { + return nil, ErrClientTerminated + } if err := validateServiceName(name); err != nil { return nil, err } diff --git a/pkg/k8s/serviceaccount.go b/pkg/k8s/serviceaccount.go index b9c1214..00f5ff9 100644 --- a/pkg/k8s/serviceaccount.go +++ b/pkg/k8s/serviceaccount.go @@ -8,6 +8,9 @@ import ( ) func (c *Client) CreateServiceAccount(ctx context.Context, name string, labels map[string]string) error { + if c.terminated { + return ErrClientTerminated + } if err := validateServiceName(name); err != nil { return err } @@ -28,5 +31,8 @@ func (c *Client) CreateServiceAccount(ctx context.Context, name string, labels m } func (c *Client) DeleteServiceAccount(ctx context.Context, name string) error { + if c.terminated { + return ErrClientTerminated + } return c.clientset.CoreV1().ServiceAccounts(c.namespace).Delete(ctx, name, metav1.DeleteOptions{}) } diff --git a/pkg/k8s/types.go b/pkg/k8s/types.go index a6db04f..1fe3d50 100644 --- a/pkg/k8s/types.go +++ b/pkg/k8s/types.go @@ -74,6 +74,7 @@ type KubeManager interface { UpdateDaemonSet(ctx context.Context, name string, labels map[string]string, initContainers []corev1.Container, containers []corev1.Container) (*appv1.DaemonSet, error) WaitForDeployment(ctx context.Context, name string) error WaitForService(ctx context.Context, name string) error + Terminate() AllPodsStatuses(ctx context.Context) ([]PodStatus, error) PodStatus(ctx context.Context, name string) (PodStatus, error) PrintAllPodsStatuses(ctx context.Context) error diff --git a/pkg/knuu/knuu.go b/pkg/knuu/knuu.go index 3d2fcd9..06e84e5 100644 --- a/pkg/knuu/knuu.go +++ b/pkg/knuu/knuu.go @@ -7,6 +7,7 @@ import ( "os" "os/signal" "strings" + "sync" "syscall" "time" @@ -29,12 +30,16 @@ const ( // FIXME: use supported kubernetes version images (use of latest could break) (https://github.com/celestiaorg/knuu/issues/116) timeoutHandlerImage = "docker.io/bitnami/kubectl:latest" + timeoutHandlerNameStop = timeoutHandlerName + "-stop" + timeoutHandlerTimeout = 1 * time.Second + ExitCodeSIGINT = 130 + TimeFormat = "20060102T150405Z" ) type Knuu struct { *system.SystemDependencies - timeout time.Duration + stopMu sync.Mutex } type Options struct { @@ -61,13 +66,19 @@ func New(ctx context.Context, opts Options) (*Knuu, error) { Scope: opts.Scope, StartTime: time.Now().UTC().Format(TimeFormat), }, - timeout: opts.Timeout, } if err := setDefaults(ctx, k); err != nil { return nil, err } + if opts.Timeout == 0 { + opts.Timeout = defaultTimeout + } + if err := k.handleTimeout(ctx, opts.Timeout, timeoutHandlerName); err != nil { + return nil, ErrHandleTimeout.Wrap(err) + } + if opts.ProxyEnabled { if err := setupProxy(ctx, k); err != nil { return nil, err @@ -87,14 +98,20 @@ func (k *Knuu) HandleStopSignal(ctx context.Context) { go func() { <-stop k.Logger.Info("Received signal to stop, cleaning up resources...") - if err := k.CleanUp(ctx); err != nil { - k.Logger.WithError(err).Error("deleting namespace") + // Lock the stop mutex to prevent multiple stop signals from being processed concurrently + k.stopMu.Lock() + defer k.stopMu.Unlock() + err := k.handleTimeout(ctx, timeoutHandlerTimeout, timeoutHandlerNameStop) + if err != nil { + k.Logger.Errorf("Error cleaning up resources with timeout handler: %v", err) } + k.K8sClient.Terminate() + os.Exit(ExitCodeSIGINT) }() } // handleTimeout creates a timeout handler that will delete all resources with the scope after the timeout -func (k *Knuu) handleTimeout(ctx context.Context) error { +func (k *Knuu) handleTimeout(ctx context.Context, timeout time.Duration, timeoutHandlerName string) error { inst, err := k.NewInstance(timeoutHandlerName) if err != nil { return ErrCannotCreateInstance.Wrap(err) @@ -112,7 +129,7 @@ func (k *Knuu) handleTimeout(ctx context.Context) error { // Wait for a specific period before executing the next operation. // This is useful to ensure that any previous operation has time to complete. - commands = append(commands, fmt.Sprintf("sleep %d", int64(k.timeout.Seconds()))) + commands = append(commands, fmt.Sprintf("sleep %d", int64(timeout.Seconds()))) // Collects all resources (pods, services, etc.) within the specified namespace that match a specific label, excluding certain types, // and then deletes them. This is useful for cleaning up specific test resources before proceeding to delete the namespace. commands = append(commands, @@ -184,10 +201,6 @@ func setDefaults(ctx context.Context, k *Knuu) error { } k.Scope = k8s.SanitizeName(k.Scope) - if k.timeout == 0 { - k.timeout = defaultTimeout - } - if k.K8sClient == nil { var err error k.K8sClient, err = k8s.NewClient(ctx, k.Scope, k.Logger) @@ -196,10 +209,6 @@ func setDefaults(ctx context.Context, k *Knuu) error { } } - if err := k.handleTimeout(ctx); err != nil { - return ErrHandleTimeout.Wrap(err) - } - if k.ImageBuilder == nil { k.ImageBuilder = &kaniko.Kaniko{ SystemDependencies: k.SystemDependencies, diff --git a/pkg/knuu/knuu_test.go b/pkg/knuu/knuu_test.go index 03f55d6..b2c5dd5 100644 --- a/pkg/knuu/knuu_test.go +++ b/pkg/knuu/knuu_test.go @@ -74,7 +74,7 @@ func TestNew(t *testing.T) { assert.NotNil(t, k.K8sClient) assert.NotNil(t, k.ImageBuilder) assert.NotEmpty(t, k.Scope) - assert.Equal(t, defaultTimeout, k.timeout) + assert.Equal(t, defaultTimeout, defaultTimeout, timeoutHandlerName) }, }, { @@ -106,17 +106,6 @@ func TestNew(t *testing.T) { assert.NotNil(t, k.Logger) }, }, - { - name: "With custom Timeout", - options: Options{ - Timeout: 30 * time.Minute, - }, - expectedError: nil, - validateFunc: func(t *testing.T, k *Knuu) { - assert.NotNil(t, k) - assert.Equal(t, 30*time.Minute, k.timeout) - }, - }, { name: "With custom Image Builder", options: Options{