diff --git a/go.mod b/go.mod index 941c9d0756..806f9a8824 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/sashabaranov/go-openai v1.23.0 github.com/schollz/progressbar/v3 v3.14.5 github.com/spf13/cobra v1.8.1 - github.com/spf13/viper v1.18.2 + github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.9.0 golang.org/x/term v0.23.0 helm.sh/helm/v3 v3.15.2 @@ -50,7 +50,7 @@ require ( google.golang.org/api v0.187.0 gopkg.in/yaml.v2 v2.4.0 sigs.k8s.io/controller-runtime v0.18.4 - sigs.k8s.io/gateway-api v1.0.0 + sigs.k8s.io/gateway-api v1.1.0 ) require ( @@ -72,6 +72,7 @@ require ( github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9 // indirect github.com/anchore/go-struct-converter v0.0.0-20230627203149-c72ef8859ca9 // indirect github.com/blang/semver/v4 v4.0.0 // indirect + github.com/cncf/xds/go v0.0.0-20240329184929-0c46c01016dc // indirect github.com/containerd/console v1.0.3 // indirect github.com/containerd/errdefs v0.1.0 // indirect github.com/containerd/log v0.1.0 // indirect @@ -90,6 +91,7 @@ require ( github.com/gookit/color v1.5.4 // indirect github.com/gorilla/websocket v1.5.2 // indirect github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc // indirect + github.com/hashicorp/go-hclog v1.6.3 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jpillora/backoff v1.0.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect @@ -115,6 +117,7 @@ require ( google.golang.org/genproto/googleapis/rpc v0.0.0-20240723171418-e6d459c13d2a // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + gotest.tools/v3 v3.5.0 // indirect knative.dev/pkg v0.0.0-20230616134650-eb63a40adfb0 // indirect ) @@ -172,7 +175,7 @@ require ( github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/hcl v1.0.0 // indirect + github.com/hashicorp/hcl v1.0.1-vault-5 // indirect github.com/huandu/xstrings v1.5.0 // indirect github.com/imdario/mergo v0.3.16 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect @@ -221,7 +224,7 @@ require ( github.com/spdx/tools-golang v0.5.3 // indirect github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.6.0 // indirect - github.com/spf13/pflag v1.0.5 // indirect + github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect @@ -233,7 +236,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 golang.org/x/crypto v0.26.0 // indirect - golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8 // indirect + golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect golang.org/x/net v0.28.0 golang.org/x/oauth2 v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect diff --git a/go.sum b/go.sum index 75e22faf9b..24c81cf966 100644 --- a/go.sum +++ b/go.sum @@ -791,8 +791,8 @@ github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20220314180256-7f1daf1720fc/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20230105202645-06c439db220b/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20240318125728-8a4994d93e50 h1:DBmgJDC9dTfkVyGgipamEh2BpGYxScCH1TOF1LL1cXc= -github.com/cncf/xds/go v0.0.0-20240318125728-8a4994d93e50/go.mod h1:5e1+Vvlzido69INQaVO6d87Qn543Xr6nooe9Kz7oBFM= +github.com/cncf/xds/go v0.0.0-20240329184929-0c46c01016dc h1:Xo7J+m6Iq9pGYXnooTSpxZ11PzNzI7cKU9V81dpKSRQ= +github.com/cncf/xds/go v0.0.0-20240329184929-0c46c01016dc/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= github.com/cohere-ai/cohere-go/v2 v2.7.3 h1:nKr7TpTFbpCMGHWOzWHQc5L/2cEMXQfiGKwf1ofPW2o= github.com/cohere-ai/cohere-go/v2 v2.7.3/go.mod h1:dlDCT66i8BqZDuuskFvYzsrc+O0M4l5J9Ibckoflvt4= github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= @@ -873,6 +873,7 @@ github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0 github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f h1:Wl78ApPPB2Wvf/TIe2xdyJxTlb6obmF18d8QdkxNDu4= github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f/go.mod h1:OSYXu++VVOHnXeitef/D8n/6y4QV8uLHSFXX4NeXMGc= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= @@ -1119,8 +1120,8 @@ github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= -github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= +github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= @@ -1133,8 +1134,8 @@ github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.6.0 h1:uL2shRDx7RTrOrTCUZEGP/wJUFiUI8QT6E7z5o8jga4= github.com/hashicorp/golang-lru v0.6.0/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/hcl v1.0.1-vault-5 h1:kI3hhbbyzr4dldA8UdTb7ZlVVlI2DACdCfz31RPDgJM= +github.com/hashicorp/hcl v1.0.1-vault-5/go.mod h1:XYhtn6ijBSAj6n4YqAaf7RBPS4I06AItNorpy+MoQNM= github.com/hashicorp/hcl/v2 v2.19.1 h1://i05Jqznmb2EXqa39Nsvyan2o5XyMowW5fnCKW5RPI= github.com/hashicorp/hcl/v2 v2.19.1/go.mod h1:ThLC89FV4p9MPW804KVbe/cEXoQ8NZEh+JtMeeGErHE= github.com/hashicorp/nomad/api v0.0.0-20240604134157-e73d8bb1140d h1:KHq+mAzWSkumj4PDoXc5VZbycPGcmYu8tohgVLQ6SIc= @@ -1244,9 +1245,12 @@ github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0 github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/masahiro331/go-xfs-filesystem v0.0.0-20230608043311-a335f4599b70 h1:X6W6raTo07X0q4pvSI/68Pj/Ic4iIU2CfQU65OH0Zhc= github.com/masahiro331/go-xfs-filesystem v0.0.0-20230608043311-a335f4599b70/go.mod h1:QKBZqdn6teT0LK3QhAf3K6xakItd1LonOShOEC44idQ= +github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= @@ -1451,10 +1455,11 @@ github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= -github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= +github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace h1:9PNP1jnUjRhfmGMlkXHjYPishpcw4jpSt/V/xYY3FMA= +github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= +github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -1469,6 +1474,7 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 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.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= 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= @@ -1572,8 +1578,8 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 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-20220827204233-334a2380cb91/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE= -golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8 h1:LoYXNGAShUG3m/ehNk4iFctuhGX/+R1ZpfJ4/ia80JM= -golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI= +golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY= +golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= @@ -1786,6 +1792,7 @@ golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -2238,8 +2245,8 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/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= -gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= -gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g= +gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY= +gotest.tools/v3 v3.5.0/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= helm.sh/helm/v3 v3.15.2 h1:/3XINUFinJOBjQplGnjw92eLGpgXXp1L8chWPkCkDuw= helm.sh/helm/v3 v3.15.2/go.mod h1:FzSIP8jDQaa6WAVg9F+OkKz7J0ZmAga4MABtTbsb9WQ= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -2316,8 +2323,8 @@ 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.18.4 h1:87+guW1zhvuPLh1PHybKdYFLU0YJp4FhJRmiHvm5BZw= sigs.k8s.io/controller-runtime v0.18.4/go.mod h1:TVoGrfdpbA9VRFaRnKgk9P5/atA0pMwq+f+msb9M8Sg= -sigs.k8s.io/gateway-api v1.0.0 h1:iPTStSv41+d9p0xFydll6d7f7MOBGuqXM6p2/zVYMAs= -sigs.k8s.io/gateway-api v1.0.0/go.mod h1:4cUgr0Lnp5FZ0Cdq8FdRwCvpiWws7LVhLHGIudLlf4c= +sigs.k8s.io/gateway-api v1.1.0 h1:DsLDXCi6jR+Xz8/xd0Z1PYl2Pn0TyaFMOPPZIj4inDM= +sigs.k8s.io/gateway-api v1.1.0/go.mod h1:ZH4lHrL2sDi0FHZ9jjneb8kKnGzFWyrTya35sWUTrRs= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/kustomize/api v0.17.2 h1:E7/Fjk7V5fboiuijoZHgs4aHuexi5Y2loXlVOAVAG5g= diff --git a/pkg/ai/prompts.go b/pkg/ai/prompts.go index e9cd480d1d..94fa70374b 100644 --- a/pkg/ai/prompts.go +++ b/pkg/ai/prompts.go @@ -58,6 +58,14 @@ const ( Solution: {kubectl command} ` + + cilium_prompt = `Simplify the following Cilium error messages delimited by triple dashes written in --- %s --- language; --- %s ---. + These errors come from running Cilium status checks in the kubernetes cluster. + Provide step by step instructions to fix, with suggestions, referencing Cilium documentation if relevant. + Write the output in the following format in no more than 300 characters: + Error: {Explain error here} + Solution: {Step by step solution here} + ` ) var PromptMap = map[string]string{ @@ -68,4 +76,5 @@ var PromptMap = map[string]string{ "PrometheusConfigRelabelReport": prom_relabel_prompt, "PolicyReport": kyverno_prompt, "ClusterPolicyReport": kyverno_prompt, + "CiliumStatus": cilium_prompt, } diff --git a/pkg/common/types.go b/pkg/common/types.go index 98c14140c5..1c6e15bdd0 100644 --- a/pkg/common/types.go +++ b/pkg/common/types.go @@ -50,6 +50,7 @@ type PreAnalysis struct { Pod v1.Pod FailureDetails []Failure Deployment appsv1.Deployment + DaemonSet appsv1.DaemonSet ReplicaSet appsv1.ReplicaSet PersistentVolumeClaim v1.PersistentVolumeClaim Endpoint v1.Endpoints diff --git a/pkg/integration/cilium/analyzer.go b/pkg/integration/cilium/analyzer.go new file mode 100644 index 0000000000..e9495f1867 --- /dev/null +++ b/pkg/integration/cilium/analyzer.go @@ -0,0 +1,177 @@ +package cilium + +import ( + "fmt" + + "github.com/k8sgpt-ai/k8sgpt/pkg/common" + "github.com/k8sgpt-ai/k8sgpt/pkg/util" + v1 "k8s.io/api/apps/v1" + ctrl "sigs.k8s.io/controller-runtime/pkg/client" +) + +type CiliumAnalyzer struct { +} + +func (c CiliumAnalyzer) Analyze(a common.Analyzer) ([]common.Result, error) { + results := make([]common.Result, 0) + namespace := "kube-system" + if a.Namespace != "" { + namespace = a.Namespace + } + + ciliumAgentDsResult, err := analyzeDaemonset(a, namespace, "cilium") + if err != nil { + return nil, err + } + results = append(results, ciliumAgentDsResult...) + + ciliumEnvoyDsResult, err := analyzeDaemonset(a, namespace, "cilium-envoy") + if err != nil { + return nil, err + } + results = append(results, ciliumEnvoyDsResult...) + + ciliumOperatorDeployResult, err := analyzeDeployment(a, namespace, "cilium-operator") + if err != nil { + return nil, err + } + results = append(results, ciliumOperatorDeployResult...) + + hubbleRelayDeployResult, err := analyzeDeployment(a, namespace, "hubble-relay") + if err != nil { + return nil, err + } + results = append(results, hubbleRelayDeployResult...) + + hubbleUiDeployResult, err := analyzeDeployment(a, namespace, "hubble-ui") + if err != nil { + return nil, err + } + results = append(results, hubbleUiDeployResult...) + + ciliumClusterMeshDeployResult, err := analyzeDeployment(a, namespace, "clustermesh-apiserver") + if err != nil { + return nil, err + } + results = append(results, ciliumClusterMeshDeployResult...) + + return results, nil +} + +func analyzeDaemonset(a common.Analyzer, namespace string, dsName string) ([]common.Result, error) { + var preAnalysis = map[string]common.PreAnalysis{} + var failures []common.Failure + client := a.Client.CtrlClient + + dsObj := &v1.DaemonSet{} + err := client.Get(a.Context, ctrl.ObjectKey{ + Namespace: namespace, + Name: dsName, + }, dsObj) + if err != nil { + return nil, err + } + + notReady := int(dsObj.Status.DesiredNumberScheduled) - int(dsObj.Status.NumberReady) + if notReady > 0 { + failures = append(failures, common.Failure{ + Text: fmt.Sprintf("%d pods of DaemonSet %s are not ready", notReady, dsName), + Sensitive: []common.Sensitive{}, + }) + } + + if unavailable := int(dsObj.Status.NumberUnavailable) - notReady; unavailable > 0 { + failures = append(failures, common.Failure{ + Text: fmt.Sprintf("%d pods of DaemonSet %s are not available", unavailable, dsName), + Sensitive: []common.Sensitive{}, + }) + } + + if dsObj.Status.UpdatedNumberScheduled < dsObj.Status.DesiredNumberScheduled { + failures = append(failures, common.Failure{ + Text: fmt.Sprintf("DaemonSet %s is rolling out - %d out of %d pods updated", dsName, dsObj.Status.UpdatedNumberScheduled, dsObj.Status.DesiredNumberScheduled), + Sensitive: []common.Sensitive{}, + }) + } + + if len(failures) > 0 { + preAnalysis[fmt.Sprintf("%s/%s", dsObj.Namespace, + dsObj.Name)] = common.PreAnalysis{ + DaemonSet: *dsObj, + FailureDetails: failures, + } + } + + for key, value := range preAnalysis { + var currentAnalysis = common.Result{ + Kind: "DaemonSet", + Name: key, + Error: value.FailureDetails, + } + + parent, _ := util.GetParent(a.Client, value.DaemonSet.ObjectMeta) + currentAnalysis.ParentObject = parent + a.Results = append(a.Results, currentAnalysis) + } + + return a.Results, nil +} + +func analyzeDeployment(a common.Analyzer, namespace string, deployName string) ([]common.Result, error) { + var preAnalysis = map[string]common.PreAnalysis{} + var failures []common.Failure + client := a.Client.CtrlClient + + deployObj := &v1.Deployment{} + err := client.Get(a.Context, ctrl.ObjectKey{ + Namespace: namespace, + Name: deployName, + }, deployObj) + if err != nil { + return nil, err + } + + notReady := int(deployObj.Status.Replicas) - int(deployObj.Status.ReadyReplicas) + if notReady > 0 { + failures = append(failures, common.Failure{ + Text: fmt.Sprintf("%d pods of Deployment %s are not ready", notReady, deployName), + Sensitive: []common.Sensitive{}, + }) + } + + if unavailable := int(deployObj.Status.UnavailableReplicas) - notReady; unavailable > 0 { + failures = append(failures, common.Failure{ + Text: fmt.Sprintf("%d pods of Deployment %s are not available", unavailable, deployName), + Sensitive: []common.Sensitive{}, + }) + } + + if deployObj.Status.UpdatedReplicas < deployObj.Status.Replicas { + failures = append(failures, common.Failure{ + Text: fmt.Sprintf("Deployment %s is rolling out - %d out of %d pods updated", deployName, deployObj.Status.UpdatedReplicas, deployObj.Status.Replicas), + Sensitive: []common.Sensitive{}, + }) + } + + if len(failures) > 0 { + preAnalysis[fmt.Sprintf("%s/%s", deployObj.Namespace, + deployObj.Name)] = common.PreAnalysis{ + Deployment: *deployObj, + FailureDetails: failures, + } + } + + for key, value := range preAnalysis { + var currentAnalysis = common.Result{ + Kind: "Deployment", + Name: key, + Error: value.FailureDetails, + } + + parent, _ := util.GetParent(a.Client, value.Deployment.ObjectMeta) + currentAnalysis.ParentObject = parent + a.Results = append(a.Results, currentAnalysis) + } + + return a.Results, nil +} diff --git a/pkg/integration/cilium/cilium.go b/pkg/integration/cilium/cilium.go new file mode 100644 index 0000000000..710c60ff40 --- /dev/null +++ b/pkg/integration/cilium/cilium.go @@ -0,0 +1,97 @@ +package cilium + +import ( + "os" + + "github.com/fatih/color" + "github.com/k8sgpt-ai/k8sgpt/pkg/common" + "github.com/k8sgpt-ai/k8sgpt/pkg/kubernetes" + "github.com/spf13/viper" +) + +const ( + CiliumAnalyzerName string = "CiliumStatus" +) + +type Cilium struct{} + +func NewCilium() *Cilium { + return &Cilium{} +} + +func (c *Cilium) GetAnalyzerName() []string { + return []string{ + CiliumAnalyzerName, + } +} + +func (c *Cilium) AddAnalyzer(mergedMap *map[string]common.IAnalyzer) { + (*mergedMap)[CiliumAnalyzerName] = &CiliumAnalyzer{} +} + +func (c *Cilium) OwnsAnalyzer(analyzer string) bool { + for _, a := range c.GetAnalyzerName() { + if analyzer == a { + return true + } + } + return false +} + +func (c *Cilium) isDeployed() bool { + kubecontext := viper.GetString("kubecontext") + kubeconfig := viper.GetString("kubeconfig") + client, err := kubernetes.NewClient(kubecontext, kubeconfig) + if err != nil { + // TODO: better error handling + color.Red("Error initialising kubernetes client: %v", err) + os.Exit(1) + } + groups, _, err := client.Client.Discovery().ServerGroupsAndResources() + if err != nil { + // TODO: better error handling + color.Red("Error initialising discovery client: %v", err) + os.Exit(1) + } + + for _, group := range groups { + if group.Name == "cilium.io" { + return true + } + } + + return false +} + +func (c *Cilium) isFilterActive() bool { + activeFilters := viper.GetStringSlice("active_filters") + for _, filter := range c.GetAnalyzerName() { + for _, af := range activeFilters { + if af == filter { + return true + } + } + } + + return false +} + +func (c *Cilium) IsActivate() bool { + if c.isFilterActive() && c.isDeployed() { + return true + } else { + return false + } +} + +func (c *Cilium) Deploy(namespace string) error { + return nil +} + +func (c *Cilium) UnDeploy(_ string) error { + return nil +} + +func (c *Cilium) GetNamespace() (string, error) { + return "", nil +} diff --git a/pkg/integration/integration.go b/pkg/integration/integration.go index c3ad08cf05..bca7c4636b 100644 --- a/pkg/integration/integration.go +++ b/pkg/integration/integration.go @@ -18,6 +18,7 @@ import ( "fmt" "github.com/k8sgpt-ai/k8sgpt/pkg/integration/aws" + "github.com/k8sgpt-ai/k8sgpt/pkg/integration/cilium" "github.com/k8sgpt-ai/k8sgpt/pkg/integration/kyverno" "github.com/k8sgpt-ai/k8sgpt/pkg/common" @@ -54,6 +55,7 @@ var integrations = map[string]IIntegration{ "aws": aws.NewAWS(), "keda": keda.NewKeda(), "kyverno": kyverno.NewKyverno(), + "cilium": cilium.NewCilium(), } func NewIntegration() *Integration {