Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
k82cn committed Jun 12, 2019
2 parents e94c482 + bcd0175 commit 32e31f4
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 8 deletions.
6 changes: 5 additions & 1 deletion cmd/admission/app/configure/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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
Expand All @@ -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.")
Expand All @@ -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")
Expand Down
10 changes: 8 additions & 2 deletions cmd/admission/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions cmd/controllers/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 3 additions & 0 deletions cmd/controllers/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 0 additions & 4 deletions hack/.golint_failures
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions installer/chart/templates/scheduler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit 32e31f4

Please sign in to comment.