Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:golangci规范修改part2 #2995

Merged
merged 19 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
8fcc81b
bcs-cluster-reporter规范修改
LidolLxf Feb 28, 2024
ca43887
bcs-storage规范修改
LidolLxf Feb 28, 2024
319075d
bcs-bscp规范修改
LidolLxf Feb 29, 2024
a7e0f1e
bcs-services/bcs-bscp/cmd/vault-server规范修改
LidolLxf Feb 29, 2024
1da30ad
bcs-user-manager规范修改
LidolLxf Feb 29, 2024
e275200
bcs-runtime/bcs-k8s/kubernetes/common规范修改
LidolLxf Feb 29, 2024
052bccd
/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver规范修改
LidolLxf Feb 29, 2024
d4efb34
bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler规范修改
LidolLxf Feb 29, 2024
3291ea3
bcs-netservice-controller、bcs-webhook-server规范修改
LidolLxf Feb 29, 2024
0af5b5e
bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar规范修改
LidolLxf Mar 1, 2024
50acc5f
bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-prox规范修改
LidolLxf Mar 1, 2024
aebdbbc
bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy规范修改
LidolLxf Mar 1, 2024
69c221e
bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-…
LidolLxf Mar 1, 2024
fd88d70
bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-…
LidolLxf Mar 1, 2024
30f1827
bcs-runtime/bcs-k8s/bcs-component/bcs-egress规范修改
LidolLxf Mar 1, 2024
6ef1e88
bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler规范修改
LidolLxf Mar 1, 2024
8ef7425
bcs-runtime/bcs-k8s/bcs-component/bcs-clusternet-controller规范修改
LidolLxf Mar 1, 2024
951288b
bcs-runtime/bcs-k8s/bcs-network规范提交
LidolLxf Mar 1, 2024
91f2eae
Merge branch 'master' into fix_golangci_part2
LidolLxf Mar 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ source:
- /bcs-services/bcs-cluster-manager/internal/cloudprovider/component/.*
- /bcs-services/bcs-cluster-manager/internal/cloudprovider/qcloud/api/common_.*
- /bcs-services/bcs-data-manager/pkg/mock/.*
- /bcs-services/bcs-bscp/test/.*

# 提供产品代码库中工具或框架自动生成的且在代码库中的代码,没有可为空。以便后续代码统计环节进行排除等特殊处理。
auto_generate_source:
Expand Down
21 changes: 10 additions & 11 deletions bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/cmd/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

// Package cmd xxx
package cmd

