diff --git a/PROJECT b/PROJECT index e24601e7..17841a33 100644 --- a/PROJECT +++ b/PROJECT @@ -37,11 +37,7 @@ resources: version: v1alpha1 - group: cache kind: CacheBackend - version: "" - group: notebook kind: Notebook version: v1alpha1 -- group: inference - kind: ElasticBatchJob - version: v1alpha1 version: "2" diff --git a/apis/addtoscheme_inference_v1alpha1.go b/apis/addtoscheme_inference_v1alpha1.go deleted file mode 100644 index d385252e..00000000 --- a/apis/addtoscheme_inference_v1alpha1.go +++ /dev/null @@ -1,25 +0,0 @@ -/* -Copyright 2019 The Alibaba Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -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 apis - -import ( - "github.com/alibaba/kubedl/apis/inference/v1alpha1" -) - -func init() { - AddToSchemes = append(AddToSchemes, v1alpha1.SchemeBuilder.AddToScheme) -} diff --git a/apis/inference/v1alpha1/defaults.go b/apis/inference/v1alpha1/defaults.go deleted file mode 100644 index 1299a1ee..00000000 --- a/apis/inference/v1alpha1/defaults.go +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright 2022 The Kubeflow Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// 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 v1alpha1 - -import ( - "strings" - - "github.com/alibaba/kubedl/pkg/features" - common "github.com/alibaba/kubedl/pkg/job_controller/api/v1" - corev1 "k8s.io/api/core/v1" - - "k8s.io/apimachinery/pkg/runtime" -) - -// Int32 is a helper routine that allocates a new int32 value -// to store v and returns a pointer to it. -func Int32(v int32) *int32 { - return &v -} - -// setDefaultPort sets the default ports for elasticbatch container. -func setDefaultPort(spec *corev1.PodSpec) { - index := 0 - for i, container := range spec.Containers { - if container.Name == ElasticBatchJobDefaultContainerName { - index = i - break - } - } - - hasElasticBatchJobPort := false - for _, port := range spec.Containers[index].Ports { - if port.Name == ElasticBatchJobDefaultPortName { - hasElasticBatchJobPort = true - break - } - } - if !hasElasticBatchJobPort { - spec.Containers[index].Ports = append(spec.Containers[index].Ports, corev1.ContainerPort{ - Name: ElasticBatchJobDefaultPortName, - ContainerPort: ElasticBatchJobDefaultPort, - }) - } -} - -func addDefaultingFuncs(scheme *runtime.Scheme) error { - return RegisterDefaults(scheme) -} - -func setDefaultAIMasterReplicas(spec *common.ReplicaSpec) { - if spec.Replicas == nil || *spec.Replicas != 1 { - spec.Replicas = Int32(1) - } - if spec.RestartPolicy == "" { - spec.RestartPolicy = ElasticBatchJobDefaultAIMasterRestartPolicy - } -} - -func setDefaultWorkerReplicas(spec *common.ReplicaSpec) { - if spec.Replicas == nil { - spec.Replicas = Int32(1) - } - if spec.RestartPolicy == "" { - spec.RestartPolicy = ElasticBatchJobDefaultWorkerRestartPolicy - } -} - -// setTypeNamesToCamelCase sets the name of all replica types from any case to correct case. -func setTypeNamesToCamelCase(job *ElasticBatchJob) { - setTypeNameToCamelCase(job, ElasticBatchReplicaTypeWorker) -} - -// setTypeNameToCamelCase sets the name of the replica type from any case to correct case. -func setTypeNameToCamelCase(job *ElasticBatchJob, typ common.ReplicaType) { - for t := range job.Spec.ElasticBatchReplicaSpecs { - if strings.EqualFold(string(t), string(typ)) && t != typ { - spec := job.Spec.ElasticBatchReplicaSpecs[t] - delete(job.Spec.ElasticBatchReplicaSpecs, t) - job.Spec.ElasticBatchReplicaSpecs[typ] = spec - return - } - } -} - -func setDefaultDAGConditions(job *ElasticBatchJob) { - // DAG scheduling flow for ElasticBatch job - // - // AIMaster - // |--> Worker - - if job.Spec.ElasticBatchReplicaSpecs[common.JobReplicaTypeAIMaster] != nil { - for rtype := range job.Spec.ElasticBatchReplicaSpecs { - if rtype == common.JobReplicaTypeAIMaster { - continue - } - job.Spec.ElasticBatchReplicaSpecs[rtype].DependOn = append(job.Spec.ElasticBatchReplicaSpecs[rtype].DependOn, common.DAGCondition{ - Upstream: common.JobReplicaTypeAIMaster, - OnPhase: corev1.PodRunning, - }) - } - } -} - -func setDefaultAIMasterEnv(job *ElasticBatchJob, spec *corev1.PodSpec) { - jobName := job.ObjectMeta.Name - jobNamespace := job.ObjectMeta.Namespace - for i := range spec.Containers { - if spec.Containers[i].Name == ElasticBatchJobDefaultContainerName { - if len(spec.Containers[i].Env) == 0 { - spec.Containers[i].Env = make([]corev1.EnvVar, 0) - } - spec.Containers[i].Env = append(spec.Containers[i].Env, corev1.EnvVar{ - Name: "JOB_NAME", - Value: jobName, - }) - spec.Containers[i].Env = append(spec.Containers[i].Env, corev1.EnvVar{ - Name: "NAMESPACE", - Value: jobNamespace, - }) - spec.Containers[i].Env = append(spec.Containers[i].Env, corev1.EnvVar{ - Name: "JOB_TYPE", - Value: "ELASTICBATCH", - }) - break - } - } -} - -func EnableFallbackToLogsOnErrorTerminationMessagePolicy(podSpec *corev1.PodSpec) { - for ci := range podSpec.Containers { - c := &podSpec.Containers[ci] - if c.TerminationMessagePolicy == "" { - c.TerminationMessagePolicy = corev1.TerminationMessageFallbackToLogsOnError - } - } -} - -// SetDefaults_ElasticBatchJob sets any unspecified values to defaults. -func SetDefaults_ElasticBatchJob(job *ElasticBatchJob) { - if job.Kind == "" { - job.Kind = ElasticBatchJobKind - } - if job.APIVersion == "" { - job.APIVersion = GroupVersion.String() - } - // Set default cleanpod policy to None. - if job.Spec.CleanPodPolicy == nil { - policy := common.CleanPodPolicyNone - job.Spec.CleanPodPolicy = &policy - } - - // Set default success policy to "AllWorkers". - if job.Spec.SuccessPolicy == nil { - defaultPolicy := common.SuccessPolicyAllWorkers - job.Spec.SuccessPolicy = &defaultPolicy - } - - // Update the key of ElasticBatchReplicaSpecs to camel case. - setTypeNamesToCamelCase(job) - - if features.KubeDLFeatureGates.Enabled(features.DAGScheduling) { - setDefaultDAGConditions(job) - } - - for rType, spec := range job.Spec.ElasticBatchReplicaSpecs { - EnableFallbackToLogsOnErrorTerminationMessagePolicy(&spec.Template.Spec) - // Set default replicas and restart policy. - if rType == ElasticBatchReplicaTypeWorker { - setDefaultWorkerReplicas(spec) - } else if rType == ElasticBatchReplicaTypeAIMaster { - setDefaultAIMasterReplicas(spec) - setDefaultPort(&spec.Template.Spec) - setDefaultAIMasterEnv(job, &spec.Template.Spec) - } - } -} diff --git a/apis/inference/v1alpha1/defaults_test.go b/apis/inference/v1alpha1/defaults_test.go deleted file mode 100644 index 65e7c253..00000000 --- a/apis/inference/v1alpha1/defaults_test.go +++ /dev/null @@ -1,288 +0,0 @@ -/* -Copyright 2022 The Alibaba Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -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 v1alpha1 - -import ( - "reflect" - "testing" - - v1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - common "github.com/alibaba/kubedl/pkg/job_controller/api/v1" - "github.com/alibaba/kubedl/pkg/util" -) - -const ( - testImage = "test-image:latest" -) - -func expectedElasticBatchJob(cleanPodPolicy common.CleanPodPolicy, portName string, port int32) *ElasticBatchJob { - ports := []v1.ContainerPort{} - - // port not set - if portName != "" { - ports = append(ports, - v1.ContainerPort{ - Name: portName, - ContainerPort: port, - }, - ) - } - - // port set with custom name - if portName != ElasticBatchJobDefaultPortName { - ports = append(ports, - v1.ContainerPort{ - Name: ElasticBatchJobDefaultPortName, - ContainerPort: ElasticBatchJobDefaultPort, - }, - ) - } - - restartPolicy := common.RestartPolicyExitCode - defaultSuccessPolicy := common.SuccessPolicyAllWorkers - - return &ElasticBatchJob{ - TypeMeta: metav1.TypeMeta{ - Kind: ElasticBatchJobKind, - APIVersion: GroupVersion.String(), - }, - Spec: ElasticBatchJobSpec{ - SuccessPolicy: &defaultSuccessPolicy, - RunPolicy: common.RunPolicy{CleanPodPolicy: &cleanPodPolicy}, - ElasticBatchReplicaSpecs: map[common.ReplicaType]*common.ReplicaSpec{ - ElasticBatchReplicaTypeWorker: { - Replicas: Int32(1), - Template: v1.PodTemplateSpec{ - Spec: v1.PodSpec{ - Containers: []v1.Container{ - { - Name: ElasticBatchJobDefaultContainerName, - Image: testImage, - Ports: ports, - TerminationMessagePolicy: v1.TerminationMessageFallbackToLogsOnError, - }, - }, - }, - }, - RestartPolicy: restartPolicy, - }, - }, - }, - } -} - -func TestSetTypeNames(t *testing.T) { - spec := &common.ReplicaSpec{ - RestartPolicy: common.RestartPolicyAlways, - Template: v1.PodTemplateSpec{ - Spec: v1.PodSpec{ - Containers: []v1.Container{ - { - Name: ElasticBatchJobDefaultContainerName, - Image: testImage, - Ports: []v1.ContainerPort{ - { - Name: ElasticBatchJobDefaultPortName, - ContainerPort: ElasticBatchJobDefaultPort, - }, - }, - }, - }, - }, - }, - } - - workerUpperCase := common.ReplicaType("WORKER") - original := &ElasticBatchJob{ - Spec: ElasticBatchJobSpec{ - ElasticBatchReplicaSpecs: map[common.ReplicaType]*common.ReplicaSpec{ - workerUpperCase: spec, - }, - }, - } - - setTypeNamesToCamelCase(original) - if _, ok := original.Spec.ElasticBatchReplicaSpecs[workerUpperCase]; ok { - t.Errorf("Failed to delete key %s", workerUpperCase) - } - if _, ok := original.Spec.ElasticBatchReplicaSpecs[ElasticBatchReplicaTypeWorker]; !ok { - t.Errorf("Failed to set key %s", ElasticBatchReplicaTypeWorker) - } -} - -func TestSetDefaultElasticBatchJob(t *testing.T) { - customPortName := "customPort" - var customPort int32 = 1234 - - testCases := map[string]struct { - original *ElasticBatchJob - expected *ElasticBatchJob - }{ - "set replicas": { - original: &ElasticBatchJob{ - Spec: ElasticBatchJobSpec{ - ElasticBatchReplicaSpecs: map[common.ReplicaType]*common.ReplicaSpec{ - ElasticBatchReplicaTypeWorker: { - Template: v1.PodTemplateSpec{ - Spec: v1.PodSpec{ - Containers: []v1.Container{ - { - Name: ElasticBatchJobDefaultContainerName, - Image: testImage, - Ports: []v1.ContainerPort{ - { - Name: ElasticBatchJobDefaultPortName, - ContainerPort: ElasticBatchJobDefaultPort, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - expected: expectedElasticBatchJob(common.CleanPodPolicyNone, ElasticBatchJobDefaultPortName, ElasticBatchJobDefaultPort), - }, - "set replicas with default restartpolicy": { - original: &ElasticBatchJob{ - Spec: ElasticBatchJobSpec{ - ElasticBatchReplicaSpecs: map[common.ReplicaType]*common.ReplicaSpec{ - ElasticBatchReplicaTypeWorker: { - Template: v1.PodTemplateSpec{ - Spec: v1.PodSpec{ - Containers: []v1.Container{ - { - Name: ElasticBatchJobDefaultContainerName, - Image: testImage, - Ports: []v1.ContainerPort{ - { - Name: ElasticBatchJobDefaultPortName, - ContainerPort: ElasticBatchJobDefaultPort, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - expected: expectedElasticBatchJob(common.CleanPodPolicyNone, ElasticBatchJobDefaultPortName, ElasticBatchJobDefaultPort), - }, - "set replicas with default port": { - original: &ElasticBatchJob{ - Spec: ElasticBatchJobSpec{ - ElasticBatchReplicaSpecs: map[common.ReplicaType]*common.ReplicaSpec{ - ElasticBatchReplicaTypeWorker: { - Replicas: Int32(1), - Template: v1.PodTemplateSpec{ - Spec: v1.PodSpec{ - Containers: []v1.Container{ - { - Name: ElasticBatchJobDefaultContainerName, - Image: testImage, - Ports: []v1.ContainerPort{ - {Name: ElasticBatchJobDefaultPortName, ContainerPort: ElasticBatchJobDefaultPort}, - }, - }, - }, - }, - }, - }, - }, - }, - }, - expected: expectedElasticBatchJob(common.CleanPodPolicyNone, "", 0), - }, - "set replicas adding default port": { - original: &ElasticBatchJob{ - Spec: ElasticBatchJobSpec{ - ElasticBatchReplicaSpecs: map[common.ReplicaType]*common.ReplicaSpec{ - ElasticBatchReplicaTypeWorker: { - Replicas: Int32(1), - Template: v1.PodTemplateSpec{ - Spec: v1.PodSpec{ - Containers: []v1.Container{ - { - Name: ElasticBatchJobDefaultContainerName, - Image: testImage, - Ports: []v1.ContainerPort{ - {Name: customPortName, ContainerPort: customPort}, - {Name: ElasticBatchJobDefaultPortName, ContainerPort: ElasticBatchJobDefaultPort}, - }, - }, - }, - }, - }, - }, - }, - }, - }, - expected: expectedElasticBatchJob(common.CleanPodPolicyNone, customPortName, customPort), - }, - "set custom cleanpod policy": { - original: &ElasticBatchJob{ - Spec: ElasticBatchJobSpec{ - RunPolicy: common.RunPolicy{CleanPodPolicy: cleanPodPolicyPointer(common.CleanPodPolicyAll)}, - ElasticBatchReplicaSpecs: map[common.ReplicaType]*common.ReplicaSpec{ - ElasticBatchReplicaTypeWorker: { - Replicas: Int32(1), - Template: v1.PodTemplateSpec{ - Spec: v1.PodSpec{ - Containers: []v1.Container{ - { - Name: ElasticBatchJobDefaultContainerName, - Image: testImage, - Ports: []v1.ContainerPort{ - { - Name: customPortName, - ContainerPort: customPort, - }, - { - Name: ElasticBatchJobDefaultPortName, - ContainerPort: ElasticBatchJobDefaultPort, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - expected: expectedElasticBatchJob(common.CleanPodPolicyAll, customPortName, customPort), - }, - } - - for name, tc := range testCases { - SetDefaults_ElasticBatchJob(tc.original) - if !reflect.DeepEqual(tc.original, tc.expected) { - t.Errorf("%s: Want\n%v; Got\n %v", name, util.Pformat(tc.expected), util.Pformat(tc.original)) - } - } -} - -func cleanPodPolicyPointer(cleanPodPolicy common.CleanPodPolicy) *common.CleanPodPolicy { - c := cleanPodPolicy - return &c -} diff --git a/apis/inference/v1alpha1/elasticbatchjob_constants.go b/apis/inference/v1alpha1/elasticbatchjob_constants.go deleted file mode 100644 index ec9cec1d..00000000 --- a/apis/inference/v1alpha1/elasticbatchjob_constants.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2022 The Kubeflow Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// 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 v1alpha1 - -import ( - common "github.com/alibaba/kubedl/pkg/job_controller/api/v1" -) - -const ( - ElasticBatchJobKind = "ElasticBatchJob" - // ElasticBatchJobDefaultContainerName is the name of the ElasticBatchJob container. - ElasticBatchJobDefaultContainerName = "elasticbatch" - // ElasticBatchJobDefaultPortName is name of the port used to communicate between AIMaster and - // workers. - ElasticBatchJobDefaultPortName = "elstcbatch-port" - // ElasticBatchJobDefaultPort is default value of the port. - ElasticBatchJobDefaultPort = 23456 - // ElasticBatchJobDefaultMasterRestartPolicy is default RestartPolicy for Master ElasticBatchReplicaSpec. - ElasticBatchJobDefaultAIMasterRestartPolicy = common.RestartPolicyNever - // ElasticBatchJobDefaultWorkerRestartPolicy is default RestartPolicy for Worker ElasticBatchReplicaSpec, - ElasticBatchJobDefaultWorkerRestartPolicy = common.RestartPolicyExitCode -) diff --git a/apis/inference/v1alpha1/elasticbatchjob_types.go b/apis/inference/v1alpha1/elasticbatchjob_types.go deleted file mode 100644 index c62c320d..00000000 --- a/apis/inference/v1alpha1/elasticbatchjob_types.go +++ /dev/null @@ -1,88 +0,0 @@ -/*Copyright 2022 The Alibaba Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -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 v1alpha1 - -import ( - common "github.com/alibaba/kubedl/pkg/job_controller/api/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// ElasticBatchJobSpec defines the desired state of ElasticBatchJob -type ElasticBatchJobSpec struct { - // RunPolicy encapsulates various runtime policies of the distributed training - // job, for example how to clean up resources and how long the job can stay - // active. - common.RunPolicy `json:",inline"` - - // SuccessPolicy defines the policy to mark the ElasticBatchJob as succeeded when the job contains master role. - // Value "" means the default policy that the job is succeeded if all workers are succeeded or master completed, - // Value "AllWorkers" means the job is succeeded if all workers *AND* master are succeeded. - // Default to "" - // +optional - SuccessPolicy *common.SuccessPolicy `json:"successPolicy,omitempty"` - - // A map of ElasticBatchReplicaType (type) to ReplicaSpec (value). Specifies the ElasticBatchJob cluster configuration. - // For example, - // { - // "AIMaster": ReplicaSpec, - // "Worker": ReplicaSpec, - // } - ElasticBatchReplicaSpecs map[common.ReplicaType]*common.ReplicaSpec `json:"elasticBatchReplicaSpecs"` -} - -// +genclient -// +kubebuilder:object:root=true -// +kubebuilder:subresource:status -// +kubebuilder:resource:scope=Namespaced -// +kubebuilder:printcolumn:name="State",type=string,JSONPath=`.status.conditions[-1:].type` -// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` -// +kubebuilder:printcolumn:name="Model-Version",type=string,JSONPath=`.status.modelVersionName` -// +kubebuilder:printcolumn:name="Cache-Backend",type=string,JSONPath=`.status.cacheBackendName` -// +kubebuilder:printcolumn:name="Max-Lifetime",type=integer,JSONPath=`.spec.activeDeadlineSeconds` -// +kubebuilder:printcolumn:name="TTL-AFTER-FINISHED",type=integer,JSONPath=`.spec.ttlSecondsAfterFinished` - -// Represents a ElasticBatchJob resource. -type ElasticBatchJob struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec ElasticBatchJobSpec `json:"spec,omitempty"` - Status common.JobStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true -// +k8s:defaulter-gen=TypeMeta -// +kubebuilder:resource:scope=Namespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// ElasticBatchJobList contains a list of ElasticBatchJob - -type ElasticBatchJobList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []ElasticBatchJob `json:"items"` -} - -const ( - // ElasticBatchReplicaTypeAIMaster is the type of AIMaster of distributed ElasticBatchJob - ElasticBatchReplicaTypeAIMaster common.ReplicaType = common.JobReplicaTypeAIMaster - - // ElasticBatchReplicaTypeWorker is the type for workers of distributed ElasticBatchJob. - ElasticBatchReplicaTypeWorker common.ReplicaType = "Worker" -) - -func init() { - SchemeBuilder.Register(&ElasticBatchJob{}, &ElasticBatchJobList{}) -} diff --git a/apis/inference/v1alpha1/elasticbatchjob_types_test.go b/apis/inference/v1alpha1/elasticbatchjob_types_test.go deleted file mode 100644 index 7b42479b..00000000 --- a/apis/inference/v1alpha1/elasticbatchjob_types_test.go +++ /dev/null @@ -1,87 +0,0 @@ -/* -Copyright 2022 The Alibaba Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -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 v1alpha1 - -import ( - "context" - "testing" - - "github.com/onsi/gomega" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" - "k8s.io/client-go/kubernetes/scheme" - - v1 "github.com/alibaba/kubedl/pkg/job_controller/api/v1" -) - -func TestStorageElasticBatchJob(t *testing.T) { - key := types.NamespacedName{ - Name: "foo", - Namespace: "default", - } - created := &ElasticBatchJob{ - ObjectMeta: metav1.ObjectMeta{ - Name: "foo", - Namespace: "default", - }, - Spec: ElasticBatchJobSpec{ - ElasticBatchReplicaSpecs: map[v1.ReplicaType]*v1.ReplicaSpec{}, - }, - Status: v1.JobStatus{ - ReplicaStatuses: map[v1.ReplicaType]*v1.ReplicaStatus{}, - }, - } - g := gomega.NewGomegaWithT(t) - - expected := &ElasticBatchJob{ - TypeMeta: metav1.TypeMeta{ - Kind: ElasticBatchJobKind, - APIVersion: GroupVersion.Group + "/" + GroupVersion.Version, - }, - ObjectMeta: metav1.ObjectMeta{ - Name: "foo", - Namespace: "default", - ResourceVersion: "1", - }, - Spec: ElasticBatchJobSpec{ - ElasticBatchReplicaSpecs: map[v1.ReplicaType]*v1.ReplicaSpec{}, - }, - Status: v1.JobStatus{ - ReplicaStatuses: map[v1.ReplicaType]*v1.ReplicaStatus{}, - }, - } - scheme.Scheme.Default(expected) - - // Test Create - fetched := &ElasticBatchJob{} - g.Expect(c.Create(context.TODO(), created)).NotTo(gomega.HaveOccurred()) - - g.Expect(c.Get(context.TODO(), key, fetched)).NotTo(gomega.HaveOccurred()) - g.Expect(fetched).To(gomega.Equal(expected)) - - // Test Updating the Labels - updated := fetched.DeepCopy() - updated.Labels = map[string]string{"hello": "world"} - g.Expect(c.Update(context.TODO(), updated)).NotTo(gomega.HaveOccurred()) - - g.Expect(c.Get(context.TODO(), key, fetched)).NotTo(gomega.HaveOccurred()) - g.Expect(fetched).To(gomega.Equal(updated)) - - // Test Delete - g.Expect(c.Delete(context.TODO(), fetched)).NotTo(gomega.HaveOccurred()) - g.Expect(c.Get(context.TODO(), key, fetched)).To(gomega.HaveOccurred()) -} diff --git a/apis/inference/v1alpha1/groupversion_info.go b/apis/inference/v1alpha1/groupversion_info.go deleted file mode 100644 index 906c516f..00000000 --- a/apis/inference/v1alpha1/groupversion_info.go +++ /dev/null @@ -1,48 +0,0 @@ -/* -Copyright 2022 The Alibaba Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -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 v1alpha1 contains API Schema definitions for the inference v1alpha1 API group -//+kubebuilder:object:generate=true -//+groupName=inference.kubedl.io -package v1alpha1 - -import ( - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" -) - -var ( - // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "inference.kubedl.io", Version: "v1alpha1"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} - - // AddToScheme adds the types in this group-version to the given scheme. - AddToScheme = SchemeBuilder.AddToScheme -) - -func init() { - // We only register manually written functions here. The registration of the - // generated functions takes place in the generated files. The separation - // makes the code compile even when the generated files are missing. - SchemeBuilder.SchemeBuilder.Register(addDefaultingFuncs) -} - -// Resource takes an unqualified resource and returns a Group-qualified GroupResource. -func Resource(resource string) schema.GroupResource { - return GroupVersion.WithResource(resource).GroupResource() -} diff --git a/apis/inference/v1alpha1/v1alpha1_suite_test.go b/apis/inference/v1alpha1/v1alpha1_suite_test.go deleted file mode 100644 index eb6e5d95..00000000 --- a/apis/inference/v1alpha1/v1alpha1_suite_test.go +++ /dev/null @@ -1,40 +0,0 @@ -/* - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -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 v1alpha1 - -import ( - "log" - "os" - "testing" - - "k8s.io/client-go/kubernetes/scheme" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/client/fake" -) - -var c client.Client - -func TestMain(m *testing.M) { - err := SchemeBuilder.AddToScheme(scheme.Scheme) - if err != nil { - log.Fatal(err) - } - - c = fake.NewFakeClientWithScheme(scheme.Scheme) - - code := m.Run() - os.Exit(code) -} diff --git a/apis/inference/v1alpha1/zz_generated.defaults.go b/apis/inference/v1alpha1/zz_generated.defaults.go deleted file mode 100644 index 9f7c75dc..00000000 --- a/apis/inference/v1alpha1/zz_generated.defaults.go +++ /dev/null @@ -1,45 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright 2019 The Alibaba Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -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. -*/ -// Code generated by main. DO NOT EDIT. - -package v1alpha1 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// RegisterDefaults adds defaulters functions to the given scheme. -// Public to allow building arbitrary schemes. -// All generated defaulters are covering - they call all nested defaulters. -func RegisterDefaults(scheme *runtime.Scheme) error { - scheme.AddTypeDefaultingFunc(&ElasticBatchJob{}, func(obj interface{}) { SetObjectDefaults_ElasticBatchJob(obj.(*ElasticBatchJob)) }) - scheme.AddTypeDefaultingFunc(&ElasticBatchJobList{}, func(obj interface{}) { SetObjectDefaults_ElasticBatchJobList(obj.(*ElasticBatchJobList)) }) - return nil -} - -func SetObjectDefaults_ElasticBatchJob(in *ElasticBatchJob) { - SetDefaults_ElasticBatchJob(in) -} - -func SetObjectDefaults_ElasticBatchJobList(in *ElasticBatchJobList) { - for i := range in.Items { - a := &in.Items[i] - SetObjectDefaults_ElasticBatchJob(a) - } -} diff --git a/config/crd/bases/inference.kubedl.io_elasticbatchjobs.yaml b/config/crd/bases/inference.kubedl.io_elasticbatchjobs.yaml deleted file mode 100644 index cc3fb179..00000000 --- a/config/crd/bases/inference.kubedl.io_elasticbatchjobs.yaml +++ /dev/null @@ -1,3160 +0,0 @@ - ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.6.1 - creationTimestamp: null - name: elasticbatchjobs.inference.kubedl.io -spec: - group: inference.kubedl.io - names: - kind: ElasticBatchJob - listKind: ElasticBatchJobList - plural: elasticbatchjobs - singular: elasticbatchjob - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .status.conditions[-1:].type - name: State - type: string - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - - jsonPath: .status.modelVersionName - name: Model-Version - type: string - - jsonPath: .status.cacheBackendName - name: Cache-Backend - type: string - - jsonPath: .spec.activeDeadlineSeconds - name: Max-Lifetime - type: integer - - jsonPath: .spec.ttlSecondsAfterFinished - name: TTL-AFTER-FINISHED - type: integer - name: v1alpha1 - schema: - openAPIV3Schema: - properties: - apiVersion: - type: string - kind: - type: string - metadata: - type: object - spec: - properties: - activeDeadlineSeconds: - format: int64 - type: integer - backoffLimit: - format: int32 - type: integer - cleanPodPolicy: - type: string - cronPolicy: - properties: - concurrencyPolicy: - type: string - deadline: - format: date-time - type: string - historyLimit: - format: int32 - type: integer - schedule: - type: string - suspend: - type: boolean - required: - - schedule - type: object - elasticBatchReplicaSpecs: - additionalProperties: - properties: - replicas: - format: int32 - type: integer - restartPolicy: - type: string - spotReplicaSpec: - properties: - labels: - additionalProperties: - type: string - type: object - priorityClassName: - type: string - spotReplicaNumber: - format: int32 - type: integer - type: object - template: - properties: - metadata: - properties: - annotations: - additionalProperties: - type: string - type: object - finalizers: - items: - type: string - type: array - labels: - additionalProperties: - type: string - type: object - name: - type: string - namespace: - type: string - type: object - spec: - properties: - activeDeadlineSeconds: - format: int64 - type: integer - affinity: - properties: - nodeAffinity: - properties: - preferredDuringSchedulingIgnoredDuringExecution: - items: - properties: - preference: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchFields: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - type: object - weight: - format: int32 - type: integer - required: - - preference - - weight - type: object - type: array - requiredDuringSchedulingIgnoredDuringExecution: - properties: - nodeSelectorTerms: - items: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchFields: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - type: object - type: array - required: - - nodeSelectorTerms - type: object - type: object - podAffinity: - properties: - preferredDuringSchedulingIgnoredDuringExecution: - items: - properties: - podAffinityTerm: - properties: - labelSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - namespaceSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - namespaces: - items: - type: string - type: array - topologyKey: - type: string - required: - - topologyKey - type: object - weight: - format: int32 - type: integer - required: - - podAffinityTerm - - weight - type: object - type: array - requiredDuringSchedulingIgnoredDuringExecution: - items: - properties: - labelSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - namespaceSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - namespaces: - items: - type: string - type: array - topologyKey: - type: string - required: - - topologyKey - type: object - type: array - type: object - podAntiAffinity: - properties: - preferredDuringSchedulingIgnoredDuringExecution: - items: - properties: - podAffinityTerm: - properties: - labelSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - namespaceSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - namespaces: - items: - type: string - type: array - topologyKey: - type: string - required: - - topologyKey - type: object - weight: - format: int32 - type: integer - required: - - podAffinityTerm - - weight - type: object - type: array - requiredDuringSchedulingIgnoredDuringExecution: - items: - properties: - labelSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - namespaceSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - namespaces: - items: - type: string - type: array - topologyKey: - type: string - required: - - topologyKey - type: object - type: array - type: object - type: object - automountServiceAccountToken: - type: boolean - containers: - items: - properties: - args: - items: - type: string - type: array - command: - items: - type: string - type: array - env: - items: - properties: - name: - type: string - value: - type: string - valueFrom: - properties: - configMapKeyRef: - properties: - key: - type: string - name: - type: string - optional: - type: boolean - required: - - key - type: object - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource - type: object - secretKeyRef: - properties: - key: - type: string - name: - type: string - optional: - type: boolean - required: - - key - type: object - type: object - required: - - name - type: object - type: array - envFrom: - items: - properties: - configMapRef: - properties: - name: - type: string - optional: - type: boolean - type: object - prefix: - type: string - secretRef: - properties: - name: - type: string - optional: - type: boolean - type: object - type: object - type: array - image: - type: string - imagePullPolicy: - type: string - lifecycle: - properties: - postStart: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - type: object - preStop: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - type: object - type: object - livenessProbe: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - failureThreshold: - format: int32 - type: integer - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - initialDelaySeconds: - format: int32 - type: integer - periodSeconds: - format: int32 - type: integer - successThreshold: - format: int32 - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - format: int64 - type: integer - timeoutSeconds: - format: int32 - type: integer - type: object - name: - type: string - ports: - items: - properties: - containerPort: - format: int32 - type: integer - hostIP: - type: string - hostPort: - format: int32 - type: integer - name: - type: string - protocol: - default: TCP - type: string - required: - - containerPort - type: object - type: array - x-kubernetes-list-map-keys: - - containerPort - - protocol - x-kubernetes-list-type: map - readinessProbe: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - failureThreshold: - format: int32 - type: integer - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - initialDelaySeconds: - format: int32 - type: integer - periodSeconds: - format: int32 - type: integer - successThreshold: - format: int32 - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - format: int64 - type: integer - timeoutSeconds: - format: int32 - type: integer - type: object - resources: - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - type: object - securityContext: - properties: - allowPrivilegeEscalation: - type: boolean - capabilities: - properties: - add: - items: - type: string - type: array - drop: - items: - type: string - type: array - type: object - privileged: - type: boolean - procMount: - type: string - readOnlyRootFilesystem: - type: boolean - runAsGroup: - format: int64 - type: integer - runAsNonRoot: - type: boolean - runAsUser: - format: int64 - type: integer - seLinuxOptions: - properties: - level: - type: string - role: - type: string - type: - type: string - user: - type: string - type: object - seccompProfile: - properties: - localhostProfile: - type: string - type: - type: string - required: - - type - type: object - windowsOptions: - properties: - gmsaCredentialSpec: - type: string - gmsaCredentialSpecName: - type: string - hostProcess: - type: boolean - runAsUserName: - type: string - type: object - type: object - startupProbe: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - failureThreshold: - format: int32 - type: integer - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - initialDelaySeconds: - format: int32 - type: integer - periodSeconds: - format: int32 - type: integer - successThreshold: - format: int32 - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - format: int64 - type: integer - timeoutSeconds: - format: int32 - type: integer - type: object - stdin: - type: boolean - stdinOnce: - type: boolean - terminationMessagePath: - type: string - terminationMessagePolicy: - type: string - tty: - type: boolean - volumeDevices: - items: - properties: - devicePath: - type: string - name: - type: string - required: - - devicePath - - name - type: object - type: array - volumeMounts: - items: - properties: - mountPath: - type: string - mountPropagation: - type: string - name: - type: string - readOnly: - type: boolean - subPath: - type: string - subPathExpr: - type: string - required: - - mountPath - - name - type: object - type: array - workingDir: - type: string - required: - - name - type: object - type: array - dnsConfig: - properties: - nameservers: - items: - type: string - type: array - options: - items: - properties: - name: - type: string - value: - type: string - type: object - type: array - searches: - items: - type: string - type: array - type: object - dnsPolicy: - type: string - enableServiceLinks: - type: boolean - ephemeralContainers: - items: - properties: - args: - items: - type: string - type: array - command: - items: - type: string - type: array - env: - items: - properties: - name: - type: string - value: - type: string - valueFrom: - properties: - configMapKeyRef: - properties: - key: - type: string - name: - type: string - optional: - type: boolean - required: - - key - type: object - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource - type: object - secretKeyRef: - properties: - key: - type: string - name: - type: string - optional: - type: boolean - required: - - key - type: object - type: object - required: - - name - type: object - type: array - envFrom: - items: - properties: - configMapRef: - properties: - name: - type: string - optional: - type: boolean - type: object - prefix: - type: string - secretRef: - properties: - name: - type: string - optional: - type: boolean - type: object - type: object - type: array - image: - type: string - imagePullPolicy: - type: string - lifecycle: - properties: - postStart: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - type: object - preStop: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - type: object - type: object - livenessProbe: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - failureThreshold: - format: int32 - type: integer - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - initialDelaySeconds: - format: int32 - type: integer - periodSeconds: - format: int32 - type: integer - successThreshold: - format: int32 - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - format: int64 - type: integer - timeoutSeconds: - format: int32 - type: integer - type: object - name: - type: string - ports: - items: - properties: - containerPort: - format: int32 - type: integer - hostIP: - type: string - hostPort: - format: int32 - type: integer - name: - type: string - protocol: - default: TCP - type: string - required: - - containerPort - type: object - type: array - readinessProbe: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - failureThreshold: - format: int32 - type: integer - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - initialDelaySeconds: - format: int32 - type: integer - periodSeconds: - format: int32 - type: integer - successThreshold: - format: int32 - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - format: int64 - type: integer - timeoutSeconds: - format: int32 - type: integer - type: object - resources: - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - type: object - securityContext: - properties: - allowPrivilegeEscalation: - type: boolean - capabilities: - properties: - add: - items: - type: string - type: array - drop: - items: - type: string - type: array - type: object - privileged: - type: boolean - procMount: - type: string - readOnlyRootFilesystem: - type: boolean - runAsGroup: - format: int64 - type: integer - runAsNonRoot: - type: boolean - runAsUser: - format: int64 - type: integer - seLinuxOptions: - properties: - level: - type: string - role: - type: string - type: - type: string - user: - type: string - type: object - seccompProfile: - properties: - localhostProfile: - type: string - type: - type: string - required: - - type - type: object - windowsOptions: - properties: - gmsaCredentialSpec: - type: string - gmsaCredentialSpecName: - type: string - hostProcess: - type: boolean - runAsUserName: - type: string - type: object - type: object - startupProbe: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - failureThreshold: - format: int32 - type: integer - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - initialDelaySeconds: - format: int32 - type: integer - periodSeconds: - format: int32 - type: integer - successThreshold: - format: int32 - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - format: int64 - type: integer - timeoutSeconds: - format: int32 - type: integer - type: object - stdin: - type: boolean - stdinOnce: - type: boolean - targetContainerName: - type: string - terminationMessagePath: - type: string - terminationMessagePolicy: - type: string - tty: - type: boolean - volumeDevices: - items: - properties: - devicePath: - type: string - name: - type: string - required: - - devicePath - - name - type: object - type: array - volumeMounts: - items: - properties: - mountPath: - type: string - mountPropagation: - type: string - name: - type: string - readOnly: - type: boolean - subPath: - type: string - subPathExpr: - type: string - required: - - mountPath - - name - type: object - type: array - workingDir: - type: string - required: - - name - type: object - type: array - hostAliases: - items: - properties: - hostnames: - items: - type: string - type: array - ip: - type: string - type: object - type: array - hostIPC: - type: boolean - hostNetwork: - type: boolean - hostPID: - type: boolean - hostname: - type: string - imagePullSecrets: - items: - properties: - name: - type: string - type: object - type: array - initContainers: - items: - properties: - args: - items: - type: string - type: array - command: - items: - type: string - type: array - env: - items: - properties: - name: - type: string - value: - type: string - valueFrom: - properties: - configMapKeyRef: - properties: - key: - type: string - name: - type: string - optional: - type: boolean - required: - - key - type: object - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource - type: object - secretKeyRef: - properties: - key: - type: string - name: - type: string - optional: - type: boolean - required: - - key - type: object - type: object - required: - - name - type: object - type: array - envFrom: - items: - properties: - configMapRef: - properties: - name: - type: string - optional: - type: boolean - type: object - prefix: - type: string - secretRef: - properties: - name: - type: string - optional: - type: boolean - type: object - type: object - type: array - image: - type: string - imagePullPolicy: - type: string - lifecycle: - properties: - postStart: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - type: object - preStop: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - type: object - type: object - livenessProbe: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - failureThreshold: - format: int32 - type: integer - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - initialDelaySeconds: - format: int32 - type: integer - periodSeconds: - format: int32 - type: integer - successThreshold: - format: int32 - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - format: int64 - type: integer - timeoutSeconds: - format: int32 - type: integer - type: object - name: - type: string - ports: - items: - properties: - containerPort: - format: int32 - type: integer - hostIP: - type: string - hostPort: - format: int32 - type: integer - name: - type: string - protocol: - default: TCP - type: string - required: - - containerPort - type: object - type: array - x-kubernetes-list-map-keys: - - containerPort - - protocol - x-kubernetes-list-type: map - readinessProbe: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - failureThreshold: - format: int32 - type: integer - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - initialDelaySeconds: - format: int32 - type: integer - periodSeconds: - format: int32 - type: integer - successThreshold: - format: int32 - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - format: int64 - type: integer - timeoutSeconds: - format: int32 - type: integer - type: object - resources: - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - type: object - securityContext: - properties: - allowPrivilegeEscalation: - type: boolean - capabilities: - properties: - add: - items: - type: string - type: array - drop: - items: - type: string - type: array - type: object - privileged: - type: boolean - procMount: - type: string - readOnlyRootFilesystem: - type: boolean - runAsGroup: - format: int64 - type: integer - runAsNonRoot: - type: boolean - runAsUser: - format: int64 - type: integer - seLinuxOptions: - properties: - level: - type: string - role: - type: string - type: - type: string - user: - type: string - type: object - seccompProfile: - properties: - localhostProfile: - type: string - type: - type: string - required: - - type - type: object - windowsOptions: - properties: - gmsaCredentialSpec: - type: string - gmsaCredentialSpecName: - type: string - hostProcess: - type: boolean - runAsUserName: - type: string - type: object - type: object - startupProbe: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - failureThreshold: - format: int32 - type: integer - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - initialDelaySeconds: - format: int32 - type: integer - periodSeconds: - format: int32 - type: integer - successThreshold: - format: int32 - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - format: int64 - type: integer - timeoutSeconds: - format: int32 - type: integer - type: object - stdin: - type: boolean - stdinOnce: - type: boolean - terminationMessagePath: - type: string - terminationMessagePolicy: - type: string - tty: - type: boolean - volumeDevices: - items: - properties: - devicePath: - type: string - name: - type: string - required: - - devicePath - - name - type: object - type: array - volumeMounts: - items: - properties: - mountPath: - type: string - mountPropagation: - type: string - name: - type: string - readOnly: - type: boolean - subPath: - type: string - subPathExpr: - type: string - required: - - mountPath - - name - type: object - type: array - workingDir: - type: string - required: - - name - type: object - type: array - nodeName: - type: string - nodeSelector: - additionalProperties: - type: string - type: object - x-kubernetes-map-type: atomic - overhead: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - preemptionPolicy: - type: string - priority: - format: int32 - type: integer - priorityClassName: - type: string - readinessGates: - items: - properties: - conditionType: - type: string - required: - - conditionType - type: object - type: array - restartPolicy: - type: string - runtimeClassName: - type: string - schedulerName: - type: string - securityContext: - properties: - fsGroup: - format: int64 - type: integer - fsGroupChangePolicy: - type: string - runAsGroup: - format: int64 - type: integer - runAsNonRoot: - type: boolean - runAsUser: - format: int64 - type: integer - seLinuxOptions: - properties: - level: - type: string - role: - type: string - type: - type: string - user: - type: string - type: object - seccompProfile: - properties: - localhostProfile: - type: string - type: - type: string - required: - - type - type: object - supplementalGroups: - items: - format: int64 - type: integer - type: array - sysctls: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - windowsOptions: - properties: - gmsaCredentialSpec: - type: string - gmsaCredentialSpecName: - type: string - hostProcess: - type: boolean - runAsUserName: - type: string - type: object - type: object - serviceAccount: - type: string - serviceAccountName: - type: string - setHostnameAsFQDN: - type: boolean - shareProcessNamespace: - type: boolean - subdomain: - type: string - terminationGracePeriodSeconds: - format: int64 - type: integer - tolerations: - items: - properties: - effect: - type: string - key: - type: string - operator: - type: string - tolerationSeconds: - format: int64 - type: integer - value: - type: string - type: object - type: array - topologySpreadConstraints: - items: - properties: - labelSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - maxSkew: - format: int32 - type: integer - topologyKey: - type: string - whenUnsatisfiable: - type: string - required: - - maxSkew - - topologyKey - - whenUnsatisfiable - type: object - type: array - x-kubernetes-list-map-keys: - - topologyKey - - whenUnsatisfiable - x-kubernetes-list-type: map - volumes: - items: - properties: - awsElasticBlockStore: - properties: - fsType: - type: string - partition: - format: int32 - type: integer - readOnly: - type: boolean - volumeID: - type: string - required: - - volumeID - type: object - azureDisk: - properties: - cachingMode: - type: string - diskName: - type: string - diskURI: - type: string - fsType: - type: string - kind: - type: string - readOnly: - type: boolean - required: - - diskName - - diskURI - type: object - azureFile: - properties: - readOnly: - type: boolean - secretName: - type: string - shareName: - type: string - required: - - secretName - - shareName - type: object - cephfs: - properties: - monitors: - items: - type: string - type: array - path: - type: string - readOnly: - type: boolean - secretFile: - type: string - secretRef: - properties: - name: - type: string - type: object - user: - type: string - required: - - monitors - type: object - cinder: - properties: - fsType: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - volumeID: - type: string - required: - - volumeID - type: object - configMap: - properties: - defaultMode: - format: int32 - type: integer - items: - items: - properties: - key: - type: string - mode: - format: int32 - type: integer - path: - type: string - required: - - key - - path - type: object - type: array - name: - type: string - optional: - type: boolean - type: object - csi: - properties: - driver: - type: string - fsType: - type: string - nodePublishSecretRef: - properties: - name: - type: string - type: object - readOnly: - type: boolean - volumeAttributes: - additionalProperties: - type: string - type: object - required: - - driver - type: object - downwardAPI: - properties: - defaultMode: - format: int32 - type: integer - items: - items: - properties: - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - mode: - format: int32 - type: integer - path: - type: string - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource - type: object - required: - - path - type: object - type: array - type: object - emptyDir: - properties: - medium: - type: string - sizeLimit: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - ephemeral: - properties: - volumeClaimTemplate: - properties: - metadata: - properties: - annotations: - additionalProperties: - type: string - type: object - finalizers: - items: - type: string - type: array - labels: - additionalProperties: - type: string - type: object - name: - type: string - namespace: - type: string - type: object - spec: - properties: - accessModes: - items: - type: string - type: array - dataSource: - properties: - apiGroup: - type: string - kind: - type: string - name: - type: string - required: - - kind - - name - type: object - dataSourceRef: - properties: - apiGroup: - type: string - kind: - type: string - name: - type: string - required: - - kind - - name - type: object - resources: - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - type: object - selector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - storageClassName: - type: string - volumeMode: - type: string - volumeName: - type: string - type: object - required: - - spec - type: object - type: object - fc: - properties: - fsType: - type: string - lun: - format: int32 - type: integer - readOnly: - type: boolean - targetWWNs: - items: - type: string - type: array - wwids: - items: - type: string - type: array - type: object - flexVolume: - properties: - driver: - type: string - fsType: - type: string - options: - additionalProperties: - type: string - type: object - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - required: - - driver - type: object - flocker: - properties: - datasetName: - type: string - datasetUUID: - type: string - type: object - gcePersistentDisk: - properties: - fsType: - type: string - partition: - format: int32 - type: integer - pdName: - type: string - readOnly: - type: boolean - required: - - pdName - type: object - gitRepo: - properties: - directory: - type: string - repository: - type: string - revision: - type: string - required: - - repository - type: object - glusterfs: - properties: - endpoints: - type: string - path: - type: string - readOnly: - type: boolean - required: - - endpoints - - path - type: object - hostPath: - properties: - path: - type: string - type: - type: string - required: - - path - type: object - iscsi: - properties: - chapAuthDiscovery: - type: boolean - chapAuthSession: - type: boolean - fsType: - type: string - initiatorName: - type: string - iqn: - type: string - iscsiInterface: - type: string - lun: - format: int32 - type: integer - portals: - items: - type: string - type: array - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - targetPortal: - type: string - required: - - iqn - - lun - - targetPortal - type: object - name: - type: string - nfs: - properties: - path: - type: string - readOnly: - type: boolean - server: - type: string - required: - - path - - server - type: object - persistentVolumeClaim: - properties: - claimName: - type: string - readOnly: - type: boolean - required: - - claimName - type: object - photonPersistentDisk: - properties: - fsType: - type: string - pdID: - type: string - required: - - pdID - type: object - portworxVolume: - properties: - fsType: - type: string - readOnly: - type: boolean - volumeID: - type: string - required: - - volumeID - type: object - projected: - properties: - defaultMode: - format: int32 - type: integer - sources: - items: - properties: - configMap: - properties: - items: - items: - properties: - key: - type: string - mode: - format: int32 - type: integer - path: - type: string - required: - - key - - path - type: object - type: array - name: - type: string - optional: - type: boolean - type: object - downwardAPI: - properties: - items: - items: - properties: - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - mode: - format: int32 - type: integer - path: - type: string - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource - type: object - required: - - path - type: object - type: array - type: object - secret: - properties: - items: - items: - properties: - key: - type: string - mode: - format: int32 - type: integer - path: - type: string - required: - - key - - path - type: object - type: array - name: - type: string - optional: - type: boolean - type: object - serviceAccountToken: - properties: - audience: - type: string - expirationSeconds: - format: int64 - type: integer - path: - type: string - required: - - path - type: object - type: object - type: array - type: object - quobyte: - properties: - group: - type: string - readOnly: - type: boolean - registry: - type: string - tenant: - type: string - user: - type: string - volume: - type: string - required: - - registry - - volume - type: object - rbd: - properties: - fsType: - type: string - image: - type: string - keyring: - type: string - monitors: - items: - type: string - type: array - pool: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - user: - type: string - required: - - image - - monitors - type: object - scaleIO: - properties: - fsType: - type: string - gateway: - type: string - protectionDomain: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - sslEnabled: - type: boolean - storageMode: - type: string - storagePool: - type: string - system: - type: string - volumeName: - type: string - required: - - gateway - - secretRef - - system - type: object - secret: - properties: - defaultMode: - format: int32 - type: integer - items: - items: - properties: - key: - type: string - mode: - format: int32 - type: integer - path: - type: string - required: - - key - - path - type: object - type: array - optional: - type: boolean - secretName: - type: string - type: object - storageos: - properties: - fsType: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - volumeName: - type: string - volumeNamespace: - type: string - type: object - vsphereVolume: - properties: - fsType: - type: string - storagePolicyID: - type: string - storagePolicyName: - type: string - volumePath: - type: string - required: - - volumePath - type: object - required: - - name - type: object - type: array - required: - - containers - type: object - type: object - type: object - type: object - schedulingPolicy: - properties: - minAvailable: - format: int32 - type: integer - priority: - format: int32 - type: integer - priorityClassName: - type: string - queue: - type: string - type: object - successPolicy: - type: string - ttlSecondsAfterFinished: - format: int32 - type: integer - required: - - elasticBatchReplicaSpecs - type: object - status: - properties: - cacheBackendName: - type: string - completionTime: - format: date-time - type: string - conditions: - items: - properties: - lastTransitionTime: - format: date-time - type: string - lastUpdateTime: - format: date-time - type: string - message: - type: string - reason: - type: string - status: - type: string - type: - type: string - required: - - status - - type - type: object - type: array - lastReconcileTime: - format: date-time - type: string - modelVersionName: - type: string - replicaStatuses: - additionalProperties: - properties: - active: - format: int32 - type: integer - evicted: - format: int32 - type: integer - failed: - format: int32 - type: integer - succeeded: - format: int32 - type: integer - type: object - type: object - startTime: - format: date-time - type: string - required: - - replicaStatuses - type: object - type: object - served: true - storage: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml index e4953ce7..3b7a6bfa 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -14,7 +14,6 @@ resources: - bases/apps.kubedl.io_crons.yaml - bases/cache.kubedl.io_cachebackends.yaml - bases/notebook.kubedl.io_notebooks.yaml -- bases/inference.kubedl.io_elasticbatchjobs.yaml # +kubebuilder:scaffold:crdkustomizeresource patchesStrategicMerge: @@ -32,7 +31,6 @@ patchesStrategicMerge: #- patches/webhook_in_crons.yaml #- patches/webhook_in_cachebackends.yaml #- patches/webhook_in_notebooks.yaml -#- patches/webhook_in_elasticbatchjobs.yaml # +kubebuilder:scaffold:crdkustomizewebhookpatch # [CERTMANAGER] To enable webhook, uncomment all the sections with [CERTMANAGER] prefix. @@ -49,7 +47,6 @@ patchesStrategicMerge: #- patches/cainjection_in_crons.yaml #- patches/cainjection_in_cachebackends.yaml #- patches/cainjection_in_notebooks.yaml -#- patches/cainjection_in_elasticbatchjobs.yaml # +kubebuilder:scaffold:crdkustomizecainjectionpatch # the following config is for teaching kustomize how to do kustomization for CRDs. diff --git a/config/crd/patches/cainjection_in_elasticbatchjobs.yaml b/config/crd/patches/cainjection_in_elasticbatchjobs.yaml deleted file mode 100644 index ce49a863..00000000 --- a/config/crd/patches/cainjection_in_elasticbatchjobs.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# The following patch adds a directive for certmanager to inject CA into the CRD -# CRD conversion requires k8s 1.13 or later. -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - annotations: - cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) - name: elasticbatchjobs.inference.kubedl.io diff --git a/config/crd/patches/webhook_in_elasticbatchjobs.yaml b/config/crd/patches/webhook_in_elasticbatchjobs.yaml deleted file mode 100644 index 0f0fa873..00000000 --- a/config/crd/patches/webhook_in_elasticbatchjobs.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# The following patch enables conversion webhook for CRD -# CRD conversion requires k8s 1.13 or later. -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: elasticbatchjobs.inference.kubedl.io -spec: - conversion: - strategy: Webhook - webhookClientConfig: - # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank, - # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) - caBundle: Cg== - service: - namespace: system - name: webhook-service - path: /convert diff --git a/config/manager/all_in_one.yaml b/config/manager/all_in_one.yaml index f5c5a022..24df0796 100644 --- a/config/manager/all_in_one.yaml +++ b/config/manager/all_in_one.yaml @@ -396,30 +396,6 @@ rules: - get - patch - update - - apiGroups: - - inference.kubedl.io - resources: - - elasticbatchjobs - verbs: - - get - - list - - watch - - create - - update - - patch - - delete - - apiGroups: - - inference.kubedl.io - resources: - - elasticbatchjobs/status - verbs: - - get - - list - - watch - - create - - update - - patch - - delete - apiGroups: - cache.kubedl.io resources: diff --git a/config/rbac/elasticbatchjob_editor_role.yaml b/config/rbac/elasticbatchjob_editor_role.yaml deleted file mode 100644 index 5c95abff..00000000 --- a/config/rbac/elasticbatchjob_editor_role.yaml +++ /dev/null @@ -1,24 +0,0 @@ -# permissions for end users to edit elasticbatchjobs. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: elasticbatchjob-editor-role -rules: -- apiGroups: - - inference.kubedl.io - resources: - - elasticbatchjobs - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - inference.kubedl.io - resources: - - elasticbatchjobs/status - verbs: - - get diff --git a/config/rbac/elasticbatchjob_viewer_role.yaml b/config/rbac/elasticbatchjob_viewer_role.yaml deleted file mode 100644 index 79e1bd99..00000000 --- a/config/rbac/elasticbatchjob_viewer_role.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# permissions for end users to view elasticbatchjobs. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: elasticbatchjob-viewer-role -rules: -- apiGroups: - - inference.kubedl.io - resources: - - elasticbatchjobs - verbs: - - get - - list - - watch -- apiGroups: - - inference.kubedl.io - resources: - - elasticbatchjobs/status - verbs: - - get diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index bc149e47..b3940960 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -165,26 +165,6 @@ rules: - get - patch - update -- apiGroups: - - inference.kubedl.io - resources: - - elasticbatchjobs - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - inference.kubedl.io - resources: - - elasticbatchjobs/status - verbs: - - get - - patch - - update - apiGroups: - model.kubedl.io resources: diff --git a/config/samples/inference_v1alpha1_elasticbatchjob.yaml b/config/samples/inference_v1alpha1_elasticbatchjob.yaml deleted file mode 100644 index d0b51e68..00000000 --- a/config/samples/inference_v1alpha1_elasticbatchjob.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: inference.kubedl.io/v1alpha1 -kind: ElasticBatchJob -metadata: - name: elasticbatchjob-sample -spec: - # Add fields here - foo: bar diff --git a/controllers/add_elasticbatch.go b/controllers/add_elasticbatch.go deleted file mode 100644 index ec22e2d9..00000000 --- a/controllers/add_elasticbatch.go +++ /dev/null @@ -1,31 +0,0 @@ -/* -Copyright 2022 The Alibaba Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -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 controllers - -import ( - controllerruntime "sigs.k8s.io/controller-runtime" - - inference "github.com/alibaba/kubedl/apis/inference/v1alpha1" - "github.com/alibaba/kubedl/cmd/options" - "github.com/alibaba/kubedl/controllers/elasticbatch" -) - -func init() { - SetupWithManagerMap[&inference.ElasticBatchJob{}] = func(mgr controllerruntime.Manager, config options.JobControllerConfiguration) error { - return elasticbatch.NewReconciler(mgr, config).SetupWithManager(mgr) - } -} diff --git a/controllers/apps/cron_controller.go b/controllers/apps/cron_controller.go index 1aef6094..2eb908e9 100644 --- a/controllers/apps/cron_controller.go +++ b/controllers/apps/cron_controller.go @@ -26,7 +26,6 @@ import ( cronutil "github.com/robfig/cron/v3" "github.com/alibaba/kubedl/apis/apps/v1alpha1" - inferencev1alpha1 "github.com/alibaba/kubedl/apis/inference/v1alpha1" trainingv1alpha1 "github.com/alibaba/kubedl/apis/training/v1alpha1" "github.com/alibaba/kubedl/cmd/options" v1 "github.com/alibaba/kubedl/pkg/job_controller/api/v1" @@ -488,6 +487,5 @@ var ( &trainingv1alpha1.XGBoostJob{}, &trainingv1alpha1.XDLJob{}, &trainingv1alpha1.MPIJob{}, - &inferencev1alpha1.ElasticBatchJob{}, } ) diff --git a/controllers/elasticbatch/elasticbatch.go b/controllers/elasticbatch/elasticbatch.go deleted file mode 100644 index 4c07d1af..00000000 --- a/controllers/elasticbatch/elasticbatch.go +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 The Alibaba Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// 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 controller provides a Kubernetes controller for a ElasticBatchJob resource. -package elasticbatch - -import ( - "context" - "encoding/json" - "strconv" - - inference "github.com/alibaba/kubedl/apis/inference/v1alpha1" -) - -type ElasticBatchConfig struct { - Task TaskSpec `json:"task"` - Environment string `json:"environment"` -} - -// TaskSpec is the specification for a task (PS or worker) of the ElasticBatchJob. -type TaskSpec struct { - Type string `json:"type"` - Index int `json:"index"` -} - -// Generate the environment variable ElASTICBATCH_CONFIG -// { -// "task": { -// "type": "worker", -// "index": 1 -// }, -// } -func genElasticBatchConfigJSONStr(ctx context.Context, elasticbatchjob *inference.ElasticBatchJob, rtype, index string) (string, error) { - // Configure the ElASTICBATCH_CONFIG environment variable. - i, err := strconv.ParseInt(index, 0, 32) - if err != nil { - return "", err - } - - elasticBatchConfig := ElasticBatchConfig{ - Task: TaskSpec{ - Type: rtype, - Index: int(i), - }, - Environment: "cloud", - } - - elasticBatchConfigJSONStr, err := json.Marshal(elasticBatchConfig) - if err != nil { - return "", err - } - - return string(elasticBatchConfigJSONStr), nil -} diff --git a/controllers/elasticbatch/elasticbatchjob_controller_test.go b/controllers/elasticbatch/elasticbatchjob_controller_test.go deleted file mode 100644 index c14bae56..00000000 --- a/controllers/elasticbatch/elasticbatchjob_controller_test.go +++ /dev/null @@ -1,294 +0,0 @@ -// Copyright 2022 The Alibaba Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// 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 elasticbatch - -import ( - "context" - "strings" - "testing" - - "github.com/prometheus/client_golang/prometheus" - "github.com/spf13/pflag" - "github.com/stretchr/testify/assert" - "k8s.io/client-go/util/workqueue" - - "github.com/alibaba/kubedl/apis" - inference "github.com/alibaba/kubedl/apis/inference/v1alpha1" - "github.com/alibaba/kubedl/cmd/options" - "github.com/alibaba/kubedl/pkg/gang_schedule/registry" - "github.com/alibaba/kubedl/pkg/job_controller" - v1 "github.com/alibaba/kubedl/pkg/job_controller/api/v1" - "github.com/alibaba/kubedl/pkg/metrics" - "github.com/alibaba/kubedl/pkg/util" - - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/types" - "k8s.io/client-go/tools/record" - k8scontroller "k8s.io/kubernetes/pkg/controller" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/client/fake" - "sigs.k8s.io/controller-runtime/pkg/reconcile" -) - -func init() { - // Enable klog which is used in dependencies - _ = pflag.Set("logtostderr", "true") - _ = pflag.Set("v", "10") -} - -type ElasticBatchJobReconcilerTest struct { - ElasticBatchJobReconciler -} - -func (r *ElasticBatchJobReconcilerTest) GetJobFromAPIClient(namespace, name string) (metav1.Object, error) { - job := &inference.ElasticBatchJob{} - err := r.Get(context.Background(), types.NamespacedName{Namespace: namespace, Name: name}, job) - return job, err -} - -func (r *ElasticBatchJobReconcilerTest) satisfiedExpectations(elasticbatchJob *inference.ElasticBatchJob) bool { - // during unit test, no watch events will happen, hence always return true to trigger reconcile - return true -} - -type FakeJobExpectations struct { - *k8scontroller.ControllerExpectations -} - -func (fe FakeJobExpectations) SatisfiedExpectations(controllerKey string) bool { - // alwasys return true, so that, reconcile loop can always trigger sync, - return true -} - -func tearDown() { - prometheus.DefaultRegisterer = prometheus.NewRegistry() -} - -// NewReconciler returns a new reconcile.Reconciler -func NewReconcilerTest(client client.Client, scheme *runtime.Scheme, - recorder record.EventRecorder, - config options.JobControllerConfiguration) *ElasticBatchJobReconcilerTest { - r := &ElasticBatchJobReconcilerTest{ - ElasticBatchJobReconciler{ - Client: client, - scheme: scheme, - }, - } - r.recorder = recorder - // Initialize pkg job controller with components we only need. - r.ctrl = job_controller.JobController{ - Client: client, - APIReader: client, - BackoffStatesQueue: workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()), - Controller: r, - PodControl: job_controller.NewPodControl(client, recorder), - ServiceControl: job_controller.NewServiceControl(client, recorder), - Config: config, - Recorder: recorder, - Metrics: metrics.NewJobMetrics(inference.ElasticBatchJobKind, client), - } - if r.ctrl.Config.EnableGangScheduling { - r.ctrl.GangScheduler = registry.Get(r.ctrl.Config.GangSchedulerName) - } - r.ctrl.Expectations = FakeJobExpectations{ControllerExpectations: k8scontroller.NewControllerExpectations()} - return r -} - -// Test Scenario: check the job is succeeded only if all workers are succeeded -// 1. Create a job with 2 replicas -// 2. Mark the 2 pods as running, and check the job is running -// 3. Mark worker0 as succeeded, the job should still be running, because the successPolicy is AllWorkers -// 4. Mark worker1 as succeeded, now assert the job should be succeeded -func TestAllWorkersSuccessPolicy(t *testing.T) { - scheme := runtime.NewScheme() - _ = apis.AddToScheme(scheme) - _ = corev1.AddToScheme(scheme) - defer tearDown() - - // a job with 2 replicas - elasticbatchJob := createElasticBatchJob("job1", 2) - fakeClient := fake.NewFakeClientWithScheme(scheme, elasticbatchJob) - jobControllerConfig := options.JobControllerConfiguration{} - eventBroadcaster := record.NewBroadcaster() - recorder := eventBroadcaster.NewRecorder(scheme, corev1.EventSource{Component: "broadcast-controller"}) - elasticbatchJobReconciler := NewReconcilerTest(fakeClient, scheme, recorder, jobControllerConfig) - - jobRequest := reconcile.Request{ - NamespacedName: types.NamespacedName{ - Name: "job1", - Namespace: "default", - }, - } - // reconcile the job, it should create 2 replicas - _, _ = elasticbatchJobReconciler.Reconcile(context.Background(), jobRequest) - - markPodStatus("job1-aimaster-0", corev1.PodRunning, elasticbatchJobReconciler) - // mark two pods running - markPodStatus("job1-worker-0", corev1.PodRunning, elasticbatchJobReconciler) - markPodStatus("job1-worker-1", corev1.PodRunning, elasticbatchJobReconciler) - - // Reconcile again, the job should go into Running state - _, _ = elasticbatchJobReconciler.Reconcile(context.Background(), jobRequest) - _ = elasticbatchJobReconciler.Get(context.TODO(), jobRequest.NamespacedName, elasticbatchJob) - assert.True(t, util.HasCondition(elasticbatchJob.Status, v1.JobRunning)) - - // make job1-worker-0 succeed - markPodStatus("job1-worker-0", corev1.PodSucceeded, elasticbatchJobReconciler) - - // reconcile again - _, _ = elasticbatchJobReconciler.Reconcile(context.Background(), jobRequest) - // one worker succeeded, because of AllWorker SuccessPolicy, the job is still running - _ = elasticbatchJobReconciler.Get(context.TODO(), jobRequest.NamespacedName, elasticbatchJob) - assert.True(t, util.HasCondition(elasticbatchJob.Status, v1.JobRunning)) - - // mark job1-worker-0 succeed too - markPodStatus("job1-worker-1", corev1.PodSucceeded, elasticbatchJobReconciler) - - // reconcile again - _, _ = elasticbatchJobReconciler.Reconcile(context.Background(), jobRequest) - - // two workers succeeded, the jobs is succeeded - _ = elasticbatchJobReconciler.Get(context.TODO(), jobRequest.NamespacedName, elasticbatchJob) - assert.True(t, util.HasCondition(elasticbatchJob.Status, v1.JobSucceeded)) -} - -func markPodStatus(podName string, status corev1.PodPhase, elasticbatchJobReconciler *ElasticBatchJobReconcilerTest) { - worker := reconcile.Request{ - NamespacedName: types.NamespacedName{ - Name: podName, - Namespace: "default", - }, - } - pod := &corev1.Pod{} - _ = elasticbatchJobReconciler.Get(context.TODO(), worker.NamespacedName, pod) - - var containerState corev1.ContainerState - switch status { - case corev1.PodSucceeded: - containerState = corev1.ContainerState{ - Terminated: &corev1.ContainerStateTerminated{ - ExitCode: 0, - }, - } - case corev1.PodRunning: - containerState = corev1.ContainerState{ - Running: &corev1.ContainerStateRunning{ - StartedAt: metav1.Now(), - }, - } - } - - pod.Status.ContainerStatuses = []corev1.ContainerStatus{ - { - Name: "elasticbatch", - State: containerState, - }, - } - pod.Status.Phase = status - if status == corev1.PodRunning { - now := metav1.Now() - pod.Status.StartTime = &now - } - _ = elasticbatchJobReconciler.Status().Update(context.Background(), pod) -} - -func createElasticBatchJob(jobName string, replicas int32) *inference.ElasticBatchJob { - var aimasterReplica int32 = 1 - - successPolicy := v1.SuccessPolicyAllWorkers - elasticbatchJob1 := &inference.ElasticBatchJob{ - ObjectMeta: metav1.ObjectMeta{ - Name: jobName, - Namespace: "default", - UID: "12345", - Annotations: map[string]string{"aimaster": "ready"}, - }, - - Spec: inference.ElasticBatchJobSpec{ - ElasticBatchReplicaSpecs: map[v1.ReplicaType]*v1.ReplicaSpec{ - "AIMaster": { - Replicas: &aimasterReplica, - RestartPolicy: "Never", - Template: corev1.PodTemplateSpec{ - ObjectMeta: metav1.ObjectMeta{ - Name: jobName + "-aimaster-pod", - }, - Spec: corev1.PodSpec{ - Containers: []corev1.Container{ - { - Name: "elasticbatch", - Image: "kubedl/aimaster:latest", - }, - }, - }, - }, - }, - "Worker": { - Replicas: &replicas, - RestartPolicy: "Never", - Template: corev1.PodTemplateSpec{ - Spec: corev1.PodSpec{ - Containers: []corev1.Container{ - { - Name: "elasticbatch", - Image: "kubedl/elasticbatch:1.0", - }, - }, - }, - }, - }, - }, - SuccessPolicy: &successPolicy, - }, - Status: v1.JobStatus{}, - } - return elasticbatchJob1 -} - -// not used, maybe using later.. -func createPodForJob(podName string, job *inference.ElasticBatchJob) *corev1.Pod { - labelGroupName := v1.GroupNameLabel - labelJobName := v1.JobNameLabel - groupName := inference.GroupVersion.Group - labels := map[string]string{ - labelGroupName: groupName, - labelJobName: strings.Replace(job.Name, "/", "-", -1), - } - labels[v1.ReplicaTypeLabel] = "Worker" - labels[v1.ReplicaIndexLabel] = "0" - return &corev1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: podName, - Labels: labels, - Namespace: "default", - DeletionTimestamp: nil, - }, - - Status: corev1.PodStatus{ - ContainerStatuses: []corev1.ContainerStatus{ - { - Name: "elasticbatch", - State: corev1.ContainerState{ - Terminated: &corev1.ContainerStateTerminated{ - ExitCode: 0, - }, - }, - }, - }, - Phase: corev1.PodSucceeded, - }, - } -} diff --git a/controllers/elasticbatch/job.go b/controllers/elasticbatch/job.go deleted file mode 100644 index 6ac4604d..00000000 --- a/controllers/elasticbatch/job.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2022 The Alibaba Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -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 elasticbatch - -import ( - "context" - "fmt" - - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" - - inference "github.com/alibaba/kubedl/apis/inference/v1alpha1" - "github.com/alibaba/kubedl/pkg/job_controller" - v1 "github.com/alibaba/kubedl/pkg/job_controller/api/v1" -) - -// GetJobFromInformerCache returns the Job from Informer Cache -func (r *ElasticBatchJobReconciler) GetJobFromInformerCache(namespace, name string) (metav1.Object, error) { - job := &inference.ElasticBatchJob{} - // Default reader for ElasticBatchJob is cache reader. - err := r.Get(context.Background(), types.NamespacedName{Namespace: namespace, Name: name}, job) - if err != nil { - if errors.IsNotFound(err) { - log.Info("elasticbatch job not found", "namespace", namespace, "name", name) - } else { - log.Error(err, "failed to get job from api-server", "namespace", namespace, "name", name) - } - return nil, err - } - return job, nil -} - -// GetJobFromAPIClient returns the Job from API server -func (r *ElasticBatchJobReconciler) GetJobFromAPIClient(namespace, name string) (metav1.Object, error) { - job := &inference.ElasticBatchJob{} - err := r.ctrl.APIReader.Get(context.Background(), types.NamespacedName{Namespace: namespace, Name: name}, job) - if err != nil { - if errors.IsNotFound(err) { - log.Info("elasticbatch job not found", "namespace", namespace, "name", name) - } else { - log.Error(err, "failed to get job from api-server", "namespace", namespace, "name", name) - } - return nil, err - } - return job, nil -} - -// DeleteJob deletes the job -func (r *ElasticBatchJobReconciler) DeleteJob(job interface{}) error { - elasticbatchJob, ok := job.(*inference.ElasticBatchJob) - if !ok { - return fmt.Errorf("%+v is not a type of ElasticBatchJob", elasticbatchJob) - } - if err := r.Delete(context.Background(), elasticbatchJob); err != nil { - r.recorder.Eventf(elasticbatchJob, corev1.EventTypeWarning, job_controller.FailedDeleteJobReason, "Error deleting: %v", err) - log.Error(err, "failed to delete job", "namespace", elasticbatchJob.Namespace, "name", elasticbatchJob.Name) - return err - } - r.recorder.Eventf(elasticbatchJob, corev1.EventTypeNormal, job_controller.SuccessfulDeleteJobReason, "Deleted job: %v", elasticbatchJob.Name) - log.Info("job deleted", "namespace", elasticbatchJob.Namespace, "name", elasticbatchJob.Name) - return nil -} - -// UpdateJobStatus updates the job status and job conditions -func (r *ElasticBatchJobReconciler) UpdateJobStatus(job interface{}, replicas map[v1.ReplicaType]*v1.ReplicaSpec, jobStatus *v1.JobStatus, restart bool) error { - elasticbatchJob, ok := job.(*inference.ElasticBatchJob) - if !ok { - return fmt.Errorf("%+v is not a type of ElasticBatchJob", elasticbatchJob) - } - return r.updateGeneralJobStatus(elasticbatchJob, replicas, jobStatus, restart) -} - -// UpdateJobStatusInApiServer updates the job status in API server -func (r *ElasticBatchJobReconciler) UpdateJobStatusInApiServer(job interface{}, jobStatus *v1.JobStatus) error { - elasticbatchJob, ok := job.(*inference.ElasticBatchJob) - if !ok { - return fmt.Errorf("%+v is not a type of ElasticBatchJob", elasticbatchJob) - } - jobCpy := elasticbatchJob.DeepCopy() - jobCpy.Status = *jobStatus.DeepCopy() - return r.Status().Update(context.Background(), jobCpy) -} diff --git a/controllers/elasticbatch/pod.go b/controllers/elasticbatch/pod.go deleted file mode 100644 index 648e0e6e..00000000 --- a/controllers/elasticbatch/pod.go +++ /dev/null @@ -1,48 +0,0 @@ -/* -Copyright 2022 The Alibaba Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -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 elasticbatch - -import ( - "context" - - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/meta" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "sigs.k8s.io/controller-runtime/pkg/client" -) - -// GetPodsForJob returns the set of pods that this job should manage. -func (r *ElasticBatchJobReconciler) GetPodsForJob(obj interface{}) ([]*corev1.Pod, error) { - job, err := meta.Accessor(obj) - if err != nil { - return nil, err - } - selector, err := metav1.LabelSelectorAsSelector(&metav1.LabelSelector{ - MatchLabels: r.ctrl.GenLabels(job.GetName()), - }) - if err != nil { - return nil, err - } - // List all pods to include those that don't match the selector anymore - // but have a ControllerRef pointing to this controller. - podList := &corev1.PodList{} - err = r.List(context.Background(), podList, client.MatchingLabelsSelector{Selector: selector}) - if err != nil { - return nil, err - } - return r.ctrl.AdoptAndClaimPods(job, podList) -} diff --git a/controllers/elasticbatch/service.go b/controllers/elasticbatch/service.go deleted file mode 100644 index 5ff5a7ea..00000000 --- a/controllers/elasticbatch/service.go +++ /dev/null @@ -1,51 +0,0 @@ -/* -Copyright 2012 The Alibaba Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -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 elasticbatch - -import ( - "context" - - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/meta" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "sigs.k8s.io/controller-runtime/pkg/client" -) - -// GetServicesForJob returns the services managed by the job. This can be achieved by selecting services using label key "job-name" -// i.e. all services created by the job will come with label "job-name" = -func (r *ElasticBatchJobReconciler) GetServicesForJob(obj interface{}) ([]*corev1.Service, error) { - job, err := meta.Accessor(obj) - if err != nil { - return nil, err - } - - selector, err := metav1.LabelSelectorAsSelector(&metav1.LabelSelector{ - MatchLabels: r.ctrl.GenLabels(job.GetName()), - }) - if err != nil { - return nil, err - } - - // List all pods to include those that don't match the selector anymore - // but have a ControllerRef pointing to this controller. - serviceList := &corev1.ServiceList{} - err = r.List(context.Background(), serviceList, client.MatchingLabelsSelector{Selector: selector}) - if err != nil { - return nil, err - } - return r.ctrl.AdoptAndClaimServices(job, serviceList) -} diff --git a/controllers/elasticbatch/status.go b/controllers/elasticbatch/status.go deleted file mode 100644 index 8c056818..00000000 --- a/controllers/elasticbatch/status.go +++ /dev/null @@ -1,172 +0,0 @@ -/* -Copyright 2022 The Alibaba Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -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 elasticbatch - -import ( - "errors" - "fmt" - - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "sigs.k8s.io/controller-runtime/pkg/event" - "sigs.k8s.io/controller-runtime/pkg/reconcile" - - inference "github.com/alibaba/kubedl/apis/inference/v1alpha1" - "github.com/alibaba/kubedl/pkg/job_controller" - v1 "github.com/alibaba/kubedl/pkg/job_controller/api/v1" - commonutil "github.com/alibaba/kubedl/pkg/util" -) - -// updateGeneralJobStatus updates the status of job with given replica specs and job status. -func (r *ElasticBatchJobReconciler) updateGeneralJobStatus(elasticbatchJob *inference.ElasticBatchJob, - replicaSpecs map[v1.ReplicaType]*v1.ReplicaSpec, jobStatus *v1.JobStatus, restart bool) error { - log.Info("Updating status", "ElasticBatchJob name", elasticbatchJob.Name, "restart", restart) - - // Set job status start time since this job has acknowledged by controller. - if jobStatus.StartTime == nil { - now := metav1.Now() - jobStatus.StartTime = &now - } - - previousRestarting := commonutil.IsRestarting(*jobStatus) - previousFailed := commonutil.IsFailed(*jobStatus) - allWorkersSucceed := false - workerRep, workerFound := replicaSpecs[inference.ElasticBatchReplicaTypeWorker] - if workerFound { - succeed := int32(0) - if jobStatus.ReplicaStatuses[inference.ElasticBatchReplicaTypeWorker] != nil { - succeed = jobStatus.ReplicaStatuses[inference.ElasticBatchReplicaTypeWorker].Succeeded - } - allWorkersSucceed = *workerRep.Replicas == succeed - } - - for rtype, spec := range replicaSpecs { - replicas := *spec.Replicas - // If rtype in replica status not found, there must be a mistyped/invalid rtype in job spec, - // and it has not been reconciled in previous processes, discard it. - status, ok := jobStatus.ReplicaStatuses[rtype] - if !ok { - log.Info("skipping invalid replica type", "rtype", rtype) - continue - } - expected := replicas - status.Succeeded - running := status.Active - failed := status.Failed - - log.Info("Update elasticbatch job status", "ElasticBatchJob", elasticbatchJob.Name, - "ReplicaType", rtype, "expected", expected, "running", running, "failed", failed) - - if job_controller.ContainsReplicaType(replicaSpecs, v1.JobReplicaTypeAIMaster) { - if running > 0 { - msg := fmt.Sprintf("ElasticBatchJob %s is running.", elasticbatchJob.Name) - err := commonutil.UpdateJobConditions(jobStatus, v1.JobRunning, commonutil.JobRunningReason, msg) - if err != nil { - log.Error(err, "append ElasticBatchJob condition error") - return err - } - } - // Conditions for marking job as succeeded: - // 1. if success policy is AllWorkers, then wait util all workers succeed. - // 2. aimaster exits successfully. - succeed := expected == 0 - if rtype != v1.JobReplicaTypeAIMaster && workerFound && elasticbatchJob.Spec.SuccessPolicy != nil && *elasticbatchJob.Spec.SuccessPolicy == v1.SuccessPolicyAllWorkers { - succeed = succeed && allWorkersSucceed - } - if succeed { - msg := fmt.Sprintf("ElasticBatchJob %s successfully completed.", elasticbatchJob.Name) - r.recorder.Event(elasticbatchJob, corev1.EventTypeNormal, commonutil.JobSucceededReason, msg) - if jobStatus.CompletionTime == nil { - now := metav1.Now() - jobStatus.CompletionTime = &now - } - err := commonutil.UpdateJobConditions(jobStatus, v1.JobSucceeded, commonutil.JobSucceededReason, msg) - if err != nil { - log.Error(err, "append ElasticBatchJob condition error") - return err - } - r.ctrl.Metrics.SuccessInc() - } - } else { - log.Info("Invalid config: Job must contain AIMaster replica spec") - return errors.New("invalid config: Job must contain AIMaster replica spec") - } - - if failed > 0 { - if restart && rtype != v1.JobReplicaTypeAIMaster { - msg := fmt.Sprintf("ElasticBatchJob %s is restarting because %d %s replica(s) failed.", elasticbatchJob.Name, failed, rtype) - r.recorder.Event(elasticbatchJob, corev1.EventTypeWarning, commonutil.JobRestartingReason, msg) - err := commonutil.UpdateJobConditions(jobStatus, v1.JobRestarting, commonutil.JobRestartingReason, msg) - if err != nil { - log.Info("Append job condition", "error:", err) - return err - } - if !previousRestarting { - r.ctrl.Metrics.FailureInc() - r.ctrl.Metrics.RestartInc() - } - } else { - msg := fmt.Sprintf("ElasticBatchJob %s is failed because %d %s replica(s) failed.", elasticbatchJob.Name, failed, rtype) - r.recorder.Event(elasticbatchJob, corev1.EventTypeNormal, commonutil.JobFailedReason, msg) - if jobStatus.CompletionTime == nil { - now := metav1.Now() - jobStatus.CompletionTime = &now - } - err := commonutil.UpdateJobConditions(jobStatus, v1.JobFailed, commonutil.JobFailedReason, msg) - if err != nil { - log.Info("Append job condition", "error: ", err) - return err - } - if !previousFailed { - r.ctrl.Metrics.FailureInc() - } - } - } - } - return nil -} - -func onOwnerCreateFunc(r reconcile.Reconciler) func(e event.CreateEvent) bool { - return func(e event.CreateEvent) bool { - elasticbatchJob, ok := e.Object.(*inference.ElasticBatchJob) - if !ok { - return true - } - reconciler, ok := r.(*ElasticBatchJobReconciler) - if !ok { - return true - } - reconciler.scheme.Default(elasticbatchJob) - msg := fmt.Sprintf("ElasticBatchJob %s is created.", e.Object.GetName()) - if err := commonutil.UpdateJobConditions(&elasticbatchJob.Status, v1.JobCreated, commonutil.JobCreatedReason, msg); err != nil { - log.Error(err, "append job condition error") - return false - } - reconciler.ctrl.Metrics.CreatedInc() - return true - } -} - -func OnOwnerDeleteAndDeletionExpectationFunc(jc job_controller.JobController) func(e event.DeleteEvent) bool { - return func(e event.DeleteEvent) bool { - elasticbatchJob, ok := e.Object.(*inference.ElasticBatchJob) - if !ok { - return false - } - jc.DeleteExpectations(elasticbatchJob, elasticbatchJob.Spec.ElasticBatchReplicaSpecs) - return true - } -} diff --git a/controllers/persist/object/job/elasticbatchjob_persist_controller.go b/controllers/persist/object/job/elasticbatchjob_persist_controller.go deleted file mode 100644 index 6363dc1f..00000000 --- a/controllers/persist/object/job/elasticbatchjob_persist_controller.go +++ /dev/null @@ -1,94 +0,0 @@ -/* -Copyright 2020 The Alibaba Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -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 job - -import ( - "context" - - inference "github.com/alibaba/kubedl/apis/inference/v1alpha1" - "github.com/alibaba/kubedl/controllers/persist/util" - - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/types" - ctrl "sigs.k8s.io/controller-runtime" - ctrlruntime "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/controller" - "sigs.k8s.io/controller-runtime/pkg/reconcile" - "sigs.k8s.io/controller-runtime/pkg/source" -) - -func init() { - jobPersistCtrlMap[&inference.ElasticBatchJob{}] = NewElasticBatchJobPersistController -} - -func NewElasticBatchJobPersistController(mgr ctrl.Manager, handler *jobPersistHandler) PersistController { - return &ElasticBatchJobPersistController{ - client: mgr.GetClient(), - handler: handler, - } -} - -var _ reconcile.Reconciler = &ElasticBatchJobPersistController{} - -type ElasticBatchJobPersistController struct { - client ctrlruntime.Client - handler *jobPersistHandler -} - -func (pc *ElasticBatchJobPersistController) Reconcile(_ context.Context, req ctrl.Request) (ctrl.Result, error) { - // Parse uid and object name from request.Name field. - id, name, err := util.ParseIDName(req.Name) - if err != nil { - log.Error(err, "failed to parse request key") - return ctrl.Result{}, err - } - - elasticbatchJob := inference.ElasticBatchJob{} - err = pc.client.Get(context.Background(), types.NamespacedName{ - Namespace: req.Namespace, - Name: name, - }, &elasticbatchJob) - if err != nil { - if errors.IsNotFound(err) { - log.Info("try to fetch elasticbatch job but it has been deleted.", "key", req.String()) - if err = pc.handler.Delete(elasticbatchJob.Namespace, elasticbatchJob.Name, elasticbatchJob.Kind, id); err != nil { - return ctrl.Result{}, err - } - return ctrl.Result{}, nil - } - return ctrl.Result{}, err - } - - // Persist elasticbatch job object into storage backend. - if err = pc.handler.Save(&elasticbatchJob, elasticbatchJob.Kind, elasticbatchJob.Spec.ElasticBatchReplicaSpecs, &elasticbatchJob.Status); err != nil { - return ctrl.Result{Requeue: true}, err - } - return ctrl.Result{}, nil -} - -func (pc *ElasticBatchJobPersistController) SetupWithManager(mgr ctrl.Manager) error { - c, err := controller.New("ElasticBatchJobPersistController", mgr, controller.Options{Reconciler: pc}) - if err != nil { - return err - } - - // Watch events with event events-handler. - if err = c.Watch(&source.Kind{Type: &inference.ElasticBatchJob{}}, &enqueueForJob{}); err != nil { - return err - } - return nil -} diff --git a/controllers/persist/object/pod/pod_persist_controller.go b/controllers/persist/object/pod/pod_persist_controller.go index 36b1af43..af248ec4 100644 --- a/controllers/persist/object/pod/pod_persist_controller.go +++ b/controllers/persist/object/pod/pod_persist_controller.go @@ -21,7 +21,6 @@ import ( stderrors "errors" "fmt" - inferencev1alpha1 "github.com/alibaba/kubedl/apis/inference/v1alpha1" trainingv1alpha1 "github.com/alibaba/kubedl/apis/training/v1alpha1" persistutil "github.com/alibaba/kubedl/controllers/persist/util" "github.com/alibaba/kubedl/pkg/storage/backends" @@ -133,9 +132,6 @@ func matchDefaultContainerName(kind string) string { return trainingv1alpha1.XDLJobDefaultContainerName case trainingv1alpha1.XGBoostJobKind: return trainingv1alpha1.XGBoostJobDefaultContainerName - case inferencev1alpha1.ElasticBatchJobKind: - return inferencev1alpha1.ElasticBatchJobDefaultContainerName } - return "" } diff --git a/controllers/persist/util/filter.go b/controllers/persist/util/filter.go index 0a651b9e..b7e0e19f 100644 --- a/controllers/persist/util/filter.go +++ b/controllers/persist/util/filter.go @@ -17,7 +17,6 @@ limitations under the License. package util import ( - inferencev1alpha1 "github.com/alibaba/kubedl/apis/inference/v1alpha1" trainingv1alpha1 "github.com/alibaba/kubedl/apis/training/v1alpha1" apiv1 "github.com/alibaba/kubedl/pkg/job_controller/api/v1" "github.com/alibaba/kubedl/pkg/util" @@ -26,8 +25,7 @@ import ( ) func IsKubeDLManagedJobKind(kind string) bool { - return kind == trainingv1alpha1.TFJobKind || kind == trainingv1alpha1.PyTorchJobKind || - kind == trainingv1alpha1.XDLJobKind || kind == trainingv1alpha1.XGBoostJobKind || kind == inferencev1alpha1.ElasticBatchJobKind + return kind == trainingv1alpha1.TFJobKind || kind == trainingv1alpha1.PyTorchJobKind || kind == trainingv1alpha1.XDLJobKind || kind == trainingv1alpha1.XGBoostJobKind } func IsKubeDLManagedPod(pod *corev1.Pod) bool { diff --git a/controllers/suite_tests/elasticbatchjob_controller_test.go b/controllers/suite_tests/elasticbatchjob_controller_test.go deleted file mode 100644 index 21ed74ea..00000000 --- a/controllers/suite_tests/elasticbatchjob_controller_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package suite_tests - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "golang.org/x/net/context" - - inference "github.com/alibaba/kubedl/apis/inference/v1alpha1" - - apierrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" - "k8s.io/klog" -) - -var _ = Describe("ElasticBatchJob Controller", func() { - - BeforeEach(func() { - // Add any setup steps that needs to be executed before each test - }) - - AfterEach(func() { - // Add any teardown steps that needs to be executed after each test - }) - - Context("Job with schedule", func() { - It("Should create successfully", func() { - key := types.NamespacedName{ - Name: "foo", - Namespace: "default", - } - - instance := &inference.ElasticBatchJob{ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "default"}} - - // Create - err := k8sClient.Create(context.Background(), instance) - if apierrors.IsInvalid(err) { - klog.Errorf("failed to create object, got an invalid object error: %v", err) - return - } - // .NotTo(HaveOccurred()) - Expect(err).Should(Succeed()) - - // Get - By("Expecting created elasticbatch job") - Eventually(func() error { - job := &inference.ElasticBatchJob{} - return k8sClient.Get(context.Background(), key, job) - }, timeout).Should(BeNil()) - - // Delete - By("Deleting elasticbatch job") - Eventually(func() error { - job := &inference.ElasticBatchJob{} - err := k8sClient.Get(context.Background(), key, job) - if err != nil { - return err - } - return k8sClient.Delete(context.Background(), job) - }, timeout).Should(Succeed()) - }) - }) -}) diff --git a/controllers/tensorflow/tfjob_controller_test.go b/controllers/tensorflow/tfjob_controller_test.go index 9d812415..125b2e7d 100644 --- a/controllers/tensorflow/tfjob_controller_test.go +++ b/controllers/tensorflow/tfjob_controller_test.go @@ -14,7 +14,7 @@ import ( "github.com/alibaba/kubedl/apis/model/v1alpha1" training "github.com/alibaba/kubedl/apis/training/v1alpha1" "github.com/alibaba/kubedl/cmd/options" - controllers "github.com/alibaba/kubedl/controllers/model" + "github.com/alibaba/kubedl/controllers/model" "github.com/alibaba/kubedl/pkg/gang_schedule/registry" "github.com/alibaba/kubedl/pkg/job_controller" v1 "github.com/alibaba/kubedl/pkg/job_controller/api/v1" diff --git a/example/elasticbatch/elasticbatch_job_sample.yaml b/example/elasticbatch/elasticbatch_job_sample.yaml deleted file mode 100644 index 8f0541c6..00000000 --- a/example/elasticbatch/elasticbatch_job_sample.yaml +++ /dev/null @@ -1,29 +0,0 @@ -apiVersion: inference.kubedl.io/v1alpha1 -kind: ElasticBatchJob -metadata: - name: elasticbatch-example - namespace: default - annotations: - pai.ai/enable-error-monitoring: 'true' -spec: - elasticBatchReplicaSpecs: - AIMaster: - template: - spec: - containers: - - name: elasticbatch - image: registry.cn-zhangjiakou.aliyuncs.com/pai-dlc/aimaster:1.1.3 - args: ["--community-k8s=true --execution-mode=async --max-tolerated-failure-rate=1 "] - serviceAccountName: default - Worker: - replicas: 3 - template: - spec: - containers: - - name: elasticbatch - image: busybox:latest - imagePullPolicy: Always - command: - - /bin/sh - - -c - - echo __hello___ && sleep 3000 diff --git a/helm/kubedl/crds/inference.kubedl.io_elasticbatchjobs.yaml b/helm/kubedl/crds/inference.kubedl.io_elasticbatchjobs.yaml deleted file mode 100644 index cc3fb179..00000000 --- a/helm/kubedl/crds/inference.kubedl.io_elasticbatchjobs.yaml +++ /dev/null @@ -1,3160 +0,0 @@ - ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.6.1 - creationTimestamp: null - name: elasticbatchjobs.inference.kubedl.io -spec: - group: inference.kubedl.io - names: - kind: ElasticBatchJob - listKind: ElasticBatchJobList - plural: elasticbatchjobs - singular: elasticbatchjob - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .status.conditions[-1:].type - name: State - type: string - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - - jsonPath: .status.modelVersionName - name: Model-Version - type: string - - jsonPath: .status.cacheBackendName - name: Cache-Backend - type: string - - jsonPath: .spec.activeDeadlineSeconds - name: Max-Lifetime - type: integer - - jsonPath: .spec.ttlSecondsAfterFinished - name: TTL-AFTER-FINISHED - type: integer - name: v1alpha1 - schema: - openAPIV3Schema: - properties: - apiVersion: - type: string - kind: - type: string - metadata: - type: object - spec: - properties: - activeDeadlineSeconds: - format: int64 - type: integer - backoffLimit: - format: int32 - type: integer - cleanPodPolicy: - type: string - cronPolicy: - properties: - concurrencyPolicy: - type: string - deadline: - format: date-time - type: string - historyLimit: - format: int32 - type: integer - schedule: - type: string - suspend: - type: boolean - required: - - schedule - type: object - elasticBatchReplicaSpecs: - additionalProperties: - properties: - replicas: - format: int32 - type: integer - restartPolicy: - type: string - spotReplicaSpec: - properties: - labels: - additionalProperties: - type: string - type: object - priorityClassName: - type: string - spotReplicaNumber: - format: int32 - type: integer - type: object - template: - properties: - metadata: - properties: - annotations: - additionalProperties: - type: string - type: object - finalizers: - items: - type: string - type: array - labels: - additionalProperties: - type: string - type: object - name: - type: string - namespace: - type: string - type: object - spec: - properties: - activeDeadlineSeconds: - format: int64 - type: integer - affinity: - properties: - nodeAffinity: - properties: - preferredDuringSchedulingIgnoredDuringExecution: - items: - properties: - preference: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchFields: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - type: object - weight: - format: int32 - type: integer - required: - - preference - - weight - type: object - type: array - requiredDuringSchedulingIgnoredDuringExecution: - properties: - nodeSelectorTerms: - items: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchFields: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - type: object - type: array - required: - - nodeSelectorTerms - type: object - type: object - podAffinity: - properties: - preferredDuringSchedulingIgnoredDuringExecution: - items: - properties: - podAffinityTerm: - properties: - labelSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - namespaceSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - namespaces: - items: - type: string - type: array - topologyKey: - type: string - required: - - topologyKey - type: object - weight: - format: int32 - type: integer - required: - - podAffinityTerm - - weight - type: object - type: array - requiredDuringSchedulingIgnoredDuringExecution: - items: - properties: - labelSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - namespaceSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - namespaces: - items: - type: string - type: array - topologyKey: - type: string - required: - - topologyKey - type: object - type: array - type: object - podAntiAffinity: - properties: - preferredDuringSchedulingIgnoredDuringExecution: - items: - properties: - podAffinityTerm: - properties: - labelSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - namespaceSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - namespaces: - items: - type: string - type: array - topologyKey: - type: string - required: - - topologyKey - type: object - weight: - format: int32 - type: integer - required: - - podAffinityTerm - - weight - type: object - type: array - requiredDuringSchedulingIgnoredDuringExecution: - items: - properties: - labelSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - namespaceSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - namespaces: - items: - type: string - type: array - topologyKey: - type: string - required: - - topologyKey - type: object - type: array - type: object - type: object - automountServiceAccountToken: - type: boolean - containers: - items: - properties: - args: - items: - type: string - type: array - command: - items: - type: string - type: array - env: - items: - properties: - name: - type: string - value: - type: string - valueFrom: - properties: - configMapKeyRef: - properties: - key: - type: string - name: - type: string - optional: - type: boolean - required: - - key - type: object - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource - type: object - secretKeyRef: - properties: - key: - type: string - name: - type: string - optional: - type: boolean - required: - - key - type: object - type: object - required: - - name - type: object - type: array - envFrom: - items: - properties: - configMapRef: - properties: - name: - type: string - optional: - type: boolean - type: object - prefix: - type: string - secretRef: - properties: - name: - type: string - optional: - type: boolean - type: object - type: object - type: array - image: - type: string - imagePullPolicy: - type: string - lifecycle: - properties: - postStart: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - type: object - preStop: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - type: object - type: object - livenessProbe: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - failureThreshold: - format: int32 - type: integer - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - initialDelaySeconds: - format: int32 - type: integer - periodSeconds: - format: int32 - type: integer - successThreshold: - format: int32 - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - format: int64 - type: integer - timeoutSeconds: - format: int32 - type: integer - type: object - name: - type: string - ports: - items: - properties: - containerPort: - format: int32 - type: integer - hostIP: - type: string - hostPort: - format: int32 - type: integer - name: - type: string - protocol: - default: TCP - type: string - required: - - containerPort - type: object - type: array - x-kubernetes-list-map-keys: - - containerPort - - protocol - x-kubernetes-list-type: map - readinessProbe: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - failureThreshold: - format: int32 - type: integer - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - initialDelaySeconds: - format: int32 - type: integer - periodSeconds: - format: int32 - type: integer - successThreshold: - format: int32 - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - format: int64 - type: integer - timeoutSeconds: - format: int32 - type: integer - type: object - resources: - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - type: object - securityContext: - properties: - allowPrivilegeEscalation: - type: boolean - capabilities: - properties: - add: - items: - type: string - type: array - drop: - items: - type: string - type: array - type: object - privileged: - type: boolean - procMount: - type: string - readOnlyRootFilesystem: - type: boolean - runAsGroup: - format: int64 - type: integer - runAsNonRoot: - type: boolean - runAsUser: - format: int64 - type: integer - seLinuxOptions: - properties: - level: - type: string - role: - type: string - type: - type: string - user: - type: string - type: object - seccompProfile: - properties: - localhostProfile: - type: string - type: - type: string - required: - - type - type: object - windowsOptions: - properties: - gmsaCredentialSpec: - type: string - gmsaCredentialSpecName: - type: string - hostProcess: - type: boolean - runAsUserName: - type: string - type: object - type: object - startupProbe: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - failureThreshold: - format: int32 - type: integer - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - initialDelaySeconds: - format: int32 - type: integer - periodSeconds: - format: int32 - type: integer - successThreshold: - format: int32 - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - format: int64 - type: integer - timeoutSeconds: - format: int32 - type: integer - type: object - stdin: - type: boolean - stdinOnce: - type: boolean - terminationMessagePath: - type: string - terminationMessagePolicy: - type: string - tty: - type: boolean - volumeDevices: - items: - properties: - devicePath: - type: string - name: - type: string - required: - - devicePath - - name - type: object - type: array - volumeMounts: - items: - properties: - mountPath: - type: string - mountPropagation: - type: string - name: - type: string - readOnly: - type: boolean - subPath: - type: string - subPathExpr: - type: string - required: - - mountPath - - name - type: object - type: array - workingDir: - type: string - required: - - name - type: object - type: array - dnsConfig: - properties: - nameservers: - items: - type: string - type: array - options: - items: - properties: - name: - type: string - value: - type: string - type: object - type: array - searches: - items: - type: string - type: array - type: object - dnsPolicy: - type: string - enableServiceLinks: - type: boolean - ephemeralContainers: - items: - properties: - args: - items: - type: string - type: array - command: - items: - type: string - type: array - env: - items: - properties: - name: - type: string - value: - type: string - valueFrom: - properties: - configMapKeyRef: - properties: - key: - type: string - name: - type: string - optional: - type: boolean - required: - - key - type: object - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource - type: object - secretKeyRef: - properties: - key: - type: string - name: - type: string - optional: - type: boolean - required: - - key - type: object - type: object - required: - - name - type: object - type: array - envFrom: - items: - properties: - configMapRef: - properties: - name: - type: string - optional: - type: boolean - type: object - prefix: - type: string - secretRef: - properties: - name: - type: string - optional: - type: boolean - type: object - type: object - type: array - image: - type: string - imagePullPolicy: - type: string - lifecycle: - properties: - postStart: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - type: object - preStop: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - type: object - type: object - livenessProbe: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - failureThreshold: - format: int32 - type: integer - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - initialDelaySeconds: - format: int32 - type: integer - periodSeconds: - format: int32 - type: integer - successThreshold: - format: int32 - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - format: int64 - type: integer - timeoutSeconds: - format: int32 - type: integer - type: object - name: - type: string - ports: - items: - properties: - containerPort: - format: int32 - type: integer - hostIP: - type: string - hostPort: - format: int32 - type: integer - name: - type: string - protocol: - default: TCP - type: string - required: - - containerPort - type: object - type: array - readinessProbe: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - failureThreshold: - format: int32 - type: integer - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - initialDelaySeconds: - format: int32 - type: integer - periodSeconds: - format: int32 - type: integer - successThreshold: - format: int32 - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - format: int64 - type: integer - timeoutSeconds: - format: int32 - type: integer - type: object - resources: - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - type: object - securityContext: - properties: - allowPrivilegeEscalation: - type: boolean - capabilities: - properties: - add: - items: - type: string - type: array - drop: - items: - type: string - type: array - type: object - privileged: - type: boolean - procMount: - type: string - readOnlyRootFilesystem: - type: boolean - runAsGroup: - format: int64 - type: integer - runAsNonRoot: - type: boolean - runAsUser: - format: int64 - type: integer - seLinuxOptions: - properties: - level: - type: string - role: - type: string - type: - type: string - user: - type: string - type: object - seccompProfile: - properties: - localhostProfile: - type: string - type: - type: string - required: - - type - type: object - windowsOptions: - properties: - gmsaCredentialSpec: - type: string - gmsaCredentialSpecName: - type: string - hostProcess: - type: boolean - runAsUserName: - type: string - type: object - type: object - startupProbe: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - failureThreshold: - format: int32 - type: integer - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - initialDelaySeconds: - format: int32 - type: integer - periodSeconds: - format: int32 - type: integer - successThreshold: - format: int32 - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - format: int64 - type: integer - timeoutSeconds: - format: int32 - type: integer - type: object - stdin: - type: boolean - stdinOnce: - type: boolean - targetContainerName: - type: string - terminationMessagePath: - type: string - terminationMessagePolicy: - type: string - tty: - type: boolean - volumeDevices: - items: - properties: - devicePath: - type: string - name: - type: string - required: - - devicePath - - name - type: object - type: array - volumeMounts: - items: - properties: - mountPath: - type: string - mountPropagation: - type: string - name: - type: string - readOnly: - type: boolean - subPath: - type: string - subPathExpr: - type: string - required: - - mountPath - - name - type: object - type: array - workingDir: - type: string - required: - - name - type: object - type: array - hostAliases: - items: - properties: - hostnames: - items: - type: string - type: array - ip: - type: string - type: object - type: array - hostIPC: - type: boolean - hostNetwork: - type: boolean - hostPID: - type: boolean - hostname: - type: string - imagePullSecrets: - items: - properties: - name: - type: string - type: object - type: array - initContainers: - items: - properties: - args: - items: - type: string - type: array - command: - items: - type: string - type: array - env: - items: - properties: - name: - type: string - value: - type: string - valueFrom: - properties: - configMapKeyRef: - properties: - key: - type: string - name: - type: string - optional: - type: boolean - required: - - key - type: object - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource - type: object - secretKeyRef: - properties: - key: - type: string - name: - type: string - optional: - type: boolean - required: - - key - type: object - type: object - required: - - name - type: object - type: array - envFrom: - items: - properties: - configMapRef: - properties: - name: - type: string - optional: - type: boolean - type: object - prefix: - type: string - secretRef: - properties: - name: - type: string - optional: - type: boolean - type: object - type: object - type: array - image: - type: string - imagePullPolicy: - type: string - lifecycle: - properties: - postStart: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - type: object - preStop: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - type: object - type: object - livenessProbe: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - failureThreshold: - format: int32 - type: integer - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - initialDelaySeconds: - format: int32 - type: integer - periodSeconds: - format: int32 - type: integer - successThreshold: - format: int32 - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - format: int64 - type: integer - timeoutSeconds: - format: int32 - type: integer - type: object - name: - type: string - ports: - items: - properties: - containerPort: - format: int32 - type: integer - hostIP: - type: string - hostPort: - format: int32 - type: integer - name: - type: string - protocol: - default: TCP - type: string - required: - - containerPort - type: object - type: array - x-kubernetes-list-map-keys: - - containerPort - - protocol - x-kubernetes-list-type: map - readinessProbe: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - failureThreshold: - format: int32 - type: integer - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - initialDelaySeconds: - format: int32 - type: integer - periodSeconds: - format: int32 - type: integer - successThreshold: - format: int32 - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - format: int64 - type: integer - timeoutSeconds: - format: int32 - type: integer - type: object - resources: - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - type: object - securityContext: - properties: - allowPrivilegeEscalation: - type: boolean - capabilities: - properties: - add: - items: - type: string - type: array - drop: - items: - type: string - type: array - type: object - privileged: - type: boolean - procMount: - type: string - readOnlyRootFilesystem: - type: boolean - runAsGroup: - format: int64 - type: integer - runAsNonRoot: - type: boolean - runAsUser: - format: int64 - type: integer - seLinuxOptions: - properties: - level: - type: string - role: - type: string - type: - type: string - user: - type: string - type: object - seccompProfile: - properties: - localhostProfile: - type: string - type: - type: string - required: - - type - type: object - windowsOptions: - properties: - gmsaCredentialSpec: - type: string - gmsaCredentialSpecName: - type: string - hostProcess: - type: boolean - runAsUserName: - type: string - type: object - type: object - startupProbe: - properties: - exec: - properties: - command: - items: - type: string - type: array - type: object - failureThreshold: - format: int32 - type: integer - httpGet: - properties: - host: - type: string - httpHeaders: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - path: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - scheme: - type: string - required: - - port - type: object - initialDelaySeconds: - format: int32 - type: integer - periodSeconds: - format: int32 - type: integer - successThreshold: - format: int32 - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - format: int64 - type: integer - timeoutSeconds: - format: int32 - type: integer - type: object - stdin: - type: boolean - stdinOnce: - type: boolean - terminationMessagePath: - type: string - terminationMessagePolicy: - type: string - tty: - type: boolean - volumeDevices: - items: - properties: - devicePath: - type: string - name: - type: string - required: - - devicePath - - name - type: object - type: array - volumeMounts: - items: - properties: - mountPath: - type: string - mountPropagation: - type: string - name: - type: string - readOnly: - type: boolean - subPath: - type: string - subPathExpr: - type: string - required: - - mountPath - - name - type: object - type: array - workingDir: - type: string - required: - - name - type: object - type: array - nodeName: - type: string - nodeSelector: - additionalProperties: - type: string - type: object - x-kubernetes-map-type: atomic - overhead: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - preemptionPolicy: - type: string - priority: - format: int32 - type: integer - priorityClassName: - type: string - readinessGates: - items: - properties: - conditionType: - type: string - required: - - conditionType - type: object - type: array - restartPolicy: - type: string - runtimeClassName: - type: string - schedulerName: - type: string - securityContext: - properties: - fsGroup: - format: int64 - type: integer - fsGroupChangePolicy: - type: string - runAsGroup: - format: int64 - type: integer - runAsNonRoot: - type: boolean - runAsUser: - format: int64 - type: integer - seLinuxOptions: - properties: - level: - type: string - role: - type: string - type: - type: string - user: - type: string - type: object - seccompProfile: - properties: - localhostProfile: - type: string - type: - type: string - required: - - type - type: object - supplementalGroups: - items: - format: int64 - type: integer - type: array - sysctls: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - windowsOptions: - properties: - gmsaCredentialSpec: - type: string - gmsaCredentialSpecName: - type: string - hostProcess: - type: boolean - runAsUserName: - type: string - type: object - type: object - serviceAccount: - type: string - serviceAccountName: - type: string - setHostnameAsFQDN: - type: boolean - shareProcessNamespace: - type: boolean - subdomain: - type: string - terminationGracePeriodSeconds: - format: int64 - type: integer - tolerations: - items: - properties: - effect: - type: string - key: - type: string - operator: - type: string - tolerationSeconds: - format: int64 - type: integer - value: - type: string - type: object - type: array - topologySpreadConstraints: - items: - properties: - labelSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - maxSkew: - format: int32 - type: integer - topologyKey: - type: string - whenUnsatisfiable: - type: string - required: - - maxSkew - - topologyKey - - whenUnsatisfiable - type: object - type: array - x-kubernetes-list-map-keys: - - topologyKey - - whenUnsatisfiable - x-kubernetes-list-type: map - volumes: - items: - properties: - awsElasticBlockStore: - properties: - fsType: - type: string - partition: - format: int32 - type: integer - readOnly: - type: boolean - volumeID: - type: string - required: - - volumeID - type: object - azureDisk: - properties: - cachingMode: - type: string - diskName: - type: string - diskURI: - type: string - fsType: - type: string - kind: - type: string - readOnly: - type: boolean - required: - - diskName - - diskURI - type: object - azureFile: - properties: - readOnly: - type: boolean - secretName: - type: string - shareName: - type: string - required: - - secretName - - shareName - type: object - cephfs: - properties: - monitors: - items: - type: string - type: array - path: - type: string - readOnly: - type: boolean - secretFile: - type: string - secretRef: - properties: - name: - type: string - type: object - user: - type: string - required: - - monitors - type: object - cinder: - properties: - fsType: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - volumeID: - type: string - required: - - volumeID - type: object - configMap: - properties: - defaultMode: - format: int32 - type: integer - items: - items: - properties: - key: - type: string - mode: - format: int32 - type: integer - path: - type: string - required: - - key - - path - type: object - type: array - name: - type: string - optional: - type: boolean - type: object - csi: - properties: - driver: - type: string - fsType: - type: string - nodePublishSecretRef: - properties: - name: - type: string - type: object - readOnly: - type: boolean - volumeAttributes: - additionalProperties: - type: string - type: object - required: - - driver - type: object - downwardAPI: - properties: - defaultMode: - format: int32 - type: integer - items: - items: - properties: - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - mode: - format: int32 - type: integer - path: - type: string - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource - type: object - required: - - path - type: object - type: array - type: object - emptyDir: - properties: - medium: - type: string - sizeLimit: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - ephemeral: - properties: - volumeClaimTemplate: - properties: - metadata: - properties: - annotations: - additionalProperties: - type: string - type: object - finalizers: - items: - type: string - type: array - labels: - additionalProperties: - type: string - type: object - name: - type: string - namespace: - type: string - type: object - spec: - properties: - accessModes: - items: - type: string - type: array - dataSource: - properties: - apiGroup: - type: string - kind: - type: string - name: - type: string - required: - - kind - - name - type: object - dataSourceRef: - properties: - apiGroup: - type: string - kind: - type: string - name: - type: string - required: - - kind - - name - type: object - resources: - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - type: object - selector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - storageClassName: - type: string - volumeMode: - type: string - volumeName: - type: string - type: object - required: - - spec - type: object - type: object - fc: - properties: - fsType: - type: string - lun: - format: int32 - type: integer - readOnly: - type: boolean - targetWWNs: - items: - type: string - type: array - wwids: - items: - type: string - type: array - type: object - flexVolume: - properties: - driver: - type: string - fsType: - type: string - options: - additionalProperties: - type: string - type: object - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - required: - - driver - type: object - flocker: - properties: - datasetName: - type: string - datasetUUID: - type: string - type: object - gcePersistentDisk: - properties: - fsType: - type: string - partition: - format: int32 - type: integer - pdName: - type: string - readOnly: - type: boolean - required: - - pdName - type: object - gitRepo: - properties: - directory: - type: string - repository: - type: string - revision: - type: string - required: - - repository - type: object - glusterfs: - properties: - endpoints: - type: string - path: - type: string - readOnly: - type: boolean - required: - - endpoints - - path - type: object - hostPath: - properties: - path: - type: string - type: - type: string - required: - - path - type: object - iscsi: - properties: - chapAuthDiscovery: - type: boolean - chapAuthSession: - type: boolean - fsType: - type: string - initiatorName: - type: string - iqn: - type: string - iscsiInterface: - type: string - lun: - format: int32 - type: integer - portals: - items: - type: string - type: array - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - targetPortal: - type: string - required: - - iqn - - lun - - targetPortal - type: object - name: - type: string - nfs: - properties: - path: - type: string - readOnly: - type: boolean - server: - type: string - required: - - path - - server - type: object - persistentVolumeClaim: - properties: - claimName: - type: string - readOnly: - type: boolean - required: - - claimName - type: object - photonPersistentDisk: - properties: - fsType: - type: string - pdID: - type: string - required: - - pdID - type: object - portworxVolume: - properties: - fsType: - type: string - readOnly: - type: boolean - volumeID: - type: string - required: - - volumeID - type: object - projected: - properties: - defaultMode: - format: int32 - type: integer - sources: - items: - properties: - configMap: - properties: - items: - items: - properties: - key: - type: string - mode: - format: int32 - type: integer - path: - type: string - required: - - key - - path - type: object - type: array - name: - type: string - optional: - type: boolean - type: object - downwardAPI: - properties: - items: - items: - properties: - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - mode: - format: int32 - type: integer - path: - type: string - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource - type: object - required: - - path - type: object - type: array - type: object - secret: - properties: - items: - items: - properties: - key: - type: string - mode: - format: int32 - type: integer - path: - type: string - required: - - key - - path - type: object - type: array - name: - type: string - optional: - type: boolean - type: object - serviceAccountToken: - properties: - audience: - type: string - expirationSeconds: - format: int64 - type: integer - path: - type: string - required: - - path - type: object - type: object - type: array - type: object - quobyte: - properties: - group: - type: string - readOnly: - type: boolean - registry: - type: string - tenant: - type: string - user: - type: string - volume: - type: string - required: - - registry - - volume - type: object - rbd: - properties: - fsType: - type: string - image: - type: string - keyring: - type: string - monitors: - items: - type: string - type: array - pool: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - user: - type: string - required: - - image - - monitors - type: object - scaleIO: - properties: - fsType: - type: string - gateway: - type: string - protectionDomain: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - sslEnabled: - type: boolean - storageMode: - type: string - storagePool: - type: string - system: - type: string - volumeName: - type: string - required: - - gateway - - secretRef - - system - type: object - secret: - properties: - defaultMode: - format: int32 - type: integer - items: - items: - properties: - key: - type: string - mode: - format: int32 - type: integer - path: - type: string - required: - - key - - path - type: object - type: array - optional: - type: boolean - secretName: - type: string - type: object - storageos: - properties: - fsType: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - volumeName: - type: string - volumeNamespace: - type: string - type: object - vsphereVolume: - properties: - fsType: - type: string - storagePolicyID: - type: string - storagePolicyName: - type: string - volumePath: - type: string - required: - - volumePath - type: object - required: - - name - type: object - type: array - required: - - containers - type: object - type: object - type: object - type: object - schedulingPolicy: - properties: - minAvailable: - format: int32 - type: integer - priority: - format: int32 - type: integer - priorityClassName: - type: string - queue: - type: string - type: object - successPolicy: - type: string - ttlSecondsAfterFinished: - format: int32 - type: integer - required: - - elasticBatchReplicaSpecs - type: object - status: - properties: - cacheBackendName: - type: string - completionTime: - format: date-time - type: string - conditions: - items: - properties: - lastTransitionTime: - format: date-time - type: string - lastUpdateTime: - format: date-time - type: string - message: - type: string - reason: - type: string - status: - type: string - type: - type: string - required: - - status - - type - type: object - type: array - lastReconcileTime: - format: date-time - type: string - modelVersionName: - type: string - replicaStatuses: - additionalProperties: - properties: - active: - format: int32 - type: integer - evicted: - format: int32 - type: integer - failed: - format: int32 - type: integer - succeeded: - format: int32 - type: integer - type: object - type: object - startTime: - format: date-time - type: string - required: - - replicaStatuses - type: object - type: object - served: true - storage: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/pkg/job_controller/job.go b/pkg/job_controller/job.go index 3ab8a4db..f506bc35 100644 --- a/pkg/job_controller/job.go +++ b/pkg/job_controller/job.go @@ -19,7 +19,6 @@ import ( appv1 "github.com/alibaba/kubedl/apis/apps/v1alpha1" cachev1alpha1 "github.com/alibaba/kubedl/apis/cache/v1alpha1" - inference "github.com/alibaba/kubedl/apis/inference/v1alpha1" "github.com/alibaba/kubedl/apis/model/v1alpha1" training "github.com/alibaba/kubedl/apis/training/v1alpha1" model "github.com/alibaba/kubedl/controllers/model" @@ -304,7 +303,15 @@ func (jc *JobController) ReconcileJobs(job client.Object, replicas map[apiv1.Rep return result, err } - if !jc.shouldCreateService(rtype) { + // Skip service of ElasticDLJob and MPIJob. + if jc.Controller.GetAPIGroupVersionKind().Kind == training.ElasticDLJobKind || + jc.Controller.GetAPIGroupVersionKind().Kind == training.MPIJobKind { + continue + } + + // Service is in need only for Master + if jc.Controller.GetAPIGroupVersionKind().Kind == training.PyTorchJobKind && + rtype != training.PyTorchReplicaTypeMaster { continue } @@ -603,14 +610,3 @@ func (jc *JobController) cleanupJob(runPolicy *apiv1.RunPolicy, jobStatus apiv1. res.RequeueAfter = deleteTime.Sub(currentTime) return res, nil } - -func (jc *JobController) shouldCreateService(rtype apiv1.ReplicaType) bool { - if (jc.Controller.GetAPIGroupVersionKind().Kind == training.PyTorchJobKind && rtype != training.PyTorchReplicaTypeMaster) || - (jc.Controller.GetAPIGroupVersionKind().Kind == training.MPIJobKind) || - (jc.Controller.GetAPIGroupVersionKind().Kind == training.ElasticDLJobKind) || - (jc.Controller.GetAPIGroupVersionKind().Kind == inference.ElasticBatchJobKind) { - return false - } - - return true -} diff --git a/pkg/metrics/status_counter.go b/pkg/metrics/status_counter.go index 3aaa93fc..7fbf85de 100644 --- a/pkg/metrics/status_counter.go +++ b/pkg/metrics/status_counter.go @@ -22,7 +22,6 @@ import ( "k8s.io/apimachinery/pkg/runtime" "sigs.k8s.io/controller-runtime/pkg/client" - inference1alpha1 "github.com/alibaba/kubedl/apis/inference/v1alpha1" trainingv1alpha1 "github.com/alibaba/kubedl/apis/training/v1alpha1" v1 "github.com/alibaba/kubedl/pkg/job_controller/api/v1" ) @@ -48,12 +47,11 @@ func JobStatusCounter(kind string, reader client.Reader, filter func(status v1.J var ( listObjectMap = map[string]client.ObjectList{ - trainingv1alpha1.TFJobKind: &trainingv1alpha1.TFJobList{}, - trainingv1alpha1.PyTorchJobKind: &trainingv1alpha1.PyTorchJobList{}, - trainingv1alpha1.XDLJobKind: &trainingv1alpha1.XDLJobList{}, - trainingv1alpha1.XGBoostJobKind: &trainingv1alpha1.XGBoostJobList{}, - trainingv1alpha1.MarsJobKind: &trainingv1alpha1.MarsJobList{}, - inference1alpha1.ElasticBatchJobKind: &inference1alpha1.ElasticBatchJobList{}, + trainingv1alpha1.TFJobKind: &trainingv1alpha1.TFJobList{}, + trainingv1alpha1.PyTorchJobKind: &trainingv1alpha1.PyTorchJobList{}, + trainingv1alpha1.XDLJobKind: &trainingv1alpha1.XDLJobList{}, + trainingv1alpha1.XGBoostJobKind: &trainingv1alpha1.XGBoostJobList{}, + trainingv1alpha1.MarsJobKind: &trainingv1alpha1.MarsJobList{}, } ) diff --git a/pkg/storage/dmo/converters/job.go b/pkg/storage/dmo/converters/job.go index eb5c98f6..c3275b2f 100644 --- a/pkg/storage/dmo/converters/job.go +++ b/pkg/storage/dmo/converters/job.go @@ -25,7 +25,6 @@ import ( "k8s.io/klog" "k8s.io/utils/pointer" - inferencev1alpha1 "github.com/alibaba/kubedl/apis/inference/v1alpha1" trainingv1alpha1 "github.com/alibaba/kubedl/apis/training/v1alpha1" v1 "github.com/alibaba/kubedl/pkg/job_controller/api/v1" "github.com/alibaba/kubedl/pkg/storage/dmo" @@ -106,8 +105,6 @@ func ExtractTypedJobInfos(job metav1.Object) (kind string, spec map[v1.ReplicaTy return trainingv1alpha1.XGBoostJobKind, typed.Spec.XGBReplicaSpecs, typed.Status.JobStatus, nil case *trainingv1alpha1.XDLJob: return trainingv1alpha1.XDLJobKind, typed.Spec.XDLReplicaSpecs, typed.Status, nil - case *inferencev1alpha1.ElasticBatchJob: - return inferencev1alpha1.ElasticBatchJobKind, typed.Spec.ElasticBatchReplicaSpecs, typed.Status, nil } return "", nil, v1.JobStatus{}, fmt.Errorf("unkonwn job kind, %s/%s", job.GetNamespace(), job.GetName()) }