Skip to content

Commit

Permalink
bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy规范修改
Browse files Browse the repository at this point in the history
  • Loading branch information
LidolLxf committed Mar 1, 2024
1 parent 50acc5f commit aebdbbc
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 5 additions & 3 deletions bcs-runtime/bcs-k8s/bcs-component/bcs-multi-ns-proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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]")
Expand All @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit aebdbbc

Please sign in to comment.