import (
Expand All @@ -25,18 +25,17 @@ import (
"syscall"
"time"

"github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/health"
ipvsConfig "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/config"
"github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/utils"

"github.com/Tencent/bk-bcs/bcs-common/common"
"github.com/Tencent/bk-bcs/bcs-common/common/blog"
"github.com/gorilla/mux"
"github.com/prometheus/client_golang/prometheus/promhttp"

"github.com/Tencent/bk-bcs/bcs-common/common"
"github.com/Tencent/bk-bcs/bcs-common/common/blog"
"github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/cmd/config"
"github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/endpoint"
"github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/health"
ipvsConfig "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/config"
"github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/service"
"github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/utils"
"github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/utils/sets"
)

Expand Down Expand Up @@ -278,11 +277,11 @@ func (pm *ProxyManager) persistLvsConfig() error {
}

func (pm *ProxyManager) initProxyOptions(options *config.ProxyAPIServerOptions) {
if pm == nil {
if pm == nil { // nolint
blog.Errorf("server failed:%v", ErrProxyManagerNotInited)
}

pm.options = options
pm.options = options // nolint
}

func (pm *ProxyManager) checkVirtualServerIsExist() error {
Expand Down Expand Up @@ -434,7 +433,7 @@ func (pm *ProxyManager) waitQuitHandler() error {
}

quitSignal := make(chan os.Signal, 10)
signal.Notify(quitSignal, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGKILL, syscall.SIGTERM)
signal.Notify(quitSignal, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGKILL, syscall.SIGTERM) // nolint

go func() {
select {
Expand All @@ -456,7 +455,7 @@ func (pm *ProxyManager) close() {
return
}

pm.lvsProxy.DeleteVirtualServer(pm.options.ProxyLvs.VirtualAddress)
pm.lvsProxy.DeleteVirtualServer(pm.options.ProxyLvs.VirtualAddress) // nolint
pm.cancel()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

// Package config xxx
package config

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

// Package main xxx
package main

import (
Expand All @@ -37,23 +37,23 @@ const (
// Operation for operation command
type Operation string

func (o Operation) validate() bool {
func (o Operation) validate() bool { // nolint unused
return o == Init || o == Add || o == Delete || o == Reload
}

func (o Operation) isInitCommand() bool {
func (o Operation) isInitCommand() bool { // nolint unused
return o == Init
}

func (o Operation) isReloadCommand() bool {
func (o Operation) isReloadCommand() bool { // nolint unused
return o == Reload
}

func (o Operation) isAddCommand() bool {
func (o Operation) isAddCommand() bool { // nolint unused
return o == Add
}

func (o Operation) isDeleteCommand() bool {
func (o Operation) isDeleteCommand() bool { // nolint unused
return o == Delete
}

Expand Down Expand Up @@ -97,8 +97,6 @@ func main() {
default:
log.Printf("invalid operation command")
}

return
}

func initFunc() {
Expand Down Expand Up @@ -144,7 +142,6 @@ func initFunc() {
return
}
log.Printf("lvs[%s] init real servers %v successful", opts.virtualServer, opts.realServer)
return
}

func reloadFunc() {
Expand All @@ -171,7 +168,6 @@ func addFunc() {
}

log.Printf("lvs[%s] add real servers %v successful", opts.virtualServer, opts.realServer)
return
}

func deleteFunc() {
Expand All @@ -186,7 +182,6 @@ func deleteFunc() {
}

log.Printf("lvs[%s] delete successful", opts.virtualServer)
return
}

func validateInitOptions(opt options) bool {
Expand All @@ -212,7 +207,8 @@ func init() {
flag.Var(&opts.realServer, "rs", "virtual server backend real server, for example: "+
"-rs=127.0.0.1:6443 -rs=127.0.0.2:6443")
flag.StringVar(&opts.ipvsPersistDir, "persistDir", "/root/.bcs", "persistent ipvs rules path")
flag.StringVar(&opts.toolPath, "toolPath", "/root/bcs-apiserver-proxy-tools", "absolute path for bcs-apiserver-proxy-tools")
flag.StringVar(&opts.toolPath, "toolPath", "/root/bcs-apiserver-proxy-tools",
"absolute path for bcs-apiserver-proxy-tools")
flag.StringVar(&opts.healthScheme, "healthScheme", "https", "scheme for health check")
flag.StringVar(&opts.healthPath, "healthPath", "/healthz", "path for health check")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package main
Expand All @@ -21,9 +20,8 @@ import (

"github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/health"
ipvsConfig "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/config"
"github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/utils"

"github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/service"
"github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/utils"
)

var (
Expand Down Expand Up @@ -81,7 +79,7 @@ func NewLvsCareFromConfig(opts options) (*LvsCare, error) {
type LvsCare struct {
virtualServer string
realServer []string
scheduler Scheduler
scheduler Scheduler // nolint unused
lvs service.LvsProxy
}

Expand Down
5 changes: 2 additions & 3 deletions bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

// Package main xxx
package main

import (
"github.com/Tencent/bk-bcs/bcs-common/common/blog"
"github.com/Tencent/bk-bcs/bcs-common/common/conf"

"github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/cmd"
"github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/cmd/config"
_ "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/utils/metrics"
Expand Down Expand Up @@ -48,6 +49,4 @@ func main() {
if err := proxyManager.Run(); err != nil {
blog.Infof("proxyManager run quit: %v", err)
}

return
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package endpoint
Expand All @@ -17,7 +16,6 @@ import (
"errors"

"github.com/Tencent/bk-bcs/bcs-common/common/blog"

"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package endpoint
Expand All @@ -17,10 +16,11 @@ import (
"context"
"errors"
"fmt"
"k8s.io/client-go/kubernetes"
"os/user"
"testing"

"k8s.io/client-go/kubernetes"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

// Package endpoint xxx
Expand All @@ -21,11 +20,11 @@ import (
"sync"
"time"

"github.com/Tencent/bk-bcs/bcs-common/common/blog"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"

"github.com/Tencent/bk-bcs/bcs-common/common/blog"
"github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/health"
"github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/utils"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package endpoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

// Package health xxx
package health

import (
Expand All @@ -30,6 +30,7 @@ var (
)

// HealthCheck is interface for check addr:port health
// nolint
type HealthCheck interface {
IsHTTPAPIHealth(addr string, port uint32) bool
}
Expand Down Expand Up @@ -61,6 +62,7 @@ func NewHealthConfig(scheme string, path string) (HealthCheck, error) {
}

// HealthConfig conf immutable schem/path
// nolint
type HealthConfig struct {
Shem string
Path string
Expand All @@ -76,6 +78,7 @@ func (hc *HealthConfig) IsHTTPAPIHealth(addr string, port uint32) bool {
url := fmt.Sprintf("%s://%s:%d%s", hc.Shem, addr, port, hc.Path)
client := &http.Client{
Transport: &http.Transport{
// nolint
TLSClientConfig: &tls.Config{
// NOCC:gas/tls(设计如此)
InsecureSkipVerify: true,
Expand All @@ -95,7 +98,7 @@ func (hc *HealthConfig) IsHTTPAPIHealth(addr string, port uint32) bool {
}
defer resp.Body.Close()

if resp.StatusCode != http.StatusOK {
if resp.StatusCode != http.StatusOK { // nolint
return false
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package health
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

// Package config xxx
package config

import (
"fmt"
"github.com/spf13/viper"
"os"
"path"

"github.com/spf13/viper"
)

const (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

// Package exec xxx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/

// Package ipvs xxx
Expand All @@ -30,12 +29,14 @@ type Interface interface {
Flush() error
// AddVirtualServer creates the specified virtual server.
AddVirtualServer(*VirtualServer) error
// UpdateVirtualServer updates an already existing virtual server. If the virtual server does not exist, return error.
// UpdateVirtualServer updates an already existing virtual server.
// If the virtual server does not exist, return error.
UpdateVirtualServer(*VirtualServer) error
// DeleteVirtualServer deletes the specified virtual server. If the virtual server does not exist, return error.
DeleteVirtualServer(*VirtualServer) error
// GetVirtualServer xxx
// Given a partial virtual server, IsVirtualServerAvailable will return the specified virtual server information in the system.
// Given a partial virtual server,
// IsVirtualServerAvailable will return the specified virtual server information in the system.
GetVirtualServer(*VirtualServer) (*VirtualServer, error)
// GetVirtualServers lists all virtual servers in the system.
GetVirtualServers() ([]*VirtualServer, error)
Expand Down
Loading
Loading