Skip to content

Commit b5ab5cb

Browse files
author
Rajadeepan D Ramesh
committed
Fix lint error in cmd package
1 parent ab4e709 commit b5ab5cb

5 files changed

Lines changed: 17 additions & 7 deletions

File tree

cmd/admission/app/configure/configure.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
16+
1617
package configure
1718

1819
import (
@@ -28,7 +29,7 @@ import (
2829
admissionregistrationv1beta1client "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1"
2930
)
3031

31-
// admission-controller server config.
32+
// Config admission-controller server config.
3233
type Config struct {
3334
Master string
3435
Kubeconfig string
@@ -43,11 +44,13 @@ type Config struct {
4344
PrintVersion bool
4445
}
4546

47+
// NewConfig create new config
4648
func NewConfig() *Config {
4749
c := Config{}
4850
return &c
4951
}
5052

53+
// AddFlags add flags
5154
func (c *Config) AddFlags() {
5255
flag.StringVar(&c.Master, "master", c.Master, "The address of the Kubernetes API server (overrides any value in kubeconfig)")
5356
flag.StringVar(&c.Kubeconfig, "kubeconfig", c.Kubeconfig, "Path to kubeconfig file with authorization and master location information.")
@@ -68,6 +71,7 @@ func (c *Config) AddFlags() {
6871
flag.BoolVar(&c.PrintVersion, "version", false, "Show version and quit")
6972
}
7073

74+
// CheckPortOrDie check valid port range
7175
func (c *Config) CheckPortOrDie() error {
7276
if c.Port < 1 || c.Port > 65535 {
7377
return fmt.Errorf("the port should be in the range of 1 and 65535")

cmd/admission/app/server.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
16+
1617
package app
1718

1819
import (
@@ -34,11 +35,14 @@ import (
3435
)
3536

3637
const (
37-
CONTENTTYPE = "Content-Type"
38+
//CONTENTTYPE http content-type
39+
CONTENTTYPE = "Content-Type"
40+
41+
//APPLICATIONJSON json content
3842
APPLICATIONJSON = "application/json"
3943
)
4044

41-
// Get a clientset with restConfig.
45+
// GetClient Get a clientset with restConfig.
4246
func GetClient(restConfig *restclient.Config) *kubernetes.Clientset {
4347
clientset, err := kubernetes.NewForConfig(restConfig)
4448
if err != nil {
@@ -47,6 +51,7 @@ func GetClient(restConfig *restclient.Config) *kubernetes.Clientset {
4751
return clientset
4852
}
4953

54+
//GetKubeBatchClient get a clientset for kubebatch
5055
func GetKubeBatchClient(restConfig *restclient.Config) *versioned.Clientset {
5156
clientset, err := versioned.NewForConfig(restConfig)
5257
if err != nil {
@@ -85,6 +90,7 @@ func ConfigTLS(config *appConf.Config, restConfig *restclient.Config) *tls.Confi
8590
return &tls.Config{}
8691
}
8792

93+
//Serve the http request
8894
func Serve(w http.ResponseWriter, r *http.Request, admit admissioncontroller.AdmitFunc) {
8995
var body []byte
9096
if r.Body != nil {

cmd/controllers/app/options/options.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ func (s *ServerOption) AddFlags(fs *pflag.FlagSet) {
5656
fs.BoolVar(&s.PrintVersion, "version", false, "Show version and quit")
5757
}
5858

59+
// CheckOptionOrDie checks the LockObjectNamespace
5960
func (s *ServerOption) CheckOptionOrDie() error {
6061
if s.EnableLeaderElection && s.LockObjectNamespace == "" {
6162
return fmt.Errorf("lock-object-namespace must not be nil when LeaderElection is enabled")

cmd/controllers/app/server.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ import (
2929
clientset "k8s.io/client-go/kubernetes"
3030
"k8s.io/client-go/kubernetes/scheme"
3131
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
32+
33+
// Initialize client auth plugin.
3234
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
3335
"k8s.io/client-go/rest"
3436
"k8s.io/client-go/tools/clientcmd"
@@ -71,6 +73,7 @@ func buildConfig(opt *options.ServerOption) (*rest.Config, error) {
7173
return cfg, nil
7274
}
7375

76+
//Run the controller
7477
func Run(opt *options.ServerOption) error {
7578
config, err := buildConfig(opt)
7679
if err != nil {

hack/.golint_failures

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
volcano.sh/volcano/cmd/admission/app
2-
volcano.sh/volcano/cmd/admission/app/configure
3-
volcano.sh/volcano/cmd/controllers/app
4-
volcano.sh/volcano/cmd/controllers/app/options
51
volcano.sh/volcano/pkg/admission
62
volcano.sh/volcano/pkg/apis/batch/v1alpha1
73
volcano.sh/volcano/pkg/apis/bus/v1alpha1

0 commit comments

Comments
 (0)