volcano.sh/volcano@v1.9.0/pkg/controllers/job/plugins/interface/interface.go (about)

     1  /*
     2  Copyright 2019 The Volcano Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package pluginsinterface
    18  
    19  import (
    20  	v1 "k8s.io/api/core/v1"
    21  	"k8s.io/client-go/kubernetes"
    22  
    23  	vcbatch "volcano.sh/apis/pkg/apis/batch/v1alpha1"
    24  )
    25  
    26  // PluginClientset clientset.
    27  type PluginClientset struct {
    28  	KubeClients kubernetes.Interface
    29  }
    30  
    31  // PluginInterface interface.
    32  type PluginInterface interface {
    33  	// Name returns the unique name of Plugin.
    34  	Name() string
    35  
    36  	// OnPodCreate is called for all pod when createJobPod
    37  	OnPodCreate(pod *v1.Pod, job *vcbatch.Job) error
    38  
    39  	// OnJobAdd is called when do job initiation
    40  	// Note: it can be called multi times, must be idempotent
    41  	OnJobAdd(job *vcbatch.Job) error
    42  
    43  	// OnJobDelete is called when killJob
    44  	// Note: it can be called multi times, must be idempotent
    45  	OnJobDelete(job *vcbatch.Job) error
    46  
    47  	// OnJobUpdate is called when job updated
    48  	// Note: it can be called multi times, must be idempotent
    49  	OnJobUpdate(job *vcbatch.Job) error
    50  }