From 629561efeba0e127870f472307d9cfac905493fd Mon Sep 17 00:00:00 2001 From: Rajadeepan D Ramesh Date: Tue, 11 Jun 2019 14:29:21 +0530 Subject: [PATCH 1/3] Fix lint error in cmd package --- cmd/admission/app/configure/configure.go | 6 +++++- cmd/admission/app/server.go | 10 ++++++++-- cmd/controllers/app/options/options.go | 1 + cmd/controllers/app/server.go | 3 +++ hack/.golint_failures | 4 ---- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/cmd/admission/app/configure/configure.go b/cmd/admission/app/configure/configure.go index 18758414635..981af32231a 100644 --- a/cmd/admission/app/configure/configure.go +++ b/cmd/admission/app/configure/configure.go @@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ + package configure import ( @@ -28,7 +29,7 @@ import ( admissionregistrationv1beta1client "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1" ) -// admission-controller server config. +// Config admission-controller server config. type Config struct { Master string Kubeconfig string @@ -43,11 +44,13 @@ type Config struct { PrintVersion bool } +// NewConfig create new config func NewConfig() *Config { c := Config{} return &c } +// AddFlags add flags func (c *Config) AddFlags() { flag.StringVar(&c.Master, "master", c.Master, "The address of the Kubernetes API server (overrides any value in kubeconfig)") 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() { flag.BoolVar(&c.PrintVersion, "version", false, "Show version and quit") } +// CheckPortOrDie check valid port range func (c *Config) CheckPortOrDie() error { if c.Port < 1 || c.Port > 65535 { return fmt.Errorf("the port should be in the range of 1 and 65535") diff --git a/cmd/admission/app/server.go b/cmd/admission/app/server.go index d6fbaeb76e5..23669438ba7 100644 --- a/cmd/admission/app/server.go +++ b/cmd/admission/app/server.go @@ -13,6 +13,7 @@ WITHOUT WARRANTIES 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 import ( @@ -34,11 +35,14 @@ import ( ) const ( - CONTENTTYPE = "Content-Type" + //CONTENTTYPE http content-type + CONTENTTYPE = "Content-Type" + + //APPLICATIONJSON json content APPLICATIONJSON = "application/json" ) -// Get a clientset with restConfig. +// GetClient Get a clientset with restConfig. func GetClient(restConfig *restclient.Config) *kubernetes.Clientset { clientset, err := kubernetes.NewForConfig(restConfig) if err != nil { @@ -47,6 +51,7 @@ func GetClient(restConfig *restclient.Config) *kubernetes.Clientset { return clientset } +//GetKubeBatchClient get a clientset for kubebatch func GetKubeBatchClient(restConfig *restclient.Config) *versioned.Clientset { clientset, err := versioned.NewForConfig(restConfig) if err != nil { @@ -85,6 +90,7 @@ func ConfigTLS(config *appConf.Config, restConfig *restclient.Config) *tls.Confi return &tls.Config{} } +//Serve the http request func Serve(w http.ResponseWriter, r *http.Request, admit admissioncontroller.AdmitFunc) { var body []byte if r.Body != nil { diff --git a/cmd/controllers/app/options/options.go b/cmd/controllers/app/options/options.go index dfb2017e865..d0ea3fe9caa 100644 --- a/cmd/controllers/app/options/options.go +++ b/cmd/controllers/app/options/options.go @@ -56,6 +56,7 @@ func (s *ServerOption) AddFlags(fs *pflag.FlagSet) { fs.BoolVar(&s.PrintVersion, "version", false, "Show version and quit") } +// CheckOptionOrDie checks the LockObjectNamespace func (s *ServerOption) CheckOptionOrDie() error { if s.EnableLeaderElection && s.LockObjectNamespace == "" { return fmt.Errorf("lock-object-namespace must not be nil when LeaderElection is enabled") diff --git a/cmd/controllers/app/server.go b/cmd/controllers/app/server.go index 57e85b1cf6e..f3748e3555b 100644 --- a/cmd/controllers/app/server.go +++ b/cmd/controllers/app/server.go @@ -29,6 +29,8 @@ import ( clientset "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/scheme" corev1 "k8s.io/client-go/kubernetes/typed/core/v1" + + // Initialize client auth plugin. _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" @@ -71,6 +73,7 @@ func buildConfig(opt *options.ServerOption) (*rest.Config, error) { return cfg, nil } +//Run the controller func Run(opt *options.ServerOption) error { config, err := buildConfig(opt) if err != nil { diff --git a/hack/.golint_failures b/hack/.golint_failures index 3ce6bcb7e3a..0ce0e144696 100644 --- a/hack/.golint_failures +++ b/hack/.golint_failures @@ -1,7 +1,3 @@ -volcano.sh/volcano/cmd/admission/app -volcano.sh/volcano/cmd/admission/app/configure -volcano.sh/volcano/cmd/controllers/app -volcano.sh/volcano/cmd/controllers/app/options volcano.sh/volcano/pkg/admission volcano.sh/volcano/pkg/apis/batch/v1alpha1 volcano.sh/volcano/pkg/apis/bus/v1alpha1 From 85f404b54a2a2cd088c63b11cdfdade6a0515acf Mon Sep 17 00:00:00 2001 From: SrinivasChilveri Date: Tue, 11 Jun 2019 15:26:24 +0530 Subject: [PATCH 2/3] Added imagePullSecrete for scheduler in helm chart --- installer/chart/templates/scheduler.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/installer/chart/templates/scheduler.yaml b/installer/chart/templates/scheduler.yaml index 6d01220de44..9617d431ae6 100644 --- a/installer/chart/templates/scheduler.yaml +++ b/installer/chart/templates/scheduler.yaml @@ -97,6 +97,10 @@ spec: app: volcano-scheduler spec: serviceAccount: {{ .Release.Name }}-scheduler + {{ if .Values.basic.image_pull_secret }} + imagePullSecrets: + - name: {{ .Values.basic.image_pull_secret }} + {{ end }} containers: - name: {{ .Release.Name }}-scheduler image: {{.Values.basic.scheduler_image_name}}:{{.Values.basic.image_tag_version}} From 2db429a4c4ebd8affaf188575ee8c625e7ff3f86 Mon Sep 17 00:00:00 2001 From: Thandayuthapani Date: Wed, 12 Jun 2019 16:11:54 +0530 Subject: [PATCH 3/3] Fix E2E because of Event Change --- test/e2e/util.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/util.go b/test/e2e/util.go index 2680568b7e3..03af6c8beba 100644 --- a/test/e2e/util.go +++ b/test/e2e/util.go @@ -423,7 +423,7 @@ func jobUnschedulable(ctx *context, job *vkv1.Job, now time.Time) error { for _, event := range events.Items { target := event.InvolvedObject if strings.HasPrefix(target.Name, pg.Name) && target.Namespace == pg.Namespace { - if event.Reason == string("Unschedulable") && event.LastTimestamp.After(now) { + if event.Reason == string("Unschedulable") || event.Reason == string("FailedScheduling") && event.LastTimestamp.After(now) { return true, nil } }