From ea4f32c804ec4a30e4783578c565f11bf42b5079 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Feb 2023 18:02:02 +0000 Subject: [PATCH 1/8] Bump golang.org/x/net from 0.5.0 to 0.7.0 Bumps [golang.org/x/net](https://github.com/golang/net) from 0.5.0 to 0.7.0. - [Release notes](https://github.com/golang/net/releases) - [Commits](https://github.com/golang/net/compare/v0.5.0...v0.7.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: indirect ... Signed-off-by: dependabot[bot] --- go.mod | 8 ++++---- go.sum | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 70f23a27..4e3eaebd 100644 --- a/go.mod +++ b/go.mod @@ -172,12 +172,12 @@ require ( go.opencensus.io v0.24.0 // indirect go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect golang.org/x/crypto v0.5.0 // indirect - golang.org/x/net v0.5.0 // indirect + golang.org/x/net v0.7.0 // indirect golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.4.0 // indirect - golang.org/x/term v0.4.0 // indirect - golang.org/x/text v0.6.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/term v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect golang.org/x/time v0.1.0 // indirect golang.org/x/tools v0.2.0 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/go.sum b/go.sum index 6c06ad57..d47edfd4 100644 --- a/go.sum +++ b/go.sum @@ -1311,8 +1311,8 @@ golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220225172249-27dd8689420f/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= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1451,14 +1451,14 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/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-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= 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= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1469,8 +1469,8 @@ 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-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= From 374fdfa7c2821650822f5866f5c76e191f31c5d0 Mon Sep 17 00:00:00 2001 From: Azanul Date: Mon, 20 Mar 2023 23:37:24 +0530 Subject: [PATCH 2/8] action config creation bug fix Signed-off-by: Azanul --- utils/kubernetes/apply-helm-chart.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/utils/kubernetes/apply-helm-chart.go b/utils/kubernetes/apply-helm-chart.go index 9d8dac48..95688949 100644 --- a/utils/kubernetes/apply-helm-chart.go +++ b/utils/kubernetes/apply-helm-chart.go @@ -404,15 +404,19 @@ func checkIfInstallable(ch *chart.Chart) error { func createHelmActionConfig(c *Client, cfg ApplyHelmChartConfig) (*action.Configuration, error) { // Set the environment variable needed by the Init methods os.Setenv("HELM_DRIVER_SQL_CONNECTION_STRING", cfg.SQLConnectionString) - os.Setenv("HELM_KUBEAPISERVER", c.RestConfig.Host) + // KubeConfig setup cafile, err := setDataAndReturnFileHandler(c.RestConfig.CAData) if err != nil { return nil, err } cafilename := cafile.Name() - os.Setenv("HELM_KUBECAFILE", cafilename) + kubeConfig := genericclioptions.NewConfigFlags(false) + kubeConfig.APIServer = &c.RestConfig.Host + kubeConfig.CAFile = &cafilename + kubeConfig.BearerToken = &c.RestConfig.BearerToken + actionConfig := new(action.Configuration) if err := actionConfig.Init(kubeConfig, cfg.Namespace, string(cfg.HelmDriver), cfg.Logger); err != nil { return nil, ErrApplyHelmChart(err) From ff47415797d52be694a0b8db65da641eedc051f8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 29 Mar 2023 15:46:24 +0000 Subject: [PATCH 3/8] Bump github.com/opencontainers/runc from 1.1.2 to 1.1.5 Bumps [github.com/opencontainers/runc](https://github.com/opencontainers/runc) from 1.1.2 to 1.1.5. - [Release notes](https://github.com/opencontainers/runc/releases) - [Changelog](https://github.com/opencontainers/runc/blob/v1.1.5/CHANGELOG.md) - [Commits](https://github.com/opencontainers/runc/compare/v1.1.2...v1.1.5) --- updated-dependencies: - dependency-name: github.com/opencontainers/runc dependency-type: indirect ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index a0cdf57b..8802e2d4 100644 --- a/go.mod +++ b/go.mod @@ -148,7 +148,7 @@ require ( github.com/novln/docker-parser v1.0.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc2 // indirect - github.com/opencontainers/runc v1.1.2 // indirect + github.com/opencontainers/runc v1.1.5 // indirect github.com/openshift/api v0.0.0-20200803131051-87466835fcc0 // indirect github.com/pelletier/go-toml/v2 v2.0.6 // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect diff --git a/go.sum b/go.sum index 6c06ad57..c3ce8477 100644 --- a/go.sum +++ b/go.sum @@ -924,8 +924,8 @@ github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.0-rc93/go.mod h1:3NOsor4w32B2tC0Zbl8Knk4Wg84SM2ImC1fxBuqJ/H0= github.com/opencontainers/runc v1.0.2/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0= -github.com/opencontainers/runc v1.1.2 h1:2VSZwLx5k/BfsBxMMipG/LYUnmqOD/BPkIVgQUcTlLw= -github.com/opencontainers/runc v1.1.2/go.mod h1:Tj1hFw6eFWp/o33uxGf5yF2BX5yz2Z6iptFpuvbbKqc= +github.com/opencontainers/runc v1.1.5 h1:L44KXEpKmfWDcS02aeGm8QNTFXTo2D+8MYGDIJ/GDEs= +github.com/opencontainers/runc v1.1.5/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.0.1/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.0.2-0.20190207185410-29686dbc5559/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= @@ -1025,7 +1025,7 @@ github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdh github.com/sclevine/spec v1.2.0/go.mod h1:W4J29eT/Kzv7/b9IWLB055Z+qvVC9vt0Arko24q7p+U= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= -github.com/seccomp/libseccomp-golang v0.9.2-0.20210429002308-3879420cc921/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg= +github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg= github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= From 9c16b8cc194fe1d656e96de12f5d7c2d32c337da Mon Sep 17 00:00:00 2001 From: Lee Calcote Date: Tue, 4 Apr 2023 14:20:45 -0500 Subject: [PATCH 4/8] Revert "Bump golang.org/x/net from 0.5.0 to 0.7.0" --- go.mod | 8 ++++---- go.sum | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 4f1662be..8802e2d4 100644 --- a/go.mod +++ b/go.mod @@ -173,12 +173,12 @@ require ( go.opencensus.io v0.24.0 // indirect go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect golang.org/x/crypto v0.5.0 // indirect - golang.org/x/net v0.7.0 // indirect + golang.org/x/net v0.5.0 // indirect golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/term v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + golang.org/x/sys v0.4.0 // indirect + golang.org/x/term v0.4.0 // indirect + golang.org/x/text v0.6.0 // indirect golang.org/x/time v0.1.0 // indirect golang.org/x/tools v0.2.0 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/go.sum b/go.sum index aa855cd3..c3ce8477 100644 --- a/go.sum +++ b/go.sum @@ -1311,8 +1311,8 @@ golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220225172249-27dd8689420f/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.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +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/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1451,14 +1451,14 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/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.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.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/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= 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.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +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/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1469,8 +1469,8 @@ 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.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.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/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= From 228b253ab6bb021a6274a4e1c82dcd84dc6ad5ca Mon Sep 17 00:00:00 2001 From: Ashish Tiwari Date: Fri, 7 Apr 2023 21:07:30 +0530 Subject: [PATCH 5/8] Add support for "isNamespaced" in components generated from CRDs Signed-off-by: Ashish Tiwari --- utils/component/generator.go | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/utils/component/generator.go b/utils/component/generator.go index 97dfa72b..216eb3ce 100644 --- a/utils/component/generator.go +++ b/utils/component/generator.go @@ -1,6 +1,8 @@ package component import ( + "fmt" + "github.com/layer5io/meshkit/models/meshmodel/core/v1alpha1" "github.com/layer5io/meshkit/utils" "github.com/layer5io/meshkit/utils/manifests" @@ -14,6 +16,7 @@ type CuePathConfig struct { GroupPath string VersionPath string SpecPath string + ScopePath string // identifiers are the values that uniquely identify a CRD (in most of the cases, it is the 'Name' field) IdentifierPath string } @@ -23,6 +26,7 @@ var DefaultPathConfig = CuePathConfig{ IdentifierPath: "spec.names.kind", VersionPath: "spec.versions[0].name", GroupPath: "spec.group", + ScopePath: "spec.scope", SpecPath: "spec.versions[0].schema.openAPIV3Schema.properties.spec", } @@ -31,6 +35,7 @@ var DefaultPathConfig2 = CuePathConfig{ IdentifierPath: "spec.names.kind", VersionPath: "spec.versions[0].name", GroupPath: "spec.group", + ScopePath: "spec.scope", SpecPath: "spec.validation.openAPIV3Schema.properties.spec", } @@ -59,8 +64,26 @@ func Generate(crd string) (v1alpha1.ComponentDefinition, error) { if err != nil { return component, err } + group, err := extractCueValueFromPath(crdCue, DefaultPathConfig.GroupPath) + if err != nil { + return component, err + } + scope, err := extractCueValueFromPath(crdCue, DefaultPathConfig.ScopePath) + if err != nil { + // return component, err Ignore error if scope isn't found + } + if scope == "Cluster" { + component.Metadata["isNamespaced"] = false + } else if scope == "Namespaced" { + component.Metadata["isNamespaced"] = true + } component.Kind = name - component.APIVersion = version + if group != "" { + component.APIVersion = fmt.Sprintf("%s/%s", group, version) + } else { + component.APIVersion = version + } + component.Format = v1alpha1.JSON component.DisplayName = manifests.FormatToReadableString(name) return component, nil From d53d02f8252869a4cc7da18c937149229ee4acf3 Mon Sep 17 00:00:00 2001 From: Ashish Tiwari Date: Fri, 7 Apr 2023 21:24:37 +0530 Subject: [PATCH 6/8] fix lint err Signed-off-by: Ashish Tiwari --- utils/component/generator.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/utils/component/generator.go b/utils/component/generator.go index 216eb3ce..0ae123de 100644 --- a/utils/component/generator.go +++ b/utils/component/generator.go @@ -68,10 +68,8 @@ func Generate(crd string) (v1alpha1.ComponentDefinition, error) { if err != nil { return component, err } - scope, err := extractCueValueFromPath(crdCue, DefaultPathConfig.ScopePath) - if err != nil { - // return component, err Ignore error if scope isn't found - } + // return component, err Ignore error if scope isn't found + scope, _ := extractCueValueFromPath(crdCue, DefaultPathConfig.ScopePath) if scope == "Cluster" { component.Metadata["isNamespaced"] = false } else if scope == "Namespaced" { From 3745e89fdff9be73e3e47972ba42696f6b93a1b4 Mon Sep 17 00:00:00 2001 From: Ashish Tiwari Date: Fri, 7 Apr 2023 21:46:19 +0530 Subject: [PATCH 7/8] Make searches on Meshmodel entities case insensitive Signed-off-by: Ashish Tiwari --- models/meshmodel/core/v1alpha1/component.go | 6 +++--- models/meshmodel/core/v1alpha1/relationship.go | 2 +- models/meshmodel/registry.go | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/models/meshmodel/core/v1alpha1/component.go b/models/meshmodel/core/v1alpha1/component.go index 8758a683..ebd9e8a5 100644 --- a/models/meshmodel/core/v1alpha1/component.go +++ b/models/meshmodel/core/v1alpha1/component.go @@ -94,11 +94,11 @@ func GetMeshModelComponents(db *database.Handler, f ComponentFilter) (c []Compon Joins("JOIN category_dbs ON model_dbs.category_id = category_dbs.id") // if f.Greedy { if f.Name != "" && f.DisplayName != "" { - finder = finder.Where("component_definition_dbs.kind LIKE ? OR display_name LIKE ?", "%"+f.Name+"%", f.DisplayName+"%") + finder = finder.Where("component_definition_dbs.kind ILIKE ? OR display_name ILIKE ?", "%"+f.Name+"%", f.DisplayName+"%") } else if f.Name != "" { - finder = finder.Where("component_definition_dbs.kind LIKE ?", "%"+f.Name+"%") + finder = finder.Where("component_definition_dbs.kind ILIKE ?", "%"+f.Name+"%") } else if f.DisplayName != "" { - finder = finder.Where("component_definition_dbs.display_name LIKE ?", "%"+f.DisplayName+"%") + finder = finder.Where("component_definition_dbs.display_name ILIKE ?", "%"+f.DisplayName+"%") } } else { if f.Name != "" { diff --git a/models/meshmodel/core/v1alpha1/relationship.go b/models/meshmodel/core/v1alpha1/relationship.go index 7eaa433a..74c91d16 100644 --- a/models/meshmodel/core/v1alpha1/relationship.go +++ b/models/meshmodel/core/v1alpha1/relationship.go @@ -71,7 +71,7 @@ func GetMeshModelRelationship(db *database.Handler, f RelationshipFilter) (r []R Joins("JOIN category_dbs ON model_dbs.category_id = category_dbs.id") // if f.Kind != "" { if f.Greedy { - finder = finder.Where("relationship_definition_dbs.kind LIKE ?", "%"+f.Kind+"%") + finder = finder.Where("relationship_definition_dbs.kind ILIKE ?", "%"+f.Kind+"%") } else { finder = finder.Where("relationship_definition_dbs.kind = ?", "%"+f.Kind+"%") } diff --git a/models/meshmodel/registry.go b/models/meshmodel/registry.go index 5b2013c9..004cd19c 100644 --- a/models/meshmodel/registry.go +++ b/models/meshmodel/registry.go @@ -198,11 +198,11 @@ func (rm *RegistryManager) GetModels(db *database.Handler, f types.Filter) []v1a if mf, ok := f.(*v1alpha1.ModelFilter); ok { if mf.Greedy { if mf.Name != "" && mf.DisplayName != "" { - finder = finder.Where("model_dbs.name LIKE ? OR model_dbs.display_name LIKE ?", "%"+mf.Name+"%", "%"+mf.DisplayName+"%") + finder = finder.Where("model_dbs.name ILIKE ? OR model_dbs.display_name ILIKE ?", "%"+mf.Name+"%", "%"+mf.DisplayName+"%") } else if mf.Name != "" { - finder = finder.Where("model_dbs.name LIKE ?", "%"+mf.Name+"%") + finder = finder.Where("model_dbs.name ILIKE ?", "%"+mf.Name+"%") } else if mf.DisplayName != "" { - finder = finder.Where("model_dbs.display_name LIKE ?", "%"+mf.DisplayName+"%") + finder = finder.Where("model_dbs.display_name ILIKE ?", "%"+mf.DisplayName+"%") } } else { if mf.Name != "" { @@ -250,7 +250,7 @@ func (rm *RegistryManager) GetCategories(db *database.Handler, f types.Filter) [ if mf, ok := f.(*v1alpha1.CategoryFilter); ok { if mf.Name != "" { if mf.Greedy { - finder = finder.Where("name LIKE ?", "%"+mf.Name+"%") + finder = finder.Where("name ILIKE ?", "%"+mf.Name+"%") } else { finder = finder.Where("name = ?", mf.Name) } From 17573405d86d87e5dfb2a82e62ebdf15200ece85 Mon Sep 17 00:00:00 2001 From: Ashish Tiwari Date: Sat, 8 Apr 2023 03:26:37 +0530 Subject: [PATCH 8/8] Revert "Make searches on Meshmodel entities case insensitive" --- models/meshmodel/core/v1alpha1/component.go | 6 +++--- models/meshmodel/core/v1alpha1/relationship.go | 2 +- models/meshmodel/registry.go | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/models/meshmodel/core/v1alpha1/component.go b/models/meshmodel/core/v1alpha1/component.go index ebd9e8a5..8758a683 100644 --- a/models/meshmodel/core/v1alpha1/component.go +++ b/models/meshmodel/core/v1alpha1/component.go @@ -94,11 +94,11 @@ func GetMeshModelComponents(db *database.Handler, f ComponentFilter) (c []Compon Joins("JOIN category_dbs ON model_dbs.category_id = category_dbs.id") // if f.Greedy { if f.Name != "" && f.DisplayName != "" { - finder = finder.Where("component_definition_dbs.kind ILIKE ? OR display_name ILIKE ?", "%"+f.Name+"%", f.DisplayName+"%") + finder = finder.Where("component_definition_dbs.kind LIKE ? OR display_name LIKE ?", "%"+f.Name+"%", f.DisplayName+"%") } else if f.Name != "" { - finder = finder.Where("component_definition_dbs.kind ILIKE ?", "%"+f.Name+"%") + finder = finder.Where("component_definition_dbs.kind LIKE ?", "%"+f.Name+"%") } else if f.DisplayName != "" { - finder = finder.Where("component_definition_dbs.display_name ILIKE ?", "%"+f.DisplayName+"%") + finder = finder.Where("component_definition_dbs.display_name LIKE ?", "%"+f.DisplayName+"%") } } else { if f.Name != "" { diff --git a/models/meshmodel/core/v1alpha1/relationship.go b/models/meshmodel/core/v1alpha1/relationship.go index 74c91d16..7eaa433a 100644 --- a/models/meshmodel/core/v1alpha1/relationship.go +++ b/models/meshmodel/core/v1alpha1/relationship.go @@ -71,7 +71,7 @@ func GetMeshModelRelationship(db *database.Handler, f RelationshipFilter) (r []R Joins("JOIN category_dbs ON model_dbs.category_id = category_dbs.id") // if f.Kind != "" { if f.Greedy { - finder = finder.Where("relationship_definition_dbs.kind ILIKE ?", "%"+f.Kind+"%") + finder = finder.Where("relationship_definition_dbs.kind LIKE ?", "%"+f.Kind+"%") } else { finder = finder.Where("relationship_definition_dbs.kind = ?", "%"+f.Kind+"%") } diff --git a/models/meshmodel/registry.go b/models/meshmodel/registry.go index 004cd19c..5b2013c9 100644 --- a/models/meshmodel/registry.go +++ b/models/meshmodel/registry.go @@ -198,11 +198,11 @@ func (rm *RegistryManager) GetModels(db *database.Handler, f types.Filter) []v1a if mf, ok := f.(*v1alpha1.ModelFilter); ok { if mf.Greedy { if mf.Name != "" && mf.DisplayName != "" { - finder = finder.Where("model_dbs.name ILIKE ? OR model_dbs.display_name ILIKE ?", "%"+mf.Name+"%", "%"+mf.DisplayName+"%") + finder = finder.Where("model_dbs.name LIKE ? OR model_dbs.display_name LIKE ?", "%"+mf.Name+"%", "%"+mf.DisplayName+"%") } else if mf.Name != "" { - finder = finder.Where("model_dbs.name ILIKE ?", "%"+mf.Name+"%") + finder = finder.Where("model_dbs.name LIKE ?", "%"+mf.Name+"%") } else if mf.DisplayName != "" { - finder = finder.Where("model_dbs.display_name ILIKE ?", "%"+mf.DisplayName+"%") + finder = finder.Where("model_dbs.display_name LIKE ?", "%"+mf.DisplayName+"%") } } else { if mf.Name != "" { @@ -250,7 +250,7 @@ func (rm *RegistryManager) GetCategories(db *database.Handler, f types.Filter) [ if mf, ok := f.(*v1alpha1.CategoryFilter); ok { if mf.Name != "" { if mf.Greedy { - finder = finder.Where("name ILIKE ?", "%"+mf.Name+"%") + finder = finder.Where("name LIKE ?", "%"+mf.Name+"%") } else { finder = finder.Where("name = ?", mf.Name) }