mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
add import-alias for k8s.io/api/batch/v1
This commit is contained in:
parent
9a9f224ba5
commit
03ad7d2d6f
@ -9,5 +9,6 @@
|
||||
"k8s.io/api/authentication/v1beta1": "authenticationv1beta1",
|
||||
"k8s.io/api/authorization/v1": "authorizationv1",
|
||||
"k8s.io/api/authorization/v1beta1": "authorizationv1beta1",
|
||||
"k8s.io/api/autoscaling/v1": "autoscalingv1"
|
||||
"k8s.io/api/autoscaling/v1": "autoscalingv1",
|
||||
"k8s.io/api/batch/v1": "batchv1"
|
||||
}
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||
package auth
|
||||
|
||||
import (
|
||||
batch "k8s.io/api/batch/v1"
|
||||
batchv1 "k8s.io/api/batch/v1"
|
||||
"k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
@ -33,11 +33,11 @@ var _ = SIGDescribe("Metadata Concealment", func() {
|
||||
ginkgo.It("should run a check-metadata-concealment job to completion", func() {
|
||||
framework.SkipUnlessProviderIs("gce")
|
||||
ginkgo.By("Creating a job")
|
||||
job := &batch.Job{
|
||||
job := &batchv1.Job{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "check-metadata-concealment",
|
||||
},
|
||||
Spec: batch.JobSpec{
|
||||
Spec: batchv1.JobSpec{
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "check-metadata-concealment",
|
||||
|
@ -19,7 +19,7 @@ package job
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
batch "k8s.io/api/batch/v1"
|
||||
batchv1 "k8s.io/api/batch/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
@ -30,7 +30,7 @@ import (
|
||||
)
|
||||
|
||||
// GetJob uses c to get the Job in namespace ns named name. If the returned error is nil, the returned Job is valid.
|
||||
func GetJob(c clientset.Interface, ns, name string) (*batch.Job, error) {
|
||||
func GetJob(c clientset.Interface, ns, name string) (*batchv1.Job, error) {
|
||||
return c.BatchV1().Jobs(ns).Get(name, metav1.GetOptions{})
|
||||
}
|
||||
|
||||
@ -43,18 +43,18 @@ func GetJobPods(c clientset.Interface, ns, jobName string) (*v1.PodList, error)
|
||||
|
||||
// CreateJob uses c to create job in namespace ns. If the returned error is nil, the returned Job is valid and has
|
||||
// been created.
|
||||
func CreateJob(c clientset.Interface, ns string, job *batch.Job) (*batch.Job, error) {
|
||||
func CreateJob(c clientset.Interface, ns string, job *batchv1.Job) (*batchv1.Job, error) {
|
||||
return c.BatchV1().Jobs(ns).Create(job)
|
||||
}
|
||||
|
||||
// UpdateJob uses c to updated job in namespace ns. If the returned error is nil, the returned Job is valid and has
|
||||
// been updated.
|
||||
func UpdateJob(c clientset.Interface, ns string, job *batch.Job) (*batch.Job, error) {
|
||||
func UpdateJob(c clientset.Interface, ns string, job *batchv1.Job) (*batchv1.Job, error) {
|
||||
return c.BatchV1().Jobs(ns).Update(job)
|
||||
}
|
||||
|
||||
// UpdateJobWithRetries updates job with retries.
|
||||
func UpdateJobWithRetries(c clientset.Interface, namespace, name string, applyUpdate func(*batch.Job)) (job *batch.Job, err error) {
|
||||
func UpdateJobWithRetries(c clientset.Interface, namespace, name string, applyUpdate func(*batchv1.Job)) (job *batchv1.Job, err error) {
|
||||
jobs := c.BatchV1().Jobs(namespace)
|
||||
var updateErr error
|
||||
pollErr := wait.PollImmediate(framework.Poll, JobTimeout, func() (bool, error) {
|
||||
|
@ -20,7 +20,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
batch "k8s.io/api/batch/v1"
|
||||
batchv1 "k8s.io/api/batch/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
extensions "k8s.io/api/extensions/v1beta1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@ -71,7 +71,7 @@ func getSelectorFromRuntimeObject(obj runtime.Object) (labels.Selector, error) {
|
||||
return metav1.LabelSelectorAsSelector(typed.Spec.Selector)
|
||||
case *appsv1.DaemonSet:
|
||||
return metav1.LabelSelectorAsSelector(typed.Spec.Selector)
|
||||
case *batch.Job:
|
||||
case *batchv1.Job:
|
||||
return metav1.LabelSelectorAsSelector(typed.Spec.Selector)
|
||||
default:
|
||||
return nil, fmt.Errorf("Unsupported kind when getting selector: %v", obj)
|
||||
@ -111,7 +111,7 @@ func getReplicasFromRuntimeObject(obj runtime.Object) (int32, error) {
|
||||
return 0, nil
|
||||
case *appsv1.DaemonSet:
|
||||
return 0, nil
|
||||
case *batch.Job:
|
||||
case *batchv1.Job:
|
||||
// TODO: currently we use pause pods so that's OK. When we'll want to switch to Pods
|
||||
// that actually finish we need a better way to do this.
|
||||
if typed.Spec.Parallelism != nil {
|
||||
|
@ -48,7 +48,7 @@ import (
|
||||
gomegatypes "github.com/onsi/gomega/types"
|
||||
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
batch "k8s.io/api/batch/v1"
|
||||
batchv1 "k8s.io/api/batch/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
extensions "k8s.io/api/extensions/v1beta1"
|
||||
apierrs "k8s.io/apimachinery/pkg/api/errors"
|
||||
@ -2259,7 +2259,7 @@ func getSelectorFromRuntimeObject(obj runtime.Object) (labels.Selector, error) {
|
||||
return metav1.LabelSelectorAsSelector(typed.Spec.Selector)
|
||||
case *appsv1.DaemonSet:
|
||||
return metav1.LabelSelectorAsSelector(typed.Spec.Selector)
|
||||
case *batch.Job:
|
||||
case *batchv1.Job:
|
||||
return metav1.LabelSelectorAsSelector(typed.Spec.Selector)
|
||||
default:
|
||||
return nil, fmt.Errorf("Unsupported kind when getting selector: %v", obj)
|
||||
@ -2297,7 +2297,7 @@ func getReplicasFromRuntimeObject(obj runtime.Object) (int32, error) {
|
||||
return 0, nil
|
||||
case *appsv1.DaemonSet:
|
||||
return 0, nil
|
||||
case *batch.Job:
|
||||
case *batchv1.Job:
|
||||
// TODO: currently we use pause pods so that's OK. When we'll want to switch to Pods
|
||||
// that actually finish we need a better way to do this.
|
||||
if typed.Spec.Parallelism != nil {
|
||||
|
@ -19,7 +19,7 @@ package node
|
||||
import (
|
||||
"time"
|
||||
|
||||
batch "k8s.io/api/batch/v1"
|
||||
batchv1 "k8s.io/api/batch/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/kubernetes/pkg/util/slice"
|
||||
@ -41,12 +41,12 @@ var _ = framework.KubeDescribe("[Feature:TTLAfterFinished][NodeAlphaFeature:TTLA
|
||||
})
|
||||
})
|
||||
|
||||
func cleanupJob(f *framework.Framework, job *batch.Job) {
|
||||
func cleanupJob(f *framework.Framework, job *batchv1.Job) {
|
||||
ns := f.Namespace.Name
|
||||
c := f.ClientSet
|
||||
|
||||
e2elog.Logf("Remove the Job's dummy finalizer; the Job should be deleted cascadingly")
|
||||
removeFinalizerFunc := func(j *batch.Job) {
|
||||
removeFinalizerFunc := func(j *batchv1.Job) {
|
||||
j.ObjectMeta.Finalizers = slice.RemoveString(j.ObjectMeta.Finalizers, dummyFinalizer, nil)
|
||||
}
|
||||
_, err := jobutil.UpdateJobWithRetries(c, ns, job.Name, removeFinalizerFunc)
|
||||
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||
package upgrades
|
||||
|
||||
import (
|
||||
batch "k8s.io/api/batch/v1"
|
||||
batchv1 "k8s.io/api/batch/v1"
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
jobutil "k8s.io/kubernetes/test/e2e/framework/job"
|
||||
@ -28,7 +28,7 @@ import (
|
||||
|
||||
// JobUpgradeTest is a test harness for batch Jobs.
|
||||
type JobUpgradeTest struct {
|
||||
job *batch.Job
|
||||
job *batchv1.Job
|
||||
namespace string
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user