From 0dab41fe980269a2b70a68956b05bd80f9b55580 Mon Sep 17 00:00:00 2001 From: wangzhengkun Date: Wed, 25 May 2022 20:58:48 +0800 Subject: [PATCH 1/7] =?UTF-8?q?feat:=20=E5=A4=A7=E5=B0=8F=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/util/mfa/mfa.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/util/mfa/mfa.go b/pkg/util/mfa/mfa.go index 7bfa93228..b2cdd31c4 100644 --- a/pkg/util/mfa/mfa.go +++ b/pkg/util/mfa/mfa.go @@ -20,7 +20,7 @@ func GetOtp(username string) (otp Otp, err error) { secret := gotp.RandomSecret(secretLength) otp.Secret = secret totp := gotp.NewDefaultTOTP(secret) - uri := totp.ProvisioningUri(username, "Kubepi") + uri := totp.ProvisioningUri(username, "KubePi") subImg, err := qrcode.Encode(uri, qrcode.Medium, 256) dist := make([]byte, 3000) base64.StdEncoding.Encode(dist, subImg) From f494bf121df5d3702a690a276b44195e11ae4a8d Mon Sep 17 00:00:00 2001 From: wangzhengkun Date: Thu, 26 May 2022 15:03:12 +0800 Subject: [PATCH 2/7] =?UTF-8?q?feat:=20=E5=9B=9E=E6=BB=9A=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E8=AE=A4=E8=AF=81=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/service/v1/ldap/ldap.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/internal/service/v1/ldap/ldap.go b/internal/service/v1/ldap/ldap.go index 8a806f9df..eeee867b0 100644 --- a/internal/service/v1/ldap/ldap.go +++ b/internal/service/v1/ldap/ldap.go @@ -51,8 +51,7 @@ func (l *service) Create(ldap *v1Ldap.Ldap, options common.DBOptions) error { if err != nil { return err } - username := ldap.Username + "," + ldap.Dn - lc := ldapClient.NewLdapClient(ldap.Address, ldap.Port, username, ldap.Password, ldap.TLS) + lc := ldapClient.NewLdapClient(ldap.Address, ldap.Port, ldap.Username, ldap.Password, ldap.TLS) err = lc.Connect() if err != nil { return err @@ -79,8 +78,7 @@ func (l *service) Update(id string, ldap *v1Ldap.Ldap, options common.DBOptions) if err != nil { return err } - username := ldap.Username + "," + ldap.Dn - lc := ldapClient.NewLdapClient(ldap.Address, ldap.Port, username, ldap.Password, ldap.TLS) + lc := ldapClient.NewLdapClient(ldap.Address, ldap.Port, ldap.Username, ldap.Password, ldap.TLS) if err := lc.Connect(); err != nil { return err } @@ -131,8 +129,7 @@ func (l *service) Login(user v1User.User, password string, options common.DBOpti userFilter = "(" + v + "=" + user.Name + ")" } } - username := ldap.Username + "," + ldap.Dn - lc := ldapClient.NewLdapClient(ldap.Address, ldap.Port, username, ldap.Password, ldap.TLS) + lc := ldapClient.NewLdapClient(ldap.Address, ldap.Port, ldap.Username, ldap.Password, ldap.TLS) if err := lc.Connect(); err != nil { return err } @@ -144,8 +141,7 @@ func (l *service) Sync(id string, options common.DBOptions) error { if err != nil { return err } - username := ldap.Username + "," + ldap.Dn - lc := ldapClient.NewLdapClient(ldap.Address, ldap.Port, username, ldap.Password, ldap.TLS) + lc := ldapClient.NewLdapClient(ldap.Address, ldap.Port, ldap.Username, ldap.Password, ldap.TLS) if err := lc.Connect(); err != nil { return err } From 2dc142582a58dcdcb90f1a41498b51190191bde6 Mon Sep 17 00:00:00 2001 From: wangzhengkun Date: Thu, 26 May 2022 15:06:42 +0800 Subject: [PATCH 3/7] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9LDAP=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/kubepi/src/business/user-management/ldap/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/kubepi/src/business/user-management/ldap/index.vue b/web/kubepi/src/business/user-management/ldap/index.vue index 7be6d065a..458dc2310 100644 --- a/web/kubepi/src/business/user-management/ldap/index.vue +++ b/web/kubepi/src/business/user-management/ldap/index.vue @@ -14,7 +14,7 @@ {{$t('commons.bool.true')}} - + From 078a8a2849259f5c7f3e6014703f9e922ac041cd Mon Sep 17 00:00:00 2001 From: wangzhengkun Date: Thu, 26 May 2022 16:09:30 +0800 Subject: [PATCH 4/7] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9Ldap=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E4=B8=BAV3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 6 ++---- go.sum | 20 +++++++------------- pkg/util/ldap/ldap_client.go | 2 +- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/go.mod b/go.mod index 4f90469a4..50746c6dc 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/docker/docker v20.10.9+incompatible // indirect github.com/fatih/color v1.13.0 // indirect github.com/fsnotify/fsnotify v1.5.1 // indirect - github.com/go-ldap/ldap v3.0.3+incompatible + github.com/go-ldap/ldap/v3 v3.4.1 github.com/go-logr/logr v0.4.0 github.com/gofrs/flock v0.8.1 github.com/golang/snappy v0.0.4 // indirect @@ -36,7 +36,6 @@ require ( golang.org/x/sys v0.0.0-20210927052749-1cf2251ac284 // indirect golang.org/x/text v0.3.6 google.golang.org/protobuf v1.27.1 // indirect - gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d // indirect gopkg.in/igm/sockjs-go.v2 v2.1.0 gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b helm.sh/helm/v3 v3.7.0 @@ -46,8 +45,7 @@ require ( k8s.io/cli-runtime v0.22.1 k8s.io/client-go v0.22.2 k8s.io/klog/v2 v2.9.0 - k8s.io/kubectl v0.22.1 // indirect - sigs.k8s.io/controller-runtime v0.10.3 + k8s.io/kubectl v0.22.1 ) replace github.com/KubeOperator/webkubectl/gotty v0.0.0-20210927072155-e9ce79172471 => ./thirdparty/gotty diff --git a/go.sum b/go.sum index 15fb85eec..016438728 100644 --- a/go.sum +++ b/go.sum @@ -56,6 +56,8 @@ github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935 github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= +github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c h1:/IBSNwUN8+eKzUzbJPqhK839ygXJ82sde8x3ogr6R28= +github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= @@ -145,7 +147,6 @@ github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd3 github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible h1:Ppm0npCCsmuR9oQaBtRuZcmILVE74aXE+AmrJj8L2ns= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= -github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -372,7 +373,6 @@ github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5y github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ= github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v4.11.0+incompatible h1:glyUF9yIYtMHzn8xaKw5rMhdWcwsYV8dZHIq5567/xs= github.com/evanphx/json-patch v4.11.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= @@ -402,6 +402,8 @@ github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYis github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-asn1-ber/asn1-ber v1.5.1 h1:pDbRAunXzIUXfx4CB2QJFv5IuPiuoW+sWvr/Us009o8= +github.com/go-asn1-ber/asn1-ber v1.5.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0= github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -411,8 +413,8 @@ github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3I github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-ldap/ldap v3.0.3+incompatible h1:HTeSZO8hWMS1Rgb2Ziku6b8a7qRIZZMHjsvuZyatzwk= -github.com/go-ldap/ldap v3.0.3+incompatible/go.mod h1:qfd9rJvER9Q0/D/Sqn1DfHRoBp40uXYvFoEVrNEPqRc= +github.com/go-ldap/ldap/v3 v3.4.1 h1:fU/0xli6HY02ocbMuozHAYsaHLcnkLjvho2r5a34BUU= +github.com/go-ldap/ldap/v3 v3.4.1/go.mod h1:iYS1MdmrmceOJ1QOTnRXrIs7i3kloqtmGQjRvjKpyMg= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= @@ -420,7 +422,6 @@ github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7 github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-logr/logr v0.4.0 h1:K7/B1jt6fIBQVd4Owv2MqGQClcgf0R266+7C/QjRcLc= github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= -github.com/go-logr/zapr v0.4.0/go.mod h1:tabnROwaDl0UNxkVeFRbY8bwB37GwRv0P8lg6aAiEnk= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= @@ -631,7 +632,6 @@ github.com/iris-contrib/jade v1.1.4/go.mod h1:EDqR+ur9piDl6DUgs6qRrlfzmlx/D5Uybo github.com/iris-contrib/schema v0.0.6 h1:CPSBLyx2e91H2yJzPuhGuifVRnZBBJ3pCOMbOvPZaTw= github.com/iris-contrib/schema v0.0.6/go.mod h1:iYszG0IOsuIsfzjymw1kMzTL8YQcCWlm65f3wX8J5iA= github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA= -github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik= @@ -1112,7 +1112,6 @@ go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/ go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= -go.uber.org/zap v1.19.0/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181009213950-7c1a557ab941/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -1130,6 +1129,7 @@ golang.org/x/crypto v0.0.0-20191122220453-ac88ee75c92c/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -1350,7 +1350,6 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/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-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210817190340-bfb29a6856f2/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927052749-1cf2251ac284 h1:lBPNCmq8u4zFP3huKCmUQ2Fx8kcY4X+O12UgGnyKsrg= golang.org/x/sys v0.0.0-20210927052749-1cf2251ac284/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= @@ -1439,7 +1438,6 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gomodules.xyz/jsonpatch/v2 v2.2.0/go.mod h1:WXp+iVDkoLQqPudfQ9GBlwB2eZ5DKOnjQZCYdOS8GPY= google.golang.org/api v0.0.0-20160322025152-9bf6e6e569ff/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= @@ -1561,8 +1559,6 @@ google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+Rur google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d h1:TxyelI5cVkbREznMhfzycHdkp5cLA7DpE+GKjSslYhM= -gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -1691,8 +1687,6 @@ rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.14/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.22/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= -sigs.k8s.io/controller-runtime v0.10.3 h1:s5Ttmw/B4AuIbwrXD3sfBkXwnPMMWrqpVj4WRt1dano= -sigs.k8s.io/controller-runtime v0.10.3/go.mod h1:CQp8eyUQZ/Q7PJvnIrB6/hgfTC1kBkGylwsLgOQi1WY= sigs.k8s.io/kustomize/api v0.8.11 h1:LzQzlq6Z023b+mBtc6v72N2mSHYmN8x7ssgbf/hv0H8= sigs.k8s.io/kustomize/api v0.8.11/go.mod h1:a77Ls36JdfCWojpUqR6m60pdGY1AYFix4AH83nJtY1g= sigs.k8s.io/kustomize/cmd/config v0.9.13/go.mod h1:7547FLF8W/lTaDf0BDqFTbZxM9zqwEJqCKN9sSR0xSs= diff --git a/pkg/util/ldap/ldap_client.go b/pkg/util/ldap/ldap_client.go index 91ffc3757..f55d8c6a7 100644 --- a/pkg/util/ldap/ldap_client.go +++ b/pkg/util/ldap/ldap_client.go @@ -4,7 +4,7 @@ import ( "crypto/tls" "errors" "fmt" - "github.com/go-ldap/ldap" + "github.com/go-ldap/ldap/v3" ) type Ldap struct { From 01d424b49963343660a857e7bbe02ffc526f73f8 Mon Sep 17 00:00:00 2001 From: wangzhengkun Date: Thu, 26 May 2022 17:48:42 +0800 Subject: [PATCH 5/7] =?UTF-8?q?feat:=20=E6=96=87=E4=BB=B6=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E6=B8=85=E9=99=A4=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/workloads/pods/podfilebrowser/index.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/web/dashboard/src/business/workloads/pods/podfilebrowser/index.vue b/web/dashboard/src/business/workloads/pods/podfilebrowser/index.vue index 346936a1c..a2087268c 100644 --- a/web/dashboard/src/business/workloads/pods/podfilebrowser/index.vue +++ b/web/dashboard/src/business/workloads/pods/podfilebrowser/index.vue @@ -124,8 +124,9 @@ :title="$t('business.pod.upload')" :visible.sync="openUpload" :close-on-click-modal="false" + :before-close="handleUploadClose" width="30%"> - + {{$t('business.pod.choose_file')}}
{{$t('business.pod.upload_tip')}}
@@ -246,8 +247,13 @@ export default { this.$refs["renameForm"].resetFields() }, openUploadPage() { + this.file= {} this.openUpload = true }, + handleUploadClose() { + this.openUpload = false + this.$refs.upload.clearFiles(); + }, handleFileClose() { this.openAddFile = false this.editFile = false @@ -383,7 +389,7 @@ export default { type: "success", message: this.$t("commons.msg.upload_success"), }) - this.openUpload = false + this.handleUploadClose() }).finally(() => { this.loading = false }) From e4ba9fdd550275dff2a0ac85eacfaba18eedc8ef Mon Sep 17 00:00:00 2001 From: wangzhengkun Date: Thu, 26 May 2022 18:46:11 +0800 Subject: [PATCH 6/7] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9k8s=E8=AE=A4?= =?UTF-8?q?=E8=AF=81=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/service/v1/file/file.go | 59 +++++--------------------------- pkg/util/podbase/kotool.go | 7 +++- 2 files changed, 15 insertions(+), 51 deletions(-) diff --git a/internal/service/v1/file/file.go b/internal/service/v1/file/file.go index e2ee91a0b..d53cad85a 100644 --- a/internal/service/v1/file/file.go +++ b/internal/service/v1/file/file.go @@ -6,9 +6,10 @@ import ( "github.com/KubeOperator/kubepi/internal/model/v1/file" "github.com/KubeOperator/kubepi/internal/service/v1/cluster" "github.com/KubeOperator/kubepi/internal/service/v1/common" + kubeClient "github.com/KubeOperator/kubepi/pkg/kubernetes" "github.com/KubeOperator/kubepi/pkg/util" - "github.com/KubeOperator/kubepi/pkg/util/kubernetes" "github.com/KubeOperator/kubepi/pkg/util/podbase" + "k8s.io/client-go/kubernetes" "os" "path" "path/filepath" @@ -74,26 +75,6 @@ func (f service) DownloadFile(request file.Request) (string, error) { if err != nil { return fileP, err } - //clu, err := f.clusterService.Get(request.Cluster, common.DBOptions{}) - //if err != nil { - // return fileP, err - //} - //config := &kubernetes.Config{ - // Host: clu.Spec.Connect.Forward.ApiServer, - // Token: clu.Spec.Authentication.BearerToken, - //} - //k8sConfig := kubernetes.NewClusterConfig(config) - //k8sClient, err := kubernetes.NewKubernetesClient(config) - //if err != nil { - // return fileP, err - //} - //pb := podbase.PodBase{ - // Namespace: request.Namespace, - // PodName: request.PodName, - // Container: request.ContainerName, - // K8sClient: k8sClient, - // RestClient: k8sConfig, - //} exec := pb.NewPodExec() fileNameWithSuffix := path.Base(request.Path) fileType := path.Ext(fileNameWithSuffix) @@ -113,28 +94,6 @@ func (f service) DownloadFile(request file.Request) (string, error) { } func (f service) UploadFile(request file.Request) error { - //clu, err := f.clusterService.Get(request.Cluster, common.DBOptions{}) - //if err != nil { - // return err - //} - //config := &kubernetes.Config{ - // Host: clu.Spec.Connect.Forward.ApiServer, - // Token: clu.Spec.Authentication.BearerToken, - //} - //k8sConfig := kubernetes.NewClusterConfig(config) - //k8sClient, err := kubernetes.NewKubernetesClient(config) - //if err != nil { - // return err - //} - //pb := podbase.PodBase{ - // Namespace: request.Namespace, - // PodName: request.PodName, - // Container: request.ContainerName, - // K8sClient: k8sClient, - // RestClient: k8sConfig, - //} - //exec := pb.NewPodExec() - pb, err := f.GetPodBase(request) if err != nil { return err @@ -153,12 +112,12 @@ func (f service) GetPodBase(request file.Request) (podbase.PodBase, error) { if err != nil { return pb, err } - config := &kubernetes.Config{ - Host: clu.Spec.Connect.Forward.ApiServer, - Token: clu.Spec.Authentication.BearerToken, + client := kubeClient.Kubernetes{clu} + config, err := client.Config() + if err != nil { + return pb, err } - k8sConfig := kubernetes.NewClusterConfig(config) - k8sClient, err := kubernetes.NewKubernetesClient(config) + clientset, err := kubernetes.NewForConfig(config) if err != nil { return pb, err } @@ -166,8 +125,8 @@ func (f service) GetPodBase(request file.Request) (podbase.PodBase, error) { Namespace: request.Namespace, PodName: request.PodName, Container: request.ContainerName, - K8sClient: k8sClient, - RestClient: k8sConfig, + K8sClient: clientset, + RestClient: config, } return pb, nil } diff --git a/pkg/util/podbase/kotool.go b/pkg/util/podbase/kotool.go index 755a3b81c..591cc0ffc 100644 --- a/pkg/util/podbase/kotool.go +++ b/pkg/util/podbase/kotool.go @@ -13,7 +13,9 @@ import ( "strings" ) -const KotoolsPath = "/kotools" +const KotoolsPath = "/Users/zk.wang/go/src/github.com/KubeOperator/kotools/utils/binary" + +//const KotoolsPath = "/kotools" type PodBase struct { Namespace string @@ -41,6 +43,9 @@ func (p *PodBase) PodInfo() (*coreV1.Pod, error) { func (p *PodBase) OsAndArch(nodeName string) (osType string, arch string) { // get pod system arch and type + osType = "linux" + arch = "amd64" + node, err := p.K8sClient.CoreV1().Nodes(). Get(context.TODO(), nodeName, metaV1.GetOptions{}) if err == nil { From 191617fc46baf0c3bacfb112ad361abf75b14f61 Mon Sep 17 00:00:00 2001 From: wangzhengkun Date: Thu, 26 May 2022 18:47:38 +0800 Subject: [PATCH 7/7] =?UTF-8?q?feat:=20=E5=88=A0=E9=99=A4=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/util/podbase/kotool.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/util/podbase/kotool.go b/pkg/util/podbase/kotool.go index 591cc0ffc..b6d56abfa 100644 --- a/pkg/util/podbase/kotool.go +++ b/pkg/util/podbase/kotool.go @@ -13,9 +13,7 @@ import ( "strings" ) -const KotoolsPath = "/Users/zk.wang/go/src/github.com/KubeOperator/kotools/utils/binary" - -//const KotoolsPath = "/kotools" +const KotoolsPath = "/kotools" type PodBase struct { Namespace string