diff --git a/.code.yml b/.code.yml index 3e03d8403d..d9f4ba0f26 100644 --- a/.code.yml +++ b/.code.yml @@ -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: diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/cmd/app.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/cmd/app.go index a1b9370e66..87b6e46efb 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/cmd/app.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/cmd/app.go @@ -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 ( @@ -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" ) @@ -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 { @@ -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 { @@ -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() } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/cmd/config/options.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/cmd/config/options.go index b1bd5d36ff..c0752c0c6b 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/cmd/config/options.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/cmd/config/options.go @@ -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 ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/ipvs_tools/main.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/ipvs_tools/main.go index 4b27108793..03447c845d 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/ipvs_tools/main.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/ipvs_tools/main.go @@ -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 ( @@ -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 } @@ -97,8 +97,6 @@ func main() { default: log.Printf("invalid operation command") } - - return } func initFunc() { @@ -144,7 +142,6 @@ func initFunc() { return } log.Printf("lvs[%s] init real servers %v successful", opts.virtualServer, opts.realServer) - return } func reloadFunc() { @@ -171,7 +168,6 @@ func addFunc() { } log.Printf("lvs[%s] add real servers %v successful", opts.virtualServer, opts.realServer) - return } func deleteFunc() { @@ -186,7 +182,6 @@ func deleteFunc() { } log.Printf("lvs[%s] delete successful", opts.virtualServer) - return } func validateInitOptions(opt options) bool { @@ -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") diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/ipvs_tools/service.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/ipvs_tools/service.go index 9cd91d985d..e0a89573f2 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/ipvs_tools/service.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/ipvs_tools/service.go @@ -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 @@ -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 ( @@ -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 } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/main.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/main.go index 2ba2229d5f..620b204805 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/main.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/main.go @@ -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" @@ -48,6 +49,4 @@ func main() { if err := proxyManager.Run(); err != nil { blog.Infof("proxyManager run quit: %v", err) } - - return } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/endpoint/config.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/endpoint/config.go index 643deaf4ba..2e4e65acf1 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/endpoint/config.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/endpoint/config.go @@ -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 @@ -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" diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/endpoint/config_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/endpoint/config_test.go index 70ce039cf1..71b09c8072 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/endpoint/config_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/endpoint/config_test.go @@ -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 @@ -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" ) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/endpoint/endpoint.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/endpoint/endpoint.go index 574409a365..987a160cc1 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/endpoint/endpoint.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/endpoint/endpoint.go @@ -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 @@ -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" ) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/endpoint/endpoint_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/endpoint/endpoint_test.go index 4e1be76a07..15e6eee8ff 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/endpoint/endpoint_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/endpoint/endpoint_test.go @@ -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 diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/health/health_check.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/health/health_check.go index f287781646..b7a28f13ff 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/health/health_check.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/health/health_check.go @@ -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 ( @@ -30,6 +30,7 @@ var ( ) // HealthCheck is interface for check addr:port health +// nolint type HealthCheck interface { IsHTTPAPIHealth(addr string, port uint32) bool } @@ -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 @@ -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, @@ -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 } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/health/health_check_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/health/health_check_test.go index 18eb534bcb..83d82869c5 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/health/health_check_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/health/health_check_test.go @@ -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 diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/config/config.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/config/config.go index 5761c194ef..0ec3278e71 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/config/config.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/config/config.go @@ -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 config xxx @@ -16,9 +15,10 @@ package config import ( "fmt" - "github.com/spf13/viper" "os" "path" + + "github.com/spf13/viper" ) const ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/exec/exec.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/exec/exec.go index da35389de0..a383799373 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/exec/exec.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/exec/exec.go @@ -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 diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/ipvs.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/ipvs.go index d071d276d2..0d980e4bcc 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/ipvs.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/ipvs.go @@ -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 @@ -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) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/ipvs_linux.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/ipvs_linux.go index 9929c5c930..ea6c9431be 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/ipvs_linux.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/ipvs_linux.go @@ -1,3 +1,4 @@ +// nolint // NOCC:tosa/license(设计如此) //go:build linux // +build linux @@ -12,7 +13,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 @@ -26,7 +26,6 @@ import ( "syscall" "github.com/Tencent/bk-bcs/bcs-common/common/blog" - libipvs "github.com/moby/ipvs" ) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/ipvs_linux_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/ipvs_linux_test.go index ad813ebbbc..ecb793d0d1 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/ipvs_linux_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/ipvs_linux_test.go @@ -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 diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/ipvs_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/ipvs_test.go index 812d927744..bcba6b2190 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/ipvs_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/ipvs_test.go @@ -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 diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/ipvs_unsupported.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/ipvs_unsupported.go index 2b6b1006bf..3217616a6f 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/ipvs_unsupported.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/ipvs_unsupported.go @@ -11,7 +11,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 diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/kernelcheck_linux.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/kernelcheck_linux.go index 25548f8e1f..ccfc701075 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/kernelcheck_linux.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/kernelcheck_linux.go @@ -1,3 +1,4 @@ +// nolint // NOCC:tosa/license(设计如此) //go:build linux // +build linux @@ -12,7 +13,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 @@ -23,10 +23,10 @@ import ( "strings" "github.com/Tencent/bk-bcs/bcs-common/common/blog" + "github.com/lithammer/dedent" + utilsexec "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/exec" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/utils/sets" - - "github.com/lithammer/dedent" ) // RequiredIPVSKernelModulesAvailableCheck tests IPVS required kernel modules. @@ -76,7 +76,7 @@ func (r RequiredIPVSKernelModulesAvailableCheck) Check() (warnings, errors []err for _, builtInMode := range ipvsModules { match, _ := regexp.Match(builtInMode+".ko", out) if !match { - builtInModules.Insert(string(builtInMode)) + builtInModules.Insert(builtInMode) } } if len(builtInModules) != 0 { diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/kernelcheck_unsupportedd.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/kernelcheck_unsupportedd.go index e71f4c1f42..bfa762a6f0 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/kernelcheck_unsupportedd.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/kernelcheck_unsupportedd.go @@ -12,7 +12,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 diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/version/version.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/version/version.go index 0f5c09689f..05569c8c10 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/version/version.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs/version/version.go @@ -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 version xxx @@ -33,7 +32,8 @@ type Version struct { var ( // versionMatchRE splits a version string into numeric and "extra" parts versionMatchRE = regexp.MustCompile(`^\s*v?([0-9]+(?:\.[0-9]+)*)(.*)*$`) - // extraMatchRE splits the "extra" part of versionMatchRE into semver pre-release and build metadata; it does not validate the "no leading zeroes" constraint for pre-release + // extraMatchRE splits the "extra" part of versionMatchRE into semver pre-release and build metadata; + // it does not validate the "no leading zeroes" constraint for pre-release extraMatchRE = regexp.MustCompile( `^(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?\s*$`) ) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/service/service.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/service/service.go index 3c5810b598..d5cb07d1ef 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/service/service.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/service/service.go @@ -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 service xxx @@ -22,6 +21,7 @@ import ( "syscall" "github.com/Tencent/bk-bcs/bcs-common/common/blog" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/utils" ) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/service/service_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/service/service_test.go index 6044986025..0319c11a03 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/service/service_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/service/service_test.go @@ -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 service diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/utils/metrics/metrics.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/utils/metrics/metrics.go index 2c94086382..ed5dd3395d 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/utils/metrics/metrics.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/utils/metrics/metrics.go @@ -8,16 +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 metrics xxx package metrics import ( - "github.com/prometheus/client_golang/prometheus" - "time" + + "github.com/prometheus/client_golang/prometheus" ) const ( @@ -54,6 +53,7 @@ func init() { } // reportBcsApiserverProxyAPIMetrics report all api action metrics +// nolint unused func reportBcsApiserverProxyAPIMetrics(handler, method, code string, started time.Time) { requestTotalAPI.WithLabelValues(handler, method, code).Inc() requestLatencyAPI.WithLabelValues(handler, method, code).Observe(time.Since(started).Seconds()) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/utils/utils.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/utils/utils.go index db127421ea..04d0124f88 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/utils/utils.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/utils/utils.go @@ -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 utils xxx @@ -25,6 +24,7 @@ import ( "strings" "github.com/Tencent/bk-bcs/bcs-common/common/blog" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-apiserver-proxy/pkg/ipvs" ) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/cache.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/cache.go index dadfe408fa..2827dbd27f 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/cache.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/cache.go @@ -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 bcs xxx package bcs import ( @@ -108,7 +108,7 @@ func (m *NodeGroupCache) CheckInstancesTerminateByAs(instances []*InstanceRef) b for _, ins := range instances { if m.instanceToCreationType[*ins] != CreationTypeAuto { - klog.V(4).Infof("ins %s, CreationType %s,terminate by as direct", (*ins).Name, CreationTypeManual) + klog.V(4).Infof("ins %s, CreationType %s,terminate by as direct", ins.Name, CreationTypeManual) return true } } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/cache_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/cache_test.go index 42f018ba08..b7b572a397 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/cache_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/cache_test.go @@ -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 bcs diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/cloud_provider.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/cloud_provider.go index 816feae2f5..c8b89fad24 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/cloud_provider.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/cloud_provider.go @@ -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 bcs @@ -17,16 +16,16 @@ import ( "fmt" "os" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/cloudprovider/bcs/clustermanager" - metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/scalingconfig" - apiv1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" "k8s.io/autoscaler/cluster-autoscaler/cloudprovider" "k8s.io/autoscaler/cluster-autoscaler/utils/errors" "k8s.io/autoscaler/cluster-autoscaler/utils/gpu" "k8s.io/klog" + + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/cloudprovider/bcs/clustermanager" + metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/scalingconfig" ) const ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/cloud_provider_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/cloud_provider_test.go index 0fc1929c78..da9f7c7ebc 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/cloud_provider_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/cloud_provider_test.go @@ -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 bcs diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/clustermanager/clustermanager.pb.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/clustermanager/clustermanager.pb.go index 1bf8907508..fa82a48d36 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/clustermanager/clustermanager.pb.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/clustermanager/clustermanager.pb.go @@ -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 clustermanager diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/clustermanager/common.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/clustermanager/common.go index eb1b6aab01..1d38c9cd78 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/clustermanager/common.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/clustermanager/common.go @@ -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 clustermanager diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/clustermanager/common_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/clustermanager/common_test.go index 08f4a2cf1c..abec1070d4 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/clustermanager/common_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/clustermanager/common_test.go @@ -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 clustermanager diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/clustermanager/nodepool.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/clustermanager/nodepool.go index cdca243713..a6f312bcb5 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/clustermanager/nodepool.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/clustermanager/nodepool.go @@ -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 clustermanager diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/node_group.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/node_group.go index 245328e8a5..8eabb6d6c0 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/node_group.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/node_group.go @@ -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 bcs @@ -24,7 +23,6 @@ import ( "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/autoscaler/cluster-autoscaler/cloudprovider" - "k8s.io/autoscaler/cluster-autoscaler/utils/gpu" "k8s.io/klog" "k8s.io/kubernetes/pkg/scheduler/nodeinfo" @@ -103,7 +101,7 @@ func (group *NodeGroup) IncreaseSize(delta int) error { return err } if size+delta > group.MaxSize() { - return fmt.Errorf("size increase too large - desired:%d max:%d", int(size)+delta, group.MaxSize()) + return fmt.Errorf("size increase too large - desired:%d max:%d", size+delta, group.MaxSize()) } if group.IsSoldOut() { if group.scalingType != ScalingTypeWakeUpStopped { @@ -111,7 +109,7 @@ func (group *NodeGroup) IncreaseSize(delta int) error { } if group.scalingType == ScalingTypeWakeUpStopped { if group.closedSize < delta { - taskID, err := group.client.UpdateDesiredNode(group.nodeGroupID, size) + taskID, err := group.client.UpdateDesiredNode(group.nodeGroupID, size) // nolint if err != nil { return fmt.Errorf("available instance type in selected-zone are sold out,"+ " starting up %v closed instances meet error %v - group: %v", @@ -245,7 +243,7 @@ func (group *NodeGroup) DeleteNodes(nodes []*apiv1.Node) error { klog.Infof("DeleteInstances len(%d)", len(ips)) return group.deleteInstances(ips) } - for i := 0; i < len(ips); i = i + maxRecordsReturnedByAPI { + for i := 0; i < len(ips); i += maxRecordsReturnedByAPI { klog.Infof("page DeleteInstances i %d, len(%d)", i, len(ips)) idx := math.Min(float64(i+maxRecordsReturnedByAPI), float64(len(ips))) err := group.deleteInstances(ips[i:int(idx)]) @@ -396,9 +394,10 @@ func (group *NodeGroup) getNodeTemplate() (*nodeTemplate, error) { return template, nil } +// nolint result 1 (error) is always nil func (group *NodeGroup) buildNodeFromTemplate(template *nodeTemplate) (*apiv1.Node, error) { node := apiv1.Node{} - nodeName := fmt.Sprintf("%s-%d", group.nodeGroupID, rand.Int63()) + nodeName := fmt.Sprintf("%s-%d", group.nodeGroupID, rand.Int63()) // nolint node.ObjectMeta = metav1.ObjectMeta{ Name: nodeName, diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/node_group_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/node_group_test.go index 3562958b7a..7257f0e8c5 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/node_group_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/node_group_test.go @@ -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 bcs diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/task.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/task.go index 9fd31ea371..74b8ffc4c4 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/task.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/task.go @@ -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 bcs @@ -17,9 +16,10 @@ import ( "sync" "time" + "k8s.io/klog" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/cloudprovider/bcs/clustermanager" metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" - "k8s.io/klog" ) var ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/util.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/util.go index f4aab2c7ab..4d43df7175 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/util.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/util.go @@ -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 bcs diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/util_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/util_test.go index 91a517ebd1..e6bb705b6f 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/util_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/bcs/util_test.go @@ -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 bcs diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/builder/builder_all.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/builder/builder_all.go index b90dffbbc7..670e0b85fc 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/builder/builder_all.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/builder/builder_all.go @@ -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 builder xxx package builder import ( @@ -30,6 +30,7 @@ const DefaultCloudProvider = bcs.ProviderName func buildCloudProvider(opts scalingconfig.Options, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter) cloudprovider.CloudProvider { + // nolint switch opts.CloudProviderName { case bcs.ProviderName: return bcs.BuildCloudProvider(opts, do, rl) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/builder/builder_bcs.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/builder/builder_bcs.go index c1a9270a60..9d9db8a5dc 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/builder/builder_bcs.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/builder/builder_bcs.go @@ -11,7 +11,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 builder diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/builder/cloud_provider_builder.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/builder/cloud_provider_builder.go index 38e1d00bbd..73c2760383 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/builder/cloud_provider_builder.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/cloudprovider/builder/cloud_provider_builder.go @@ -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 builder @@ -34,7 +33,7 @@ func NewCloudProvider(opts scalingconfig.Options) cloudprovider.CloudProvider { if opts.CloudProviderName == "" { // Ideally this would be an error, but several unit tests of the - // StaticAutoscaler depend on this behaviour. + // StaticAutoscaler depend on this behavior. klog.Warning("Returning a nil cloud provider") return nil } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/context/context.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/context/context.go index ad1043c0d4..84f7fb4a1a 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/context/context.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/context/context.go @@ -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 context xxx diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/autoscaler.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/autoscaler.go index 04ed166989..d063a744dc 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/autoscaler.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/autoscaler.go @@ -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 core diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/buffered_autoscaler.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/buffered_autoscaler.go index 3b6003f6ff..106be0dd9e 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/buffered_autoscaler.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/buffered_autoscaler.go @@ -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 core implements the core methods of cluster autoscaler @@ -19,11 +18,6 @@ import ( "sort" "time" - contextinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/context" - estimatorinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/estimator" - metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/scalingconfig" - apiv1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -45,6 +39,11 @@ import ( kubeclient "k8s.io/client-go/kubernetes" "k8s.io/klog" schedulernodeinfo "k8s.io/kubernetes/pkg/scheduler/nodeinfo" + + contextinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/context" + estimatorinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/estimator" + metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/scalingconfig" ) // BufferedAutoscaler is an autoscaler which has all the core functionality of a CA @@ -209,6 +208,7 @@ func (b *BufferedAutoscaler) cleanUpIfRequired() { } // RunOnce iterates over node groups and scales them up/down if necessary +// nolint func (b *BufferedAutoscaler) RunOnce(currentTime time.Time) errors.AutoscalerError { stateUpdateStart := time.Now() allNodes, readyNodes, typedErr := b.preRun(currentTime) @@ -394,6 +394,7 @@ func (b *BufferedAutoscaler) checkClusterState(autoscalingContext *context.Autos return nil } +// nolint func (b *BufferedAutoscaler) doScaleDown(autoscalingContext *context.AutoscalingContext, currentTime time.Time, allNodes []*corev1.Node, scheduledPods []*corev1.Pod) ( *status.ScaleDownStatus, bool, errors.AutoscalerError) { @@ -543,6 +544,7 @@ func (b *BufferedAutoscaler) processNodes(autoscalingContext *context.Autoscalin return scaleDownCandidates, podDestinations, temporaryNodes, nil } +// nolint func (b *BufferedAutoscaler) doScaleUp(autoscalingContext *contextinternal.Context, currentTime time.Time, allNodes []*corev1.Node, readyNodes []*corev1.Node, originalScheduledPods []*corev1.Pod, nodeInfosForGroups map[string]*schedulernodeinfo.NodeInfo) ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/buffered_autoscaler_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/buffered_autoscaler_test.go index 187f16a544..aaa537f3de 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/buffered_autoscaler_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/buffered_autoscaler_test.go @@ -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 core diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/cron.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/cron.go index ced35b5d98..3715dee9df 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/cron.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/cron.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/cron_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/cron_test.go index 3850bf561e..6f895b9ba2 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/cron_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/cron_test.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/filter_out_schedulable.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/filter_out_schedulable.go index 0ecaaec40d..78df427c7b 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/filter_out_schedulable.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/filter_out_schedulable.go @@ -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 core @@ -17,6 +16,7 @@ import ( "sort" "time" + apiv1 "k8s.io/api/core/v1" "k8s.io/autoscaler/cluster-autoscaler/context" "k8s.io/autoscaler/cluster-autoscaler/estimator" "k8s.io/autoscaler/cluster-autoscaler/metrics" @@ -24,8 +24,6 @@ import ( "k8s.io/autoscaler/cluster-autoscaler/simulator" "k8s.io/autoscaler/cluster-autoscaler/utils/glogx" schedulerutil "k8s.io/autoscaler/cluster-autoscaler/utils/scheduler" - - apiv1 "k8s.io/api/core/v1" "k8s.io/klog" "k8s.io/kubernetes/pkg/scheduler/util" ) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/filter_out_schedulable_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/filter_out_schedulable_test.go index 0e9c8450a1..869f9cd2d7 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/filter_out_schedulable_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/filter_out_schedulable_test.go @@ -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 core diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/scale_down.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/scale_down.go index 13595b312e..ed0a921fc6 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/scale_down.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/scale_down.go @@ -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 core @@ -269,9 +268,11 @@ func calculateScaleDownGpusTotal(nodes []*apiv1.Node, cp cloudprovider.CloudProv "can not get node group for node %v when calculating cluster gpu usage", node.Name) } if nodeGroup == nil || reflect.ValueOf(nodeGroup).IsNil() { - // We do not trust cloud providers to return properly constructed nil for interface type - hence the reflection check + // We do not trust cloud providers to return properly constructed nil for interface type - + // hence the reflection check // See https://golang.org/doc/faq#nil_error - // DOTO[lukaszos] consider creating cloud_provider sanitizer which will wrap cloud provider and ensure sane behaviour + // DOTO[lukaszos] consider creating cloud_provider sanitizer which will wrap cloud provider and + // ensure sane behavior nodeGroup = nil } @@ -448,6 +449,7 @@ func (sd *ScaleDown) CleanUpUnneededNodes() { // * timestamp is the current timestamp. // * pdbs is a list of pod disruption budgets. // * tempNodesPerNodeGroup is a map of node group id and the number of temporary nodes that node group contains. +// nolint func (sd *ScaleDown) UpdateUnneededNodes( allNodes []*apiv1.Node, destinationNodes []*apiv1.Node, @@ -624,6 +626,7 @@ func (sd *ScaleDown) checkFilteredNodes(filteredNodesToCheck []*apiv1.Node, time return utilizationMap, currentlyUnneededNodes } +// nolint `currentCandidates` is unused func (sd *ScaleDown) findAdditionalCandidates(nodesToRemove []simulator.NodeToBeRemoved, unremovable []*simulator.UnremovableNode, currentCandidates []*apiv1.Node, currentNonCandidates []*apiv1.Node, allNodes []*apiv1.Node, destinationNodes []*apiv1.Node, @@ -683,7 +686,7 @@ func (sd *ScaleDown) isNodeBelowUtilzationThreshold(node *apiv1.Node, utilInfo s // state of the cluster. Removes from the map nodes that are no longer in the // nodes list. func (sd *ScaleDown) updateUnremovableNodes(nodes []*apiv1.Node) { - if len(sd.unremovableNodes) <= 0 { + if len(sd.unremovableNodes) == 0 { return } // A set of nodes to delete from unremovableNodes map. @@ -793,6 +796,7 @@ func (sd *ScaleDown) SoftTaintUnneededNodes(allNodes []*apiv1.Node) (errors []er // TryToScaleDown tries to scale down the cluster. It returns a result inside a ScaleDownStatus indicating // if any node was removed and error if such occurred. +// nolint func (sd *ScaleDown) TryToScaleDown(allNodes []*apiv1.Node, pods []*apiv1.Pod, pdbs []*policyv1.PodDisruptionBudget, currentTime time.Time, tempNodes []*apiv1.Node, tempNodesPerNodeGroup map[string]int) (*status.ScaleDownStatus, errors.AutoscalerError) { @@ -1008,6 +1012,7 @@ func getTempNodesPerNodeGroup(cp cloudprovider.CloudProvider, tempNodes []*apiv1 return tempNodesPerNg } +// nolint `resourceLimiter` is unused func (sd *ScaleDown) checkNodeRemovable(node *apiv1.Node, val time.Time, currentTime time.Time, nodeGroupSize map[string]int, resourceLimiter *cloudprovider.ResourceLimiter, diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/scale_down_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/scale_down_test.go index edaa396d14..f8425d7b65 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/scale_down_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/scale_down_test.go @@ -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 core diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/scale_test_common.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/scale_test_common.go index cea5313354..b2d0c3c9b8 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/scale_test_common.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/scale_test_common.go @@ -8,14 +8,11 @@ * 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 core import ( - contextinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/context" - estimatorinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/estimator" "testing" "github.com/stretchr/testify/assert" @@ -40,6 +37,9 @@ import ( kube_client "k8s.io/client-go/kubernetes" kube_record "k8s.io/client-go/tools/record" schedulernodeinfo "k8s.io/kubernetes/pkg/scheduler/nodeinfo" + + contextinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/context" + estimatorinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/estimator" ) type nodeConfig struct { diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/scale_up.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/scale_up.go index 3661c2c9e9..b583150ace 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/scale_up.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/scale_up.go @@ -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 core @@ -127,8 +126,8 @@ func calculateScaleUpCoresMemoryTotal( } if currentSize > 0 { nodeCPU, nodeMemory := getNodeInfoCoresAndMemory(nodeInfo) - coresTotal = coresTotal + int64(currentSize)*nodeCPU - memoryTotal = memoryTotal + int64(currentSize)*nodeMemory + coresTotal += int64(currentSize) * nodeCPU + memoryTotal += int64(currentSize) * nodeMemory } } @@ -272,6 +271,7 @@ func maxResourceLimitReached(resources []string) *skippedReasons { // ScaleUp tries to scale the cluster up. Return true if it found a way to increase the size, // false if it didn't and error if an error occurred. Assumes that all nodes in the cluster are // ready and in sync with instance groups. +// nolint func ScaleUp(context *contextinternal.Context, processors *ca_processors.AutoscalingProcessors, clusterStateRegistry *clusterstate.ClusterStateRegistry, unschedulablePods []*apiv1.Pod, nodes []*apiv1.Node, daemonSets []*appsv1.DaemonSet, nodeInfos map[string]*schedulernodeinfo.NodeInfo, @@ -527,6 +527,7 @@ func checkPodsSchedulable(nodeGroup cloudprovider.NodeGroup, } // optimizeBestOption generates the best scale up options +// nolint func optimizeBestOption(context *contextinternal.Context, processors *ca_processors.AutoscalingProcessors, clusterStateRegistry *clusterstate.ClusterStateRegistry, daemonSets []*appsv1.DaemonSet, nodeInfos map[string]*schedulernodeinfo.NodeInfo, ignoredTaints taintKeySet, diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/scale_up_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/scale_up_test.go index 33f3c42baf..da64a28d64 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/scale_up_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/scale_up_test.go @@ -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 core diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/test_utils.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/test_utils.go index 9518aec1c4..85e31e2f85 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/test_utils.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/test_utils.go @@ -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 core diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/utils.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/utils.go index 267f1a55c5..c19dbf290f 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/utils.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/utils.go @@ -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 core @@ -268,6 +267,7 @@ func (c *podsSchedulableOnNodeChecker) checkPodsSchedulableOnNode(nodeGroupID st // It also returns a node group to sample node mapping. // DOTO(mwielgus): This returns map keyed by url, while most code (including scheduler) uses node.Name for a key. // DOTO(mwielgus): Review error policy - sometimes we may continue with partial errors. +// nolint func getNodeInfosForGroups(nodes []*apiv1.Node, nodeInfoCache map[string]*schedulernodeinfo.NodeInfo, cloudProvider cloudprovider.CloudProvider, listers kube_util.ListerRegistry, daemonsets []*appsv1.DaemonSet, predicateChecker *simulator.PredicateChecker, @@ -515,10 +515,11 @@ func sanitizeNodeInfo(nodeInfo *schedulernodeinfo.NodeInfo, nodeGroupName string return sanitizedNodeInfo, nil } +// nolint result 1 (error) is always nil func sanitizeTemplateNode(node *apiv1.Node, nodeGroup string, ignoredTaints taintKeySet) (*apiv1.Node, errors.AutoscalerError) { newNode := node.DeepCopy() - nodeName := fmt.Sprintf("template-node-for-%s-%d", nodeGroup, rand.Int63()) + nodeName := fmt.Sprintf("template-node-for-%s-%d", nodeGroup, rand.Int63()) // nolint newNode.Labels = make(map[string]string, len(node.Labels)) for k, v := range node.Labels { // if !validLabel(k) { @@ -850,16 +851,16 @@ func substractRescheduledPodResources(leftResourcesList schedulernodeinfo.Resour } } - leftResourcesList.AllowedPodNumber = leftResourcesList.AllowedPodNumber - len(podsToReschedule) - leftResourcesList.MilliCPU = leftResourcesList.MilliCPU - podResources.MilliCPU - leftResourcesList.Memory = leftResourcesList.Memory - podResources.Memory - leftResourcesList.EphemeralStorage = leftResourcesList.EphemeralStorage - podResources.EphemeralStorage + leftResourcesList.AllowedPodNumber -= len(podsToReschedule) + leftResourcesList.MilliCPU -= podResources.MilliCPU + leftResourcesList.Memory -= podResources.Memory + leftResourcesList.EphemeralStorage -= podResources.EphemeralStorage // calculate extend resources for k, v := range podResources.ScalarResources { _, ok := leftResourcesList.ScalarResources[k] if ok { - leftResourcesList.ScalarResources[k] = leftResourcesList.ScalarResources[k] - v + leftResourcesList.ScalarResources[k] -= v } } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/utils_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/utils_test.go index b0dd52e1e5..5ba45a9d3d 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/utils_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/utils_test.go @@ -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 core diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/webhook_configmap.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/webhook_configmap.go index d1a0ddf233..e00ae02b3a 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/webhook_configmap.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/webhook_configmap.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -17,9 +17,6 @@ import ( "fmt" "time" - contextinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/context" - metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" - corev1 "k8s.io/api/core/v1" apierr "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -31,6 +28,9 @@ import ( v1lister "k8s.io/client-go/listers/core/v1" "k8s.io/klog" schedulernodeinfo "k8s.io/kubernetes/pkg/scheduler/nodeinfo" + + contextinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/context" + metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" ) var _ Webhook = &ConfigMapScaler{} diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/webhook_interface.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/webhook_interface.go index 8a32a0efba..34643a0070 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/webhook_interface.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/webhook_interface.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/webhook_utils.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/webhook_utils.go index 84efd77508..8854436635 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/webhook_utils.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/webhook_utils.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -19,9 +19,6 @@ import ( "strings" "time" - contextinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/context" - metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" - "github.com/google/uuid" "gopkg.in/yaml.v2" corev1 "k8s.io/api/core/v1" @@ -41,6 +38,9 @@ import ( "k8s.io/klog" "k8s.io/kubernetes/pkg/kubelet/types" schedulernodeinfo "k8s.io/kubernetes/pkg/scheduler/nodeinfo" + + contextinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/context" + metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" ) type priorities map[string]int @@ -142,7 +142,7 @@ func HandleResponse(review ClusterAutoscalerReview, nodes []*corev1.Node, // handleScaleUpResponse abstracts options of scale up from response func handleScaleUpResponse(req *AutoscalerRequest, policies []*ScaleUpPolicy) (ScaleUpOptions, error) { options := make(ScaleUpOptions, 0) - if len(policies) <= 0 { + if len(policies) == 0 { return options, nil } for _, policy := range policies { @@ -170,7 +170,7 @@ func handleScaleDownResponse(req *AutoscalerRequest, policies []*ScaleDownPolicy nodeNameToNodeInfo map[string]*schedulernodeinfo.NodeInfo, sd *ScaleDown, scaleDownDelay time.Duration) (ScaleDownCandidates, error) { candidates := make(ScaleDownCandidates, 0) - if len(policies) <= 0 { + if len(policies) == 0 { return candidates, nil } for _, policy := range policies { @@ -532,7 +532,7 @@ func processMultiNodeGroupWithPriority(req *AutoscalerRequest, policy *ScaleUpPo break } else { options[nodeGroups[i].NodeGroupID] = nodeGroups[i].MaxSize - diff = diff - (nodeGroups[i].MaxSize - nodeGroups[i].DesiredSize) + diff -= (nodeGroups[i].MaxSize - nodeGroups[i].DesiredSize) } } return options, nil @@ -614,8 +614,8 @@ func calculateWebhookScaleUpCoresMemoryTotal(options ScaleUpOptions, "Failed to get node template of %v: %v", nodeGroup.Id(), err) } nodes := int64(options[nodeGroup.Id()]) - coresTotal = coresTotal + int64(template.AllocatableResource().MilliCPU/1000)*nodes - memoryTotal = memoryTotal + int64(template.AllocatableResource().Memory)*nodes + coresTotal += template.AllocatableResource().MilliCPU / 1000 * nodes + memoryTotal += template.AllocatableResource().Memory * nodes } // nodes from not autoscaled group @@ -670,6 +670,7 @@ func checkScaleDownResourcesLimits(candidates ScaleDownCandidates, // calculateWebhookScaleDownCoresMemoryTotal return the total resources after scaling down // NOCC:tosa/fn_length(设计如此) +// nolint `cp` is unused, `candidates` is unused func calculateWebhookScaleDownCoresMemoryTotal(candidates ScaleDownCandidates, nodes []*corev1.Node, cp cloudprovider.CloudProvider) (int64, int64, errors.AutoscalerError) { timestamp := time.Now() diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/webhook_utils_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/webhook_utils_test.go index 0931046e81..359c99d5b9 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/webhook_utils_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/webhook_utils_test.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/webhook_web.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/webhook_web.go index 150648e1bd..888d3f76c3 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/webhook_web.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/core/webhook_web.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -21,9 +21,6 @@ import ( "strings" "time" - contextinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/context" - metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" - corev1 "k8s.io/api/core/v1" "k8s.io/autoscaler/cluster-autoscaler/clusterstate" "k8s.io/autoscaler/cluster-autoscaler/utils/errors" @@ -33,6 +30,9 @@ import ( v1lister "k8s.io/client-go/listers/core/v1" "k8s.io/klog" schedulernodeinfo "k8s.io/kubernetes/pkg/scheduler/nodeinfo" + + contextinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/context" + metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" ) var _ Webhook = &WebScaler{} @@ -49,7 +49,7 @@ type WebScaler struct { // NewWebScaler initializes a WebScaler func NewWebScaler(kubeClient kubeclient.Interface, configNamespace, url, token string, maxBulkScaleUpCount int) Webhook { - tr := &http.Transport{ + tr := &http.Transport{ // nolint TLSClientConfig: &tls.Config{InsecureSkipVerify: false}, } client := &http.Client{ diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/estimator/estimator.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/estimator/estimator.go index 4302bb7402..55e3bdff61 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/estimator/estimator.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/estimator/estimator.go @@ -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 estimator xxx diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/estimator/resource_estimator.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/estimator/resource_estimator.go index 5609308733..aa056305b5 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/estimator/resource_estimator.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/estimator/resource_estimator.go @@ -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 estimator provides the extend estimator, ClusterResourceEstimator diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/main.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/main.go index 4f87ceec49..8177bed972 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/main.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/main.go @@ -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 implements main function @@ -27,11 +26,6 @@ import ( "syscall" "time" - cloudBuilder "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/cloudprovider/builder" - coreinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/core" - metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/scalingconfig" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/simulator" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/spf13/pflag" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -57,6 +51,12 @@ import ( componentbaseconfig "k8s.io/component-base/config" "k8s.io/klog" "k8s.io/kubernetes/pkg/client/leaderelectionconfig" + + cloudBuilder "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/cloudprovider/builder" + coreinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/core" + metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/scalingconfig" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/simulator" ) // MultiStringFlag is a flag for passing multiple parameters using same flag @@ -196,6 +196,7 @@ var ( nodeGroupsFlag = multiStringFlag("nodes", "sets min,max size and other configuration data for a node group in a format accepted by cloud provider."+ "Can be used multiple times. Format: ::") + // nolint nodeGroupAutoDiscoveryFlag = multiStringFlag( "node-group-auto-discovery", "One or more definition(s) of node group auto-discovery. "+ @@ -239,6 +240,7 @@ var ( regional = flag.Bool("regional", false, "Cluster is regional.") newPodScaleUpDelay = flag.Duration("new-pod-scale-up-delay", 0*time.Second, "Pods less than this old will not be considered for scale-up.") + // nolint filterOutSchedulablePodsUsesPacking = flag.Bool("filter-out-schedulable-pods-uses-packing", true, "Filtering out schedulable pods before CA scale up by trying to pack the schedulable pods on free capacity on existing nodes."+ "Setting it to false employs a more lenient filtering approach that does not try to pack the pods on the nodes."+ @@ -278,8 +280,8 @@ func createAutoscalingOptions() scalingconfig.Options { klog.Fatalf("Failed to parse flags: %v", err) } // Convert memory limits to bytes. - minMemoryTotal = minMemoryTotal * units.GiB - maxMemoryTotal = maxMemoryTotal * units.GiB + minMemoryTotal *= units.GiB + maxMemoryTotal *= units.GiB parsedGpuTotal, err := parseMultipleGpuLimits(*gpuTotal) if err != nil { @@ -383,7 +385,7 @@ func createKubeClient(kubeConfig *rest.Config) kube_client.Interface { func registerSignalHandlers(autoscaler core.Autoscaler) { sigs := make(chan os.Signal, 1) - signal.Notify(sigs, os.Interrupt, os.Kill, syscall.SIGTERM, syscall.SIGQUIT) + signal.Notify(sigs, os.Interrupt, os.Kill, syscall.SIGTERM, syscall.SIGQUIT) // nolint klog.V(1).Info("Registered cleanup signal handler") go func() { @@ -445,6 +447,7 @@ func run(healthCheck *metrics.HealthCheck) { } // Autoscale ad infinitum. + // nolint for { select { case <-time.After(*scanInterval): diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/main_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/main_test.go index 384a6b16e4..f98441cf6d 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/main_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/main_test.go @@ -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 diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/metrics/metrics.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/metrics/metrics.go index a56ac609d3..7ac88b435e 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/metrics/metrics.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/metrics/metrics.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/scalingconfig/config.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/scalingconfig/config.go index 395a34f930..ac137bd71e 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/scalingconfig/config.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/scalingconfig/config.go @@ -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 scalingconfig xxx package scalingconfig import ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/simulator/cluster.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/simulator/cluster.go index 73fc6afa1c..c25816d713 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/simulator/cluster.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/simulator/cluster.go @@ -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 simulator xxx package simulator import ( @@ -148,6 +148,7 @@ candidateloop: var err error nodeInfo, found := nodeNameToNodeInfo[node.Name] + // nolint if found { if fastCheck { podsToRemove, _, blockingPod, err = FastGetPodsToMove(nodeInfo, skipNodesWithSystemPods, @@ -212,6 +213,7 @@ func FindEmptyNodesToRemove(candidates []*apiv1.Node, pods []*apiv1.Pod) []*apiv // findPlaceFor xxx // DOTO: We don't need to pass list of nodes here as they are already available in nodeInfos. +// nolint funlen func findPlaceFor(removedNode string, pods []*apiv1.Pod, nodes []*apiv1.Node, nodeInfos map[string]*schedulernodeinfo.NodeInfo, predicateChecker *simulatorinternal.PredicateChecker, oldHints map[string]string, newHints map[string]string, @@ -239,6 +241,7 @@ func findPlaceFor(removedNode string, pods []*apiv1.Pod, nodes []*apiv1.Node, return false } err := predicateChecker.CheckPredicates(pod, predicateMeta, nodeInfo) + // nolint if err != nil { glogx.V(4).UpTo(loggingQuota).Infof("Evaluation %s for %s/%s -> %v", nodename, pod.Namespace, pod.Name, err.VerboseError()) @@ -311,7 +314,7 @@ func shuffleNodes(nodes []*apiv1.Node) []*apiv1.Node { result := make([]*apiv1.Node, len(nodes)) copy(result, nodes) for i := range result { - j := rand.Intn(len(result)) + j := rand.Intn(len(result)) // nolint instead of crypto/rand result[i], result[j] = result[j], result[i] } return result diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/simulator/cluster_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/simulator/cluster_test.go index b7e3aacf50..875e295e76 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/simulator/cluster_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/simulator/cluster_test.go @@ -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 simulator diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/simulator/drain.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/simulator/drain.go index 51d374026d..95964a2cb8 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/simulator/drain.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/simulator/drain.go @@ -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 simulator @@ -174,6 +173,7 @@ func checkControllerRef(pod *apiv1.Pod, controllerRef *metav1.OwnerReference, // For now, owner controller must be in the same namespace as the pod // so OwnerReference doesn't have its own Namespace field // controllerNamespace := pod.Namespace + // nolint if refKind == "ReplicationController" { blockingPod, err := checkRC(&replicated, checkReferences, pod, controllerRef, listers, minReplica) if err != nil { @@ -423,6 +423,7 @@ func checkRC(replicated *bool, checkReferences bool, pod *apiv1.Pod, controllerR // Assume a reason for an error is because the RC is either // gone/missing or that the rc has too few replicas configured. // DOTO: replace the minReplica check with pod disruption budget. + // nolint if err == nil && rc != nil { if rc.Spec.Replicas != nil && *rc.Spec.Replicas < minReplica { return &BlockingPod{Pod: pod, Reason: MinReplicasReached}, @@ -441,6 +442,7 @@ func checkRC(replicated *bool, checkReferences bool, pod *apiv1.Pod, controllerR return nil, nil } +// nolint `replicated` is unused func checkDS(replicated *bool, checkReferences bool, pod *apiv1.Pod, controllerRef *metav1.OwnerReference, listers kube_util.ListerRegistry, minReplica int32) (*BlockingPod, error) { controllerNamespace := pod.Namespace @@ -458,6 +460,7 @@ func checkDS(replicated *bool, checkReferences bool, pod *apiv1.Pod, controllerR return nil, nil } +// nolint `minReplica` is unused func checkJob(replicated *bool, checkReferences bool, pod *apiv1.Pod, controllerRef *metav1.OwnerReference, listers kube_util.ListerRegistry, minReplica int32) (*BlockingPod, error) { controllerNamespace := pod.Namespace @@ -467,6 +470,7 @@ func checkJob(replicated *bool, checkReferences bool, pod *apiv1.Pod, controller // Assume the only reason for an error is because the Job is // gone/missing, not for any other cause. DOTO(mml): something more // sophisticated than this + // nolint if err == nil && job != nil { *replicated = true } else { @@ -488,6 +492,7 @@ func checkRS(replicated *bool, checkReferences bool, pod *apiv1.Pod, controllerR // Assume the only reason for an error is because the RS is // gone/missing, not for any other cause. DOTO(mml): something more // sophisticated than this + // nolint if err == nil && rs != nil { if rs.Spec.Replicas != nil && *rs.Spec.Replicas < minReplica { return &BlockingPod{Pod: pod, Reason: MinReplicasReached}, @@ -505,6 +510,7 @@ func checkRS(replicated *bool, checkReferences bool, pod *apiv1.Pod, controllerR return nil, nil } +// nolint `minReplica` is unused func checkSts(replicated *bool, checkReferences bool, pod *apiv1.Pod, controllerRef *metav1.OwnerReference, listers kube_util.ListerRegistry, minReplica int32) (*BlockingPod, error) { controllerNamespace := pod.Namespace @@ -514,6 +520,7 @@ func checkSts(replicated *bool, checkReferences bool, pod *apiv1.Pod, controller // Assume the only reason for an error is because the StatefulSet is // gone/missing, not for any other cause. DOTO(mml): something more // sophisticated than this + // nolint if err == nil && ss != nil { *replicated = true } else { diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/simulator/drain_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/simulator/drain_test.go index 5b0069a864..07d2c321eb 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/simulator/drain_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/simulator/drain_test.go @@ -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 simulator diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/test/e2e.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/test/e2e.go index 89eb456d1e..5a3ec82c00 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/test/e2e.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/test/e2e.go @@ -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 implements e2e test function @@ -17,7 +16,6 @@ package main import ( "flag" "fmt" - "k8s.io/apimachinery/pkg/types" "net/http" "time" @@ -29,6 +27,7 @@ import ( "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/uuid" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/apiserver/pkg/server" @@ -231,6 +230,7 @@ func (tc *testConfig) DeleteWorkLoad() { defer func() { klog.Infof("E2E finish delete workload %v", tc.name) }() + // nolint wait.PollImmediate(1*time.Second, 5*time.Second, func() (done bool, err error) { if err := tc.client.AppsV1().Deployments(tc.namespace).Delete(tc.name, &metav1.DeleteOptions{}); err != nil && !errors.IsNotFound(err) { @@ -280,7 +280,7 @@ func main() { pflag.CommandLine.AddGoFlagSet(flag.CommandLine) pflag.Parse() go func() { - http.Handle("/metrics", prometheus.Handler()) + http.Handle("/metrics", prometheus.Handler()) // nolint prometheus.Handler is deprecated err := http.ListenAndServe(*address, nil) klog.Fatalf("Failed to start metrics: %v", err) }() diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/test/metrics.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/test/metrics.go index 9312f5b63f..96d8f34ffe 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/test/metrics.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/test/metrics.go @@ -8,16 +8,14 @@ * 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 defines prometheus metrics package main import ( - _ "k8s.io/kubernetes/pkg/client/metrics/prometheus" // for client-go metrics registration - "github.com/prometheus/client_golang/prometheus" + _ "k8s.io/kubernetes/pkg/client/metrics/prometheus" // for client-go metrics registration ) const ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/util/lister.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/util/lister.go index ef5a0bfee6..65721cabdb 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/util/lister.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.16/util/lister.go @@ -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 util provides some util functions @@ -78,7 +77,8 @@ func NewListerRegistry(allNode kube_util.NodeLister, readyNode kube_util.NodeLis } // NewListerRegistryWithDefaultListers returns a registry filled with listers of the default implementations -func NewListerRegistryWithDefaultListers(kubeClient client.Interface, stopChannel <-chan struct{}) ListerRegistryExtend { +func NewListerRegistryWithDefaultListers( + kubeClient client.Interface, stopChannel <-chan struct{}) ListerRegistryExtend { unschedulablePodLister := kube_util.NewUnschedulablePodLister(kubeClient, stopChannel) scheduledPodLister := kube_util.NewScheduledPodLister(kubeClient, stopChannel) readyNodeLister := kube_util.NewReadyNodeLister(kubeClient, stopChannel) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/cache.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/cache.go index c5ab8aca8a..11a272c9b6 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/cache.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/cache.go @@ -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 bcs xxx package bcs import ( @@ -108,7 +108,7 @@ func (m *NodeGroupCache) CheckInstancesTerminateByAs(instances []*InstanceRef) b for _, ins := range instances { if m.instanceToCreationType[*ins] != CreationTypeAuto { - klog.V(4).Infof("ins %s, CreationType %s,terminate by as direct", (*ins).Name, CreationTypeManual) + klog.V(4).Infof("ins %s, CreationType %s,terminate by as direct", ins.Name, CreationTypeManual) return true } } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/cache_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/cache_test.go index 42f018ba08..b7b572a397 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/cache_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/cache_test.go @@ -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 bcs diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/cloud_provider.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/cloud_provider.go index 427277d54a..f080dd5bf0 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/cloud_provider.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/cloud_provider.go @@ -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 bcs @@ -17,16 +16,16 @@ import ( "fmt" "os" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/cloudprovider/bcs/clustermanager" - metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/scalingconfig" - apiv1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" "k8s.io/autoscaler/cluster-autoscaler/cloudprovider" "k8s.io/autoscaler/cluster-autoscaler/utils/errors" "k8s.io/autoscaler/cluster-autoscaler/utils/gpu" klog "k8s.io/klog/v2" + + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/cloudprovider/bcs/clustermanager" + metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/scalingconfig" ) const ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/cloud_provider_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/cloud_provider_test.go index 0fc1929c78..da9f7c7ebc 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/cloud_provider_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/cloud_provider_test.go @@ -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 bcs diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/clustermanager/clustermanager.pb.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/clustermanager/clustermanager.pb.go index 1bf8907508..fa82a48d36 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/clustermanager/clustermanager.pb.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/clustermanager/clustermanager.pb.go @@ -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 clustermanager diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/clustermanager/common.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/clustermanager/common.go index 9d336a7088..4cdd0432c1 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/clustermanager/common.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/clustermanager/common.go @@ -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 clustermanager diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/clustermanager/common_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/clustermanager/common_test.go index 08f4a2cf1c..abec1070d4 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/clustermanager/common_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/clustermanager/common_test.go @@ -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 clustermanager diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/clustermanager/nodepool.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/clustermanager/nodepool.go index e764ca1027..456c402e4f 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/clustermanager/nodepool.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/clustermanager/nodepool.go @@ -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 clustermanager diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/node_group.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/node_group.go index 8b9edad3e2..8f5c6a6d0d 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/node_group.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/node_group.go @@ -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 bcs @@ -23,12 +22,11 @@ import ( apiv1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - schedulerframework "k8s.io/kubernetes/pkg/scheduler/framework" - "k8s.io/autoscaler/cluster-autoscaler/cloudprovider" ca_config "k8s.io/autoscaler/cluster-autoscaler/config" "k8s.io/autoscaler/cluster-autoscaler/utils/gpu" klog "k8s.io/klog/v2" + schedulerframework "k8s.io/kubernetes/pkg/scheduler/framework" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/cloudprovider/bcs/clustermanager" ) @@ -104,7 +102,7 @@ func (group *NodeGroup) IncreaseSize(delta int) error { return err } if size+delta > group.MaxSize() { - return fmt.Errorf("size increase too large - desired:%d max:%d", int(size)+delta, group.MaxSize()) + return fmt.Errorf("size increase too large - desired:%d max:%d", size+delta, group.MaxSize()) } if group.IsSoldOut() { if group.scalingType != ScalingTypeWakeUpStopped { @@ -112,7 +110,7 @@ func (group *NodeGroup) IncreaseSize(delta int) error { } if group.scalingType == ScalingTypeWakeUpStopped { if group.closedSize < delta { - taskID, err := group.client.UpdateDesiredNode(group.nodeGroupID, size) + taskID, err := group.client.UpdateDesiredNode(group.nodeGroupID, size) // nolint if err != nil { return fmt.Errorf("available instance type in selected-zone are sold out,"+ " starting up %v closed instances meet error %v - group: %v", @@ -246,7 +244,7 @@ func (group *NodeGroup) DeleteNodes(nodes []*apiv1.Node) error { klog.Infof("DeleteInstances len(%d)", len(ips)) return group.deleteInstances(ips) } - for i := 0; i < len(ips); i = i + maxRecordsReturnedByAPI { + for i := 0; i < len(ips); i += maxRecordsReturnedByAPI { klog.Infof("page DeleteInstances i %d, len(%d)", i, len(ips)) idx := math.Min(float64(i+maxRecordsReturnedByAPI), float64(len(ips))) err := group.deleteInstances(ips[i:int(idx)]) @@ -394,9 +392,10 @@ func (group *NodeGroup) getNodeTemplate() (*nodeTemplate, error) { return template, nil } +// nolint func (group *NodeGroup) buildNodeFromTemplate(template *nodeTemplate) (*apiv1.Node, error) { node := apiv1.Node{} - nodeName := fmt.Sprintf("%s-%d", group.nodeGroupID, rand.Int63()) + nodeName := fmt.Sprintf("%s-%d", group.nodeGroupID, rand.Int63()) // nolint node.ObjectMeta = metav1.ObjectMeta{ Name: nodeName, diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/node_group_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/node_group_test.go index 8fea7375ed..5ba4a9b1f8 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/node_group_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/node_group_test.go @@ -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 bcs diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/task.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/task.go index 6ab9a71662..4ae78a49fc 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/task.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/task.go @@ -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 bcs @@ -17,9 +16,10 @@ import ( "sync" "time" + klog "k8s.io/klog/v2" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/cloudprovider/bcs/clustermanager" metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" - klog "k8s.io/klog/v2" ) var ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/util.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/util.go index e9df2ef179..359c5cf425 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/util.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/util.go @@ -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 bcs diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/util_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/util_test.go index 91a517ebd1..e6bb705b6f 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/util_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/bcs/util_test.go @@ -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 bcs diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/builder/builder_all.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/builder/builder_all.go index b90dffbbc7..d5eaac3630 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/builder/builder_all.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/builder/builder_all.go @@ -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 builder xxx package builder import ( @@ -30,7 +30,7 @@ const DefaultCloudProvider = bcs.ProviderName func buildCloudProvider(opts scalingconfig.Options, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter) cloudprovider.CloudProvider { - switch opts.CloudProviderName { + switch opts.CloudProviderName { // nolint case bcs.ProviderName: return bcs.BuildCloudProvider(opts, do, rl) } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/builder/builder_bcs.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/builder/builder_bcs.go index c1a9270a60..9d9db8a5dc 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/builder/builder_bcs.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/builder/builder_bcs.go @@ -11,7 +11,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 builder diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/builder/cloud_provider_builder.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/builder/cloud_provider_builder.go index 16160ad0b5..d8daeecb62 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/builder/cloud_provider_builder.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/cloudprovider/builder/cloud_provider_builder.go @@ -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 builder @@ -34,7 +33,7 @@ func NewCloudProvider(opts scalingconfig.Options) cloudprovider.CloudProvider { if opts.CloudProviderName == "" { // Ideally this would be an error, but several unit tests of the - // StaticAutoscaler depend on this behaviour. + // StaticAutoscaler depend on this behavior. klog.Warning("Returning a nil cloud provider") return nil } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/context/context.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/context/context.go index a8f398f602..8c90ebe0a3 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/context/context.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/context/context.go @@ -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 context xxx diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/autoscaler.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/autoscaler.go index 5f6d19c1d4..8a4385f8cb 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/autoscaler.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/autoscaler.go @@ -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 core diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/buffered_autoscaler.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/buffered_autoscaler.go index 0c91f72eb0..856943124b 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/buffered_autoscaler.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/buffered_autoscaler.go @@ -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 core implements the core methods of cluster autoscaler @@ -20,18 +19,11 @@ import ( "sort" "time" - contextinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/context" - estimatorinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/estimator" - metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/scalingconfig" - appsv1 "k8s.io/api/apps/v1" apiv1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" - schedulerframework "k8s.io/kubernetes/pkg/scheduler/framework" - "k8s.io/autoscaler/cluster-autoscaler/cloudprovider" "k8s.io/autoscaler/cluster-autoscaler/clusterstate" "k8s.io/autoscaler/cluster-autoscaler/clusterstate/utils" @@ -49,6 +41,12 @@ import ( "k8s.io/autoscaler/cluster-autoscaler/utils/taints" "k8s.io/autoscaler/cluster-autoscaler/utils/tpu" "k8s.io/klog/v2" + schedulerframework "k8s.io/kubernetes/pkg/scheduler/framework" + + contextinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/context" + estimatorinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/estimator" + metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/scalingconfig" ) const ( @@ -254,6 +252,7 @@ func (b *BufferedAutoscaler) initializeClusterSnapshot(nodes []*apiv1.Node, // RunOnce iterates over node groups and scales them up/down if necessary // NOCC:golint/fnsize(设计如此) +// nolint func (b *BufferedAutoscaler) RunOnce(currentTime time.Time) errors.AutoscalerError { stateUpdateStart := time.Now() klog.V(4).Info("Starting main loop") @@ -462,6 +461,7 @@ func (b *BufferedAutoscaler) checkClusterState(autoscalingContext *context.Autos } // NOCC:golint/fnsize(设计如此) +// nolint func (b *BufferedAutoscaler) doScaleUp(autoscalingContext *contextinternal.Context, currentTime time.Time, allNodes []*corev1.Node, readyNodes []*corev1.Node, originalScheduledPods []*corev1.Pod, nodeInfosForGroups map[string]*schedulerframework.NodeInfo, @@ -545,6 +545,7 @@ func (b *BufferedAutoscaler) doScaleUp(autoscalingContext *contextinternal.Conte bufferNotEnough := checkResourceNotEnough(nodesInfoWithoutMaster, nil, b.CPURatio, b.MemRatio, b.ratio) shouldScaleUp := false + // nolint if len(unschedulablePodsToHelp) == 0 { scaleUpStatus.Result = status.ScaleUpNotNeeded klog.V(1).Info("No unschedulable pods") @@ -586,6 +587,7 @@ func (b *BufferedAutoscaler) doScaleUp(autoscalingContext *contextinternal.Conte } // NOCC:golint/fnsize(设计如此) +// nolint funlen func (b *BufferedAutoscaler) doScaleDown(autoscalingContext *context.AutoscalingContext, currentTime time.Time, allNodes []*corev1.Node) ( *status.ScaleDownStatus, bool, errors.AutoscalerError) { @@ -845,6 +847,7 @@ func (b *BufferedAutoscaler) ExitCleanUp() { b.clusterStateRegistry.Stop() } +// nolint func (b *BufferedAutoscaler) obtainNodeLists(cp cloudprovider.CloudProvider) ([]*corev1.Node, []*corev1.Node, errors.AutoscalerError) { allNodes, err := b.AllNodeLister().List() diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/buffered_autoscaler_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/buffered_autoscaler_test.go index ec62b11f94..7f052d04fa 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/buffered_autoscaler_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/buffered_autoscaler_test.go @@ -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 core diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/cron.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/cron.go index d56c2bd026..80cab62af2 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/cron.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/cron.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/cron_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/cron_test.go index 8397d8001e..cd4163b245 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/cron_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/cron_test.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/equivalence_groups.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/equivalence_groups.go index c7802ed4b1..b5b526d4ce 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/equivalence_groups.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/equivalence_groups.go @@ -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 core diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/equivalence_groups_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/equivalence_groups_test.go index 825ace9839..3790c7c44f 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/equivalence_groups_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/equivalence_groups_test.go @@ -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 core diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/filter_out_schedulable.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/filter_out_schedulable.go index 872bd76340..f021f5838b 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/filter_out_schedulable.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/filter_out_schedulable.go @@ -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 core @@ -17,13 +16,12 @@ import ( "sort" "time" + apiv1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/autoscaler/cluster-autoscaler/context" "k8s.io/autoscaler/cluster-autoscaler/core/utils" "k8s.io/autoscaler/cluster-autoscaler/metrics" "k8s.io/autoscaler/cluster-autoscaler/simulator" - - apiv1 "k8s.io/api/core/v1" corev1helpers "k8s.io/component-helpers/scheduling/corev1" klog "k8s.io/klog/v2" ) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/scale_down.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/scale_down.go index e4ff31bdf0..780e9bc3a7 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/scale_down.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/scale_down.go @@ -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 core @@ -24,8 +23,12 @@ import ( "sync" "time" - metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" - + apiv1 "k8s.io/api/core/v1" + policyv1 "k8s.io/api/policy/v1beta1" + kube_errors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/apimachinery/pkg/util/wait" "k8s.io/autoscaler/cluster-autoscaler/cloudprovider" "k8s.io/autoscaler/cluster-autoscaler/clusterstate" "k8s.io/autoscaler/cluster-autoscaler/context" @@ -33,27 +36,22 @@ import ( "k8s.io/autoscaler/cluster-autoscaler/metrics" "k8s.io/autoscaler/cluster-autoscaler/processors" "k8s.io/autoscaler/cluster-autoscaler/processors/customresources" + "k8s.io/autoscaler/cluster-autoscaler/processors/status" "k8s.io/autoscaler/cluster-autoscaler/simulator" "k8s.io/autoscaler/cluster-autoscaler/utils" "k8s.io/autoscaler/cluster-autoscaler/utils/daemonset" "k8s.io/autoscaler/cluster-autoscaler/utils/deletetaint" "k8s.io/autoscaler/cluster-autoscaler/utils/drain" "k8s.io/autoscaler/cluster-autoscaler/utils/errors" + "k8s.io/autoscaler/cluster-autoscaler/utils/gpu" "k8s.io/autoscaler/cluster-autoscaler/utils/kubernetes" kube_util "k8s.io/autoscaler/cluster-autoscaler/utils/kubernetes" - schedulerframework "k8s.io/kubernetes/pkg/scheduler/framework" - - apiv1 "k8s.io/api/core/v1" - policyv1 "k8s.io/api/policy/v1beta1" - kube_errors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/sets" - "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/autoscaler/cluster-autoscaler/processors/status" - "k8s.io/autoscaler/cluster-autoscaler/utils/gpu" kube_client "k8s.io/client-go/kubernetes" kube_record "k8s.io/client-go/tools/record" klog "k8s.io/klog/v2" + schedulerframework "k8s.io/kubernetes/pkg/scheduler/framework" + + metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" ) const ( @@ -158,7 +156,7 @@ type NodeDeletionTracker struct { } // Get current time. Proxy for unit tests. -var now func() time.Time = time.Now +var now func() time.Time = time.Now // nolint // NewNodeDeletionTracker creates new NodeDeletionTracker. func NewNodeDeletionTracker() *NodeDeletionTracker { @@ -332,7 +330,7 @@ func (sd *ScaleDown) calculateScaleDownCustomResourcesTotal(nodes []*apiv1.Node, // - hence the reflection check. // See https://golang.org/doc/faq#nil_error // DOTO[lukaszos] consider creating cloud_provider sanitizer which will wrap cloud provider - // and ensure sane behaviour. + // and ensure sane behavior. nodeGroup = nil } @@ -382,6 +380,7 @@ func copyScaleDownResourcesLimits(source scaleDownResourcesLimits) scaleDownReso return copy } +// nolint func (sd *ScaleDown) computeScaleDownResourcesDelta(cp cloudprovider.CloudProvider, node *apiv1.Node, nodeGroup cloudprovider.NodeGroup, @@ -577,6 +576,7 @@ func (sd *ScaleDown) checkNodeUtilization(timestamp time.Time, node *apiv1.Node, // * timestamp is the current timestamp. // * pdbs is a list of pod disruption budgets. // NOCC:golint/fnsize(设计如此) +// nolint funlen func (sd *ScaleDown) UpdateUnneededNodes( destinationNodes []*apiv1.Node, scaleDownCandidates []*apiv1.Node, @@ -758,6 +758,7 @@ func (sd *ScaleDown) checkScaleDownCandidates(scaleDownCandidates []*apiv1.Node, return skipped, utilizationMap, currentlyUnneededNodeNames } +// nolint func (sd *ScaleDown) findAdditionalCandidates(allNodeInfos []*schedulerframework.NodeInfo, currentCandidates, currentNonCandidates []string, destinations []string, timestamp time.Time, pdbs []*policyv1.PodDisruptionBudget, @@ -839,7 +840,7 @@ func (sd *ScaleDown) isNodeBelowUtilizationThreshold(node *apiv1.Node, nodeGroup // state of the cluster. Removes from the map nodes that are no longer in the // nodes list. func (sd *ScaleDown) updateUnremovableNodes(timestamp time.Time) { - if len(sd.unremovableNodes) <= 0 { + if len(sd.unremovableNodes) == 0 { return } newUnremovableNodes := make(map[string]time.Time, len(sd.unremovableNodes)) @@ -973,6 +974,7 @@ func (sd *ScaleDown) SoftTaintUnneededNodes(allNodes []*apiv1.Node) (errors []er // TryToScaleDown tries to scale down the cluster. It returns a result inside a ScaleDownStatus indicating // if any node was removed and error if such occurred. // NOCC:golint/fnsize(设计如此) +// nolint funlen func (sd *ScaleDown) TryToScaleDown( currentTime time.Time, pdbs []*policyv1.PodDisruptionBudget, @@ -1185,6 +1187,7 @@ func (sd *ScaleDown) filterNode(nodes []*apiv1.Node, } // NOCC:golint/fnsize(设计如此) +// nolint func (sd *ScaleDown) checkNodeRemovable(nodeName string, unneededSince time.Time, currentTime time.Time, nodeGroupSize map[string]int, resourceLimiter *cloudprovider.ResourceLimiter, @@ -1652,6 +1655,7 @@ func evictPod(podToEvict *apiv1.Pod, isDaemonSetPod bool, client kube_client.Int // Performs drain logic on the node. Marks the node as unschedulable and later removes all pods, giving // them up to MaxGracefulTerminationTime to finish. // NOCC:golint/fnsize(设计如此) +// nolint funlen func drainNode(node *apiv1.Node, pods []*apiv1.Pod, daemonSetPods []*apiv1.Pod, client kube_client.Interface, recorder kube_record.EventRecorder, maxGracefulTerminationSec int, maxPodEvictionTime time.Duration, waitBetweenRetries time.Duration, @@ -1688,7 +1692,7 @@ func drainNode(node *apiv1.Node, pods []*apiv1.Pod, daemonSetPods []*apiv1.Pod, metrics.RegisterEvictions(1) } case <-daemonSetConfirmations: - case <-time.After(retryUntil.Sub(time.Now()) + 5*time.Second): + case <-time.After(retryUntil.Sub(time.Now()) + 5*time.Second): // nolint if podsEvictionCounter < len(pods) { // All pods initially had results with TimedOut set to true, so the ones that // didn't receive an actual result are correctly marked as timed out. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/scale_down_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/scale_down_test.go index 6212f43f41..713cc36d49 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/scale_down_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/scale_down_test.go @@ -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 core diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/scale_test_common.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/scale_test_common.go index f407f29336..c592a605f9 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/scale_test_common.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/scale_test_common.go @@ -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 core @@ -18,12 +17,12 @@ import ( "reflect" "testing" - contextinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/context" - estimatorinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/estimator" - + "github.com/stretchr/testify/assert" + apiv1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" "k8s.io/autoscaler/cluster-autoscaler/cloudprovider" testcloudprovider "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/test" + "k8s.io/autoscaler/cluster-autoscaler/clusterstate" "k8s.io/autoscaler/cluster-autoscaler/clusterstate/utils" "k8s.io/autoscaler/cluster-autoscaler/config" "k8s.io/autoscaler/cluster-autoscaler/context" @@ -39,18 +38,16 @@ import ( "k8s.io/autoscaler/cluster-autoscaler/processors/nodeinfos" "k8s.io/autoscaler/cluster-autoscaler/processors/status" "k8s.io/autoscaler/cluster-autoscaler/simulator" + "k8s.io/autoscaler/cluster-autoscaler/utils/backoff" "k8s.io/autoscaler/cluster-autoscaler/utils/errors" kube_util "k8s.io/autoscaler/cluster-autoscaler/utils/kubernetes" "k8s.io/autoscaler/cluster-autoscaler/utils/labels" - - "github.com/stretchr/testify/assert" - - apiv1 "k8s.io/api/core/v1" - "k8s.io/autoscaler/cluster-autoscaler/clusterstate" - "k8s.io/autoscaler/cluster-autoscaler/utils/backoff" kube_client "k8s.io/client-go/kubernetes" kube_record "k8s.io/client-go/tools/record" schedulerframework "k8s.io/kubernetes/pkg/scheduler/framework" + + contextinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/context" + estimatorinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/estimator" ) type nodeConfig struct { @@ -92,7 +89,7 @@ type scaleTestResults struct { expansionOptions []groupSizeChange finalOption groupSizeChange noScaleUpReason string - finalScaleDowns []string + finalScaleDowns []string // nolint unused events []string scaleUpStatus scaleUpStatusInfo } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/scale_up.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/scale_up.go index fa35ba8129..1b9df0fe04 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/scale_up.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/scale_up.go @@ -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 core @@ -19,13 +18,9 @@ import ( "strings" "time" - contextinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/context" - appsv1 "k8s.io/api/apps/v1" apiv1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/util/sets" - klog "k8s.io/klog/v2" - "k8s.io/autoscaler/cluster-autoscaler/cloudprovider" "k8s.io/autoscaler/cluster-autoscaler/clusterstate" "k8s.io/autoscaler/cluster-autoscaler/context" @@ -40,7 +35,10 @@ import ( "k8s.io/autoscaler/cluster-autoscaler/utils/gpu" "k8s.io/autoscaler/cluster-autoscaler/utils/klogx" "k8s.io/autoscaler/cluster-autoscaler/utils/taints" + klog "k8s.io/klog/v2" schedulerframework "k8s.io/kubernetes/pkg/scheduler/framework" + + contextinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/context" ) type scaleUpResourcesLimits map[string]int64 @@ -131,8 +129,8 @@ func calculateScaleUpCoresMemoryTotal( } if currentSize > 0 { nodeCPU, nodeMemory := getNodeInfoCoresAndMemory(nodeInfo) - coresTotal = coresTotal + int64(currentSize)*nodeCPU - memoryTotal = memoryTotal + int64(currentSize)*nodeMemory + coresTotal += int64(currentSize) * nodeCPU + memoryTotal += int64(currentSize) * nodeMemory } } @@ -291,6 +289,7 @@ func maxResourceLimitReached(resources []string) *skippedReasons { } // computeExpansionOption computes scale up options +// nolint func computeExpansionOption(context *contextinternal.Context, podEquivalenceGroups []*podEquivalenceGroup, nodeGroup cloudprovider.NodeGroup, nodeInfo *schedulerframework.NodeInfo, upcomingNodes []*schedulerframework.NodeInfo, bufferNotEnough bool) (expander.Option, error) { @@ -356,6 +355,7 @@ func computeExpansionOption(context *contextinternal.Context, podEquivalenceGrou // false if it didn't and error if an error occurred. Assumes that all nodes in the cluster are // ready and in sync with instance groups. // NOCC:golint/fnsize(设计如此) +// nolint funlen func ScaleUp(context *contextinternal.Context, processors *ca_processors.AutoscalingProcessors, clusterStateRegistry *clusterstate.ClusterStateRegistry, unschedulablePods []*apiv1.Pod, nodes []*apiv1.Node, daemonSets []*appsv1.DaemonSet, nodeInfos map[string]*schedulerframework.NodeInfo, @@ -459,6 +459,7 @@ func ScaleUp(context *contextinternal.Context, processors *ca_processors.Autosca // optimizeBestOption generates the best scale up options // NOCC:golint/fnsize(设计如此) +// nolint funlen func optimizeBestOption(context *contextinternal.Context, processors *ca_processors.AutoscalingProcessors, clusterStateRegistry *clusterstate.ClusterStateRegistry, daemonSets []*appsv1.DaemonSet, nodes []*apiv1.Node, upcomingNodes []*schedulerframework.NodeInfo, diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/scale_up_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/scale_up_test.go index cdd38fbabb..a26c0144ed 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/scale_up_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/scale_up_test.go @@ -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 core diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/utils.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/utils.go index cdaca4ee3c..433d2c12a8 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/utils.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/utils.go @@ -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 core @@ -22,11 +21,6 @@ import ( appsv1 "k8s.io/api/apps/v1" apiv1 "k8s.io/api/core/v1" apiequality "k8s.io/apimachinery/pkg/api/equality" - cloudproviderapi "k8s.io/cloud-provider/api" - klog "k8s.io/klog/v2" - nodeLabel "k8s.io/kubernetes/cmd/kubeadm/app/constants" - schedulerframework "k8s.io/kubernetes/pkg/scheduler/framework" - "k8s.io/autoscaler/cluster-autoscaler/cloudprovider" "k8s.io/autoscaler/cluster-autoscaler/clusterstate" "k8s.io/autoscaler/cluster-autoscaler/clusterstate/utils" @@ -42,6 +36,10 @@ import ( "k8s.io/autoscaler/cluster-autoscaler/utils/scheduler" scheduler_utils "k8s.io/autoscaler/cluster-autoscaler/utils/scheduler" "k8s.io/autoscaler/cluster-autoscaler/utils/taints" + cloudproviderapi "k8s.io/cloud-provider/api" + klog "k8s.io/klog/v2" + nodeLabel "k8s.io/kubernetes/cmd/kubeadm/app/constants" + schedulerframework "k8s.io/kubernetes/pkg/scheduler/framework" metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" ) @@ -176,6 +174,7 @@ func filterOutExpendablePods(pods []*apiv1.Pod, expendablePodsPriorityCutoff int // DOTO(mwielgus): This returns map keyed by url, while most code (including scheduler) uses node.Name for a key. // DOTO(mwielgus): Review error policy - sometimes we may continue with partial errors. // NOCC:golint/fnsize(设计如此) +// nolint funlen func getNodeInfosForGroups(nodes []*apiv1.Node, nodeInfoCache map[string]*schedulerframework.NodeInfo, cloudProvider cloudprovider.CloudProvider, listers kube_util.ListerRegistry, daemonsets []*appsv1.DaemonSet, predicateChecker simulator.PredicateChecker, @@ -369,6 +368,7 @@ func filterOutNodesFromNotAutoscaledGroups(nodes []*apiv1.Node, cloudProvider cl return result, nil } +// nolint func deepCopyNodeInfo(nodeInfo *schedulerframework.NodeInfo) (*schedulerframework.NodeInfo, errors.AutoscalerError) { newPods := make([]*apiv1.Pod, 0) for _, podInfo := range nodeInfo.Pods { @@ -403,10 +403,11 @@ func sanitizeNodeInfo(nodeInfo *schedulerframework.NodeInfo, nodeGroupName strin return sanitizedNodeInfo, nil } +// nolint func sanitizeTemplateNode(node *apiv1.Node, nodeGroup string, ignoredTaints taints.TaintKeySet) (*apiv1.Node, errors.AutoscalerError) { newNode := node.DeepCopy() - nodeName := fmt.Sprintf("template-node-for-%s-%d", nodeGroup, rand.Int63()) + nodeName := fmt.Sprintf("template-node-for-%s-%d", nodeGroup, rand.Int63()) // nolint newNode.Labels = make(map[string]string, len(node.Labels)) for k, v := range node.Labels { // if !validLabel(k) { @@ -707,16 +708,16 @@ func substractRescheduledPodResources(leftResources *schedulerframework.Resource } } - leftResources.AllowedPodNumber = leftResources.AllowedPodNumber - len(podsToReschedule) - leftResources.MilliCPU = leftResources.MilliCPU - podResources.MilliCPU - leftResources.Memory = leftResources.Memory - podResources.Memory - leftResources.EphemeralStorage = leftResources.EphemeralStorage - podResources.EphemeralStorage + leftResources.AllowedPodNumber -= len(podsToReschedule) + leftResources.MilliCPU -= podResources.MilliCPU + leftResources.Memory -= podResources.Memory + leftResources.EphemeralStorage -= podResources.EphemeralStorage // calculate extend resources for k, v := range podResources.ScalarResources { _, ok := leftResources.ScalarResources[k] if ok { - leftResources.ScalarResources[k] = leftResources.ScalarResources[k] - v + leftResources.ScalarResources[k] -= v } } @@ -736,17 +737,17 @@ func singleNodeResource(info *schedulerframework.NodeInfo) apiv1.ResourceList { podCount = len(info.Pods) } - if allocatable == nil { + if allocatable == nil { // nolint klog.Warningf("allocatable is nil: %v", info.Node().Name) } - leftResource.AllowedPodNumber = allocatable.AllowedPodNumber - podCount - leftResource.MilliCPU = allocatable.MilliCPU - requested.MilliCPU - leftResource.Memory = allocatable.Memory - requested.Memory - leftResource.EphemeralStorage = allocatable.EphemeralStorage - requested.EphemeralStorage + leftResource.AllowedPodNumber = allocatable.AllowedPodNumber - podCount // nolint + leftResource.MilliCPU = allocatable.MilliCPU - requested.MilliCPU // nolint + leftResource.Memory = allocatable.Memory - requested.Memory // nolint + leftResource.EphemeralStorage = allocatable.EphemeralStorage - requested.EphemeralStorage // nolint // calculate extend resources - for k, allocatableEx := range allocatable.ScalarResources { + for k, allocatableEx := range allocatable.ScalarResources { // nolint requestEx, ok := requested.ScalarResources[k] if !ok { leftResource.ScalarResources[k] = allocatableEx diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/utils_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/utils_test.go index 20f193650b..5701b3783d 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/utils_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/utils_test.go @@ -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 core diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/webhook_configmap.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/webhook_configmap.go index ede0d94dab..8195123a73 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/webhook_configmap.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/webhook_configmap.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -18,21 +18,20 @@ import ( "fmt" "time" - contextinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/context" - metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" - corev1 "k8s.io/api/core/v1" apierr "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/autoscaler/cluster-autoscaler/clusterstate" + "k8s.io/autoscaler/cluster-autoscaler/utils/errors" + "k8s.io/autoscaler/cluster-autoscaler/utils/kubernetes" + scheduler_util "k8s.io/autoscaler/cluster-autoscaler/utils/scheduler" kubeclient "k8s.io/client-go/kubernetes" v1lister "k8s.io/client-go/listers/core/v1" klog "k8s.io/klog/v2" schedulerframework "k8s.io/kubernetes/pkg/scheduler/framework" - "k8s.io/autoscaler/cluster-autoscaler/clusterstate" - "k8s.io/autoscaler/cluster-autoscaler/utils/errors" - "k8s.io/autoscaler/cluster-autoscaler/utils/kubernetes" - scheduler_util "k8s.io/autoscaler/cluster-autoscaler/utils/scheduler" + contextinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/context" + metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" ) var _ Webhook = &ConfigMapScaler{} diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/webhook_interface.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/webhook_interface.go index d68e8c3fa8..0df52f7a76 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/webhook_interface.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/webhook_interface.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/webhook_utils.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/webhook_utils.go index a45e44b0c7..e794d17de8 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/webhook_utils.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/webhook_utils.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -19,20 +19,12 @@ import ( "strings" "time" - contextinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/context" - metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" - "github.com/google/uuid" "gopkg.in/yaml.v2" corev1 "k8s.io/api/core/v1" kube_errors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" apitypes "k8s.io/apimachinery/pkg/types" - v1lister "k8s.io/client-go/listers/core/v1" - klog "k8s.io/klog/v2" - "k8s.io/kubernetes/pkg/kubelet/types" - schedulerframework "k8s.io/kubernetes/pkg/scheduler/framework" - "k8s.io/autoscaler/cluster-autoscaler/cloudprovider" "k8s.io/autoscaler/cluster-autoscaler/clusterstate" core_utils "k8s.io/autoscaler/cluster-autoscaler/core/utils" @@ -43,6 +35,13 @@ import ( simulator "k8s.io/autoscaler/cluster-autoscaler/simulator" "k8s.io/autoscaler/cluster-autoscaler/utils/errors" "k8s.io/autoscaler/cluster-autoscaler/utils/gpu" + v1lister "k8s.io/client-go/listers/core/v1" + klog "k8s.io/klog/v2" + "k8s.io/kubernetes/pkg/kubelet/types" + schedulerframework "k8s.io/kubernetes/pkg/scheduler/framework" + + contextinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/context" + metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" ) type priorities map[string]int @@ -144,7 +143,7 @@ func HandleResponse(review ClusterAutoscalerReview, nodes []*corev1.Node, // handleScaleUpResponse abstracts options of scale up from response func handleScaleUpResponse(req *AutoscalerRequest, policies []*ScaleUpPolicy) (ScaleUpOptions, error) { options := make(ScaleUpOptions, 0) - if len(policies) <= 0 { + if len(policies) == 0 { return options, nil } for _, policy := range policies { @@ -172,7 +171,7 @@ func handleScaleDownResponse(req *AutoscalerRequest, policies []*ScaleDownPolicy nodeNameToNodeInfo map[string]*schedulerframework.NodeInfo, sd *ScaleDown, scaleDownDelay time.Duration) (ScaleDownCandidates, error) { candidates := make(ScaleDownCandidates, 0) - if len(policies) <= 0 { + if len(policies) == 0 { return candidates, nil } for _, policy := range policies { @@ -536,7 +535,7 @@ func processMultiNodeGroupWithPriority(req *AutoscalerRequest, policy *ScaleUpPo break } else { options[nodeGroups[i].NodeGroupID] = nodeGroups[i].MaxSize - diff = diff - (nodeGroups[i].MaxSize - nodeGroups[i].DesiredSize) + diff -= (nodeGroups[i].MaxSize - nodeGroups[i].DesiredSize) } } return options, nil @@ -618,8 +617,8 @@ func calculateWebhookScaleUpCoresMemoryTotal(options ScaleUpOptions, "Failed to get node template of %v: %v", nodeGroup.Id(), err) } nodes := int64(options[nodeGroup.Id()]) - coresTotal = coresTotal + int64(template.Allocatable.MilliCPU/1000)*nodes - memoryTotal = memoryTotal + int64(template.Allocatable.Memory)*nodes + coresTotal += template.Allocatable.MilliCPU / 1000 * nodes + memoryTotal += template.Allocatable.Memory * nodes } // nodes from not autoscaled group @@ -674,6 +673,7 @@ func checkScaleDownResourcesLimits(candidates ScaleDownCandidates, // calculateWebhookScaleDownCoresMemoryTotal return the total resources after scaling down // NOCC:tosa/fn_length(设计如此) +// nolint func calculateWebhookScaleDownCoresMemoryTotal(candidates ScaleDownCandidates, nodes []*corev1.Node, cp cloudprovider.CloudProvider) (int64, int64, errors.AutoscalerError) { timestamp := time.Now() diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/webhook_utils_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/webhook_utils_test.go index 538e9907cc..17e9bf2c81 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/webhook_utils_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/webhook_utils_test.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/webhook_web.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/webhook_web.go index ad0f35ed48..3f6cb822c9 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/webhook_web.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/core/webhook_web.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -21,9 +21,6 @@ import ( "strings" "time" - contextinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/context" - metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" - corev1 "k8s.io/api/core/v1" "k8s.io/autoscaler/cluster-autoscaler/clusterstate" "k8s.io/autoscaler/cluster-autoscaler/utils/errors" @@ -33,6 +30,9 @@ import ( v1lister "k8s.io/client-go/listers/core/v1" klog "k8s.io/klog/v2" schedulerframework "k8s.io/kubernetes/pkg/scheduler/framework" + + contextinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/context" + metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" ) var _ Webhook = &WebScaler{} @@ -49,6 +49,7 @@ type WebScaler struct { // NewWebScaler initializes a WebScaler func NewWebScaler(kubeClient kubeclient.Interface, configNamespace, url, token string, maxBulkScaleUpCount int) Webhook { + // nolint tr := &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: false}, } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/estimator/estimator.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/estimator/estimator.go index 291e01cbd3..110097f533 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/estimator/estimator.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/estimator/estimator.go @@ -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 estimator xxx diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/estimator/resource_estimator.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/estimator/resource_estimator.go index cc1596dc7a..e81764d010 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/estimator/resource_estimator.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/estimator/resource_estimator.go @@ -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 estimator provides the extend estimator, ClusterResourceEstimator @@ -21,11 +20,10 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" - nodeLabel "k8s.io/kubernetes/cmd/kubeadm/app/constants" - "k8s.io/autoscaler/cluster-autoscaler/simulator" "k8s.io/autoscaler/cluster-autoscaler/utils/scheduler" klog "k8s.io/klog/v2" + nodeLabel "k8s.io/kubernetes/cmd/kubeadm/app/constants" schedulerframework "k8s.io/kubernetes/pkg/scheduler/framework" ) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/main.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/main.go index 45fd489322..f399b9433f 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/main.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/main.go @@ -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 implements main function @@ -27,11 +26,6 @@ import ( "syscall" "time" - cloudBuilder "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/cloudprovider/builder" - coreinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/core" - metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/scalingconfig" - "github.com/spf13/pflag" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apiserver/pkg/server/mux" @@ -59,6 +53,11 @@ import ( "k8s.io/component-base/config/options" "k8s.io/component-base/metrics/legacyregistry" klog "k8s.io/klog/v2" + + cloudBuilder "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/cloudprovider/builder" + coreinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/core" + metricsinternal "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/metrics" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/scalingconfig" ) // MultiStringFlag is a flag for passing multiple parameters using same flag @@ -200,8 +199,10 @@ var ( "node-group-auto-discovery", "One or more definition(s) of node group auto-discovery. "+ "A definition is expressed `:[[=]]`. "+ - "The `aws` and `gce` cloud providers are currently supported. AWS matches by ASG tags, e.g. `asg:tag=tagKey,anotherTagKey`. "+ - "GCE matches by IG name prefix, and requires you to specify min and max nodes per IG, e.g. `mig:namePrefix=pfx,min=0,max=10` "+ + "The `aws` and `gce` cloud providers are currently supported. AWS matches by ASG tags, "+ + "e.g. `asg:tag=tagKey,anotherTagKey`. "+ + "GCE matches by IG name prefix, and requires you to specify min and max nodes per IG, "+ + "e.g. `mig:namePrefix=pfx,min=0,max=10` "+ "Can be used multiple times.") estimatorFlag = flag.String("estimator", estimator.BinpackingEstimatorName, @@ -279,6 +280,7 @@ var ( evictLatest = flag.Bool("should-evict-latest", true, "If true, get latest pod lists when scale down node") ) +// nolint func createAutoscalingOptions() scalingconfig.Options { minCoresTotal, maxCoresTotal, err := parseMinMaxFlag(*coresTotal) if err != nil { @@ -289,8 +291,8 @@ func createAutoscalingOptions() scalingconfig.Options { klog.Fatalf("Failed to parse flags: %v", err) } // Convert memory limits to bytes. - minMemoryTotal = minMemoryTotal * units.GiB - maxMemoryTotal = maxMemoryTotal * units.GiB + minMemoryTotal *= units.GiB + maxMemoryTotal *= units.GiB parsedGpuTotal, err := parseMultipleGpuLimits(*gpuTotal) if err != nil { @@ -407,7 +409,7 @@ func createKubeClient(kubeConfig *rest.Config) kube_client.Interface { // registerSignalHandlers register handler for grace termination func registerSignalHandlers(autoscaler core.Autoscaler) { sigs := make(chan os.Signal, 1) - signal.Notify(sigs, os.Interrupt, os.Kill, syscall.SIGTERM, syscall.SIGQUIT) + signal.Notify(sigs, os.Interrupt, os.Kill, syscall.SIGTERM, syscall.SIGQUIT) // nolint klog.V(1).Info("Registered cleanup signal handler") go func() { @@ -473,6 +475,7 @@ func run(healthCheck *metrics.HealthCheck) { } // Autoscale ad infinitum. + // nolint for { select { case <-time.After(*scanInterval): @@ -514,6 +517,7 @@ func main() { // start web server for prometheus and health check go func() { pathRecorderMux := mux.NewPathRecorderMux("cluster-autoscaler") + // nolint defaultMetricsHandler := legacyregistry.Handler().ServeHTTP pathRecorderMux.HandleFunc("/metrics", func(w http.ResponseWriter, req *http.Request) { defaultMetricsHandler(w, req) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/main_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/main_test.go index 384a6b16e4..f98441cf6d 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/main_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/main_test.go @@ -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 diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/metrics/metrics.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/metrics/metrics.go index a56ac609d3..7ac88b435e 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/metrics/metrics.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/metrics/metrics.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/scalingconfig/config.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/scalingconfig/config.go index 603a5b04b5..f2098a554e 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/scalingconfig/config.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/scalingconfig/config.go @@ -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 scalingconfig xxx package scalingconfig import ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/test/e2e.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/test/e2e.go index 0c86005fe2..a9b585463b 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/test/e2e.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/test/e2e.go @@ -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 implements e2e test function @@ -21,8 +20,6 @@ import ( "net/http" "time" - "k8s.io/apimachinery/pkg/types" - "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/spf13/pflag" appsv1 "k8s.io/api/apps/v1" @@ -31,6 +28,7 @@ import ( "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/uuid" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/apiserver/pkg/server" @@ -186,7 +184,8 @@ func (tc *testConfig) ScaleDownWorkLoad(deploy *appsv1.Deployment, lister v12.No // changeScale change scale func (tc *testConfig) changeScale(deploy *appsv1.Deployment, desired int32) error { return wait.PollImmediate(1*time.Second, 5*time.Second, func() (done bool, err error) { - scale, err := tc.client.AppsV1().Deployments(deploy.Namespace).GetScale(context.TODO(), deploy.Name, metav1.GetOptions{}) + scale, err := tc.client.AppsV1().Deployments(deploy.Namespace).GetScale(context.TODO(), deploy.Name, + metav1.GetOptions{}) if err != nil { return false, nil } @@ -239,6 +238,7 @@ func (tc *testConfig) DeleteWorkLoad() { defer func() { klog.Infof("E2E finish delete workload %v", tc.name) }() + // nolint wait.PollImmediate(1*time.Second, 5*time.Second, func() (done bool, err error) { if err := tc.client.AppsV1().Deployments(tc.namespace).Delete(context.TODO(), tc.name, metav1.DeleteOptions{}); err != nil && !errors.IsNotFound(err) { diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/test/metrics.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/test/metrics.go index 3258d858e5..6be0904e5c 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/test/metrics.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/test/metrics.go @@ -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 defines prometheus metrics diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/util/lister.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/util/lister.go index ef5a0bfee6..65721cabdb 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/util/lister.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-cluster-autoscaler/bcs-cluster-autoscaler-1.22/util/lister.go @@ -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 util provides some util functions @@ -78,7 +77,8 @@ func NewListerRegistry(allNode kube_util.NodeLister, readyNode kube_util.NodeLis } // NewListerRegistryWithDefaultListers returns a registry filled with listers of the default implementations -func NewListerRegistryWithDefaultListers(kubeClient client.Interface, stopChannel <-chan struct{}) ListerRegistryExtend { +func NewListerRegistryWithDefaultListers( + kubeClient client.Interface, stopChannel <-chan struct{}) ListerRegistryExtend { unschedulablePodLister := kube_util.NewUnschedulablePodLister(kubeClient, stopChannel) scheduledPodLister := kube_util.NewScheduledPodLister(kubeClient, stopChannel) readyNodeLister := kube_util.NewReadyNodeLister(kubeClient, stopChannel) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-clusternet-controller/cmd/bcs-clusternet-controller/main.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-clusternet-controller/cmd/bcs-clusternet-controller/main.go index 372969ccda..0b2e59c390 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-clusternet-controller/cmd/bcs-clusternet-controller/main.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-clusternet-controller/cmd/bcs-clusternet-controller/main.go @@ -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 ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-clusternet-controller/pkg/constant/const.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-clusternet-controller/pkg/constant/const.go index 640844f755..b264f13640 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-clusternet-controller/pkg/constant/const.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-clusternet-controller/pkg/constant/const.go @@ -4,12 +4,13 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 constant xxx package constant const ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-clusternet-controller/pkg/controllers/manifest/manifest.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-clusternet-controller/pkg/controllers/manifest/manifest.go index 9116889160..bd8c458c30 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-clusternet-controller/pkg/controllers/manifest/manifest.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-clusternet-controller/pkg/controllers/manifest/manifest.go @@ -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 manifest xxx @@ -204,6 +203,7 @@ func (c *Controller) processNextWorkItem() bool { // syncHandler compares the actual state with the desired, and attempts to // converge the two. It then updates the Status block of the Manifest resource // with the current status of the resource. +// nolint funlen func (c *Controller) syncHandler(key string) error { // If an error occurs during handling, we'll requeue the item so we can // attempt processing again later. This could have been caused by a diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-clusternet-controller/pkg/nspolicy/ns.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-clusternet-controller/pkg/nspolicy/ns.go index 9dc8da2ce4..da068c18a4 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-clusternet-controller/pkg/nspolicy/ns.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-clusternet-controller/pkg/nspolicy/ns.go @@ -4,12 +4,13 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 nspolicy xxx package nspolicy import ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-clusternet-controller/pkg/util/string.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-clusternet-controller/pkg/util/string.go index 51506ada34..fbddcd4540 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-clusternet-controller/pkg/util/string.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-clusternet-controller/pkg/util/string.go @@ -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 util xxx package util import ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/cmd/bcs-egress-controller/main.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/cmd/bcs-egress-controller/main.go index dc78a256ca..cf02c1c18c 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/cmd/bcs-egress-controller/main.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/cmd/bcs-egress-controller/main.go @@ -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 ( @@ -21,10 +21,6 @@ import ( "os" "runtime" - "bcs-egress/pkg/apis" - "bcs-egress/pkg/controller/bcsegress" - "bcs-egress/version" - "github.com/operator-framework/operator-sdk/pkg/k8sutil" kubemetrics "github.com/operator-framework/operator-sdk/pkg/kube-metrics" "github.com/operator-framework/operator-sdk/pkg/metrics" @@ -37,6 +33,10 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client/config" "sigs.k8s.io/controller-runtime/pkg/manager" "sigs.k8s.io/controller-runtime/pkg/manager/signals" + + "bcs-egress/pkg/apis" + "bcs-egress/pkg/controller/bcsegress" + "bcs-egress/version" ) // Change below variables to serve metrics on different host or port. @@ -119,7 +119,7 @@ func addMetrics(ctx context.Context, cfg *rest.Config) { } } - if err := serveCRMetrics(cfg, operatorNs); err != nil { + if err = serveCRMetrics(cfg, operatorNs); err != nil { klog.Info("Could not generate and serve custom resource metrics", "error", err.Error()) } @@ -148,7 +148,8 @@ func addMetrics(ctx context.Context, cfg *rest.Config) { // If this operator is deployed to a cluster without the prometheus-operator running, it will return // ErrServiceMonitorNotPresent, which can be used to safely skip ServiceMonitor creation. if err == metrics.ErrServiceMonitorNotPresent { - klog.Info("Install prometheus-operator in your cluster to create ServiceMonitor objects", "error", err.Error()) + klog.Info("Install prometheus-operator in your cluster to create ServiceMonitor objects", "error", + err.Error()) } } } @@ -156,7 +157,8 @@ func addMetrics(ctx context.Context, cfg *rest.Config) { // serveCRMetrics gets the Operator/CustomResource GVKs and generates metrics based on those types. // It serves those metrics on "http://metricsHost:operatorMetricsPort". func serveCRMetrics(cfg *rest.Config, operatorNs string) error { - // The function below returns a list of filtered operator/CR specific GVKs. For more control, override the GVK list below + // The function below returns a list of filtered operator/CR specific GVKs. + // For more control, override the GVK list below // with your own custom logic. Note that if you are adding third party API schemas, probably you will need to // customize this implementation to avoid permissions issues. filteredGVK, err := k8sutil.GetGVKsFromAddToScheme(apis.AddToScheme) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/hack/boilerplate.go.txt b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/hack/boilerplate.go.txt index a620e80a06..fd0afc236a 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/hack/boilerplate.go.txt +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/hack/boilerplate.go.txt @@ -8,5 +8,4 @@ * 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. - * */ diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/addtoscheme_bkbcs_v1alpha1.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/addtoscheme_bkbcs_v1alpha1.go index b386fcaaf1..b54209e2b4 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/addtoscheme_bkbcs_v1alpha1.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/addtoscheme_bkbcs_v1alpha1.go @@ -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 apis diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/apis.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/apis.go index cd70fe8b44..cce2fc1393 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/apis.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/apis.go @@ -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 apis xxx diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/bkbcs/group.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/bkbcs/group.go index ca3bd4b350..ce97ad7cc5 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/bkbcs/group.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/bkbcs/group.go @@ -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 bkbcs contains bkbcs API versions. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/bkbcs/v1alpha1/bcsegress_types.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/bkbcs/v1alpha1/bcsegress_types.go index 11344b23a2..796f3fc5c9 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/bkbcs/v1alpha1/bcsegress_types.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/bkbcs/v1alpha1/bcsegress_types.go @@ -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 v1alpha1 diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/bkbcs/v1alpha1/doc.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/bkbcs/v1alpha1/doc.go index d1c42d7077..806a62c61e 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/bkbcs/v1alpha1/doc.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/bkbcs/v1alpha1/doc.go @@ -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 v1alpha1 contains API Schema definitions for the bkbcs v1alpha1 API group diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/bkbcs/v1alpha1/register.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/bkbcs/v1alpha1/register.go index 06f10973c4..e54ae20650 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/bkbcs/v1alpha1/register.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/bkbcs/v1alpha1/register.go @@ -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. - * */ // NOTE: Boilerplate only. Ignore this file. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/bkbcs/v1alpha1/zz_generated.deepcopy.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/bkbcs/v1alpha1/zz_generated.deepcopy.go index bd8e822874..8b620b7bcd 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/bkbcs/v1alpha1/zz_generated.deepcopy.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/apis/bkbcs/v1alpha1/zz_generated.deepcopy.go @@ -10,7 +10,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. - * */ // Code generated by operator-sdk. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/controller/bcsegress/bcsegress_controller.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/controller/bcsegress/bcsegress_controller.go index c0023a8810..18ee3b9231 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/controller/bcsegress/bcsegress_controller.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/controller/bcsegress/bcsegress_controller.go @@ -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 bcsegress xxx package bcsegress import ( @@ -19,8 +19,6 @@ import ( "strings" "time" - bkbcsv1alpha1 "bcs-egress/pkg/apis/bkbcs/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -33,6 +31,8 @@ import ( "sigs.k8s.io/controller-runtime/pkg/predicate" "sigs.k8s.io/controller-runtime/pkg/reconcile" "sigs.k8s.io/controller-runtime/pkg/source" + + bkbcsv1alpha1 "bcs-egress/pkg/apis/bkbcs/v1alpha1" ) const ( @@ -102,6 +102,7 @@ type ReconcileBCSEgress struct { // and what is in the BCSEgress.Spec // The Controller will requeue the Request to be processed again if the returned error is non-nil or // Result.Requeue is true, otherwise upon completion it will remove the work from the queue. +// nolint func (r *ReconcileBCSEgress) Reconcile(request reconcile.Request) (reconcile.Result, error) { klog.Infof(">BCSEgress %s reconcile", request.String()) // Fetch the BCSEgress instance @@ -117,7 +118,7 @@ func (r *ReconcileBCSEgress) Reconcile(request reconcile.Request) (reconcile.Res // Return and don't requeue klog.Infof("BCSEgress %s is actually deleted, try to clean all rules reference to %s", request.String(), request.String()) - if err := r.cleanRulesByLabel(controlReference); err != nil { + if err = r.cleanRulesByLabel(controlReference); err != nil { klog.Errorf(">sync all reference rules failed when %s Egress deleted, %s. try next reconcile", request.String(), err.Error()) return reconcile.Result{RequeueAfter: time.Second * 3}, err @@ -183,12 +184,14 @@ func (r *ReconcileBCSEgress) Reconcile(request reconcile.Request) (reconcile.Res instance.Status.SyncedAt = metav1.Now() if err = r.client.Update(context.TODO(), instance); err != nil { klog.Errorf( - "update BCSEgress %s last Reconcile status[%s] failed, %s. push to ReconcileQueue for updating again in 5 seconds", request.String(), instance.Status.State, err.Error()) + "update BCSEgress %s last Reconcile status[%s] failed, %s. "+ + "push to ReconcileQueue for updating again in 5 seconds", request.String(), instance.Status.State, + err.Error()) return reconcile.Result{RequeueAfter: time.Second * 5}, nil } return reconcile.Result{}, nil } - if err := r.proxy.Reload(request.String()); err != nil { + if err = r.proxy.Reload(request.String()); err != nil { klog.Errorf("EgressController reload %s proxy rules failed, %s. try to reload in 15 seconds", request.String(), err.Error()) // try to update BCSEgress status @@ -208,7 +211,8 @@ func (r *ReconcileBCSEgress) Reconcile(request reconcile.Request) (reconcile.Res instance.Status.SyncedAt = metav1.Now() if err = r.client.Update(context.TODO(), instance); err != nil { klog.Errorf( - "update BCSEgress %s last Reconcile status[%s] after proxy reload failed, %s. try to Update again in next reconciler", request.String(), instance.Status.State, err.Error()) + "update BCSEgress %s last Reconcile status[%s] after proxy reload failed, %s. "+ + "try to Update again in next reconciler", request.String(), instance.Status.State, err.Error()) return reconcile.Result{RequeueAfter: time.Second * 5}, nil } klog.Warningf(">update BCSEgress %s Reconcile status done, Status [%s]", request.String(), instance.Status.State) @@ -249,7 +253,7 @@ func (r *ReconcileBCSEgress) Run() { case <-tick.C: // time to check sync flag klog.Infoln("Force synchronization in tick...") - r.synchronizationAllRules() + r.synchronizationAllRules() // nolint klog.Infoln("nothing need to synchronize in tick...") case <-r.stop.Done(): // ready to exit @@ -269,6 +273,7 @@ func (r *ReconcileBCSEgress) Stop() { // ! Every synchronization maybe affect business container, it's never too much // ! to emphasize importance of synchronization. Sometimes synchronization will // ! interrupt long connection that maintained by proxy without expectation +// nolint func (r *ReconcileBCSEgress) synchronizationAllRules() error { // all datas changed Egress were in update channel klog.V(5).Infof("BCSEgress ready to sync all rules") diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/controller/bcsegress/egress.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/controller/bcsegress/egress.go index 97256496e6..67ab27734a 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/controller/bcsegress/egress.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/controller/bcsegress/egress.go @@ -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 bcsegress diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/controller/bcsegress/option.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/controller/bcsegress/option.go index b117357905..38b1cec519 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/controller/bcsegress/option.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/controller/bcsegress/option.go @@ -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 bcsegress @@ -22,14 +21,14 @@ func init() { // init all flags viper.SetEnvPrefix("BCS") pflag.String("namespace", "bcs-system", "namespace that BCSEgress controller is running in") - viper.BindEnv("namespace") + viper.BindEnv("namespace") // nolint pflag.String("name", "egress-controller", "name that BCSEgress controller is running in with") - viper.BindEnv("name") + viper.BindEnv("name") // nolint pflag.String("tamplate", "./template/nginx-template.conf", "tamplate use for proxy configuration generation") - viper.BindEnv("tamplate") + viper.BindEnv("tamplate") // nolint pflag.String("generate_dir", "./generate/", "directory for configuration generating") - viper.BindEnv("generate_dir") - viper.BindPFlags(pflag.CommandLine) + viper.BindEnv("generate_dir") // nolint + viper.BindPFlags(pflag.CommandLine) // nolint } // NewOptionFromFlagAndEnv create option from env or command line diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/controller/bcsegress/proxy.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/controller/bcsegress/proxy.go index 38884520cb..a08134665c 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/controller/bcsegress/proxy.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/pkg/controller/bcsegress/proxy.go @@ -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 bcsegress @@ -383,6 +382,7 @@ func md5sum(filename string) (string, error) { } defer config.Close() // NOCC:gas/crypto(设计如此) + // nolint md5Block := md5.New() _, err = io.Copy(md5Block, config) if err != nil { diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/version/version.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/version/version.go index 5aa77572c8..fdbd2170d3 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/version/version.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-egress/version/version.go @@ -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 version xxx diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/cmd/gpa/app/default.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/cmd/gpa/app/default.go index c7ca777392..2102005d2a 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/cmd/gpa/app/default.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/cmd/gpa/app/default.go @@ -4,12 +4,13 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 app xxx package app import ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/cmd/gpa/app/options.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/cmd/gpa/app/options.go index 8693e31c5e..9d4e5a059c 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/cmd/gpa/app/options.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/cmd/gpa/app/options.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -65,6 +65,7 @@ func (s *RunOptions) addElectionFlags() { } // addGPAFlags addFlags adds flags related to GPAController for controller manager to the specified FlagSet +// nolint o should be consistent with previous receiver name s func (o *RunOptions) addGPAFlags() { if o == nil { return @@ -79,7 +80,8 @@ func (o *RunOptions) addGPAFlags() { pflag.DurationVar(&o.GeneralPodAutoscalerDownscaleStabilizationWindow.Duration, "general-pod-autoscaler-downscale-stabilization", o.GeneralPodAutoscalerDownscaleStabilizationWindow.Duration, - "The period for which autoscaler will look backwards and not scale down below any recommendation it made during that period.") + "The period for which autoscaler will look backwards and " + + "not scale down below any recommendation it made during that period.") pflag.DurationVar( &o.GeneralPodAutoscalerDownscaleForbiddenWindow.Duration, "general-pod-autoscaler-downscale-delay", @@ -87,7 +89,8 @@ func (o *RunOptions) addGPAFlags() { "The period since last downscale, before another downscale can be performed in general pod autoscaler.") pflag.Float64Var(&o.GeneralPodAutoscalerTolerance, "general-pod-autoscaler-tolerance", o.GeneralPodAutoscalerTolerance, - "The minimum change (from 1.0) in the desired-to-actual metrics ratio for the general pod autoscaler to consider scaling.") + "The minimum change (from 1.0) in the desired-to-actual metrics ratio for " + + "the general pod autoscaler to consider scaling.") pflag.BoolVar(&o.GeneralPodAutoscalerUseRESTClients, "general-pod-autoscaler-use-rest-clients", o.GeneralPodAutoscalerUseRESTClients, diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/cmd/gpa/main.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/cmd/gpa/main.go index 3a8c913558..d6bccf0eff 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/cmd/gpa/main.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/cmd/gpa/main.go @@ -4,12 +4,13 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 ( @@ -59,6 +60,7 @@ var ( metricPort uint ) +// nolint funlen func main() { runConfig := app.NewServerRunOptions() options := validator.NewServerRunOptions() @@ -76,7 +78,7 @@ func main() { klog.Infof("starting validator server.") if err := options.Validate(); err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) - os.Exit(1) + os.Exit(1) // nolint } go func() { if err := validator.Run(options); err != nil { @@ -111,7 +113,7 @@ func main() { scaleKindResolver := scale.NewDiscoveryScaleKindResolver(client.Discovery()) scaleClient, err := scale.NewForConfig(kubeconfig, restMapper, dynamic.LegacyAPIPathResolverFunc, scaleKindResolver) if err != nil { - klog.Fatal("Failed to build scale client %v", err) + klog.Fatalf("Failed to build scale client %v", err) } apiVersionsGetter := custom_metrics.NewAvailableAPIsGetter(gpaClient.Discovery()) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/cmd/gpa/validator/options.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/cmd/gpa/validator/options.go index fab39a5fd5..0c26701c12 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/cmd/gpa/validator/options.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/cmd/gpa/validator/options.go @@ -4,12 +4,13 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 validator xxx package validator import ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/cmd/gpa/validator/server.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/cmd/gpa/validator/server.go index 34f13f7205..68018c7f12 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/cmd/gpa/validator/server.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/cmd/gpa/validator/server.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -27,7 +27,7 @@ import ( "k8s.io/klog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/util" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/validator" + webhook "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/validator" ) // Run run @@ -71,6 +71,7 @@ func Run(s *ServerRunOptions) error { }() } + // nolint select { case <-stopCh: klog.Info("http server received stop signal, waiting for all requests to finish") @@ -84,7 +85,7 @@ func Run(s *ServerRunOptions) error { } func getTLSConfig(s *ServerRunOptions) (*tls.Config, error) { - tlsConfig := &tls.Config{ + tlsConfig := &tls.Config{ // nolint TLS MinVersion too low NextProtos: []string{"http/1.1"}, // Certificates: []tls.Certificate{cert}, // Avoid fallback on insecure SSL protocols diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/hack/tools.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/hack/tools.go index eb23f5a4f9..9dc1bc7ba3 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/hack/tools.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/hack/tools.go @@ -7,7 +7,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/autoscaling/register.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/autoscaling/register.go index fa58574272..f1d660fc79 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/autoscaling/register.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/autoscaling/register.go @@ -4,12 +4,13 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 autoscaling xxx package autoscaling // GroupName is the group name used in this package diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/autoscaling/v1alpha1/doc.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/autoscaling/v1alpha1/doc.go index 57fdb2afa6..d9753818cc 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/autoscaling/v1alpha1/doc.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/autoscaling/v1alpha1/doc.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -14,4 +14,4 @@ // +groupName=autoscaling.tkex.tencent.com // Package v1alpha1 is the v1alpha1 version of the API. -package v1alpha1 // import "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/autoscaling/v1alpha1" +package v1alpha1 // nolint import "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/autoscaling/v1alpha1" diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/autoscaling/v1alpha1/register.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/autoscaling/v1alpha1/register.go index b81dc978ec..b45d9eb226 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/autoscaling/v1alpha1/register.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/autoscaling/v1alpha1/register.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/autoscaling/v1alpha1/types.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/autoscaling/v1alpha1/types.go index c1227653f3..aaf265f6bc 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/autoscaling/v1alpha1/types.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/autoscaling/v1alpha1/types.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -44,7 +44,7 @@ type GeneralPodAutoscaler struct { // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // spec is the specification for the behaviour of the autoscaler. + // spec is the specification for the behavior of the autoscaler. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. // +optional // +kubebuilder:validation:Required @@ -207,7 +207,7 @@ type MetricSpec struct { // available to normal per-pod metrics using the "pods" source. // This is an alpha feature and can be enabled by the HPAContainerMetrics feature flag. // +optional - ContainerResource *ContainerResourceMetricSource `json:"containerResource,omitempty" protobuf:"bytes,6,opt,name=containerResource"` + ContainerResource *ContainerResourceMetricSource `json:"containerResource,omitempty" protobuf:"bytes,6,opt,name=containerResource"` // nolint } // GeneralPodAutoscalerBehavior configures the scaling behavior of the target @@ -254,7 +254,7 @@ type GPAScalingRules struct { // - For scale up: 0 (i.e. no stabilization is done). // - For scale down: 300 (i.e. the stabilization window is 300 seconds long). // +optional - StabilizationWindowSeconds *int32 `json:"stabilizationWindowSeconds,omitempty" protobuf:"varint,3,opt,name=stabilizationWindowSeconds"` + StabilizationWindowSeconds *int32 `json:"stabilizationWindowSeconds,omitempty" protobuf:"varint,3,opt,name=stabilizationWindowSeconds"` // nolint // selectPolicy is used to specify which policy should be used. // If not set, the default value MaxPolicySelect is used. // +optional @@ -452,7 +452,7 @@ type GeneralPodAutoscalerStatus struct { // LastCronScheduleTime is the schedule time of time mode // +optional - LastCronScheduleTime *metav1.Time `json:"lastCronScheduleTime,omitempty" protobuf:"bytes,7,rep,name=lastCronScheduleTime"` + LastCronScheduleTime *metav1.Time `json:"lastCronScheduleTime,omitempty" protobuf:"bytes,7,rep,name=lastCronScheduleTime"` // nolint } // GeneralPodAutoscalerConditionType are the valid conditions of @@ -522,7 +522,7 @@ type MetricStatus struct { External *ExternalMetricStatus `json:"external,omitempty" protobuf:"bytes,5,opt,name=external"` // to normal per-pod metrics using the "pods" source. // +optional - ContainerResource *ContainerResourceMetricStatus `json:"containerResource,omitempty" protobuf:"bytes,6,opt,name=containerResource"` + ContainerResource *ContainerResourceMetricStatus `json:"containerResource,omitempty" protobuf:"bytes,6,opt,name=containerResource"` // nolint } // ObjectMetricStatus indicates the current value of a metric describing a diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/autoscaling/v1alpha1/zz_generated.deepcopy.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/autoscaling/v1alpha1/zz_generated.deepcopy.go index ff95f00617..7135069973 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/autoscaling/v1alpha1/zz_generated.deepcopy.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/autoscaling/v1alpha1/zz_generated.deepcopy.go @@ -7,7 +7,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/config/register.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/config/register.go index 76d628537d..d8c92b546e 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/config/register.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/config/register.go @@ -4,12 +4,13 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 autoscaling xxx package autoscaling // GroupName is the group name used in this package diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/config/v1alpha1/doc.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/config/v1alpha1/doc.go index 1059de52d0..1f61ec9e23 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/config/v1alpha1/doc.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/config/v1alpha1/doc.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -12,4 +12,4 @@ // +k8s:deepcopy-gen=package -package v1alpha1 // import "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/config/v1alpha1" +package v1alpha1 // nolint import "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/config/v1alpha1" diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/config/v1alpha1/register.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/config/v1alpha1/register.go index dd0d5d863a..53baef5528 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/config/v1alpha1/register.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/config/v1alpha1/register.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -17,7 +17,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/config" + autoscaling "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/config" ) // SchemeGroupVersion is group version used to register these objects diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/config/v1alpha1/types.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/config/v1alpha1/types.go index 154a918091..c0161475c9 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/config/v1alpha1/types.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/config/v1alpha1/types.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/config/v1alpha1/zz_generated.deepcopy.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/config/v1alpha1/zz_generated.deepcopy.go index 5de30a9a6b..d7cbbc7bb7 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/config/v1alpha1/zz_generated.deepcopy.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/config/v1alpha1/zz_generated.deepcopy.go @@ -7,7 +7,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/clientset.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/clientset.go index d7c6ee2d31..5ecf43f9a5 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/clientset.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/clientset.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/doc.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/doc.go index f7fd9e76ec..41dca072ee 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/doc.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/doc.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/fake/clientset_generated.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/fake/clientset_generated.go index 07504938e1..afbdab045c 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/fake/doc.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/fake/doc.go index 3d85cfb5e5..f3e9e0dc0e 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/fake/doc.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/fake/doc.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/fake/register.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/fake/register.go index ec27615943..2ecef22ce0 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/fake/register.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/fake/register.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/scheme/doc.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/scheme/doc.go index 05415bc46b..6b3e185ac9 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/scheme/doc.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/scheme/doc.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/scheme/register.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/scheme/register.go index 901271b5ea..256a7b614c 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/scheme/register.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/scheme/register.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/autoscaling_client.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/autoscaling_client.go index 3a6a258a31..b2f675e4de 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/autoscaling_client.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/autoscaling_client.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/doc.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/doc.go index 1b0f1c7521..abfb9b3796 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/doc.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/doc.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/doc.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/doc.go index 2e85aaba27..0df2e1f4d3 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/doc.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/doc.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/fake_autoscaling_client.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/fake_autoscaling_client.go index 2b53217221..af5efc605b 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/fake_autoscaling_client.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/fake_autoscaling_client.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/fake_generalpodautoscaler.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/fake_generalpodautoscaler.go index 13e4eb18b0..b834c2fd5f 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/fake_generalpodautoscaler.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/fake_generalpodautoscaler.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/generalpodautoscaler.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/generalpodautoscaler.go index b89cdb907a..78841a3e85 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/generalpodautoscaler.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/generalpodautoscaler.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/generated_expansion.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/generated_expansion.go index e9527681b6..553423004e 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/generated_expansion.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/generated_expansion.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/informers/externalversions/autoscaling/interface.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/informers/externalversions/autoscaling/interface.go index 7f40309e0a..bffd293403 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/informers/externalversions/autoscaling/interface.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/informers/externalversions/autoscaling/interface.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/informers/externalversions/autoscaling/v1alpha1/generalpodautoscaler.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/informers/externalversions/autoscaling/v1alpha1/generalpodautoscaler.go index 09be881a02..a7b0fc0e8d 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/informers/externalversions/autoscaling/v1alpha1/generalpodautoscaler.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/informers/externalversions/autoscaling/v1alpha1/generalpodautoscaler.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/informers/externalversions/autoscaling/v1alpha1/interface.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/informers/externalversions/autoscaling/v1alpha1/interface.go index 5548298062..4daaf4e8c1 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/informers/externalversions/autoscaling/v1alpha1/interface.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/informers/externalversions/autoscaling/v1alpha1/interface.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/informers/externalversions/factory.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/informers/externalversions/factory.go index 1ae7f2434b..eb255e8c23 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/informers/externalversions/factory.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/informers/externalversions/factory.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/informers/externalversions/generic.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/informers/externalversions/generic.go index 61a84bd775..a60899143d 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/informers/externalversions/generic.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/informers/externalversions/generic.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go index 0ef15bfec7..30f332087a 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/listers/autoscaling/v1alpha1/expansion_generated.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/listers/autoscaling/v1alpha1/expansion_generated.go index 5eaf69ab50..bb63b4f9ff 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/listers/autoscaling/v1alpha1/expansion_generated.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/listers/autoscaling/v1alpha1/expansion_generated.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/listers/autoscaling/v1alpha1/generalpodautoscaler.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/listers/autoscaling/v1alpha1/generalpodautoscaler.go index 630191dee1..e31d13da8a 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/listers/autoscaling/v1alpha1/generalpodautoscaler.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/listers/autoscaling/v1alpha1/generalpodautoscaler.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/metrics/interfaces.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/metrics/interfaces.go index 63ec60e3bb..80577c15c1 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/metrics/interfaces.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/metrics/interfaces.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -15,10 +15,10 @@ package metrics import ( "time" - autoscaling "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/autoscaling/v1alpha1" - - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/labels" + + autoscaling "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/autoscaling/v1alpha1" ) // PodMetric contains pod metric value (the metric values are expected to be the metric as a milli-value) @@ -33,6 +33,7 @@ type PodMetricsInfo map[string]PodMetric // MetricsClient knows how to query a remote interface to retrieve container-level // resource metrics as well as pod-level arbitrary metrics +// nolint type MetricsClient interface { // GetResourceMetric gets the given resource metric (and an associated oldest timestamp) // for all pods matching the specified selector in the given namespace diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/metrics/legacy_metrics_client.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/metrics/legacy_metrics_client.go index b90886742f..b6814410f2 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/metrics/legacy_metrics_client.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/metrics/legacy_metrics_client.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -95,7 +95,7 @@ func (h *HeapsterMetricsClient) GetResourceMetric(resource v1.ResourceName, name podSum := int64(0) missing := len(m.Containers) == 0 for _, c := range m.Containers { - resValue, found := c.Usage[v1.ResourceName(resource)] + resValue, found := c.Usage[resource] if !found { missing = true klog.V(2).Infof("missing resource metric %v for container %s in pod %s/%s", resource, c.Name, namespace, m.Name) @@ -108,7 +108,7 @@ func (h *HeapsterMetricsClient) GetResourceMetric(resource v1.ResourceName, name res[m.Name] = PodMetric{ Timestamp: m.Timestamp.Time, Window: m.Window.Duration, - Value: int64(podSum), + Value: podSum, } } } @@ -175,7 +175,7 @@ func (h *HeapsterMetricsClient) GetRawMetric(metricName string, namespace string res[podNames[i]] = PodMetric{ Timestamp: podTimestamp, Window: heapsterDefaultMetricWindow, - Value: int64(val), + Value: val, } if timestamp == nil || podTimestamp.Before(*timestamp) { diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/metrics/metrics.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/metrics/metrics.go index 304e11f5df..20d331b77f 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/metrics/metrics.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/metrics/metrics.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/metrics/prometheus_metrics.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/metrics/prometheus_metrics.go index c4aa8d7276..b6fd37a03a 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/metrics/prometheus_metrics.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/metrics/prometheus_metrics.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/metrics/rest_metrics_client.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/metrics/rest_metrics_client.go index 5869934312..8e0f3da175 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/metrics/rest_metrics_client.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/metrics/rest_metrics_client.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -167,7 +167,7 @@ func (c *customMetricsClient) GetRawMetric(metricName string, namespace string, res[m.DescribedObject.Name] = PodMetric{ Timestamp: m.Timestamp.Time, Window: window, - Value: int64(m.Value.MilliValue()), + Value: m.Value.MilliValue(), } m.Value.MilliValue() diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/metrics/utilization.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/metrics/utilization.go index 46dbc335ee..d094257d08 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/metrics/utilization.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/metrics/utilization.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/requests/api.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/requests/api.go index 246aa61aa9..47695f851f 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/requests/api.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/requests/api.go @@ -4,12 +4,13 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 requests xxx package requests import "k8s.io/apimachinery/pkg/types" diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scaler/general.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scaler/general.go index 44727f1583..6990e03dc3 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scaler/general.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scaler/general.go @@ -4,22 +4,22 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 scaler xxx package scaler import ( "fmt" "math" - - // "reflect" "sync" "time" + // "k8s.io/apimachinery/pkg/types" pkgerrors "github.com/pkg/errors" autoscalinginternal "k8s.io/api/autoscaling/v1" v1 "k8s.io/api/core/v1" @@ -30,8 +30,6 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime/schema" - - // "k8s.io/apimachinery/pkg/types" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/wait" coreinformers "k8s.io/client-go/informers/core/v1" @@ -44,6 +42,7 @@ import ( "k8s.io/client-go/util/workqueue" "k8s.io/klog" + // "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/util" autoscaling "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/apis/autoscaling/v1alpha1" autoscalingscheme "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/scheme" autoscalingclient "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1" @@ -51,7 +50,6 @@ import ( autoscalinglisters "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/client/listers/autoscaling/v1alpha1" metricsclient "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/metrics" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scalercore" - // "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/util" ) var ( @@ -112,7 +110,7 @@ type GeneralController struct { scaleUpEventsLock sync.Mutex scaleDownEventsLock sync.Mutex - doingCron sync.Map + doingCron sync.Map // nolint // Multi goroutines for autoscaler workers int @@ -281,7 +279,7 @@ func getTargetRefKey(gpa *autoscaling.GeneralPodAutoscaler) string { func getMetricName(metricSpec autoscaling.MetricSpec) string { switch metricSpec.Type { case autoscaling.ObjectMetricSourceType: - return string(metricSpec.Object.Metric.Name) + return metricSpec.Object.Metric.Name case autoscaling.PodsMetricSourceType: return metricSpec.Pods.Metric.Name case autoscaling.ResourceMetricSourceType: @@ -376,6 +374,7 @@ func (a *GeneralController) computeReplicasForMetrics(gpa *autoscaling.GeneralPo // computeReplicasForSimple computes the desired number of replicas for the metric specifications listed in the GPA, // returning the maximum of the computed replica counts, a description of the associated metric, and the statuses of // all metrics computed. +// nolint func (a *GeneralController) computeReplicasForSimple(gpa *autoscaling.GeneralPodAutoscaler, scale *autoscalinginternal.Scale) (replicas int32, metric string, statuses []autoscaling.MetricStatus, timestamp time.Time, err error) { @@ -432,6 +431,7 @@ func (a *GeneralController) buildScalerChain(gpa *autoscaling.GeneralPodAutoscal // computeStatusForResourceMG 原方法名 computeStatusForResourceMetricGeneric // Computes the desired number of replicas for a specific gpa and metric specification, // returning the metric status and a proposed condition to be set on the GPA object. +// nolint func (a *GeneralController) computeStatusForResourceMG( currentReplicas int32, target autoscaling.MetricTarget, @@ -532,7 +532,7 @@ func (a *GeneralController) computeReplicasForMetric( switch spec.Type { case autoscaling.ObjectMetricSourceType: - metricSelector, err := metav1.LabelSelectorAsSelector(spec.Object.Metric.Selector) + metricSelector, err := metav1.LabelSelectorAsSelector(spec.Object.Metric.Selector) // nolint if err != nil { condition2 := a.getUnableComputeReplicaCC(gpa, "FailedGetObjectMetric", err) return 0, "", time.Time{}, condition2, @@ -545,7 +545,7 @@ func (a *GeneralController) computeReplicasForMetric( fmt.Errorf("failed to get object metric value: %v", err) } case autoscaling.PodsMetricSourceType: - metricSelector, err := metav1.LabelSelectorAsSelector(spec.Pods.Metric.Selector) + metricSelector, err := metav1.LabelSelectorAsSelector(spec.Pods.Metric.Selector) // nolint if err != nil { condition2 := a.getUnableComputeReplicaCC(gpa, "FailedGetPodsMetric", err) return 0, "", time.Time{}, condition2, @@ -962,6 +962,7 @@ func (a *GeneralController) recordInitialRecommendation(currentReplicas int32, k } } +// nolint funlen func (a *GeneralController) reconcileAutoscaler(gpa *autoscaling.GeneralPodAutoscaler, key string) error { // set default value, call Default() function will invoke scheme's defaulterFuncs scheme.Scheme.Default(gpa) @@ -1045,6 +1046,7 @@ func (a *GeneralController) reconcileAutoscaler(gpa *autoscaling.GeneralPodAutos } rescale := true + // nolint if scale.Spec.Replicas == 0 && minReplicas != 0 { // Autoscaling is disabled for this resource desiredReplicas = 0 @@ -1635,7 +1637,7 @@ func calculateScaleUpLimitWithSR(currentReplicas int32, scaleEvents []timestampe replicasAddedInCurrentPeriod := getReplicasChangePerPeriod(policy.PeriodSeconds, scaleEvents) periodStartReplicas := currentReplicas - replicasAddedInCurrentPeriod if policy.Type == autoscaling.PodsScalingPolicy { - proposed = int32(periodStartReplicas + policy.Value) + proposed = periodStartReplicas + policy.Value } else if policy.Type == autoscaling.PercentScalingPolicy { // the proposal has to be rounded up because the proposed change might not increase the replica count // causing the target to never scale up diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scaler/general_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scaler/general_test.go index 8704ad0da7..71ed16dfa4 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scaler/general_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scaler/general_test.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scaler/rate_limiters.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scaler/rate_limiters.go index a141cc9edc..ef493d8eeb 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scaler/rate_limiters.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scaler/rate_limiters.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scaler/replica_calculator.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scaler/replica_calculator.go index 995e599508..3092f13946 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scaler/replica_calculator.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scaler/replica_calculator.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -59,6 +59,7 @@ func NewReplicaCalculator(metricsClient metricsclient.MetricsClient, podLister c // GetResourceReplicas calculates the desired replica count based on a target resource utilization percentage // of the given resource for pods matching the given selector in the given namespace, and the current replica count +// nolint func (c *ReplicaCalculator) GetResourceReplicas(currentReplicas int32, targetUtilization int32, resource v1.ResourceName, namespace string, selector labels.Selector, container string, computeResourceUtilizationRatioByLimits bool) (replicaCount int32, utilization int32, rawUtilization int64, @@ -164,7 +165,8 @@ func (c *ReplicaCalculator) GetResourceReplicas(currentReplicas int32, targetUti return newReplicas, utilization, rawUtilization, timestamp, nil } -// GetRawResourceReplicas calculates the desired replica count based on a target resource utilization (as a raw milli-value) +// GetRawResourceReplicas calculates the desired replica count +// based on a target resource utilization (as a raw milli-value) // for pods matching the given selector in the given namespace, and the current replica count func (c *ReplicaCalculator) GetRawResourceReplicas(currentReplicas int32, targetUtilization int64, resource v1.ResourceName, namespace string, selector labels.Selector, container string) (replicaCount int32, @@ -292,6 +294,7 @@ func (c *ReplicaCalculator) GetObjectMetricReplicas(currentReplicas int32, targe // getUsageRatioReplicaCount calculates the desired replica count based on usageRatio and ready pods count. // For currentReplicas=0 doesn't take into account ready pods count and tolerance to support scaling to zero pods. +// nolint func (c *ReplicaCalculator) getUsageRatioReplicaCount(currentReplicas int32, usageRatio float64, namespace string, selector labels.Selector) (replicaCount int32, timestamp time.Time, err error) { if currentReplicas != 0 { @@ -312,7 +315,8 @@ func (c *ReplicaCalculator) getUsageRatioReplicaCount(currentReplicas int32, usa return replicaCount, timestamp, err } -// GetObjectPerPodMetricReplicas calculates the desired replica count based on a target metric utilization (as a milli-value) +// GetObjectPerPodMetricReplicas calculates the desired replica count +// based on a target metric utilization (as a milli-value) // for the given object in the given namespace, and the current replica count. func (c *ReplicaCalculator) GetObjectPerPodMetricReplicas(statusReplicas int32, targetAverageUtilization int64, metricName string, namespace string, objectRef *autoscaling.CrossVersionObjectReference, @@ -377,7 +381,7 @@ func (c *ReplicaCalculator) GetExternalMetricReplicas(currentReplicas int32, tar } utilization = 0 for _, val := range metrics { - utilization = utilization + val + utilization += val } usageRatio := float64(utilization) / float64(targetUtilization) @@ -403,7 +407,7 @@ func (c *ReplicaCalculator) GetExternalPerPodMetricReplicas(statusReplicas int32 } utilization = 0 for _, val := range metrics { - utilization = utilization + val + utilization += val } replicaCount = statusReplicas @@ -478,7 +482,7 @@ func calculatePodRequests(pods []*v1.Pod, resource v1.ResourceName, containerNam if containerName != "" && container.Name != containerName { continue } - if containerRequest, ok := container.Resources.Requests[resource]; ok { + if containerRequest, ok := container.Resources.Requests[resource]; ok { // nolint podSum += containerRequest.MilliValue() } else { return nil, fmt.Errorf("missing request for %s", resource) @@ -497,7 +501,7 @@ func calculatePodLimits(pods []*v1.Pod, resource v1.ResourceName, containerName if containerName != "" && container.Name != containerName { continue } - if containerLimit, ok := container.Resources.Limits[resource]; ok { + if containerLimit, ok := container.Resources.Limits[resource]; ok { // nolint podSum += containerLimit.MilliValue() } else { return nil, fmt.Errorf("missing limit for %s", resource) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scaler/replica_calculator_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scaler/replica_calculator_test.go index 7ec7b4cefb..788a8eb4b5 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scaler/replica_calculator_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scaler/replica_calculator_test.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scaler/utils.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scaler/utils.go index d75ffd3a37..74489ccd6b 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scaler/utils.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scaler/utils.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scalercore/cron.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scalercore/cron.go index daa3288649..eae270ad79 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scalercore/cron.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scalercore/cron.go @@ -4,12 +4,13 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 scalercore xxx package scalercore import ( @@ -79,6 +80,7 @@ func (s *CronScaler) ScalerName() string { return s.name } +// nolint func (s *CronScaler) getFinalMatchAndMisMatch(gpa *v1alpha1.GeneralPodAutoscaler, schedule string) (*time.Time, *time.Time, error) { sched, err := cron.ParseStandard(schedule) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scalercore/cron_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scalercore/cron_test.go index a9a1ff974e..4540109738 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scalercore/cron_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scalercore/cron_test.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scalercore/event.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scalercore/event.go index 76e8c66af1..eb4f1fede0 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scalercore/event.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scalercore/event.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -38,6 +38,6 @@ func (e *EventScaler) GetReplicas(*autoscalingv1.GeneralPodAutoscaler, int32) (i } // ScalerName scaler name -func (s *EventScaler) ScalerName() string { - return s.name +func (e *EventScaler) ScalerName() string { + return e.name } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scalercore/scaler.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scalercore/scaler.go index 73ee115161..ca4ff870d1 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scalercore/scaler.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scalercore/scaler.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scalercore/webhook.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scalercore/webhook.go index b8cf8c523a..5491a87c8b 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scalercore/webhook.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/scalercore/webhook.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -212,7 +212,7 @@ func setCABundle(caBundle []byte) error { return errors.New("no certs were appended from caBundle") } client.Transport = &http.Transport{ - TLSClientConfig: &tls.Config{ + TLSClientConfig: &tls.Config{ // nolint TLS MinVersion too low RootCAs: rootCAs, }, } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/util/patch.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/util/patch.go index f475837f1c..033f85faac 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/util/patch.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/util/patch.go @@ -4,12 +4,13 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 util xxx package util import ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/util/signal.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/util/signal.go index c2395bfa57..aeefa39230 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/util/signal.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/util/signal.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/validation/validation.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/validation/validation.go index 5f4830f76c..e4f877f465 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/validation/validation.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/validation/validation.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -192,11 +192,11 @@ func validateMetrics(metrics []autoscaling.MetricSpec, fldPath *field.Path, minR // validateWebhook validates webhook configuration and returns an ErrorList with any errors. func validateWebhook(wc *v1beta1.WebhookClientConfig, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} - if wc == nil { + if wc == nil { // nolint allErrs = append(allErrs, field.Forbidden(fldPath, "webhook config should not be empty")) } switch { - case wc.Service == nil && wc.URL == nil: + case wc.Service == nil && wc.URL == nil: // nolint allErrs = append(allErrs, field.Forbidden(fldPath, "must specify at least one service or url")) case wc.URL != nil: diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/validator/hook.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/validator/hook.go index 70ed9021b8..f2baf8a03a 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/validator/hook.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/validator/hook.go @@ -4,12 +4,13 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 webhook xxx package webhook import ( @@ -38,6 +39,7 @@ var ( ) // WebhookServer is the server of webhook +// nolint type WebhookServer struct { *http.Server } @@ -160,6 +162,7 @@ func (whsvr *WebhookServer) Serve(w http.ResponseWriter, r *http.Request) { } } +// nolint func forGPA(req *v1beta1.AdmissionRequest) ([]byte, []metav1.StatusCause, error) { var errs field.ErrorList causes := make([]metav1.StatusCause, 0) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/version/version.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/version/version.go index 64601e0f03..5d7ea03f75 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/version/version.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-general-pod-autoscaler/pkg/version/version.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/app/api-init.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/app/api-init.go index 140bae2975..f0dfe2a938 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/app/api-init.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/app/api-init.go @@ -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 app diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/app/app.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/app/app.go index 501cd6fdee..9436cf28b2 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/app/app.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/app/app.go @@ -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 app xxx @@ -21,11 +20,11 @@ import ( "strings" "github.com/Tencent/bk-bcs/bcs-common/common/blog" + "github.com/prometheus/client_golang/prometheus/promhttp" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/app/customscheduler" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/config" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/options" - - "github.com/prometheus/client_golang/prometheus/promhttp" ) // Run the customScheduler @@ -37,15 +36,13 @@ func Run(conf *config.CustomSchedulerConfig) { blog.Errorf("start processor error %s, and exit", err.Error()) os.Exit(1) } - - return } // RunPrometheusMetricsServer starting prometheus metrics handler func RunPrometheusMetricsServer(conf *config.CustomSchedulerConfig) { http.Handle("/metrics", promhttp.Handler()) addr := conf.Address + ":" + strconv.Itoa(int(conf.MetricPort)) - go http.ListenAndServe(addr, nil) + go http.ListenAndServe(addr, nil) // nolint } // ParseConfig xxx diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/app/customscheduler/customscheduler.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/app/customscheduler/customscheduler.go index f6eba37e3e..b2664b9973 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/app/customscheduler/customscheduler.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/app/customscheduler/customscheduler.go @@ -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 customscheduler custom scheduler @@ -18,6 +17,7 @@ import ( "fmt" "github.com/Tencent/bk-bcs/bcs-common/common/http/httpserver" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/config" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions" ) @@ -51,7 +51,7 @@ func NewCustomScheduler(conf *config.CustomSchedulerConfig) *CustomScheduler { // Start xxx func (p *CustomScheduler) Start() error { - p.httpServ.RegisterWebServer("", nil, actions.GetApiAction()) + p.httpServ.RegisterWebServer("", nil, actions.GetApiAction()) // nolint router := p.httpServ.GetRouter() webContainer := p.httpServ.GetWebContainer() router.Handle("/{sub_path:.*}", webContainer) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/config/config.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/config/config.go index 300bfc1e87..1186adf961 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/config/config.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/config/config.go @@ -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 config xxx diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/internal/cache/cache.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/internal/cache/cache.go index 2ce834cdf4..13dc9416f1 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/internal/cache/cache.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/internal/cache/cache.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/internal/cache/cache_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/internal/cache/cache_test.go index 1930edf1a2..3c08b3b9a6 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/internal/cache/cache_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/internal/cache/cache_test.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/internal/cache/resource.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/internal/cache/resource.go index 863f77c1f0..0e8d802fd1 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/internal/cache/resource.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/internal/cache/resource.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/internal/cache/utils.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/internal/cache/utils.go index 342dbce7ad..c4a7cb065c 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/internal/cache/utils.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/internal/cache/utils.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/main.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/main.go index 4635dff8e4..4bebfa5e5d 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/main.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/main.go @@ -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 ( @@ -22,6 +22,7 @@ import ( "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-k8s-custom-scheduler/app" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/options" v1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v1" @@ -63,7 +64,7 @@ func main() { defaultIpScheduler, err := v2.NewIpScheduler(conf) if err != nil { blog.Errorf("failed to build IpSchedulerV2: %s", err.Error()) - os.Exit(1) + os.Exit(1) // nolint } v2.DefaultIpScheduler = defaultIpScheduler defer v2.DefaultIpScheduler.Stop() @@ -71,12 +72,12 @@ func main() { defaultIpScheduler, err := v3.NewIpScheduler(conf) if err != nil { blog.Errorf("failed to build IpSchedulerV3: %s", err.Error()) - os.Exit(1) + os.Exit(1) // nolint } v3.DefaultIpScheduler = defaultIpScheduler if err := v3.StartInformers(); err != nil { blog.Errorf("start informers failed, err %s", err.Error()) - os.Exit(1) + os.Exit(1) // nolint } } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/options/options.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/options/options.go index 44c26f0543..bf9c75bdf6 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/options/options.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/options/options.go @@ -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 options xxx @@ -19,6 +18,7 @@ import ( ) // ServerOption is option in flags +// nolint type ServerOption struct { conf.FileConfig conf.ServiceConfig diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions/actions.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions/actions.go index 0b8b815ba6..0a895a0175 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions/actions.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions/actions.go @@ -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 actions xxx diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions/bind/bind.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions/bind/bind.go index e63495a8a3..c5ee628993 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions/bind/bind.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions/bind/bind.go @@ -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 bind xxx @@ -18,10 +17,10 @@ import ( "fmt" "time" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/emicklei/go-restful" schedulerapi "k8s.io/kubernetes/pkg/scheduler/api" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions" v1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v1" v2 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v2" @@ -69,10 +68,11 @@ func handleIpSchedulerBind(req *restful.Request, resp *restful.Response) { } metricsArgs.Status = metrics.ErrStatus - resp.WriteEntity(extenderBindingResult) + resp.WriteEntity(extenderBindingResult) // nolint return } + // nolint if ipSchedulerVersion == actions.IpSchedulerV1 { err = v1.HandleIpSchedulerBinding(extenderBindingArgs) } else if ipSchedulerVersion == actions.IpSchedulerV2 { @@ -89,7 +89,7 @@ func handleIpSchedulerBind(req *restful.Request, resp *restful.Response) { } metricsArgs.Status = metrics.ErrStatus - resp.WriteEntity(extenderBindingResult) + resp.WriteEntity(extenderBindingResult) // nolint return } @@ -99,6 +99,5 @@ func handleIpSchedulerBind(req *restful.Request, resp *restful.Response) { blog.Info("binding finished") metricsArgs.Status = metrics.ErrStatus - resp.WriteEntity(extenderBindingResult) - return + resp.WriteEntity(extenderBindingResult) // nolint } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions/common.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions/common.go index 694dde8b5f..c1d9196dfc 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions/common.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions/common.go @@ -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 actions diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions/prebind/prebind.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions/prebind/prebind.go index 33aaf41ad6..329b6d45be 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions/prebind/prebind.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions/prebind/prebind.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -17,10 +17,10 @@ import ( "fmt" "time" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/emicklei/go-restful" schedulerapi "k8s.io/kubernetes/pkg/scheduler/api" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions" v3 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v3" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/metrics" @@ -66,7 +66,7 @@ func handleIpSchedulerPreBind(req *restful.Request, resp *restful.Response) { } metricsArgs.Status = metrics.ErrStatus - resp.WriteEntity(extenderBindingResult) + resp.WriteEntity(extenderBindingResult) // nolint return } @@ -82,7 +82,7 @@ func handleIpSchedulerPreBind(req *restful.Request, resp *restful.Response) { } metricsArgs.Status = metrics.ErrStatus - resp.WriteEntity(extenderBindingResult) + resp.WriteEntity(extenderBindingResult) // nolint return } @@ -92,6 +92,5 @@ func handleIpSchedulerPreBind(req *restful.Request, resp *restful.Response) { blog.Info("prebind finished") metricsArgs.Status = metrics.ErrStatus - resp.WriteEntity(extenderBindingResult) - return + resp.WriteEntity(extenderBindingResult) // nolint } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions/predicate/predicate.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions/predicate/predicate.go index 97b39429c0..27e29a6552 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions/predicate/predicate.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions/predicate/predicate.go @@ -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 predicate xxx @@ -18,14 +17,14 @@ import ( "time" "github.com/Tencent/bk-bcs/bcs-common/common/blog" + "github.com/emicklei/go-restful" + schedulerapi "k8s.io/kubernetes/pkg/scheduler/api" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions" v1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v1" v2 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v2" v3 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v3" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/metrics" - - "github.com/emicklei/go-restful" - schedulerapi "k8s.io/kubernetes/pkg/scheduler/api" ) const ( @@ -67,11 +66,12 @@ func handleIpSchedulerPredicate(req *restful.Request, resp *restful.Response) { } metricsArgs.Status = metrics.ErrStatus - resp.WriteEntity(extenderFilterResult) + resp.WriteEntity(extenderFilterResult) // nolint return } metricsArgs.Status = metrics.SucStatus + // nolint if ipSchedulerVersion == actions.IpSchedulerV1 { extenderFilterResult, err = v1.HandleIpSchedulerPredicate(extenderArgs) } else if ipSchedulerVersion == actions.IpSchedulerV2 { @@ -94,6 +94,5 @@ func handleIpSchedulerPredicate(req *restful.Request, resp *restful.Response) { metricsArgs.Status = metrics.ErrStatus } - resp.WriteEntity(extenderFilterResult) - return + resp.WriteEntity(extenderFilterResult) // nolint } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v1/ipscheduler.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v1/ipscheduler.go index efe5dfc718..fce63b1fba 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v1/ipscheduler.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v1/ipscheduler.go @@ -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 v1 xxx package v1 import ( @@ -23,16 +23,16 @@ import ( "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-common/pkg/bcsapi" types "github.com/Tencent/bk-bcs/bcs-common/pkg/bcsapi/netservice" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/config" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/metrics" - v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" schedulerapi "k8s.io/kubernetes/pkg/scheduler/api" + + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/config" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/metrics" ) // IpScheduler ip scheduler @@ -96,6 +96,7 @@ func (i *IpScheduler) UpdateNetPoolsPeriodically() { i.NetPools = netPools + // nolint select { case <-ticker.C: } @@ -112,11 +113,9 @@ func HandleIpSchedulerPredicate(extenderArgs schedulerapi.ExtenderArgs) (*schedu metrics.ReportK8sCustomSchedulerNodeNum(actions.IpSchedulerV1, actions.TotalNodeNumKey, float64(len(extenderArgs.Nodes.Items))) - if extenderArgs.Pod.Spec.HostNetwork == true { + if extenderArgs.Pod.Spec.HostNetwork { blog.Infof("hostNetwork pod %s, skip to interact with netService", extenderArgs.Pod.Name) - for _, node := range extenderArgs.Nodes.Items { - canSchedule = append(canSchedule, node) - } + canSchedule = append(canSchedule, extenderArgs.Nodes.Items...) } else { blog.Infof("starting to predicate for pod %s", extenderArgs.Pod.Name) for _, node := range extenderArgs.Nodes.Items { @@ -156,7 +155,7 @@ func HandleIpSchedulerBinding(extenderBindingArgs schedulerapi.ExtenderBindingAr if err != nil { return fmt.Errorf("error when getting pod from cluster: %s", err.Error()) } - if pod.Spec.HostNetwork != true { + if !pod.Spec.HostNetwork { blog.Infof("starting to bind pod %s, update netService data in cache", extenderBindingArgs.PodName) strArray := strings.Split(extenderBindingArgs.Node, "-") @@ -168,6 +167,7 @@ func HandleIpSchedulerBinding(extenderBindingArgs schedulerapi.ExtenderBindingAr length := len(netPool.Available) blog.Info(netPool.Net) blog.Info("%d", length) + // nolint if length > 0 { DefaultIpScheduler.NetPools[i].Available = netPool.Available[:length-1] blog.Info("%d", len(DefaultIpScheduler.NetPools[i].Available)) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v1/netsvc.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v1/netsvc.go index 3e2c670187..3e278057fe 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v1/netsvc.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v1/netsvc.go @@ -8,18 +8,18 @@ * 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 v1 import ( + "fmt" + "strings" + "github.com/Tencent/bk-bcs/bcs-common/pkg/bcsapi" types "github.com/Tencent/bk-bcs/bcs-common/pkg/bcsapi/netservice" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/config" - "fmt" - "strings" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/config" ) // BcsConfig config item for ipscheduler diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v2/common.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v2/common.go index 4f8ad3129d..3d60800912 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v2/common.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v2/common.go @@ -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 v2 xxx package v2 const ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v2/ipscheduler.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v2/ipscheduler.go index da637c6157..f616b2c74e 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v2/ipscheduler.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v2/ipscheduler.go @@ -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 v2 @@ -27,13 +26,8 @@ import ( networkclientset "github.com/Tencent/bk-bcs/bcs-k8s/kubernetes/generated/clientset/versioned" networkinformers "github.com/Tencent/bk-bcs/bcs-k8s/kubernetes/generated/informers/externalversions" networklisters "github.com/Tencent/bk-bcs/bcs-k8s/kubernetes/generated/listers/cloud/v1" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/config" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/internal/cache" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/metrics" pbcloudnet "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/api/protocol/cloudnetservice" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/pkg/grpclb" - "google.golang.org/grpc" grpccredentials "google.golang.org/grpc/credentials" v1 "k8s.io/api/core/v1" @@ -46,6 +40,11 @@ import ( clientGoCache "k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/clientcmd" schedulerapi "k8s.io/kubernetes/pkg/scheduler/api" + + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/config" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/internal/cache" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/metrics" ) // IpScheduler k8s scheduler extender api for bcs cloud netservice @@ -76,6 +75,7 @@ type IpScheduler struct { var DefaultIpScheduler *IpScheduler // NewIpScheduler create a v2 IpScheduler +// nolint funlen func NewIpScheduler(conf *config.CustomSchedulerConfig) (*IpScheduler, error) { // set up signals so we handle the first shutdown signal gracefully stopCh := signals.SetupSignalHandler() @@ -98,6 +98,7 @@ func NewIpScheduler(conf *config.CustomSchedulerConfig) (*IpScheduler, error) { conn, err = grpc.Dial( "", grpc.WithInsecure(), + // nolint grpc.WithBalancer is deprecated grpc.WithBalancer(grpc.RoundRobin(grpclb.NewPseudoResolver(conf.CloudNetserviceEndpoints))), ) } else { @@ -113,6 +114,7 @@ func NewIpScheduler(conf *config.CustomSchedulerConfig) (*IpScheduler, error) { conn, err = grpc.Dial( "", grpc.WithTransportCredentials(grpccredentials.NewTLS(tlsConfig)), + // nolint grpc.WithBalancer is deprecated grpc.WithBalancer(grpc.RoundRobin(grpclb.NewPseudoResolver(conf.CloudNetserviceEndpoints))), ) } @@ -212,9 +214,7 @@ func HandleIpSchedulerPredicate(extenderArgs schedulerapi.ExtenderArgs) (*schedu } else { // unmatched annotation, skip to schedule with IpSchedulerV2 blog.Infof("pod %s without cni annotation, skip to schedule with IpSchedulerV2 ", extenderArgs.Pod.Name) - for _, node := range extenderArgs.Nodes.Items { - canSchedule = append(canSchedule, node) - } + canSchedule = append(canSchedule, extenderArgs.Nodes.Items...) } metrics.ReportK8sCustomSchedulerNodeNum(actions.IpSchedulerV2, actions.CanSchedulerNodeNumKey, @@ -268,6 +268,7 @@ func HandleIpSchedulerBinding(extenderBindingArgs schedulerapi.ExtenderBindingAr DefaultIpScheduler.CacheLock.Unlock() return fmt.Errorf("no enough resource to bind to node %s/%s", extenderBindingArgs.Node, nodeAddr) } + // nolint DefaultIpScheduler.NodeIPCache.UpdateResource(&cache.Resource{ PodName: extenderBindingArgs.PodName, PodNamespace: extenderBindingArgs.PodNamespace, @@ -292,6 +293,7 @@ func HandleIpSchedulerBinding(extenderBindingArgs schedulerapi.ExtenderBindingAr context.Background(), bind, metav1.CreateOptions{}) if err != nil { DefaultIpScheduler.CacheLock.Lock() + // nolint DefaultIpScheduler.NodeIPCache.DeleteResource( cache.GetMetaKey(extenderBindingArgs.PodName, extenderBindingArgs.PodNamespace)) DefaultIpScheduler.CacheLock.Unlock() @@ -331,6 +333,7 @@ func (i *IpScheduler) OnDelete(del interface{}) { } blog.Infof("pod %s/%s is deletd", delPod.GetName(), delPod.GetNamespace()) i.CacheLock.Lock() + // nolint i.NodeIPCache.DeleteResource(cache.GetMetaKey(delPod.GetName(), delPod.GetNamespace())) i.CacheLock.Unlock() } @@ -349,6 +352,7 @@ func (i *IpScheduler) initCache() error { } for _, ip := range cloudIPs { if ip.GetNamespace() != "bcs-system" { + // nolint i.NodeIPCache.UpdateResource(&cache.Resource{ PodName: ip.Spec.PodName, PodNamespace: ip.Spec.Namespace, @@ -406,10 +410,7 @@ func (i *IpScheduler) checkQuota() bool { i.QuotaLock.Lock() defer i.QuotaLock.Unlock() resList := i.NodeIPCache.GetAllResources() - if len(resList) < i.QuotaLimit { - return true - } - return false + return len(resList) < i.QuotaLimit } // checkSchedulable check whether a node is schedulable diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v2/ipscheduler_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v2/ipscheduler_test.go index 1b1d09d6f9..05eac71956 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v2/ipscheduler_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v2/ipscheduler_test.go @@ -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 v2 diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v3/cache.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v3/cache.go index da6efc1ce9..60677791a3 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v3/cache.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v3/cache.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v3/eventhandler.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v3/eventhandler.go index 7212ebaa23..4490ad1e3a 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v3/eventhandler.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v3/eventhandler.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -13,11 +13,10 @@ package v3 import ( + "github.com/Tencent/bk-bcs/bcs-common/common/blog" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/tools/cache" - - "github.com/Tencent/bk-bcs/bcs-common/common/blog" ) type ipHandler struct { diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v3/ipscheduler.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v3/ipscheduler.go index c5d3bcf8b8..eead6c0fc9 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v3/ipscheduler.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v3/ipscheduler.go @@ -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. - * */ // NOCC:tosa/comment_ratio(none) @@ -19,6 +18,7 @@ package v3 import ( "fmt" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" @@ -31,7 +31,6 @@ import ( "k8s.io/client-go/tools/clientcmd" schedulerapi "k8s.io/kubernetes/pkg/scheduler/api" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/config" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/actions" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/metrics" diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v3/types.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v3/types.go index 5484046ecb..093a643b0b 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v3/types.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/ipscheduler/v3/types.go @@ -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 v3 diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/metrics/metrics.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/metrics/metrics.go index 98de54cc18..cc397168f2 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/metrics/metrics.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-k8s-custom-scheduler/pkg/metrics/metrics.go @@ -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 metrics xxx diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/app/app.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/app/app.go index 2ac1f58187..11ef648269 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/app/app.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/app/app.go @@ -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 app xxx @@ -20,6 +19,7 @@ import ( "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-logbeat-sidecar/app/options" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/config" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/metric" diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/app/options/options.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/app/options/options.go index 2a5842ae7b..6f667ea65c 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/app/options/options.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/app/options/options.go @@ -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 options xxx @@ -19,6 +18,7 @@ import ( ) // SidecarOption is option in flags +// nolint type SidecarOption struct { conf.FileConfig conf.ServiceConfig diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/config/config.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/config/config.go index 85c7af8fd5..f0702a600b 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/config/config.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/config/config.go @@ -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 config xxx diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/main.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/main.go index 2630badbdc..eefd86a289 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/main.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/main.go @@ -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 ( @@ -20,6 +20,7 @@ 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-logbeat-sidecar/app" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/app/options" ) @@ -36,7 +37,7 @@ func main() { err := app.Run(op) if err != nil { blog.Errorf(err.Error()) - os.Exit(1) + os.Exit(1) // nolint } ch := make(chan bool) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/metric/logfileinfo_guage.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/metric/logfileinfo_guage.go index 6eee23b6f1..5a65abdf3c 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/metric/logfileinfo_guage.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/metric/logfileinfo_guage.go @@ -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 metric @@ -96,7 +95,7 @@ func (info *LogFileInfoType) Update(newinfo *LogFileInfoType) error { if err != nil { return err } - singleGauge.Write(m) + singleGauge.Write(m) // nolint if err != nil { return err } @@ -109,7 +108,7 @@ func (info *LogFileInfoType) Update(newinfo *LogFileInfoType) error { if err != nil { return err } - singleGauge.Write(m) + singleGauge.Write(m) // nolint error not checked if err != nil { return err } @@ -161,7 +160,7 @@ func (info *LogFileInfoType) Renew() error { if err != nil { return err } - singleGauge.Write(m) + singleGauge.Write(m) // nolint error not checked if err != nil { return err } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/metric/metric.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/metric/metric.go index 6ff10a8818..1018ca75f8 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/metric/metric.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/metric/metric.go @@ -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 metric xxx @@ -18,13 +17,13 @@ import ( "fmt" "net/http" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" - - "github.com/Tencent/bk-bcs/bcs-common/common/blog" ) // MetricClient is interface for prometheus client +// nolint type MetricClient interface { Start() } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/sidecar/cache.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/sidecar/cache.go index 1baec47320..4d0ee23de6 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/sidecar/cache.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/sidecar/cache.go @@ -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 sidecar xxx package sidecar import ( @@ -27,7 +27,7 @@ func (s *SidecarController) syncContainerCache() { blog.Infof("Start sync containerInfoCache periodly") ticker := time.NewTicker(time.Hour) defer ticker.Stop() - for { + for { // nolint select { case <-ticker.C: s.syncContainerCacheOnce() @@ -63,7 +63,7 @@ func (s *SidecarController) inspectContainer(id string) *dockertypes.ContainerJS inspectChan := make(chan interface{}, 1) timer := time.NewTimer(3 * time.Second) // NOCC:vet/vet(工具误报:函数末尾有用到cancelFunc) - ctx, cancelFunc := context.WithCancel(context.Background()) + ctx, cancelFunc := context.WithCancel(context.Background()) // nolint cancelFunc is not used on all paths go func() { defer close(inspectChan) c, err := s.client.ContainerInspect(ctx, id) @@ -83,12 +83,12 @@ func (s *SidecarController) inspectContainer(id string) *dockertypes.ContainerJS if ok { blog.Errorf("docker InspectContainer %s failed: %s", id, err.Error()) // NOCC:vet/vet(设计如此:不需要使用cancelFunc) - return nil + return nil // nolint without using the cancelFunc } c, ok := obj.(dockertypes.ContainerJSON) if !ok { blog.Errorf("docker InspectContainer %s failed with type(%T) returned, expected dockertypes.ContainerJSON", id, obj) - return nil + return nil // nolint without using the cancelFunc } return &c case <-timer.C: diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/sidecar/controller.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/sidecar/controller.go index 8f2ca100b7..34a9085a0b 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/sidecar/controller.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/sidecar/controller.go @@ -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 sidecar @@ -28,10 +27,6 @@ import ( "github.com/Tencent/bk-bcs/bcs-common/common/blog" bcsv1 "github.com/Tencent/bk-bcs/bcs-k8s/kubebkbcs/apis/bkbcs/v1" bkbcsv1 "github.com/Tencent/bk-bcs/bcs-k8s/kubebkbcs/generated/listers/bkbcs/v1" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/config" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/metric" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/types" - dockerapi "github.com/docker/docker/api" dockertypes "github.com/docker/docker/api/types" dockerevents "github.com/docker/docker/api/types/events" @@ -42,6 +37,10 @@ import ( "k8s.io/apimachinery/pkg/labels" corev1 "k8s.io/client-go/listers/core/v1" "k8s.io/client-go/tools/cache" + + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/config" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/metric" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/types" ) const ( @@ -53,7 +52,8 @@ const ( ContainerLabelK8sPodNameSpace = "io.kubernetes.pod.namespace" ) -// SidecarController controls the behaviour of BcsLogConfig CRD +// SidecarController controls the behavior of BcsLogConfig CRD +// nolint type SidecarController struct { sync.RWMutex @@ -98,8 +98,8 @@ type LogConfParameter struct { // custom label CustemLabel string - stdout bool - nonstandardLog string + stdout bool // nolint unused + nonstandardLog string // nolint unused } // NewSidecarController returns a new bcslogconfigs controller @@ -163,7 +163,7 @@ func makeProperDockerClient(dockerhost string) (*docker.Client, error) { } func getDockerClientVersion(errString string) string { - r := regexp.MustCompile("\\d\\.\\d\\d") + r := regexp.MustCompile("\\d\\.\\d\\d") // nolint versions := r.FindAllString(errString, -1) if len(versions) != 2 { blog.Errorf("Extract server version from docker daemon failed. Use min version instead") @@ -209,7 +209,7 @@ func (s *SidecarController) listenerDockerEvent() { select { case message = <-eventChan: blog.V(3).Infof("receive docker event action %s container %s", message.Action, message.ID) - case err := <-errChan: + case err = <-errChan: blog.Fatalf("Docker event channal return error: %s", err.Error()) } @@ -298,7 +298,7 @@ func (s *SidecarController) syncLogConfs() { podName := c.Config.Labels[ContainerLabelK8sPodName] podNameSpace := c.Config.Labels[ContainerLabelK8sPodNameSpace] // NOCC:vetshadow/shadow(设计如此:可以覆盖err) - pod, err := s.podLister.Pods(podNameSpace).Get(podName) + pod, err := s.podLister.Pods(podNameSpace).Get(podName) // nolint if err != nil { blog.Errorf("list pod(%s/%s) failed: %s", podNameSpace, podName, err.Error()) continue @@ -459,7 +459,7 @@ func (s *SidecarController) writeLogConfFile(key string, y *types.Yaml) { } // if log config exist, and not changed s.RLock() - logConf, _ := s.logConfs[key] + logConf := s.logConfs[key] s.RUnlock() if logConf != nil { if logConf.yamlData != nil && logConf.yamlData.BCSLogConfigKey != "" && logConf.yamlData.BCSLogConfigKey != @@ -533,7 +533,7 @@ func (s *SidecarController) deleteContainerLogConf(containerID string) { return } if logConf.yamlData != nil { - logConf.yamlData.Metric.Delete() + logConf.yamlData.Metric.Delete() // nolint error not checked } delete(s.logConfs, key) blog.Infof("delete container %s log config success", containerID) @@ -542,6 +542,7 @@ func (s *SidecarController) deleteContainerLogConf(containerID string) { // produceLogConfParameterV2 xxx // if need to collect the container logs, return true // else return false +// nolint funlen func (s *SidecarController) produceLogConfParameterV2(container *dockertypes.ContainerJSON) (*types.Yaml, bool) { // if container is network, ignore name := container.Config.Labels[ContainerLabelK8sContainerName] @@ -590,7 +591,7 @@ func (s *SidecarController) produceLogConfParameterV2(container *dockertypes.Con var ( stdoutDataid = "" // NOCC:ineffassign/assign(设计如此:仅初始化赋值为空字符串) - referenceKind = "" + referenceKind = "" // nolint ineffectual assignment to referenceKind referenceName = "" ) if len(pod.OwnerReferences) != 0 { @@ -612,6 +613,7 @@ func (s *SidecarController) produceLogConfParameterV2(container *dockertypes.Con if !container.State.Running && container.State.Status != "created" { var closeEOF = true para.CloseEOF = &closeEOF + // nolint para.CloseTimeout = time.Duration(time.Duration(logConf.Spec.ExitedContainerLogCloseTimeout) * time.Second).String() } if conf.Multiline != nil && conf.Multiline.Type != "" { @@ -636,7 +638,7 @@ func (s *SidecarController) produceLogConfParameterV2(container *dockertypes.Con } // custom log tags for k, v := range conf.LogTags { - para.ExtMeta[fmt.Sprintf("%s", strings.ReplaceAll(k, ".", "_"))] = v + para.ExtMeta[strings.ReplaceAll(k, ".", "_")] = v } // generate std output log collection config if stdoutDataid == "" && conf.Stdout && conf.StdDataId != "" { diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/sidecar/logconfig.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/sidecar/logconfig.go index ee40860c07..29679ec0fa 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/sidecar/logconfig.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/sidecar/logconfig.go @@ -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 sidecar @@ -27,7 +26,6 @@ import ( internalclientset "github.com/Tencent/bk-bcs/bcs-k8s/kubebkbcs/generated/clientset/versioned" "github.com/Tencent/bk-bcs/bcs-k8s/kubebkbcs/generated/informers/externalversions" dockertypes "github.com/docker/docker/api/types" - corev1 "k8s.io/api/core/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" @@ -188,6 +186,7 @@ func (s *SidecarController) getPodLogConfigCrd(container *dockertypes.ContainerJ // BcsLogConfig parameter WorkloadType、WorkloadName、WorkloadNamespace matched, increased 2 score // BcsLogConfig parameter ContainerName matched, increased 10 score // finally, the above scores will be accumulated to be the BcsLogConfig final score +// nolint funlen func (s *SidecarController) scoreBcsLogConfig(container *dockertypes.ContainerJSON, pod *corev1.Pod, bcsLogConf *bcsv1.BcsLogConfig) int { // do not select ConfigType == host @@ -242,7 +241,8 @@ func (s *SidecarController) scoreBcsLogConfig(container *dockertypes.ContainerJS if bcsLogConf.Spec.WorkloadType != "" { if len(pod.OwnerReferences) == 0 { blog.Warnf( - "container %s pod(%s) not match BcsLogConfig(%s:%s) WorkloadType %s, because of lacking onwer reference information", + "container %s pod(%s) not match BcsLogConfig(%s:%s) WorkloadType %s, "+ + "because of lacking onwer reference information", container.ID, pod.Name, bcsLogConf.Namespace, bcsLogConf.Name, bcsLogConf.Spec.WorkloadType) return 0 } @@ -266,6 +266,7 @@ func (s *SidecarController) scoreBcsLogConfig(container *dockertypes.ContainerJS } } if bcsLogConf.Spec.WorkloadNamespace != "" { + // nolint if pod.Namespace == bcsLogConf.Spec.WorkloadNamespace { score += 2 // not matched, return 0 score @@ -278,7 +279,8 @@ func (s *SidecarController) scoreBcsLogConfig(container *dockertypes.ContainerJS if bcsLogConf.Spec.WorkloadName != "" { if len(pod.OwnerReferences) == 0 { blog.Warnf( - "container %s pod(%s) not match BcsLogConfig(%s:%s) WorkloadName %s, because of lacking onwer reference information", + "container %s pod(%s) not match BcsLogConfig(%s:%s) WorkloadName %s, "+ + "because of lacking onwer reference information", container.ID, pod.Name, bcsLogConf.Namespace, bcsLogConf.Name, bcsLogConf.Spec.WorkloadName) return 0 } @@ -422,7 +424,8 @@ func (s *SidecarController) createCrdV1(bcsLogConfigPlural, bcsLogConfigFullName }, }, } - _, err := s.extensionClientset.ApiextensionsV1().CustomResourceDefinitions().Create(context.Background(), crd, metav1.CreateOptions{TypeMeta: crd.TypeMeta}) + _, err := s.extensionClientset.ApiextensionsV1().CustomResourceDefinitions().Create(context.Background(), crd, + metav1.CreateOptions{TypeMeta: crd.TypeMeta}) return err } @@ -442,6 +445,7 @@ func (s *SidecarController) createCrdV1Beta1(bcsLogConfigPlural, bcsLogConfigFul }, }, } - _, err := s.extensionClientset.ApiextensionsV1beta1().CustomResourceDefinitions().Create(context.Background(), crd, metav1.CreateOptions{TypeMeta: crd.TypeMeta}) + _, err := s.extensionClientset.ApiextensionsV1beta1().CustomResourceDefinitions().Create(context.Background(), + crd, metav1.CreateOptions{TypeMeta: crd.TypeMeta}) return err } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/types/types.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/types/types.go index 710725a9f2..3573d01a1a 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/types/types.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/types/types.go @@ -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 types xxx @@ -16,6 +15,7 @@ package types import ( bcsv1 "github.com/Tencent/bk-bcs/bcs-k8s/kubebkbcs/apis/bkbcs/v1" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-logbeat-sidecar/metric" ) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/internal/constant/flag.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/internal/constant/flag.go index 694239351f..e01e75b90d 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/internal/constant/flag.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/internal/constant/flag.go @@ -4,12 +4,13 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 constant xxx package constant const ( @@ -27,7 +28,7 @@ const ( // FlagKeyKubeconfigSecretName k8s secret name for proxy to get all kubeconfigs when use secret mode FlagKeyKubeconfigSecretName = "kubeconfig-secretname" // nolint // FlagKeyKubeconfigSecretNamespace k8s secret namespace for proxy to get all kubeconfigs when use secret mode - FlagKeyKubeconfigSecretNamespace = "kubeconfig-secretnamespace" + FlagKeyKubeconfigSecretNamespace = "kubeconfig-secretnamespace" // nolint // FlagKeyKubeconfigDir is the directory which holds all kubeconfigs for different namespaces FlagKeyKubeconfigDir = "kubeconfig-dir" // FlagKeyKubeconfigDefaultNs is the default namespace to use for non-namespaced api resource diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/internal/proxy/handler.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/internal/proxy/handler.go index 510ef5d6ff..f473f1de81 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/internal/proxy/handler.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/internal/proxy/handler.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/internal/proxy/proxy.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/internal/proxy/proxy.go index 931b293df3..2d551b0c17 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/internal/proxy/proxy.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/internal/proxy/proxy.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -35,7 +35,7 @@ func (r *responder) Error(w http.ResponseWriter, req *http.Request, err error) { func extractIPAddress(serverAddress string) (*url.URL, error) { if !strings.HasSuffix(serverAddress, "/") { - serverAddress = serverAddress + "/" + serverAddress += "/" } ipAddress, err := url.Parse(serverAddress) if err != nil { @@ -63,7 +63,7 @@ func makeUpgradeTransport(config *rest.Config, keepalive time.Duration) (proxy.U TLSClientConfig: tlsConfig, Dial: func(network, addr string) (net.Conn, error) { // resolve domain to real apiserver address - ipAddress, err := extractIPAddress(config.Host) + ipAddress, err := extractIPAddress(config.Host) // nolint if err != nil { return nil, err } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/internal/proxy/utils.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/internal/proxy/utils.go index e508e32353..3e326c370e 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/internal/proxy/utils.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/internal/proxy/utils.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/internal/proxy/utils_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/internal/proxy/utils_test.go index 4f6bdf6821..9a9a2d3fa6 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/internal/proxy/utils_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/internal/proxy/utils_test.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/main.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/main.go index 8d9d80a2f9..71839fb597 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/main.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/main.go @@ -4,12 +4,13 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 ( @@ -28,6 +29,7 @@ import ( "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/pkg/filewatcher" ) +// nolint funlen func main() { pflag.String(constant.FlagKeyKubeconfigMode, "file", "mode for proxy to get all kubeconfigs, available [secret, file]") @@ -49,7 +51,7 @@ func main() { var configName string pflag.StringVar(&configName, constant.FlagKeyConfigName, "config.yaml", "The config file name of bcs-multi-ns-proxy") - pflag.CommandLine.AddGoFlagSet(flag.CommandLine) + pflag.CommandLine.AddGoFlagSet(flag.CommandLine) // nolint viper.AutomaticEnv() viper.BindPFlags(pflag.CommandLine) if len(configName) != 0 { @@ -120,7 +122,7 @@ func main() { router.Handle("/{uri:.*}", handler) if err := httpServer.ListenAndServeMux(false); err != nil { blog.Errorf("http listen and serve failed, err %s", err.Error()) - os.Exit(1) + os.Exit(1) // nolint } ch := make(chan int) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/pkg/filewatcher/checker.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/pkg/filewatcher/checker.go index 86fe4b1630..12fbbf3615 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/pkg/filewatcher/checker.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/pkg/filewatcher/checker.go @@ -4,12 +4,13 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 filewatcher xxx package filewatcher import ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/pkg/filewatcher/checker_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/pkg/filewatcher/checker_test.go index ceee427a4e..5c19ae8e65 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/pkg/filewatcher/checker_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/pkg/filewatcher/checker_test.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/pkg/filewatcher/event.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/pkg/filewatcher/event.go index 4aa3161ef6..04c48a2b25 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/pkg/filewatcher/event.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/pkg/filewatcher/event.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/pkg/filewatcher/lister.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/pkg/filewatcher/lister.go index f844b10054..24d378ecca 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/pkg/filewatcher/lister.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/pkg/filewatcher/lister.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1/bcsnetip_types.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1/bcsnetip_types.go index 054598f9c0..8bb7288f06 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1/bcsnetip_types.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1/bcsnetip_types.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1/bcsnetipclaim_types.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1/bcsnetipclaim_types.go index dddd5980ec..77d6cf1297 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1/bcsnetipclaim_types.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1/bcsnetipclaim_types.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1/bcsnetpool_types.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1/bcsnetpool_types.go index f133a66987..4742f2bd54 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1/bcsnetpool_types.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1/bcsnetpool_types.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1/bcsnetpool_webhook.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1/bcsnetpool_webhook.go index 5bc2cb9161..0ac3ace21d 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1/bcsnetpool_webhook.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1/bcsnetpool_webhook.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -18,6 +18,7 @@ import ( "fmt" "net" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" k8serrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" @@ -25,7 +26,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/webhook/admission" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/internal/constant" ) @@ -43,7 +43,9 @@ func (r *BCSNetPool) SetupWebhookWithManager(mgr ctrl.Manager) error { } // NOCC:tosa/linelength(设计如此) -//+kubebuilder:webhook:path=/mutate-netservice-bkbcs-tencent-com-v1-bcsnetpool,mutating=true,failurePolicy=fail,sideEffects=None,groups=netservice.bkbcs.tencent.com,resources=bcsnetpools,verbs=create;update,versions=v1,name=mbcsnetpool.kb.io,admissionReviewVersions=v1 +// +kubebuilder:webhook:path=/mutate-netservice-bkbcs-tencent-com-v1-bcsnetpool,mutating=true, +// failurePolicy=fail,sideEffects=None,groups=netservice.bkbcs.tencent.com, +// resources=bcsnetpools,verbs=create;update,versions=v1,name=mbcsnetpool.kb.io,admissionReviewVersions=v1 var _ admission.CustomDefaulter = &bcsNetPoolClient{} @@ -53,7 +55,9 @@ func (c *bcsNetPoolClient) Default(ctx context.Context, obj runtime.Object) erro } // NOCC:tosa/linelength(设计如此) -//+kubebuilder:webhook:path=/validate-netservice-bkbcs-tencent-com-v1-bcsnetpool,mutating=false,failurePolicy=fail,sideEffects=None,groups=netservice.bkbcs.tencent.com,resources=bcsnetpools,verbs=create;update;delete,versions=v1,name=vbcsnetpool.kb.io,admissionReviewVersions=v1 +// +kubebuilder:webhook:path=/validate-netservice-bkbcs-tencent-com-v1-bcsnetpool,mutating=false, +// failurePolicy=fail,sideEffects=None,groups=netservice.bkbcs.tencent.com, +// resources=bcsnetpools,verbs=create;update;delete,versions=v1,name=vbcsnetpool.kb.io,admissionReviewVersions=v1 var _ admission.CustomValidator = &bcsNetPoolClient{} diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1/groupversion_info.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1/groupversion_info.go index 2331b69e30..6122533d91 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1/groupversion_info.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1/groupversion_info.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1/zz_generated.deepcopy.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1/zz_generated.deepcopy.go index 19d19ecc23..2b42b3b157 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1/zz_generated.deepcopy.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1/zz_generated.deepcopy.go @@ -2,17 +2,16 @@ // +build !ignore_autogenerated /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. */ - // Code generated by controller-gen. DO NOT EDIT. package v1 diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/cni/cni.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/cni/cni.go index 78b82152cf..3f2becf96e 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/cni/cni.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/cni/cni.go @@ -1,15 +1,16 @@ /* * Tencent is pleased to support the open source community by making Blueking Container Service available. - * Copyright (C) 2023 THL A29 Limited, a Tencent company. All rights reserved. + * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 ( @@ -51,6 +52,7 @@ const ( ethernetMTU = 1500 ) +// nolint func loadConf(args *skel.CmdArgs) (*NetConf, *cnitypes.K8SArgs, error) { conf := NetConf{} if err := json.Unmarshal(args.StdinData, &conf); err != nil { @@ -189,7 +191,7 @@ func cmdAdd(args *skel.CmdArgs) (retErr error) { if err != nil { return errors.Wrapf(err, "failed to open netns %q", args.Netns) } - defer netns.Close() + defer netns.Close() // nolint hostIface, contIface, err := setupVeth(netns, args.IfName) if err != nil { @@ -202,9 +204,9 @@ func cmdAdd(args *skel.CmdArgs) (retErr error) { } defer func() { if retErr != nil { - logging.Errorf("failed process cni add request: %v", retErr) - if err := ipam.ExecDel(conf.IPAM.Type, args.StdinData); err != nil { - logging.Errorf("failed to rollback result from ipam %v: %v", ipamRet, err) + logging.Errorf("failed process cni add request: %v", retErr) // nolint + if err = ipam.ExecDel(conf.IPAM.Type, args.StdinData); err != nil { + logging.Errorf("failed to rollback result from ipam %v: %v", ipamRet, err) // nolint } } }() diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/cni/types/types.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/cni/types/types.go index c64552c351..a61a44a824 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/cni/types/types.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/cni/types/types.go @@ -1,25 +1,27 @@ /* * Tencent is pleased to support the open source community by making Blueking Container Service available. - * Copyright (C) 2023 THL A29 Limited, a Tencent company. All rights reserved. + * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 cni xxx package cni import "github.com/containernetworking/cni/pkg/types" const ( - // ip rules priority and leave 512 gap for future + // ToPodRulePriority ip rules priority and leave 512 gap for future ToPodRulePriority = 512 - // 1024 is reserved for (ip rule not to table main) + // FromPodRulePriority 1024 is reserved for (ip rule not to table main) FromPodRulePriority = 1536 + // VethPrefix xxx VethPrefix = "eni" ) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/controllers/bcsnetipclaim_controller.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/controllers/bcsnetipclaim_controller.go index 7be90a9a26..7583c37e17 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/controllers/bcsnetipclaim_controller.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/controllers/bcsnetipclaim_controller.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -18,6 +18,7 @@ import ( "fmt" "time" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" v1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -27,7 +28,6 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" netservicev1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/internal/constant" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/internal/utils" @@ -40,7 +40,8 @@ type BCSNetIPClaimReconciler struct { Recorder record.EventRecorder } -//+kubebuilder:rbac:groups=netservice.bkbcs.tencent.com,resources=bcsnetipclaims,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=netservice.bkbcs.tencent.com, +// resources=bcsnetipclaims,verbs=get;list;watch;create;update;patch;delete //+kubebuilder:rbac:groups=netservice.bkbcs.tencent.com,resources=bcsnetipclaims/status,verbs=get;update;patch //+kubebuilder:rbac:groups=netservice.bkbcs.tencent.com,resources=bcsnetips,verbs=get;list;watch;update;patch //+kubebuilder:rbac:groups=netservice.bkbcs.tencent.com,resources=bcsnetips/status,verbs=get;update;patch @@ -149,6 +150,7 @@ func (r *BCSNetIPClaimReconciler) unboundIP(ctx context.Context, claim *netservi return nil } +// nolint return nil func (r *BCSNetIPClaimReconciler) addFinalizerForPool(claim *netservicev1.BCSNetIPClaim) error { claim.Finalizers = append(claim.Finalizers, constant.FinalizerNameBcsNetserviceController) if err := r.Update(context.Background(), claim); err != nil { @@ -168,6 +170,7 @@ func (r *BCSNetIPClaimReconciler) removeFinalizerForPool(claim *netservicev1.BCS return nil } +// nolint func (r *BCSNetIPClaimReconciler) boundIP(ctx context.Context, claim *netservicev1.BCSNetIPClaim, netIP netservicev1.BCSNetIP) error { netIP.Status.Phase = constant.BCSNetIPReservedStatus diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/controllers/bcsnetpool_controller.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/controllers/bcsnetpool_controller.go index c5188bedcf..092fe3b8c7 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/controllers/bcsnetpool_controller.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/controllers/bcsnetpool_controller.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -21,6 +21,7 @@ import ( "strings" "time" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" corev1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -32,7 +33,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/handler" "sigs.k8s.io/controller-runtime/pkg/source" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" netservicev1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/internal/constant" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/internal/utils" @@ -45,6 +45,7 @@ type BCSNetPoolReconciler struct { IPFilter *IPFilter } +// nolint //+kubebuilder:rbac:groups=netservice.bkbcs.tencent.com,resources=bcsnetpools,verbs=get;list;watch;create;update;patch;delete //+kubebuilder:rbac:groups=netservice.bkbcs.tencent.com,resources=bcsnetpools/status,verbs=get;update;patch //+kubebuilder:rbac:groups=netservice.bkbcs.tencent.com,resources=bcsnetips,verbs=get;list;watch;create;update;patch;delete @@ -56,6 +57,7 @@ type BCSNetPoolReconciler struct { // Reconcile is part of the main kubernetes reconciliation loop which aims to // move the current state of the cluster closer to the desired state. +// nolint funlen func (r *BCSNetPoolReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { blog.V(5).Infof("BCSNetPool %+v triggered", req.Name) netPool := &netservicev1.BCSNetPool{} @@ -74,7 +76,8 @@ func (r *BCSNetPoolReconciler) Reconcile(ctx context.Context, req ctrl.Request) // netPool is deleted if netPool.DeletionTimestamp != nil { netIPList := &netservicev1.BCSNetIPList{} - if err := r.listIPWithSelector(ctx, netIPList, map[string]string{constant.PodLabelKeyForPool: netPool.Name}); err != nil { + if err := r.listIPWithSelector(ctx, netIPList, + map[string]string{constant.PodLabelKeyForPool: netPool.Name}); err != nil { return ctrl.Result{ Requeue: true, RequeueAfter: 5 * time.Second, @@ -87,7 +90,7 @@ func (r *BCSNetPoolReconciler) Reconcile(ctx context.Context, req ctrl.Request) return ctrl.Result{ Requeue: true, RequeueAfter: 5 * time.Second, - }, fmt.Errorf("can not perform operation for pool %s, active IP %s exists", netPool.Name, ip) + }, fmt.Errorf("can not perform operation for pool %s, active IP %v exists", netPool.Name, ip) } if err := r.Delete(ctx, &ip); err != nil { blog.Errorf("delete BCSNetIP %s failed, err %s", req.Name, err.Error()) @@ -167,7 +170,8 @@ func (r *BCSNetPoolReconciler) Reconcile(ctx context.Context, req ctrl.Request) return ctrl.Result{}, nil } -func (r *BCSNetPoolReconciler) updatePoolStatus(ctx context.Context, netPool *netservicev1.BCSNetPool, status string) error { +func (r *BCSNetPoolReconciler) updatePoolStatus( + ctx context.Context, netPool *netservicev1.BCSNetPool, status string) error { netPool.Status.Phase = status netPool.Status.UpdateTime = metav1.Now() if err := r.Status().Update(ctx, netPool); err != nil { @@ -178,6 +182,7 @@ func (r *BCSNetPoolReconciler) updatePoolStatus(ctx context.Context, netPool *ne return nil } +// nolint return nil func (r *BCSNetPoolReconciler) addFinalizerForPool(netPool *netservicev1.BCSNetPool) error { netPool.Finalizers = append(netPool.Finalizers, constant.FinalizerNameBcsNetserviceController) if err := r.Update(context.Background(), netPool); err != nil { @@ -197,7 +202,8 @@ func (r *BCSNetPoolReconciler) removeFinalizerForPool(netPool *netservicev1.BCSN return nil } -func (r *BCSNetPoolReconciler) syncBCSNetIP(ctx context.Context, netPool *netservicev1.BCSNetPool) (ctrl.Result, error) { +func (r *BCSNetPoolReconciler) syncBCSNetIP( + ctx context.Context, netPool *netservicev1.BCSNetPool) (ctrl.Result, error) { blog.Infof("syncing BCSNetIP...") // create BCSNetIP based on BCSNetPool if not exists for _, ip := range netPool.Spec.AvailableIPs { @@ -339,7 +345,8 @@ func (r *BCSNetPoolReconciler) createBCSNetIP(ctx context.Context, netPool *nets // deleteBCSNetIP deletes IP not belongs to any Pools anymore func (r *BCSNetPoolReconciler) deleteBCSNetIP(ctx context.Context, netPool *netservicev1.BCSNetPool) error { netIPList := &netservicev1.BCSNetIPList{} - if err := r.listIPWithSelector(ctx, netIPList, map[string]string{constant.PodLabelKeyForPool: netPool.Name}); err != nil { + if err := r.listIPWithSelector(ctx, netIPList, + map[string]string{constant.PodLabelKeyForPool: netPool.Name}); err != nil { return err } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/controllers/ipfilter.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/controllers/ipfilter.go index b0fa7ee08a..f6bb2772d1 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/controllers/ipfilter.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/controllers/ipfilter.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -14,13 +14,13 @@ package controllers import ( + "github.com/Tencent/bk-bcs/bcs-common/common/blog" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/util/workqueue" "sigs.k8s.io/controller-runtime/pkg/event" "sigs.k8s.io/controller-runtime/pkg/handler" "sigs.k8s.io/controller-runtime/pkg/reconcile" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" v1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1" ) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/internal/constant/constants.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/internal/constant/constants.go index f5aaff1a12..d9ff19d644 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/internal/constant/constants.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/internal/constant/constants.go @@ -1,15 +1,16 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 constant xxx package constant const ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/internal/httpsvr/handler.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/internal/httpsvr/handler.go index 47811f375d..63f96679eb 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/internal/httpsvr/handler.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/internal/httpsvr/handler.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -20,13 +20,13 @@ import ( "fmt" "net/http" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/emicklei/go-restful" coreV1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" v1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/internal/constant" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/internal/utils" @@ -106,6 +106,7 @@ func InitRouters(ws *restful.WebService, httpServerClient *HttpServerClient) { } // AllocateIP do ip allocation +// nolint funlen func (c *HttpServerClient) AllocateIP(request *restful.Request, response *restful.Response) { requestID := request.Request.Header.Get("X-Request-Id") netIPReq := &NetIPAllocateRequest{} @@ -150,32 +151,32 @@ func (c *HttpServerClient) AllocateIP(request *restful.Request, response *restfu message := fmt.Sprintf("get BCSNetIPClaim %s/%s failed, err %s", netIPReq.PodNamespace, claimName, gerr.Error()) blog.Errorf(message) - response.WriteEntity(responseData(2, message, false, requestID, nil)) + response.WriteEntity(responseData(2, message, false, requestID, nil)) // nolint return } if ipClaim.DeletionTimestamp != nil { message := fmt.Sprintf("BCSNetIPClaim %s/%s is deleting", netIPReq.PodNamespace, claimName) blog.Errorf(message) - response.WriteEntity(responseData(2, message, false, requestID, nil)) + response.WriteEntity(responseData(2, message, false, requestID, nil)) // nolint return } if ipClaim.Status.Phase == "" { message := fmt.Sprintf("BCSNetIPClaim %s/%s empty phase, wait to pending", netIPReq.PodNamespace, claimName) blog.Errorf(message) - response.WriteEntity(responseData(2, message, false, requestID, nil)) + response.WriteEntity(responseData(2, message, false, requestID, nil)) // nolint return } if ipClaim.Status.Phase == constant.BCSNetIPClaimExpiredStatus { message := fmt.Sprintf("BCSNetIPClaim %s/%s is expired", netIPReq.PodNamespace, claimName) blog.Errorf(message) - response.WriteEntity(responseData(2, message, false, requestID, nil)) + response.WriteEntity(responseData(2, message, false, requestID, nil)) // nolint return } if ipClaim.Status.Phase == constant.BCSNetIPClaimPendingStatus { // allocate ip for pending ip claim targetIP, bcspool, aerr := c.allocateNewIPForClaim(netIPReq, availableIP, ipClaim) if aerr != nil { - response.WriteEntity(responseData(2, aerr.Error(), false, requestID, nil)) + response.WriteEntity(responseData(2, aerr.Error(), false, requestID, nil)) // nolint return } data := getAllocateResponseData(netIPReq, targetIP, bcspool) @@ -185,43 +186,43 @@ func (c *HttpServerClient) AllocateIP(request *restful.Request, response *restfu // get ip from ip claim bcsNetIP, bcsNetPool, aerr := c.allocateIPByClaim(netIPReq, ipClaim) if aerr != nil { - response.WriteEntity(responseData(2, aerr.Error(), false, requestID, nil)) + response.WriteEntity(responseData(2, aerr.Error(), false, requestID, nil)) // nolint return } data := getAllocateResponseData(netIPReq, bcsNetIP, bcsNetPool) message := fmt.Sprintf("allocate IP [%s] from BCSNetIPClaim %s/%s for Host %s success", bcsNetIP.Name, ipClaim.GetNamespace(), ipClaim.GetName(), netIPReq.Host) blog.Infof(message) - response.WriteEntity(responseData(0, message, true, requestID, data)) + response.WriteEntity(responseData(0, message, true, requestID, data)) // nolint return } message := fmt.Sprintf("invalid available BCSNetIPClaim %s/%s phase %s", ipClaim.GetNamespace(), ipClaim.GetName(), ipClaim.Status.Phase) blog.Errorf(message) - response.WriteEntity(responseData(2, message, false, requestID, nil)) + response.WriteEntity(responseData(2, message, false, requestID, nil)) // nolint return } // allocate available unfixed ip if len(availableIP) == 0 { message := fmt.Sprintf("no available IP for pod %s/%s", netIPReq.PodNamespace, netIPReq.PodName) blog.Errorf(message) - response.WriteEntity(responseData(2, message, false, requestID, nil)) + response.WriteEntity(responseData(2, message, false, requestID, nil)) // nolint return } targetIP := availableIP[0] if uerr := c.updateIPStatus(targetIP, netIPReq, "", "", false); uerr != nil { - response.WriteEntity(responseData(2, uerr.Error(), false, requestID, nil)) + response.WriteEntity(responseData(2, uerr.Error(), false, requestID, nil)) // nolint return } message := fmt.Sprintf("allocate IP [%s] for Host %s success", targetIP.Name, netIPReq.Host) blog.Infof(message) bcspool, err := c.getPoolByIP(targetIP) if err != nil { - response.WriteEntity(responseData(2, err.Error(), false, requestID, nil)) + response.WriteEntity(responseData(2, err.Error(), false, requestID, nil)) // nolint return } data := getAllocateResponseData(netIPReq, targetIP, bcspool) - response.WriteEntity(responseData(0, message, true, requestID, data)) + response.WriteEntity(responseData(0, message, true, requestID, data)) // nolint } // allocateNewIPForClaim xxx @@ -390,11 +391,11 @@ func (c *HttpServerClient) DeleteIP(request *restful.Request, response *restful. netIPReq := &NetIPDeleteRequest{} if err := request.ReadEntity(netIPReq); err != nil { blog.Errorf("decode json request failed, %s", err.Error()) - response.WriteErrorString(http.StatusBadRequest, err.Error()) + response.WriteErrorString(http.StatusBadRequest, err.Error()) // nolint return } if err := validateDeleteNetIPReq(netIPReq); err != nil { - response.WriteEntity(responseData(1, err.Error(), false, requestID, nil)) + response.WriteEntity(responseData(1, err.Error(), false, requestID, nil)) // nolint return } @@ -403,7 +404,7 @@ func (c *HttpServerClient) DeleteIP(request *restful.Request, response *restful. if err := c.K8SClient.List(context.Background(), netIPList); err != nil { message := fmt.Sprintf("get BCSNetIP list failed, %s", err.Error()) blog.Errorf(message) - response.WriteEntity(responseData(2, message, false, requestID, nil)) + response.WriteEntity(responseData(2, message, false, requestID, nil)) // nolint return } var netIP *v1.BCSNetIP @@ -417,7 +418,7 @@ func (c *HttpServerClient) DeleteIP(request *restful.Request, response *restful. if netIP == nil { message := fmt.Sprintf("didn't find related BCSNetIP instance for container %s", netIPReq.ContainerID) blog.Errorf(message) - response.WriteEntity(responseData(0, message, true, requestID, nil)) + response.WriteEntity(responseData(0, message, true, requestID, nil)) // nolint return } claimKey := netIP.Status.IPClaimKey @@ -428,14 +429,14 @@ func (c *HttpServerClient) DeleteIP(request *restful.Request, response *restful. if err != nil { message := fmt.Sprintf("invalid IPClaimKey %s of BCSNetIP %s instance", claimKey, netIP.GetName()) blog.Errorf(message) - response.WriteEntity(responseData(2, message, false, requestID, nil)) + response.WriteEntity(responseData(2, message, false, requestID, nil)) // nolint return } err = c.K8SClient.Get(context.Background(), types.NamespacedName{Name: podName, Namespace: podNamespace}, claim) if err != nil { message := fmt.Sprintf("get IPClaim by IPClaimKey %s of BCSNetIP %s instance", claimKey, netIP.GetName()) blog.Errorf(message) - response.WriteEntity(responseData(2, message, false, requestID, nil)) + response.WriteEntity(responseData(2, message, false, requestID, nil)) // nolint return } netIP.Status = v1.BCSNetIPStatus{ @@ -454,12 +455,12 @@ func (c *HttpServerClient) DeleteIP(request *restful.Request, response *restful. if err := c.K8SClient.Status().Update(context.Background(), netIP); err != nil { message := fmt.Sprintf("update IP [%s] status failed", netIP.Name) blog.Errorf(message) - response.WriteEntity(responseData(2, message, false, requestID, nil)) + response.WriteEntity(responseData(2, message, false, requestID, nil)) // nolint return } message := fmt.Sprintf("deactive IP [%s] success, it's available now", netIP.Name) blog.Infof(message) - response.WriteEntity(responseData(0, message, true, requestID, netIPReq)) + response.WriteEntity(responseData(0, message, true, requestID, netIPReq)) // nolint } // get IP And Pool diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/internal/option/option.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/internal/option/option.go index fe613015a7..769fc8cc90 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/internal/option/option.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/internal/option/option.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/internal/utils/utils.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/internal/utils/utils.go index 800eb38a6f..5cf1345278 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/internal/utils/utils.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/internal/utils/utils.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/ipam/main.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/ipam/main.go index b1cb0c0847..c6026b2f0b 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/ipam/main.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/ipam/main.go @@ -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 ( @@ -19,20 +19,20 @@ import ( "net" "strconv" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" + "github.com/Tencent/bk-bcs/bcs-common/common/conf" + "github.com/Tencent/bk-bcs/bcs-common/common/util" "github.com/containernetworking/cni/pkg/skel" "github.com/containernetworking/cni/pkg/types" "github.com/containernetworking/cni/pkg/types/current" "github.com/containernetworking/cni/pkg/version" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" - "github.com/Tencent/bk-bcs/bcs-common/common/conf" - "github.com/Tencent/bk-bcs/bcs-common/common/util" ipamtypes "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/ipam/types" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/pkg/client" ) var ( - //default directory for log output + // default directory for log output defaultLogDir = "./logs" ) @@ -82,7 +82,7 @@ func init() { // cmdAdd handle add command, reply available ip info func cmdAdd(args *skel.CmdArgs) error { - //loading config from stdin + // loading config from stdin netConf, ipamConf, err := LoadBcsIPAMConfig(args.StdinData, args.Args) if err != nil { return err @@ -130,7 +130,7 @@ func cmdAdd(args *skel.CmdArgs) error { // create results result := ¤t.Result{} - //ip info + // ip info ip, ipAddr, _ := net.ParseCIDR(resp.Data.IPAddr + "/" + strconv.Itoa(resp.Data.Mask)) iface := 0 ipConf := ¤t.IPConfig{ @@ -140,7 +140,7 @@ func cmdAdd(args *skel.CmdArgs) error { Gateway: net.ParseIP(resp.Data.Gateway), } result.IPs = []*current.IPConfig{ipConf} - //route info, if no gateway info ,use ipinfo.Gateway + // route info, if no gateway info ,use ipinfo.Gateway for _, configRoute := range ipamConf.Routes { if configRoute.GW == nil { route := &types.Route{ @@ -158,7 +158,7 @@ func cmdAdd(args *skel.CmdArgs) error { // cmdDel release ip address func cmdDel(args *skel.CmdArgs) error { - //loading config from stdin + // loading config from stdin _, ipamConf, err := LoadBcsIPAMConfig(args.StdinData, args.Args) if err != nil { return err @@ -187,7 +187,7 @@ func cmdDel(args *skel.CmdArgs) error { return err } - //release ip with IPInfo + // release ip with IPInfo resp, rErr := nsClient.Release(&client.ReleaseReq{ ContainerID: args.ContainerID, PodName: string(k8sConf.K8S_POD_NAME), diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/ipam/types/types.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/ipam/types/types.go index e6220b820e..64ead3c9b9 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/ipam/types/types.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/ipam/types/types.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -16,10 +16,9 @@ package types import ( "net" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/containernetworking/cni/pkg/skel" "github.com/containernetworking/cni/pkg/types" - - "github.com/Tencent/bk-bcs/bcs-common/common/blog" ) // K8sArgs args for k8s diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/main.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/main.go index 773c7d8f11..477800af4a 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/main.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/main.go @@ -1,15 +1,16 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 ( @@ -18,6 +19,8 @@ import ( "os" "strconv" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" + "github.com/Tencent/bk-bcs/bcs-common/common/http/httpserver" "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" clientgoscheme "k8s.io/client-go/kubernetes/scheme" @@ -27,13 +30,11 @@ import ( "sigs.k8s.io/controller-runtime/pkg/healthz" "sigs.k8s.io/controller-runtime/pkg/log/zap" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" - "github.com/Tencent/bk-bcs/bcs-common/common/http/httpserver" + // +kubebuilder:scaffold:imports netservicev1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/api/v1" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/controllers" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/internal/httpsvr" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/internal/option" - //+kubebuilder:scaffold:imports ) var ( @@ -90,7 +91,7 @@ func main() { }) if err != nil { setupLog.Error(err, "unable to start manager") - os.Exit(1) + os.Exit(1) // nolint } if err = (&controllers.BCSNetPoolReconciler{ diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/pkg/client/client.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/pkg/client/client.go index 8aad28006f..300cd8a8a3 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/pkg/client/client.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/pkg/client/client.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/pkg/client/types.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/pkg/client/types.go index c3ad1c8d6f..f6b72dee33 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/pkg/client/types.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-netservice-controller/pkg/client/types.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/cmd/bcs-unified-apiserver/app/app.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/cmd/bcs-unified-apiserver/app/app.go index c2c51f4964..8af0e1a658 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/cmd/bcs-unified-apiserver/app/app.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/cmd/bcs-unified-apiserver/app/app.go @@ -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 app xxx @@ -67,7 +66,7 @@ func initConfig() error { } zapProd, _ := zap.NewProduction() - defer zapProd.Sync() // flushes buffer, if any + defer zapProd.Sync() // nolint flushes buffer, if any logger := zapProd.Sugar() if err := viper.ReadInConfig(); err != nil { @@ -125,7 +124,7 @@ func NewUnifiedAPIServer(ctx context.Context) *cobra.Command { // Run 运行服务 func Run(bindAddress string) error { logger, _ := zap.NewProduction() - defer logger.Sync() + defer logger.Sync() // nolint zap.ReplaceGlobals(logger) sugar := logger.Sugar() @@ -139,7 +138,7 @@ func Run(bindAddress string) error { if err != nil { return err } - defer ln.Close() + defer ln.Close() // nolint r := mux.NewRouter() diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/cmd/bcs-unified-apiserver/main.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/cmd/bcs-unified-apiserver/main.go index a1aa94835b..4b6353e1e0 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/cmd/bcs-unified-apiserver/main.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/cmd/bcs-unified-apiserver/main.go @@ -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 ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/clientutil/client.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/clientutil/client.go index 66e1a6e0e6..39da92d4c9 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/clientutil/client.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/clientutil/client.go @@ -4,12 +4,13 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 clientutil xxx package clientutil import ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/clientutil/options.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/clientutil/options.go index 1ad352ac70..9fb5bfcd99 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/clientutil/options.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/clientutil/options.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/cluster.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/cluster.go index c3bab03e8a..dbf742ed37 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/cluster.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/cluster.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -39,6 +39,7 @@ func NewHandler() (*Handler, error) { } // ClusterFactory 不同的 cluster_id 生成对应的 Handler +// nolint func ClusterFactory(clusterId string) (rest.Handler, error) { cluster, ok := config.G.GetMember(clusterId) if !ok { diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/cluster.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/cluster.go index 1d7d26597f..d5dbba0003 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/cluster.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/cluster.go @@ -4,20 +4,22 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 federated xxx package federated import ( "context" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/clientutil" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" + + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/clientutil" ) // ClusterStor xxx diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/configmap.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/configmap.go index 40a14533e9..5cfa134f27 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/configmap.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/configmap.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container ConfigMap available. + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -16,12 +16,13 @@ import ( "context" "time" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/clientutil" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/scheme" + + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/clientutil" ) // ConfigMapStor xxx diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/deployment.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/deployment.go index 2580274031..3aea5c784a 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/deployment.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/deployment.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -16,12 +16,13 @@ import ( "context" "time" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/clientutil" appsv1 "k8s.io/api/apps/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/scheme" + + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/clientutil" ) // DeploymentStor xxx diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/event.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/event.go index da899de460..8af44508ce 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/event.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/event.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/handler.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/handler.go index 82ec82ac44..2534ed78ae 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/handler.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/handler.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/pod.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/pod.go index 4afd8b04ba..28ee192875 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/pod.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/pod.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/secret.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/secret.go index e5ee35f2d2..a2fa93bc11 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/secret.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/secret.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Secret available. + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -16,12 +16,13 @@ import ( "context" "time" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/clientutil" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/scheme" + + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/clientutil" ) // SecretStor xxx diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/service.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/service.go index ac66efaade..b0c21c9d90 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/service.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/service.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -16,12 +16,13 @@ import ( "context" "time" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/clientutil" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/scheme" + + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/clientutil" ) // ServiceStor xxx diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/statefulset.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/statefulset.go index 2638da2cfc..2da8976ec9 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/statefulset.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/federated/statefulset.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -16,12 +16,13 @@ import ( "context" "time" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/clientutil" appsv1 "k8s.io/api/apps/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/scheme" + + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/clientutil" ) // StatefulSetStor xxx diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/isolated/handler.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/isolated/handler.go index 1116e531f7..1ddd0339ca 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/isolated/handler.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/isolated/handler.go @@ -4,12 +4,13 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 isolated xxx package isolated import ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/shared/handler.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/shared/handler.go index c6e24b97bd..3d57ee55f0 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/shared/handler.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/cluster/shared/handler.go @@ -4,12 +4,13 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 shared xxx package shared import ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/component/bcs/bcs.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/component/bcs/bcs.go index 3599aa7432..536f3bc24d 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/component/bcs/bcs.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/component/bcs/bcs.go @@ -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 bcs xxx diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/component/bcs/bcs_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/component/bcs/bcs_test.go index 541f5ab3f7..8e7621d0d6 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/component/bcs/bcs_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/component/bcs/bcs_test.go @@ -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 bcs diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/component/bcs/helper.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/component/bcs/helper.go index 057cb3ce46..d68a5001b4 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/component/bcs/helper.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/component/bcs/helper.go @@ -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 bcs diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/component/client.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/component/client.go index e4f8e08e5d..85cf80cbb7 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/component/client.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/component/client.go @@ -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 component xxx package component import ( @@ -20,9 +20,10 @@ import ( "sync" "time" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/config" resty "github.com/go-resty/resty/v2" "github.com/pkg/errors" + + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/config" ) const ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/config/apiserver.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/config/apiserver.go index a6bebef277..4f1f7e36c9 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/config/apiserver.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/config/apiserver.go @@ -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 config diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/config/base.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/config/base.go index 8ee29fa227..effbdeef59 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/config/base.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/config/base.go @@ -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 config diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/config/bcs.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/config/bcs.go index 24808bf78b..f2f00de373 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/config/bcs.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/config/bcs.go @@ -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 config diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/config/cluster_resource.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/config/cluster_resource.go index e1cf166988..5f6d3c957c 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/config/cluster_resource.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/config/cluster_resource.go @@ -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 config diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/config/config.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/config/config.go index a4bdf1d461..24b2ddb187 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/config/config.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/config/config.go @@ -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 config xxx @@ -38,15 +37,15 @@ type Configurations struct { // ReadFrom : read from file func (c *Configurations) Init() error { c.Base = &BaseConf{} - c.Base.Init() + c.Base.Init() // nolint // logging c.Logging = &LogConf{} - c.Logging.Init() + c.Logging.Init() // nolint // BCS Config c.BCS = &BCSConf{} - c.BCS.Init() + c.BCS.Init() // nolint c.BCSEnvConf = []*BCSConf{} c.BCSEnvMap = map[BCSClusterEnv]*BCSConf{} @@ -64,7 +63,7 @@ var G = &Configurations{} // init 初始化 func init() { - G.Init() + G.Init() // nolint } // ReadFrom : read from file @@ -80,9 +79,9 @@ func (c *Configurations) ReadFrom(content []byte) error { if err != nil { return err } - c.Logging.InitBlog() - c.Base.InitManagers() - c.InitClusterResources() + c.Logging.InitBlog() // nolint + c.Base.InitManagers() // nolint + c.InitClusterResources() // nolint // 把列表类型转换为map,方便检索 for _, conf := range c.BCSEnvConf { diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/config/logging.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/config/logging.go index c2283d35f0..785b90db8d 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/config/logging.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/config/logging.go @@ -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 config diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/proxy/proxy.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/proxy/proxy.go index cf4e152f4b..1b82095ccc 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/proxy/proxy.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/proxy/proxy.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -36,7 +36,7 @@ func (r *responder) Error(w http.ResponseWriter, req *http.Request, err error) { // makeTarget 提取连接地址 func makeTarget(serverAddress string) (*url.URL, error) { if !strings.HasSuffix(serverAddress, "/") { - serverAddress = serverAddress + "/" + serverAddress += "/" } target, err := url.Parse(serverAddress) if err != nil { @@ -46,7 +46,8 @@ func makeTarget(serverAddress string) (*url.URL, error) { } // makeUpgradeTransport creates a transport for proxy connections that must upgrade. -// reference implementation https://github.com/kubernetes/kubectl/blob/master/pkg/proxy/proxy_server.go#L153 and remove tlsConfig +// reference implementation https://github.com/kubernetes/kubectl/blob/master/pkg/proxy/proxy_server.go#L153 +// and remove tlsConfig func makeUpgradeTransport(config *rest.Config) (proxy.UpgradeRequestRoundTripper, error) { transportConfig, err := config.TransportConfig() if err != nil { @@ -87,6 +88,7 @@ func makeUpgradeAwareHandler(config *rest.Config) (*proxy.UpgradeAwareHandler, e } // ProxyHandler 代理请求 +// nolint type ProxyHandler struct { handler *proxy.UpgradeAwareHandler config *rest.Config diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/cluster.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/cluster.go index 4040679961..f04c52f2ab 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/cluster.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/cluster.go @@ -4,12 +4,13 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 apis xxx package apis import ( @@ -49,7 +50,7 @@ func (h *ClusterHandler) Serve(c *rest.RequestContext) error { ctx := c.Request.Context() switch c.Options.Verb { case rest.GetVerb: - if c.Path == "/api" { + if c.Path == "/api" { // nolint rewrite if-else to switch statement obj, err = h.handler.GetAPIVersions(ctx) } else if c.Path == "/api/v1" { obj, err = h.handler.ServerCoreV1Resources(ctx) @@ -67,7 +68,7 @@ func (h *ClusterHandler) Serve(c *rest.RequestContext) error { if err != nil { return err } - rest.AddTypeInformationToObject(obj) + rest.AddTypeInformationToObject(obj) // nolint c.Write(obj) return nil } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/configmap.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/configmap.go index 02052c466f..8788acd739 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/configmap.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/configmap.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -96,7 +96,7 @@ func (h *ConfigMapHandler) Serve(c *rest.RequestContext) error { if err != nil { return err } - rest.AddTypeInformationToObject(obj) + rest.AddTypeInformationToObject(obj) // nolint c.Write(obj) return nil } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/deployment.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/deployment.go index 015cd9df3b..acea5d4c05 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/deployment.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/deployment.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -97,7 +97,7 @@ func (h *DeploymentHandler) Serve(c *rest.RequestContext) error { if err != nil { return err } - rest.AddTypeInformationToObject(obj) + rest.AddTypeInformationToObject(obj) // nolint c.Write(obj) return nil } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/event.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/event.go index ca1419d12e..d09b179f42 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/event.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/event.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -67,7 +67,7 @@ func (h *EventHandler) Serve(c *rest.RequestContext) error { if err != nil { return err } - rest.AddTypeInformationToObject(obj) + rest.AddTypeInformationToObject(obj) // nolint c.Write(obj) return nil } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/pod.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/pod.go index 77c1ebf6da..ac912184b8 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/pod.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/pod.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -76,7 +76,7 @@ func (h *PodHandler) Serve(c *rest.RequestContext) error { obj, err = h.handler.Delete(ctx, c.Namespace, c.Name, *c.Options.DeleteOptions) case rest.GetLogsVerb: // 处理 Pod 日志流 // NOCC:vetshadow/shadow(设计如此:需要初始化restReq并且err可以被覆盖) - restReq, err := h.handler.GetLogs(ctx, c.Namespace, c.Name, c.Options.PodLogOptions) + restReq, err := h.handler.GetLogs(ctx, c.Namespace, c.Name, c.Options.PodLogOptions) // nolint if err != nil { return err } @@ -91,7 +91,7 @@ func (h *PodHandler) Serve(c *rest.RequestContext) error { case rest.WatchVerb: // watch 需要特殊处理 chunk // NOCC:vetshadow/shadow(设计如此:需要初始化watch并且err可以被覆盖) - watch, err := h.handler.Watch(ctx, c.Namespace, *c.Options.ListOptions) + watch, err := h.handler.Watch(ctx, c.Namespace, *c.Options.ListOptions) // nolint if err != nil { return err } @@ -108,7 +108,7 @@ func (h *PodHandler) Serve(c *rest.RequestContext) error { case rest.ExecVerb: // remotecommand 直接使用透明代理 // NOCC:vetshadow/shadow(设计如此:需要初始化proxy并且err可以被覆盖) - proxy, err := h.handler.Exec(ctx, c.Namespace, c.Name, *c.Options.GetOptions) + proxy, err := h.handler.Exec(ctx, c.Namespace, c.Name, *c.Options.GetOptions) // nolint if err != nil { return err } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/secret.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/secret.go index 8398fc0fd4..d8241144fe 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/secret.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/secret.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -94,7 +94,7 @@ func (h *SecretHandler) Serve(c *rest.RequestContext) error { if err != nil { return err } - rest.AddTypeInformationToObject(obj) + rest.AddTypeInformationToObject(obj) // nolint c.Write(obj) return nil } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/service.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/service.go index 3b64bb496f..4c4dd74c36 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/service.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/service.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -94,7 +94,7 @@ func (h *ServiceHandler) Serve(c *rest.RequestContext) error { if err != nil { return err } - rest.AddTypeInformationToObject(obj) + rest.AddTypeInformationToObject(obj) // nolint c.Write(obj) return nil } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/statefulset.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/statefulset.go index b13a1fff27..952c81cec1 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/statefulset.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/apis/statefulset.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -97,7 +97,7 @@ func (h *StatefulSetHandler) Serve(c *rest.RequestContext) error { if err != nil { return err } - rest.AddTypeInformationToObject(obj) + rest.AddTypeInformationToObject(obj) // nolint c.Write(obj) return nil } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/constants.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/constants.go index 6cf9e96902..7bc131601a 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/constants.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/constants.go @@ -4,12 +4,13 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 rest xxx package rest // Verb xxx diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/request.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/request.go index 7a970ca592..3ab7b6e699 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/request.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/request.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -18,12 +18,13 @@ import ( "net/http" "strings" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/clientutil" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/sets" apirequest "k8s.io/apiserver/pkg/endpoints/request" + + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/clientutil" ) const ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/response.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/response.go index 32b1bce057..618e9372ab 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/response.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-unified-apiserver/pkg/rest/response.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -48,7 +48,7 @@ func AbortWithError(rw http.ResponseWriter, err error) { rw.Header().Set("Content-Type", "application/json; charset=utf-8") rw.Header().Set("Cache-Control", "no-cache, no-store") rw.WriteHeader(int(status.Code)) - json.NewEncoder(rw).Encode(status) + json.NewEncoder(rw).Encode(status) // nolint } // Write Json Body 返回 @@ -56,7 +56,7 @@ func (c *RequestContext) Write(obj runtime.Object) { c.Writer.Header().Set("Content-Type", "application/json; charset=utf-8") c.Writer.Header().Set("Cache-Control", "no-cache, no-store") c.Writer.WriteHeader(http.StatusOK) - json.NewEncoder(c.Writer).Encode(obj) + json.NewEncoder(c.Writer).Encode(obj) // nolint } // WriteChunk 按 Chunk 返回, Watch方式使用 diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/cmd/server.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/cmd/server.go index 7caac17d85..8612fafe28 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/cmd/server.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/cmd/server.go @@ -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 ( @@ -21,6 +21,7 @@ import ( "time" "github.com/Tencent/bk-bcs/bcs-common/common/blog" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/server" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/options" ) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/convert/convert.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/convert/convert.go index 96f435db34..81ec89a133 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/convert/convert.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/convert/convert.go @@ -19,6 +19,7 @@ import ( ) // ConvertAdmissionRequestToV1 converts AdmissionRequest to v1.AdmissionRequest. +// nolint func ConvertAdmissionRequestToV1(r *v1beta1.AdmissionRequest) *v1.AdmissionRequest { return &v1.AdmissionRequest{ Kind: r.Kind, @@ -40,6 +41,7 @@ func ConvertAdmissionRequestToV1(r *v1beta1.AdmissionRequest) *v1.AdmissionReque } // ConvertAdmissionRequestToV1beta1 converts AdmissionRequest to v1beta1.AdmissionRequest. +// nolint func ConvertAdmissionRequestToV1beta1(r *v1.AdmissionRequest) *v1beta1.AdmissionRequest { return &v1beta1.AdmissionRequest{ Kind: r.Kind, @@ -61,6 +63,7 @@ func ConvertAdmissionRequestToV1beta1(r *v1.AdmissionRequest) *v1beta1.Admission } // ConvertAdmissionResponseToV1 converts AdmissionResponse to v1.AdmissionResponse. +// nolint func ConvertAdmissionResponseToV1(r *v1beta1.AdmissionResponse) *v1.AdmissionResponse { var pt *v1.PatchType if r.PatchType != nil { @@ -79,6 +82,7 @@ func ConvertAdmissionResponseToV1(r *v1beta1.AdmissionResponse) *v1.AdmissionRes } // ConvertAdmissionResponseToV1beta1 converts AdmissionResponse to v1beta1.AdmissionResponse. +// nolint func ConvertAdmissionResponseToV1beta1(r *v1.AdmissionResponse) *v1beta1.AdmissionResponse { var pt *v1beta1.PatchType if r.PatchType != nil { diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/metrics/mtrics.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/metrics/mtrics.go index 2fef5c5aaa..0358e46116 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/metrics/mtrics.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/metrics/mtrics.go @@ -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 metrics xxx package metrics import ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bcslog/bcslog.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bcslog/bcslog.go index d09f72801a..9fc6b1b911 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bcslog/bcslog.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bcslog/bcslog.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -23,6 +23,11 @@ import ( "strings" "time" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" + bcsv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubebkbcs/apis/bkbcs/v1" + internalclientset "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubebkbcs/generated/clientset/versioned" + informers "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubebkbcs/generated/informers/externalversions" + listers "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubebkbcs/generated/listers/bkbcs/v1" mapset "github.com/deckarep/golang-set" "k8s.io/api/admission/v1beta1" corev1 "k8s.io/api/core/v1" @@ -34,14 +39,9 @@ import ( clientGoCache "k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/clientcmd" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/metrics" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginutil" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/types" - bcsv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubebkbcs/apis/bkbcs/v1" - internalclientset "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubebkbcs/generated/clientset/versioned" - informers "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubebkbcs/generated/informers/externalversions" - listers "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubebkbcs/generated/listers/bkbcs/v1" ) // Hooker webhook for bcslog @@ -71,6 +71,7 @@ func (h *Hooker) Init(configFilePath string) error { return nil } +// nolint unused func (h *Hooker) initKubeClient() error { cfg, err := clientcmd.BuildConfigFromFlags(h.opt.KubeMaster, h.opt.Kubeconfig) if err != nil { @@ -109,6 +110,7 @@ func (h *Hooker) initKubeClient() error { // createBcsLogConfig xxx // create crd of BcsLogConf +// nolint unused func (h *Hooker) createBcsLogConfig(clientset apiextensionsclient.Interface) (bool, error) { bcsLogConfigPlural := "bcslogconfigs" @@ -241,18 +243,17 @@ func (h *Hooker) createPatch(pod *corev1.Pod) ([]types.PatchOperation, error) { } } } - } else { - if defaultLogConf != nil { - for i, container := range pod.Spec.Containers { - patchedContainer := h.injectK8sContainer(pod.Namespace, &container, defaultLogConf, -1) - patch = append(patch, replaceContainer(i, *patchedContainer)) - } + } else if defaultLogConf != nil { + for i, container := range pod.Spec.Containers { + patchedContainer := h.injectK8sContainer(pod.Namespace, &container, defaultLogConf, -1) + patch = append(patch, replaceContainer(i, *patchedContainer)) } } return patch, nil } +// nolint funlen func (h *Hooker) injectK8sContainer( namespace string, container *corev1.Container, bcsLogConf *bcsv1.BcsLogConfig, index int) *corev1.Container { diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bcslog/bcslogmesos.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bcslog/bcslogmesos.go index 5023a95120..78eb8d1f0e 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bcslog/bcslogmesos.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bcslog/bcslogmesos.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -175,6 +175,7 @@ func (h *Hooker) injectMesosContainers(namespace string, podTemplate *commtypes. } // injectMesosContainer injects bcs log config to an container +// nolint funlen func (h *Hooker) injectMesosContainer(namespace string, container commtypes.Container, bcsLogConf *bcsv1.BcsLogConfig, index int) commtypes.Container { // nolint var envs []commtypes.EnvVar diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bcslog/init.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bcslog/init.go index 02360ed0e8..f1dba119ba 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bcslog/init.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bcslog/init.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bcslog/options.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bcslog/options.go index eb0e62e395..a80ab9b7b4 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bcslog/options.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bcslog/options.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bcslog/types.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bcslog/types.go index 2503df73e6..c8c15862dc 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bcslog/types.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bcslog/types.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -95,6 +95,7 @@ func FindK8sMatchedConfigType(pod *corev1.Pod, bcsLogConfs []*bcsv1.BcsLogConfig for _, logConf := range bcsLogConfs { if logConf.Spec.ConfigType == CustomConfigType { if pod.OwnerReferences[0].Kind == "ReplicaSet" { + // nolint use strings.EqualFold instead if strings.ToLower(logConf.Spec.WorkloadType) == strings.ToLower("Deployment") && strings.HasPrefix(pod.OwnerReferences[0].Name, logConf.Spec.WorkloadName) { // nolint matchedLogConf = logConf @@ -102,6 +103,7 @@ func FindK8sMatchedConfigType(pod *corev1.Pod, bcsLogConfs []*bcsv1.BcsLogConfig } continue } + // nolint use strings.EqualFold instead if strings.ToLower(pod.OwnerReferences[0].Kind) == strings.ToLower(logConf.Spec.WorkloadType) && pod.OwnerReferences[0].Name == logConf.Spec.WorkloadName { // nolint matchedLogConf = logConf diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/blockannotation/blockannotation.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/blockannotation/blockannotation.go index 5c39a5ed85..07e8b6e38a 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/blockannotation/blockannotation.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/blockannotation/blockannotation.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -20,11 +20,12 @@ import ( "time" "github.com/Tencent/bk-bcs/bcs-common/common/blog" + "k8s.io/api/admission/v1beta1" + corev1 "k8s.io/api/core/v1" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/metrics" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginmanager" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginutil" - "k8s.io/api/admission/v1beta1" - corev1 "k8s.io/api/core/v1" ) const ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/blockannotation/conf.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/blockannotation/conf.go index 194f9534e9..e453a5bbcf 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/blockannotation/conf.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/blockannotation/conf.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/blockannotation/expr.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/blockannotation/expr.go index 94a193f307..47bdc4ed81 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/blockannotation/expr.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/blockannotation/expr.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -62,7 +62,7 @@ func NewBlockUnit(refer, op, failPolicy string) *BlockUnit { func (cu *BlockUnit) IsBlock(toMatch string) bool { isBlocked, err := cu.doMatch(toMatch) if err != nil { - if cu.FailPolicy == FailPolicyAllow { + if cu.FailPolicy == FailPolicyAllow { // nolint return false } return true diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/blockannotation/expr_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/blockannotation/expr_test.go index 817bfe312f..ef87e53dab 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/blockannotation/expr_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/blockannotation/expr_test.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bscp/bscp.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bscp/bscp.go index c15a3e0b3c..89aeaa6777 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bscp/bscp.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bscp/bscp.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -20,10 +20,10 @@ import ( "strings" "time" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" "k8s.io/api/admission/v1beta1" corev1 "k8s.io/api/core/v1" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/metrics" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginutil" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/types" @@ -203,6 +203,7 @@ func (h *Hooker) retrieveEnvFromPod(pod *corev1.Pod) (map[string]string, []types // injectToPod xxx // inject inject env and volume mounts into template containers +// nolint unused func (h *Hooker) injectToPod(pod *corev1.Pod, envs map[string]string) []types.PatchOperation { var patches []types.PatchOperation for _, container := range h.temContainers { diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bscp/bscp_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bscp/bscp_test.go index 8b4e0dd9ba..de5698be5f 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bscp/bscp_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bscp/bscp_test.go @@ -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 bscp diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bscp/bscpmesos.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bscp/bscpmesos.go index 20783e7769..30db77a731 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bscp/bscpmesos.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bscp/bscpmesos.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bscp/init.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bscp/init.go index 0add4e53de..3c80e66e14 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bscp/init.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bscp/init.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bscp/types.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bscp/types.go index caed338408..f70d07963f 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bscp/types.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bscp/types.go @@ -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 bscp diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/dbprivilege/dbprivilege.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/dbprivilege/dbprivilege.go index 0486849151..c5575c9cbb 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/dbprivilege/dbprivilege.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/dbprivilege/dbprivilege.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -21,6 +21,13 @@ import ( "reflect" "time" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" + commtypes "github.com/Tencent/bk-bcs/bcs-common/common/types" + "github.com/Tencent/bk-bcs/bcs-common/pkg/capabilities" + bcsv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubebkbcs/apis/bkbcs/v1" + internalclientset "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubebkbcs/generated/clientset/versioned" + informers "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubebkbcs/generated/informers/externalversions" + listers "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubebkbcs/generated/listers/bkbcs/v1" "k8s.io/api/admission/v1beta1" corev1 "k8s.io/api/core/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" @@ -34,16 +41,9 @@ import ( clientGoCache "k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/clientcmd" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" - commtypes "github.com/Tencent/bk-bcs/bcs-common/common/types" - "github.com/Tencent/bk-bcs/bcs-common/pkg/capabilities" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/metrics" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginutil" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/types" - bcsv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubebkbcs/apis/bkbcs/v1" - internalclientset "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubebkbcs/generated/clientset/versioned" - informers "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubebkbcs/generated/informers/externalversions" - listers "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubebkbcs/generated/listers/bkbcs/v1" ) // Hooker webhook for db privilege @@ -315,7 +315,7 @@ func (h *Hooker) createPatch(pod *corev1.Pod) ([]types.PatchOperation, error) { blog.Errorf("generateInitContainer error %s", err.Error()) return nil, err } - initContainers := append(pod.Spec.InitContainers, container) + initContainers := append(pod.Spec.InitContainers, container) // nolint patch = append(patch, types.PatchOperation{ Op: "replace", Path: "/spec/initContainers", @@ -394,7 +394,7 @@ func (h *Hooker) generateInitContainer(configs []*bcsv1.BcsDbPrivConfig) (corev1 }, { Name: "io_tencent_bcs_app_code", - Value: string(h.dbPrivSecret.Data["sdk-appCode"][:]), + Value: string(h.dbPrivSecret.Data["sdk-appCode"][:]), // nolint }, { Name: "io_tencent_bcs_app_secret", diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/dbprivilege/init.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/dbprivilege/init.go index 88b5aaf479..78a90ce840 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/dbprivilege/init.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/dbprivilege/init.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/dbprivilege/options.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/dbprivilege/options.go index 03f6c052c8..0aefc1beb0 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/dbprivilege/options.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/dbprivilege/options.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/dbprivilege/types.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/dbprivilege/types.go index fccc3eb062..a9ca633a33 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/dbprivilege/types.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/dbprivilege/types.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -20,5 +20,5 @@ const ( // NetworkTypeUnderlay underlay network NetworkTypeUnderlay = "underlay" // DbPrivilegeSecretName the name of secret to store db privilege info - DbPrivilegeSecretName = "bcs-db-privilege" // NOCC:gas/crypto(存量代码) + DbPrivilegeSecretName = "bcs-db-privilege" // nolint NOCC:gas/crypto(存量代码) ) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/fake/fake.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/fake/fake.go index fc29e17b53..ddce3a1a7a 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/fake/fake.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/fake/fake.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -16,10 +16,10 @@ package fake import ( "encoding/json" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" "k8s.io/api/admission/v1beta1" corev1 "k8s.io/api/core/v1" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginutil" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/types" ) @@ -51,7 +51,7 @@ func (h *Hooker) Handle(ar v1beta1.AdmissionReview) *v1beta1.AdmissionResponse { return pluginutil.ToAdmissionResponse(err) } - initContainers := append(pod.Spec.InitContainers, corev1.Container{ + initContainers := append(pod.Spec.InitContainers, corev1.Container{ // nolint Image: "fakeimgae", }) var patch []types.PatchOperation diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/fake/init.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/fake/init.go index 3a7a60e038..091a08490d 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/fake/init.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/fake/init.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/filterclb/filterclb.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/filterclb/filterclb.go index 812bc904af..eabe90a057 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/filterclb/filterclb.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/filterclb/filterclb.go @@ -1,6 +1,6 @@ /* * Tencent is pleased to support the open source community by making Blueking Container Service available. - * Copyright (C) 2023 THL A29 Limited, a Tencent company. All rights reserved. + * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT @@ -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 filterclb filters invalid cloud loadbalance @@ -20,6 +19,7 @@ import ( "fmt" "time" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/pkg/errors" "k8s.io/api/admission/v1beta1" corev1 "k8s.io/api/core/v1" @@ -31,7 +31,6 @@ import ( clientset "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/metrics" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginmanager" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginutil" @@ -130,11 +129,11 @@ func (h *Handler) Handle(review v1beta1.AdmissionReview) *v1beta1.AdmissionRespo return &v1beta1.AdmissionResponse{Allowed: true} } - //只处理创建和更新 + // 只处理创建和更新 if req.Operation != v1beta1.Create && req.Operation != v1beta1.Update { return &v1beta1.AdmissionResponse{Allowed: true} } - //含有特定annotations 也过滤 + // 含有特定annotations 也过滤 started := time.Now() blog.Infof("filterclb: %s %s/%s", req.Operation, req.Namespace, req.Name) if req.Kind.Kind == "Service" { @@ -150,7 +149,8 @@ func (h *Handler) Handle(review v1beta1.AdmissionReview) *v1beta1.AdmissionRespo if h.DenyService(svc) { blog.Infof("filterclb: %s %s/%s deny service", req.Operation, req.Namespace, req.Name) metrics.ReportBcsWebhookServerPluginLantency(pluginName, metrics.StatusFailure, started) - return pluginutil.ToAdmissionResponse(fmt.Errorf("service %s/%s is not allowed to create, It is forbidden to directly create external network clb", req.Namespace, req.Name)) + return pluginutil.ToAdmissionResponse(fmt.Errorf("service %s/%s is not allowed to create, "+ + "It is forbidden to directly create external network clb", req.Namespace, req.Name)) } // pass @@ -171,7 +171,8 @@ func (h *Handler) Handle(review v1beta1.AdmissionReview) *v1beta1.AdmissionRespo if h.DenyIngress(ingress) { blog.Infof("filterclb: %s %s/%s deny ingress", req.Operation, req.Namespace, req.Name) metrics.ReportBcsWebhookServerPluginLantency(pluginName, metrics.StatusFailure, started) - return pluginutil.ToAdmissionResponse(fmt.Errorf("ingress %s/%s is not allowed to create, It is forbidden to directly create external network clb", req.Namespace, req.Name)) + return pluginutil.ToAdmissionResponse(fmt.Errorf("ingress %s/%s is not allowed to create, "+ + "It is forbidden to directly create external network clb", req.Namespace, req.Name)) } // pass @@ -212,7 +213,8 @@ func (h *Handler) DenyIngress(ingress *v1.Ingress) bool { if ingress.Annotations[annotationIngressExistLbID] != "" { return false } - if ingress.Annotations[annotationsIngressClass] != "" && ingress.Annotations[annotationsIngressClass] != ingressClassQcloud { + if ingress.Annotations[annotationsIngressClass] != "" && + ingress.Annotations[annotationsIngressClass] != ingressClassQcloud { return false } if ingress.Spec.IngressClassName != nil && *ingress.Spec.IngressClassName != ingressClassQcloud { @@ -220,25 +222,28 @@ func (h *Handler) DenyIngress(ingress *v1.Ingress) bool { } if h.supportIngressClass { - ingressClassList, err := h.kubeClient.NetworkingV1().IngressClasses().List(context.Background(), metav1.ListOptions{}) + ingressClassList, err := h.kubeClient.NetworkingV1().IngressClasses().List(context.Background(), + metav1.ListOptions{}) if err != nil { blog.Errorf("get ingress class list failed, err %s", err.Error()) return true } - //只有一个,并且不是qcloud,不需要拦截 + // 只有一个,并且不是qcloud,不需要拦截 if len(ingressClassList.Items) == 1 && ingressClassList.Items[0].Name != ingressClassQcloud { return false } - //默认的是非qcloud,不需要拦截 + // 默认的是非qcloud,不需要拦截 for _, ingressClass := range ingressClassList.Items { // 也许可能存在多个默认,但是就必须指定ingressClassName了(k8s设定) - if ingressClass.Annotations[annotationIngressClassDefaultKey] == constStringTrue && ingressClass.Name != ingressClassQcloud { + if ingressClass.Annotations[annotationIngressClassDefaultKey] == constStringTrue && + ingressClass.Name != ingressClassQcloud { return false } } } else { - //1.18以下版本,判断是否存在deploy l7-lb-controller - _, err := h.kubeClient.ExtensionsV1beta1().Deployments("kube-system").Get(context.Background(), l7LbControllerName, metav1.GetOptions{}) + // 1.18以下版本,判断是否存在deploy l7-lb-controller + _, err := h.kubeClient.ExtensionsV1beta1().Deployments("kube-system").Get(context.Background(), + l7LbControllerName, metav1.GetOptions{}) if err != nil { if apierrors.IsNotFound(err) { blog.Infof("get deploy %s not found, skip filter clb", l7LbControllerName) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/filterclb/filterclb_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/filterclb/filterclb_test.go index 6fea06a11d..f755686101 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/filterclb/filterclb_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/filterclb/filterclb_test.go @@ -1,6 +1,6 @@ /* * Tencent is pleased to support the open source community by making Blueking Container Service available. - * Copyright (C) 2023 THL A29 Limited, a Tencent company. All rights reserved. + * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT @@ -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 filterclb diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageacceleration/cachemanager/cache.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageacceleration/cachemanager/cache.go index 399b3b982f..2c989e0a90 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageacceleration/cachemanager/cache.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageacceleration/cachemanager/cache.go @@ -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 cachemanager xxx package cachemanager import ( @@ -18,6 +18,7 @@ import ( "sync" "time" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -25,8 +26,6 @@ import ( corev1informers "k8s.io/client-go/informers/core/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/cache" - - "github.com/Tencent/bk-bcs/bcs-common/common/blog" ) var ( diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageacceleration/handler.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageacceleration/handler.go index 3b4028d90a..134f0631f0 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageacceleration/handler.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageacceleration/handler.go @@ -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 imageacceleration xxx package imageacceleration import ( @@ -19,15 +19,14 @@ import ( "strings" "time" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" + commtypes "github.com/Tencent/bk-bcs/bcs-common/common/types" "github.com/pkg/errors" "k8s.io/api/admission/v1beta1" corev1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/client-go/kubernetes" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" - commtypes "github.com/Tencent/bk-bcs/bcs-common/common/types" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/metrics" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageacceleration/cachemanager" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginutil" diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageacceleration/secret.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageacceleration/secret.go index 2893347d2a..4914fd9300 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageacceleration/secret.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageacceleration/secret.go @@ -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 imageacceleration @@ -17,10 +16,9 @@ import ( "context" "encoding/json" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" - - "github.com/Tencent/bk-bcs/bcs-common/common/blog" ) // imagePullSecret defines the .dockerconfigjson of secret data diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageacceleration/types.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageacceleration/types.go index dbfa5ff8f9..de9a1514af 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageacceleration/types.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageacceleration/types.go @@ -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 imageacceleration @@ -23,7 +22,7 @@ const ( // configMapName defines the name of configmap that can enable image acceleration configMapName = "bcs-image-acceleration" // secretImagePullItem defines the image pull data of secret - secretImagePullItem = ".dockerconfigjson" // // NOCC:gas/crypto(设计如此) + secretImagePullItem = ".dockerconfigjson" // nolint NOCC:gas/crypto(设计如此) // configMapKeyEnabled key of configmap, namespace will enable image acceleration if value is "true" configMapKeyEnabled = "enabled" diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageacceleration/utils.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageacceleration/utils.go index 32027cdf1d..8ca2e1dbcf 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageacceleration/utils.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageacceleration/utils.go @@ -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 imageacceleration diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/bcsgd.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/bcsgd.go index 87a93badbc..f741ba3212 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/bcsgd.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/bcsgd.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -20,12 +20,10 @@ import ( "github.com/Tencent/bk-bcs/bcs-common/common/blog" tkexv1alpha1 "github.com/Tencent/bk-bcs/bcs-scenarios/kourse/pkg/apis/tkex/v1alpha1" - bcsclient "github.com/Tencent/bk-bcs/bcs-scenarios/kourse/pkg/client/clientset/versioned" bcssche "github.com/Tencent/bk-bcs/bcs-scenarios/kourse/pkg/client/clientset/versioned/scheme" informers "github.com/Tencent/bk-bcs/bcs-scenarios/kourse/pkg/client/informers/externalversions" bcsgdlister "github.com/Tencent/bk-bcs/bcs-scenarios/kourse/pkg/client/listers/tkex/v1alpha1" - jsonpatch "github.com/evanphx/json-patch" "k8s.io/api/admission/v1beta1" batchv1 "k8s.io/api/batch/v1" @@ -97,6 +95,7 @@ func (b *bcsgdWorkload) Init(i *imageLoader) error { // LoadImageBeforeUpdate prevents workload instance from updating and // create a image-load job. +// nolint funlen func (b *bcsgdWorkload) LoadImageBeforeUpdate(ar v1beta1.AdmissionReview) *v1beta1.AdmissionResponse { // get req gd newGD := &tkexv1alpha1.GameDeployment{} diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/bcsgd_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/bcsgd_test.go index dbe717fb60..c832fe9b43 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/bcsgd_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/bcsgd_test.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/bcsgs.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/bcsgs.go index e8860ca267..a2cacb06cb 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/bcsgs.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/bcsgs.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -24,7 +24,6 @@ import ( bcssche "github.com/Tencent/bk-bcs/bcs-scenarios/kourse/pkg/client/clientset/versioned/scheme" informers "github.com/Tencent/bk-bcs/bcs-scenarios/kourse/pkg/client/informers/externalversions" bcsgslister "github.com/Tencent/bk-bcs/bcs-scenarios/kourse/pkg/client/listers/tkex/v1alpha1" - jsonpatch "github.com/evanphx/json-patch" "k8s.io/api/admission/v1beta1" batchv1 "k8s.io/api/batch/v1" @@ -85,6 +84,7 @@ func (b *bcsgsWorkload) Init(i *imageLoader) error { // LoadImageBeforeUpdate prevents workload instance from updating and // create a image-load job. +// nolint funlen func (b *bcsgsWorkload) LoadImageBeforeUpdate(ar v1beta1.AdmissionReview) *v1beta1.AdmissionResponse { // get req gs newGS := &tkexv1alpha1.GameStatefulSet{} diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/bcsgs_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/bcsgs_test.go index 602268a689..a11063dc66 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/bcsgs_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/bcsgs_test.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/diff.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/diff.go index 85e770dceb..3889e1c0ea 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/diff.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/diff.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -31,7 +31,7 @@ func diff(oldMeta, newMeta metav1.ObjectMeta, } updatePatchStr := fmt.Sprintf("[%s]", strings.Join(updatePatch, ",")) // set patch to annotations and append annotions patch - revertPatch := append(revertMeta, revertCon...) + revertPatch := append(revertMeta, revertCon...) // nolint revertPatch = append(revertPatch, fmt.Sprintf( "{\"op\":\"add\",\"path\":\"/metadata/annotations/%s\",\"value\":\"%s\"}", imageUpdateAnno, strings.ReplaceAll(updatePatchStr, "\"", "\\\""))) @@ -46,9 +46,9 @@ func metaDiff(oldMeta, newMeta metav1.ObjectMeta) ([]string, []string) { revertLabelPatch, updateLabelPatch := labelDiff(oldMeta, newMeta) revertAnnoPatch, updateAnnoPatch := annoDiff(oldMeta, newMeta) - revertPatch := append(revertLabelPatch, revertAnnoPatch...) + revertPatch := append(revertLabelPatch, revertAnnoPatch...) // nolint - updatePatch := append(updateLabelPatch, updateAnnoPatch...) + updatePatch := append(updateLabelPatch, updateAnnoPatch...) // nolint return revertPatch, updatePatch } @@ -114,7 +114,7 @@ func imageDiff(oldContainers, newContainers []corev1.Container) ([]string, []str Name: c.Name, Image: c.Image, ImagePullPolicy: corev1.PullIfNotPresent, - Command: []string{"echo", "pull " + c.Image}}) + Command: []string{"echo", "pull " + c.Image}}) // nolint } } return revertPatch, updatePatch, retContainers diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/imageloader.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/imageloader.go index bc32f79cd9..d2614b13ad 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/imageloader.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/imageloader.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -22,9 +22,6 @@ import ( "time" "github.com/Tencent/bk-bcs/bcs-common/common/blog" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/metrics" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginmanager" - "k8s.io/api/admission/v1beta1" apiv1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" @@ -38,6 +35,9 @@ import ( "k8s.io/client-go/rest" "k8s.io/client-go/tools/cache" "k8s.io/client-go/util/workqueue" + + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/metrics" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginmanager" ) const ( @@ -57,6 +57,7 @@ func init() { } // ImageLoaderConfig config of image loader +// nolint type ImageLoaderConfig struct { // Workload supported workload Workload string `json:"workload"` @@ -177,7 +178,7 @@ func (i *imageLoader) Init(configFilePath string) error { } workers := 1 - go i.run(workers) + go i.run(workers) // nolint return nil } @@ -205,6 +206,7 @@ func (i *imageLoader) worker() { } } +// nolint always nil func (i *imageLoader) run(workers int) error { defer utilruntime.HandleCrash() defer i.queue.ShutDown() diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/job.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/job.go index b8fb97095a..d14301cad1 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/job.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/job.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -20,7 +20,6 @@ import ( "time" "github.com/Tencent/bk-bcs/bcs-common/common/blog" - batchv1 "k8s.io/api/batch/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" @@ -237,7 +236,7 @@ func (i *imageLoader) createJob(job *batchv1.Job) error { _, createErr := i.k8sClient.BatchV1().Jobs(pluginName).Create(context.Background(), job, metav1.CreateOptions{}) return createErr } - isRetryable := func(err error) bool { + isRetryable := func(err error) bool { // nolint return errors.IsAlreadyExists(err) } err := retry.OnError(retry.DefaultBackoff, isRetryable, createFunc) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/metrics.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/metrics.go index 3ab4933c18..038da71cb1 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/metrics.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/metrics.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/secret.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/secret.go index fecf9b4350..102eafa8cb 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/secret.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/secret.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/workload.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/workload.go index 5b4f431460..c98fb5fc73 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/workload.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/imageloader/workload.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -18,7 +18,6 @@ import ( "github.com/Tencent/bk-bcs/bcs-common/common/blog" tkexv1alpha1 "github.com/Tencent/bk-bcs/bcs-scenarios/kourse/pkg/apis/tkex/v1alpha1" - "k8s.io/api/admission/v1beta1" corev1 "k8s.io/api/core/v1" ) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/mesos.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/mesos.go index 68553162b3..f0c39fd315 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/mesos.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/mesos.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/patchmount/patchmount.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/patchmount/patchmount.go index 188397a764..3f51c8102f 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/patchmount/patchmount.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/patchmount/patchmount.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -18,10 +18,10 @@ import ( "fmt" "time" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" "k8s.io/api/admission/v1beta1" corev1 "k8s.io/api/core/v1" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/metrics" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginmanager" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginutil" @@ -174,6 +174,7 @@ func getMountTypesTemplate(pod *corev1.Pod, patchMountType string) ([]corev1.Vol var volumesTemplate []corev1.Volume disableMountSysDevices := pod.Annotations[disableMountSysDevicesAnnotationKey] == "true" + // nolint switch patchMountType { case patchMountLxcfs: if disableMountSysDevices { diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/patchmount/types.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/patchmount/types.go index 3944c02167..3b44d97d13 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/patchmount/types.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/patchmount/types.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/plugin.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/plugin.go index 1070f2b029..c3f6d8b002 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/plugin.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/plugin.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/randhostport/cache.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/randhostport/cache.go index e9d7231d51..54d2aef0f8 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/randhostport/cache.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/randhostport/cache.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -121,7 +121,7 @@ func (pc *PortCache) Unlock() { // IncPortQuantity increase quantity for certain port func (pc *PortCache) IncPortQuantity(port uint64) error { if entry, ok := pc.m[port]; ok { - entry.Quantity = entry.Quantity + 1 + entry.Quantity++ heap.Fix(pc.h, entry.Index) } return fmt.Errorf("entry for port %d not found when do increase", port) @@ -130,7 +130,7 @@ func (pc *PortCache) IncPortQuantity(port uint64) error { // DecPortQuantity decrease quantity for certain port func (pc *PortCache) DecPortQuantity(port uint64) error { if entry, ok := pc.m[port]; ok { - entry.Quantity = entry.Quantity - 1 + entry.Quantity-- heap.Fix(pc.h, entry.Index) return nil } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/randhostport/cache_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/randhostport/cache_test.go index ca87667899..2affd98001 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/randhostport/cache_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/randhostport/cache_test.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/randhostport/randhostport.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/randhostport/randhostport.go index 20e3974d37..dfc3b776fe 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/randhostport/randhostport.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/randhostport/randhostport.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -22,11 +22,6 @@ import ( "time" "github.com/Tencent/bk-bcs/bcs-common/common/blog" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/metrics" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginmanager" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginutil" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/types" - "k8s.io/api/admission/v1beta1" corev1 "k8s.io/api/core/v1" k8smetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -37,6 +32,11 @@ import ( "k8s.io/client-go/rest" "k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/clientcmd" + + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/metrics" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginmanager" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginutil" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/types" ) func init() { @@ -108,7 +108,7 @@ func (hpi *HostPortInjector) Init(configFilePath string) error { } } else { portPeriod := hpi.conf.EndPort - hpi.conf.StartPort - hpi.nextAssignPort = uint64(rand.Int63n(int64(portPeriod)) + int64(hpi.conf.StartPort)) + hpi.nextAssignPort = uint64(rand.Int63n(int64(portPeriod)) + int64(hpi.conf.StartPort)) // nolint } blog.Infof("randhostport plugin init cache successfully") @@ -134,11 +134,12 @@ func (hpi *HostPortInjector) Init(configFilePath string) error { return nil } +// nolint always nil func (hpi *HostPortInjector) initCache() error { hpi.portCache = NewPortCache() for i := hpi.conf.StartPort; i <= hpi.conf.EndPort; i++ { hpi.portCache.PushPortEntry(&PortEntry{ - Port: uint64(i), + Port: i, Quantity: uint64(0), }) } @@ -211,6 +212,7 @@ func (hpi *HostPortInjector) injectRequired(pod *corev1.Pod) bool { return true } +// nolint funlen func (hpi *HostPortInjector) injectToPod(pod *corev1.Pod) ([]types.PatchOperation, error) { portStrs := getPortStringsFromPodAnnotations(pod.Annotations) if len(portStrs) == 0 { @@ -260,7 +262,7 @@ func (hpi *HostPortInjector) injectToPod(pod *corev1.Pod) ([]types.PatchOperatio hostPorts = append(hostPorts, portEntry) } for _, hostPort := range hostPorts { - hostPort.Quantity = hostPort.Quantity + 1 + hostPort.Quantity++ hpi.portCache.PushPortEntry(hostPort) } hpi.portCache.Unlock() @@ -297,9 +299,9 @@ func (hpi *HostPortInjector) injectToPod(pod *corev1.Pod) ([]types.PatchOperatio Op: PatchOperationAdd, Value: hostPorts[hostPortCount].Port, }) - hostPortMapping[hostPorts[hostPortCount].Port] = uint64(hostPorts[hostPortCount].Port) + hostPortMapping[hostPorts[hostPortCount].Port] = hostPorts[hostPortCount].Port } else { - hostPortMapping[uint64(containerPort)] = uint64(hostPorts[hostPortCount].Port) + hostPortMapping[uint64(containerPort)] = hostPorts[hostPortCount].Port } hostPortCount++ } @@ -323,7 +325,8 @@ func (hpi *HostPortInjector) injectToPod(pod *corev1.Pod) ([]types.PatchOperatio } // generateAnnotationsPatch generate patch for pod annotations -func (hpi *HostPortInjector) generateAnnotationsPatch(pod *corev1.Pod, hostPortMapping map[uint64]uint64) types.PatchOperation { +func (hpi *HostPortInjector) generateAnnotationsPatch( + pod *corev1.Pod, hostPortMapping map[uint64]uint64) types.PatchOperation { annotations := pod.Annotations op := PatchOperationReplace if len(annotations) == 0 { diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/randhostport/randhostport_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/randhostport/randhostport_test.go index eb5a163745..09e469db7b 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/randhostport/randhostport_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/randhostport/randhostport_test.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/randhostport/types.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/randhostport/types.go index 002359009a..76aa18955c 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/randhostport/types.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/randhostport/types.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/randhostport/utils.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/randhostport/utils.go index 444a8ec295..2c0ecbbe7c 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/randhostport/utils.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/randhostport/utils.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/resourceratio/resourceratio.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/resourceratio/resourceratio.go index 109f97b2b8..59e01db18b 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/resourceratio/resourceratio.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/resourceratio/resourceratio.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -20,11 +20,11 @@ import ( "strings" "time" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" "k8s.io/api/admission/v1beta1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/metrics" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginmanager" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginutil" @@ -132,7 +132,7 @@ func (r *ResourceRatio) isBlock(pod *corev1.Pod) bool { cpuRequest := resource.NewQuantity(0, resource.DecimalSI) memoryRequest := resource.NewQuantity(0, resource.BinarySI) - allContainers := append(pod.Spec.Containers, pod.Spec.InitContainers...) + allContainers := append(pod.Spec.Containers, pod.Spec.InitContainers...) // nolint for _, container := range allContainers { if container.Resources.Requests != nil { if cpu, ok := container.Resources.Requests[corev1.ResourceCPU]; ok { @@ -172,7 +172,7 @@ func (r *ResourceRatio) isBlock(pod *corev1.Pod) bool { return true } - //转化为核和Gi,再计算比例 + // 转化为核和Gi,再计算比例 cpuCoreValue := float64(cpuRequest.MilliValue()) / float64(1000) memoryGiValue := float64(memoryRequest.Value()) / float64(1024*1024*1024) ratio := cpuCoreValue / memoryGiValue diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/resourceratio/resourceratio_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/resourceratio/resourceratio_test.go index d61220479a..0a79258d88 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/resourceratio/resourceratio_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/resourceratio/resourceratio_test.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginmanager/manager.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginmanager/manager.go index ff58842472..10c64b732c 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginmanager/manager.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginmanager/manager.go @@ -1,15 +1,16 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 pluginmanager xxx package pluginmanager import ( @@ -17,6 +18,7 @@ import ( "path/filepath" "github.com/Tencent/bk-bcs/bcs-common/common/blog" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/options" ) diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginmanager/util.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginmanager/util.go index 4e6e38db87..496d3bf715 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginmanager/util.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginmanager/util.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginutil/pluginutil.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginutil/pluginutil.go index 000aa4b86d..bf48af05d4 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginutil/pluginutil.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginutil/pluginutil.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/server/init.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/server/init.go index 7cc5fd41d3..b48b384742 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/server/init.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/server/init.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -12,6 +12,7 @@ package server +// nolint import ( // import bcslog plugin _ "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/plugin/bcslog" diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/server/k8s.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/server/k8s.go index c4aefb8342..4b6b6d3fec 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/server/k8s.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/server/k8s.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -20,6 +20,7 @@ import ( "strconv" "time" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" jsonpatch "github.com/evanphx/json-patch" v1 "k8s.io/api/admission/v1" "k8s.io/api/admission/v1beta1" @@ -28,7 +29,6 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/serializer" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/convert" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/metrics" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginutil" @@ -44,10 +44,11 @@ var ( deserializer = codecs.UniversalDeserializer() // (https://github.com/kubernetes/kubernetes/issues/57982) - defaulter = runtime.ObjectDefaulter(runtimeScheme) + defaulter = runtime.ObjectDefaulter(runtimeScheme) // nolint ) // K8sHook do k8s hook +// nolint funlen func (ws *WebhookServer) K8sHook(w http.ResponseWriter, r *http.Request) { var ( handler = "K8sHook" @@ -158,6 +159,7 @@ func (ws *WebhookServer) K8sHook(w http.ResponseWriter, r *http.Request) { metrics.ReportBcsWebhookServerAPIMetrics(handler, method, strconv.Itoa(http.StatusOK), started) } +// nolint funlen func (ws *WebhookServer) doK8sHook(ar v1beta1.AdmissionReview) *v1beta1.AdmissionResponse { req := ar.Request plugins := ws.PluginMgr.GetKubernetesPlugins() @@ -207,7 +209,7 @@ func (ws *WebhookServer) doK8sHook(ar v1beta1.AdmissionReview) *v1beta1.Admissio default: return &v1beta1.AdmissionResponse{Allowed: true} // NOCC:goconst/string(设计如此) - case "y", "yes", "true", "on": + case "y", "yes", "true", "on": // nolint // do nothing, let it go } } @@ -230,7 +232,8 @@ func (ws *WebhookServer) doK8sHook(ar v1beta1.AdmissionReview) *v1beta1.Admissio tmpUnstructKind, tmpUnstructName, tmpUnstructNs, pluginNames[index]) // do webhook tmpResponse := p.Handle(ar) - blog.Infof("end %s %s/%s hook by plugin %s, cost %d Milliseconds", tmpUnstructKind, tmpUnstructName, tmpUnstructNs, pluginNames[index], time.Since(startTime).Milliseconds()) + blog.Infof("end %s %s/%s hook by plugin %s, cost %d Milliseconds", tmpUnstructKind, tmpUnstructName, + tmpUnstructNs, pluginNames[index], time.Since(startTime).Milliseconds()) // when one plugin is not allowed, just return response if !tmpResponse.Allowed { diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/server/k8s_test.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/server/k8s_test.go index 47d6f85098..627bda6a33 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/server/k8s_test.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/server/k8s_test.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/server/mesos.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/server/mesos.go index 986d7be4f8..00b9b1a71b 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/server/mesos.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/server/mesos.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -22,6 +22,7 @@ import ( "github.com/Tencent/bk-bcs/bcs-common/common/blog" commtypes "github.com/Tencent/bk-bcs/bcs-common/common/types" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/metrics" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/types" ) @@ -33,6 +34,7 @@ type Meta struct { } // MesosHook do mesos hook +// nolint funlen func (ws *WebhookServer) MesosHook(w http.ResponseWriter, r *http.Request) { var ( handler = "MesosHook" diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/server/server.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/server/server.go index 31c77bb68e..097cceefcd 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/server/server.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/server/server.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -26,11 +26,11 @@ import ( "github.com/Tencent/bk-bcs/bcs-common/common" "github.com/Tencent/bk-bcs/bcs-common/common/blog" + "github.com/prometheus/client_golang/prometheus/promhttp" + _ "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/metrics" // metrics xxx "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/pluginmanager" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/options" - - "github.com/prometheus/client_golang/prometheus/promhttp" ) // WebhookServer server for bcs webhook @@ -63,7 +63,7 @@ func NewWebhookServer(opt *options.ServerOption) (*WebhookServer, error) { PluginMgr: pm, Server: &http.Server{ Addr: fmt.Sprintf("%s:%v", opt.Address, opt.Port), - TLSConfig: &tls.Config{Certificates: []tls.Certificate{pair}}, + TLSConfig: &tls.Config{Certificates: []tls.Certificate{pair}}, // nolint TLS MinVersion too low }, } @@ -101,11 +101,10 @@ func (ws *WebhookServer) Run() { <-signalChan blog.Infof("Got OS shutdown signal, shutting down webhook server gracefully...") - ws.Server.Shutdown(context.Background()) + ws.Server.Shutdown(context.Background()) // nolint if err := ws.PluginMgr.ClosePlugins(); err != nil { blog.Errorf("close plugins failed, err %s", err.Error()) } - return } func runPrometheusMetricsServer(opt *options.ServerOption) { @@ -114,7 +113,7 @@ func runPrometheusMetricsServer(opt *options.ServerOption) { // register prometheus server http.Handle("/metrics", promhttp.Handler()) addr := opt.Address + ":" + strconv.Itoa(int(opt.MetricPort)) - go http.ListenAndServe(addr, nil) + go http.ListenAndServe(addr, nil) // nolint blog.Infof("run prometheus server ok") } diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/types/types.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/types/types.go index 49a9f3d034..6995794760 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/types/types.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/internal/types/types.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/options/options.go b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/options/options.go index d421f52318..617fa58068 100644 --- a/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/options/options.go +++ b/bcs-runtime/bcs-k8s/bcs-component/bcs-webhook-server/options/options.go @@ -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 options xxx @@ -22,6 +21,7 @@ import ( ) // ServerOption is option in flags +// nolint type ServerOption struct { conf.FileConfig conf.MetricConfig @@ -30,7 +30,7 @@ type ServerOption struct { Address string `json:"address" short:"a" value:"0.0.0.0" usage:"IP address to listen on for this service"` Port uint `json:"port" short:"p" value:"443" usage:"Port to listen on for this service"` - ServerCertFile string `json:"server_cert_file" value:"" usage:"Server public key file(*.crt). If both server_cert_file and server_key_file are set, it will set up an HTTPS server"` + ServerCertFile string `json:"server_cert_file" value:"" usage:"Server public key file(*.crt). If both server_cert_file and server_key_file are set, it will set up an HTTPS server"` ServerKeyFile string `json:"server_key_file" value:"" usage:"Server private key file(*.key). If both server_cert_file and server_key_file are set, it will set up an HTTPS server"` EngineType string `json:"engine_type" value:"kubernetes" usage:"the platform that bcs-webhook-server runs in, kubernetes or mesos"` PluginDir string `json:"plugin_dir" value:"./plugins" usage:"directory for bcs webhook plugins"` @@ -56,6 +56,6 @@ func Parse(ops *ServerOption) error { if ops.EngineType != EngineTypeKubernetes && ops.EngineType != EngineTypeMesos { return fmt.Errorf("unsupported engine type %s", ops.EngineType) } - strings.Replace(ops.Plugins, ";", ",", -1) + strings.Replace(ops.Plugins, ";", ",", -1) // nolint return nil } diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/bcs-eni-cni/eni/eni.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/bcs-eni-cni/eni/eni.go index aada023b34..0cc4f9ecbb 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/bcs-eni-cni/eni/eni.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/bcs-eni-cni/eni/eni.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -15,11 +15,12 @@ package eni import ( "encoding/json" "fmt" - "golang.org/x/sys/unix" "net" "strconv" "strings" + "golang.org/x/sys/unix" + "github.com/containernetworking/cni/pkg/skel" "github.com/containernetworking/cni/pkg/types" "github.com/containernetworking/cni/pkg/types/current" @@ -90,7 +91,7 @@ func loadConf(bytes []byte, args string) (*NetConf, string, error) { } // ENI cni object -type ENI struct{ +type ENI struct { eniPrefix string } diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/bcs-eni-cni/main.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/bcs-eni-cni/main.go index 37c57111e8..88a3fedeaa 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/bcs-eni-cni/main.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/bcs-eni-cni/main.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/bcs-eni-ipam/cloudagent/cloudagentclient.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/bcs-eni-ipam/cloudagent/cloudagentclient.go index f5441c78cf..f7be93b34b 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/bcs-eni-ipam/cloudagent/cloudagentclient.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/bcs-eni-ipam/cloudagent/cloudagentclient.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/bcs-eni-ipam/cloudagent/k8s.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/bcs-eni-ipam/cloudagent/k8s.go index 04543ea948..03c20b9d93 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/bcs-eni-ipam/cloudagent/k8s.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/bcs-eni-ipam/cloudagent/k8s.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/bcs-eni-ipam/main.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/bcs-eni-ipam/main.go index e7f3a3b1c9..131999a424 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/bcs-eni-ipam/main.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/bcs-eni-ipam/main.go @@ -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 @@ -35,13 +34,13 @@ var ( defaultLogDir = "./logs" ) -//BcsIPAMConfig represents the IP related network configuration. +// BcsIPAMConfig represents the IP related network configuration. type BcsIPAMConfig struct { Routes []types.Route `json:"routes"` Args *cloudagent.K8sArgs `json:"-"` } -//NetConf network configuration from json config, reading from stdin +// NetConf network configuration from json config, reading from stdin type NetConf struct { Name string `json:"name"` CNIVersion string `json:"cniVersion"` @@ -50,7 +49,7 @@ type NetConf struct { IPAM *BcsIPAMConfig `json:"ipam"` } -//LoadBcsIPAMConfig creates a NetworkConfig from the given network name. +// LoadBcsIPAMConfig creates a NetworkConfig from the given network name. func LoadBcsIPAMConfig(bytes []byte, args string) (*NetConf, *BcsIPAMConfig, error) { n := &NetConf{} if err := json.Unmarshal(bytes, n); err != nil { @@ -78,7 +77,7 @@ func init() { util.InitFlags() } -//cmdAdd handle add command, reply available ip info +// cmdAdd handle add command, reply available ip info func cmdAdd(args *skel.CmdArgs) error { //loading config from stdin netConf, ipamConf, err := LoadBcsIPAMConfig(args.StdinData, args.Args) @@ -143,7 +142,7 @@ func cmdAdd(args *skel.CmdArgs) error { return types.PrintResult(result, netConf.CNIVersion) } -//cmdDel release ip address +// cmdDel release ip address func cmdDel(args *skel.CmdArgs) error { //loading config from stdin netConf, _, err := LoadBcsIPAMConfig(args.StdinData, args.Args) diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/netagent/main.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/netagent/main.go index bf4e50b346..b22db97026 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/netagent/main.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/netagent/main.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/netagenttest/main.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/netagenttest/main.go index c69bbb8f39..786b7f31e1 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/netagenttest/main.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/cmd/netagenttest/main.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/action/alloc.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/action/alloc.go index f8cceee0ef..bc21cdf04e 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/action/alloc.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/action/alloc.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/action/release.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/action/release.go index 56df42cc47..0a06fe6d60 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/action/release.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/action/release.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/app/rpcs.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/app/rpcs.go index d2d339aa03..1167b337c2 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/app/rpcs.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/app/rpcs.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/app/server.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/app/server.go index d8d3a4eb7e..da22edd80a 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/app/server.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/app/server.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/deviceplugin/deviceplugin.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/deviceplugin/deviceplugin.go index a496d48b6c..13d7db9379 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/deviceplugin/deviceplugin.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/deviceplugin/deviceplugin.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/deviceplugin/devicepluginop.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/deviceplugin/devicepluginop.go index 110c2f1d6d..88e3d40e52 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/deviceplugin/devicepluginop.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/deviceplugin/devicepluginop.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/inspector/dirtycheck.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/inspector/dirtycheck.go index f322ed7d1d..e03724b695 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/inspector/dirtycheck.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/inspector/dirtycheck.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/inspector/networkinspector.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/inspector/networkinspector.go index 09e3313b29..9a7742ce69 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/inspector/networkinspector.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/inspector/networkinspector.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/inspector/patch.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/inspector/patch.go index 8937482ce3..a1ac2cff83 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/inspector/patch.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/inspector/patch.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/ipcache/cache.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/ipcache/cache.go index 4f16ee01d1..0494c957bd 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/ipcache/cache.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/ipcache/cache.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/networkutil/networkutil.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/networkutil/networkutil.go index 2da4445910..e79b185bc6 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/networkutil/networkutil.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/networkutil/networkutil.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -14,12 +14,13 @@ package networkutil import ( "fmt" - "golang.org/x/sys/unix" "net" "os" "reflect" "strings" + "golang.org/x/sys/unix" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/internal/constant" diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/networkutil/utils.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/networkutil/utils.go index 9655faa03d..8626256d7a 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/networkutil/utils.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/networkutil/utils.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/networkutil/utils_test.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/networkutil/utils_test.go index a1301eb8c3..2fde5a475c 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/networkutil/utils_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/networkutil/utils_test.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/options/options.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/options/options.go index b6b4e3ec96..e602073ff7 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/options/options.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netagent/internal/options/options.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/controllers/fixedip_controller.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/controllers/fixedip_controller.go index e004b9102b..581a5bfd13 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/controllers/fixedip_controller.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/controllers/fixedip_controller.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/controllers/node_controller.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/controllers/node_controller.go index 22c26d5593..ad72cc952d 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/controllers/node_controller.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/controllers/node_controller.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/controllers/nodenetwork.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/controllers/nodenetwork.go index f652b818cd..245a3d5af9 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/controllers/nodenetwork.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/controllers/nodenetwork.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/controllers/nodenetwork_controller.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/controllers/nodenetwork_controller.go index a1f5527288..cdf405b56f 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/controllers/nodenetwork_controller.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/controllers/nodenetwork_controller.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/controllers/util.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/controllers/util.go index f1bd308f5b..66b1015c76 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/controllers/util.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/controllers/util.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/internal/metric/metric.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/internal/metric/metric.go index 8bc4286ec6..813cb142d0 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/internal/metric/metric.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/internal/metric/metric.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/internal/option/option.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/internal/option/option.go index 72eba37e97..62d0fd0946 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/internal/option/option.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/internal/option/option.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/main.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/main.go index abd11408a0..429ff2762f 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/main.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/main.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/aws/awseni.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/aws/awseni.go index a0400d9d56..51f5c83858 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/aws/awseni.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/aws/awseni.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/aws/awseni_imp.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/aws/awseni_imp.go index dd6b6c8cdb..36c0ec13b0 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/aws/awseni_imp.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/aws/awseni_imp.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/aws/util.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/aws/util.go index 3e437b8dba..3abf46cfa8 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/aws/util.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/aws/util.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/aws/util_test.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/aws/util_test.go index fdf4c9bf36..39c3197b24 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/aws/util_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/aws/util_test.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/errors.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/errors.go index ebc2e91ca5..420abe3c34 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/errors.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/errors.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/interface.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/interface.go index 8c0601b3fd..0b00db6dc4 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/interface.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/interface.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/qcloud/constant.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/qcloud/constant.go index 8700f758ff..749ee777d0 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/qcloud/constant.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/qcloud/constant.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/qcloud/qcloudeni.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/qcloud/qcloudeni.go index 6c4d077d0a..f9e7d3a447 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/qcloud/qcloudeni.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/qcloud/qcloudeni.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/qcloud/qcloudeni_imp.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/qcloud/qcloudeni_imp.go index d273e88489..5d2300577d 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/qcloud/qcloudeni_imp.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/qcloud/qcloudeni_imp.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/qcloud/util.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/qcloud/util.go index c098bf98de..e18ca6e10c 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/qcloud/util.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netcontroller/pkg/cloud/qcloud/util.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/cmd/cloudnetservice/main.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/cmd/cloudnetservice/main.go index 95be2b5428..f409bb81e6 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/cmd/cloudnetservice/main.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/cmd/cloudnetservice/main.go @@ -1,20 +1,22 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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-network/bcs-cloud-netservice/internal/app" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/option" ) diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/action.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/action.go index b0f05860f9..f985316c76 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/action.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/action.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/eni/allocate.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/eni/allocate.go index 41718d9415..ad2a80d6f8 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/eni/allocate.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/eni/allocate.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/eni/release.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/eni/release.go index 2e281469e9..4bc563d79c 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/eni/release.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/eni/release.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/allocate.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/allocate.go index 8bdbe3b21b..fc02932447 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/allocate.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/allocate.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/cleaneni.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/cleaneni.go index ac975bcd07..e8e921f0b7 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/cleaneni.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/cleaneni.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/fixedallocate.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/fixedallocate.go index 67898b6d02..3b7f686d5d 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/fixedallocate.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/fixedallocate.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/fixedclean.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/fixedclean.go index dd22cda4e3..17728f817b 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/fixedclean.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/fixedclean.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/list.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/list.go index 273f516274..0e77c68ed6 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/list.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/list.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/release.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/release.go index bf7334030a..ea95dcc9c5 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/release.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/release.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/transstatus.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/transstatus.go index 5576b31606..699e79c76c 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/transstatus.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/ip/transstatus.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/quota/add.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/quota/add.go index 86d65c38d2..1e50f705d6 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/quota/add.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/quota/add.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/quota/delete.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/quota/delete.go index 4d75a20a88..c2a2b5f213 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/quota/delete.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/quota/delete.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/quota/get.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/quota/get.go index 121a897d2d..125d2ab962 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/quota/get.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/quota/get.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/quota/list.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/quota/list.go index b0cec5feb6..11b0148880 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/quota/list.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/quota/list.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/quota/update.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/quota/update.go index 34132f8b92..a90e17832d 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/quota/update.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/quota/update.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/subnet/add.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/subnet/add.go index 530d1c952a..f27feaf464 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/subnet/add.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/subnet/add.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/subnet/change.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/subnet/change.go index a05aff67b0..ced389dc23 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/subnet/change.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/subnet/change.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/subnet/delete.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/subnet/delete.go index 457eea6a27..ef5056532d 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/subnet/delete.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/subnet/delete.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/subnet/findavailable.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/subnet/findavailable.go index 5bb02dd4ca..70b33269e9 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/subnet/findavailable.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/subnet/findavailable.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/subnet/list.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/subnet/list.go index 8e8e304123..03342e52af 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/subnet/list.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/subnet/list.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/utils/utils.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/utils/utils.go index e6f54ae152..05e3f410e6 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/utils/utils.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/action/utils/utils.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/app/app.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/app/app.go index 1a5a88a7b2..6286bae920 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/app/app.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/app/app.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/app/rpcs.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/app/rpcs.go index 4d3cb22a26..540317a0bc 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/app/rpcs.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/app/rpcs.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/cleaner/cleaner.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/cleaner/cleaner.go index 11e7e7ba6f..bd5b8f7129 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/cleaner/cleaner.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/cleaner/cleaner.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/cloud/aws/aws.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/cloud/aws/aws.go index af573ffe91..bd9d76d3aa 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/cloud/aws/aws.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/cloud/aws/aws.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/cloud/cloud.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/cloud/cloud.go index 18dfed8267..570ecdd1f1 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/cloud/cloud.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/cloud/cloud.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/cloud/tencentcloud/constant.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/cloud/tencentcloud/constant.go index 8a3bde669c..f1f5e0520c 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/cloud/tencentcloud/constant.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/cloud/tencentcloud/constant.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/cloud/tencentcloud/tencentcloud.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/cloud/tencentcloud/tencentcloud.go index ee36f75404..3d3d633017 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/cloud/tencentcloud/tencentcloud.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/cloud/tencentcloud/tencentcloud.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/cloud/tencentcloud/tencentcloud_imp.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/cloud/tencentcloud/tencentcloud_imp.go index 208c8a19cb..c4ff8abb3a 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/cloud/tencentcloud/tencentcloud_imp.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/cloud/tencentcloud/tencentcloud_imp.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/metric/metric.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/metric/metric.go index ef2374a995..02821cb154 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/metric/metric.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/metric/metric.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/option/option.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/option/option.go index dc2b8fa41a..97afe48022 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/option/option.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/option/option.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/store/kube/kube.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/store/kube/kube.go index f546d0b4c4..c69f9b2196 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/store/kube/kube.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/store/kube/kube.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/store/store.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/store/store.go index 2838455e55..e2288b5ff6 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/store/store.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/store/store.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/types/pool.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/types/pool.go index 74f14ea623..f18418f05d 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/types/pool.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/types/pool.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/types/types.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/types/types.go index 377c7df0f8..30b564d572 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/types/types.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/types/types.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/utils/cidr.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/utils/cidr.go index 4aab63e148..abf2509155 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/utils/cidr.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/utils/cidr.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/utils/cidr_test.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/utils/cidr_test.go index d9c047cc1b..f308d9a3fb 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/utils/cidr_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/utils/cidr_test.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/utils/utils.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/utils/utils.go index d1c7cf7b3e..1f81ae6ce5 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/utils/utils.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/utils/utils.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/utils/utils_test.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/utils/utils_test.go index 9ffcfb80ed..3509c09317 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/utils/utils_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloud-netservice/internal/utils/utils_test.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/cloud-network-agent/bcs-eni-cni/main.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/cloud-network-agent/bcs-eni-cni/main.go index 5db0d254aa..746016010d 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/cloud-network-agent/bcs-eni-cni/main.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/cloud-network-agent/bcs-eni-cni/main.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/cloud-network-agent/controller/controller.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/cloud-network-agent/controller/controller.go index ee813e2542..50b5d785e0 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/cloud-network-agent/controller/controller.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/cloud-network-agent/controller/controller.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/cloud-network-agent/main.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/cloud-network-agent/main.go index 86f115ddaf..34b9b2d502 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/cloud-network-agent/main.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/cloud-network-agent/main.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/cloud-network-agent/options/options.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/cloud-network-agent/options/options.go index ede6bb5dcc..9c251f06dd 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/cloud-network-agent/options/options.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/cloud-network-agent/options/options.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/cloud-network-agent/server/server.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/cloud-network-agent/server/server.go index e954541054..265951818f 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/cloud-network-agent/server/server.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/cloud-network-agent/server/server.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/constant/constant.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/constant/constant.go index 40af8b59ec..5951745175 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/constant/constant.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/constant/constant.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/aws/awseni.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/aws/awseni.go index f99bcd91b2..f586344eb7 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/aws/awseni.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/aws/awseni.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/aws/awseni_imp.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/aws/awseni_imp.go index 95d937df73..01028c1cbe 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/aws/awseni_imp.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/aws/awseni_imp.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/aws/util.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/aws/util.go index 3e437b8dba..3abf46cfa8 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/aws/util.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/aws/util.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/aws/util_test.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/aws/util_test.go index fdf4c9bf36..39c3197b24 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/aws/util_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/aws/util_test.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/interface.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/interface.go index 6dfb2e9e53..a3a9d6f58b 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/interface.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/interface.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/qcloud/constant.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/qcloud/constant.go index fb71aed791..17f17fa0ef 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/qcloud/constant.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/qcloud/constant.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/qcloud/qcloudeni.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/qcloud/qcloudeni.go index 412b8f0577..a6a37722ce 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/qcloud/qcloudeni.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/qcloud/qcloudeni.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/qcloud/qcloudeni_imp.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/qcloud/qcloudeni_imp.go index eca50e6765..ab93bc2cd9 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/qcloud/qcloudeni_imp.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/qcloud/qcloudeni_imp.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/qcloud/util.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/qcloud/util.go index 835add6e6d..36ac1a0112 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/qcloud/util.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/eni/qcloud/util.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/enilimit/limit.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/enilimit/limit.go index 42a4284220..fb29f6261e 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/enilimit/limit.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/enilimit/limit.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/enilimit/limit_test.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/enilimit/limit_test.go index 74b6a174ba..8b106ba0bb 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/enilimit/limit_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/enilimit/limit_test.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/netservice/netservice.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/netservice/netservice.go index a9c5d96751..7f1daf28e2 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/netservice/netservice.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/netservice/netservice.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/networkutil/networkutil.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/networkutil/networkutil.go index 9a95498c3a..a3fe73fa7d 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/networkutil/networkutil.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/networkutil/networkutil.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -14,12 +14,13 @@ package networkutil import ( "fmt" - "golang.org/x/sys/unix" "net" "os" "reflect" "strings" + "golang.org/x/sys/unix" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/containernetworking/plugins/pkg/ip" diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/networkutil/utils.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/networkutil/utils.go index b9e6a49205..576909cef8 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/networkutil/utils.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/networkutil/utils.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/networkutil/utils_test.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/networkutil/utils_test.go index 9eaa57d9a2..ea2f6a5327 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/networkutil/utils_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/networkutil/utils_test.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/nodenetwork/nodenetwork.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/nodenetwork/nodenetwork.go index 90662e218c..52b1924f31 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/nodenetwork/nodenetwork.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-cloudnetwork/pkg/nodenetwork/nodenetwork.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/ingresscontroller/endpointfilter.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/ingresscontroller/endpointfilter.go index aeb8a79c67..c65bceff6e 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/ingresscontroller/endpointfilter.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/ingresscontroller/endpointfilter.go @@ -1,18 +1,20 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 ingresscontroller xxx package ingresscontroller import ( + "github.com/Tencent/bk-bcs/bcs-common/common/blog" k8scorev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/util/workqueue" @@ -20,7 +22,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/event" "sigs.k8s.io/controller-runtime/pkg/reconcile" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/ingresscache" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics" ) diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/ingresscontroller/ingress_controller.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/ingresscontroller/ingress_controller.go index c308d69f5e..40b102ceaf 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/ingresscontroller/ingress_controller.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/ingresscontroller/ingress_controller.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -20,28 +20,27 @@ import ( "strings" "time" - "github.com/pkg/errors" - k8smetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - k8stypes "k8s.io/apimachinery/pkg/types" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/constant" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/ingresscache" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/option" - netcommon "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/pkg/common" networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" - "github.com/go-logr/logr" + "github.com/pkg/errors" k8scorev1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" + k8smetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + k8stypes "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/tools/record" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/event" "sigs.k8s.io/controller-runtime/pkg/predicate" "sigs.k8s.io/controller-runtime/pkg/source" + + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/constant" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/ingresscache" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/option" + netcommon "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/pkg/common" ) // IngressReconciler reconciler for bcs ingress in network extension @@ -130,7 +129,7 @@ func (ir *IngressReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { Requeue: true, RequeueAfter: 5 * time.Second, }, nil - } else if retry == true { + } else if retry { blog.V(4).Infof("process deleted ingress %s/%s retry", req.Name, req.Namespace) return ctrl.Result{ Requeue: true, @@ -193,6 +192,7 @@ func (ir *IngressReconciler) removeFinalizerForIngress(ingress *networkextension return nil } +// nolint unused func (ir *IngressReconciler) addFinalizerForIngress(ingress *networkextensionv1.Ingress) error { ingress.Finalizers = append(ingress.Finalizers, constant.FinalizerNameBcsIngressController) if err := ir.Client.Update(context.Background(), ingress, &client.UpdateOptions{}); err != nil { diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/ingresscontroller/podfilter.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/ingresscontroller/podfilter.go index fa948df579..f9f5a073b1 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/ingresscontroller/podfilter.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/ingresscontroller/podfilter.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -15,6 +15,7 @@ package ingresscontroller import ( "context" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" k8scorev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/types" @@ -23,7 +24,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/event" "sigs.k8s.io/controller-runtime/pkg/reconcile" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/ingresscache" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics" ) diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/ingresscontroller/utils.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/ingresscontroller/utils.go index 8b89887ba5..e5570fcf20 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/ingresscontroller/utils.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/ingresscontroller/utils.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -16,10 +16,10 @@ import ( "fmt" "reflect" + networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" k8scorev1 "k8s.io/api/core/v1" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/ingresscache" - networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" ) func deduplicateIngresses(ingresses []ingresscache.IngressMeta) []ingresscache.IngressMeta { diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/ingresscontroller/utils_test.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/ingresscontroller/utils_test.go index 3f91eadd91..9df33972c2 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/ingresscontroller/utils_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/ingresscontroller/utils_test.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/check/checkrunner.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/check/checkrunner.go index 8722b9e1b9..6264270b7d 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/check/checkrunner.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/check/checkrunner.go @@ -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 check 通过额外goroutine,定时检查组件运行状态 diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/check/ingresschecker.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/check/ingresschecker.go index e0caa59ed8..39d429df4d 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/check/ingresschecker.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/check/ingresschecker.go @@ -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 check diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/check/interface.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/check/interface.go index b7c65b3a39..db1ac382c9 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/check/interface.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/check/interface.go @@ -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 check diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/check/listenerchecker.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/check/listenerchecker.go index b2c977108e..1ec971cee1 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/check/listenerchecker.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/check/listenerchecker.go @@ -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 check diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/check/portbindchecker.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/check/portbindchecker.go index 79c120ca57..5c1518a6bc 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/check/portbindchecker.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/check/portbindchecker.go @@ -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 check diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/check/portbindchecker_test.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/check/portbindchecker_test.go index 02b6c16ac9..4a8e2e3802 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/check/portbindchecker_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/check/portbindchecker_test.go @@ -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 check diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/aws/aga_support_test.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/aws/aga_support_test.go index df54df43e8..f5ebc1a73d 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/aws/aga_support_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/aws/aga_support_test.go @@ -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 aws diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/aws/aga_supporter.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/aws/aga_supporter.go index 2b5fe1b455..320119207f 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/aws/aga_supporter.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/aws/aga_supporter.go @@ -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 aws diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/aws/helper_test.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/aws/helper_test.go index f28182bb71..f8db16c8cc 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/aws/helper_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/aws/helper_test.go @@ -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 aws diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/aws/sdkhelper.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/aws/sdkhelper.go index 278337e9e1..904a23ce31 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/aws/sdkhelper.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/aws/sdkhelper.go @@ -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 aws diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/aws/validate.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/aws/validate.go index 8a8e245887..ef3e0092e2 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/aws/validate.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/aws/validate.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/aws/validate_test.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/aws/validate_test.go index a0ec57d742..6ba787e107 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/aws/validate_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/aws/validate_test.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/azure.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/azure.go index 352a8bd0f6..f0c305f03c 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/azure.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/azure.go @@ -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 azure load balancer related api wrapper diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/constant.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/constant.go index fc5bd95216..58da9a6d72 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/constant.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/constant.go @@ -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 azure diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/error.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/error.go index 3de0281132..dc11e5b864 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/error.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/error.go @@ -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 azure diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/helper.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/helper.go index 92d468127d..3e5309095a 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/helper.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/helper.go @@ -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 azure @@ -38,9 +37,10 @@ import ( // - probe // - loadBalancingRules (can be seen as listener) // (LoadBalancer listener) --> LoadBalancingRule --> backendAddressPool --> backend1 -// |--> backend2 -// |--> ... -// |--> ... +// +// |--> backend2 +// |--> ... +// |--> ... func (a *Alb) ensureLoadBalancerListener(region string, listeners []*networkextensionv1.Listener) (map[string]cloud. Result, error) { if len(listeners) == 0 { diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/helper_test.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/helper_test.go index 641e09da60..da07f66cfc 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/helper_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/helper_test.go @@ -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 azure diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/resourcehelper.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/resourcehelper.go index d0b98c7417..90d4c7ef01 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/resourcehelper.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/resourcehelper.go @@ -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 azure diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/sdk.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/sdk.go index cd4515362d..47a0b96293 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/sdk.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/sdk.go @@ -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 azure diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/uitl.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/uitl.go index 8530155b0b..329a61c628 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/uitl.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/uitl.go @@ -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 azure diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/util_test.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/util_test.go index 3590e54e79..f42290c106 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/util_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/util_test.go @@ -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 azure diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/validate.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/validate.go index 322c8d0bc6..d727598e61 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/validate.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/azure/validate.go @@ -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 azure diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/gcp/sdkhelper.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/gcp/sdkhelper.go index ddc710cec0..69b76ff37d 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/gcp/sdkhelper.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/gcp/sdkhelper.go @@ -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 gcp diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/gcp/util.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/gcp/util.go index 3470b2228c..579b91dd6d 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/gcp/util.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/gcp/util.go @@ -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 gcp diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/interface.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/interface.go index 51948eb04b..01e44cd515 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/interface.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/interface.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/namespacedlb/namespacedclient.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/namespacedlb/namespacedclient.go index 93b6f4214b..4e7e491be7 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/namespacedlb/namespacedclient.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/namespacedlb/namespacedclient.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/api.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/api.go index 11200ced90..e1a7440b6e 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/api.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/api.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/clb.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/clb.go index 11a02675fe..81efaf020c 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/clb.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/clb.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/constant.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/constant.go index b066ad5a23..5f8065e939 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/constant.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/constant.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/helper.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/helper.go index ad194cc43d..d3ebfcb44d 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/helper.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/helper.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/helperbatch.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/helperbatch.go index d5b3b8f6eb..f08af2d4d9 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/helperbatch.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/helperbatch.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/sdk.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/sdk.go index d5d55768a3..2316f34a3b 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/sdk.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/sdk.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/sdkhelper.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/sdkhelper.go index ea992c18e0..eb1d7e75cf 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/sdkhelper.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/sdkhelper.go @@ -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 tencentcloud diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/util.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/util.go index 4184edfd9f..cadeae54c4 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/util.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/util.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/util_test.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/util_test.go index ef298022c0..ff34f9f80f 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/util_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/util_test.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/validate.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/validate.go index 21e4a614e1..2e86249abd 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/validate.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud/tencentcloud/validate.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloudcollector/cloudcollector.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloudcollector/cloudcollector.go index c0f46cf048..b9d43e2ac2 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloudcollector/cloudcollector.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloudcollector/cloudcollector.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloudcollector/helper.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloudcollector/helper.go index 5c7f6a8cfd..6fd8a91ed1 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloudcollector/helper.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloudcollector/helper.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloudcollector/statuscache.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloudcollector/statuscache.go index 5641402a5d..e7c5d70ea7 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloudcollector/statuscache.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloudcollector/statuscache.go @@ -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 cloudcollector diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloudnode/interface.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloudnode/interface.go index 42b6d8d816..0ac39f5fa2 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloudnode/interface.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloudnode/interface.go @@ -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 cloudnode diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloudnode/native/defaultnodeclient.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloudnode/native/defaultnodeclient.go index acac57f49d..3dc90b99df 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloudnode/native/defaultnodeclient.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloudnode/native/defaultnodeclient.go @@ -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 native diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/common/common.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/common/common.go index 17c1c39c1f..447097b211 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/common/common.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/common/common.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/conflicthandler/conflict.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/conflicthandler/conflict.go index d79e7c33e6..7aa4a933c3 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/conflicthandler/conflict.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/conflicthandler/conflict.go @@ -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 conflicthandler 判断新增ingress/portpool是否和集群内现有ingress/portpool产生端口冲突 diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/conflicthandler/resource.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/conflicthandler/resource.go index 4d19dca95a..559f14b1d8 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/conflicthandler/resource.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/conflicthandler/resource.go @@ -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 conflicthandler diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/conflicthandler/resource_test.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/conflicthandler/resource_test.go index 7b00413f6d..df5c47fe14 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/conflicthandler/resource_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/conflicthandler/resource_test.go @@ -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 conflicthandler diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/conflicthandler/util.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/conflicthandler/util.go index c91abccd68..df166bfe46 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/conflicthandler/util.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/conflicthandler/util.go @@ -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 conflicthandler diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/constant/constant.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/constant/constant.go index 25038bb21a..7dd2ce651b 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/constant/constant.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/constant/constant.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/constant/webhook.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/constant/webhook.go index 592e7b075d..13fbcbeb8a 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/constant/webhook.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/constant/webhook.go @@ -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 constant diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/eventer/eventer.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/eventer/eventer.go index 18ddb42d0d..bd980cc8b7 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/eventer/eventer.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/eventer/eventer.go @@ -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 eventer defines watch the event of pod create failed diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator/ingressconverter.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator/ingressconverter.go index eebc1e4ba4..259ed73bee 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator/ingressconverter.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator/ingressconverter.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator/ingressconverter_test.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator/ingressconverter_test.go index b80cb61bc6..6df87ae765 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator/ingressconverter_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator/ingressconverter_test.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator/mappingconverter.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator/mappingconverter.go index 626d96ae04..d4c125f9ee 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator/mappingconverter.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator/mappingconverter.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator/ruleconverter.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator/ruleconverter.go index eb9ffcf0c2..a32dc5c902 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator/ruleconverter.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator/ruleconverter.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator/util.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator/util.go index 3b69eb64c6..a65388d473 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator/util.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator/util.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator/util_test.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator/util_test.go index 4654f18659..15da199dbf 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator/util_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator/util_test.go @@ -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 generator diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/aga_support.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/aga_support.go index 33c989acf1..2d04c86fc5 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/aga_support.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/aga_support.go @@ -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 httpsvr diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/httpserver.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/httpserver.go index 4603f5f76e..8ad0cf1ac8 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/httpserver.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/httpserver.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/ingress.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/ingress.go index 3bae60e797..e402c5e252 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/ingress.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/ingress.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/listener.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/listener.go index 45d76c1293..3bac3fab9e 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/listener.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/listener.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/node.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/node.go index 148e3a20a6..a7470886c9 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/node.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/node.go @@ -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 httpsvr diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/portpool.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/portpool.go index ef437d09e0..ed18cf77fb 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/portpool.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/portpool.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/response.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/response.go index 4cedc3b5a1..146afba640 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/response.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/httpsvr/response.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/ingresscache/cache.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/ingresscache/cache.go index 3f947cbc2a..680db3d4f6 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/ingresscache/cache.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/ingresscache/cache.go @@ -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 ingresscache 缓存service/workload到ingress的对应信息,提高ingress的调谐效率 diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/ingresscache/interface.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/ingresscache/interface.go index 795439286b..62b59443b2 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/ingresscache/interface.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/ingresscache/interface.go @@ -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 ingresscache diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/ingresscache/util.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/ingresscache/util.go index c9908ba57d..cfb96a7620 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/ingresscache/util.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/ingresscache/util.go @@ -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 ingresscache diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics/check.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics/check.go index 14be6f152d..23fe1d9879 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics/check.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics/check.go @@ -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 metrics diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics/listener_controller.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics/listener_controller.go index ac550c12b0..767fbadbe5 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics/listener_controller.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics/listener_controller.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics/metric.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics/metric.go index 1f052689ca..2850068fb4 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics/metric.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics/metric.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics/nodeinfoexporter.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics/nodeinfoexporter.go index b198683e38..316fb87ad0 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics/nodeinfoexporter.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics/nodeinfoexporter.go @@ -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 metrics diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics/portpool.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics/portpool.go index 55cb1d79c7..a3fefac82a 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics/portpool.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics/portpool.go @@ -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 metrics diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics/webhook.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics/webhook.go index 879553cac2..0cbe5d394e 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics/webhook.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics/webhook.go @@ -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 metrics diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/nodecache/nodecache.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/nodecache/nodecache.go index 73446dfb05..191d614ef5 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/nodecache/nodecache.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/nodecache/nodecache.go @@ -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 nodecache cache node info diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/option/option.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/option/option.go index 84eaba6439..e36a83ab90 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/option/option.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/option/option.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/metric.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/metric.go index b86382f4cc..18ca804ae8 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/metric.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/metric.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/pool.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/pool.go index fc44ceb419..e4020f15fc 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/pool.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/pool.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/poolcache.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/poolcache.go index 0d8e623c06..47c4ca877c 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/poolcache.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/poolcache.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/poolcache_test.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/poolcache_test.go index 01f0af931b..1152359efa 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/poolcache_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/poolcache_test.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/poolitem.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/poolitem.go index 50b7f11475..d219affbdd 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/poolitem.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/poolitem.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/port.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/port.go index bfc58fa27a..88b07ca039 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/port.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/port.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/types.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/types.go index a761df5431..7ce879e8ac 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/types.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache/types.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/utils/patch_util.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/utils/patch_util.go index 950a5be110..7a5485259f 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/utils/patch_util.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/utils/patch_util.go @@ -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 utils diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/annotationparse.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/annotationparse.go index d6547405c6..01658c15a7 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/annotationparse.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/annotationparse.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/annotationparse_test.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/annotationparse_test.go index cf78d6e66c..36f6851f86 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/annotationparse_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/annotationparse_test.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/convert.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/convert.go index 2924f5cd28..eaf4c58a67 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/convert.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/convert.go @@ -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 webhookserver diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/errors.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/errors.go index 8f7ec4c5e6..59f9f7a82e 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/errors.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/errors.go @@ -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 webhookserver diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/mutating.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/mutating.go index 08e3f70cee..67535689ba 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/mutating.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/mutating.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/mutating_ingress.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/mutating_ingress.go index b890ed2d8d..74d3e9ac6d 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/mutating_ingress.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/mutating_ingress.go @@ -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 webhookserver diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/mutating_node.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/mutating_node.go index 94e89a97ee..9a244bae36 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/mutating_node.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/mutating_node.go @@ -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 webhookserver diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/portallocate.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/portallocate.go index 2def693dac..9a996477aa 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/portallocate.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/portallocate.go @@ -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 webhookserver diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/scheme.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/scheme.go index 5f9a4d7af8..b25b5677c4 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/scheme.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/scheme.go @@ -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 webhookserver diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/utils.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/utils.go index 1bfd4b5cca..99d3efa762 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/utils.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/utils.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/validate.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/validate.go index 30211d8224..c3855471d6 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/validate.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/validate.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/validate_delete.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/validate_delete.go index 9c629fddab..b1c742c01b 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/validate_delete.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/validate_delete.go @@ -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 webhookserver diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/validate_test.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/validate_test.go index ad092de87f..4052b64897 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/validate_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/validate_test.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/webhookserver.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/webhookserver.go index 09c5f6f315..83be1a2251 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/webhookserver.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/webhookserver/webhookserver.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/cache.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/cache.go index 91bb3978e8..b391dccb21 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/cache.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/cache.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/cache_test.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/cache_test.go index 4bb5cbcdc4..8c3be299aa 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/cache_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/cache_test.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/event.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/event.go index 495651b609..6f0885c554 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/event.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/event.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/event_test.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/event_test.go index b83d2863b6..0eddd7c8f3 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/event_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/event_test.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/options.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/options.go index 9a3203fafa..6bc704e9a9 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/options.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/options.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/synchronizer.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/synchronizer.go index b85842145a..661712e84e 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/synchronizer.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/synchronizer.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/synchronizer_test.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/synchronizer_test.go index 843b546dbf..b558b0fd32 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/synchronizer_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/synchronizer_test.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/util.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/util.go index 51c7b77889..a42735fed8 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/util.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker/util.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/listenercontroller/listenerHelper.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/listenercontroller/listenerHelper.go index b137954016..91b392c65d 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/listenercontroller/listenerHelper.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/listenercontroller/listenerHelper.go @@ -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 listenercontroller @@ -19,10 +18,9 @@ import ( "sync" "time" - "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" + "sigs.k8s.io/controller-runtime/pkg/client" ) // ListenerHelper do some listener operation in go routine diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/listenercontroller/listener_controller.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/listenercontroller/listener_controller.go index e5a4b5b1a1..83b8ed26b7 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/listenercontroller/listener_controller.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/listenercontroller/listener_controller.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -19,6 +19,8 @@ import ( "reflect" "time" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" + networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/client-go/tools/record" ctrl "sigs.k8s.io/controller-runtime" @@ -26,12 +28,10 @@ import ( "sigs.k8s.io/controller-runtime/pkg/event" "sigs.k8s.io/controller-runtime/pkg/predicate" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/option" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/worker" - networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" ) // getListenerPredicate filter listener events diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/main.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/main.go index ee4775634b..d459b16a4e 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/main.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/main.go @@ -1,15 +1,16 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 ( @@ -20,26 +21,26 @@ import ( "strconv" "time" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" + "github.com/Tencent/bk-bcs/bcs-common/common/http/httpserver" + "github.com/Tencent/bk-bcs/bcs-common/common/http/ipv6server" + clbv1 "github.com/Tencent/bk-bcs/bcs-k8s/kubedeprecated/apis/clb/v1" + networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" gocache "github.com/patrickmn/go-cache" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus/promhttp" - "k8s.io/client-go/kubernetes" - "k8s.io/client-go/rest" - "sigs.k8s.io/controller-runtime/pkg/cache" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/manager" - "k8s.io/apimachinery/pkg/runtime" + "k8s.io/client-go/kubernetes" clientgoscheme "k8s.io/client-go/kubernetes/scheme" _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" + "k8s.io/client-go/rest" ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/cache" + "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/log/zap" + "sigs.k8s.io/controller-runtime/pkg/manager" "sigs.k8s.io/controller-runtime/pkg/metrics" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" - "github.com/Tencent/bk-bcs/bcs-common/common/http/httpserver" - "github.com/Tencent/bk-bcs/bcs-common/common/http/ipv6server" - clbv1 "github.com/Tencent/bk-bcs/bcs-k8s/kubedeprecated/apis/clb/v1" ingressctrl "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/ingresscontroller" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/check" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud" @@ -67,7 +68,6 @@ import ( "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/nodecontroller" portbindingctrl "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller" portpoolctrl "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portpoolcontroller" - networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" ) var ( @@ -80,6 +80,7 @@ func init() { _ = clbv1.AddToScheme(scheme) } +// nolint funlen func main() { opts := &option.ControllerOption{} @@ -238,9 +239,9 @@ func main() { mgr.GetEventRecorderFor("bcs-ingress-controller")) if err != nil { blog.Errorf("create hook server failed, err %s", err.Error()) - os.Exit(1) + os.Exit(1) // nolint } - mgr.Add(webhookServer) + mgr.Add(webhookServer) // nolint // init cloud loadbalance backend status collector collector := cloudcollector.NewCloudCollector(lbClient, mgr.GetClient()) diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/namespacecontroller/namespacecontroller.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/namespacecontroller/namespacecontroller.go index 2a9c24872b..4ac0098c68 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/namespacecontroller/namespacecontroller.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/namespacecontroller/namespacecontroller.go @@ -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 namespacecontroller add configmap to specified namespace @@ -18,6 +17,8 @@ import ( "context" "time" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" + networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" k8scorev1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" k8stypes "k8s.io/apimachinery/pkg/types" @@ -26,9 +27,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/event" "sigs.k8s.io/controller-runtime/pkg/predicate" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller" - networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" ) // NamespaceReconciler reconciler for namespace @@ -67,7 +66,8 @@ func (nr *NamespaceReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) } configMap := &k8scorev1.ConfigMap{} - if err := nr.k8sClient.Get(nr.ctx, k8stypes.NamespacedName{Namespace: ns.Name, Name: networkextensionv1.NodePortBindingConfigMapName}, + if err := nr.k8sClient.Get(nr.ctx, k8stypes.NamespacedName{Namespace: ns.Name, + Name: networkextensionv1.NodePortBindingConfigMapName}, configMap); err != nil { if k8serrors.IsNotFound(err) { blog.Infof("not found configMap '%s/%s'", req.Namespace, networkextensionv1.NodePortBindingConfigMapName) diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/namespacecontroller/utils.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/namespacecontroller/utils.go index 318d19897d..1e4b4680cd 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/namespacecontroller/utils.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/namespacecontroller/utils.go @@ -8,15 +8,13 @@ * 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 namespacecontroller import ( - k8scorev1 "k8s.io/api/core/v1" - networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" + k8scorev1 "k8s.io/api/core/v1" ) func checkNodeBindLabel(ns *k8scorev1.Namespace) bool { diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/nodecontroller/nodecontroller.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/nodecontroller/nodecontroller.go index ffc93cab5e..17095cc53e 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/nodecontroller/nodecontroller.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/nodecontroller/nodecontroller.go @@ -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 nodecontroller node controller @@ -19,6 +18,7 @@ import ( "reflect" "time" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" corev1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/client-go/tools/record" @@ -27,7 +27,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/event" "sigs.k8s.io/controller-runtime/pkg/predicate" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloudnode" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/nodecache" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/option" @@ -100,10 +99,7 @@ func (r *NodeReconciler) SetupWithManager(mgr ctrl.Manager) error { func (r *NodeReconciler) getNodePredicate() predicate.Predicate { return predicate.Funcs{ CreateFunc: func(createEvent event.CreateEvent) bool { - if !r.opts.NodeInfoExporterOpen { - return false - } - return true + return r.opts.NodeInfoExporterOpen }, UpdateFunc: func(event event.UpdateEvent) bool { if !r.opts.NodeInfoExporterOpen { @@ -123,16 +119,10 @@ func (r *NodeReconciler) getNodePredicate() predicate.Predicate { return false }, DeleteFunc: func(deleteEvent event.DeleteEvent) bool { - if !r.opts.NodeInfoExporterOpen { - return false - } - return true + return r.opts.NodeInfoExporterOpen }, GenericFunc: func(genericEvent event.GenericEvent) bool { - if !r.opts.NodeInfoExporterOpen { - return false - } - return true + return r.opts.NodeInfoExporterOpen }, } } diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/event.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/event.go index f7b504dca5..9520679aac 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/event.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/event.go @@ -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 portbindingcontroller diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/nodefilter.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/nodefilter.go index 56584410c6..3a69ff8107 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/nodefilter.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/nodefilter.go @@ -8,12 +8,12 @@ * 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 portbindingcontroller import ( + "github.com/Tencent/bk-bcs/bcs-common/common/blog" k8scorev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/util/workqueue" @@ -21,7 +21,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/event" "sigs.k8s.io/controller-runtime/pkg/reconcile" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics" ) diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/nodeportbindinghandler.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/nodeportbindinghandler.go index 36c3008ce6..7b7212214c 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/nodeportbindinghandler.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/nodeportbindinghandler.go @@ -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 portbindingcontroller @@ -19,6 +18,8 @@ import ( "fmt" "sync" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" + networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" "github.com/pkg/errors" k8scorev1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" @@ -28,10 +29,8 @@ import ( "k8s.io/client-go/tools/record" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/constant" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/utils" - networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" ) // NodePortBindingCache cache node portbinding info @@ -175,6 +174,7 @@ func (n *nodePortBindingHandler) postPortBindingClean(portBinding *networkextens return nil } +// nolint unused func (n *nodePortBindingHandler) patchNodeAnnotation(node *k8scorev1.Node, status string) error { rawPatch := client.RawPatch(k8stypes.MergePatchType, []byte( "{\"metadata\":{\"annotations\":{\""+constant.AnnotationForPortPoolBindingStatus+ @@ -225,6 +225,7 @@ func (n *nodePortBindingHandler) updateConfigMap(configMapNamespace string) erro configMap := &k8scorev1.ConfigMap{} err := n.k8sClient.Get(n.ctx, k8stypes.NamespacedName{Namespace: configMapNamespace, Name: networkextensionv1.NodePortBindingConfigMapName}, configMap) + // nolint if err != nil { if k8serrors.IsNotFound(err) { if cerr := n.createConfigMap(configMapNamespace); cerr != nil { @@ -240,7 +241,7 @@ func (n *nodePortBindingHandler) updateConfigMap(configMapNamespace string) erro configMap.Data = n.bindCache.GetCache() if err := n.k8sClient.Update(n.ctx, configMap); err != nil { - err = errors.Wrapf(err, "update node portbinding['%s/%s'] config map failed") + err = errors.Wrapf(err, "update node portbinding[''] config map failed") blog.Errorf("%v", err) return err } @@ -256,7 +257,7 @@ func (n *nodePortBindingHandler) createConfigMap(configMapNamespace string) erro configMap.Data = n.bindCache.GetCache() if err := n.k8sClient.Create(n.ctx, configMap); err != nil { - err = errors.Wrapf(err, "update node portbinding['%s/%s'] config map failed") + err = errors.Wrapf(err, "update node portbinding[''] config map failed") blog.Errorf("%v", err) return err } diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/podfilter.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/podfilter.go index 28235ed7ef..6b799d2462 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/podfilter.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/podfilter.go @@ -4,19 +4,19 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. */ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -27,6 +27,8 @@ package portbindingcontroller import ( "context" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" + networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" k8scorev1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/types" @@ -35,10 +37,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/event" "sigs.k8s.io/controller-runtime/pkg/reconcile" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics" - - networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" ) // PodFilter filter for pod event diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/podportbindinghandler.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/podportbindinghandler.go index 26ac2a5ce9..48efd3b5f2 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/podportbindinghandler.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/podportbindinghandler.go @@ -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 portbindingcontroller @@ -17,6 +16,8 @@ import ( "context" "reflect" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" + networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" "github.com/pkg/errors" k8scorev1 "k8s.io/api/core/v1" k8smetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -24,10 +25,8 @@ import ( "k8s.io/client-go/tools/record" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/constant" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator" - networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" ) // PodPortBindingHandler handle portbinding related to pods diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/portbinding.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/portbinding.go index 86b88f7ad7..07fb196407 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/portbinding.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/portbinding.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -19,19 +19,17 @@ import ( "time" "github.com/Tencent/bk-bcs/bcs-common/common/blog" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics" - - "github.com/pkg/errors" - - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/constant" - bcsnetcommon "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/pkg/common" networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" - + "github.com/pkg/errors" k8scorev1 "k8s.io/api/core/v1" k8smetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" k8stypes "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/tools/record" "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/constant" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics" + bcsnetcommon "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/pkg/common" ) type iPortBindingHandler interface { @@ -52,7 +50,8 @@ type portBindingHandler struct { postPortBindingClean func(portBinding *networkextensionv1.PortBinding) error } -func newPortBindingHandler(ctx context.Context, k8sClient client.Client, eventer record.EventRecorder) *portBindingHandler { +func newPortBindingHandler( + ctx context.Context, k8sClient client.Client, eventer record.EventRecorder) *portBindingHandler { return &portBindingHandler{ ctx: ctx, k8sClient: k8sClient, diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/portbindingcheck.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/portbindingcheck.go index 7cd62f57ed..186a7a5a7e 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/portbindingcheck.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/portbindingcheck.go @@ -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 portbindingcontroller @@ -17,14 +16,14 @@ import ( "context" "time" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" + networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/constant" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics" - networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" ) // checkPortBindingCreate check if related portbinding create successfully diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/portbindingcontroller.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/portbindingcontroller.go index 30a24752b6..c881c90231 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/portbindingcontroller.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/portbindingcontroller.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -20,6 +20,8 @@ import ( "reflect" "time" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" + networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" k8scorev1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" k8stypes "k8s.io/apimachinery/pkg/types" @@ -30,14 +32,12 @@ import ( "sigs.k8s.io/controller-runtime/pkg/predicate" "sigs.k8s.io/controller-runtime/pkg/source" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" ingresscommon "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/common" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/constant" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/utils" bcsnetcommon "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/pkg/common" - networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" ) // PortBindingReconciler reconciler for bcs port pool @@ -69,11 +69,13 @@ func NewPortBindingReconciler(ctx context.Context, cleanInterval time.Duration, // Reconcile reconcile port pool // portbinding name is same with pod name +// nolint funlen func (pbr *PortBindingReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { blog.V(3).Infof("PortBinding %+v triggered", req.NamespacedName) portBinding := &networkextensionv1.PortBinding{} isPortBindingFound := true if err := pbr.k8sClient.Get(pbr.ctx, req.NamespacedName, portBinding); err != nil { + // nolint if k8serrors.IsNotFound(err) { isPortBindingFound = false } else { @@ -90,6 +92,7 @@ func (pbr *PortBindingReconciler) Reconcile(req ctrl.Request) (ctrl.Result, erro isNodeFound := true pod := &k8scorev1.Pod{} if err := pbr.k8sClient.Get(pbr.ctx, req.NamespacedName, pod); err != nil { + // nolint if k8serrors.IsNotFound(err) { isPodFound = false } else { @@ -102,6 +105,7 @@ func (pbr *PortBindingReconciler) Reconcile(req ctrl.Request) (ctrl.Result, erro } node := &k8scorev1.Node{} if err := pbr.k8sClient.Get(pbr.ctx, k8stypes.NamespacedName{Name: req.Name}, node); err != nil { + // nolint if k8serrors.IsNotFound(err) { isNodeFound = false } else { @@ -179,11 +183,9 @@ func (pbr *PortBindingReconciler) Reconcile(req ctrl.Request) (ctrl.Result, erro AnnotationForPortBindingNotReadyTimestamp]; timeOk && notReadyTimeStr != "" { if notReadyTime, inErr := time.Parse(time.RFC3339Nano, notReadyTimeStr); inErr != nil { blog.Warnf("parse not ready timestamp on node %s failed, err: %s", node.GetName(), inErr.Error()) - } else { + } else if time.Since(notReadyTime) < time.Second*10 { // 距离上次刷新时间未超过10秒 - if time.Now().Sub(notReadyTime) < time.Second*10 { - needPatch = false - } + needPatch = false } } if needPatch { diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/portbindingitem.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/portbindingitem.go index ad55401149..fbac6c3a14 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/portbindingitem.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/portbindingitem.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -17,13 +17,13 @@ import ( "reflect" "github.com/Tencent/bk-bcs/bcs-common/common/blog" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/common" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/constant" networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" - k8serrors "k8s.io/apimachinery/pkg/api/errors" k8sapitypes "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/common" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/constant" ) type portBindingItemHandler struct { diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/util.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/util.go index 45d27594d6..6bfa152c2b 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/util.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portbindingcontroller/util.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -18,12 +18,12 @@ import ( "reflect" "time" + networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" "github.com/pkg/errors" k8scorev1 "k8s.io/api/core/v1" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/constant" netpkgcommon "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/pkg/common" - networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" ) // if port binding is expired diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portpoolcontroller/portpool.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portpoolcontroller/portpool.go index ccc56dc10b..f86c34bfb9 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portpoolcontroller/portpool.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portpoolcontroller/portpool.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -17,17 +17,16 @@ import ( "fmt" "reflect" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" + networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" "github.com/pkg/errors" + "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud" ingresscommon "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/common" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/constant" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/pkg/common" - networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" - - "sigs.k8s.io/controller-runtime/pkg/client" ) // PortPoolHandler handler for port pool @@ -53,6 +52,7 @@ func newPortPoolHandler(ns, region string, // ensure port pool // the returned bool value indicates whether you need to retry +// nolint funlen func (pph *PortPoolHandler) ensurePortPool(pool *networkextensionv1.PortPool) (bool, error) { defItemMap := make(map[string]*networkextensionv1.PortPoolItem) for _, poolItem := range pool.Spec.PoolItems { @@ -127,9 +127,7 @@ func (pph *PortPoolHandler) ensurePortPool(pool *networkextensionv1.PortPool) (b pool.Status.PoolItemStatuses[i] = updateItemStatusMap[ts.GetKey()] } } - for _, ts := range newItemStatusList { - pool.Status.PoolItemStatuses = append(pool.Status.PoolItemStatuses, ts) - } + pool.Status.PoolItemStatuses = append(pool.Status.PoolItemStatuses, newItemStatusList...) pool.Status.Status = checkPortPoolStatus(pool) @@ -145,7 +143,8 @@ func (pph *PortPoolHandler) ensurePortPool(pool *networkextensionv1.PortPool) (b // update related cache poolKey := ingresscommon.GetNamespacedNameKey(pool.GetName(), pool.GetNamespace()) - pph.ensureCache(poolKey, tmpItemsStatus, successDeletedKeyMap, failedDeletedKeyMap, newItemStatusList, updateItemStatusMap) + pph.ensureCache(poolKey, tmpItemsStatus, successDeletedKeyMap, failedDeletedKeyMap, newItemStatusList, + updateItemStatusMap) if len(failedDeletedKeyMap) != 0 || shouldRetry { return true, nil @@ -211,7 +210,7 @@ func (pph *PortPoolHandler) deletePortPool(pool *networkextensionv1.PortPool) (b itemKey := itemStatus.GetKey() if _, ok := successDeletedKeyMap[itemKey]; !ok { if _, inOk := failedDeletedKeyMap[itemKey]; inOk { - pph.poolCache.SetPortPoolItemStatus(poolKey, itemStatus) + pph.poolCache.SetPortPoolItemStatus(poolKey, itemStatus) // nolint } } else { pph.poolCache.DeletePortPoolItem(poolKey, itemKey) @@ -284,7 +283,7 @@ func (pph *PortPoolHandler) ensureCache(poolKey string, tmpItemsStatus []*networ itemKey := itemStatus.GetKey() if _, ok := successDeletedKeyMap[itemKey]; !ok { if _, inOk := failedDeletedKeyMap[itemKey]; inOk { - pph.poolCache.SetPortPoolItemStatus(poolKey, itemStatus) + pph.poolCache.SetPortPoolItemStatus(poolKey, itemStatus) // nolint blog.Infof("set port pool %s item %s status to %s", poolKey, itemStatus.ItemName, constant.PortPoolItemStatusDeleting) } @@ -303,7 +302,7 @@ func (pph *PortPoolHandler) ensureCache(poolKey string, tmpItemsStatus []*networ } // update item status for _, itemStatus := range updateItemStatusMap { - pph.poolCache.SetPortPoolItemStatus(poolKey, itemStatus) + pph.poolCache.SetPortPoolItemStatus(poolKey, itemStatus) // nolint blog.Infof("set port pool %s item %s status to %s", poolKey, itemStatus.ItemName, itemStatus.Status) } } diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portpoolcontroller/portpoolcontroller.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portpoolcontroller/portpoolcontroller.go index 1d0961b188..2c29386a2f 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portpoolcontroller/portpoolcontroller.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portpoolcontroller/portpoolcontroller.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -20,15 +20,7 @@ import ( "time" "github.com/Tencent/bk-bcs/bcs-common/common/blog" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud" - ingresscommon "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/common" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/constant" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/option" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache" - pkgcommon "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/pkg/common" networkextensionv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" - k8scorev1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/client-go/tools/record" @@ -36,6 +28,14 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/event" "sigs.k8s.io/controller-runtime/pkg/predicate" + + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud" + ingresscommon "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/common" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/constant" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/metrics" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/option" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/portpoolcache" + pkgcommon "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/pkg/common" ) // PortPoolReconciler reconciler for bcs port pool diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portpoolcontroller/portpoolitem.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portpoolcontroller/portpoolitem.go index a86dfc3725..fd10cd1e32 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portpoolcontroller/portpoolitem.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portpoolcontroller/portpoolitem.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -18,19 +18,17 @@ import ( "sort" "strings" - "k8s.io/client-go/util/retry" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" + netextv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" + k8smetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + k8slabels "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/util/retry" + "sigs.k8s.io/controller-runtime/pkg/client" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/cloud" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/common" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/constant" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/generator" - netextv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" - - k8smetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - k8slabels "k8s.io/apimachinery/pkg/labels" - "sigs.k8s.io/controller-runtime/pkg/client" ) // PortPoolItemHandler port pool item @@ -93,7 +91,8 @@ func (ppih *PortPoolItemHandler) ensurePortPoolItem( segmentLen = 1 } if err := ppih.ensureListeners( - lbObj.Region, lbObj.LoadbalancerID, item.ItemName, item.StartPort, item.EndPort, segmentLen, item.Protocol); err != nil { + lbObj.Region, lbObj.LoadbalancerID, item.ItemName, item.StartPort, item.EndPort, segmentLen, + item.Protocol); err != nil { blog.Warnf("listeners of loadbalance %s not all ready, err %s", lbObj.LoadbalancerID, err.Error()) errMsgs = append(errMsgs, fmt.Sprintf("lb %s: %s", lbObj.LoadbalancerID, err.Error())) } @@ -177,7 +176,8 @@ func (ppih *PortPoolItemHandler) getCloudListenersByRegionIDs(regionIDs []string tmpID = lbID } if ppih.LbClient.IsNamespaced() { - lbObj, err = ppih.LbClient.DescribeLoadBalancerWithNs(ppih.Namespace, tmpRegion, tmpID, "", constant.ProtocolLayerTransport) + lbObj, err = ppih.LbClient.DescribeLoadBalancerWithNs(ppih.Namespace, tmpRegion, tmpID, "", + constant.ProtocolLayerTransport) } else { lbObj, err = ppih.LbClient.DescribeLoadBalancer(tmpRegion, tmpID, "", constant.ProtocolLayerTransport) } @@ -209,7 +209,8 @@ func (ppih *PortPoolItemHandler) getLBListenerList(lbID string) (*netextv1.Liste } // get portpool item's listener -func (ppih *PortPoolItemHandler) getListenerListWithItemName(lbID, portpoolName, itemName string) (*netextv1.ListenerList, error) { +func (ppih *PortPoolItemHandler) getListenerListWithItemName( + lbID, portpoolName, itemName string) (*netextv1.ListenerList, error) { set := k8slabels.Set(map[string]string{ netextv1.LabelKeyForPortPoolListener: netextv1.LabelValueTrue, netextv1.LabelKeyForLoadbalanceID: generator.GetLabelLBId(lbID), @@ -258,7 +259,7 @@ func (ppih *PortPoolItemHandler) ensureListeners(region, lbID, itemName string, if segment > 1 { tmpEndPort = int(p + segment - 1) } - tmpName := common.GetListenerNameWithProtocol(lbID, protocol, int(tmpStartPort), int(tmpEndPort)) + tmpName := common.GetListenerNameWithProtocol(lbID, protocol, int(tmpStartPort), tmpEndPort) listener, ok := listenerMap[tmpName] if !ok { notReady = true diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portpoolcontroller/util.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portpoolcontroller/util.go index 5827798d3d..651382c29d 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portpoolcontroller/util.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/portpoolcontroller/util.go @@ -8,15 +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 portpoolcontroller import ( + netextv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/common" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-ingress-controller/internal/constant" - netextv1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1" ) // return true if listener's labels are correct diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipmasq-cidrsync/internal/options/options.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipmasq-cidrsync/internal/options/options.go index 6e620068f4..8ea9f500e6 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipmasq-cidrsync/internal/options/options.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipmasq-cidrsync/internal/options/options.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipmasq-cidrsync/internal/sync/sync.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipmasq-cidrsync/internal/sync/sync.go index 21dec581c6..bf9953c4c5 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipmasq-cidrsync/internal/sync/sync.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipmasq-cidrsync/internal/sync/sync.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipmasq-cidrsync/internal/sync/sync_test.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipmasq-cidrsync/internal/sync/sync_test.go index a269a6af17..e3fefd4440 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipmasq-cidrsync/internal/sync/sync_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipmasq-cidrsync/internal/sync/sync_test.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipmasq-cidrsync/internal/sync/types.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipmasq-cidrsync/internal/sync/types.go index 67504efb4f..a708f76863 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipmasq-cidrsync/internal/sync/types.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipmasq-cidrsync/internal/sync/types.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipmasq-cidrsync/main.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipmasq-cidrsync/main.go index acdb3ab5d0..a69608ecdd 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipmasq-cidrsync/main.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipmasq-cidrsync/main.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/internal/handler/handler.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/internal/handler/handler.go index 5c0a7fbff0..022098621e 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/internal/handler/handler.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/internal/handler/handler.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/internal/handler/type.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/internal/handler/type.go index e4b02e6f59..7750a77dcb 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/internal/handler/type.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/internal/handler/type.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/internal/handler/util.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/internal/handler/util.go index 3065fb0d94..d3e9e2ae4e 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/internal/handler/util.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/internal/handler/util.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/internal/option/option.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/internal/option/option.go index 56fc72ef47..729833b4a8 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/internal/option/option.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/internal/option/option.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/main.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/main.go index 6a33aebd52..ab228289de 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/main.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/main.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/nslabelinjector/main.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/nslabelinjector/main.go index b29e5f6abb..ea085797e2 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/nslabelinjector/main.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/nslabelinjector/main.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/pkg/webhookserver/handler.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/pkg/webhookserver/handler.go index 6b2598d16f..70b0b80bbf 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/pkg/webhookserver/handler.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/pkg/webhookserver/handler.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/pkg/webhookserver/metric.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/pkg/webhookserver/metric.go index 7a2885cb14..3075ce27a9 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/pkg/webhookserver/metric.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/pkg/webhookserver/metric.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/pkg/webhookserver/server.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/pkg/webhookserver/server.go index c77c436b6d..9e855d7c3c 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/pkg/webhookserver/server.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-ipres-webhook/pkg/webhookserver/server.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/controller.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/controller.go index f92870e0a5..8d2ae493bf 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/controller.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/controller.go @@ -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 controller @@ -103,7 +102,7 @@ type ProtocolAndPort struct { Port string } -//EndPoints endpoints +// EndPoints endpoints type EndPoints struct { IPs []string ProtocolAndPort diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/podpolicy/controller.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/podpolicy/controller.go index fa3dc02b6c..d9b73b5cc0 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/podpolicy/controller.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/podpolicy/controller.go @@ -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 podpolicy diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/podpolicy/ipt/container.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/podpolicy/ipt/container.go index 75ff7fc90e..539af275dd 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/podpolicy/ipt/container.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/podpolicy/ipt/container.go @@ -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 ipt diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/podpolicy/ipt/handler.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/podpolicy/ipt/handler.go index 904ed2e173..10eebf7be6 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/podpolicy/ipt/handler.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/podpolicy/ipt/handler.go @@ -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 ipt @@ -66,6 +65,7 @@ func NewCleanupHandler(dockerClient *docker.Client, ipSetHandler *iptables.IPSet // - Skip pause container // - Skip hostNetwork container // - Only one container of a pod will be refreshed iptables +// // For-loop every container with every networkPolicy, if networkPolicy // hit the container, refresh iptables with policy for it. func (h *iptablesHandler) Refresh() error { diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/podpolicy/ipt/types.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/podpolicy/ipt/types.go index 756bf35489..b21a0a80bf 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/podpolicy/ipt/types.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/podpolicy/ipt/types.go @@ -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 ipt used to sync network policy for every container diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/podpolicy/np/handler.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/podpolicy/np/handler.go index 318e84ae0a..c742db3f65 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/podpolicy/np/handler.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/podpolicy/np/handler.go @@ -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 np used to re-build networkPolicyInfos diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/podpolicy/types.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/podpolicy/types.go index b271b5fbc2..5fc01589f1 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/podpolicy/types.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/controller/podpolicy/types.go @@ -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 podpolicy diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/datainformer/interface.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/datainformer/interface.go index ba1d787602..4fe2beeb46 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/datainformer/interface.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/datainformer/interface.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/datainformer/kubernetes/kubernetes.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/datainformer/kubernetes/kubernetes.go index 5c885cf960..b490a957a3 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/datainformer/kubernetes/kubernetes.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/datainformer/kubernetes/kubernetes.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/datainformer/mesos/mesos.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/datainformer/mesos/mesos.go index 9ba4d7069b..6485ae58e9 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/datainformer/mesos/mesos.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/datainformer/mesos/mesos.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -35,7 +35,7 @@ import ( "k8s.io/client-go/tools/cache" ) -//containerInfo hold info from BcsContainer +// containerInfo hold info from BcsContainer type containerInfo struct { ID string `json:"ID"` Pid int `json:"Pid"` diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/iptables/interface.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/iptables/interface.go index 16b1e89bf3..e92ae005cd 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/iptables/interface.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/iptables/interface.go @@ -8,12 +8,11 @@ * 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 iptables -//Interface define iptables operation +// Interface define iptables operation type Interface interface { Exists(table, chain string, rulespec ...string) (bool, error) Insert(table, chain string, pos int, rulespec ...string) error diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/iptables/iptables.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/iptables/iptables.go index 6f56188a28..213487cd13 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/iptables/iptables.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/iptables/iptables.go @@ -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 iptables diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/iptables/nsiptables.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/iptables/nsiptables.go index 4a9b63eb05..615f681619 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/iptables/nsiptables.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/iptables/nsiptables.go @@ -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 iptables diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/main.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/main.go index 382ad0b261..cbfc7b94ae 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/main.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/main.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/metrics/metrics.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/metrics/metrics.go index a6a924d1d4..dfa42404e9 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/metrics/metrics.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/metrics/metrics.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/options/options.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/options/options.go index 4eed8bebb3..8ca13e6092 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/options/options.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/options/options.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/server/server.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/server/server.go index 44ca99e7b5..6863c1f62e 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/server/server.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-networkpolicy/server/server.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-node-external-worker/exporter/node_exporter.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-node-external-worker/exporter/node_exporter.go index ca5218d0dd..18150a5705 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-node-external-worker/exporter/node_exporter.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-node-external-worker/exporter/node_exporter.go @@ -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 exporter xxx package exporter import ( @@ -23,6 +23,7 @@ import ( "strconv" "time" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/google/uuid" k8scorev1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" @@ -30,7 +31,6 @@ import ( "k8s.io/client-go/util/retry" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-node-external-worker/httpsvr" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-node-external-worker/options" ) @@ -50,6 +50,7 @@ func (n *NodeExporter) Watch() { ticker := time.NewTicker(time.Second * 5) defer ticker.Stop() + // nolint for { select { case <-ticker.C: diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-node-external-worker/httpsvr/httpsvr.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-node-external-worker/httpsvr/httpsvr.go index fde5fa41f0..35a75e0e2c 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-node-external-worker/httpsvr/httpsvr.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-node-external-worker/httpsvr/httpsvr.go @@ -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 httpsvr xxx @@ -17,9 +16,9 @@ package httpsvr import ( "fmt" + "github.com/Tencent/bk-bcs/bcs-common/common/http/httpserver" "github.com/emicklei/go-restful" - "github.com/Tencent/bk-bcs/bcs-common/common/http/httpserver" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-node-external-worker/options" ) diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-node-external-worker/httpsvr/response.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-node-external-worker/httpsvr/response.go index ca4434327a..ef90dc2d33 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-node-external-worker/httpsvr/response.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-node-external-worker/httpsvr/response.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -20,7 +20,7 @@ import ( "github.com/Tencent/bk-bcs/bcs-common/common/blog" ) -var unknownError = errors.New("unknown") +var unknownError = errors.New("unknown") // nolint // APIRespone response for api request type APIRespone struct { diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-node-external-worker/main.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-node-external-worker/main.go index 009c2d573c..6db416df11 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-node-external-worker/main.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-node-external-worker/main.go @@ -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 ( @@ -19,12 +19,12 @@ import ( "os" "time" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" "k8s.io/apimachinery/pkg/runtime" clientgoscheme "k8s.io/client-go/kubernetes/scheme" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/log/zap" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-node-external-worker/exporter" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-node-external-worker/httpsvr" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/bcs-node-external-worker/options" @@ -54,7 +54,7 @@ func main() { }) if err != nil { blog.Fatalf("start ctrl manager failed, err: %s", err.Error()) - os.Exit(1) + os.Exit(1) // nolint } blog.Infof("node-external-worker start...") @@ -62,7 +62,7 @@ func main() { httpServer := &httpsvr.HttpServerClient{Ops: opts} if err = httpServer.Init(); err != nil { blog.Fatalf("init http sever failed, err: %s", err.Error()) - os.Exit(1) + os.Exit(1) // nolint } nodeExporter := exporter.NodeExporter{ @@ -76,6 +76,6 @@ func main() { if err = mgr.Start(ctrl.SetupSignalHandler()); err != nil { blog.Errorf("problem running manager, err %s", err.Error()) - os.Exit(1) + os.Exit(1) // nolint } } diff --git a/bcs-runtime/bcs-k8s/bcs-network/bcs-node-external-worker/options/options.go b/bcs-runtime/bcs-k8s/bcs-network/bcs-node-external-worker/options/options.go index 89e4abd7ff..a72d32aee7 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/bcs-node-external-worker/options/options.go +++ b/bcs-runtime/bcs-k8s/bcs-network/bcs-node-external-worker/options/options.go @@ -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 options xxx @@ -23,7 +22,9 @@ import ( ) const ( - EnvNameNodeName = "NODE_NAME" + // EnvNameNodeName xxx + EnvNameNodeName = "NODE_NAME" + // EnvNamePodNamespace xxx EnvNamePodNamespace = "POD_NAMESPACE" ) diff --git a/bcs-runtime/bcs-k8s/bcs-network/internal/actionexecutor/action.go b/bcs-runtime/bcs-k8s/bcs-network/internal/actionexecutor/action.go index 002556e446..c783ff5cd6 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/internal/actionexecutor/action.go +++ b/bcs-runtime/bcs-k8s/bcs-network/internal/actionexecutor/action.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/internal/apimetric/apimetric.go b/bcs-runtime/bcs-k8s/bcs-network/internal/apimetric/apimetric.go index 5a43983d7d..2fc5dd7432 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/internal/apimetric/apimetric.go +++ b/bcs-runtime/bcs-k8s/bcs-network/internal/apimetric/apimetric.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/internal/constant/constant.go b/bcs-runtime/bcs-k8s/bcs-network/internal/constant/constant.go index 4de07bc3d9..91e93a9d1a 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/internal/constant/constant.go +++ b/bcs-runtime/bcs-k8s/bcs-network/internal/constant/constant.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/internal/constant/event.go b/bcs-runtime/bcs-k8s/bcs-network/internal/constant/event.go index 7d13099fb4..332746f6ac 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/internal/constant/event.go +++ b/bcs-runtime/bcs-k8s/bcs-network/internal/constant/event.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/pkg/common/common.go b/bcs-runtime/bcs-k8s/bcs-network/pkg/common/common.go index ac452282e9..7f6821dde5 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/pkg/common/common.go +++ b/bcs-runtime/bcs-k8s/bcs-network/pkg/common/common.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/pkg/common/common_test.go b/bcs-runtime/bcs-k8s/bcs-network/pkg/common/common_test.go index ad1ef73722..1797709b5b 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/pkg/common/common_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/pkg/common/common_test.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/pkg/grpclb/grpclb.go b/bcs-runtime/bcs-k8s/bcs-network/pkg/grpclb/grpclb.go index 2318c4e4f1..d5d5dcd6fb 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/pkg/grpclb/grpclb.go +++ b/bcs-runtime/bcs-k8s/bcs-network/pkg/grpclb/grpclb.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -14,6 +14,7 @@ package grpclb import ( "fmt" + "google.golang.org/grpc/naming" ) diff --git a/bcs-runtime/bcs-k8s/bcs-network/pkg/leaderelection/election.go b/bcs-runtime/bcs-k8s/bcs-network/pkg/leaderelection/election.go index 1f070b62aa..3b807a1e6d 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/pkg/leaderelection/election.go +++ b/bcs-runtime/bcs-k8s/bcs-network/pkg/leaderelection/election.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/etcd/etcd.go b/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/etcd/etcd.go index 00c8467917..2ad72fa5f8 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/etcd/etcd.go +++ b/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/etcd/etcd.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/kubernetes/configmap.go b/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/kubernetes/configmap.go index c396922f09..15499610db 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/kubernetes/configmap.go +++ b/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/kubernetes/configmap.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -17,7 +17,7 @@ import ( "encoding/json" "fmt" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" corev1client "k8s.io/client-go/kubernetes/typed/core/v1" diff --git a/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/kubernetes/lock.go b/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/kubernetes/lock.go index 75c86b5890..9f054c270c 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/kubernetes/lock.go +++ b/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/kubernetes/lock.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/kubernetes/lock_test.go b/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/kubernetes/lock_test.go index a9e2160527..f3b4e34e0d 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/kubernetes/lock_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/kubernetes/lock_test.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/kubernetes/lockrecord.go b/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/kubernetes/lockrecord.go index af2ed623b9..d3ca1d7193 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/kubernetes/lockrecord.go +++ b/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/kubernetes/lockrecord.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/kubernetes/store.go b/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/kubernetes/store.go index 17077b62ac..0134417a3c 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/kubernetes/store.go +++ b/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/kubernetes/store.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/lock.go b/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/lock.go index 36c9639ef6..488a1660d6 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/lock.go +++ b/bcs-runtime/bcs-k8s/bcs-network/pkg/lock/lock.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/conf/conf.go b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/conf/conf.go index 4f03b140fd..381dae1d70 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/conf/conf.go +++ b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/conf/conf.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/eip.go b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/eip.go index 51f2b2f640..28ae8c4cb7 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/eip.go +++ b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/eip.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/instance.go b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/instance.go index 143cff99e0..7b78ea2916 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/instance.go +++ b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/instance.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/interface.go b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/interface.go index 61a635ef41..a00efb7a3d 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/interface.go +++ b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/interface.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/netservice.go b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/netservice.go index 1db1e7a5a3..5a60593c6c 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/netservice.go +++ b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/netservice.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -14,12 +14,13 @@ package eip import ( "fmt" + "strings" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-common/common/static" "github.com/Tencent/bk-bcs/bcs-common/pkg/bcsapi" netsvc "github.com/Tencent/bk-bcs/bcs-common/pkg/bcsapi/netservice" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/conf" - "strings" ) // NetSvcClient client to operate netservice diff --git a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/network.go b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/network.go index 58d709c47e..0753fb6bc7 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/network.go +++ b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/network.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/network_test.go b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/network_test.go index bd1ebcde14..c80b282c26 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/network_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/network_test.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/routemap.go b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/routemap.go index e1170f44c0..49c2ffad55 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/routemap.go +++ b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/routemap.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -15,10 +15,11 @@ package eip import ( "encoding/json" "fmt" - "github.com/Tencent/bk-bcs/bcs-common/common/blog" "io/ioutil" "os" "sync" + + "github.com/Tencent/bk-bcs/bcs-common/common/blog" ) // RouteMap store (route_table_id, ips[]) mapping diff --git a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/routemap_test.go b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/routemap_test.go index d2e88540e7..d05ddc2697 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/routemap_test.go +++ b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/routemap_test.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/util.go b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/util.go index 61ad405ddb..1b6f697c06 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/util.go +++ b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/util.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -14,11 +14,12 @@ package eip import ( "fmt" - "golang.org/x/sys/unix" "net" "strconv" "strings" + "golang.org/x/sys/unix" + "github.com/vishvananda/netlink" "github.com/Tencent/bk-bcs/bcs-common/common/blog" @@ -55,7 +56,7 @@ func getBridgeRoutes(tableID int, bridgeName string) ([]netlink.Route, error) { return routes, nil } -//GetIPAddrByName return eni ip address, mask, mac address +// GetIPAddrByName return eni ip address, mask, mac address func getIPAddrByName(name string) (string, int, string) { //get ip address netFace, err := net.InterfaceByName(name) diff --git a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/vpc.go b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/vpc.go index 768cbeca9d..b36619a36d 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/vpc.go +++ b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/eip/vpc.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -14,9 +14,10 @@ package eip import ( "fmt" + "time" + "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/conf" - "time" "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common" "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile" diff --git a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/main.go b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/main.go index 0b2051b060..d4508d5efb 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/main.go +++ b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/main.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -14,11 +14,12 @@ package main import ( "fmt" + "runtime" + "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-network/qcloud-eip/eip" "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/option" - "runtime" "github.com/containernetworking/cni/pkg/skel" "github.com/containernetworking/cni/pkg/version" diff --git a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/option/option.go b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/option/option.go index e10e29a3e0..4dcc3bb85a 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/option/option.go +++ b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/option/option.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/utils/command.go b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/utils/command.go index 0991d118bc..38c301d768 100644 --- a/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/utils/command.go +++ b/bcs-runtime/bcs-k8s/bcs-network/qcloud-eip/utils/command.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/kubernetes/apis/cloud/v1/groupversion_info.go b/bcs-runtime/bcs-k8s/kubernetes/apis/cloud/v1/groupversion_info.go index d6cdfecd5f..c259ed7777 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/apis/cloud/v1/groupversion_info.go +++ b/bcs-runtime/bcs-k8s/kubernetes/apis/cloud/v1/groupversion_info.go @@ -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 v1 contains API Schema definitions for the cloud v1 API group @@ -33,6 +32,7 @@ var ( ) var ( + // SchemeGroupVersion xxx SchemeGroupVersion = GroupVersion ) diff --git a/bcs-runtime/bcs-k8s/kubernetes/apis/monitor/v1/groupversion_info.go b/bcs-runtime/bcs-k8s/kubernetes/apis/monitor/v1/groupversion_info.go index e56c205e08..8c5f2ff6cf 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/apis/monitor/v1/groupversion_info.go +++ b/bcs-runtime/bcs-k8s/kubernetes/apis/monitor/v1/groupversion_info.go @@ -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 v1 contains API Schema definitions for the monitor v1 API group @@ -33,6 +32,7 @@ var ( ) var ( + // SchemeGroupVersion xxx SchemeGroupVersion = GroupVersion ) diff --git a/bcs-runtime/bcs-k8s/kubernetes/apis/monitor/v1/servicemonitor_types.go b/bcs-runtime/bcs-k8s/kubernetes/apis/monitor/v1/servicemonitor_types.go index a7c2beddf5..7f55ac79af 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/apis/monitor/v1/servicemonitor_types.go +++ b/bcs-runtime/bcs-k8s/kubernetes/apis/monitor/v1/servicemonitor_types.go @@ -8,13 +8,13 @@ * 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 v1 import ( "fmt" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/selection" @@ -32,10 +32,12 @@ type ServiceMonitorSpec struct { Selector LabelSelector `json:"selector,omitempty"` } +// LabelSelector xxx type LabelSelector struct { MatchLabels map[string]string `json:"matchLabels,omitempty"` } +// Endpoint xxx type Endpoint struct { Port string `json:"port,omitempty"` Path string `json:"path,omitempty"` @@ -62,10 +64,12 @@ type ServiceMonitor struct { Status ServiceMonitorStatus `json:"status,omitempty"` } +// GetUuid xxx func (s *ServiceMonitor) GetUuid() string { return fmt.Sprintf("%s.%s", s.Namespace, s.Name) } +// GetSelector xxx func (s *ServiceMonitor) GetSelector() labels.Requirements { rms := labels.Requirements{} for k, v := range s.Spec.Selector.MatchLabels { diff --git a/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1/groupversion_info.go b/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1/groupversion_info.go index e85b904e41..9b8050bbac 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1/groupversion_info.go +++ b/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1/groupversion_info.go @@ -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 v1 contains API Schema definitions for the networkextension v1 API group @@ -33,6 +32,7 @@ var ( ) var ( + // SchemeGroupVersion xxx SchemeGroupVersion = GroupVersion ) diff --git a/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1/ingress_types.go b/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1/ingress_types.go index 457e1a9dae..7357c48e78 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1/ingress_types.go +++ b/bcs-runtime/bcs-k8s/kubernetes/apis/networkextension/v1/ingress_types.go @@ -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 v1 @@ -43,8 +42,9 @@ const ( // WorkloadKindGameStatefulset kind name of workload game statefulset WorkloadKindGameStatefulset = "gamestatefulset" - // Pod CLB weight annotation key - AnnotationKeyForLoadbalanceWeight = "networkextension.bkbcs.tencent.com/clb-weight" + // AnnotationKeyForLoadbalanceWeight Pod CLB weight annotation key + AnnotationKeyForLoadbalanceWeight = "networkextension.bkbcs.tencent.com/clb-weight" + // AnnotationKeyForLoadbalanceWeightReady xxx AnnotationKeyForLoadbalanceWeightReady = "networkextension.bkbcs.tencent.com/clb-weight-ready" // AnnotationKeyForWarnings annotation key for ingress warnings @@ -117,7 +117,8 @@ type ListenerHealthCheck struct { HealthCheckProtocol string `json:"healthCheckProtocol,omitempty"` // HTTPCodeValues specifies a set of HTTP response status codes of health check. // You can specify multiple values (for example, "200,202") or a range of values - // (for example, "200-299"). https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2@v1.17.0/types#Matcher + // (for example, "200-299"). + // https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2@v1.17.0/types#Matcher // +optional HTTPCodeValues string `json:"httpCodeValues,omitempty"` HTTPCheckPath string `json:"httpCheckPath,omitempty"` @@ -134,11 +135,12 @@ type IngressListenerAttribute struct { BackendInsecure bool `json:"backendInsecure,omitempty"` // MaxRate specifies the maximum number of connections per second allowed for every target instance. MaxRate int `json:"maxRate,omitempty"` - // aws targetGroup attributes, https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_ModifyTargetGroupAttributes.html + // aws targetGroup attributes, + // https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_ModifyTargetGroupAttributes.html AWSAttributes []AWSAttribute `json:"awsAttributes,omitempty"` HealthCheck *ListenerHealthCheck `json:"healthCheck,omitempty"` // 声明7层监听器中,rule的优先级(目前只在aws中使用) - Priority int `json:"priority,omitempty""` + Priority int `json:"priority,omitempty"` } // AWSAttribute define aws target group attribute @@ -208,10 +210,12 @@ type IngressLoadBalancer struct { AWSLBType string `json:"awsLBType,omitempty"` } +// BuildKeyID xxx func (in IngressLoadBalancer) BuildKeyID() string { return in.Region + ":" + in.LoadbalancerID } +// BuildKeyName xxx func (in IngressLoadBalancer) BuildKeyName() string { return in.Region + ":" + in.LoadbalancerName } diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/admission/convert.go b/bcs-runtime/bcs-k8s/kubernetes/common/admission/convert.go index a3c397c800..f1ac448583 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/admission/convert.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/admission/convert.go @@ -4,12 +4,13 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 admission xxx package admission import ( diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/admission/crd_handler.go b/bcs-runtime/bcs-k8s/kubernetes/common/admission/crd_handler.go index 01bf4442d1..27ef2316b4 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/admission/crd_handler.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/admission/crd_handler.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -16,14 +16,13 @@ import ( "context" "fmt" + gdv1alpha1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-gamedeployment-operator/pkg/apis/tkex/v1alpha1" + gssv1alpha1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-gamestatefulset-operator/pkg/apis/tkex/v1alpha1" v1 "k8s.io/api/admission/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/klog/v2" - - gdv1alpha1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-gamedeployment-operator/pkg/apis/tkex/v1alpha1" - gssv1alpha1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-gamestatefulset-operator/pkg/apis/tkex/v1alpha1" ) // handleCRD handles admission requests when deleting CRD diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/admission/scheme.go b/bcs-runtime/bcs-k8s/kubernetes/common/admission/scheme.go index 06bd2bcafa..f5742b359d 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/admission/scheme.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/admission/scheme.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/admission/server.go b/bcs-runtime/bcs-k8s/kubernetes/common/admission/server.go index 11214c0865..a530b105b9 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/admission/server.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/admission/server.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -51,6 +51,7 @@ func (s *ServerRunOptions) Validate() error { } func getTLSConfig(s *ServerRunOptions) (*tls.Config, error) { + // nolint TLS MinVersion too low tlsConfig := &tls.Config{ NextProtos: []string{"http/1.1"}, // Certificates: []tls.Certificate{cert}, @@ -112,6 +113,7 @@ func Run(s *ServerRunOptions, serverType string, client interface{}, stopCh <-ch }() } + // nolint select { case <-stopCh: klog.Info("http server received stop signal, waiting for all requests to finish") diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/admission/validation.go b/bcs-runtime/bcs-k8s/kubernetes/common/admission/validation.go index dacbe4104f..c0a85f4111 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/admission/validation.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/admission/validation.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -18,13 +18,13 @@ import ( "io/ioutil" "net/http" + gdclientset "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-gamedeployment-operator/pkg/client/clientset/versioned" + gssclientset "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-gamestatefulset-operator/pkg/client/clientset/versioned" v1 "k8s.io/api/admission/v1" "k8s.io/api/admission/v1beta1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/klog" - gdclientset "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-gamedeployment-operator/pkg/client/clientset/versioned" - gssclientset "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-gamestatefulset-operator/pkg/client/clientset/versioned" hookclientset "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned" ) diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/admission/workload_handler.go b/bcs-runtime/bcs-k8s/kubernetes/common/admission/workload_handler.go index 4b3f85451f..2ce4361a23 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/admission/workload_handler.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/admission/workload_handler.go @@ -4,7 +4,7 @@ * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -16,11 +16,11 @@ import ( "encoding/json" "fmt" + gdv1alpha1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-gamedeployment-operator/pkg/apis/tkex/v1alpha1" + gssv1alpha1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-gamestatefulset-operator/pkg/apis/tkex/v1alpha1" v1 "k8s.io/api/admission/v1" "k8s.io/klog/v2" - gdv1alpha1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-gamedeployment-operator/pkg/apis/tkex/v1alpha1" - gssv1alpha1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/bcs-component/bcs-gamestatefulset-operator/pkg/apis/tkex/v1alpha1" hookv1alpha1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1" ) diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/apis.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/apis.go index 35a3fec5ae..cce2fc1393 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/apis.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/apis.go @@ -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 apis xxx package apis import ( diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1/doc.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1/doc.go index 02879ed280..26cf951b0d 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1/doc.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1/doc.go @@ -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. - * */ // +k8s:deepcopy-gen=package diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1/hook_types.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1/hook_types.go index daf4be5786..8e832fe948 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1/hook_types.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1/hook_types.go @@ -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. - * */ // +kubebuilder:validation:Optional @@ -223,7 +222,8 @@ type WebMetricHeader struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:printcolumn:JSONPath=.status.phase,name=PHASE,type=string,description=The phase of hookruns. -// +kubebuilder:printcolumn:JSONPath=.metadata.creationTimestamp,name=AGE,type=date,description= CreationTimestamp is a timestamp representing the server time when this object was created. +// +kubebuilder:printcolumn:JSONPath=.metadata.creationTimestamp,name=AGE,type=date, +// description= CreationTimestamp is a timestamp representing the server time when this object was created. // +kubebuilder:subresource:status type HookRun struct { metav1.TypeMeta `json:",inline"` diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1/register.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1/register.go index 23ab1b40eb..6d09fd215e 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1/register.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1/register.go @@ -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 v1alpha1 @@ -20,18 +19,26 @@ import ( ) const ( - Kind = "GameDeployment" - Plural = "gamedeployments" + // Kind xxx + Kind = "GameDeployment" + // Plural xxx + Plural = "gamedeployments" + // Singular xxx Singular = "gamedeployment" + // GroupName xxx GroupName = "tkex.tencent.com" - Version = "v1alpha1" + // Version xxx + Version = "v1alpha1" ) var ( + // SchemeBuilder xxx SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - AddToScheme = SchemeBuilder.AddToScheme + // AddToScheme xxx + AddToScheme = SchemeBuilder.AddToScheme + // SchemeGroupVersion xxx SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: Version} ) diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1/zz_generated.deepcopy.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1/zz_generated.deepcopy.go index 3257ceb1af..0eb0b90c4b 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1/zz_generated.deepcopy.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1/zz_generated.deepcopy.go @@ -10,7 +10,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. - * */ // Code generated by deepcopy-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/clientset.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/clientset.go index 85be870260..5879c4c406 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/clientset.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/clientset.go @@ -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. - * */ // Code generated by client-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/doc.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/doc.go index 663299f844..8c158b1003 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/doc.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/doc.go @@ -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. - * */ // Code generated by client-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/fake/clientset_generated.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/fake/clientset_generated.go index a4e8d9005c..bae0a14627 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/fake/clientset_generated.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/fake/clientset_generated.go @@ -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. - * */ // Code generated by client-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/fake/doc.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/fake/doc.go index bc3aa29bf4..1f26c05118 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/fake/doc.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/fake/doc.go @@ -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. - * */ // Code generated by client-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/fake/register.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/fake/register.go index 94456a4703..ddda6d3977 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/fake/register.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/fake/register.go @@ -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. - * */ // Code generated by client-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/scheme/doc.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/scheme/doc.go index fedfb8e461..866e398edd 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/scheme/doc.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/scheme/doc.go @@ -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. - * */ // Code generated by client-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/scheme/register.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/scheme/register.go index 7f7311e6cc..36f1ca2fa3 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/scheme/register.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/scheme/register.go @@ -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. - * */ // Code generated by client-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/doc.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/doc.go index af96e22246..f03bb9e57f 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/doc.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/doc.go @@ -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. - * */ // Code generated by client-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/fake/doc.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/fake/doc.go index 45af606688..e1f3b33b8a 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/fake/doc.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/fake/doc.go @@ -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. - * */ // Code generated by client-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/fake/fake_hookrun.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/fake/fake_hookrun.go index 8624a00b5e..696c3e9aa8 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/fake/fake_hookrun.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/fake/fake_hookrun.go @@ -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. - * */ // Code generated by client-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/fake/fake_hooktemplate.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/fake/fake_hooktemplate.go index 9d4ae62f37..5256850cdb 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/fake/fake_hooktemplate.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/fake/fake_hooktemplate.go @@ -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. - * */ // Code generated by client-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/fake/fake_tkex_client.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/fake/fake_tkex_client.go index d29b4ef691..ca75f5b137 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/fake/fake_tkex_client.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/fake/fake_tkex_client.go @@ -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. - * */ // Code generated by client-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/generated_expansion.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/generated_expansion.go index 19071329fa..a6466b6588 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/generated_expansion.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/generated_expansion.go @@ -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. - * */ // Code generated by client-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/hookrun.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/hookrun.go index 95224dac97..7e9d2642ca 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/hookrun.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/hookrun.go @@ -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. - * */ // Code generated by client-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/hooktemplate.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/hooktemplate.go index ff35be863c..8506f32633 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/hooktemplate.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/hooktemplate.go @@ -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. - * */ // Code generated by client-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/tkex_client.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/tkex_client.go index 1f5ef2ea42..8c570f26a2 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/tkex_client.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1/tkex_client.go @@ -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. - * */ // Code generated by client-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/factory.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/factory.go index e1d1891628..42327b4aad 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/factory.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/factory.go @@ -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. - * */ // Code generated by informer-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/generic.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/generic.go index ef230ea34d..8a5c2101a1 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/generic.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/generic.go @@ -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. - * */ // Code generated by informer-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/internalinterfaces/factory_interfaces.go index 1ae726c0b2..841d9695bf 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/internalinterfaces/factory_interfaces.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -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. - * */ // Code generated by informer-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/tkex/interface.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/tkex/interface.go index f1b03b838d..865f778695 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/tkex/interface.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/tkex/interface.go @@ -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. - * */ // Code generated by informer-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/tkex/v1alpha1/hookrun.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/tkex/v1alpha1/hookrun.go index dbea8a9aaa..f3eb7ec5f6 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/tkex/v1alpha1/hookrun.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/tkex/v1alpha1/hookrun.go @@ -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. - * */ // Code generated by informer-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/tkex/v1alpha1/hooktemplate.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/tkex/v1alpha1/hooktemplate.go index d4cdac0577..60332b035e 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/tkex/v1alpha1/hooktemplate.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/tkex/v1alpha1/hooktemplate.go @@ -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. - * */ // Code generated by informer-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/tkex/v1alpha1/interface.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/tkex/v1alpha1/interface.go index e54998ae83..b23e750f32 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/tkex/v1alpha1/interface.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/informers/externalversions/tkex/v1alpha1/interface.go @@ -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. - * */ // Code generated by informer-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/listers/tkex/v1alpha1/expansion_generated.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/listers/tkex/v1alpha1/expansion_generated.go index cc88fbf3ca..08f0771dd2 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/listers/tkex/v1alpha1/expansion_generated.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/listers/tkex/v1alpha1/expansion_generated.go @@ -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. - * */ // Code generated by lister-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/listers/tkex/v1alpha1/hookrun.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/listers/tkex/v1alpha1/hookrun.go index 7b13b2c98b..a669c1c9ce 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/listers/tkex/v1alpha1/hookrun.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/listers/tkex/v1alpha1/hookrun.go @@ -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. - * */ // Code generated by lister-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/listers/tkex/v1alpha1/hooktemplate.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/listers/tkex/v1alpha1/hooktemplate.go index 5109b47ca4..fc88cd7a8b 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/listers/tkex/v1alpha1/hooktemplate.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/listers/tkex/v1alpha1/hooktemplate.go @@ -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. - * */ // Code generated by lister-gen. DO NOT EDIT. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/metrics/metrics.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/metrics/metrics.go index 785d96affa..6abb707320 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/metrics/metrics.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/metrics/metrics.go @@ -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 metrics xxx package metrics import ( @@ -19,6 +19,7 @@ import ( "github.com/prometheus/client_golang/prometheus" ) +// PromServer xxx type PromServer struct{} var ( @@ -35,6 +36,7 @@ func init() { prometheus.MustRegister(hrCreateDuration) } +// CollectHRCreateDurations xxx func (p *PromServer) CollectHRCreateDurations(namespace, name, status, action, objectKind string, d time.Duration) { hrCreateDuration.WithLabelValues(namespace, name, status, action, objectKind).Observe(d.Seconds()) } diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/postinplace/interface.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/postinplace/interface.go index 1d0b6320f1..88c0463153 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/postinplace/interface.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/postinplace/interface.go @@ -8,19 +8,23 @@ * 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 postinplace xxx package postinplace import ( hookv1alpha1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1" ) +// PostInplaceHookObjectInterface xxx +// nolint type PostInplaceHookObjectInterface interface { GetPostInplaceHook() *hookv1alpha1.HookStep } +// PostInplaceHookStatusInterface xxx +// nolint type PostInplaceHookStatusInterface interface { GetPostInplaceHookConditions() []hookv1alpha1.PostInplaceHookCondition SetPostInplaceHookConditions([]hookv1alpha1.PostInplaceHookCondition) diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/postinplace/postinplace.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/postinplace/postinplace.go index 9afaa37923..39fc241b0f 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/postinplace/postinplace.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/postinplace/postinplace.go @@ -6,9 +6,8 @@ * http://opensource.org/licenses/MIT * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either expostss or implied. See the License for the specific language governing permissions and + * either express or implied. See the License for the specific language governing permissions and * limitations under the License. - * */ package postinplace @@ -20,12 +19,6 @@ import ( "strings" "time" - hookv1alpha1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1" - hookclientset "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned" - hooklister "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/listers/tkex/v1alpha1" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/metrics" - commonhookutil "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/util/hook" - apps "k8s.io/api/apps/v1" v1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" @@ -34,16 +27,29 @@ import ( clientset "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/record" "k8s.io/klog" + + hookv1alpha1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1" + hookclientset "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned" + hooklister "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/listers/tkex/v1alpha1" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/metrics" + commonhookutil "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/util/hook" ) const ( - PodNameArgKey = "PodName" + // PodNameArgKey xxx + PodNameArgKey = "PodName" + // NamespaceArgKey xxx NamespaceArgKey = "PodNamespace" - PodIPArgKey = "PodIP" - PodImageArgKey = "PodContainer" - HostArgKey = "HostIP" + // PodIPArgKey xxx + PodIPArgKey = "PodIP" + // PodImageArgKey xxx + PodImageArgKey = "PodContainer" + // HostArgKey xxx + HostArgKey = "HostIP" ) +// PostInplaceInterface xxx +// nolint type PostInplaceInterface interface { CreatePostInplaceHook(obj PostInplaceHookObjectInterface, pod *v1.Pod, @@ -56,6 +62,8 @@ type PostInplaceInterface interface { podNameLabelKey string) error } +// PostInplaceControl xxx +// nolint type PostInplaceControl struct { kubeClient clientset.Interface hookClient hookclientset.Interface @@ -64,6 +72,7 @@ type PostInplaceControl struct { hookTemplateLister hooklister.HookTemplateLister } +// New xxx func New(kubeClient clientset.Interface, hookClient hookclientset.Interface, recorder record.EventRecorder, hookRunLister hooklister.HookRunLister, hookTemplateLister hooklister.HookTemplateLister) PostInplaceInterface { return &PostInplaceControl{kubeClient: kubeClient, hookClient: hookClient, recorder: recorder, @@ -171,7 +180,7 @@ func (p *PostInplaceControl) UpdatePostInplaceHook(obj PostInplaceHookObjectInte return nil } if existHookRuns[0].Status.Phase == hookv1alpha1.HookPhaseSuccessful { - err := deletePostInplaceHookCondition(newStatus, pod.Name) + err = deletePostInplaceHookCondition(newStatus, pod.Name) if err != nil { klog.Warningf("expected the %s %s/%s exists a PostInplaceHookCondition for pod %s, but got an error: %s", objectKind, namespace, name, pod.Name, err.Error()) @@ -291,7 +300,7 @@ func deletePostInplaceHookCondition(status PostInplaceHookStatusInterface, podNa return fmt.Errorf("no PostInplaceHookCondition to delete") } - newConditions := append(conditions[:index], conditions[index+1:]...) + newConditions := append(conditions[:index], conditions[index+1:]...) // nolint status.SetPostInplaceHookConditions(newConditions) return nil } diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/predelete/interface.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/predelete/interface.go index 26d857163d..26215c3b8e 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/predelete/interface.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/predelete/interface.go @@ -8,19 +8,23 @@ * 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 predelete xxx package predelete import ( hookv1alpha1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1" ) +// PreDeleteHookObjectInterface xxx +// nolint type PreDeleteHookObjectInterface interface { GetPreDeleteHook() *hookv1alpha1.HookStep } +// PreDeleteHookStatusInterface xxx +// nolint type PreDeleteHookStatusInterface interface { GetPreDeleteHookConditions() []hookv1alpha1.PreDeleteHookCondition SetPreDeleteHookConditions([]hookv1alpha1.PreDeleteHookCondition) diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/predelete/predelete.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/predelete/predelete.go index 3cd61c4b9f..4c8c9289ef 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/predelete/predelete.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/predelete/predelete.go @@ -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 predelete @@ -22,12 +21,6 @@ import ( "strings" "time" - hookv1alpha1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1" - hookclientset "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned" - hooklister "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/listers/tkex/v1alpha1" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/metrics" - commonhookutil "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/util/hook" - apps "k8s.io/api/apps/v1" v1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" @@ -37,21 +30,38 @@ import ( clientset "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/record" "k8s.io/klog" + + hookv1alpha1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1" + hookclientset "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned" + hooklister "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/listers/tkex/v1alpha1" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/metrics" + commonhookutil "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/util/hook" ) const ( - PodNameArgKey = "PodName" - NamespaceArgKey = "PodNamespace" - PodIPArgKey = "PodIP" - PodImageArgKey = "PodContainer" - HostArgKey = "HostIP" + // PodNameArgKey xxx + PodNameArgKey = "PodName" + // NamespaceArgKey xxx + NamespaceArgKey = "PodNamespace" + // PodIPArgKey xxx + PodIPArgKey = "PodIP" + // PodImageArgKey xxx + PodImageArgKey = "PodContainer" + // HostArgKey xxx + HostArgKey = "HostIP" + // DeletingAnnotation xxx DeletingAnnotation = "io.tencent.bcs.dev/game-pod-deleting" ) +// PreDeleteInterface xxx +// nolint type PreDeleteInterface interface { - CheckDelete(obj PreDeleteHookObjectInterface, pod *v1.Pod, newStatus PreDeleteHookStatusInterface, podNameLabelKey string) (bool, error) + CheckDelete(obj PreDeleteHookObjectInterface, pod *v1.Pod, newStatus PreDeleteHookStatusInterface, + podNameLabelKey string) (bool, error) } +// PreDeleteControl xxx +// nolint type PreDeleteControl struct { kubeClient clientset.Interface hookClient hookclientset.Interface @@ -60,14 +70,16 @@ type PreDeleteControl struct { hookTemplateLister hooklister.HookTemplateLister } +// New xxx func New(kubeClient clientset.Interface, hookClient hookclientset.Interface, recorder record.EventRecorder, hookRunLister hooklister.HookRunLister, hookTemplateLister hooklister.HookTemplateLister) PreDeleteInterface { - return &PreDeleteControl{kubeClient: kubeClient, hookClient: hookClient, recorder: recorder, hookRunLister: hookRunLister, - hookTemplateLister: hookTemplateLister} + return &PreDeleteControl{kubeClient: kubeClient, hookClient: hookClient, recorder: recorder, + hookRunLister: hookRunLister, hookTemplateLister: hookTemplateLister} } // CheckDelete check whether the pod can be deleted safely -func (p *PreDeleteControl) CheckDelete(obj PreDeleteHookObjectInterface, pod *v1.Pod, newStatus PreDeleteHookStatusInterface, podNameLabelKey string) (bool, error) { +func (p *PreDeleteControl) CheckDelete(obj PreDeleteHookObjectInterface, pod *v1.Pod, + newStatus PreDeleteHookStatusInterface, podNameLabelKey string) (bool, error) { if pod.Status.Phase != v1.PodRunning { return true, nil } @@ -108,7 +120,9 @@ func (p *PreDeleteControl) CheckDelete(obj PreDeleteHookObjectInterface, pod *v1 if len(existHookRuns) == 0 { var ps metrics.PromServer startTime := time.Now() - preDeleteHookRun, err := p.createHookRun(metaObj, runtimeObj, preDeleteHook, pod, preDeleteLabels, podNameLabelKey) + // nolint + preDeleteHookRun, err := p.createHookRun(metaObj, runtimeObj, preDeleteHook, pod, preDeleteLabels, + podNameLabelKey) if err != nil { klog.Warningf("Created PreDelete HookRun failed for pod %s of %s %s/%s, err:%s", pod.Name, objectKind, namespace, name, err) @@ -118,7 +132,8 @@ func (p *PreDeleteControl) CheckDelete(obj PreDeleteHookObjectInterface, pod *v1 ps.CollectHRCreateDurations(namespace, name, "success", "predelete", objectKind, time.Since(startTime)) updatePreDeleteHookCondition(newStatus, pod.Name) - klog.Infof("Created PreDelete HookRun %s for pod %s of %s %s/%s", preDeleteHookRun.Name, pod.Name, objectKind, namespace, name) + klog.Infof("Created PreDelete HookRun %s for pod %s of %s %s/%s", preDeleteHookRun.Name, pod.Name, objectKind, + namespace, name) err = p.injectPodDeletingAnnotation(pod) if err != nil { @@ -128,7 +143,7 @@ func (p *PreDeleteControl) CheckDelete(obj PreDeleteHookObjectInterface, pod *v1 return false, nil } if existHookRuns[0].Status.Phase == hookv1alpha1.HookPhaseSuccessful { - err := deletePreDeleteHookCondition(newStatus, pod.Name) + err = deletePreDeleteHookCondition(newStatus, pod.Name) if err != nil { klog.Warningf("expected the %s %s/%s exists a PreDeleteHookCondition for pod %s, but got an error: %s", objectKind, namespace, name, pod.Name, err.Error()) @@ -146,8 +161,9 @@ func (p *PreDeleteControl) CheckDelete(obj PreDeleteHookObjectInterface, pod *v1 } // createHookRun create a PreDelete HookRun -func (p *PreDeleteControl) createHookRun(metaObj metav1.Object, runtimeObj runtime.Object, preDeleteHook *hookv1alpha1.HookStep, - pod *v1.Pod, labels map[string]string, podNameLabelKey string) (*hookv1alpha1.HookRun, error) { +func (p *PreDeleteControl) createHookRun(metaObj metav1.Object, runtimeObj runtime.Object, + preDeleteHook *hookv1alpha1.HookStep, pod *v1.Pod, labels map[string]string, + podNameLabelKey string) (*hookv1alpha1.HookRun, error) { arguments := []hookv1alpha1.Argument{} for _, arg := range preDeleteHook.Args { value := arg.Value @@ -199,8 +215,9 @@ func (p *PreDeleteControl) createHookRun(metaObj metav1.Object, runtimeObj runti } // newHookRunFromGameStatefulSet generate a HookRun from HookTemplate -func (p *PreDeleteControl) newHookRunFromHookTemplate(metaObj metav1.Object, runtimeObj runtime.Object, args []hookv1alpha1.Argument, - pod *v1.Pod, preDeleteHook *hookv1alpha1.HookStep, labels map[string]string, podNameLabelKey string) (*hookv1alpha1.HookRun, error) { +func (p *PreDeleteControl) newHookRunFromHookTemplate(metaObj metav1.Object, runtimeObj runtime.Object, + args []hookv1alpha1.Argument, pod *v1.Pod, preDeleteHook *hookv1alpha1.HookStep, labels map[string]string, + podNameLabelKey string) (*hookv1alpha1.HookRun, error) { template, err := p.hookTemplateLister.HookTemplates(pod.Namespace).Get(preDeleteHook.TemplateName) if err != nil { if k8serrors.IsNotFound(err) { @@ -209,7 +226,8 @@ func (p *PreDeleteControl) newHookRunFromHookTemplate(metaObj metav1.Object, run return nil, err } - nameParts := []string{"predelete", pod.Labels[apps.ControllerRevisionHashLabelKey], pod.Labels[podNameLabelKey], preDeleteHook.TemplateName} + nameParts := []string{"predelete", pod.Labels[apps.ControllerRevisionHashLabelKey], pod.Labels[podNameLabelKey], + preDeleteHook.TemplateName} name := strings.Join(nameParts, "-") run, err := commonhookutil.NewHookRunFromTemplate(template, args, name, "", pod.Namespace) @@ -217,7 +235,8 @@ func (p *PreDeleteControl) newHookRunFromHookTemplate(metaObj metav1.Object, run return nil, err } run.Labels = labels - run.OwnerReferences = []metav1.OwnerReference{*metav1.NewControllerRef(metaObj, runtimeObj.GetObjectKind().GroupVersionKind())} + run.OwnerReferences = []metav1.OwnerReference{*metav1.NewControllerRef(metaObj, + runtimeObj.GetObjectKind().GroupVersionKind())} return run, nil } @@ -237,7 +256,7 @@ func deletePreDeleteHookCondition(status PreDeleteHookStatusInterface, podName s return fmt.Errorf("no PreDeleteHookCondition to delete") } - newConditions := append(conditions[:index], conditions[index+1:]...) + newConditions := append(conditions[:index], conditions[index+1:]...) // nolint not assigned to the same slice status.SetPreDeleteHookConditions(newConditions) return nil } @@ -261,7 +280,8 @@ func updatePreDeleteHookCondition(status PreDeleteHookStatusInterface, podName s } // reset PreDeleteHookConditionPhase of a pod -func resetPreDeleteHookConditionPhase(status PreDeleteHookStatusInterface, podName string, phase hookv1alpha1.HookPhase) error { +func resetPreDeleteHookConditionPhase( + status PreDeleteHookStatusInterface, podName string, phase hookv1alpha1.HookPhase) error { var index int found := false conditions := status.GetPreDeleteHookConditions() diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/preinplace/interface.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/preinplace/interface.go index 4d25834a74..ad2a1d825b 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/preinplace/interface.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/preinplace/interface.go @@ -8,19 +8,23 @@ * 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 preinplace xxx package preinplace import ( hookv1alpha1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1" ) +// PreInplaceHookObjectInterface xxx +// nolint type PreInplaceHookObjectInterface interface { GetPreInplaceHook() *hookv1alpha1.HookStep } +// PreInplaceHookStatusInterface xxx +// nolint type PreInplaceHookStatusInterface interface { GetPreInplaceHookConditions() []hookv1alpha1.PreInplaceHookCondition SetPreInplaceHookConditions([]hookv1alpha1.PreInplaceHookCondition) diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/preinplace/preinplace.go b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/preinplace/preinplace.go index 2ff2649ab4..467840aadd 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/preinplace/preinplace.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/preinplace/preinplace.go @@ -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 preinplace @@ -22,12 +21,6 @@ import ( "strings" "time" - hookv1alpha1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1" - hookclientset "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned" - hooklister "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/listers/tkex/v1alpha1" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/metrics" - commonhookutil "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/util/hook" - apps "k8s.io/api/apps/v1" v1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" @@ -37,18 +30,33 @@ import ( clientset "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/record" "k8s.io/klog" + + hookv1alpha1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1" + hookclientset "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned" + hooklister "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/listers/tkex/v1alpha1" + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/metrics" + commonhookutil "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/util/hook" ) const ( - PodNameArgKey = "PodName" - NamespaceArgKey = "PodNamespace" - PodIPArgKey = "PodIP" - PodImageArgKey = "PodContainer" - ModifiedArgKey = "ModifiedContainer" - HostArgKey = "HostIP" + // PodNameArgKey xxx + PodNameArgKey = "PodName" + // NamespaceArgKey xxx + NamespaceArgKey = "PodNamespace" + // PodIPArgKey xxx + PodIPArgKey = "PodIP" + // PodImageArgKey xxx + PodImageArgKey = "PodContainer" + // ModifiedArgKey xxx + ModifiedArgKey = "ModifiedContainer" + // HostArgKey xxx + HostArgKey = "HostIP" + // DeletingAnnotation xxx DeletingAnnotation = "io.tencent.bcs.dev/game-pod-deleting" ) +// PreInplaceInterface xxx +// nolint type PreInplaceInterface interface { CheckInplace(obj PreInplaceHookObjectInterface, pod *v1.Pod, @@ -57,6 +65,8 @@ type PreInplaceInterface interface { podNameLabelKey string) (bool, error) } +// PreInplaceControl xxx +// nolint type PreInplaceControl struct { kubeClient clientset.Interface hookClient hookclientset.Interface @@ -65,6 +75,7 @@ type PreInplaceControl struct { hookTemplateLister hooklister.HookTemplateLister } +// New xxx func New(kubeClient clientset.Interface, hookClient hookclientset.Interface, recorder record.EventRecorder, hookRunLister hooklister.HookRunLister, hookTemplateLister hooklister.HookTemplateLister) PreInplaceInterface { return &PreInplaceControl{kubeClient: kubeClient, hookClient: hookClient, recorder: recorder, @@ -72,8 +83,8 @@ func New(kubeClient clientset.Interface, hookClient hookclientset.Interface, rec } // CheckInplace check whether the pod can be deleted safely -func (p *PreInplaceControl) CheckInplace(obj PreInplaceHookObjectInterface, pod *v1.Pod, podTemplate *v1.PodTemplateSpec, - newStatus PreInplaceHookStatusInterface, podNameLabelKey string) (bool, error) { +func (p *PreInplaceControl) CheckInplace(obj PreInplaceHookObjectInterface, pod *v1.Pod, + podTemplate *v1.PodTemplateSpec, newStatus PreInplaceHookStatusInterface, podNameLabelKey string) (bool, error) { if pod.Status.Phase != v1.PodRunning { return true, nil } @@ -116,7 +127,7 @@ func (p *PreInplaceControl) CheckInplace(obj PreInplaceHookObjectInterface, pod if len(existHookRuns) == 0 { var ps metrics.PromServer startTime := time.Now() - preInplaceHookRun, err := p.createHookRun(metaObj, runtimeObj, + preInplaceHookRun, err := p.createHookRun(metaObj, runtimeObj, // nolint preInplaceHook, pod, podTemplate, preInplaceLabels, podNameLabelKey) if err != nil { ps.CollectHRCreateDurations(namespace, name, "failure", "preinplace", objectKind, time.Since(startTime)) @@ -135,7 +146,7 @@ func (p *PreInplaceControl) CheckInplace(obj PreInplaceHookObjectInterface, pod return false, nil } if existHookRuns[0].Status.Phase == hookv1alpha1.HookPhaseSuccessful { - err := deletePreInplaceHookCondition(newStatus, pod.Name) + err = deletePreInplaceHookCondition(newStatus, pod.Name) if err != nil { klog.Warningf("expected the %s %s/%s exists a PreInplaceHookCondition for pod %s, but got an error: %s", objectKind, namespace, name, pod.Name, err.Error()) @@ -258,7 +269,7 @@ func deletePreInplaceHookCondition(status PreInplaceHookStatusInterface, podName return fmt.Errorf("no PreInplaceHookCondition to delete") } - newConditions := append(conditions[:index], conditions[index+1:]...) + newConditions := append(conditions[:index], conditions[index+1:]...) // nolint status.SetPreInplaceHookConditions(newConditions) return nil } @@ -328,6 +339,7 @@ func (p *PreInplaceControl) injectPodDeletingAnnotation(pod *v1.Pod) error { } // findModifiedContainers returns names of containers which image are modified when inplace updating +// nolint result 1 (error) is always nil func findModifiedContainers(podTemplate *v1.PodTemplateSpec, pod *v1.Pod) ([]hookv1alpha1.Argument, error) { oldImages := make(map[string]string) for _, container := range pod.Spec.Containers { diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/context/context.go b/bcs-runtime/bcs-k8s/kubernetes/common/context/context.go index e3c48633fc..288752781e 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/context/context.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/context/context.go @@ -8,15 +8,16 @@ * 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 context xxx package context import ( hookv1alpha1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1" ) +// CanaryContext xxx type CanaryContext interface { CurrentHookRuns() []*hookv1alpha1.HookRun OtherHookRuns() []*hookv1alpha1.HookRun diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/expectations/scale_expectations.go b/bcs-runtime/bcs-k8s/kubernetes/common/expectations/scale_expectations.go index 989099d7a7..5ce19c5695 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/expectations/scale_expectations.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/expectations/scale_expectations.go @@ -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 expectations xxx package expectations import ( diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/expectations/scale_expectations_test.go b/bcs-runtime/bcs-k8s/kubernetes/common/expectations/scale_expectations_test.go index fafaaed500..2508cce860 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/expectations/scale_expectations_test.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/expectations/scale_expectations_test.go @@ -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 expectations diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/expectations/update_expectations.go b/bcs-runtime/bcs-k8s/kubernetes/common/expectations/update_expectations.go index ce892f9a85..999a08a302 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/expectations/update_expectations.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/expectations/update_expectations.go @@ -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 expectations diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/expectations/update_expectations_test.go b/bcs-runtime/bcs-k8s/kubernetes/common/expectations/update_expectations_test.go index 7bdd17f890..216f6ae324 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/expectations/update_expectations_test.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/expectations/update_expectations_test.go @@ -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 expectations diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/hack/boilerplate.go.txt b/bcs-runtime/bcs-k8s/kubernetes/common/hack/boilerplate.go.txt index a620e80a06..fd0afc236a 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/hack/boilerplate.go.txt +++ b/bcs-runtime/bcs-k8s/kubernetes/common/hack/boilerplate.go.txt @@ -8,5 +8,4 @@ * 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. - * */ diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/metrics/restclient/metrics.go b/bcs-runtime/bcs-k8s/kubernetes/common/metrics/restclient/metrics.go index 63da97383c..f1b7457e22 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/metrics/restclient/metrics.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/metrics/restclient/metrics.go @@ -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 restclient xxx package restclient import ( diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/metrics/workqueue/metrics.go b/bcs-runtime/bcs-k8s/kubernetes/common/metrics/workqueue/metrics.go index dd111adda0..f79c5fe8c7 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/metrics/workqueue/metrics.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/metrics/workqueue/metrics.go @@ -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 workqueue xxx package workqueue import ( diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/update/adapter.go b/bcs-runtime/bcs-k8s/kubernetes/common/update/adapter.go index ec05f137e4..c4857a33a6 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/update/adapter.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/update/adapter.go @@ -8,37 +8,45 @@ * 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 update xxx package update import ( "context" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" clientset "k8s.io/client-go/kubernetes" ) +// Adapter xxx type Adapter interface { GetPod(namespace, name string) (*v1.Pod, error) UpdatePod(pod *v1.Pod) error UpdatePodStatus(pod *v1.Pod) error } +// AdapterTypedClient xxx type AdapterTypedClient struct { Client clientset.Interface } +// GetPod xxx func (c *AdapterTypedClient) GetPod(namespace, name string) (*v1.Pod, error) { return c.Client.CoreV1().Pods(namespace).Get(context.TODO(), name, metav1.GetOptions{}) } +// UpdatePod xxx +// nolint func (c *AdapterTypedClient) UpdatePod(pod *v1.Pod) error { _, err := c.Client.CoreV1().Pods(pod.Namespace).Update(context.TODO(), pod, metav1.UpdateOptions{}) return err } +// UpdatePodStatus xxx +// nolint func (c *AdapterTypedClient) UpdatePodStatus(pod *v1.Pod) error { _, err := c.Client.CoreV1().Pods(pod.Namespace).UpdateStatus(context.TODO(), pod, metav1.UpdateOptions{}) return err diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/update/hotpatchupdate/hotpatch_update.go b/bcs-runtime/bcs-k8s/kubernetes/common/update/hotpatchupdate/hotpatch_update.go index 9006c1741a..3df028a703 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/update/hotpatchupdate/hotpatch_update.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/update/hotpatchupdate/hotpatch_update.go @@ -8,21 +8,22 @@ * 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 hotpatchupdate xxx package hotpatchupdate import ( "encoding/json" "fmt" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/update" apps "k8s.io/api/apps/v1" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" clientset "k8s.io/client-go/kubernetes" "k8s.io/client-go/util/retry" + + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/update" ) // Interface for managing pods in-place update. @@ -37,6 +38,7 @@ type realControl struct { now func() metav1.Time } +// NewForTypedClient xxx func NewForTypedClient(c clientset.Interface, revisionKey string) Interface { return &realControl{adp: &update.AdapterTypedClient{Client: c}, revisionKey: revisionKey, now: metav1.Now} } @@ -46,7 +48,8 @@ func (c *realControl) Update(pod *v1.Pod, oldRevision, newRevision *apps.Control spec := update.CalculateInPlaceUpdateSpec(oldRevision, newRevision) if spec == nil { - return fmt.Errorf("find Pod %s update strategy is HotPatch, but the diff not only contains replace operation of spec.containers[x].image", pod) + return fmt.Errorf("find Pod %s update strategy is HotPatch,"+ + "but the diff not only contains replace operation of spec.containers[x].image", pod) } return c.updatePodHotPatch(pod, spec) diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/update/hotpatchupdate/types.go b/bcs-runtime/bcs-k8s/kubernetes/common/update/hotpatchupdate/types.go index e300b25ac6..52ac0993db 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/update/hotpatchupdate/types.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/update/hotpatchupdate/types.go @@ -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 hotpatchupdate @@ -22,11 +21,12 @@ const ( // The value of annotation is HotPatchUpdateState. HotPatchUpdateStateKey string = "hotpatch-update-state" - //hot-patch annotation + // PodHotpatchContainerKey hot-patch annotation PodHotpatchContainerKey = "io.kubernetes.hotpatch.container" ) // HotPatchUpdateState records latest hotpatch-update state, including old statuses of containers. +// nolint type HotPatchUpdateState struct { // Revision is the updated revision hash. Revision string `json:"revision"` @@ -41,6 +41,7 @@ type HotPatchUpdateState struct { // HotPatchUpdateContainerStatus records the statuses of the container that are mainly used // to determine whether the HotPatchUpdate is completed. +// nolint type HotPatchUpdateContainerStatus struct { ImageID string `json:"imageID,omitempty"` } diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/update/inplaceupdate/inplace_update.go b/bcs-runtime/bcs-k8s/kubernetes/common/update/inplaceupdate/inplace_update.go index 74702e8f33..73aad2b288 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/update/inplaceupdate/inplace_update.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/update/inplaceupdate/inplace_update.go @@ -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 inplaceupdate xxx package inplaceupdate import ( @@ -18,13 +18,14 @@ import ( "fmt" "time" - "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/update" apps "k8s.io/api/apps/v1" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" clientset "k8s.io/client-go/kubernetes" "k8s.io/client-go/util/retry" "k8s.io/klog" + + "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/update" ) // UpdateOptions is the option of update @@ -119,6 +120,7 @@ func (c *realControl) Update(pod *v1.Pod, oldRevision, newRevision *apps.Control return UpdateResult{InPlaceUpdate: true, DelayDuration: delayDuration} } +// nolint `opts` is unused func (c *realControl) refreshCondition(pod *v1.Pod, opts *UpdateOptions) error { // no need to update condition because of no readiness-gate if !containsReadinessGate(pod) { @@ -156,6 +158,7 @@ func (c *realControl) updateCondition(pod *v1.Pod, condition v1.PodCondition) er }) } +// nolint `opts` is unused func (c *realControl) finishGracePeriod(pod *v1.Pod, opts *UpdateOptions) (time.Duration, error) { var delayDuration time.Duration err := retry.RetryOnConflict(retry.DefaultBackoff, func() error { @@ -204,6 +207,7 @@ func (c *realControl) finishGracePeriod(pod *v1.Pod, opts *UpdateOptions) (time. return delayDuration, err } +// nolint `opts` is unused func (c *realControl) updatePodInPlace(pod *v1.Pod, spec *update.UpdateSpec, opts *UpdateOptions) error { return retry.RetryOnConflict(retry.DefaultBackoff, func() error { clone, err := c.adp.GetPod(pod.Namespace, pod.Name) diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/update/inplaceupdate/types.go b/bcs-runtime/bcs-k8s/kubernetes/common/update/inplaceupdate/types.go index dd0eb948d4..c70815144f 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/update/inplaceupdate/types.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/update/inplaceupdate/types.go @@ -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 inplaceupdate @@ -35,6 +34,7 @@ const ( ) // InPlaceUpdateState records latest inplace-update state, including old statuses of containers. +// nolint type InPlaceUpdateState struct { // Revision is the updated revision hash. Revision string `json:"revision"` @@ -49,11 +49,13 @@ type InPlaceUpdateState struct { // InPlaceUpdateContainerStatus records the statuses of the container that are mainly used // to determine whether the InPlaceUpdate is completed. +// nolint type InPlaceUpdateContainerStatus struct { ImageID string `json:"imageID,omitempty"` } // InPlaceUpdateStrategy defines the strategies for in-place update. +// nolint type InPlaceUpdateStrategy struct { // GracePeriodSeconds is the timespan between set Pod status to not-ready and update images in Pod spec // when in-place update a Pod. diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/update/utils.go b/bcs-runtime/bcs-k8s/kubernetes/common/update/utils.go index dd3ac0e731..f1683cea5d 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/update/utils.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/update/utils.go @@ -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 update @@ -21,13 +20,14 @@ import ( "github.com/mattbaird/jsonpatch" apps "k8s.io/api/apps/v1" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/util/strategicpatch" ) var inPlaceUpdatePatchRexp = regexp.MustCompile("^/spec/containers/([0-9]+)/image$") // UpdateSpec records the images of containers which need to in-place update. +// nolint type UpdateSpec struct { Revision string `json:"revision"` Annotations map[string]string `json:"annotations,omitempty"` @@ -40,7 +40,7 @@ type UpdateSpec struct { NewTemplate *v1.PodTemplateSpec `json:"newTemplate,omitempty"` } -// calculateInPlaceUpdateSpec calculates diff between old and update revisions. +// CalculateInPlaceUpdateSpec calculates diff between old and update revisions. // If the diff just contains replace operation of spec.containers[x].image, it will returns an UpdateSpec. // Otherwise, it returns nil which means can not use in-place update. func CalculateInPlaceUpdateSpec(oldRevision, newRevision *apps.ControllerRevision) *UpdateSpec { diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/util/diff/diff.go b/bcs-runtime/bcs-k8s/kubernetes/common/util/diff/diff.go index 670e83f70e..710f7747e3 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/util/diff/diff.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/util/diff/diff.go @@ -8,16 +8,18 @@ * 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 diff xxx package diff import ( "encoding/json" + "k8s.io/apimachinery/pkg/util/strategicpatch" ) +// CreateTwoWayMergePatch xxx func CreateTwoWayMergePatch(orig, new, dataStruct interface{}) ([]byte, bool, error) { origBytes, err := json.Marshal(orig) if err != nil { diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/util/hook/filter.go b/bcs-runtime/bcs-k8s/kubernetes/common/util/hook/filter.go index f7cf9a1230..5b7d5d0dd8 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/util/hook/filter.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/util/hook/filter.go @@ -8,16 +8,18 @@ * 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 hook xxx package hook import ( hookv1alpha1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1" ) -func FilterHookRuns(hrs []*hookv1alpha1.HookRun, cond func(hr *hookv1alpha1.HookRun) bool) ([]*hookv1alpha1.HookRun, []*hookv1alpha1.HookRun) { +// FilterHookRuns xxx +func FilterHookRuns(hrs []*hookv1alpha1.HookRun, cond func(hr *hookv1alpha1.HookRun) bool) ( + []*hookv1alpha1.HookRun, []*hookv1alpha1.HookRun) { condTrue := []*hookv1alpha1.HookRun{} condFalse := []*hookv1alpha1.HookRun{} for _, hr := range hrs { @@ -33,6 +35,7 @@ func FilterHookRuns(hrs []*hookv1alpha1.HookRun, cond func(hr *hookv1alpha1.Hook return condTrue, condFalse } +// FilterHookRunsByName xxx func FilterHookRunsByName(hookRuns []*hookv1alpha1.HookRun, name string) *hookv1alpha1.HookRun { hookRunsByName, _ := FilterHookRuns(hookRuns, func(hr *hookv1alpha1.HookRun) bool { return hr.Name == name @@ -43,6 +46,7 @@ func FilterHookRunsByName(hookRuns []*hookv1alpha1.HookRun, name string) *hookv1 return nil } +// GetCurrentStepHookRun xxx func GetCurrentStepHookRun(currentHrs []*hookv1alpha1.HookRun) *hookv1alpha1.HookRun { for _, hr := range currentHrs { hookRunType, ok := hr.Labels[HookRunTypeLabel] @@ -53,6 +57,7 @@ func GetCurrentStepHookRun(currentHrs []*hookv1alpha1.HookRun) *hookv1alpha1.Hoo return nil } +// FilterHookRunsToDelete xxx func FilterHookRunsToDelete(hrs []*hookv1alpha1.HookRun, revision string) []*hookv1alpha1.HookRun { hrsToDelete := []*hookv1alpha1.HookRun{} for _, hr := range hrs { @@ -64,6 +69,7 @@ func FilterHookRunsToDelete(hrs []*hookv1alpha1.HookRun, revision string) []*hoo return hrsToDelete } +// FilterPreDeleteHookRuns xxx func FilterPreDeleteHookRuns(hrs []*hookv1alpha1.HookRun) []*hookv1alpha1.HookRun { preDeleteHookRuns := []*hookv1alpha1.HookRun{} for _, hr := range hrs { @@ -76,6 +82,7 @@ func FilterPreDeleteHookRuns(hrs []*hookv1alpha1.HookRun) []*hookv1alpha1.HookRu return preDeleteHookRuns } +// FilterPreInplaceHookRuns xxx func FilterPreInplaceHookRuns(hrs []*hookv1alpha1.HookRun) []*hookv1alpha1.HookRun { preInplaceHookRuns := []*hookv1alpha1.HookRun{} for _, hr := range hrs { diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/util/hook/hook.go b/bcs-runtime/bcs-k8s/kubernetes/common/util/hook/hook.go index b88a44b480..efebc328cf 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/util/hook/hook.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/util/hook/hook.go @@ -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 hook @@ -21,10 +20,11 @@ import ( "strconv" "strings" - hookv1alpha1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1" - tkexclientset "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1" k8serrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + hookv1alpha1 "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/apis/tkex/v1alpha1" + tkexclientset "github.com/Tencent/bk-bcs/bcs-runtime/bcs-k8s/kubernetes/common/bcs-hook/client/clientset/versioned/typed/tkex/v1alpha1" ) var defaultArgs = [...]string{"PodName", "PodNamespace", "PodIP", "PodContainer", "ModifiedContainer", "HostIP"} @@ -93,7 +93,7 @@ func NewHookRunFromTemplate(template *hookv1alpha1.HookTemplate, args []hookv1al // MergeArgs generates args for hookrun with hooktemplate's args func MergeArgs(incomingArgs, templateArgs []hookv1alpha1.Argument) ([]hookv1alpha1.Argument, error) { - newArgs := append(templateArgs[:0:0], templateArgs...) + newArgs := append(templateArgs[:0:0], templateArgs...) // nolint not assigned to the same slice for _, arg := range incomingArgs { i := findArg(arg.Name, newArgs) if i >= 0 && arg.Value != nil { diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/util/requeueduration/duration.go b/bcs-runtime/bcs-k8s/kubernetes/common/util/requeueduration/duration.go index 8f40dacc53..287c085905 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/util/requeueduration/duration.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/util/requeueduration/duration.go @@ -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 requeueduration xxx package requeueduration import ( @@ -23,6 +23,7 @@ type DurationStore struct { store sync.Map } +// Push xxx func (dm *DurationStore) Push(key string, newDuration time.Duration) { value, _ := dm.store.LoadOrStore(key, &Duration{}) requeueDuration, ok := value.(*Duration) @@ -33,6 +34,7 @@ func (dm *DurationStore) Push(key string, newDuration time.Duration) { requeueDuration.Update(newDuration) } +// Pop xxx func (dm *DurationStore) Pop(key string) time.Duration { value, ok := dm.store.Load(key) if !ok { @@ -52,6 +54,7 @@ type Duration struct { duration time.Duration } +// Update xxx func (rd *Duration) Update(newDuration time.Duration) { rd.Lock() defer rd.Unlock() @@ -62,6 +65,7 @@ func (rd *Duration) Update(newDuration time.Duration) { } } +// Get xxx func (rd *Duration) Get() time.Duration { rd.Lock() defer rd.Unlock() diff --git a/bcs-runtime/bcs-k8s/kubernetes/common/util/utils.go b/bcs-runtime/bcs-k8s/kubernetes/common/util/utils.go index 1a9d3a392d..b0c54c4721 100644 --- a/bcs-runtime/bcs-k8s/kubernetes/common/util/utils.go +++ b/bcs-runtime/bcs-k8s/kubernetes/common/util/utils.go @@ -8,14 +8,14 @@ * 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 util xxx package util import ( appsv1 "k8s.io/api/apps/v1" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/sets" ) diff --git a/bcs-services/bcs-bscp/.golangci.yml b/bcs-services/bcs-bscp/.golangci.yml index 6e5b5137ec..11a358ec22 100644 --- a/bcs-services/bcs-bscp/.golangci.yml +++ b/bcs-services/bcs-bscp/.golangci.yml @@ -8,6 +8,7 @@ run: - bcs-runtime/bcs-k8s/bcs-component/bcs-cc-agent - bcs-runtime/bcs-k8s/bcs-component/bcs-cpuset-device - .*/third_party/* + - test/* skip-files: - .*\.docs\.go$ - .*\.gen\.go$ diff --git a/bcs-services/bcs-bscp/cmd/data-service/service/upload_download.go b/bcs-services/bcs-bscp/cmd/data-service/service/upload_download.go index 7cc10d2d7b..c94a776674 100644 --- a/bcs-services/bcs-bscp/cmd/data-service/service/upload_download.go +++ b/bcs-services/bcs-bscp/cmd/data-service/service/upload_download.go @@ -188,7 +188,7 @@ func (s *Service) getTmplVariables(kt *kit.Kit, tmplRevisions []*table.TemplateR vars, err := s.repo.GetVariables(k, r.Spec.ContentSpec.Signature, false) if err != nil { hitError = fmt.Errorf("get template config variables from repo failed, "+ - "template id: %d, name: %s, path: %s, error: %v", + "template id: %d, name: %s, path: %s, error: %v", // nolint goconst r.Attachment.TemplateID, r.Spec.Name, r.Spec.Path, err) return } @@ -232,7 +232,7 @@ func (s *Service) getCIVariables(kt *kit.Kit, cis []*pbci.ConfigItem) ([][]strin vars, err := s.repo.GetVariables(k, c.CommitSpec.Content.Signature, false) if err != nil { hitError = fmt.Errorf("get config item variables from repo failed, "+ - "config item id: %d, name: %s, path: %s, error: %v", + "config item id: %d, name: %s, path: %s, error: %v", // nolint goconst c.Id, c.Spec.Name, c.Spec.Path, err) return } diff --git a/bcs-services/bcs-bscp/cmd/vault-server/vault-plugins/service/path_kv_encrypt.go b/bcs-services/bcs-bscp/cmd/vault-server/vault-plugins/service/path_kv_encrypt.go index 3e4a3a19c4..c9837f3c81 100644 --- a/bcs-services/bcs-bscp/cmd/vault-server/vault-plugins/service/path_kv_encrypt.go +++ b/bcs-services/bcs-bscp/cmd/vault-server/vault-plugins/service/path_kv_encrypt.go @@ -25,7 +25,7 @@ import ( func (b *backend) pathKvEncrypt() *framework.Path { return &framework.Path{ - Pattern: "apps/" + framework.GenericNameRegex("app_id") + "/kvs/" + + Pattern: "apps/" + framework.GenericNameRegex("app_id") + "/kvs/" + // nolint goconst framework.GenericNameRegex("name") + "/encrypt", Fields: map[string]*framework.FieldSchema{ "app_id": { diff --git a/bcs-services/bcs-bscp/cmd/vault-server/vault/main.go b/bcs-services/bcs-bscp/cmd/vault-server/vault/main.go index c0dea5a081..28300f0b20 100644 --- a/bcs-services/bcs-bscp/cmd/vault-server/vault/main.go +++ b/bcs-services/bcs-bscp/cmd/vault-server/vault/main.go @@ -10,6 +10,7 @@ * limitations under the License. */ +// Package main xxx package main import ( diff --git a/bcs-services/bcs-bscp/pkg/criteria/validator/id.go b/bcs-services/bcs-bscp/pkg/criteria/validator/id.go index 6d4b8e8533..398fc8e62f 100644 --- a/bcs-services/bcs-bscp/pkg/criteria/validator/id.go +++ b/bcs-services/bcs-bscp/pkg/criteria/validator/id.go @@ -19,7 +19,7 @@ import ( ) const ( - qualifiedUidFmt string = "(" + qnameExtUidFmt + qnameExtUidSuffix + "*)?" + qnameExtUidFmt + qualifiedUidFmt string = "(" + qnameExtUidFmt + qnameExtUidSuffix + "*)?" + qnameExtUidFmt // nolint goconst qnameExtUidFmt string = "[A-Za-z0-9]" qnameExtUidSuffix string = "[A-Za-z0-9-_:]" ) diff --git a/bcs-services/bcs-bscp/pkg/dal/dao/app.go b/bcs-services/bcs-bscp/pkg/dal/dao/app.go index c0f98a0409..54c19d42de 100644 --- a/bcs-services/bcs-bscp/pkg/dal/dao/app.go +++ b/bcs-services/bcs-bscp/pkg/dal/dao/app.go @@ -186,7 +186,7 @@ func (dao *appDao) Create(kit *kit.Kit, g *table.App) (uint32, error) { } if err = eDecorator.Fire(one); err != nil { logs.Errorf("fire create app: %s event failed, err: %v, rid: %s", g.ID, err, kit.Rid) - return errors.New("fire event failed, " + err.Error()) + return errors.New("fire event failed, " + err.Error()) // nolint goconst } return nil diff --git a/bcs-services/bcs-bscp/pkg/dal/vault/kv.go b/bcs-services/bcs-bscp/pkg/dal/vault/kv.go index edbf167e91..dcb1bc866e 100644 --- a/bcs-services/bcs-bscp/pkg/dal/vault/kv.go +++ b/bcs-services/bcs-bscp/pkg/dal/vault/kv.go @@ -63,6 +63,7 @@ func (s *set) GetLastKv(kit *kit.Kit, opt *types.GetLastKvOpt) (kvType table.Dat kvTypeStr, ok := kv.Data["kv_type"].(string) if !ok { + // nolint goconst return "", "", fmt.Errorf("failed to get 'kv_type' as a string from kv.Data,"+ " err : %v", err) } diff --git a/bcs-services/bcs-bscp/pkg/logs/glog/glog.go b/bcs-services/bcs-bscp/pkg/logs/glog/glog.go index cd9a3b1377..3da406a72e 100644 --- a/bcs-services/bcs-bscp/pkg/logs/glog/glog.go +++ b/bcs-services/bcs-bscp/pkg/logs/glog/glog.go @@ -677,10 +677,10 @@ func (l *loggingT) printf(s severity, format string, args ...interface{}) { // if log content <= LineMaxSize, not need to handle. logContentLen := uint32(len(logContent)) if logContentLen <= LineMaxSize() { - fmt.Fprintf(buf, logContent) + fmt.Fprint(buf, logContent) } else { halfLineMaxSize := LineMaxSize() / 2 - fmt.Fprintf(buf, logContent[:halfLineMaxSize]+lineWrapStandard+logContent[logContentLen-halfLineMaxSize:]) + fmt.Fprint(buf, logContent[:halfLineMaxSize]+lineWrapStandard+logContent[logContentLen-halfLineMaxSize:]) } if buf.Bytes()[buf.Len()-1] != '\n' { @@ -698,10 +698,10 @@ func (l *loggingT) printDepthf(s severity, format string, depth int, args ...int // if log content <= LineMaxSize, not need to handle. logContentLen := uint32(len(logContent)) if logContentLen <= LineMaxSize() { - fmt.Fprintf(buf, logContent) + fmt.Fprint(buf, logContent) } else { halfLineMaxSize := LineMaxSize() / 2 - fmt.Fprintf(buf, logContent[:halfLineMaxSize]+lineWrapStandard+logContent[logContentLen-halfLineMaxSize:]) + fmt.Fprint(buf, logContent[:halfLineMaxSize]+lineWrapStandard+logContent[logContentLen-halfLineMaxSize:]) } if buf.Bytes()[buf.Len()-1] != '\n' { @@ -732,19 +732,20 @@ func (l *loggingT) output(s severity, buf *buffer, file string, line int, alsoTo } data := buf.Bytes() if l.toStderr { - os.Stderr.Write(data) + os.Stderr.Write(data) // nolint error not checked } else { if alsoToStderr || l.alsoToStderr || s >= l.stderrThreshold.get() { - os.Stderr.Write(data) + os.Stderr.Write(data) // nolint error not checked } if l.file == nil { if err := l.createFiles(); err != nil { + // nolint error not checked os.Stderr.Write(data) // Make sure the message appears somewhere. l.exit(err) } } - l.file.Write(data) + l.file.Write(data) // nolint error not checked } if s == fatalLog { // If we got here via Exit rather than Fatal, print no stacks. @@ -758,14 +759,14 @@ func (l *loggingT) output(s severity, buf *buffer, file string, line int, alsoTo // If -logtostderr has been specified, the loop below will do that anyway // as the first stack in the full dump. if !l.toStderr { - os.Stderr.Write(stacks(false)) + os.Stderr.Write(stacks(false)) // nolint error not checked } // Write the stack trace for all goroutines to the files. trace := stacks(true) logExitFunc = func(error) {} // If we get a write error, we'll still exit below. for log := fatalLog; log >= infoLog; log-- { if l.file != nil { // Can be nil if -logtostderr is set. - l.file.Write(trace) + l.file.Write(trace) // nolint error not checked } } l.mu.Unlock() @@ -953,8 +954,8 @@ func (l *loggingT) lockAndFlushAll() { func (l *loggingT) flushAll() { // Flush from fatal down, in case there's trouble flushing. if l.file != nil { - l.file.Flush() // ignore error - l.file.Sync() // ignore error + l.file.Flush() // nolint error not checked ignore error + l.file.Sync() // nolint error not checked ignore error } } @@ -1016,7 +1017,7 @@ func (l *loggingT) setV(pc uintptr) Level { fn := runtime.FuncForPC(pc) file, _ := fn.FileLine(pc) // The file is something like /a/b/c/d.go. We want just the d. - if strings.HasSuffix(file, ".go") { + if strings.HasSuffix(file, ".go") { // nolint file = file[:len(file)-3] } if slash := strings.LastIndex(file, "/"); slash >= 0 { diff --git a/bcs-services/bcs-bscp/pkg/logs/glog/glog_file.go b/bcs-services/bcs-bscp/pkg/logs/glog/glog_file.go index 1e4f55142b..88b8c0171f 100644 --- a/bcs-services/bcs-bscp/pkg/logs/glog/glog_file.go +++ b/bcs-services/bcs-bscp/pkg/logs/glog/glog_file.go @@ -33,7 +33,6 @@ package glog import ( "errors" "fmt" - "io/ioutil" "os" "os/user" "path/filepath" @@ -115,6 +114,7 @@ type logKeeper struct { total int } +// nolint result `ok` is always `false` func (lk *logKeeper) add(newBlock *fileBlock) (ok bool) { block := lk.tail if block == nil { @@ -133,6 +133,7 @@ func (lk *logKeeper) add(newBlock *fileBlock) (ok bool) { return ok } +// nolint result `ok` is always `false` func (lk *logKeeper) remove() (ok bool) { if lk.header == nil || lk.total == 0 { return @@ -152,7 +153,7 @@ func (lk *logKeeper) removeFile(name string) error { } func (lk *logKeeper) load() { - _dir, err := ioutil.ReadDir(lk.dir) + _dir, err := os.ReadDir(lk.dir) if err != nil { return } @@ -237,7 +238,7 @@ func init() { } // Sanitize userName since it may contain filepath separators on Windows. - userName = strings.Replace(userName, `\`, "_", -1) + userName = strings.ReplaceAll(userName, `\`, "_") } // shortHostname returns its argument, truncating at the first period. @@ -330,7 +331,7 @@ func create(t time.Time) (f *os.File, filename string, filesize uint32, err erro } if !needCreate { - return + return // nolint naked return } fname := filepath.Join(lk.dir, name) diff --git a/bcs-services/bcs-bscp/pkg/logs/glog/glog_method.go b/bcs-services/bcs-bscp/pkg/logs/glog/glog_method.go index dc85ac5f51..4fce1c5b48 100644 --- a/bcs-services/bcs-bscp/pkg/logs/glog/glog_method.go +++ b/bcs-services/bcs-bscp/pkg/logs/glog/glog_method.go @@ -35,7 +35,7 @@ import ( // SetV set the level of logging. func SetV(level Level) { - logging.verbosity.Set(strconv.Itoa(int(level))) + logging.verbosity.Set(strconv.Itoa(int(level))) // nolint error not checked } // GetV get the level of logging. @@ -51,10 +51,10 @@ func InitLogs(toStderr, alsoToStderr, restartScrolling bool, verbose int32, stdE once.Do(func() { logging.toStderr = toStderr logging.alsoToStderr = alsoToStderr - logging.verbosity.Set(strconv.Itoa(int(verbose))) - logging.stderrThreshold.Set(stdErrThreshold) - logging.vmodule.Set(vModule) - logging.traceLocation.Set(traceLocation) + logging.verbosity.Set(strconv.Itoa(int(verbose))) // nolint error not checked + logging.stderrThreshold.Set(stdErrThreshold) // nolint error not checked + logging.vmodule.Set(vModule) // nolint error not checked + logging.traceLocation.Set(traceLocation) // nolint error not checked logNoScrolling = restartScrolling lineMaxSize = maxLineSize * 1024 diff --git a/bcs-services/bcs-bscp/test/benchmark/case/api-server/repo.go b/bcs-services/bcs-bscp/test/benchmark/case/api-server/repo.go index 8613e50e71..e6178f98a4 100644 --- a/bcs-services/bcs-bscp/test/benchmark/case/api-server/repo.go +++ b/bcs-services/bcs-bscp/test/benchmark/case/api-server/repo.go @@ -10,6 +10,7 @@ * limitations under the License. */ +// Package main xxx package main import ( @@ -29,7 +30,8 @@ import ( ) // dd if=/dev/urandom of=/tmp/100Mib.bin bs=1M count=100 -func upload(ctx context.Context, host string, bizID, appID string, sign string, body io.Reader) (*http.Response, error) { +func upload( + ctx context.Context, host string, bizID, appID string, sign string, body io.Reader) (*http.Response, error) { u := fmt.Sprintf("http://%s/api/v1/api/create/content/upload/biz_id/%s/app_id/%s", host, bizID, appID) req, err := http.NewRequestWithContext(ctx, "PUT", u, body) if err != nil { @@ -53,7 +55,9 @@ func upload(ctx context.Context, host string, bizID, appID string, sign string, return resp, nil } -func download(ctx context.Context, host string, bizID, appID string, sign string, body io.Reader) (*http.Response, error) { +// nolint unused +func download( + ctx context.Context, host string, bizID, appID string, sign string, body io.Reader) (*http.Response, error) { u := fmt.Sprintf("http://%s/api/v1/api/get/content/download/biz_id/%s/app_id/%s", host, bizID, appID) req, err := http.NewRequestWithContext(ctx, "GET", u, nil) if err != nil { diff --git a/bcs-services/bcs-bscp/test/benchmark/run/limiter.go b/bcs-services/bcs-bscp/test/benchmark/run/limiter.go index f63b56d835..cfb07e33e8 100644 --- a/bcs-services/bcs-bscp/test/benchmark/run/limiter.go +++ b/bcs-services/bcs-bscp/test/benchmark/run/limiter.go @@ -56,7 +56,5 @@ func (sl *Limiter) Execute(ch chan<- *Status, f func() error) { s.Error = f() s.CostDuration = time.Since(start) ch <- s - return }() - return } diff --git a/bcs-services/bcs-bscp/test/benchmark/run/reporter.go b/bcs-services/bcs-bscp/test/benchmark/run/reporter.go index 3688d92881..8ae1d35806 100644 --- a/bcs-services/bcs-bscp/test/benchmark/run/reporter.go +++ b/bcs-services/bcs-bscp/test/benchmark/run/reporter.go @@ -58,7 +58,7 @@ func (a *Reporter) GenReport(path string) error { write := bufio.NewWriter(outFile) tp.render(write, reporter.Data) - write.Flush() + write.Flush() // nolint error not checked return nil } diff --git a/bcs-services/bcs-bscp/test/benchmark/run/run.go b/bcs-services/bcs-bscp/test/benchmark/run/run.go index b5d8a75a90..c26c9adc76 100644 --- a/bcs-services/bcs-bscp/test/benchmark/run/run.go +++ b/bcs-services/bcs-bscp/test/benchmark/run/run.go @@ -39,7 +39,7 @@ func FireLoadTest(f func() error) Metrics { timeout := make(chan bool) if TotalRequest == 0 { go func() { - select { + select { // nolint case <-time.After(time.Duration(SustainSeconds) * time.Second): close(timeout) } diff --git a/bcs-services/bcs-bscp/test/benchmark/run/stats.go b/bcs-services/bcs-bscp/test/benchmark/run/stats.go index da0ff68178..b3cbe6c8ec 100644 --- a/bcs-services/bcs-bscp/test/benchmark/run/stats.go +++ b/bcs-services/bcs-bscp/test/benchmark/run/stats.go @@ -148,7 +148,7 @@ func (s *Statistic) CalculateMetrics() Metrics { var m Metrics m.SustainSeconds = s.SustainSecond m.Concurrent = s.Concurrent - m.QPS = float64(float64(len(s.Values)) / s.SustainSecond) + m.QPS = float64(len(s.Values)) / s.SustainSecond m.MaxDuration = s.MaxCostDuration m.MinDuration = s.MinCostDuration diff --git a/bcs-services/bcs-bscp/test/mock/repo/app/app.go b/bcs-services/bcs-bscp/test/mock/repo/app/app.go index 749a2af1f4..12af2146b5 100644 --- a/bcs-services/bcs-bscp/test/mock/repo/app/app.go +++ b/bcs-services/bcs-bscp/test/mock/repo/app/app.go @@ -93,7 +93,7 @@ func (rp *repoMock) listenAndServe() error { go func() { notifier := shutdown.AddNotifier() - select { + select { // nolint case <-notifier.Signal: defer notifier.Done() @@ -140,5 +140,4 @@ func (rp *repoMock) listenAndServe() error { } func (rp *repoMock) finalizer() { - return } diff --git a/bcs-services/bcs-bscp/test/mock/repo/repo_mock.go b/bcs-services/bcs-bscp/test/mock/repo/repo_mock.go index db92a7b9ae..a551957f20 100644 --- a/bcs-services/bcs-bscp/test/mock/repo/repo_mock.go +++ b/bcs-services/bcs-bscp/test/mock/repo/repo_mock.go @@ -10,6 +10,7 @@ * limitations under the License. */ +// Package main xxx package main import ( diff --git a/bcs-services/bcs-bscp/test/mock/repo/service/repo.go b/bcs-services/bcs-bscp/test/mock/repo/service/repo.go index 1b0dee1d26..8cc548f779 100644 --- a/bcs-services/bcs-bscp/test/mock/repo/service/repo.go +++ b/bcs-services/bcs-bscp/test/mock/repo/service/repo.go @@ -42,5 +42,4 @@ func (s *Service) createRepo(w http.ResponseWriter, r *http.Request) { } resp.WriteResp(w, nil) - return } diff --git a/bcs-services/bcs-bscp/test/mock/repo/service/types.go b/bcs-services/bcs-bscp/test/mock/repo/service/types.go index 5ba681e31b..7b3c79a224 100644 --- a/bcs-services/bcs-bscp/test/mock/repo/service/types.go +++ b/bcs-services/bcs-bscp/test/mock/repo/service/types.go @@ -49,7 +49,6 @@ func (r *BaseResp) Err(w http.ResponseWriter, err error) { w.WriteHeader(http.StatusInternalServerError) w.Write(marshal) - return } // WriteResp write base repo to ResponseWriter with result data. @@ -63,7 +62,6 @@ func (r *BaseResp) WriteResp(w http.ResponseWriter, data interface{}) { } w.Write(marshal) - return } func unmarshal(body io.ReadCloser, data interface{}) error { diff --git a/bcs-services/bcs-bscp/test/suite/tools/statistics.go b/bcs-services/bcs-bscp/test/suite/tools/statistics.go index 088c7c9ac1..72dd49d865 100644 --- a/bcs-services/bcs-bscp/test/suite/tools/statistics.go +++ b/bcs-services/bcs-bscp/test/suite/tools/statistics.go @@ -65,7 +65,7 @@ func statisticsResult(one *Result) *StatisticalResults { continue } - failedMap[line].Total = failedMap[line].Total + 1 + failedMap[line].Total++ } } @@ -125,7 +125,7 @@ func getResultFromContent(content string) ([]*Result, error) { } if one[len(one)-1] != '}' { - one = one + "}" + one += "}" } r := new(Result) @@ -215,6 +215,6 @@ func compressStr(str, err string) string { return "" + err } - reg := regexp.MustCompile("\\s+") + reg := regexp.MustCompile("\\s+") // nolint return reg.ReplaceAllString(str, " ") + err } diff --git a/bcs-services/bcs-bscp/test/suite/tools/template.go b/bcs-services/bcs-bscp/test/suite/tools/template.go index a08196f6f8..4d2d0dcc35 100644 --- a/bcs-services/bcs-bscp/test/suite/tools/template.go +++ b/bcs-services/bcs-bscp/test/suite/tools/template.go @@ -33,7 +33,7 @@ func init() { } func (t defaultTemplate) render(wr io.Writer, results []*StatisticalResults) { - t.engine.Execute(wr, map[string][]*StatisticalResults{ + t.engine.Execute(wr, map[string][]*StatisticalResults{ // nolint error not checked "Results": results, }) } diff --git a/bcs-services/bcs-bscp/test/suite/tools/tool.go b/bcs-services/bcs-bscp/test/suite/tools/tool.go index 4ef54047d3..49044bf221 100644 --- a/bcs-services/bcs-bscp/test/suite/tools/tool.go +++ b/bcs-services/bcs-bscp/test/suite/tools/tool.go @@ -50,12 +50,10 @@ func main() { results, err := statistics(path) if err != nil { - log.Fatalln(err) + log.Fatalln(err) // nolint } tp.render(write, results) - write.Flush() + write.Flush() // nolint error not checked } - - return } diff --git a/bcs-services/bcs-bscp/test/unit/logs.go b/bcs-services/bcs-bscp/test/unit/logs.go index e6824f6e6b..81be3ed3b2 100644 --- a/bcs-services/bcs-bscp/test/unit/logs.go +++ b/bcs-services/bcs-bscp/test/unit/logs.go @@ -10,6 +10,7 @@ * limitations under the License. */ +// Package unit xxx package unit import ( @@ -24,7 +25,7 @@ const DefaultTestLogDir = "./log" // InitTestLogOptions init logs, if log dir not exist, will to create dir. func InitTestLogOptions(logDir string) { // ignore error, if log dir create failed, logs will use tmp dir to save log file. - os.MkdirAll(logDir, os.ModePerm) + os.MkdirAll(logDir, os.ModePerm) // nolint error not checked logs.InitLogger( logs.LogConfig{ diff --git a/bcs-services/bcs-cluster-reporter/cmd/options/options.go b/bcs-services/bcs-cluster-reporter/cmd/options/options.go index 26692f405f..59813894bb 100644 --- a/bcs-services/bcs-cluster-reporter/cmd/options/options.go +++ b/bcs-services/bcs-cluster-reporter/cmd/options/options.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-services/bcs-cluster-reporter/cmd/root.go b/bcs-services/bcs-cluster-reporter/cmd/root.go index 0be22d3da3..fdb051365b 100644 --- a/bcs-services/bcs-cluster-reporter/cmd/root.go +++ b/bcs-services/bcs-cluster-reporter/cmd/root.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -27,12 +27,6 @@ import ( "time" cmproto "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-manager/api/clustermanager" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/cmd/options" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/api/bcs" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/k8s" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/metric_manager" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/plugin_manager" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/util" "github.com/spf13/cobra" "github.com/spf13/viper" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -41,6 +35,13 @@ import ( "k8s.io/client-go/tools/leaderelection" "k8s.io/client-go/tools/leaderelection/resourcelock" "k8s.io/klog" + + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/cmd/options" + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/api/bcs" + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/k8s" + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/metric_manager" + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/plugin_manager" + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/util" ) var ( @@ -131,7 +132,7 @@ func Run() error { <-signalChan // stop plugins klog.Infof("start to shutdown bcs-cluster-reporter") - pprof.Lookup("heap").WriteTo(os.Stdout, 1) + pprof.Lookup("heap").WriteTo(os.Stdout, 1) // nolint cancel() return nil @@ -192,7 +193,8 @@ func Complete(cmd *cobra.Command, args []string) error { if bcro.BcsClusterManagerToken == "" || bcro.BcsClusterManagerApiserver == "" || bcro.BcsGatewayApiserver == "" || bcro.BcsGatewayToken == "" { return fmt.Errorf( - "bcs config missing, BcsClusterManagerToken, BcsClusterManagerApiserver, BcsGatewayApiserver, BcsGatewayToken must be set") + "bcs config missing, BcsClusterManagerToken, BcsClusterManagerApiserver, BcsGatewayApiserver, " + + "BcsGatewayToken must be set") } bcro.BcsClusterManagerToken = util.Decode(bcro.BcsClusterManagerToken) bcro.BcsGatewayToken = util.Decode(bcro.BcsGatewayToken) @@ -235,6 +237,7 @@ func init() { // configure viper to read config func initConfig() {} +// nolint funlen func getClusters() { clusterConfigList := make([]plugin_manager.ClusterConfig, 0, 0) diff --git a/bcs-services/bcs-cluster-reporter/internal/api/bcs/cluster.go b/bcs-services/bcs-cluster-reporter/internal/api/bcs/cluster.go index 5163fce4cb..912b5cab25 100644 --- a/bcs-services/bcs-cluster-reporter/internal/api/bcs/cluster.go +++ b/bcs-services/bcs-cluster-reporter/internal/api/bcs/cluster.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -23,9 +23,10 @@ import ( "time" cmproto "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-manager/api/clustermanager" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/rest" k8srest "k8s.io/client-go/rest" "k8s.io/klog/v2" + + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/rest" ) // GetClusters get clustermanager clusters by ids @@ -45,7 +46,7 @@ func (cm *ClusterManager) GetClusters(clusterIds []string) ([]cmproto.Cluster, e clusterIds = append(clusterIds, "") } - resultList := make([]cmproto.Cluster, 0, 0) + resultList := make([]cmproto.Cluster, 0) for _, clusterId := range clusterIds { svcUrl, _ := url.Parse(cm.url + _urlMap["GetClusters"]) if clusterId != "" { @@ -71,7 +72,7 @@ func (cm *ClusterManager) GetClusters(clusterIds []string) ([]cmproto.Cluster, e } clusterData, _ := json.Marshal(result.Data) - clusterList := make([]cmproto.Cluster, 0, 0) + clusterList := make([]cmproto.Cluster, 0) err = json.Unmarshal(clusterData, &clusterList) if err != nil { cluster := cmproto.Cluster{} @@ -123,7 +124,7 @@ func (cm *ClusterManager) GetNodesByClusterId(clusterId string) ([]cmproto.Node, } nodeData, _ := json.Marshal(result.Data) - nodeList := make([]cmproto.Node, 0, 0) + nodeList := make([]cmproto.Node, 0) err = json.Unmarshal(nodeData, &nodeList) if err != nil { e := fmt.Errorf("unmarshal cluster response failed %s", err.Error()) @@ -165,7 +166,7 @@ func (cm *ClusterManager) GetNode(ip string) (*cmproto.Node, error) { } nodeData, _ := json.Marshal(result.Data) - nodeList := make([]cmproto.Node, 0, 0) + nodeList := make([]cmproto.Node, 0) err = json.Unmarshal(nodeData, &nodeList) if err != nil { e := fmt.Errorf("Unmarshal getnode response failed %s", err.Error()) diff --git a/bcs-services/bcs-cluster-reporter/internal/api/bcs/clustermanager.go b/bcs-services/bcs-cluster-reporter/internal/api/bcs/clustermanager.go index faae4cb98b..0cc2a1d1a1 100644 --- a/bcs-services/bcs-cluster-reporter/internal/api/bcs/clustermanager.go +++ b/bcs-services/bcs-cluster-reporter/internal/api/bcs/clustermanager.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -36,6 +36,7 @@ func NewClusterManager(token, apiserver, apiGatewayUrl, apiGatewayToken string) } // BcsTransport client +// nolint type BcsTransport struct { token string } @@ -51,7 +52,7 @@ func (t *BcsTransport) RoundTrip(req *http.Request) (*http.Response, error) { tr := &http.Transport{ TLSClientConfig: &tls.Config{ // NOCC:gas/tls(设计如此) - InsecureSkipVerify: true, // 设置为 true 来禁用证书验证 nolint + InsecureSkipVerify: true, // nolint 设置为 true 来禁用证书验证 }, } diff --git a/bcs-services/bcs-cluster-reporter/internal/k8s/get.go b/bcs-services/bcs-cluster-reporter/internal/k8s/get.go index a20c8789aa..9dbe32f510 100644 --- a/bcs-services/bcs-cluster-reporter/internal/k8s/get.go +++ b/bcs-services/bcs-cluster-reporter/internal/k8s/get.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-services/bcs-cluster-reporter/internal/k8s/init.go b/bcs-services/bcs-cluster-reporter/internal/k8s/init.go index d602b8398d..532b13f160 100644 --- a/bcs-services/bcs-cluster-reporter/internal/k8s/init.go +++ b/bcs-services/bcs-cluster-reporter/internal/k8s/init.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-services/bcs-cluster-reporter/internal/k8s/pod.go b/bcs-services/bcs-cluster-reporter/internal/k8s/pod.go index d39bb74884..b2576b250a 100644 --- a/bcs-services/bcs-cluster-reporter/internal/k8s/pod.go +++ b/bcs-services/bcs-cluster-reporter/internal/k8s/pod.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -35,7 +35,7 @@ func GetPods(clientSet *kubernetes.Clientset, namespace string, opts v1.ListOpti return podList.Items, nil } re, _ := regexp.Compile(nameRe) - result := make([]corev1.Pod, 0, 0) + result := make([]corev1.Pod, 0) for _, pod := range podList.Items { if re.MatchString(pod.Name) || strings.Contains(pod.Name, nameRe) { result = append(result, pod) diff --git a/bcs-services/bcs-cluster-reporter/internal/metric_manager/metric.go b/bcs-services/bcs-cluster-reporter/internal/metric_manager/metric.go index 8b3f07a67c..3b1814b650 100644 --- a/bcs-services/bcs-cluster-reporter/internal/metric_manager/metric.go +++ b/bcs-services/bcs-cluster-reporter/internal/metric_manager/metric.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-services/bcs-cluster-reporter/internal/metric_manager/metric_test.go b/bcs-services/bcs-cluster-reporter/internal/metric_manager/metric_test.go index 8087b8a969..1439a77475 100644 --- a/bcs-services/bcs-cluster-reporter/internal/metric_manager/metric_test.go +++ b/bcs-services/bcs-cluster-reporter/internal/metric_manager/metric_test.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-services/bcs-cluster-reporter/internal/plugin/clustercheck/clustercheck.go b/bcs-services/bcs-cluster-reporter/internal/plugin/clustercheck/clustercheck.go index a75776bbc7..eee37c2f3c 100644 --- a/bcs-services/bcs-cluster-reporter/internal/plugin/clustercheck/clustercheck.go +++ b/bcs-services/bcs-cluster-reporter/internal/plugin/clustercheck/clustercheck.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -22,12 +22,6 @@ import ( "sync" "time" - "k8s.io/client-go/kubernetes" - - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/k8s" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/metric_manager" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/plugin_manager" - "github.com/prometheus/client_golang/prometheus" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -35,9 +29,14 @@ import ( "k8s.io/apimachinery/pkg/util/json" "k8s.io/apimachinery/pkg/util/yaml" "k8s.io/client-go/dynamic" + "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "k8s.io/client-go/restmapper" "k8s.io/klog" + + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/k8s" + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/metric_manager" + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/plugin_manager" ) const ( @@ -49,7 +48,7 @@ type Plugin struct { stopChan chan int opt *Options checkLock sync.Mutex - testYamlString string + testYamlString string // nolint unused } var ( @@ -105,11 +104,11 @@ func (p *Plugin) Setup(configFilePath string) error { objectMap := unstructuredObj.Object updateNestedMap(objectMap, []string{"spec", "template", "metadata", "labels", "bcs-cluster-reporter"}, "bcs-cluster-reporter") - //updateNestedMap(objectMap, []string{"spec", "selector", "matchLabels", "bcs-cluster-reporter"}, + // updateNestedMap(objectMap, []string{"spec", "selector", "matchLabels", "bcs-cluster-reporter"}, // "bcs-cluster-reporter") - //updateNestedMap(objectMap, []string{"spec", "selector", "matchLabels", "bcs-cluster-reporter"}, + // updateNestedMap(objectMap, []string{"spec", "selector", "matchLabels", "bcs-cluster-reporter"}, // "bcs-cluster-reporter") - //klog.Info(objectMap) + // klog.Info(objectMap) unstructuredObj.SetUnstructuredContent(objectMap) default: klog.Fatalf("workload %s type is %s, not supported, please use job, deployment, replicaset", @@ -160,6 +159,7 @@ func (p *Plugin) Name() string { func int64Ptr(i int64) *int64 { return &i } // Check xxx +// nolint funlen func (p *Plugin) Check() { start := time.Now() p.checkLock.Lock() @@ -282,6 +282,7 @@ func (p *Plugin) Check() { } // test ClusterByCreateUnstructuredObj +// nolint funlen func testClusterByCreateUnstructuredObj(unstructuredObj *unstructured.Unstructured, config *rest.Config, status *string, interval int, clusterID string) ( workloadToScheduleCost, workloadToPodCost, worloadToRunningCost time.Duration, err error) { @@ -531,7 +532,8 @@ func getWatchStatus(clientSet *kubernetes.Clientset, clusterUnstructuredObj *uns } // get Pod Life Cycle Time Point -func getPodLifeCycleTimePoint(pod *v1.Pod, createStartTime time.Time) (workloadToScheduleCost, worloadToRunningCost time.Duration) { +func getPodLifeCycleTimePoint( + pod *v1.Pod, createStartTime time.Time) (workloadToScheduleCost, worloadToRunningCost time.Duration) { workloadToScheduleCost = 0 worloadToRunningCost = 0 for _, condition := range pod.Status.Conditions { diff --git a/bcs-services/bcs-cluster-reporter/internal/plugin/clustercheck/init.go b/bcs-services/bcs-cluster-reporter/internal/plugin/clustercheck/init.go index 32f4a0ca9c..3078016e38 100644 --- a/bcs-services/bcs-cluster-reporter/internal/plugin/clustercheck/init.go +++ b/bcs-services/bcs-cluster-reporter/internal/plugin/clustercheck/init.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-services/bcs-cluster-reporter/internal/plugin/clustercheck/options.go b/bcs-services/bcs-cluster-reporter/internal/plugin/clustercheck/options.go index 2144867240..d53df601a5 100644 --- a/bcs-services/bcs-cluster-reporter/internal/plugin/clustercheck/options.go +++ b/bcs-services/bcs-cluster-reporter/internal/plugin/clustercheck/options.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-services/bcs-cluster-reporter/internal/plugin/dnscheck/dnscheck.go b/bcs-services/bcs-cluster-reporter/internal/plugin/dnscheck/dnscheck.go index fd6a6163af..bd06c9a19c 100644 --- a/bcs-services/bcs-cluster-reporter/internal/plugin/dnscheck/dnscheck.go +++ b/bcs-services/bcs-cluster-reporter/internal/plugin/dnscheck/dnscheck.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -22,16 +22,16 @@ import ( "sync" "time" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/k8s" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/metric_manager" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/plugin_manager" - "github.com/prometheus/client_golang/prometheus" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/json" "k8s.io/apimachinery/pkg/util/yaml" "k8s.io/client-go/kubernetes" "k8s.io/klog" + + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/k8s" + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/metric_manager" + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/plugin_manager" ) // Plugin xxx @@ -175,7 +175,7 @@ func (p *Plugin) checkDNSEndpoints(ctx context.Context, domainList []string) { select { case <-ctx.Done(): klog.Infof("Stop checkDNSEndpoints") - break + break // nolint ineffective break statement default: status := "ok" @@ -185,7 +185,7 @@ func (p *Plugin) checkDNSEndpoints(ctx context.Context, domainList []string) { status = "getepfailed" } - ipList := make([]string, 0, 0) + ipList := make([]string, 0) for _, subset := range ep.Subsets { for _, address := range subset.Addresses { ipList = append(ipList, address.IP) diff --git a/bcs-services/bcs-cluster-reporter/internal/plugin/dnscheck/init.go b/bcs-services/bcs-cluster-reporter/internal/plugin/dnscheck/init.go index 3dbc255057..f30fa2efee 100644 --- a/bcs-services/bcs-cluster-reporter/internal/plugin/dnscheck/init.go +++ b/bcs-services/bcs-cluster-reporter/internal/plugin/dnscheck/init.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-services/bcs-cluster-reporter/internal/plugin/dnscheck/options.go b/bcs-services/bcs-cluster-reporter/internal/plugin/dnscheck/options.go index 699bb17d16..7d51e41c8b 100644 --- a/bcs-services/bcs-cluster-reporter/internal/plugin/dnscheck/options.go +++ b/bcs-services/bcs-cluster-reporter/internal/plugin/dnscheck/options.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-services/bcs-cluster-reporter/internal/plugin/eventrecorder/eventrecorder.go b/bcs-services/bcs-cluster-reporter/internal/plugin/eventrecorder/eventrecorder.go index 328bde961e..5cce5ea8f5 100644 --- a/bcs-services/bcs-cluster-reporter/internal/plugin/eventrecorder/eventrecorder.go +++ b/bcs-services/bcs-cluster-reporter/internal/plugin/eventrecorder/eventrecorder.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -21,10 +21,6 @@ import ( "sync" "time" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/k8s" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/metric_manager" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/plugin_manager" - "github.com/prometheus/client_golang/prometheus" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -32,6 +28,10 @@ import ( "k8s.io/client-go/informers" "k8s.io/client-go/tools/cache" "k8s.io/klog" + + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/k8s" + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/metric_manager" + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/plugin_manager" ) // Plugin xxx @@ -146,7 +146,7 @@ func (p *Plugin) Check() { } func flatten(data interface{}) []*metric_manager.GaugeVecSet { - result := make([]*metric_manager.GaugeVecSet, 0, 0) + result := make([]*metric_manager.GaugeVecSet, 0) if m, ok := data.(map[string]map[string]*metric_manager.GaugeVecSet); ok { for _, value := range m { @@ -183,7 +183,7 @@ func recordEvent(eventChecktGaugeVecSetMap map[string]map[string]*metric_manager klog.Fatalf("eventrecorder GetClientsetByConfig failed: %s", err.Error()) } - clientSet.CoreV1().Events(metav1.NamespaceAll).Watch(context.Background(), metav1.ListOptions{}) + clientSet.CoreV1().Events(metav1.NamespaceAll).Watch(context.Background(), metav1.ListOptions{}) // nolint factory := informers.NewSharedInformerFactoryWithOptions(clientSet, time.Second*60, informers.WithTweakListOptions(func(options *metav1.ListOptions) { options.ResourceVersion = "0" diff --git a/bcs-services/bcs-cluster-reporter/internal/plugin/eventrecorder/init.go b/bcs-services/bcs-cluster-reporter/internal/plugin/eventrecorder/init.go index 447ed74538..479782fde0 100644 --- a/bcs-services/bcs-cluster-reporter/internal/plugin/eventrecorder/init.go +++ b/bcs-services/bcs-cluster-reporter/internal/plugin/eventrecorder/init.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-services/bcs-cluster-reporter/internal/plugin/eventrecorder/options.go b/bcs-services/bcs-cluster-reporter/internal/plugin/eventrecorder/options.go index ddb58960bd..788a0ebb32 100644 --- a/bcs-services/bcs-cluster-reporter/internal/plugin/eventrecorder/options.go +++ b/bcs-services/bcs-cluster-reporter/internal/plugin/eventrecorder/options.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-services/bcs-cluster-reporter/internal/plugin/logrecorder/init.go b/bcs-services/bcs-cluster-reporter/internal/plugin/logrecorder/init.go index be105708ed..b833b293f5 100644 --- a/bcs-services/bcs-cluster-reporter/internal/plugin/logrecorder/init.go +++ b/bcs-services/bcs-cluster-reporter/internal/plugin/logrecorder/init.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-services/bcs-cluster-reporter/internal/plugin/logrecorder/logrecorder.go b/bcs-services/bcs-cluster-reporter/internal/plugin/logrecorder/logrecorder.go index 52b54d90c8..335a336211 100644 --- a/bcs-services/bcs-cluster-reporter/internal/plugin/logrecorder/logrecorder.go +++ b/bcs-services/bcs-cluster-reporter/internal/plugin/logrecorder/logrecorder.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -24,15 +24,15 @@ import ( "sync" "time" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/k8s" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/metric_manager" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/plugin_manager" - "github.com/prometheus/client_golang/prometheus" corev1 "k8s.io/api/core/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/yaml" "k8s.io/klog" + + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/k8s" + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/metric_manager" + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/plugin_manager" ) // Plugin xxx @@ -143,10 +143,12 @@ func getLogRecord(cluster plugin_manager.ClusterConfig) { _, ok := logCache[pod.Name] if !ok { logCache[pod.Name] = make(map[string][]PodLog) - logCache[pod.Name]["etcd"] = make([]PodLog, 0, 0) + logCache[pod.Name]["etcd"] = make([]PodLog, 0) } - logsStream, err := clientSet.CoreV1().Pods("kube-system").GetLogs(pod.Name, logOptions).Stream(context.Background()) + // nolint + logsStream, err := clientSet.CoreV1().Pods("kube-system").GetLogs(pod.Name, logOptions). + Stream(context.Background()) if err != nil { klog.Fatal(err.Error()) } @@ -166,7 +168,9 @@ func getLogRecord(cluster plugin_manager.ClusterConfig) { } // 重建链接 logsStream.Close() - logsStream, err = clientSet.CoreV1().Pods("kube-system").GetLogs(pod.Name, logOptions).Stream(context.Background()) + // nolint + logsStream, err = clientSet.CoreV1().Pods("kube-system").GetLogs(pod.Name, logOptions). + Stream(context.Background()) if err != nil { klog.Fatalf(err.Error()) } @@ -183,6 +187,7 @@ func getLogRecord(cluster plugin_manager.ClusterConfig) { } go func() { + // nolint use time.Sleep instead of for { select { case <-time.After(1 * time.Minute): @@ -195,7 +200,7 @@ func getLogRecord(cluster plugin_manager.ClusterConfig) { func cleanPodLogCache() { for podName, podLogs := range logCache { for containerName, logList := range podLogs { - newLogList := make([]PodLog, 0, 0) + newLogList := make([]PodLog, 0) for _, logItem := range logList { if !logItem.LogTime.Before(time.Now().Add(-5 * time.Minute)) { newLogList = append(newLogList, logItem) @@ -233,7 +238,7 @@ func LogAnalysis(cluster plugin_manager.ClusterConfig) { logCacheLock.RUnlock() }() - etcdTookTooLongGaugeVecSetList := make([]*metric_manager.GaugeVecSet, 0, 0) + etcdTookTooLongGaugeVecSetList := make([]*metric_manager.GaugeVecSet, 0) tookToLongList := make(map[string]int) @@ -242,7 +247,7 @@ func LogAnalysis(cluster plugin_manager.ClusterConfig) { if strings.Contains(podName, "etcd") && containerName == "etcd" { for _, logItem := range logList { logMap := make(map[string]interface{}) - err := json.Unmarshal([]byte(strings.Replace(logItem.Log, "-", "", -1)), &logMap) + err := json.Unmarshal([]byte(strings.ReplaceAll(logItem.Log, "-", "")), &logMap) if err != nil { klog.Errorf("unmarshal failed: %s, %s", err.Error(), logItem.Log) break @@ -251,8 +256,8 @@ func LogAnalysis(cluster plugin_manager.ClusterConfig) { var requestPath string for _, str := range strings.Split(logMap["request"].(string), " ") { if strings.Contains(str, "key:") { - requestPath = strings.Replace(str, "key:", "", -1) - requestPath = strings.Replace(requestPath, "\"", "", -1) + requestPath = strings.ReplaceAll(str, "key:", "") + requestPath = strings.ReplaceAll(requestPath, "\"", "") break } @@ -260,10 +265,10 @@ func LogAnalysis(cluster plugin_manager.ClusterConfig) { var responseSize string if strings.Contains(logMap["response"].(string), " ") { - responseSize = strings.Replace( - strings.Split(logMap["response"].(string), " ")[1], "size:", "", -1) + responseSize = strings.ReplaceAll( + strings.Split(logMap["response"].(string), " ")[1], "size:", "") } else { - responseSize = strings.Replace(logMap["response"].(string), "size:", "", -1) + responseSize = strings.ReplaceAll(logMap["response"].(string), "size:", "") } size, err := strconv.Atoi(responseSize) diff --git a/bcs-services/bcs-cluster-reporter/internal/plugin/logrecorder/options.go b/bcs-services/bcs-cluster-reporter/internal/plugin/logrecorder/options.go index ea12b69165..2a1e797576 100644 --- a/bcs-services/bcs-cluster-reporter/internal/plugin/logrecorder/options.go +++ b/bcs-services/bcs-cluster-reporter/internal/plugin/logrecorder/options.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-services/bcs-cluster-reporter/internal/plugin/masterpodcheck/init.go b/bcs-services/bcs-cluster-reporter/internal/plugin/masterpodcheck/init.go index 6d391a8824..6479e2a3b1 100644 --- a/bcs-services/bcs-cluster-reporter/internal/plugin/masterpodcheck/init.go +++ b/bcs-services/bcs-cluster-reporter/internal/plugin/masterpodcheck/init.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-services/bcs-cluster-reporter/internal/plugin/masterpodcheck/masterpodcheck.go b/bcs-services/bcs-cluster-reporter/internal/plugin/masterpodcheck/masterpodcheck.go index b3042116f7..1e9ddbb1f4 100644 --- a/bcs-services/bcs-cluster-reporter/internal/plugin/masterpodcheck/masterpodcheck.go +++ b/bcs-services/bcs-cluster-reporter/internal/plugin/masterpodcheck/masterpodcheck.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -26,10 +26,6 @@ import ( "sync" "time" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/k8s" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/metric_manager" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/plugin_manager" - "github.com/dlclark/regexp2" "github.com/prometheus/client_golang/prometheus" "gopkg.in/yaml.v2" @@ -41,6 +37,10 @@ import ( "k8s.io/client-go/rest" "k8s.io/client-go/tools/remotecommand" "k8s.io/klog" + + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/k8s" + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/metric_manager" + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/plugin_manager" ) var ( @@ -83,7 +83,7 @@ type MetricLabel struct { // ToLabelList xxx func (l *MetricLabel) ToLabelList() []string { - result := make([]string, 0, 0) + result := make([]string, 0) result = append(result, l.Target) result = append(result, l.TargetBiz) result = append(result, l.Status) @@ -153,6 +153,7 @@ func (p *Plugin) Name() string { } // Check xxx +// nolint funlen func (p *Plugin) Check() { start := time.Now() p.checkLock.Lock() @@ -255,7 +256,7 @@ func (p *Plugin) Check() { // check Master Pod func (p *Plugin) checkMasterPod(clientSet *kubernetes.Clientset, podList []corev1.Pod, podName string, nodeLabelSelector string, clusterId string, clusterBiz string, config *rest.Config) []*metric_manager.GaugeVecSet { - result := make([]*metric_manager.GaugeVecSet, 0, 0) + result := make([]*metric_manager.GaugeVecSet, 0) metricLabel := MetricLabel{ Target: clusterId, @@ -265,7 +266,7 @@ func (p *Plugin) checkMasterPod(clientSet *kubernetes.Clientset, podList []corev var err error // 获取本次要检查的master pod列表 - masterPodList := make([]corev1.Pod, 0, 0) + masterPodList := make([]corev1.Pod, 0) for _, pod := range podList { if strings.Contains(pod.Name, podName) { masterPodList = append(masterPodList, pod) @@ -443,6 +444,7 @@ func checkArguments(argList1 []string, argList2 []string) error { arg2 := argList2[index] if arg1 != arg2 { // exclude ip address + // nolint re, _ := regexp.Compile( "(([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])") arg1WithoutIp := re.ReplaceAllString(arg1, "") @@ -530,12 +532,10 @@ func (p *Plugin) checkPodFileConsistency(restConfig *rest.Config, clientSet *kub if sampleFile == "" { sampleFile = execMsg sampleName = pod.Name - } else { - if sampleFile != execMsg { - klog.Infof("pod %s policy %s doesn't equal pod %s policy %s", - sampleName, sampleFile, pod.Name, execMsg) - return "配置不一致", nil // nolint - } + } else if sampleFile != execMsg { + klog.Infof("pod %s policy %s doesn't equal pod %s policy %s", + sampleName, sampleFile, pod.Name, execMsg) + return "配置不一致", nil // nolint } } return "ok", nil @@ -549,17 +549,16 @@ func (p *Plugin) checkPodConfig(obj interface{}, path string, regex string) (boo if value.Kind() != reflect.Struct && value.Kind() != reflect.Slice && value.Kind() != reflect.Pointer { return false, fmt.Errorf("invalid field %s in path %s %s", field, path, value) } - if value.Kind() == reflect.Slice { + if value.Kind() == reflect.Slice { // nolint rewrite if-else to switch statement indexStr := strings.Trim(field, "[]") index, err := strconv.Atoi(indexStr) if err != nil { return false, fmt.Errorf("invalid field %s in path %s %s", field, path, value) } - if value.Len() >= index+1 { - value = value.Index(index) - } else { + if !(value.Len() >= index+1) { return true, nil } + value = value.Index(index) } else if value.Kind() == reflect.Struct { // 如果当前值是结构体,就按照字段名获取对应属性值 fieldValue := value.FieldByName(field) diff --git a/bcs-services/bcs-cluster-reporter/internal/plugin/masterpodcheck/options.go b/bcs-services/bcs-cluster-reporter/internal/plugin/masterpodcheck/options.go index 59f6cc12b2..0e81a693f7 100644 --- a/bcs-services/bcs-cluster-reporter/internal/plugin/masterpodcheck/options.go +++ b/bcs-services/bcs-cluster-reporter/internal/plugin/masterpodcheck/options.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-services/bcs-cluster-reporter/internal/plugin/netcheck/init.go b/bcs-services/bcs-cluster-reporter/internal/plugin/netcheck/init.go index 459688c7d2..ccad211b35 100644 --- a/bcs-services/bcs-cluster-reporter/internal/plugin/netcheck/init.go +++ b/bcs-services/bcs-cluster-reporter/internal/plugin/netcheck/init.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-services/bcs-cluster-reporter/internal/plugin/netcheck/netcheck.go b/bcs-services/bcs-cluster-reporter/internal/plugin/netcheck/netcheck.go index 6005e06958..2793dd02ea 100644 --- a/bcs-services/bcs-cluster-reporter/internal/plugin/netcheck/netcheck.go +++ b/bcs-services/bcs-cluster-reporter/internal/plugin/netcheck/netcheck.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -22,10 +22,6 @@ import ( "sync" "time" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/k8s" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/metric_manager" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/plugin_manager" - "github.com/prometheus/client_golang/prometheus" "golang.org/x/net/icmp" "golang.org/x/net/ipv4" @@ -35,6 +31,10 @@ import ( "k8s.io/apimachinery/pkg/util/json" "k8s.io/client-go/kubernetes" "k8s.io/klog" + + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/k8s" + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/metric_manager" + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/plugin_manager" ) // Plugin xxx @@ -204,7 +204,7 @@ func (p *Plugin) Check() { metric_manager.SetCommonDurationMetric([]string{"netcheck", "", "", ""}, start) }() - netChecktGaugeVecSetList := make([]*metric_manager.GaugeVecSet, 0, 0) + netChecktGaugeVecSetList := make([]*metric_manager.GaugeVecSet, 0) status := "error" defer func() { diff --git a/bcs-services/bcs-cluster-reporter/internal/plugin/netcheck/netcheck_test.go b/bcs-services/bcs-cluster-reporter/internal/plugin/netcheck/netcheck_test.go index 273c56c3e0..046aef943b 100644 --- a/bcs-services/bcs-cluster-reporter/internal/plugin/netcheck/netcheck_test.go +++ b/bcs-services/bcs-cluster-reporter/internal/plugin/netcheck/netcheck_test.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-services/bcs-cluster-reporter/internal/plugin/netcheck/options.go b/bcs-services/bcs-cluster-reporter/internal/plugin/netcheck/options.go index 9dd293df79..f409ab4120 100644 --- a/bcs-services/bcs-cluster-reporter/internal/plugin/netcheck/options.go +++ b/bcs-services/bcs-cluster-reporter/internal/plugin/netcheck/options.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-services/bcs-cluster-reporter/internal/plugin/systemappcheck/init.go b/bcs-services/bcs-cluster-reporter/internal/plugin/systemappcheck/init.go index bac67ff0b0..13cc743f5d 100644 --- a/bcs-services/bcs-cluster-reporter/internal/plugin/systemappcheck/init.go +++ b/bcs-services/bcs-cluster-reporter/internal/plugin/systemappcheck/init.go @@ -1,15 +1,16 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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 systempodcheck xxx package systempodcheck import ( diff --git a/bcs-services/bcs-cluster-reporter/internal/plugin/systemappcheck/options.go b/bcs-services/bcs-cluster-reporter/internal/plugin/systemappcheck/options.go index c3ad08d689..ee357b7d7b 100644 --- a/bcs-services/bcs-cluster-reporter/internal/plugin/systemappcheck/options.go +++ b/bcs-services/bcs-cluster-reporter/internal/plugin/systemappcheck/options.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-services/bcs-cluster-reporter/internal/plugin/systemappcheck/systemappcheck.go b/bcs-services/bcs-cluster-reporter/internal/plugin/systemappcheck/systemappcheck.go index 9bfd5451da..96a8712fbf 100644 --- a/bcs-services/bcs-cluster-reporter/internal/plugin/systemappcheck/systemappcheck.go +++ b/bcs-services/bcs-cluster-reporter/internal/plugin/systemappcheck/systemappcheck.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -22,10 +22,6 @@ import ( "sync" "time" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/k8s" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/metric_manager" - "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/plugin_manager" - "github.com/containerd/containerd/pkg/cri/util" "github.com/prometheus/client_golang/prometheus" "gopkg.in/yaml.v2" @@ -38,6 +34,10 @@ import ( "k8s.io/apimachinery/pkg/util/json" "k8s.io/client-go/kubernetes" "k8s.io/klog" + + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/k8s" + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/metric_manager" + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/plugin_manager" ) // Plugin xxx @@ -128,6 +128,8 @@ func (p *Plugin) Name() string { // informer 改造 // // 内存使用优化 +// +// nolint funlen func (p *Plugin) Check() { start := time.Now() p.checkLock.Lock() @@ -369,7 +371,7 @@ func GetStatus(updatedReplicas int, availableReplicas int, replicas int) string func (p *Plugin) CheckComponents( clusterId string, clusterbiz string, clientSet *kubernetes.Clientset, componentList []Component) ( []*metric_manager.GaugeVecSet, error) { - imageGaugeVecSetList := make([]*metric_manager.GaugeVecSet, 0, 0) + imageGaugeVecSetList := make([]*metric_manager.GaugeVecSet, 0) for _, component := range componentList { var workload runtime.Object var err error @@ -457,7 +459,6 @@ func GetResourceGaugeVecSet( int(deploy.Status.ReadyReplicas), int(deploy.Status.Replicas))}, Value: 1} } - break case "statefulset": sts := &v1.StatefulSet{} err := runtime.DefaultUnstructuredConverter.FromUnstructured(objectMap, sts) @@ -474,7 +475,6 @@ func GetResourceGaugeVecSet( int(sts.Status.ReadyReplicas), int(sts.Status.Replicas))}, Value: 1} } - break case "daemonset": ds := &v1.DaemonSet{} err := runtime.DefaultUnstructuredConverter.FromUnstructured(objectMap, ds) @@ -491,7 +491,6 @@ func GetResourceGaugeVecSet( int(ds.Status.NumberReady), int(ds.Status.DesiredNumberScheduled))}, Value: 1} } - break default: klog.V(6).Infof("%s type is %s", unstr.GetName(), kind) } diff --git a/bcs-services/bcs-cluster-reporter/internal/plugin/systemappcheck/systemappcheck_test.go b/bcs-services/bcs-cluster-reporter/internal/plugin/systemappcheck/systemappcheck_test.go index 18b6e71360..7d5d2e3a8d 100644 --- a/bcs-services/bcs-cluster-reporter/internal/plugin/systemappcheck/systemappcheck_test.go +++ b/bcs-services/bcs-cluster-reporter/internal/plugin/systemappcheck/systemappcheck_test.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-services/bcs-cluster-reporter/internal/plugin_manager/options.go b/bcs-services/bcs-cluster-reporter/internal/plugin_manager/options.go index b868815f09..9e3a337c36 100644 --- a/bcs-services/bcs-cluster-reporter/internal/plugin_manager/options.go +++ b/bcs-services/bcs-cluster-reporter/internal/plugin_manager/options.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-services/bcs-cluster-reporter/internal/plugin_manager/plugin_manager.go b/bcs-services/bcs-cluster-reporter/internal/plugin_manager/plugin_manager.go index 2bfd61be92..d8a53f7033 100644 --- a/bcs-services/bcs-cluster-reporter/internal/plugin_manager/plugin_manager.go +++ b/bcs-services/bcs-cluster-reporter/internal/plugin_manager/plugin_manager.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -19,10 +19,10 @@ import ( "strings" "sync" + "github.com/prometheus/client_golang/prometheus" + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/metric_manager" "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/util" - - "github.com/prometheus/client_golang/prometheus" ) var ( diff --git a/bcs-services/bcs-cluster-reporter/internal/rest/rest.go b/bcs-services/bcs-cluster-reporter/internal/rest/rest.go index c024e3d85e..a094bd31d1 100644 --- a/bcs-services/bcs-cluster-reporter/internal/rest/rest.go +++ b/bcs-services/bcs-cluster-reporter/internal/rest/rest.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -17,7 +17,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net/http" "net/url" "strings" @@ -65,7 +64,7 @@ func (r *Request) Do() ([]byte, error) { var body []byte if resp.Body != nil { - data, err := ioutil.ReadAll(resp.Body) + data, err := io.ReadAll(resp.Body) body = data if err != nil { return nil, err diff --git a/bcs-services/bcs-cluster-reporter/internal/util/crypt.go b/bcs-services/bcs-cluster-reporter/internal/util/crypt.go index 5641a8f916..81d2c54a15 100644 --- a/bcs-services/bcs-cluster-reporter/internal/util/crypt.go +++ b/bcs-services/bcs-cluster-reporter/internal/util/crypt.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. @@ -34,33 +34,33 @@ import ( const letterBytes = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" const ( - // ValidateSignatureError + // ValidateSignatureError xxx ValidateSignatureError int = -40001 - // ParseXmlError + // ParseXmlError xxx ParseXmlError int = -40002 - // ComputeSignatureError + // ComputeSignatureError xxx ComputeSignatureError int = -40003 - // IllegalAesKey + // IllegalAesKey xxx IllegalAesKey int = -40004 - // ValidateCorpidError + // ValidateCorpidError xxx ValidateCorpidError int = -40005 - // EncryptAESError + // EncryptAESError xxx EncryptAESError int = -40006 - // DecryptAESError + // DecryptAESError xxx DecryptAESError int = -40007 - // IllegalBuffer + // IllegalBuffer xxx IllegalBuffer int = -40008 - // EncodeBase64Error + // EncodeBase64Error xxx EncodeBase64Error int = -40009 - // DecodeBase64Error + // DecodeBase64Error xxx DecodeBase64Error int = -40010 - // GenXmlError + // GenXmlError xxx GenXmlError int = -40010 - // ParseJsonError + // ParseJsonError xxx ParseJsonError int = -40012 - // GenJsonError + // GenJsonError xxx GenJsonError int = -40013 - // IllegalProtocolType + // IllegalProtocolType xxx IllegalProtocolType int = -40014 ) @@ -161,7 +161,7 @@ func NewWXBizMsgCrypt(token, encoding_aeskey, receiver_id string, protocol_type func (wx *WXBizMsgCrypt) randString(n int) string { b := make([]byte, n) for i := range b { - b[i] = letterBytes[rand.Int63()%int64(len(letterBytes))] + b[i] = letterBytes[rand.Int63()%int64(len(letterBytes))] // nolint math/rand instead of crypto/rand } return string(b) } @@ -253,10 +253,10 @@ func (wx *WXBizMsgCrypt) calSignature(timestamp, nonce, data string) string { buffer.WriteString(value) } - sha := sha1.New() + sha := sha1.New() // nolint Use of weak cryptographic primitive sha.Write(buffer.Bytes()) signature := fmt.Sprintf("%x", sha.Sum(nil)) - return string(signature) + return signature } // ParsePlainText xxx diff --git a/bcs-services/bcs-cluster-reporter/internal/util/routinepool.go b/bcs-services/bcs-cluster-reporter/internal/util/routinepool.go index 9b9f04b447..c96fc101c3 100644 --- a/bcs-services/bcs-cluster-reporter/internal/util/routinepool.go +++ b/bcs-services/bcs-cluster-reporter/internal/util/routinepool.go @@ -1,10 +1,10 @@ /* - * Tencent is pleased to support the open source community by making Blueking Container Service available., + * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT - * Unless required by applicable law or agreed to in writing, software distributed under, + * Unless required by applicable law or agreed to in writing, software distributed under * 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. diff --git a/bcs-services/bcs-cluster-reporter/main.go b/bcs-services/bcs-cluster-reporter/main.go index 843979f367..86fd2ec523 100644 --- a/bcs-services/bcs-cluster-reporter/main.go +++ b/bcs-services/bcs-cluster-reporter/main.go @@ -10,11 +10,14 @@ * limitations under the License. */ +// Package main xxx package main import ( "runtime/debug" + "k8s.io/klog" + "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/cmd" _ "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/plugin/clustercheck" _ "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/plugin/dnscheck" @@ -23,8 +26,6 @@ import ( _ "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/plugin/masterpodcheck" _ "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/plugin/netcheck" _ "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-reporter/internal/plugin/systemappcheck" - - "k8s.io/klog" ) func main() { diff --git a/bcs-services/bcs-storage/storage/apiserver/health.go b/bcs-services/bcs-storage/storage/apiserver/health.go index 17a38b1be9..b0149a48ce 100644 --- a/bcs-services/bcs-storage/storage/apiserver/health.go +++ b/bcs-services/bcs-storage/storage/apiserver/health.go @@ -78,7 +78,7 @@ func GetHealth() metric.HealthMeta { message := storageHealth.Message if !storageHealth.Data[mongodbConfigKey].OK { - message += " | " + storageHealth.Data[mongodbConfigKey].Message + message += " | " + storageHealth.Data[mongodbConfigKey].Message // nolint goconst } if !storageHealth.Data[zkConfigKey].OK { message += " | " + storageHealth.Data[zkConfigKey].Message diff --git a/bcs-services/bcs-user-manager/app/user-manager/storages/sqlstore/token.go b/bcs-services/bcs-user-manager/app/user-manager/storages/sqlstore/token.go index e7b3ec0323..713f3cf2fd 100644 --- a/bcs-services/bcs-user-manager/app/user-manager/storages/sqlstore/token.go +++ b/bcs-services/bcs-user-manager/app/user-manager/storages/sqlstore/token.go @@ -214,6 +214,7 @@ func (u *realTokenStore) decryptToken(token string) (string, error) { func (u *realTokenStore) GetAllClients() []models.BcsClientUser { var err error var tokens []models.BcsClientUser + // nolint goconst u.db.Raw(`SELECT c.project_code, c.name, c.manager, c.authority_user, c.created_by, c.created_at, c.updated_at, `+ `u.expires_at, u.user_token FROM bcs_clients AS c JOIN bcs_users AS u on u.name = c.name WHERE u.user_type = ? `+ `AND u.deleted_at IS NULL AND c.deleted_at IS NULL`, models.PlainUser). diff --git a/bcs-services/bcs-user-manager/app/user-manager/v1http/permission/verify.go b/bcs-services/bcs-user-manager/app/user-manager/v1http/permission/verify.go index 25ad9c440b..7bbd57b214 100644 --- a/bcs-services/bcs-user-manager/app/user-manager/v1http/permission/verify.go +++ b/bcs-services/bcs-user-manager/app/user-manager/v1http/permission/verify.go @@ -309,7 +309,7 @@ func (cli *PermVerifyClient) verifyUserNamespaceScopedPermission(ctx context.Con } if !exist { blog.Log(ctx).Infof("PermVerifyClient verifyUserNamespaceScopedPermission namespace[%s] not exist "+ - "project[%s] cluster[%s]", resource.Namespace, projectID, resource.ClusterID) + "project[%s] cluster[%s]", resource.Namespace, projectID, resource.ClusterID) // nolint goconst return false, nil } blog.Log(ctx).Infof("PermVerifyClient verifyUserNamespaceScopedPermission namespace[%s] exist "+ diff --git a/bcs-services/bcs-user-manager/go.mod b/bcs-services/bcs-user-manager/go.mod index b8f34f07cc..c2060afacf 100644 --- a/bcs-services/bcs-user-manager/go.mod +++ b/bcs-services/bcs-user-manager/go.mod @@ -1,6 +1,6 @@ module github.com/Tencent/bk-bcs/bcs-services/bcs-user-manager -go 1.17 +go 1.20 replace ( github.com/TencentBlueKing/iam-go-sdk => github.com/TencentBlueKing/iam-go-sdk v0.1.5