diff --git a/hack/boilerplate.go.txt b/hack/boilerplate.go.txt index daa97b8d..895aa14d 100644 --- a/hack/boilerplate.go.txt +++ b/hack/boilerplate.go.txt @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 85120169..e1313349 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -28,14 +28,14 @@ SCRIPT_ROOT=$(unset CDPATH && cd $(dirname "${BASH_SOURCE[0]}")/.. && pwd) # instead of the $GOPATH directly. For normal projects this can be dropped. bash ${SCRIPT_ROOT}/hack/generate-groups.sh "deepcopy,client,informer,lister" \ volcano.sh/apis/pkg/client volcano.sh/apis/pkg/apis \ - "batch:v1alpha1 bus:v1alpha1 scheduling:v1beta1 nodeinfo:v1alpha1 flow:v1alpha1" \ + "batch:v1alpha1 bus:v1alpha1 scheduling:v1beta1 nodeinfo:v1alpha1 flow:v1alpha1 batch:v1 bus:v1 scheduling:v1" \ --go-header-file ${SCRIPT_ROOT}/hack/boilerplate.go.txt echo "--------------------" bash ${SCRIPT_ROOT}/hack/generate-internal-groups.sh "deepcopy,conversion" \ volcano.sh/apis/pkg/apis/ volcano.sh/apis/pkg/apis volcano.sh/apis/pkg/apis \ - "scheduling:v1beta1" \ + "scheduling:v1beta1 scheduling:v1" \ --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \ --go-header-file ${SCRIPT_ROOT}/hack/boilerplate.go.txt diff --git a/pkg/apis/batch/v1/doc.go b/pkg/apis/batch/v1/doc.go new file mode 100644 index 00000000..96885274 --- /dev/null +++ b/pkg/apis/batch/v1/doc.go @@ -0,0 +1,21 @@ +/* +Copyright 2022 The Volcano 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 v1 contains API Schema definitions for the batch v1 API group +// +kubebuilder:object:generate=true +// +groupName=batch.volcano.sh +// +k8s:deepcopy-gen=package +package v1 diff --git a/pkg/apis/batch/v1/labels.go b/pkg/apis/batch/v1/labels.go new file mode 100644 index 00000000..475bb8a9 --- /dev/null +++ b/pkg/apis/batch/v1/labels.go @@ -0,0 +1,46 @@ +/* +Copyright 2022 The Volcano 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 v1 + +const ( + // TaskSpecKey task spec key used in pod annotation + TaskSpecKey = "volcano.sh/task-spec" + // JobNameKey job name key used in pod annotation / labels + JobNameKey = "volcano.sh/job-name" + // QueueNameKey queue name key used in pod annotation / labels + QueueNameKey = "volcano.sh/queue-name" + // JobNamespaceKey job namespace key + JobNamespaceKey = "volcano.sh/job-namespace" + // DefaultTaskSpec default task spec value + DefaultTaskSpec = "default" + // JobVersion job version key used in pod annotation + JobVersion = "volcano.sh/job-version" + // JobTypeKey job type key used in labels + JobTypeKey = "volcano.sh/job-type" + // PodgroupNamePrefix podgroup name prefix + PodgroupNamePrefix = "podgroup-" + // PodTemplateKey type specify a equivalence pod class + PodTemplateKey = "volcano.sh/template-uid" + // JobForwardingKey job forwarding key used in job annotation + JobForwardingKey = "volcano.sh/job-forwarding" + // ForwardClusterKey cluster key used in pod annotation + ForwardClusterKey = "volcano.sh/forward-cluster" + // OrginalNameKey annotation key for resource name + OrginalNameKey = "volcano.sh/burst-name" + // BurstToSiloClusterAnnotation labels key for resource only in silo cluster + BurstToSiloClusterAnnotation = "volcano.sh/silo-resource" +) \ No newline at end of file diff --git a/pkg/apis/batch/v1/register.go b/pkg/apis/batch/v1/register.go new file mode 100644 index 00000000..dc8c9bb4 --- /dev/null +++ b/pkg/apis/batch/v1/register.go @@ -0,0 +1,52 @@ +/* +Copyright 2022 The Volcano 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 v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +var ( + // SchemeBuilder points to a list of functions added to Scheme. + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + // AddToScheme applies all the stored functions to the scheme. + AddToScheme = SchemeBuilder.AddToScheme +) + +// GroupName is the group name used in this package. +const GroupName = "batch.volcano.sh" + +// SchemeGroupVersion is the group version used to register these objects. +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"} + +// Resource takes an unqualified resource and returns a Group-qualified GroupResource. +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +// addKnownTypes adds the set of types defined in this package to the supplied scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Job{}, + &JobList{}, + ) + + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/pkg/apis/batch/v1/types.go b/pkg/apis/batch/v1/types.go new file mode 100644 index 00000000..52b9c1c1 --- /dev/null +++ b/pkg/apis/batch/v1/types.go @@ -0,0 +1,384 @@ +/* +Copyright 2022 The Volcano 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 v1 + +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + busv1 "volcano.sh/apis/pkg/apis/bus/v1" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=jobs,shortName=vcjob;vj +// +kubebuilder:subresource:status +// +kubebuilder:storageversion + +// Job defines the volcano job. +// +kubebuilder:printcolumn:name="STATUS",type=string,JSONPath=`.status.state.phase` +// +kubebuilder:printcolumn:name="minAvailable",type=integer,JSONPath=`.status.minAvailable` +// +kubebuilder:printcolumn:name="RUNNINGS",type=integer,JSONPath=`.status.running` +// +kubebuilder:printcolumn:name="AGE",type=date,JSONPath=`.metadata.creationTimestamp` +// +kubebuilder:printcolumn:name="QUEUE",type=string,priority=1,JSONPath=`.spec.queue` +type Job struct { + metav1.TypeMeta `json:",inline"` + + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Specification of the desired behavior of the volcano job, including the minAvailable + // +optional + Spec JobSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + + // Current status of the volcano Job + // +optional + Status JobStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// JobSpec describes how the job execution will look like and when it will actually run. +type JobSpec struct { + // SchedulerName is the default value of `tasks.template.spec.schedulerName`. + // +optional + SchedulerName string `json:"schedulerName,omitempty" protobuf:"bytes,1,opt,name=schedulerName"` + + // The minimal available pods to run for this Job + // Defaults to the summary of tasks' replicas + // +optional + MinAvailable int32 `json:"minAvailable,omitempty" protobuf:"bytes,2,opt,name=minAvailable"` + + // The volumes mount on Job + // +optional + Volumes []VolumeSpec `json:"volumes,omitempty" protobuf:"bytes,3,opt,name=volumes"` + + // Tasks specifies the task specification of Job + // +optional + Tasks []TaskSpec `json:"tasks,omitempty" protobuf:"bytes,4,opt,name=tasks"` + + // Specifies the default lifecycle of tasks + // +optional + Policies []LifecyclePolicy `json:"policies,omitempty" protobuf:"bytes,5,opt,name=policies"` + + // Specifies the plugin of job + // Key is plugin name, value is the arguments of the plugin + // +optional + Plugins map[string][]string `json:"plugins,omitempty" protobuf:"bytes,6,opt,name=plugins"` + + // Running Estimate is a user running duration estimate for the job + // Default to nil + RunningEstimate *metav1.Duration `json:"runningEstimate,omitempty" protobuf:"bytes,7,opt,name=runningEstimate"` + + //Specifies the queue that will be used in the scheduler, "default" queue is used this leaves empty. + // +optional + Queue string `json:"queue,omitempty" protobuf:"bytes,8,opt,name=queue"` + + // Specifies the maximum number of retries before marking this Job failed. + // Defaults to 3. + // +optional + MaxRetry int32 `json:"maxRetry,omitempty" protobuf:"bytes,9,opt,name=maxRetry"` + + // ttlSecondsAfterFinished limits the lifetime of a Job that has finished + // execution (either Completed or Failed). If this field is set, + // ttlSecondsAfterFinished after the Job finishes, it is eligible to be + // automatically deleted. If this field is unset, + // the Job won't be automatically deleted. If this field is set to zero, + // the Job becomes eligible to be deleted immediately after it finishes. + // +optional + TTLSecondsAfterFinished *int32 `json:"ttlSecondsAfterFinished,omitempty" protobuf:"varint,10,opt,name=ttlSecondsAfterFinished"` + + // If specified, indicates the job's priority. + // +optional + PriorityClassName string `json:"priorityClassName,omitempty" protobuf:"bytes,11,opt,name=priorityClassName"` + + // The minimal success pods to run for this Job + // +kubebuilder:validation:Minimum=1 + // +optional + MinSuccess *int32 `json:"minSuccess,omitempty" protobuf:"varint,12,opt,name=minSuccess"` +} + +// VolumeSpec defines the specification of Volume, e.g. PVC. +type VolumeSpec struct { + // Path within the container at which the volume should be mounted. Must + // not contain ':'. + MountPath string `json:"mountPath" protobuf:"bytes,1,opt,name=mountPath"` + + // defined the PVC name + // +optional + VolumeClaimName string `json:"volumeClaimName,omitempty" protobuf:"bytes,2,opt,name=volumeClaimName"` + + // VolumeClaim defines the PVC used by the VolumeMount. + // +optional + VolumeClaim *v1.PersistentVolumeClaimSpec `json:"volumeClaim,omitempty" protobuf:"bytes,3,opt,name=volumeClaim"` +} + +// JobEvent job event. +type JobEvent string + +const ( + // CommandIssued command issued event is generated if a command is raised by user + CommandIssued JobEvent = "CommandIssued" + // PluginError plugin error event is generated if error happens + PluginError JobEvent = "PluginError" + // PVCError pvc error event is generated if error happens during IO creation + PVCError JobEvent = "PVCError" + // PodGroupError pod grp error event is generated if error happens during pod grp creation + PodGroupError JobEvent = "PodGroupError" + //ExecuteAction action issued event for each action + ExecuteAction JobEvent = "ExecuteAction" + //JobStatusError is generated if update job status failed + JobStatusError JobEvent = "JobStatusError" + // PodGroupPending pod grp pending event is generated if pg pending due to some error + PodGroupPending JobEvent = "PodGroupPending" +) + +// LifecyclePolicy specifies the lifecycle and error handling of task and job. +type LifecyclePolicy struct { + // The action that will be taken to the PodGroup according to Event. + // One of "Restart", "None". + // Default to None. + // +optional + Action busv1.Action `json:"action,omitempty" protobuf:"bytes,1,opt,name=action"` + + // The Event recorded by scheduler; the controller takes actions + // according to this Event. + // +optional + Event busv1.Event `json:"event,omitempty" protobuf:"bytes,2,opt,name=event"` + + // The Events recorded by scheduler; the controller takes actions + // according to this Events. + // +optional + Events []busv1.Event `json:"events,omitempty" protobuf:"bytes,3,opt,name=events"` + + // The exit code of the pod container, controller will take action + // according to this code. + // Note: only one of `Event` or `ExitCode` can be specified. + // +optional + ExitCode *int32 `json:"exitCode,omitempty" protobuf:"bytes,4,opt,name=exitCode"` + + // Timeout is the grace period for controller to take actions. + // Default to nil (take action immediately). + // +optional + Timeout *metav1.Duration `json:"timeout,omitempty" protobuf:"bytes,5,opt,name=timeout"` +} + +type NumaPolicy string + +const ( + None NumaPolicy = "none" + BestEffort NumaPolicy = "best-effort" + Restricted NumaPolicy = "restricted" + SingleNumaNode NumaPolicy = "single-numa-node" +) + +// TaskSpec specifies the task specification of Job. +type TaskSpec struct { + // Name specifies the name of tasks + // +optional + Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"` + + // Replicas specifies the replicas of this TaskSpec in Job + // +optional + Replicas int32 `json:"replicas,omitempty" protobuf:"bytes,2,opt,name=replicas"` + + // The minimal available pods to run for this Task + // Defaults to the task replicas + // +optional + MinAvailable *int32 `json:"minAvailable,omitempty" protobuf:"bytes,3,opt,name=minAvailable"` + + // Specifies the pod that will be created for this TaskSpec + // when executing a Job + // +optional + Template v1.PodTemplateSpec `json:"template,omitempty" protobuf:"bytes,4,opt,name=template"` + + // Specifies the lifecycle of task + // +optional + Policies []LifecyclePolicy `json:"policies,omitempty" protobuf:"bytes,5,opt,name=policies"` + + // Specifies the topology policy of task + // +optional + TopologyPolicy NumaPolicy `json:"topologyPolicy,omitempty" protobuf:"bytes,6,opt,name=topologyPolicy"` + + // Specifies the maximum number of retries before marking this Task failed. + // Defaults to 3. + // +optional + MaxRetry int32 `json:"maxRetry,omitempty" protobuf:"bytes,7,opt,name=maxRetry"` + + // Specifies the tasks that this task depends on. + // +optional + DependsOn *DependsOn `json:"dependsOn,omitempty" protobuf:"bytes,8,opt,name=dependsOn"` +} + +// JobPhase defines the phase of the job. +type JobPhase string + +const ( + // Pending is the phase that job is pending in the queue, waiting for scheduling decision + Pending JobPhase = "Pending" + // Aborting is the phase that job is aborted, waiting for releasing pods + Aborting JobPhase = "Aborting" + // Aborted is the phase that job is aborted by user or error handling + Aborted JobPhase = "Aborted" + // Running is the phase that minimal available tasks of Job are running + Running JobPhase = "Running" + // Restarting is the phase that the Job is restarted, waiting for pod releasing and recreating + Restarting JobPhase = "Restarting" + // Completing is the phase that required tasks of job are completed, job starts to clean up + Completing JobPhase = "Completing" + // Completed is the phase that all tasks of Job are completed + Completed JobPhase = "Completed" + // Terminating is the phase that the Job is terminated, waiting for releasing pods + Terminating JobPhase = "Terminating" + // Terminated is the phase that the job is finished unexpected, e.g. events + Terminated JobPhase = "Terminated" + // Failed is the phase that the job is restarted failed reached the maximum number of retries. + Failed JobPhase = "Failed" +) + +// JobState contains details for the current state of the job. +type JobState struct { + // The phase of Job. + // +optional + Phase JobPhase `json:"phase,omitempty" protobuf:"bytes,1,opt,name=phase"` + + // Unique, one-word, CamelCase reason for the phase's last transition. + // +optional + Reason string `json:"reason,omitempty" protobuf:"bytes,2,opt,name=reason"` + + // Human-readable message indicating details about last transition. + // +optional + Message string `json:"message,omitempty" protobuf:"bytes,3,opt,name=message"` + + // Last time the condition transit from one phase to another. + // +optional + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,4,opt,name=lastTransitionTime"` +} + +// TaskState contains details for the current state of the task. +type TaskState struct { + // The phase of Task. + // +optional + Phase map[v1.PodPhase]int32 `json:"phase,omitempty" protobuf:"bytes,11,opt,name=phase"` +} + +// JobStatus represents the current status of a Job. +type JobStatus struct { + // Current state of Job. + // +optional + State JobState `json:"state,omitempty" protobuf:"bytes,1,opt,name=state"` + + // The minimal available pods to run for this Job + // +optional + MinAvailable int32 `json:"minAvailable,omitempty" protobuf:"bytes,2,opt,name=minAvailable"` + + // The status of pods for each task + // +optional + TaskStatusCount map[string]TaskState `json:"taskStatusCount,omitempty" protobuf:"bytes,21,opt,name=taskStatusCount"` + + // The number of pending pods. + // +optional + Pending int32 `json:"pending,omitempty" protobuf:"bytes,3,opt,name=pending"` + + // The number of running pods. + // +optional + Running int32 `json:"running,omitempty" protobuf:"bytes,4,opt,name=running"` + + // The number of pods which reached phase Succeeded. + // +optional + Succeeded int32 `json:"succeeded,omitempty" protobuf:"bytes,5,opt,name=succeeded"` + + // The number of pods which reached phase Failed. + // +optional + Failed int32 `json:"failed,omitempty" protobuf:"bytes,6,opt,name=failed"` + + // The number of pods which reached phase Terminating. + // +optional + Terminating int32 `json:"terminating,omitempty" protobuf:"bytes,7,opt,name=terminating"` + + // The number of pods which reached phase Unknown. + // +optional + Unknown int32 `json:"unknown,omitempty" protobuf:"bytes,8,opt,name=unknown"` + + //Current version of job + // +optional + Version int32 `json:"version,omitempty" protobuf:"bytes,9,opt,name=version"` + + // The number of Job retries. + // +optional + RetryCount int32 `json:"retryCount,omitempty" protobuf:"bytes,10,opt,name=retryCount"` + + // The job running duration is the length of time from job running to complete. + // +optional + RunningDuration *metav1.Duration `json:"runningDuration,omitempty" protobuf:"bytes,11,opt,name=runningDuration"` + + // The resources that controlled by this job, e.g. Service, ConfigMap + // +optional + ControlledResources map[string]string `json:"controlledResources,omitempty" protobuf:"bytes,12,opt,name=controlledResources"` + + // Which conditions caused the current job state. + // +optional + // +patchMergeKey=status + // +patchStrategy=merge + Conditions []JobCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"status" protobuf:"bytes,13,rep,name=conditions"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true + +// JobList defines the list of jobs. +type JobList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Items []Job `json:"items" protobuf:"bytes,2,rep,name=items"` +} + +// JobCondition contains details for the current condition of this job. +type JobCondition struct { + // Status is the new phase of job after performing the state's action. + Status JobPhase `json:"status" protobuf:"bytes,1,opt,name=status,casttype=JobPhase"` + // Last time the condition transitioned from one phase to another. + // +optional + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,2,opt,name=lastTransitionTime"` +} + +// Iteration defines the phase of the iteration. +type Iteration string + +const ( + // Indicates that when there are multiple tasks, + // as long as one task becomes the specified state, + // the task scheduling will be triggered + IterationAny Iteration = "any" + // Indicates that when there are multiple tasks, + // all tasks must become the specified state, + // the task scheduling will be triggered + IterationAll Iteration = "all" +) + +// DependsOn represents the tasks that this task depends on and their dependencies +type DependsOn struct { + // Indicates the name of the tasks that this task depends on, + // which can depend on multiple tasks + // +optional + Name []string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"` + // This field specifies that when there are multiple dependent tasks, + // as long as one task becomes the specified state, + // the task scheduling is triggered or + // all tasks must be changed to the specified state to trigger the task scheduling + // +optional + Iteration Iteration `json:"iteration,omitempty" protobuf:"bytes,2,opt,name=iteration"` +} diff --git a/pkg/apis/batch/v1/zz_generated.deepcopy.go b/pkg/apis/batch/v1/zz_generated.deepcopy.go new file mode 100644 index 00000000..ca26ce8e --- /dev/null +++ b/pkg/apis/batch/v1/zz_generated.deepcopy.go @@ -0,0 +1,366 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2022 The Volcano 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 deepcopy-gen. DO NOT EDIT. + +package v1 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + busv1 "volcano.sh/apis/pkg/apis/bus/v1" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DependsOn) DeepCopyInto(out *DependsOn) { + *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DependsOn. +func (in *DependsOn) DeepCopy() *DependsOn { + if in == nil { + return nil + } + out := new(DependsOn) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Job) DeepCopyInto(out *Job) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Job. +func (in *Job) DeepCopy() *Job { + if in == nil { + return nil + } + out := new(Job) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Job) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *JobCondition) DeepCopyInto(out *JobCondition) { + *out = *in + if in.LastTransitionTime != nil { + in, out := &in.LastTransitionTime, &out.LastTransitionTime + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobCondition. +func (in *JobCondition) DeepCopy() *JobCondition { + if in == nil { + return nil + } + out := new(JobCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *JobList) DeepCopyInto(out *JobList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Job, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobList. +func (in *JobList) DeepCopy() *JobList { + if in == nil { + return nil + } + out := new(JobList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *JobList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *JobSpec) DeepCopyInto(out *JobSpec) { + *out = *in + if in.Volumes != nil { + in, out := &in.Volumes, &out.Volumes + *out = make([]VolumeSpec, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Tasks != nil { + in, out := &in.Tasks, &out.Tasks + *out = make([]TaskSpec, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Policies != nil { + in, out := &in.Policies, &out.Policies + *out = make([]LifecyclePolicy, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Plugins != nil { + in, out := &in.Plugins, &out.Plugins + *out = make(map[string][]string, len(*in)) + for key, val := range *in { + var outVal []string + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = make([]string, len(*in)) + copy(*out, *in) + } + (*out)[key] = outVal + } + } + if in.RunningEstimate != nil { + in, out := &in.RunningEstimate, &out.RunningEstimate + *out = new(metav1.Duration) + **out = **in + } + if in.TTLSecondsAfterFinished != nil { + in, out := &in.TTLSecondsAfterFinished, &out.TTLSecondsAfterFinished + *out = new(int32) + **out = **in + } + if in.MinSuccess != nil { + in, out := &in.MinSuccess, &out.MinSuccess + *out = new(int32) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobSpec. +func (in *JobSpec) DeepCopy() *JobSpec { + if in == nil { + return nil + } + out := new(JobSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *JobState) DeepCopyInto(out *JobState) { + *out = *in + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobState. +func (in *JobState) DeepCopy() *JobState { + if in == nil { + return nil + } + out := new(JobState) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *JobStatus) DeepCopyInto(out *JobStatus) { + *out = *in + in.State.DeepCopyInto(&out.State) + if in.TaskStatusCount != nil { + in, out := &in.TaskStatusCount, &out.TaskStatusCount + *out = make(map[string]TaskState, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + if in.RunningDuration != nil { + in, out := &in.RunningDuration, &out.RunningDuration + *out = new(metav1.Duration) + **out = **in + } + if in.ControlledResources != nil { + in, out := &in.ControlledResources, &out.ControlledResources + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]JobCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobStatus. +func (in *JobStatus) DeepCopy() *JobStatus { + if in == nil { + return nil + } + out := new(JobStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LifecyclePolicy) DeepCopyInto(out *LifecyclePolicy) { + *out = *in + if in.Events != nil { + in, out := &in.Events, &out.Events + *out = make([]busv1.Event, len(*in)) + copy(*out, *in) + } + if in.ExitCode != nil { + in, out := &in.ExitCode, &out.ExitCode + *out = new(int32) + **out = **in + } + if in.Timeout != nil { + in, out := &in.Timeout, &out.Timeout + *out = new(metav1.Duration) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LifecyclePolicy. +func (in *LifecyclePolicy) DeepCopy() *LifecyclePolicy { + if in == nil { + return nil + } + out := new(LifecyclePolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TaskSpec) DeepCopyInto(out *TaskSpec) { + *out = *in + if in.MinAvailable != nil { + in, out := &in.MinAvailable, &out.MinAvailable + *out = new(int32) + **out = **in + } + in.Template.DeepCopyInto(&out.Template) + if in.Policies != nil { + in, out := &in.Policies, &out.Policies + *out = make([]LifecyclePolicy, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.DependsOn != nil { + in, out := &in.DependsOn, &out.DependsOn + *out = new(DependsOn) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskSpec. +func (in *TaskSpec) DeepCopy() *TaskSpec { + if in == nil { + return nil + } + out := new(TaskSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TaskState) DeepCopyInto(out *TaskState) { + *out = *in + if in.Phase != nil { + in, out := &in.Phase, &out.Phase + *out = make(map[corev1.PodPhase]int32, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskState. +func (in *TaskState) DeepCopy() *TaskState { + if in == nil { + return nil + } + out := new(TaskState) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeSpec) DeepCopyInto(out *VolumeSpec) { + *out = *in + if in.VolumeClaim != nil { + in, out := &in.VolumeClaim, &out.VolumeClaim + *out = new(corev1.PersistentVolumeClaimSpec) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSpec. +func (in *VolumeSpec) DeepCopy() *VolumeSpec { + if in == nil { + return nil + } + out := new(VolumeSpec) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/apis/batch/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/batch/v1alpha1/zz_generated.deepcopy.go index b567ac73..07581463 100644 --- a/pkg/apis/batch/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/batch/v1alpha1/zz_generated.deepcopy.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/apis/bus/v1/actions.go b/pkg/apis/bus/v1/actions.go new file mode 100644 index 00000000..e859c66f --- /dev/null +++ b/pkg/apis/bus/v1/actions.go @@ -0,0 +1,62 @@ +/* +Copyright 2022 The Volcano 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 v1 + +// Action is the action that Job controller will take according to the event. +type Action string + +const ( + + // AbortJobAction if this action is set, the whole job will be aborted: + // all Pod of Job will be evicted, and no Pod will be recreated + AbortJobAction Action = "AbortJob" + + // RestartJobAction if this action is set, the whole job will be restarted + RestartJobAction Action = "RestartJob" + + // RestartTaskAction if this action is set, only the task will be restarted; default action. + // This action can not work together with job level events, e.g. JobUnschedulable + RestartTaskAction Action = "RestartTask" + + // TerminateJobAction if this action is set, the whole job wil be terminated + // and can not be resumed: all Pod of Job will be evicted, and no Pod will be recreated. + TerminateJobAction Action = "TerminateJob" + + // CompleteJobAction if this action is set, the unfinished pods will be killed, job completed. + CompleteJobAction Action = "CompleteJob" + + // ResumeJobAction is the action to resume an aborted job. + ResumeJobAction Action = "ResumeJob" + + // Note: actions below are only used internally, should not be used by users. + + // SyncJobAction is the action to sync Job/Pod status. + SyncJobAction Action = "SyncJob" + + // EnqueueAction is the action to sync Job inqueue status. + EnqueueAction Action = "EnqueueJob" + + // SyncQueueAction is the action to sync queue status. + SyncQueueAction Action = "SyncQueue" + + // OpenQueueAction is the action to open queue + OpenQueueAction Action = "OpenQueue" + + // CloseQueueAction is the action to close queue + CloseQueueAction Action = "CloseQueue" +) + diff --git a/pkg/apis/bus/v1/doc.go b/pkg/apis/bus/v1/doc.go new file mode 100644 index 00000000..f24966b7 --- /dev/null +++ b/pkg/apis/bus/v1/doc.go @@ -0,0 +1,21 @@ +/* +Copyright 2022 The Volcano 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 v1 contains API Schema definitions for the bus v1 API group +// +kubebuilder:object:generate=true +// +groupName=bus.volcano.sh +// +k8s:deepcopy-gen=package +package v1 diff --git a/pkg/apis/bus/v1/events.go b/pkg/apis/bus/v1/events.go new file mode 100644 index 00000000..ce026141 --- /dev/null +++ b/pkg/apis/bus/v1/events.go @@ -0,0 +1,55 @@ +/* +Copyright 2022 The Volcano 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 v1 + +// Event represent the phase of Job, e.g. pod-failed. +type Event string + +const ( + + // AnyEvent means all event + AnyEvent Event = "*" + + // PodFailedEvent is triggered if Pod was failed + PodFailedEvent Event = "PodFailed" + + // PodEvictedEvent is triggered if Pod was deleted + PodEvictedEvent Event = "PodEvicted" + + // JobUnknownEvent These below are several events can lead to job 'Unknown' + // 1. Task Unschedulable, this is triggered when part of + // pods can't be scheduled while some are already running in gang-scheduling case. + JobUnknownEvent Event = "Unknown" + + // TaskCompletedEvent is triggered if the 'Replicas' amount of pods in one task are succeed + TaskCompletedEvent Event = "TaskCompleted" + + // Note: events below are used internally, should not be used by users. + + // OutOfSyncEvent is triggered if Pod/Job is updated(add/update/delete) + OutOfSyncEvent Event = "OutOfSync" + + // CommandIssuedEvent is triggered if a command is raised by user + CommandIssuedEvent Event = "CommandIssued" + + // JobUpdatedEvent is triggered if Job is updated, currently only scale up/down + JobUpdatedEvent Event = "JobUpdated" + + // TaskFailedEvent is triggered when task finished unexpected. + TaskFailedEvent Event = "TaskFailed" +) + diff --git a/pkg/apis/bus/v1/register.go b/pkg/apis/bus/v1/register.go new file mode 100644 index 00000000..f6311b5a --- /dev/null +++ b/pkg/apis/bus/v1/register.go @@ -0,0 +1,52 @@ +/* +Copyright 2022 The Volcano 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 v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +var ( + // SchemeBuilder points to a list of functions added to Scheme. + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + // AddToScheme applies all the stored functions to the scheme. + AddToScheme = SchemeBuilder.AddToScheme +) + +// GroupName is the group name used in this package. +const GroupName = "bus.volcano.sh" + +// SchemeGroupVersion is the group version used to register these objects. +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"} + +// Resource takes an unqualified resource and returns a Group-qualified GroupResource. +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +// addKnownTypes adds the set of types defined in this package to the supplied scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Command{}, + &CommandList{}, + ) + + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/pkg/apis/bus/v1/types.go b/pkg/apis/bus/v1/types.go new file mode 100644 index 00000000..76f904c8 --- /dev/null +++ b/pkg/apis/bus/v1/types.go @@ -0,0 +1,57 @@ +/* +Copyright 2022 The Volcano 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 v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:storageversion + +// Command defines command structure. +type Command struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Action defines the action that will be took to the target object. + Action string `json:"action,omitempty" protobuf:"bytes,2,opt,name=action"` + + // TargetObject defines the target object of this command. + TargetObject *metav1.OwnerReference `json:"target,omitempty" protobuf:"bytes,3,opt,name=target"` + + // Unique, one-word, CamelCase reason for this command. + // +optional + Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"` + + // Human-readable message indicating details of this command. + // +optional + Message string `json:"message,omitempty" protobuf:"bytes,4,opt,name=message"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true + +// CommandList defines list of commands. +type CommandList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Items []Command `json:"items" protobuf:"bytes,2,rep,name=items"` +} diff --git a/pkg/apis/bus/v1/zz_generated.deepcopy.go b/pkg/apis/bus/v1/zz_generated.deepcopy.go new file mode 100644 index 00000000..432dd65c --- /dev/null +++ b/pkg/apis/bus/v1/zz_generated.deepcopy.go @@ -0,0 +1,90 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2022 The Volcano 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 deepcopy-gen. DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Command) DeepCopyInto(out *Command) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.TargetObject != nil { + in, out := &in.TargetObject, &out.TargetObject + *out = new(metav1.OwnerReference) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Command. +func (in *Command) DeepCopy() *Command { + if in == nil { + return nil + } + out := new(Command) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Command) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CommandList) DeepCopyInto(out *CommandList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Command, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommandList. +func (in *CommandList) DeepCopy() *CommandList { + if in == nil { + return nil + } + out := new(CommandList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CommandList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} diff --git a/pkg/apis/bus/v1alpha1/commands.go b/pkg/apis/bus/v1alpha1/commands.go index ae97b5f3..19d0ce20 100644 --- a/pkg/apis/bus/v1alpha1/commands.go +++ b/pkg/apis/bus/v1alpha1/commands.go @@ -7,6 +7,7 @@ import ( // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:object:root=true +// +kubebuilder:storageversion // Command defines command structure. type Command struct { diff --git a/pkg/apis/bus/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/bus/v1alpha1/zz_generated.deepcopy.go index ee8b6864..11493754 100644 --- a/pkg/apis/bus/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/bus/v1alpha1/zz_generated.deepcopy.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/apis/flow/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/flow/v1alpha1/zz_generated.deepcopy.go index 1a346840..a7a597f1 100644 --- a/pkg/apis/flow/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/flow/v1alpha1/zz_generated.deepcopy.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/apis/helpers/helpers.go b/pkg/apis/helpers/helpers.go index df21f62b..2fe63814 100644 --- a/pkg/apis/helpers/helpers.go +++ b/pkg/apis/helpers/helpers.go @@ -36,20 +36,26 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/klog" + vcbatchv1 "volcano.sh/apis/pkg/apis/batch/v1" vcbatch "volcano.sh/apis/pkg/apis/batch/v1alpha1" + vcbusv1 "volcano.sh/apis/pkg/apis/bus/v1" vcbus "volcano.sh/apis/pkg/apis/bus/v1alpha1" flow "volcano.sh/apis/pkg/apis/flow/v1alpha1" - schedulerv1beta1 "volcano.sh/apis/pkg/apis/scheduling/v1beta1" + vcschedulingv1 "volcano.sh/apis/pkg/apis/scheduling/v1" + vcschedulingv1beta1 "volcano.sh/apis/pkg/apis/scheduling/v1beta1" ) // JobKind creates job GroupVersionKind. -var JobKind = vcbatch.SchemeGroupVersion.WithKind("Job") +var V1alpha1JobKind = vcbatch.SchemeGroupVersion.WithKind("Job") +var V1JobKind = vcbatchv1.SchemeGroupVersion.WithKind("Job") // CommandKind creates command GroupVersionKind. -var CommandKind = vcbus.SchemeGroupVersion.WithKind("Command") +var V1alpha1CommandKind = vcbus.SchemeGroupVersion.WithKind("Command") +var V1CommandKind = vcbusv1.SchemeGroupVersion.WithKind("Command") // V1beta1QueueKind is queue kind with v1alpha2 version. -var V1beta1QueueKind = schedulerv1beta1.SchemeGroupVersion.WithKind("Queue") +var V1beta1QueueKind = vcschedulingv1beta1.SchemeGroupVersion.WithKind("Queue") +var V1QueueKind = vcschedulingv1.SchemeGroupVersion.WithKind("Queue") // JobFlowKind creates jobflow GroupVersionKind. var JobFlowKind = flow.SchemeGroupVersion.WithKind("JobFlow") @@ -58,7 +64,7 @@ var JobFlowKind = flow.SchemeGroupVersion.WithKind("JobFlow") var JobTemplateKind = flow.SchemeGroupVersion.WithKind("JobTemplate") // CreateOrUpdateConfigMap creates config map if not present or updates config map if necessary. -func CreateOrUpdateConfigMap(job *vcbatch.Job, kubeClients kubernetes.Interface, data map[string]string, cmName string) error { +func CreateOrUpdateConfigMap(job *vcbatchv1.Job, kubeClients kubernetes.Interface, data map[string]string, cmName string) error { // If ConfigMap does not exist, create one for Job. cmOld, err := kubeClients.CoreV1().ConfigMaps(job.Namespace).Get(context.TODO(), cmName, metav1.GetOptions{}) if err != nil { @@ -73,7 +79,7 @@ func CreateOrUpdateConfigMap(job *vcbatch.Job, kubeClients kubernetes.Interface, Namespace: job.Namespace, Name: cmName, OwnerReferences: []metav1.OwnerReference{ - *metav1.NewControllerRef(job, JobKind), + *metav1.NewControllerRef(job, V1JobKind), }, }, Data: data, @@ -103,7 +109,7 @@ func CreateOrUpdateConfigMap(job *vcbatch.Job, kubeClients kubernetes.Interface, } // CreateOrUpdateSecret creates secret if not present or updates secret if necessary -func CreateOrUpdateSecret(job *vcbatch.Job, kubeClients kubernetes.Interface, data map[string][]byte, secretName string) error { +func CreateOrUpdateSecret(job *vcbatchv1.Job, kubeClients kubernetes.Interface, data map[string][]byte, secretName string) error { secretOld, err := kubeClients.CoreV1().Secrets(job.Namespace).Get(context.TODO(), secretName, metav1.GetOptions{}) if err != nil { if !apierrors.IsNotFound(err) { @@ -117,7 +123,7 @@ func CreateOrUpdateSecret(job *vcbatch.Job, kubeClients kubernetes.Interface, da Name: secretName, Namespace: job.Namespace, OwnerReferences: []metav1.OwnerReference{ - *metav1.NewControllerRef(job, JobKind), + *metav1.NewControllerRef(job, V1JobKind), }, }, Data: data, @@ -149,7 +155,7 @@ func CreateOrUpdateSecret(job *vcbatch.Job, kubeClients kubernetes.Interface, da } // DeleteConfigmap deletes the config map resource. -func DeleteConfigmap(job *vcbatch.Job, kubeClients kubernetes.Interface, cmName string) error { +func DeleteConfigmap(job *vcbatchv1.Job, kubeClients kubernetes.Interface, cmName string) error { if err := kubeClients.CoreV1().ConfigMaps(job.Namespace).Delete(context.TODO(), cmName, metav1.DeleteOptions{}); err != nil && !apierrors.IsNotFound(err) { klog.Errorf("Failed to delete Configmap of Job %v/%v: %v", job.Namespace, job.Name, err) @@ -160,7 +166,7 @@ func DeleteConfigmap(job *vcbatch.Job, kubeClients kubernetes.Interface, cmName } // DeleteSecret delete secret. -func DeleteSecret(job *vcbatch.Job, kubeClients kubernetes.Interface, secretName string) error { +func DeleteSecret(job *vcbatchv1.Job, kubeClients kubernetes.Interface, secretName string) error { err := kubeClients.CoreV1().Secrets(job.Namespace).Delete(context.TODO(), secretName, metav1.DeleteOptions{}) if err != nil && apierrors.IsNotFound(err) { return nil diff --git a/pkg/apis/nodeinfo/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/nodeinfo/v1alpha1/zz_generated.deepcopy.go index 43840e34..690b4875 100644 --- a/pkg/apis/nodeinfo/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/nodeinfo/v1alpha1/zz_generated.deepcopy.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/apis/scheduling/scheme/scheme.go b/pkg/apis/scheduling/scheme/scheme.go index bf008674..4efeda4f 100644 --- a/pkg/apis/scheduling/scheme/scheme.go +++ b/pkg/apis/scheduling/scheme/scheme.go @@ -19,7 +19,9 @@ package scheme import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/serializer" + "volcano.sh/apis/pkg/apis/scheduling" + vcschedulingv1 "volcano.sh/apis/pkg/apis/scheduling/v1" "volcano.sh/apis/pkg/apis/scheduling/v1beta1" ) @@ -39,4 +41,5 @@ func init() { func Install(scheme *runtime.Scheme) { v1beta1.AddToScheme(scheme) scheduling.AddToScheme(scheme) + vcschedulingv1.AddToScheme(scheme) } diff --git a/pkg/apis/scheduling/v1/conversion.go b/pkg/apis/scheduling/v1/conversion.go new file mode 100644 index 00000000..9eeafe52 --- /dev/null +++ b/pkg/apis/scheduling/v1/conversion.go @@ -0,0 +1,34 @@ +/* +Copyright 2022 The Volcano 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 v1 + +import ( + "unsafe" + + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/conversion" + + "volcano.sh/apis/pkg/apis/scheduling" +) + +func Convert_scheduling_QueueSpec_To_v1_QueueSpec(in *scheduling.QueueSpec, out *QueueSpec, s conversion.Scope) error { + out.Weight = in.Weight + out.Capability = *(*v1.ResourceList)(unsafe.Pointer(&in.Capability)) + out.Reclaimable = (*bool)(unsafe.Pointer(in.Reclaimable)) + + return nil +} diff --git a/pkg/apis/scheduling/v1/doc.go b/pkg/apis/scheduling/v1/doc.go new file mode 100644 index 00000000..158db8a3 --- /dev/null +++ b/pkg/apis/scheduling/v1/doc.go @@ -0,0 +1,23 @@ +/* +Copyright 2022 The Volcano 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 v1 contains API Schema definitions for the scheduling v1 API group +// +kubebuilder:object:generate=true +// +groupName=scheduling.volcano.sh +// +k8s:deepcopy-gen=package +// +k8s:conversion-gen=volcano.sh/apis/pkg/apis/scheduling + +package v1 diff --git a/pkg/apis/scheduling/v1/labels.go b/pkg/apis/scheduling/v1/labels.go new file mode 100644 index 00000000..571e1fe8 --- /dev/null +++ b/pkg/apis/scheduling/v1/labels.go @@ -0,0 +1,66 @@ +/* +Copyright 2022 The Volcano 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 v1 + +// AnnotationPrefix is the key prefix to pick annotations from upper resource to podgroup +const AnnotationPrefix = "volcano.sh/" + +// JobWaitingTime is the key of sla plugin to set maximum waiting time +// that a job could stay Pending in service level agreement +const JobWaitingTime = "volcano.sh/sla-waiting-time" + +const KubeHierarchyAnnotationKey = "volcano.sh/hierarchy" + +const KubeHierarchyWeightAnnotationKey = "volcano.sh/hierarchy-weights" + +// KubeGroupNameAnnotationKey is the annotation key of Pod to identify +// which PodGroup it belongs to. +const KubeGroupNameAnnotationKey = "scheduling.k8s.io/group-name" + +// VolcanoGroupNameAnnotationKey is the annotation key of Pod to identify +// which PodGroup it belongs to. +const VolcanoGroupNameAnnotationKey = GroupName + "/group-name" + +// QueueNameAnnotationKey is the annotation key of Pod to identify +// which queue it belongs to. +const QueueNameAnnotationKey = GroupName + "/queue-name" + +// PodPreemptable is the key of preemptable +const PodPreemptable = "volcano.sh/preemptable" + +// PodPreemptStableTime is the key of preempt-stable-time, value's format "600s","10m" +// Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". +const PreemptStableTime = "volcano.sh/preempt-stable-time" + +// CooldownTime is the key of cooldown-time, value's format "600s","10m" +// Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". +const CooldownTime = "volcano.sh/cooldown-time" + +//RevocableZone is the key of revocable-zone +const RevocableZone = "volcano.sh/revocable-zone" + +// JDBMinAvailable is the key of min available pod number +const JDBMinAvailable = "volcano.sh/jdb-min-available" + +// JDBMaxUnavailable is the key of max unavailable pod number +const JDBMaxUnavailable = "volcano.sh/jdb-max-unavailable" + +// NumaPolicyKey is the key of pod numa-topology policy +const NumaPolicyKey = "volcano.sh/numa-topology-policy" + +// TopologyDecisionAnnotation is the key of topology decision about pod request resource +const TopologyDecisionAnnotation = "volcano.sh/topology-decision" diff --git a/pkg/apis/scheduling/v1/register.go b/pkg/apis/scheduling/v1/register.go new file mode 100644 index 00000000..67bcc90a --- /dev/null +++ b/pkg/apis/scheduling/v1/register.go @@ -0,0 +1,59 @@ +/* +Copyright 2022 The Volcano 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 v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + localSchemeBuilder = &SchemeBuilder + AddToScheme = SchemeBuilder.AddToScheme +) + +const ( + // GroupName is the group name used in this package. + GroupName = "scheduling.volcano.sh" + + // GroupVersion is the version of scheduling group + GroupVersion = "v1" +) + +// SchemeGroupVersion is the group version used to register these objects. +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: GroupVersion} + +// Resource takes an unqualified resource and returns a Group-qualified GroupResource. +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +// addKnownTypes adds the set of types defined in this package to the supplied scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &PodGroup{}, + &PodGroupList{}, + &Queue{}, + &QueueList{}, + ) + + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} + diff --git a/pkg/apis/scheduling/v1/types.go b/pkg/apis/scheduling/v1/types.go new file mode 100644 index 00000000..93f36c6c --- /dev/null +++ b/pkg/apis/scheduling/v1/types.go @@ -0,0 +1,374 @@ +/* +Copyright 2022 The Volcano 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 v1 + +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// PodGroupPhase is the phase of a pod group at the current time. +type PodGroupPhase string + +// QueueState is state type of queue. +type QueueState string + +const ( + // QueueStateOpen indicate `Open` state of queue + QueueStateOpen QueueState = "Open" + // QueueStateClosed indicate `Closed` state of queue + QueueStateClosed QueueState = "Closed" + // QueueStateClosing indicate `Closing` state of queue + QueueStateClosing QueueState = "Closing" + // QueueStateUnknown indicate `Unknown` state of queue + QueueStateUnknown QueueState = "Unknown" +) + +// These are the valid phase of podGroups. +const ( + // PodGroupPending means the pod group has been accepted by the system, but scheduler can not allocate + // enough resources to it. + PodGroupPending PodGroupPhase = "Pending" + + // PodGroupRunning means `spec.minMember` pods of PodGroup has been in running phase. + PodGroupRunning PodGroupPhase = "Running" + + // PodGroupUnknown means part of `spec.minMember` pods are running but the other part can not + // be scheduled, e.g. not enough resource; scheduler will wait for related controller to recover it. + PodGroupUnknown PodGroupPhase = "Unknown" + + // PodGroupInqueue means controllers can start to create pods, + // is a new state between PodGroupPending and PodGroupRunning + PodGroupInqueue PodGroupPhase = "Inqueue" + + // PodGroupCompleted means all the pods of PodGroup are completed + PodGroupCompleted PodGroupPhase = "Completed" +) + +type PodGroupConditionType string + +const ( + // PodGroupUnschedulableType is Unschedulable event type + PodGroupUnschedulableType PodGroupConditionType = "Unschedulable" + + // PodGroupScheduled is scheduled event type + PodGroupScheduled PodGroupConditionType = "Scheduled" +) + +type PodGroupConditionDetail string + +const ( + // PodGroupReady is that PodGroup has reached scheduling restriction + PodGroupReady PodGroupConditionDetail = "pod group is ready" + // PodGroupNotReady is that PodGroup has not yet reached the scheduling restriction + PodGroupNotReady PodGroupConditionDetail = "pod group is not ready" +) + +// PodGroupCondition contains details for the current state of this pod group. +type PodGroupCondition struct { + // Type is the type of the condition + Type PodGroupConditionType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type"` + + // Status is the status of the condition. + Status v1.ConditionStatus `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"` + + // The ID of condition transition. + TransitionID string `json:"transitionID,omitempty" protobuf:"bytes,3,opt,name=transitionID"` + + // Last time the phase transitioned from another to current phase. + // +optional + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,4,opt,name=lastTransitionTime"` + + // Unique, one-word, CamelCase reason for the phase's last transition. + // +optional + Reason string `json:"reason,omitempty" protobuf:"bytes,5,opt,name=reason"` + + // Human-readable message indicating details about last transition. + // +optional + Message string `json:"message,omitempty" protobuf:"bytes,6,opt,name=message"` +} + +const ( + // PodFailedReason is probed if pod of PodGroup failed + PodFailedReason string = "PodFailed" + + // PodDeletedReason is probed if pod of PodGroup deleted + PodDeletedReason string = "PodDeleted" + + // NotEnoughResourcesReason is probed if there're not enough resources to schedule pods + NotEnoughResourcesReason string = "NotEnoughResources" + + // NotEnoughPodsReason is probed if there're not enough tasks compared to `spec.minMember` + NotEnoughPodsReason string = "NotEnoughTasks" + + // NotEnoughPodsOfTaskReason is probed if there're not enough pods of task compared to `spec.minTaskMember` + NotEnoughPodsOfTaskReason string = "NotEnoughPodsOfTask" +) + +// QueueEvent represent the phase of queue. +type QueueEvent string + +const ( + // QueueOutOfSyncEvent is triggered if PodGroup/Queue were updated + QueueOutOfSyncEvent QueueEvent = "OutOfSync" + // QueueCommandIssuedEvent is triggered if a command is raised by user + QueueCommandIssuedEvent QueueEvent = "CommandIssued" +) + +// QueueAction is the action that queue controller will take according to the event. +type QueueAction string + +const ( + // SyncQueueAction is the action to sync queue status. + SyncQueueAction QueueAction = "SyncQueue" + // OpenQueueAction is the action to open queue + OpenQueueAction QueueAction = "OpenQueue" + // CloseQueueAction is the action to close queue + CloseQueueAction QueueAction = "CloseQueue" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true + +// +kubebuilder:resource:path=podgroups,shortName=pg;podgroup-v1 +// +kubebuilder:printcolumn:name="STATUS",type=string,JSONPath=`.status.phase` +// +kubebuilder:printcolumn:name="minMember",type=integer,JSONPath=`.spec.minMember` +// +kubebuilder:printcolumn:name="RUNNINGS",type=integer,JSONPath=`.status.running` +// +kubebuilder:printcolumn:name="AGE",type=date,JSONPath=`.metadata.creationTimestamp` +// +kubebuilder:printcolumn:name="QUEUE",type=string,priority=1,JSONPath=`.spec.queue` +// +kubebuilder:storageversion + +// PodGroup is a collection of Pod; used for batch workload. +type PodGroup struct { + metav1.TypeMeta `json:",inline"` + + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Specification of the desired behavior of the pod group. + // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status + // +optional + Spec PodGroupSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + + // Status represents the current information about a pod group. + // This data may not be up to date. + // +optional + Status PodGroupStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// PodGroupSpec represents the template of a pod group. +type PodGroupSpec struct { + // MinMember defines the minimal number of members/tasks to run the pod group; + // if there's not enough resources to start all tasks, the scheduler + // will not start anyone. + MinMember int32 `json:"minMember,omitempty" protobuf:"bytes,1,opt,name=minMember"` + + // MinTaskMember defines the minimal number of pods to run each task in the pod group; + // if there's not enough resources to start each task, the scheduler + // will not start anyone. + MinTaskMember map[string]int32 `json:"minTaskMember,omitempty" protobuf:"bytes,1,opt,name=minTaskMember"` + + // Queue defines the queue to allocate resource for PodGroup; if queue does not exist, + // the PodGroup will not be scheduled. Defaults to `default` Queue with the lowest weight. + // +optional + Queue string `json:"queue,omitempty" protobuf:"bytes,2,opt,name=queue"` + + // If specified, indicates the PodGroup's priority. "system-node-critical" and + // "system-cluster-critical" are two special keywords which indicate the + // highest priorities with the former being the highest priority. Any other + // name must be defined by creating a PriorityClass object with that name. + // If not specified, the PodGroup priority will be default or zero if there is no + // default. + // +optional + PriorityClassName string `json:"priorityClassName,omitempty" protobuf:"bytes,3,opt,name=priorityClassName"` + + // MinResources defines the minimal resource of members/tasks to run the pod group; + // if there's not enough resources to start all tasks, the scheduler + // will not start anyone. + MinResources *v1.ResourceList `json:"minResources,omitempty" protobuf:"bytes,4,opt,name=minResources"` +} + +// PodGroupStatus represents the current state of a pod group. +type PodGroupStatus struct { + // Current phase of PodGroup. + Phase PodGroupPhase `json:"phase,omitempty" protobuf:"bytes,1,opt,name=phase"` + + // The conditions of PodGroup. + // +optional + Conditions []PodGroupCondition `json:"conditions,omitempty" protobuf:"bytes,2,opt,name=conditions"` + + // The number of actively running pods. + // +optional + Running int32 `json:"running,omitempty" protobuf:"bytes,3,opt,name=running"` + + // The number of pods which reached phase Succeeded. + // +optional + Succeeded int32 `json:"succeeded,omitempty" protobuf:"bytes,4,opt,name=succeeded"` + + // The number of pods which reached phase Failed. + // +optional + Failed int32 `json:"failed,omitempty" protobuf:"bytes,5,opt,name=failed"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true + +// PodGroupList is a collection of pod groups. +type PodGroupList struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata + // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // items is the list of PodGroup + Items []PodGroup `json:"items" protobuf:"bytes,2,rep,name=items"` +} + +const ( + // DefaultQueue constant stores the name of the queue as "default" + DefaultQueue = "default" +) + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=queues,scope=Cluster,shortName=q;queue-v1 +// +kubebuilder:subresource:status +// +kubebuilder:storageversion + +// Queue is a queue of PodGroup. +type Queue struct { + metav1.TypeMeta `json:",inline"` + + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Specification of the desired behavior of the queue. + // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status + // +optional + Spec QueueSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + + // The status of queue. + // +optional + Status QueueStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// Guarantee represents configuration of queue resource reservation +type Guarantee struct { + // The amount of cluster resource reserved for queue. Just set either `percentage` or `resource` + // +optional + Resource v1.ResourceList `json:"resource,omitempty" protobuf:"bytes,3,opt,name=resource"` +} + +// Reservation represents current condition about resource reservation +type Reservation struct { + // Nodes are Locked nodes for queue + // +optional + Nodes []string `json:"nodes,omitempty" protobuf:"bytes,1,opt,name=nodes"` + // Resource is a list of total idle resource in locked nodes. + // +optional + Resource v1.ResourceList `json:"resource,omitempty" protobuf:"bytes,2,opt,name=resource"` +} + +// QueueStatus represents the status of Queue. +type QueueStatus struct { + // State is state of queue + State QueueState `json:"state,omitempty" protobuf:"bytes,1,opt,name=state"` + + // The number of 'Unknown' PodGroup in this queue. + Unknown int32 `json:"unknown,omitempty" protobuf:"bytes,2,opt,name=unknown"` + // The number of 'Pending' PodGroup in this queue. + Pending int32 `json:"pending,omitempty" protobuf:"bytes,3,opt,name=pending"` + // The number of 'Running' PodGroup in this queue. + Running int32 `json:"running,omitempty" protobuf:"bytes,4,opt,name=running"` + // The number of `Inqueue` PodGroup in this queue. + Inqueue int32 `json:"inqueue,omitempty" protobuf:"bytes,5,opt,name=inqueue"` + // The number of `Completed` PodGroup in this queue. + Completed int32 `json:"completed,omitempty" protobuf:"bytes,7,opt,name=completed"` + + // Reservation is the profile of resource reservation for queue + Reservation Reservation `json:"reservation,omitempty" protobuf:"bytes,6,opt,name=reservation"` +} + +// CluterSpec represents the template of Cluster +type Cluster struct { + Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"` + Weight int32 `json:"weight,omitempty" protobuf:"bytes,2,opt,name=weight"` + Capacity v1.ResourceList `json:"capacity,omitempty" protobuf:"bytes,3,opt,name=capacity"` +} + +// Affinity is a group of affinity scheduling rules. +type Affinity struct { + // Describes nodegroup affinity scheduling rules for the queue(e.g. putting pods of the queue in the nodes of the nodegroup) + // +optional + NodeGroupAffinity *NodeGroupAffinity `json:"nodeGroupAffinity,omitempty" protobuf:"bytes,1,opt,name=nodeGroupAffinity"` + + // Describes nodegroup anti-affinity scheduling rules for the queue(e.g. avoid putting pods of the queue in the nodes of the nodegroup). + // +optional + NodeGroupAntiAffinity *NodeGroupAntiAffinity `json:"nodeGroupAntiAffinity,omitempty" protobuf:"bytes,2,opt,name=nodeGroupAntiAffinity"` +} + +type NodeGroupAffinity struct { + // +optional + RequiredDuringSchedulingIgnoredDuringExecution []string `json:"requiredDuringSchedulingIgnoredDuringExecution,omitempty" protobuf:"bytes,1,opt,name=requiredDuringSchedulingIgnoredDuringExecution"` + // +optional + PreferredDuringSchedulingIgnoredDuringExecution []string `json:"preferredDuringSchedulingIgnoredDuringExecution,omitempty" protobuf:"bytes,2,rep,name=preferredDuringSchedulingIgnoredDuringExecution"` +} + +type NodeGroupAntiAffinity struct { + // +optional + RequiredDuringSchedulingIgnoredDuringExecution []string `json:"requiredDuringSchedulingIgnoredDuringExecution,omitempty" protobuf:"bytes,1,opt,name=requiredDuringSchedulingIgnoredDuringExecution"` + // +optional + PreferredDuringSchedulingIgnoredDuringExecution []string `json:"preferredDuringSchedulingIgnoredDuringExecution,omitempty" protobuf:"bytes,2,rep,name=preferredDuringSchedulingIgnoredDuringExecution"` +} + +// QueueSpec represents the template of Queue. +type QueueSpec struct { + Weight int32 `json:"weight,omitempty" protobuf:"bytes,1,opt,name=weight"` + Capability v1.ResourceList `json:"capability,omitempty" protobuf:"bytes,2,opt,name=capability"` + + // Reclaimable indicate whether the queue can be reclaimed by other queue + Reclaimable *bool `json:"reclaimable,omitempty" protobuf:"bytes,3,opt,name=reclaimable"` + + // extendCluster indicate the jobs in this Queue will be dispatched to these clusters. + ExtendClusters []Cluster `json:"extendClusters,omitempty" protobuf:"bytes,4,opt,name=extendClusters"` + + // Guarantee indicate configuration about resource reservation + Guarantee Guarantee `json:"guarantee,omitempty" protobuf:"bytes,5,opt,name=guarantee"` + + // If specified, the pod owned by the queue will be scheduled with constraint + // +optional + Affinity *Affinity `json:"affinity,omitempty" protobuf:"bytes,6,opt,name=affinity"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true + +// QueueList is a collection of queues. +type QueueList struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata + // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // items is the list of PodGroup + Items []Queue `json:"items" protobuf:"bytes,2,rep,name=items"` +} diff --git a/pkg/apis/scheduling/v1/zz_generated.conversion.go b/pkg/apis/scheduling/v1/zz_generated.conversion.go new file mode 100644 index 00000000..d338366d --- /dev/null +++ b/pkg/apis/scheduling/v1/zz_generated.conversion.go @@ -0,0 +1,602 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2022 The Volcano 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 conversion-gen. DO NOT EDIT. + +package v1 + +import ( + unsafe "unsafe" + + corev1 "k8s.io/api/core/v1" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + scheduling "volcano.sh/apis/pkg/apis/scheduling" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*Affinity)(nil), (*scheduling.Affinity)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_Affinity_To_scheduling_Affinity(a.(*Affinity), b.(*scheduling.Affinity), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*scheduling.Affinity)(nil), (*Affinity)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_scheduling_Affinity_To_v1_Affinity(a.(*scheduling.Affinity), b.(*Affinity), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Cluster)(nil), (*scheduling.Cluster)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_Cluster_To_scheduling_Cluster(a.(*Cluster), b.(*scheduling.Cluster), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*scheduling.Cluster)(nil), (*Cluster)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_scheduling_Cluster_To_v1_Cluster(a.(*scheduling.Cluster), b.(*Cluster), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Guarantee)(nil), (*scheduling.Guarantee)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_Guarantee_To_scheduling_Guarantee(a.(*Guarantee), b.(*scheduling.Guarantee), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*scheduling.Guarantee)(nil), (*Guarantee)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_scheduling_Guarantee_To_v1_Guarantee(a.(*scheduling.Guarantee), b.(*Guarantee), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NodeGroupAffinity)(nil), (*scheduling.NodeGroupAffinity)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_NodeGroupAffinity_To_scheduling_NodeGroupAffinity(a.(*NodeGroupAffinity), b.(*scheduling.NodeGroupAffinity), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*scheduling.NodeGroupAffinity)(nil), (*NodeGroupAffinity)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_scheduling_NodeGroupAffinity_To_v1_NodeGroupAffinity(a.(*scheduling.NodeGroupAffinity), b.(*NodeGroupAffinity), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NodeGroupAntiAffinity)(nil), (*scheduling.NodeGroupAntiAffinity)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_NodeGroupAntiAffinity_To_scheduling_NodeGroupAntiAffinity(a.(*NodeGroupAntiAffinity), b.(*scheduling.NodeGroupAntiAffinity), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*scheduling.NodeGroupAntiAffinity)(nil), (*NodeGroupAntiAffinity)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_scheduling_NodeGroupAntiAffinity_To_v1_NodeGroupAntiAffinity(a.(*scheduling.NodeGroupAntiAffinity), b.(*NodeGroupAntiAffinity), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*PodGroup)(nil), (*scheduling.PodGroup)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_PodGroup_To_scheduling_PodGroup(a.(*PodGroup), b.(*scheduling.PodGroup), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*scheduling.PodGroup)(nil), (*PodGroup)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_scheduling_PodGroup_To_v1_PodGroup(a.(*scheduling.PodGroup), b.(*PodGroup), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*PodGroupCondition)(nil), (*scheduling.PodGroupCondition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_PodGroupCondition_To_scheduling_PodGroupCondition(a.(*PodGroupCondition), b.(*scheduling.PodGroupCondition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*scheduling.PodGroupCondition)(nil), (*PodGroupCondition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_scheduling_PodGroupCondition_To_v1_PodGroupCondition(a.(*scheduling.PodGroupCondition), b.(*PodGroupCondition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*PodGroupList)(nil), (*scheduling.PodGroupList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_PodGroupList_To_scheduling_PodGroupList(a.(*PodGroupList), b.(*scheduling.PodGroupList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*scheduling.PodGroupList)(nil), (*PodGroupList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_scheduling_PodGroupList_To_v1_PodGroupList(a.(*scheduling.PodGroupList), b.(*PodGroupList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*PodGroupSpec)(nil), (*scheduling.PodGroupSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_PodGroupSpec_To_scheduling_PodGroupSpec(a.(*PodGroupSpec), b.(*scheduling.PodGroupSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*scheduling.PodGroupSpec)(nil), (*PodGroupSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_scheduling_PodGroupSpec_To_v1_PodGroupSpec(a.(*scheduling.PodGroupSpec), b.(*PodGroupSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*PodGroupStatus)(nil), (*scheduling.PodGroupStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_PodGroupStatus_To_scheduling_PodGroupStatus(a.(*PodGroupStatus), b.(*scheduling.PodGroupStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*scheduling.PodGroupStatus)(nil), (*PodGroupStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_scheduling_PodGroupStatus_To_v1_PodGroupStatus(a.(*scheduling.PodGroupStatus), b.(*PodGroupStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Queue)(nil), (*scheduling.Queue)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_Queue_To_scheduling_Queue(a.(*Queue), b.(*scheduling.Queue), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*scheduling.Queue)(nil), (*Queue)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_scheduling_Queue_To_v1_Queue(a.(*scheduling.Queue), b.(*Queue), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*QueueList)(nil), (*scheduling.QueueList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_QueueList_To_scheduling_QueueList(a.(*QueueList), b.(*scheduling.QueueList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*scheduling.QueueList)(nil), (*QueueList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_scheduling_QueueList_To_v1_QueueList(a.(*scheduling.QueueList), b.(*QueueList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*QueueSpec)(nil), (*scheduling.QueueSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_QueueSpec_To_scheduling_QueueSpec(a.(*QueueSpec), b.(*scheduling.QueueSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*QueueStatus)(nil), (*scheduling.QueueStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_QueueStatus_To_scheduling_QueueStatus(a.(*QueueStatus), b.(*scheduling.QueueStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*scheduling.QueueStatus)(nil), (*QueueStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_scheduling_QueueStatus_To_v1_QueueStatus(a.(*scheduling.QueueStatus), b.(*QueueStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Reservation)(nil), (*scheduling.Reservation)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_Reservation_To_scheduling_Reservation(a.(*Reservation), b.(*scheduling.Reservation), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*scheduling.Reservation)(nil), (*Reservation)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_scheduling_Reservation_To_v1_Reservation(a.(*scheduling.Reservation), b.(*Reservation), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*scheduling.QueueSpec)(nil), (*QueueSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_scheduling_QueueSpec_To_v1_QueueSpec(a.(*scheduling.QueueSpec), b.(*QueueSpec), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1_Affinity_To_scheduling_Affinity(in *Affinity, out *scheduling.Affinity, s conversion.Scope) error { + out.NodeGroupAffinity = (*scheduling.NodeGroupAffinity)(unsafe.Pointer(in.NodeGroupAffinity)) + out.NodeGroupAntiAffinity = (*scheduling.NodeGroupAntiAffinity)(unsafe.Pointer(in.NodeGroupAntiAffinity)) + return nil +} + +// Convert_v1_Affinity_To_scheduling_Affinity is an autogenerated conversion function. +func Convert_v1_Affinity_To_scheduling_Affinity(in *Affinity, out *scheduling.Affinity, s conversion.Scope) error { + return autoConvert_v1_Affinity_To_scheduling_Affinity(in, out, s) +} + +func autoConvert_scheduling_Affinity_To_v1_Affinity(in *scheduling.Affinity, out *Affinity, s conversion.Scope) error { + out.NodeGroupAffinity = (*NodeGroupAffinity)(unsafe.Pointer(in.NodeGroupAffinity)) + out.NodeGroupAntiAffinity = (*NodeGroupAntiAffinity)(unsafe.Pointer(in.NodeGroupAntiAffinity)) + return nil +} + +// Convert_scheduling_Affinity_To_v1_Affinity is an autogenerated conversion function. +func Convert_scheduling_Affinity_To_v1_Affinity(in *scheduling.Affinity, out *Affinity, s conversion.Scope) error { + return autoConvert_scheduling_Affinity_To_v1_Affinity(in, out, s) +} + +func autoConvert_v1_Cluster_To_scheduling_Cluster(in *Cluster, out *scheduling.Cluster, s conversion.Scope) error { + out.Name = in.Name + out.Weight = in.Weight + out.Capacity = *(*corev1.ResourceList)(unsafe.Pointer(&in.Capacity)) + return nil +} + +// Convert_v1_Cluster_To_scheduling_Cluster is an autogenerated conversion function. +func Convert_v1_Cluster_To_scheduling_Cluster(in *Cluster, out *scheduling.Cluster, s conversion.Scope) error { + return autoConvert_v1_Cluster_To_scheduling_Cluster(in, out, s) +} + +func autoConvert_scheduling_Cluster_To_v1_Cluster(in *scheduling.Cluster, out *Cluster, s conversion.Scope) error { + out.Name = in.Name + out.Weight = in.Weight + out.Capacity = *(*corev1.ResourceList)(unsafe.Pointer(&in.Capacity)) + return nil +} + +// Convert_scheduling_Cluster_To_v1_Cluster is an autogenerated conversion function. +func Convert_scheduling_Cluster_To_v1_Cluster(in *scheduling.Cluster, out *Cluster, s conversion.Scope) error { + return autoConvert_scheduling_Cluster_To_v1_Cluster(in, out, s) +} + +func autoConvert_v1_Guarantee_To_scheduling_Guarantee(in *Guarantee, out *scheduling.Guarantee, s conversion.Scope) error { + out.Resource = *(*corev1.ResourceList)(unsafe.Pointer(&in.Resource)) + return nil +} + +// Convert_v1_Guarantee_To_scheduling_Guarantee is an autogenerated conversion function. +func Convert_v1_Guarantee_To_scheduling_Guarantee(in *Guarantee, out *scheduling.Guarantee, s conversion.Scope) error { + return autoConvert_v1_Guarantee_To_scheduling_Guarantee(in, out, s) +} + +func autoConvert_scheduling_Guarantee_To_v1_Guarantee(in *scheduling.Guarantee, out *Guarantee, s conversion.Scope) error { + out.Resource = *(*corev1.ResourceList)(unsafe.Pointer(&in.Resource)) + return nil +} + +// Convert_scheduling_Guarantee_To_v1_Guarantee is an autogenerated conversion function. +func Convert_scheduling_Guarantee_To_v1_Guarantee(in *scheduling.Guarantee, out *Guarantee, s conversion.Scope) error { + return autoConvert_scheduling_Guarantee_To_v1_Guarantee(in, out, s) +} + +func autoConvert_v1_NodeGroupAffinity_To_scheduling_NodeGroupAffinity(in *NodeGroupAffinity, out *scheduling.NodeGroupAffinity, s conversion.Scope) error { + out.RequiredDuringSchedulingIgnoredDuringExecution = *(*[]string)(unsafe.Pointer(&in.RequiredDuringSchedulingIgnoredDuringExecution)) + out.PreferredDuringSchedulingIgnoredDuringExecution = *(*[]string)(unsafe.Pointer(&in.PreferredDuringSchedulingIgnoredDuringExecution)) + return nil +} + +// Convert_v1_NodeGroupAffinity_To_scheduling_NodeGroupAffinity is an autogenerated conversion function. +func Convert_v1_NodeGroupAffinity_To_scheduling_NodeGroupAffinity(in *NodeGroupAffinity, out *scheduling.NodeGroupAffinity, s conversion.Scope) error { + return autoConvert_v1_NodeGroupAffinity_To_scheduling_NodeGroupAffinity(in, out, s) +} + +func autoConvert_scheduling_NodeGroupAffinity_To_v1_NodeGroupAffinity(in *scheduling.NodeGroupAffinity, out *NodeGroupAffinity, s conversion.Scope) error { + out.RequiredDuringSchedulingIgnoredDuringExecution = *(*[]string)(unsafe.Pointer(&in.RequiredDuringSchedulingIgnoredDuringExecution)) + out.PreferredDuringSchedulingIgnoredDuringExecution = *(*[]string)(unsafe.Pointer(&in.PreferredDuringSchedulingIgnoredDuringExecution)) + return nil +} + +// Convert_scheduling_NodeGroupAffinity_To_v1_NodeGroupAffinity is an autogenerated conversion function. +func Convert_scheduling_NodeGroupAffinity_To_v1_NodeGroupAffinity(in *scheduling.NodeGroupAffinity, out *NodeGroupAffinity, s conversion.Scope) error { + return autoConvert_scheduling_NodeGroupAffinity_To_v1_NodeGroupAffinity(in, out, s) +} + +func autoConvert_v1_NodeGroupAntiAffinity_To_scheduling_NodeGroupAntiAffinity(in *NodeGroupAntiAffinity, out *scheduling.NodeGroupAntiAffinity, s conversion.Scope) error { + out.RequiredDuringSchedulingIgnoredDuringExecution = *(*[]string)(unsafe.Pointer(&in.RequiredDuringSchedulingIgnoredDuringExecution)) + out.PreferredDuringSchedulingIgnoredDuringExecution = *(*[]string)(unsafe.Pointer(&in.PreferredDuringSchedulingIgnoredDuringExecution)) + return nil +} + +// Convert_v1_NodeGroupAntiAffinity_To_scheduling_NodeGroupAntiAffinity is an autogenerated conversion function. +func Convert_v1_NodeGroupAntiAffinity_To_scheduling_NodeGroupAntiAffinity(in *NodeGroupAntiAffinity, out *scheduling.NodeGroupAntiAffinity, s conversion.Scope) error { + return autoConvert_v1_NodeGroupAntiAffinity_To_scheduling_NodeGroupAntiAffinity(in, out, s) +} + +func autoConvert_scheduling_NodeGroupAntiAffinity_To_v1_NodeGroupAntiAffinity(in *scheduling.NodeGroupAntiAffinity, out *NodeGroupAntiAffinity, s conversion.Scope) error { + out.RequiredDuringSchedulingIgnoredDuringExecution = *(*[]string)(unsafe.Pointer(&in.RequiredDuringSchedulingIgnoredDuringExecution)) + out.PreferredDuringSchedulingIgnoredDuringExecution = *(*[]string)(unsafe.Pointer(&in.PreferredDuringSchedulingIgnoredDuringExecution)) + return nil +} + +// Convert_scheduling_NodeGroupAntiAffinity_To_v1_NodeGroupAntiAffinity is an autogenerated conversion function. +func Convert_scheduling_NodeGroupAntiAffinity_To_v1_NodeGroupAntiAffinity(in *scheduling.NodeGroupAntiAffinity, out *NodeGroupAntiAffinity, s conversion.Scope) error { + return autoConvert_scheduling_NodeGroupAntiAffinity_To_v1_NodeGroupAntiAffinity(in, out, s) +} + +func autoConvert_v1_PodGroup_To_scheduling_PodGroup(in *PodGroup, out *scheduling.PodGroup, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1_PodGroupSpec_To_scheduling_PodGroupSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1_PodGroupStatus_To_scheduling_PodGroupStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1_PodGroup_To_scheduling_PodGroup is an autogenerated conversion function. +func Convert_v1_PodGroup_To_scheduling_PodGroup(in *PodGroup, out *scheduling.PodGroup, s conversion.Scope) error { + return autoConvert_v1_PodGroup_To_scheduling_PodGroup(in, out, s) +} + +func autoConvert_scheduling_PodGroup_To_v1_PodGroup(in *scheduling.PodGroup, out *PodGroup, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_scheduling_PodGroupSpec_To_v1_PodGroupSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_scheduling_PodGroupStatus_To_v1_PodGroupStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_scheduling_PodGroup_To_v1_PodGroup is an autogenerated conversion function. +func Convert_scheduling_PodGroup_To_v1_PodGroup(in *scheduling.PodGroup, out *PodGroup, s conversion.Scope) error { + return autoConvert_scheduling_PodGroup_To_v1_PodGroup(in, out, s) +} + +func autoConvert_v1_PodGroupCondition_To_scheduling_PodGroupCondition(in *PodGroupCondition, out *scheduling.PodGroupCondition, s conversion.Scope) error { + out.Type = scheduling.PodGroupConditionType(in.Type) + out.Status = corev1.ConditionStatus(in.Status) + out.TransitionID = in.TransitionID + out.LastTransitionTime = in.LastTransitionTime + out.Reason = in.Reason + out.Message = in.Message + return nil +} + +// Convert_v1_PodGroupCondition_To_scheduling_PodGroupCondition is an autogenerated conversion function. +func Convert_v1_PodGroupCondition_To_scheduling_PodGroupCondition(in *PodGroupCondition, out *scheduling.PodGroupCondition, s conversion.Scope) error { + return autoConvert_v1_PodGroupCondition_To_scheduling_PodGroupCondition(in, out, s) +} + +func autoConvert_scheduling_PodGroupCondition_To_v1_PodGroupCondition(in *scheduling.PodGroupCondition, out *PodGroupCondition, s conversion.Scope) error { + out.Type = PodGroupConditionType(in.Type) + out.Status = corev1.ConditionStatus(in.Status) + out.TransitionID = in.TransitionID + out.LastTransitionTime = in.LastTransitionTime + out.Reason = in.Reason + out.Message = in.Message + return nil +} + +// Convert_scheduling_PodGroupCondition_To_v1_PodGroupCondition is an autogenerated conversion function. +func Convert_scheduling_PodGroupCondition_To_v1_PodGroupCondition(in *scheduling.PodGroupCondition, out *PodGroupCondition, s conversion.Scope) error { + return autoConvert_scheduling_PodGroupCondition_To_v1_PodGroupCondition(in, out, s) +} + +func autoConvert_v1_PodGroupList_To_scheduling_PodGroupList(in *PodGroupList, out *scheduling.PodGroupList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]scheduling.PodGroup)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1_PodGroupList_To_scheduling_PodGroupList is an autogenerated conversion function. +func Convert_v1_PodGroupList_To_scheduling_PodGroupList(in *PodGroupList, out *scheduling.PodGroupList, s conversion.Scope) error { + return autoConvert_v1_PodGroupList_To_scheduling_PodGroupList(in, out, s) +} + +func autoConvert_scheduling_PodGroupList_To_v1_PodGroupList(in *scheduling.PodGroupList, out *PodGroupList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]PodGroup)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_scheduling_PodGroupList_To_v1_PodGroupList is an autogenerated conversion function. +func Convert_scheduling_PodGroupList_To_v1_PodGroupList(in *scheduling.PodGroupList, out *PodGroupList, s conversion.Scope) error { + return autoConvert_scheduling_PodGroupList_To_v1_PodGroupList(in, out, s) +} + +func autoConvert_v1_PodGroupSpec_To_scheduling_PodGroupSpec(in *PodGroupSpec, out *scheduling.PodGroupSpec, s conversion.Scope) error { + out.MinMember = in.MinMember + out.MinTaskMember = *(*map[string]int32)(unsafe.Pointer(&in.MinTaskMember)) + out.Queue = in.Queue + out.PriorityClassName = in.PriorityClassName + out.MinResources = (*corev1.ResourceList)(unsafe.Pointer(in.MinResources)) + return nil +} + +// Convert_v1_PodGroupSpec_To_scheduling_PodGroupSpec is an autogenerated conversion function. +func Convert_v1_PodGroupSpec_To_scheduling_PodGroupSpec(in *PodGroupSpec, out *scheduling.PodGroupSpec, s conversion.Scope) error { + return autoConvert_v1_PodGroupSpec_To_scheduling_PodGroupSpec(in, out, s) +} + +func autoConvert_scheduling_PodGroupSpec_To_v1_PodGroupSpec(in *scheduling.PodGroupSpec, out *PodGroupSpec, s conversion.Scope) error { + out.MinMember = in.MinMember + out.MinTaskMember = *(*map[string]int32)(unsafe.Pointer(&in.MinTaskMember)) + out.Queue = in.Queue + out.PriorityClassName = in.PriorityClassName + out.MinResources = (*corev1.ResourceList)(unsafe.Pointer(in.MinResources)) + return nil +} + +// Convert_scheduling_PodGroupSpec_To_v1_PodGroupSpec is an autogenerated conversion function. +func Convert_scheduling_PodGroupSpec_To_v1_PodGroupSpec(in *scheduling.PodGroupSpec, out *PodGroupSpec, s conversion.Scope) error { + return autoConvert_scheduling_PodGroupSpec_To_v1_PodGroupSpec(in, out, s) +} + +func autoConvert_v1_PodGroupStatus_To_scheduling_PodGroupStatus(in *PodGroupStatus, out *scheduling.PodGroupStatus, s conversion.Scope) error { + out.Phase = scheduling.PodGroupPhase(in.Phase) + out.Conditions = *(*[]scheduling.PodGroupCondition)(unsafe.Pointer(&in.Conditions)) + out.Running = in.Running + out.Succeeded = in.Succeeded + out.Failed = in.Failed + return nil +} + +// Convert_v1_PodGroupStatus_To_scheduling_PodGroupStatus is an autogenerated conversion function. +func Convert_v1_PodGroupStatus_To_scheduling_PodGroupStatus(in *PodGroupStatus, out *scheduling.PodGroupStatus, s conversion.Scope) error { + return autoConvert_v1_PodGroupStatus_To_scheduling_PodGroupStatus(in, out, s) +} + +func autoConvert_scheduling_PodGroupStatus_To_v1_PodGroupStatus(in *scheduling.PodGroupStatus, out *PodGroupStatus, s conversion.Scope) error { + out.Phase = PodGroupPhase(in.Phase) + out.Conditions = *(*[]PodGroupCondition)(unsafe.Pointer(&in.Conditions)) + out.Running = in.Running + out.Succeeded = in.Succeeded + out.Failed = in.Failed + return nil +} + +// Convert_scheduling_PodGroupStatus_To_v1_PodGroupStatus is an autogenerated conversion function. +func Convert_scheduling_PodGroupStatus_To_v1_PodGroupStatus(in *scheduling.PodGroupStatus, out *PodGroupStatus, s conversion.Scope) error { + return autoConvert_scheduling_PodGroupStatus_To_v1_PodGroupStatus(in, out, s) +} + +func autoConvert_v1_Queue_To_scheduling_Queue(in *Queue, out *scheduling.Queue, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1_QueueSpec_To_scheduling_QueueSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1_QueueStatus_To_scheduling_QueueStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1_Queue_To_scheduling_Queue is an autogenerated conversion function. +func Convert_v1_Queue_To_scheduling_Queue(in *Queue, out *scheduling.Queue, s conversion.Scope) error { + return autoConvert_v1_Queue_To_scheduling_Queue(in, out, s) +} + +func autoConvert_scheduling_Queue_To_v1_Queue(in *scheduling.Queue, out *Queue, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_scheduling_QueueSpec_To_v1_QueueSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_scheduling_QueueStatus_To_v1_QueueStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_scheduling_Queue_To_v1_Queue is an autogenerated conversion function. +func Convert_scheduling_Queue_To_v1_Queue(in *scheduling.Queue, out *Queue, s conversion.Scope) error { + return autoConvert_scheduling_Queue_To_v1_Queue(in, out, s) +} + +func autoConvert_v1_QueueList_To_scheduling_QueueList(in *QueueList, out *scheduling.QueueList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]scheduling.Queue, len(*in)) + for i := range *in { + if err := Convert_v1_Queue_To_scheduling_Queue(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1_QueueList_To_scheduling_QueueList is an autogenerated conversion function. +func Convert_v1_QueueList_To_scheduling_QueueList(in *QueueList, out *scheduling.QueueList, s conversion.Scope) error { + return autoConvert_v1_QueueList_To_scheduling_QueueList(in, out, s) +} + +func autoConvert_scheduling_QueueList_To_v1_QueueList(in *scheduling.QueueList, out *QueueList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Queue, len(*in)) + for i := range *in { + if err := Convert_scheduling_Queue_To_v1_Queue(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_scheduling_QueueList_To_v1_QueueList is an autogenerated conversion function. +func Convert_scheduling_QueueList_To_v1_QueueList(in *scheduling.QueueList, out *QueueList, s conversion.Scope) error { + return autoConvert_scheduling_QueueList_To_v1_QueueList(in, out, s) +} + +func autoConvert_v1_QueueSpec_To_scheduling_QueueSpec(in *QueueSpec, out *scheduling.QueueSpec, s conversion.Scope) error { + out.Weight = in.Weight + out.Capability = *(*corev1.ResourceList)(unsafe.Pointer(&in.Capability)) + out.Reclaimable = (*bool)(unsafe.Pointer(in.Reclaimable)) + out.ExtendClusters = *(*[]scheduling.Cluster)(unsafe.Pointer(&in.ExtendClusters)) + if err := Convert_v1_Guarantee_To_scheduling_Guarantee(&in.Guarantee, &out.Guarantee, s); err != nil { + return err + } + out.Affinity = (*scheduling.Affinity)(unsafe.Pointer(in.Affinity)) + return nil +} + +// Convert_v1_QueueSpec_To_scheduling_QueueSpec is an autogenerated conversion function. +func Convert_v1_QueueSpec_To_scheduling_QueueSpec(in *QueueSpec, out *scheduling.QueueSpec, s conversion.Scope) error { + return autoConvert_v1_QueueSpec_To_scheduling_QueueSpec(in, out, s) +} + +func autoConvert_scheduling_QueueSpec_To_v1_QueueSpec(in *scheduling.QueueSpec, out *QueueSpec, s conversion.Scope) error { + out.Weight = in.Weight + out.Capability = *(*corev1.ResourceList)(unsafe.Pointer(&in.Capability)) + // WARNING: in.State requires manual conversion: does not exist in peer-type + out.Reclaimable = (*bool)(unsafe.Pointer(in.Reclaimable)) + out.ExtendClusters = *(*[]Cluster)(unsafe.Pointer(&in.ExtendClusters)) + if err := Convert_scheduling_Guarantee_To_v1_Guarantee(&in.Guarantee, &out.Guarantee, s); err != nil { + return err + } + out.Affinity = (*Affinity)(unsafe.Pointer(in.Affinity)) + return nil +} + +func autoConvert_v1_QueueStatus_To_scheduling_QueueStatus(in *QueueStatus, out *scheduling.QueueStatus, s conversion.Scope) error { + out.State = scheduling.QueueState(in.State) + out.Unknown = in.Unknown + out.Pending = in.Pending + out.Running = in.Running + out.Inqueue = in.Inqueue + out.Completed = in.Completed + if err := Convert_v1_Reservation_To_scheduling_Reservation(&in.Reservation, &out.Reservation, s); err != nil { + return err + } + return nil +} + +// Convert_v1_QueueStatus_To_scheduling_QueueStatus is an autogenerated conversion function. +func Convert_v1_QueueStatus_To_scheduling_QueueStatus(in *QueueStatus, out *scheduling.QueueStatus, s conversion.Scope) error { + return autoConvert_v1_QueueStatus_To_scheduling_QueueStatus(in, out, s) +} + +func autoConvert_scheduling_QueueStatus_To_v1_QueueStatus(in *scheduling.QueueStatus, out *QueueStatus, s conversion.Scope) error { + out.State = QueueState(in.State) + out.Unknown = in.Unknown + out.Pending = in.Pending + out.Running = in.Running + out.Inqueue = in.Inqueue + out.Completed = in.Completed + if err := Convert_scheduling_Reservation_To_v1_Reservation(&in.Reservation, &out.Reservation, s); err != nil { + return err + } + return nil +} + +// Convert_scheduling_QueueStatus_To_v1_QueueStatus is an autogenerated conversion function. +func Convert_scheduling_QueueStatus_To_v1_QueueStatus(in *scheduling.QueueStatus, out *QueueStatus, s conversion.Scope) error { + return autoConvert_scheduling_QueueStatus_To_v1_QueueStatus(in, out, s) +} + +func autoConvert_v1_Reservation_To_scheduling_Reservation(in *Reservation, out *scheduling.Reservation, s conversion.Scope) error { + out.Nodes = *(*[]string)(unsafe.Pointer(&in.Nodes)) + out.Resource = *(*corev1.ResourceList)(unsafe.Pointer(&in.Resource)) + return nil +} + +// Convert_v1_Reservation_To_scheduling_Reservation is an autogenerated conversion function. +func Convert_v1_Reservation_To_scheduling_Reservation(in *Reservation, out *scheduling.Reservation, s conversion.Scope) error { + return autoConvert_v1_Reservation_To_scheduling_Reservation(in, out, s) +} + +func autoConvert_scheduling_Reservation_To_v1_Reservation(in *scheduling.Reservation, out *Reservation, s conversion.Scope) error { + out.Nodes = *(*[]string)(unsafe.Pointer(&in.Nodes)) + out.Resource = *(*corev1.ResourceList)(unsafe.Pointer(&in.Resource)) + return nil +} + +// Convert_scheduling_Reservation_To_v1_Reservation is an autogenerated conversion function. +func Convert_scheduling_Reservation_To_v1_Reservation(in *scheduling.Reservation, out *Reservation, s conversion.Scope) error { + return autoConvert_scheduling_Reservation_To_v1_Reservation(in, out, s) +} diff --git a/pkg/apis/scheduling/v1/zz_generated.deepcopy.go b/pkg/apis/scheduling/v1/zz_generated.deepcopy.go new file mode 100644 index 00000000..3d818a34 --- /dev/null +++ b/pkg/apis/scheduling/v1/zz_generated.deepcopy.go @@ -0,0 +1,433 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2022 The Volcano 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 deepcopy-gen. DO NOT EDIT. + +package v1 + +import ( + corev1 "k8s.io/api/core/v1" + resource "k8s.io/apimachinery/pkg/api/resource" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Affinity) DeepCopyInto(out *Affinity) { + *out = *in + if in.NodeGroupAffinity != nil { + in, out := &in.NodeGroupAffinity, &out.NodeGroupAffinity + *out = new(NodeGroupAffinity) + (*in).DeepCopyInto(*out) + } + if in.NodeGroupAntiAffinity != nil { + in, out := &in.NodeGroupAntiAffinity, &out.NodeGroupAntiAffinity + *out = new(NodeGroupAntiAffinity) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Affinity. +func (in *Affinity) DeepCopy() *Affinity { + if in == nil { + return nil + } + out := new(Affinity) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Cluster) DeepCopyInto(out *Cluster) { + *out = *in + if in.Capacity != nil { + in, out := &in.Capacity, &out.Capacity + *out = make(corev1.ResourceList, len(*in)) + for key, val := range *in { + (*out)[key] = val.DeepCopy() + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Cluster. +func (in *Cluster) DeepCopy() *Cluster { + if in == nil { + return nil + } + out := new(Cluster) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Guarantee) DeepCopyInto(out *Guarantee) { + *out = *in + if in.Resource != nil { + in, out := &in.Resource, &out.Resource + *out = make(corev1.ResourceList, len(*in)) + for key, val := range *in { + (*out)[key] = val.DeepCopy() + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Guarantee. +func (in *Guarantee) DeepCopy() *Guarantee { + if in == nil { + return nil + } + out := new(Guarantee) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeGroupAffinity) DeepCopyInto(out *NodeGroupAffinity) { + *out = *in + if in.RequiredDuringSchedulingIgnoredDuringExecution != nil { + in, out := &in.RequiredDuringSchedulingIgnoredDuringExecution, &out.RequiredDuringSchedulingIgnoredDuringExecution + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.PreferredDuringSchedulingIgnoredDuringExecution != nil { + in, out := &in.PreferredDuringSchedulingIgnoredDuringExecution, &out.PreferredDuringSchedulingIgnoredDuringExecution + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeGroupAffinity. +func (in *NodeGroupAffinity) DeepCopy() *NodeGroupAffinity { + if in == nil { + return nil + } + out := new(NodeGroupAffinity) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeGroupAntiAffinity) DeepCopyInto(out *NodeGroupAntiAffinity) { + *out = *in + if in.RequiredDuringSchedulingIgnoredDuringExecution != nil { + in, out := &in.RequiredDuringSchedulingIgnoredDuringExecution, &out.RequiredDuringSchedulingIgnoredDuringExecution + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.PreferredDuringSchedulingIgnoredDuringExecution != nil { + in, out := &in.PreferredDuringSchedulingIgnoredDuringExecution, &out.PreferredDuringSchedulingIgnoredDuringExecution + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeGroupAntiAffinity. +func (in *NodeGroupAntiAffinity) DeepCopy() *NodeGroupAntiAffinity { + if in == nil { + return nil + } + out := new(NodeGroupAntiAffinity) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroup) DeepCopyInto(out *PodGroup) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroup. +func (in *PodGroup) DeepCopy() *PodGroup { + if in == nil { + return nil + } + out := new(PodGroup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PodGroup) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupCondition) DeepCopyInto(out *PodGroupCondition) { + *out = *in + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupCondition. +func (in *PodGroupCondition) DeepCopy() *PodGroupCondition { + if in == nil { + return nil + } + out := new(PodGroupCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupList) DeepCopyInto(out *PodGroupList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]PodGroup, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupList. +func (in *PodGroupList) DeepCopy() *PodGroupList { + if in == nil { + return nil + } + out := new(PodGroupList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PodGroupList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupSpec) DeepCopyInto(out *PodGroupSpec) { + *out = *in + if in.MinTaskMember != nil { + in, out := &in.MinTaskMember, &out.MinTaskMember + *out = make(map[string]int32, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.MinResources != nil { + in, out := &in.MinResources, &out.MinResources + *out = new(corev1.ResourceList) + if **in != nil { + in, out := *in, *out + *out = make(map[corev1.ResourceName]resource.Quantity, len(*in)) + for key, val := range *in { + (*out)[key] = val.DeepCopy() + } + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupSpec. +func (in *PodGroupSpec) DeepCopy() *PodGroupSpec { + if in == nil { + return nil + } + out := new(PodGroupSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupStatus) DeepCopyInto(out *PodGroupStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]PodGroupCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupStatus. +func (in *PodGroupStatus) DeepCopy() *PodGroupStatus { + if in == nil { + return nil + } + out := new(PodGroupStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Queue) DeepCopyInto(out *Queue) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Queue. +func (in *Queue) DeepCopy() *Queue { + if in == nil { + return nil + } + out := new(Queue) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Queue) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *QueueList) DeepCopyInto(out *QueueList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Queue, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QueueList. +func (in *QueueList) DeepCopy() *QueueList { + if in == nil { + return nil + } + out := new(QueueList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *QueueList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *QueueSpec) DeepCopyInto(out *QueueSpec) { + *out = *in + if in.Capability != nil { + in, out := &in.Capability, &out.Capability + *out = make(corev1.ResourceList, len(*in)) + for key, val := range *in { + (*out)[key] = val.DeepCopy() + } + } + if in.Reclaimable != nil { + in, out := &in.Reclaimable, &out.Reclaimable + *out = new(bool) + **out = **in + } + if in.ExtendClusters != nil { + in, out := &in.ExtendClusters, &out.ExtendClusters + *out = make([]Cluster, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.Guarantee.DeepCopyInto(&out.Guarantee) + if in.Affinity != nil { + in, out := &in.Affinity, &out.Affinity + *out = new(Affinity) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QueueSpec. +func (in *QueueSpec) DeepCopy() *QueueSpec { + if in == nil { + return nil + } + out := new(QueueSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *QueueStatus) DeepCopyInto(out *QueueStatus) { + *out = *in + in.Reservation.DeepCopyInto(&out.Reservation) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QueueStatus. +func (in *QueueStatus) DeepCopy() *QueueStatus { + if in == nil { + return nil + } + out := new(QueueStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Reservation) DeepCopyInto(out *Reservation) { + *out = *in + if in.Nodes != nil { + in, out := &in.Nodes, &out.Nodes + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Resource != nil { + in, out := &in.Resource, &out.Resource + *out = make(corev1.ResourceList, len(*in)) + for key, val := range *in { + (*out)[key] = val.DeepCopy() + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Reservation. +func (in *Reservation) DeepCopy() *Reservation { + if in == nil { + return nil + } + out := new(Reservation) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/apis/scheduling/v1beta1/types.go b/pkg/apis/scheduling/v1beta1/types.go index 6c053ab0..34d7f276 100644 --- a/pkg/apis/scheduling/v1beta1/types.go +++ b/pkg/apis/scheduling/v1beta1/types.go @@ -144,6 +144,7 @@ const ( // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:object:root=true + // +kubebuilder:resource:path=podgroups,shortName=pg;podgroup-v1beta1 // +kubebuilder:printcolumn:name="STATUS",type=string,JSONPath=`.status.phase` // +kubebuilder:printcolumn:name="minMember",type=integer,JSONPath=`.spec.minMember` diff --git a/pkg/apis/scheduling/v1beta1/zz_generated.conversion.go b/pkg/apis/scheduling/v1beta1/zz_generated.conversion.go index dd8b4b47..2b920890 100644 --- a/pkg/apis/scheduling/v1beta1/zz_generated.conversion.go +++ b/pkg/apis/scheduling/v1beta1/zz_generated.conversion.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/apis/scheduling/v1beta1/zz_generated.deepcopy.go b/pkg/apis/scheduling/v1beta1/zz_generated.deepcopy.go index 8a524df8..48db70c7 100644 --- a/pkg/apis/scheduling/v1beta1/zz_generated.deepcopy.go +++ b/pkg/apis/scheduling/v1beta1/zz_generated.deepcopy.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/apis/scheduling/zz_generated.deepcopy.go b/pkg/apis/scheduling/zz_generated.deepcopy.go index 8d3e48ee..4d002041 100644 --- a/pkg/apis/scheduling/zz_generated.deepcopy.go +++ b/pkg/apis/scheduling/zz_generated.deepcopy.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index 9aa2c31c..b78439b2 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -24,20 +24,26 @@ import ( discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" + batchv1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/batch/v1" batchv1alpha1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/batch/v1alpha1" + busv1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/bus/v1" busv1alpha1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/bus/v1alpha1" flowv1alpha1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/flow/v1alpha1" nodeinfov1alpha1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1" + schedulingv1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/scheduling/v1" schedulingv1beta1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/scheduling/v1beta1" ) type Interface interface { Discovery() discovery.DiscoveryInterface BatchV1alpha1() batchv1alpha1.BatchV1alpha1Interface + BatchV1() batchv1.BatchV1Interface BusV1alpha1() busv1alpha1.BusV1alpha1Interface + BusV1() busv1.BusV1Interface FlowV1alpha1() flowv1alpha1.FlowV1alpha1Interface NodeinfoV1alpha1() nodeinfov1alpha1.NodeinfoV1alpha1Interface SchedulingV1beta1() schedulingv1beta1.SchedulingV1beta1Interface + SchedulingV1() schedulingv1.SchedulingV1Interface } // Clientset contains the clients for groups. Each group has exactly one @@ -45,10 +51,13 @@ type Interface interface { type Clientset struct { *discovery.DiscoveryClient batchV1alpha1 *batchv1alpha1.BatchV1alpha1Client + batchV1 *batchv1.BatchV1Client busV1alpha1 *busv1alpha1.BusV1alpha1Client + busV1 *busv1.BusV1Client flowV1alpha1 *flowv1alpha1.FlowV1alpha1Client nodeinfoV1alpha1 *nodeinfov1alpha1.NodeinfoV1alpha1Client schedulingV1beta1 *schedulingv1beta1.SchedulingV1beta1Client + schedulingV1 *schedulingv1.SchedulingV1Client } // BatchV1alpha1 retrieves the BatchV1alpha1Client @@ -56,11 +65,21 @@ func (c *Clientset) BatchV1alpha1() batchv1alpha1.BatchV1alpha1Interface { return c.batchV1alpha1 } +// BatchV1 retrieves the BatchV1Client +func (c *Clientset) BatchV1() batchv1.BatchV1Interface { + return c.batchV1 +} + // BusV1alpha1 retrieves the BusV1alpha1Client func (c *Clientset) BusV1alpha1() busv1alpha1.BusV1alpha1Interface { return c.busV1alpha1 } +// BusV1 retrieves the BusV1Client +func (c *Clientset) BusV1() busv1.BusV1Interface { + return c.busV1 +} + // FlowV1alpha1 retrieves the FlowV1alpha1Client func (c *Clientset) FlowV1alpha1() flowv1alpha1.FlowV1alpha1Interface { return c.flowV1alpha1 @@ -76,6 +95,11 @@ func (c *Clientset) SchedulingV1beta1() schedulingv1beta1.SchedulingV1beta1Inter return c.schedulingV1beta1 } +// SchedulingV1 retrieves the SchedulingV1Client +func (c *Clientset) SchedulingV1() schedulingv1.SchedulingV1Interface { + return c.schedulingV1 +} + // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { @@ -120,10 +144,18 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } + cs.batchV1, err = batchv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.busV1alpha1, err = busv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } + cs.busV1, err = busv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.flowV1alpha1, err = flowv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err @@ -136,6 +168,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } + cs.schedulingV1, err = schedulingv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) if err != nil { @@ -158,10 +194,13 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { func New(c rest.Interface) *Clientset { var cs Clientset cs.batchV1alpha1 = batchv1alpha1.New(c) + cs.batchV1 = batchv1.New(c) cs.busV1alpha1 = busv1alpha1.New(c) + cs.busV1 = busv1.New(c) cs.flowV1alpha1 = flowv1alpha1.New(c) cs.nodeinfoV1alpha1 = nodeinfov1alpha1.New(c) cs.schedulingV1beta1 = schedulingv1beta1.New(c) + cs.schedulingV1 = schedulingv1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/client/clientset/versioned/doc.go b/pkg/client/clientset/versioned/doc.go index 6bd143ec..573605b7 100644 --- a/pkg/client/clientset/versioned/doc.go +++ b/pkg/client/clientset/versioned/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index 87a67dbe..befadd96 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -24,14 +24,20 @@ import ( fakediscovery "k8s.io/client-go/discovery/fake" "k8s.io/client-go/testing" clientset "volcano.sh/apis/pkg/client/clientset/versioned" + batchv1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/batch/v1" + fakebatchv1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/batch/v1/fake" batchv1alpha1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/batch/v1alpha1" fakebatchv1alpha1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/batch/v1alpha1/fake" + busv1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/bus/v1" + fakebusv1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/bus/v1/fake" busv1alpha1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/bus/v1alpha1" fakebusv1alpha1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/bus/v1alpha1/fake" flowv1alpha1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/flow/v1alpha1" fakeflowv1alpha1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/flow/v1alpha1/fake" nodeinfov1alpha1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1" fakenodeinfov1alpha1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/fake" + schedulingv1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/scheduling/v1" + fakeschedulingv1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/scheduling/v1/fake" schedulingv1beta1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/scheduling/v1beta1" fakeschedulingv1beta1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/scheduling/v1beta1/fake" ) @@ -91,11 +97,21 @@ func (c *Clientset) BatchV1alpha1() batchv1alpha1.BatchV1alpha1Interface { return &fakebatchv1alpha1.FakeBatchV1alpha1{Fake: &c.Fake} } +// BatchV1 retrieves the BatchV1Client +func (c *Clientset) BatchV1() batchv1.BatchV1Interface { + return &fakebatchv1.FakeBatchV1{Fake: &c.Fake} +} + // BusV1alpha1 retrieves the BusV1alpha1Client func (c *Clientset) BusV1alpha1() busv1alpha1.BusV1alpha1Interface { return &fakebusv1alpha1.FakeBusV1alpha1{Fake: &c.Fake} } +// BusV1 retrieves the BusV1Client +func (c *Clientset) BusV1() busv1.BusV1Interface { + return &fakebusv1.FakeBusV1{Fake: &c.Fake} +} + // FlowV1alpha1 retrieves the FlowV1alpha1Client func (c *Clientset) FlowV1alpha1() flowv1alpha1.FlowV1alpha1Interface { return &fakeflowv1alpha1.FakeFlowV1alpha1{Fake: &c.Fake} @@ -110,3 +126,8 @@ func (c *Clientset) NodeinfoV1alpha1() nodeinfov1alpha1.NodeinfoV1alpha1Interfac func (c *Clientset) SchedulingV1beta1() schedulingv1beta1.SchedulingV1beta1Interface { return &fakeschedulingv1beta1.FakeSchedulingV1beta1{Fake: &c.Fake} } + +// SchedulingV1 retrieves the SchedulingV1Client +func (c *Clientset) SchedulingV1() schedulingv1.SchedulingV1Interface { + return &fakeschedulingv1.FakeSchedulingV1{Fake: &c.Fake} +} diff --git a/pkg/client/clientset/versioned/fake/doc.go b/pkg/client/clientset/versioned/fake/doc.go index b44ff4ad..5fdbae9e 100644 --- a/pkg/client/clientset/versioned/fake/doc.go +++ b/pkg/client/clientset/versioned/fake/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index 8a5ae87a..59a9aee6 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -23,10 +23,13 @@ import ( schema "k8s.io/apimachinery/pkg/runtime/schema" serializer "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" + batchv1 "volcano.sh/apis/pkg/apis/batch/v1" batchv1alpha1 "volcano.sh/apis/pkg/apis/batch/v1alpha1" + busv1 "volcano.sh/apis/pkg/apis/bus/v1" busv1alpha1 "volcano.sh/apis/pkg/apis/bus/v1alpha1" flowv1alpha1 "volcano.sh/apis/pkg/apis/flow/v1alpha1" nodeinfov1alpha1 "volcano.sh/apis/pkg/apis/nodeinfo/v1alpha1" + schedulingv1 "volcano.sh/apis/pkg/apis/scheduling/v1" schedulingv1beta1 "volcano.sh/apis/pkg/apis/scheduling/v1beta1" ) @@ -35,10 +38,13 @@ var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ batchv1alpha1.AddToScheme, + batchv1.AddToScheme, busv1alpha1.AddToScheme, + busv1.AddToScheme, flowv1alpha1.AddToScheme, nodeinfov1alpha1.AddToScheme, schedulingv1beta1.AddToScheme, + schedulingv1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/client/clientset/versioned/scheme/doc.go b/pkg/client/clientset/versioned/scheme/doc.go index 1d123c7b..7599bdaf 100644 --- a/pkg/client/clientset/versioned/scheme/doc.go +++ b/pkg/client/clientset/versioned/scheme/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index d90320b6..556c7861 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -23,10 +23,13 @@ import ( schema "k8s.io/apimachinery/pkg/runtime/schema" serializer "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" + batchv1 "volcano.sh/apis/pkg/apis/batch/v1" batchv1alpha1 "volcano.sh/apis/pkg/apis/batch/v1alpha1" + busv1 "volcano.sh/apis/pkg/apis/bus/v1" busv1alpha1 "volcano.sh/apis/pkg/apis/bus/v1alpha1" flowv1alpha1 "volcano.sh/apis/pkg/apis/flow/v1alpha1" nodeinfov1alpha1 "volcano.sh/apis/pkg/apis/nodeinfo/v1alpha1" + schedulingv1 "volcano.sh/apis/pkg/apis/scheduling/v1" schedulingv1beta1 "volcano.sh/apis/pkg/apis/scheduling/v1beta1" ) @@ -35,10 +38,13 @@ var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ batchv1alpha1.AddToScheme, + batchv1.AddToScheme, busv1alpha1.AddToScheme, + busv1.AddToScheme, flowv1alpha1.AddToScheme, nodeinfov1alpha1.AddToScheme, schedulingv1beta1.AddToScheme, + schedulingv1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/client/clientset/versioned/typed/bactch/v1/bactch_client.go b/pkg/client/clientset/versioned/typed/bactch/v1/bactch_client.go new file mode 100644 index 00000000..54cec4dc --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bactch/v1/bactch_client.go @@ -0,0 +1,101 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +package v1 + +import ( + "net/http" + + rest "k8s.io/client-go/rest" + v1 "volcano.sh/apis/pkg/apis/bactch/v1" + "volcano.sh/apis/pkg/client/clientset/versioned/scheme" +) + +type BactchV1Interface interface { + RESTClient() rest.Interface +} + +// BactchV1Client is used to interact with features provided by the bactch group. +type BactchV1Client struct { + restClient rest.Interface +} + +// NewForConfig creates a new BactchV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*BactchV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new BactchV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*BactchV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &BactchV1Client{client}, nil +} + +// NewForConfigOrDie creates a new BactchV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *BactchV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new BactchV1Client for the given RESTClient. +func New(c rest.Interface) *BactchV1Client { + return &BactchV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *BactchV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/clientset/versioned/typed/bactch/v1/doc.go b/pkg/client/clientset/versioned/typed/bactch/v1/doc.go new file mode 100644 index 00000000..efdfd9a4 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bactch/v1/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/client/clientset/versioned/typed/bactch/v1/fake/doc.go b/pkg/client/clientset/versioned/typed/bactch/v1/fake/doc.go new file mode 100644 index 00000000..47d3cb36 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bactch/v1/fake/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/client/clientset/versioned/typed/bactch/v1/fake/fake_bactch_client.go b/pkg/client/clientset/versioned/typed/bactch/v1/fake/fake_bactch_client.go new file mode 100644 index 00000000..a0df8fa9 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bactch/v1/fake/fake_bactch_client.go @@ -0,0 +1,34 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +package fake + +import ( + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeBactchV1 struct { + *testing.Fake +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeBactchV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/bactch/v1/generated_expansion.go b/pkg/client/clientset/versioned/typed/bactch/v1/generated_expansion.go new file mode 100644 index 00000000..31c6ce99 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bactch/v1/generated_expansion.go @@ -0,0 +1,18 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +package v1 diff --git a/pkg/client/clientset/versioned/typed/batch/v1/batch_client.go b/pkg/client/clientset/versioned/typed/batch/v1/batch_client.go new file mode 100644 index 00000000..195f7374 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/batch/v1/batch_client.go @@ -0,0 +1,106 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +package v1 + +import ( + "net/http" + + rest "k8s.io/client-go/rest" + v1 "volcano.sh/apis/pkg/apis/batch/v1" + "volcano.sh/apis/pkg/client/clientset/versioned/scheme" +) + +type BatchV1Interface interface { + RESTClient() rest.Interface + JobsGetter +} + +// BatchV1Client is used to interact with features provided by the batch.volcano.sh group. +type BatchV1Client struct { + restClient rest.Interface +} + +func (c *BatchV1Client) Jobs(namespace string) JobInterface { + return newJobs(c, namespace) +} + +// NewForConfig creates a new BatchV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*BatchV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new BatchV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*BatchV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &BatchV1Client{client}, nil +} + +// NewForConfigOrDie creates a new BatchV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *BatchV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new BatchV1Client for the given RESTClient. +func New(c rest.Interface) *BatchV1Client { + return &BatchV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *BatchV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/clientset/versioned/typed/batch/v1/doc.go b/pkg/client/clientset/versioned/typed/batch/v1/doc.go new file mode 100644 index 00000000..efdfd9a4 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/batch/v1/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/client/clientset/versioned/typed/batch/v1/fake/doc.go b/pkg/client/clientset/versioned/typed/batch/v1/fake/doc.go new file mode 100644 index 00000000..47d3cb36 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/batch/v1/fake/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/client/clientset/versioned/typed/batch/v1/fake/fake_batch_client.go b/pkg/client/clientset/versioned/typed/batch/v1/fake/fake_batch_client.go new file mode 100644 index 00000000..a4345a33 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/batch/v1/fake/fake_batch_client.go @@ -0,0 +1,39 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +package fake + +import ( + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" + v1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/batch/v1" +) + +type FakeBatchV1 struct { + *testing.Fake +} + +func (c *FakeBatchV1) Jobs(namespace string) v1.JobInterface { + return &FakeJobs{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeBatchV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/batch/v1/fake/fake_job.go b/pkg/client/clientset/versioned/typed/batch/v1/fake/fake_job.go new file mode 100644 index 00000000..10529b54 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/batch/v1/fake/fake_job.go @@ -0,0 +1,141 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + batchv1 "volcano.sh/apis/pkg/apis/batch/v1" +) + +// FakeJobs implements JobInterface +type FakeJobs struct { + Fake *FakeBatchV1 + ns string +} + +var jobsResource = schema.GroupVersionResource{Group: "batch.volcano.sh", Version: "v1", Resource: "jobs"} + +var jobsKind = schema.GroupVersionKind{Group: "batch.volcano.sh", Version: "v1", Kind: "Job"} + +// Get takes name of the job, and returns the corresponding job object, and an error if there is any. +func (c *FakeJobs) Get(ctx context.Context, name string, options v1.GetOptions) (result *batchv1.Job, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(jobsResource, c.ns, name), &batchv1.Job{}) + + if obj == nil { + return nil, err + } + return obj.(*batchv1.Job), err +} + +// List takes label and field selectors, and returns the list of Jobs that match those selectors. +func (c *FakeJobs) List(ctx context.Context, opts v1.ListOptions) (result *batchv1.JobList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(jobsResource, jobsKind, c.ns, opts), &batchv1.JobList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &batchv1.JobList{ListMeta: obj.(*batchv1.JobList).ListMeta} + for _, item := range obj.(*batchv1.JobList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested jobs. +func (c *FakeJobs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(jobsResource, c.ns, opts)) + +} + +// Create takes the representation of a job and creates it. Returns the server's representation of the job, and an error, if there is any. +func (c *FakeJobs) Create(ctx context.Context, job *batchv1.Job, opts v1.CreateOptions) (result *batchv1.Job, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(jobsResource, c.ns, job), &batchv1.Job{}) + + if obj == nil { + return nil, err + } + return obj.(*batchv1.Job), err +} + +// Update takes the representation of a job and updates it. Returns the server's representation of the job, and an error, if there is any. +func (c *FakeJobs) Update(ctx context.Context, job *batchv1.Job, opts v1.UpdateOptions) (result *batchv1.Job, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(jobsResource, c.ns, job), &batchv1.Job{}) + + if obj == nil { + return nil, err + } + return obj.(*batchv1.Job), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeJobs) UpdateStatus(ctx context.Context, job *batchv1.Job, opts v1.UpdateOptions) (*batchv1.Job, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(jobsResource, "status", c.ns, job), &batchv1.Job{}) + + if obj == nil { + return nil, err + } + return obj.(*batchv1.Job), err +} + +// Delete takes name of the job and deletes it. Returns an error if one occurs. +func (c *FakeJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(jobsResource, c.ns, name, opts), &batchv1.Job{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeJobs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(jobsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &batchv1.JobList{}) + return err +} + +// Patch applies the patch and returns the patched job. +func (c *FakeJobs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *batchv1.Job, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(jobsResource, c.ns, name, pt, data, subresources...), &batchv1.Job{}) + + if obj == nil { + return nil, err + } + return obj.(*batchv1.Job), err +} diff --git a/pkg/client/clientset/versioned/typed/batch/v1/generated_expansion.go b/pkg/client/clientset/versioned/typed/batch/v1/generated_expansion.go new file mode 100644 index 00000000..3e0524a6 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/batch/v1/generated_expansion.go @@ -0,0 +1,20 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +package v1 + +type JobExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/batch/v1/job.go b/pkg/client/clientset/versioned/typed/batch/v1/job.go new file mode 100644 index 00000000..d32b34df --- /dev/null +++ b/pkg/client/clientset/versioned/typed/batch/v1/job.go @@ -0,0 +1,194 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v1 "volcano.sh/apis/pkg/apis/batch/v1" + scheme "volcano.sh/apis/pkg/client/clientset/versioned/scheme" +) + +// JobsGetter has a method to return a JobInterface. +// A group's client should implement this interface. +type JobsGetter interface { + Jobs(namespace string) JobInterface +} + +// JobInterface has methods to work with Job resources. +type JobInterface interface { + Create(ctx context.Context, job *v1.Job, opts metav1.CreateOptions) (*v1.Job, error) + Update(ctx context.Context, job *v1.Job, opts metav1.UpdateOptions) (*v1.Job, error) + UpdateStatus(ctx context.Context, job *v1.Job, opts metav1.UpdateOptions) (*v1.Job, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Job, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.JobList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Job, err error) + JobExpansion +} + +// jobs implements JobInterface +type jobs struct { + client rest.Interface + ns string +} + +// newJobs returns a Jobs +func newJobs(c *BatchV1Client, namespace string) *jobs { + return &jobs{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the job, and returns the corresponding job object, and an error if there is any. +func (c *jobs) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Job, err error) { + result = &v1.Job{} + err = c.client.Get(). + Namespace(c.ns). + Resource("jobs"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Jobs that match those selectors. +func (c *jobs) List(ctx context.Context, opts metav1.ListOptions) (result *v1.JobList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.JobList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("jobs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested jobs. +func (c *jobs) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("jobs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a job and creates it. Returns the server's representation of the job, and an error, if there is any. +func (c *jobs) Create(ctx context.Context, job *v1.Job, opts metav1.CreateOptions) (result *v1.Job, err error) { + result = &v1.Job{} + err = c.client.Post(). + Namespace(c.ns). + Resource("jobs"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(job). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a job and updates it. Returns the server's representation of the job, and an error, if there is any. +func (c *jobs) Update(ctx context.Context, job *v1.Job, opts metav1.UpdateOptions) (result *v1.Job, err error) { + result = &v1.Job{} + err = c.client.Put(). + Namespace(c.ns). + Resource("jobs"). + Name(job.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(job). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *jobs) UpdateStatus(ctx context.Context, job *v1.Job, opts metav1.UpdateOptions) (result *v1.Job, err error) { + result = &v1.Job{} + err = c.client.Put(). + Namespace(c.ns). + Resource("jobs"). + Name(job.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(job). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the job and deletes it. Returns an error if one occurs. +func (c *jobs) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("jobs"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *jobs) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("jobs"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched job. +func (c *jobs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Job, err error) { + result = &v1.Job{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("jobs"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/batch/v1alpha1/batch_client.go b/pkg/client/clientset/versioned/typed/batch/v1alpha1/batch_client.go index 004701a1..8171e2f4 100644 --- a/pkg/client/clientset/versioned/typed/batch/v1alpha1/batch_client.go +++ b/pkg/client/clientset/versioned/typed/batch/v1alpha1/batch_client.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/batch/v1alpha1/doc.go b/pkg/client/clientset/versioned/typed/batch/v1alpha1/doc.go index e49de87c..e30c3b58 100644 --- a/pkg/client/clientset/versioned/typed/batch/v1alpha1/doc.go +++ b/pkg/client/clientset/versioned/typed/batch/v1alpha1/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/batch/v1alpha1/fake/doc.go b/pkg/client/clientset/versioned/typed/batch/v1alpha1/fake/doc.go index 3bc0494e..47d3cb36 100644 --- a/pkg/client/clientset/versioned/typed/batch/v1alpha1/fake/doc.go +++ b/pkg/client/clientset/versioned/typed/batch/v1alpha1/fake/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/batch/v1alpha1/fake/fake_batch_client.go b/pkg/client/clientset/versioned/typed/batch/v1alpha1/fake/fake_batch_client.go index c761acb0..f5351e7d 100644 --- a/pkg/client/clientset/versioned/typed/batch/v1alpha1/fake/fake_batch_client.go +++ b/pkg/client/clientset/versioned/typed/batch/v1alpha1/fake/fake_batch_client.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/batch/v1alpha1/fake/fake_job.go b/pkg/client/clientset/versioned/typed/batch/v1alpha1/fake/fake_job.go index 514cc670..fb1b1511 100644 --- a/pkg/client/clientset/versioned/typed/batch/v1alpha1/fake/fake_job.go +++ b/pkg/client/clientset/versioned/typed/batch/v1alpha1/fake/fake_job.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/batch/v1alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/batch/v1alpha1/generated_expansion.go index 623f4ea6..a4f1f078 100644 --- a/pkg/client/clientset/versioned/typed/batch/v1alpha1/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/batch/v1alpha1/generated_expansion.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/batch/v1alpha1/job.go b/pkg/client/clientset/versioned/typed/batch/v1alpha1/job.go index 47a6de59..0666db2e 100644 --- a/pkg/client/clientset/versioned/typed/batch/v1alpha1/job.go +++ b/pkg/client/clientset/versioned/typed/batch/v1alpha1/job.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/bus/v1/bus_client.go b/pkg/client/clientset/versioned/typed/bus/v1/bus_client.go new file mode 100644 index 00000000..f406393f --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bus/v1/bus_client.go @@ -0,0 +1,106 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +package v1 + +import ( + "net/http" + + rest "k8s.io/client-go/rest" + v1 "volcano.sh/apis/pkg/apis/bus/v1" + "volcano.sh/apis/pkg/client/clientset/versioned/scheme" +) + +type BusV1Interface interface { + RESTClient() rest.Interface + CommandsGetter +} + +// BusV1Client is used to interact with features provided by the bus.volcano.sh group. +type BusV1Client struct { + restClient rest.Interface +} + +func (c *BusV1Client) Commands(namespace string) CommandInterface { + return newCommands(c, namespace) +} + +// NewForConfig creates a new BusV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*BusV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new BusV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*BusV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &BusV1Client{client}, nil +} + +// NewForConfigOrDie creates a new BusV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *BusV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new BusV1Client for the given RESTClient. +func New(c rest.Interface) *BusV1Client { + return &BusV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *BusV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/clientset/versioned/typed/bus/v1/command.go b/pkg/client/clientset/versioned/typed/bus/v1/command.go new file mode 100644 index 00000000..ccc9b057 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bus/v1/command.go @@ -0,0 +1,177 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v1 "volcano.sh/apis/pkg/apis/bus/v1" + scheme "volcano.sh/apis/pkg/client/clientset/versioned/scheme" +) + +// CommandsGetter has a method to return a CommandInterface. +// A group's client should implement this interface. +type CommandsGetter interface { + Commands(namespace string) CommandInterface +} + +// CommandInterface has methods to work with Command resources. +type CommandInterface interface { + Create(ctx context.Context, command *v1.Command, opts metav1.CreateOptions) (*v1.Command, error) + Update(ctx context.Context, command *v1.Command, opts metav1.UpdateOptions) (*v1.Command, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Command, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.CommandList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Command, err error) + CommandExpansion +} + +// commands implements CommandInterface +type commands struct { + client rest.Interface + ns string +} + +// newCommands returns a Commands +func newCommands(c *BusV1Client, namespace string) *commands { + return &commands{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the command, and returns the corresponding command object, and an error if there is any. +func (c *commands) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Command, err error) { + result = &v1.Command{} + err = c.client.Get(). + Namespace(c.ns). + Resource("commands"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Commands that match those selectors. +func (c *commands) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CommandList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.CommandList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("commands"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested commands. +func (c *commands) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("commands"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a command and creates it. Returns the server's representation of the command, and an error, if there is any. +func (c *commands) Create(ctx context.Context, command *v1.Command, opts metav1.CreateOptions) (result *v1.Command, err error) { + result = &v1.Command{} + err = c.client.Post(). + Namespace(c.ns). + Resource("commands"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(command). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a command and updates it. Returns the server's representation of the command, and an error, if there is any. +func (c *commands) Update(ctx context.Context, command *v1.Command, opts metav1.UpdateOptions) (result *v1.Command, err error) { + result = &v1.Command{} + err = c.client.Put(). + Namespace(c.ns). + Resource("commands"). + Name(command.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(command). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the command and deletes it. Returns an error if one occurs. +func (c *commands) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("commands"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *commands) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("commands"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched command. +func (c *commands) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Command, err error) { + result = &v1.Command{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("commands"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/bus/v1/doc.go b/pkg/client/clientset/versioned/typed/bus/v1/doc.go new file mode 100644 index 00000000..efdfd9a4 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bus/v1/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/client/clientset/versioned/typed/bus/v1/fake/doc.go b/pkg/client/clientset/versioned/typed/bus/v1/fake/doc.go new file mode 100644 index 00000000..47d3cb36 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bus/v1/fake/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/client/clientset/versioned/typed/bus/v1/fake/fake_bus_client.go b/pkg/client/clientset/versioned/typed/bus/v1/fake/fake_bus_client.go new file mode 100644 index 00000000..0fea55a1 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bus/v1/fake/fake_bus_client.go @@ -0,0 +1,39 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +package fake + +import ( + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" + v1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/bus/v1" +) + +type FakeBusV1 struct { + *testing.Fake +} + +func (c *FakeBusV1) Commands(namespace string) v1.CommandInterface { + return &FakeCommands{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeBusV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/bus/v1/fake/fake_command.go b/pkg/client/clientset/versioned/typed/bus/v1/fake/fake_command.go new file mode 100644 index 00000000..9bd695f0 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bus/v1/fake/fake_command.go @@ -0,0 +1,129 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + busv1 "volcano.sh/apis/pkg/apis/bus/v1" +) + +// FakeCommands implements CommandInterface +type FakeCommands struct { + Fake *FakeBusV1 + ns string +} + +var commandsResource = schema.GroupVersionResource{Group: "bus.volcano.sh", Version: "v1", Resource: "commands"} + +var commandsKind = schema.GroupVersionKind{Group: "bus.volcano.sh", Version: "v1", Kind: "Command"} + +// Get takes name of the command, and returns the corresponding command object, and an error if there is any. +func (c *FakeCommands) Get(ctx context.Context, name string, options v1.GetOptions) (result *busv1.Command, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(commandsResource, c.ns, name), &busv1.Command{}) + + if obj == nil { + return nil, err + } + return obj.(*busv1.Command), err +} + +// List takes label and field selectors, and returns the list of Commands that match those selectors. +func (c *FakeCommands) List(ctx context.Context, opts v1.ListOptions) (result *busv1.CommandList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(commandsResource, commandsKind, c.ns, opts), &busv1.CommandList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &busv1.CommandList{ListMeta: obj.(*busv1.CommandList).ListMeta} + for _, item := range obj.(*busv1.CommandList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested commands. +func (c *FakeCommands) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(commandsResource, c.ns, opts)) + +} + +// Create takes the representation of a command and creates it. Returns the server's representation of the command, and an error, if there is any. +func (c *FakeCommands) Create(ctx context.Context, command *busv1.Command, opts v1.CreateOptions) (result *busv1.Command, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(commandsResource, c.ns, command), &busv1.Command{}) + + if obj == nil { + return nil, err + } + return obj.(*busv1.Command), err +} + +// Update takes the representation of a command and updates it. Returns the server's representation of the command, and an error, if there is any. +func (c *FakeCommands) Update(ctx context.Context, command *busv1.Command, opts v1.UpdateOptions) (result *busv1.Command, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(commandsResource, c.ns, command), &busv1.Command{}) + + if obj == nil { + return nil, err + } + return obj.(*busv1.Command), err +} + +// Delete takes name of the command and deletes it. Returns an error if one occurs. +func (c *FakeCommands) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(commandsResource, c.ns, name, opts), &busv1.Command{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCommands) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(commandsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &busv1.CommandList{}) + return err +} + +// Patch applies the patch and returns the patched command. +func (c *FakeCommands) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *busv1.Command, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(commandsResource, c.ns, name, pt, data, subresources...), &busv1.Command{}) + + if obj == nil { + return nil, err + } + return obj.(*busv1.Command), err +} diff --git a/pkg/client/clientset/versioned/typed/bus/v1/generated_expansion.go b/pkg/client/clientset/versioned/typed/bus/v1/generated_expansion.go new file mode 100644 index 00000000..29d6bc6a --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bus/v1/generated_expansion.go @@ -0,0 +1,20 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +package v1 + +type CommandExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/bus/v1alpha1/bus_client.go b/pkg/client/clientset/versioned/typed/bus/v1alpha1/bus_client.go index 9558ff2f..cb729ffd 100644 --- a/pkg/client/clientset/versioned/typed/bus/v1alpha1/bus_client.go +++ b/pkg/client/clientset/versioned/typed/bus/v1alpha1/bus_client.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/bus/v1alpha1/command.go b/pkg/client/clientset/versioned/typed/bus/v1alpha1/command.go index c083bb42..eb039422 100644 --- a/pkg/client/clientset/versioned/typed/bus/v1alpha1/command.go +++ b/pkg/client/clientset/versioned/typed/bus/v1alpha1/command.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/bus/v1alpha1/doc.go b/pkg/client/clientset/versioned/typed/bus/v1alpha1/doc.go index e49de87c..e30c3b58 100644 --- a/pkg/client/clientset/versioned/typed/bus/v1alpha1/doc.go +++ b/pkg/client/clientset/versioned/typed/bus/v1alpha1/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/bus/v1alpha1/fake/doc.go b/pkg/client/clientset/versioned/typed/bus/v1alpha1/fake/doc.go index 3bc0494e..47d3cb36 100644 --- a/pkg/client/clientset/versioned/typed/bus/v1alpha1/fake/doc.go +++ b/pkg/client/clientset/versioned/typed/bus/v1alpha1/fake/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/bus/v1alpha1/fake/fake_bus_client.go b/pkg/client/clientset/versioned/typed/bus/v1alpha1/fake/fake_bus_client.go index c144c927..366d9e26 100644 --- a/pkg/client/clientset/versioned/typed/bus/v1alpha1/fake/fake_bus_client.go +++ b/pkg/client/clientset/versioned/typed/bus/v1alpha1/fake/fake_bus_client.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/bus/v1alpha1/fake/fake_command.go b/pkg/client/clientset/versioned/typed/bus/v1alpha1/fake/fake_command.go index 28e276da..2e3369d1 100644 --- a/pkg/client/clientset/versioned/typed/bus/v1alpha1/fake/fake_command.go +++ b/pkg/client/clientset/versioned/typed/bus/v1alpha1/fake/fake_command.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/bus/v1alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/bus/v1alpha1/generated_expansion.go index bb13ce27..efa863e3 100644 --- a/pkg/client/clientset/versioned/typed/bus/v1alpha1/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/bus/v1alpha1/generated_expansion.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/flow/v1alpha1/doc.go b/pkg/client/clientset/versioned/typed/flow/v1alpha1/doc.go index e49de87c..e30c3b58 100644 --- a/pkg/client/clientset/versioned/typed/flow/v1alpha1/doc.go +++ b/pkg/client/clientset/versioned/typed/flow/v1alpha1/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/flow/v1alpha1/fake/doc.go b/pkg/client/clientset/versioned/typed/flow/v1alpha1/fake/doc.go index 3bc0494e..47d3cb36 100644 --- a/pkg/client/clientset/versioned/typed/flow/v1alpha1/fake/doc.go +++ b/pkg/client/clientset/versioned/typed/flow/v1alpha1/fake/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/flow/v1alpha1/fake/fake_flow_client.go b/pkg/client/clientset/versioned/typed/flow/v1alpha1/fake/fake_flow_client.go index 66fc76c4..500ae7f5 100644 --- a/pkg/client/clientset/versioned/typed/flow/v1alpha1/fake/fake_flow_client.go +++ b/pkg/client/clientset/versioned/typed/flow/v1alpha1/fake/fake_flow_client.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/flow/v1alpha1/fake/fake_jobflow.go b/pkg/client/clientset/versioned/typed/flow/v1alpha1/fake/fake_jobflow.go index aa7351c2..ce09abb7 100644 --- a/pkg/client/clientset/versioned/typed/flow/v1alpha1/fake/fake_jobflow.go +++ b/pkg/client/clientset/versioned/typed/flow/v1alpha1/fake/fake_jobflow.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/flow/v1alpha1/fake/fake_jobtemplate.go b/pkg/client/clientset/versioned/typed/flow/v1alpha1/fake/fake_jobtemplate.go index 86ce3c1e..1de735fb 100644 --- a/pkg/client/clientset/versioned/typed/flow/v1alpha1/fake/fake_jobtemplate.go +++ b/pkg/client/clientset/versioned/typed/flow/v1alpha1/fake/fake_jobtemplate.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/flow/v1alpha1/flow_client.go b/pkg/client/clientset/versioned/typed/flow/v1alpha1/flow_client.go index a62d6987..4726d739 100644 --- a/pkg/client/clientset/versioned/typed/flow/v1alpha1/flow_client.go +++ b/pkg/client/clientset/versioned/typed/flow/v1alpha1/flow_client.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/flow/v1alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/flow/v1alpha1/generated_expansion.go index c6eb4f44..3aa95ad0 100644 --- a/pkg/client/clientset/versioned/typed/flow/v1alpha1/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/flow/v1alpha1/generated_expansion.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/flow/v1alpha1/jobflow.go b/pkg/client/clientset/versioned/typed/flow/v1alpha1/jobflow.go index af4c31f9..975abdfd 100644 --- a/pkg/client/clientset/versioned/typed/flow/v1alpha1/jobflow.go +++ b/pkg/client/clientset/versioned/typed/flow/v1alpha1/jobflow.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/flow/v1alpha1/jobtemplate.go b/pkg/client/clientset/versioned/typed/flow/v1alpha1/jobtemplate.go index a5f5e0b5..05f9194e 100644 --- a/pkg/client/clientset/versioned/typed/flow/v1alpha1/jobtemplate.go +++ b/pkg/client/clientset/versioned/typed/flow/v1alpha1/jobtemplate.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/doc.go b/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/doc.go index e49de87c..e30c3b58 100644 --- a/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/doc.go +++ b/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/fake/doc.go b/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/fake/doc.go index 3bc0494e..47d3cb36 100644 --- a/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/fake/doc.go +++ b/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/fake/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/fake/fake_nodeinfo_client.go b/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/fake/fake_nodeinfo_client.go index 1f580e5b..c931afc9 100644 --- a/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/fake/fake_nodeinfo_client.go +++ b/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/fake/fake_nodeinfo_client.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/fake/fake_numatopology.go b/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/fake/fake_numatopology.go index 16b43aaf..2b21fce8 100644 --- a/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/fake/fake_numatopology.go +++ b/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/fake/fake_numatopology.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/generated_expansion.go index 0b1176f4..e97b13d8 100644 --- a/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/generated_expansion.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/nodeinfo_client.go b/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/nodeinfo_client.go index da9a6181..4f9fcac5 100644 --- a/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/nodeinfo_client.go +++ b/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/nodeinfo_client.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/numatopology.go b/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/numatopology.go index 35fd7dc8..ffba15a6 100644 --- a/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/numatopology.go +++ b/pkg/client/clientset/versioned/typed/nodeinfo/v1alpha1/numatopology.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1/doc.go b/pkg/client/clientset/versioned/typed/scheduling/v1/doc.go new file mode 100644 index 00000000..efdfd9a4 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/scheduling/v1/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1/fake/doc.go b/pkg/client/clientset/versioned/typed/scheduling/v1/fake/doc.go new file mode 100644 index 00000000..47d3cb36 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/scheduling/v1/fake/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1/fake/fake_podgroup.go b/pkg/client/clientset/versioned/typed/scheduling/v1/fake/fake_podgroup.go new file mode 100644 index 00000000..b825894a --- /dev/null +++ b/pkg/client/clientset/versioned/typed/scheduling/v1/fake/fake_podgroup.go @@ -0,0 +1,141 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + schedulingv1 "volcano.sh/apis/pkg/apis/scheduling/v1" +) + +// FakePodGroups implements PodGroupInterface +type FakePodGroups struct { + Fake *FakeSchedulingV1 + ns string +} + +var podgroupsResource = schema.GroupVersionResource{Group: "scheduling.volcano.sh", Version: "v1", Resource: "podgroups"} + +var podgroupsKind = schema.GroupVersionKind{Group: "scheduling.volcano.sh", Version: "v1", Kind: "PodGroup"} + +// Get takes name of the podGroup, and returns the corresponding podGroup object, and an error if there is any. +func (c *FakePodGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *schedulingv1.PodGroup, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(podgroupsResource, c.ns, name), &schedulingv1.PodGroup{}) + + if obj == nil { + return nil, err + } + return obj.(*schedulingv1.PodGroup), err +} + +// List takes label and field selectors, and returns the list of PodGroups that match those selectors. +func (c *FakePodGroups) List(ctx context.Context, opts v1.ListOptions) (result *schedulingv1.PodGroupList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(podgroupsResource, podgroupsKind, c.ns, opts), &schedulingv1.PodGroupList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &schedulingv1.PodGroupList{ListMeta: obj.(*schedulingv1.PodGroupList).ListMeta} + for _, item := range obj.(*schedulingv1.PodGroupList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested podGroups. +func (c *FakePodGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(podgroupsResource, c.ns, opts)) + +} + +// Create takes the representation of a podGroup and creates it. Returns the server's representation of the podGroup, and an error, if there is any. +func (c *FakePodGroups) Create(ctx context.Context, podGroup *schedulingv1.PodGroup, opts v1.CreateOptions) (result *schedulingv1.PodGroup, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(podgroupsResource, c.ns, podGroup), &schedulingv1.PodGroup{}) + + if obj == nil { + return nil, err + } + return obj.(*schedulingv1.PodGroup), err +} + +// Update takes the representation of a podGroup and updates it. Returns the server's representation of the podGroup, and an error, if there is any. +func (c *FakePodGroups) Update(ctx context.Context, podGroup *schedulingv1.PodGroup, opts v1.UpdateOptions) (result *schedulingv1.PodGroup, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(podgroupsResource, c.ns, podGroup), &schedulingv1.PodGroup{}) + + if obj == nil { + return nil, err + } + return obj.(*schedulingv1.PodGroup), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakePodGroups) UpdateStatus(ctx context.Context, podGroup *schedulingv1.PodGroup, opts v1.UpdateOptions) (*schedulingv1.PodGroup, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(podgroupsResource, "status", c.ns, podGroup), &schedulingv1.PodGroup{}) + + if obj == nil { + return nil, err + } + return obj.(*schedulingv1.PodGroup), err +} + +// Delete takes name of the podGroup and deletes it. Returns an error if one occurs. +func (c *FakePodGroups) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(podgroupsResource, c.ns, name, opts), &schedulingv1.PodGroup{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakePodGroups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(podgroupsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &schedulingv1.PodGroupList{}) + return err +} + +// Patch applies the patch and returns the patched podGroup. +func (c *FakePodGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *schedulingv1.PodGroup, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(podgroupsResource, c.ns, name, pt, data, subresources...), &schedulingv1.PodGroup{}) + + if obj == nil { + return nil, err + } + return obj.(*schedulingv1.PodGroup), err +} diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1/fake/fake_queue.go b/pkg/client/clientset/versioned/typed/scheduling/v1/fake/fake_queue.go new file mode 100644 index 00000000..d82c2ebc --- /dev/null +++ b/pkg/client/clientset/versioned/typed/scheduling/v1/fake/fake_queue.go @@ -0,0 +1,132 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + schedulingv1 "volcano.sh/apis/pkg/apis/scheduling/v1" +) + +// FakeQueues implements QueueInterface +type FakeQueues struct { + Fake *FakeSchedulingV1 +} + +var queuesResource = schema.GroupVersionResource{Group: "scheduling.volcano.sh", Version: "v1", Resource: "queues"} + +var queuesKind = schema.GroupVersionKind{Group: "scheduling.volcano.sh", Version: "v1", Kind: "Queue"} + +// Get takes name of the queue, and returns the corresponding queue object, and an error if there is any. +func (c *FakeQueues) Get(ctx context.Context, name string, options v1.GetOptions) (result *schedulingv1.Queue, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(queuesResource, name), &schedulingv1.Queue{}) + if obj == nil { + return nil, err + } + return obj.(*schedulingv1.Queue), err +} + +// List takes label and field selectors, and returns the list of Queues that match those selectors. +func (c *FakeQueues) List(ctx context.Context, opts v1.ListOptions) (result *schedulingv1.QueueList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(queuesResource, queuesKind, opts), &schedulingv1.QueueList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &schedulingv1.QueueList{ListMeta: obj.(*schedulingv1.QueueList).ListMeta} + for _, item := range obj.(*schedulingv1.QueueList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested queues. +func (c *FakeQueues) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(queuesResource, opts)) +} + +// Create takes the representation of a queue and creates it. Returns the server's representation of the queue, and an error, if there is any. +func (c *FakeQueues) Create(ctx context.Context, queue *schedulingv1.Queue, opts v1.CreateOptions) (result *schedulingv1.Queue, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(queuesResource, queue), &schedulingv1.Queue{}) + if obj == nil { + return nil, err + } + return obj.(*schedulingv1.Queue), err +} + +// Update takes the representation of a queue and updates it. Returns the server's representation of the queue, and an error, if there is any. +func (c *FakeQueues) Update(ctx context.Context, queue *schedulingv1.Queue, opts v1.UpdateOptions) (result *schedulingv1.Queue, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(queuesResource, queue), &schedulingv1.Queue{}) + if obj == nil { + return nil, err + } + return obj.(*schedulingv1.Queue), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeQueues) UpdateStatus(ctx context.Context, queue *schedulingv1.Queue, opts v1.UpdateOptions) (*schedulingv1.Queue, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(queuesResource, "status", queue), &schedulingv1.Queue{}) + if obj == nil { + return nil, err + } + return obj.(*schedulingv1.Queue), err +} + +// Delete takes name of the queue and deletes it. Returns an error if one occurs. +func (c *FakeQueues) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(queuesResource, name, opts), &schedulingv1.Queue{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeQueues) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(queuesResource, listOpts) + + _, err := c.Fake.Invokes(action, &schedulingv1.QueueList{}) + return err +} + +// Patch applies the patch and returns the patched queue. +func (c *FakeQueues) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *schedulingv1.Queue, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(queuesResource, name, pt, data, subresources...), &schedulingv1.Queue{}) + if obj == nil { + return nil, err + } + return obj.(*schedulingv1.Queue), err +} diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1/fake/fake_scheduling_client.go b/pkg/client/clientset/versioned/typed/scheduling/v1/fake/fake_scheduling_client.go new file mode 100644 index 00000000..7127e5a5 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/scheduling/v1/fake/fake_scheduling_client.go @@ -0,0 +1,43 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +package fake + +import ( + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" + v1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/scheduling/v1" +) + +type FakeSchedulingV1 struct { + *testing.Fake +} + +func (c *FakeSchedulingV1) PodGroups(namespace string) v1.PodGroupInterface { + return &FakePodGroups{c, namespace} +} + +func (c *FakeSchedulingV1) Queues() v1.QueueInterface { + return &FakeQueues{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeSchedulingV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1/generated_expansion.go b/pkg/client/clientset/versioned/typed/scheduling/v1/generated_expansion.go new file mode 100644 index 00000000..0d2643d0 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/scheduling/v1/generated_expansion.go @@ -0,0 +1,22 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +package v1 + +type PodGroupExpansion interface{} + +type QueueExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1/podgroup.go b/pkg/client/clientset/versioned/typed/scheduling/v1/podgroup.go new file mode 100644 index 00000000..fa97d852 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/scheduling/v1/podgroup.go @@ -0,0 +1,194 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v1 "volcano.sh/apis/pkg/apis/scheduling/v1" + scheme "volcano.sh/apis/pkg/client/clientset/versioned/scheme" +) + +// PodGroupsGetter has a method to return a PodGroupInterface. +// A group's client should implement this interface. +type PodGroupsGetter interface { + PodGroups(namespace string) PodGroupInterface +} + +// PodGroupInterface has methods to work with PodGroup resources. +type PodGroupInterface interface { + Create(ctx context.Context, podGroup *v1.PodGroup, opts metav1.CreateOptions) (*v1.PodGroup, error) + Update(ctx context.Context, podGroup *v1.PodGroup, opts metav1.UpdateOptions) (*v1.PodGroup, error) + UpdateStatus(ctx context.Context, podGroup *v1.PodGroup, opts metav1.UpdateOptions) (*v1.PodGroup, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.PodGroup, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.PodGroupList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PodGroup, err error) + PodGroupExpansion +} + +// podGroups implements PodGroupInterface +type podGroups struct { + client rest.Interface + ns string +} + +// newPodGroups returns a PodGroups +func newPodGroups(c *SchedulingV1Client, namespace string) *podGroups { + return &podGroups{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the podGroup, and returns the corresponding podGroup object, and an error if there is any. +func (c *podGroups) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.PodGroup, err error) { + result = &v1.PodGroup{} + err = c.client.Get(). + Namespace(c.ns). + Resource("podgroups"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of PodGroups that match those selectors. +func (c *podGroups) List(ctx context.Context, opts metav1.ListOptions) (result *v1.PodGroupList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.PodGroupList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("podgroups"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested podGroups. +func (c *podGroups) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("podgroups"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a podGroup and creates it. Returns the server's representation of the podGroup, and an error, if there is any. +func (c *podGroups) Create(ctx context.Context, podGroup *v1.PodGroup, opts metav1.CreateOptions) (result *v1.PodGroup, err error) { + result = &v1.PodGroup{} + err = c.client.Post(). + Namespace(c.ns). + Resource("podgroups"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(podGroup). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a podGroup and updates it. Returns the server's representation of the podGroup, and an error, if there is any. +func (c *podGroups) Update(ctx context.Context, podGroup *v1.PodGroup, opts metav1.UpdateOptions) (result *v1.PodGroup, err error) { + result = &v1.PodGroup{} + err = c.client.Put(). + Namespace(c.ns). + Resource("podgroups"). + Name(podGroup.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(podGroup). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *podGroups) UpdateStatus(ctx context.Context, podGroup *v1.PodGroup, opts metav1.UpdateOptions) (result *v1.PodGroup, err error) { + result = &v1.PodGroup{} + err = c.client.Put(). + Namespace(c.ns). + Resource("podgroups"). + Name(podGroup.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(podGroup). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the podGroup and deletes it. Returns an error if one occurs. +func (c *podGroups) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("podgroups"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *podGroups) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("podgroups"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched podGroup. +func (c *podGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PodGroup, err error) { + result = &v1.PodGroup{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("podgroups"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1/queue.go b/pkg/client/clientset/versioned/typed/scheduling/v1/queue.go new file mode 100644 index 00000000..691101f0 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/scheduling/v1/queue.go @@ -0,0 +1,183 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v1 "volcano.sh/apis/pkg/apis/scheduling/v1" + scheme "volcano.sh/apis/pkg/client/clientset/versioned/scheme" +) + +// QueuesGetter has a method to return a QueueInterface. +// A group's client should implement this interface. +type QueuesGetter interface { + Queues() QueueInterface +} + +// QueueInterface has methods to work with Queue resources. +type QueueInterface interface { + Create(ctx context.Context, queue *v1.Queue, opts metav1.CreateOptions) (*v1.Queue, error) + Update(ctx context.Context, queue *v1.Queue, opts metav1.UpdateOptions) (*v1.Queue, error) + UpdateStatus(ctx context.Context, queue *v1.Queue, opts metav1.UpdateOptions) (*v1.Queue, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Queue, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.QueueList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Queue, err error) + QueueExpansion +} + +// queues implements QueueInterface +type queues struct { + client rest.Interface +} + +// newQueues returns a Queues +func newQueues(c *SchedulingV1Client) *queues { + return &queues{ + client: c.RESTClient(), + } +} + +// Get takes name of the queue, and returns the corresponding queue object, and an error if there is any. +func (c *queues) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Queue, err error) { + result = &v1.Queue{} + err = c.client.Get(). + Resource("queues"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Queues that match those selectors. +func (c *queues) List(ctx context.Context, opts metav1.ListOptions) (result *v1.QueueList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.QueueList{} + err = c.client.Get(). + Resource("queues"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested queues. +func (c *queues) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("queues"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a queue and creates it. Returns the server's representation of the queue, and an error, if there is any. +func (c *queues) Create(ctx context.Context, queue *v1.Queue, opts metav1.CreateOptions) (result *v1.Queue, err error) { + result = &v1.Queue{} + err = c.client.Post(). + Resource("queues"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(queue). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a queue and updates it. Returns the server's representation of the queue, and an error, if there is any. +func (c *queues) Update(ctx context.Context, queue *v1.Queue, opts metav1.UpdateOptions) (result *v1.Queue, err error) { + result = &v1.Queue{} + err = c.client.Put(). + Resource("queues"). + Name(queue.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(queue). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *queues) UpdateStatus(ctx context.Context, queue *v1.Queue, opts metav1.UpdateOptions) (result *v1.Queue, err error) { + result = &v1.Queue{} + err = c.client.Put(). + Resource("queues"). + Name(queue.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(queue). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the queue and deletes it. Returns an error if one occurs. +func (c *queues) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Resource("queues"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *queues) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("queues"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched queue. +func (c *queues) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Queue, err error) { + result = &v1.Queue{} + err = c.client.Patch(pt). + Resource("queues"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1/scheduling_client.go b/pkg/client/clientset/versioned/typed/scheduling/v1/scheduling_client.go new file mode 100644 index 00000000..3964434d --- /dev/null +++ b/pkg/client/clientset/versioned/typed/scheduling/v1/scheduling_client.go @@ -0,0 +1,111 @@ +/* +Copyright 2022 The Volcano 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 client-gen. DO NOT EDIT. + +package v1 + +import ( + "net/http" + + rest "k8s.io/client-go/rest" + v1 "volcano.sh/apis/pkg/apis/scheduling/v1" + "volcano.sh/apis/pkg/client/clientset/versioned/scheme" +) + +type SchedulingV1Interface interface { + RESTClient() rest.Interface + PodGroupsGetter + QueuesGetter +} + +// SchedulingV1Client is used to interact with features provided by the scheduling.volcano.sh group. +type SchedulingV1Client struct { + restClient rest.Interface +} + +func (c *SchedulingV1Client) PodGroups(namespace string) PodGroupInterface { + return newPodGroups(c, namespace) +} + +func (c *SchedulingV1Client) Queues() QueueInterface { + return newQueues(c) +} + +// NewForConfig creates a new SchedulingV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*SchedulingV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new SchedulingV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*SchedulingV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &SchedulingV1Client{client}, nil +} + +// NewForConfigOrDie creates a new SchedulingV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *SchedulingV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new SchedulingV1Client for the given RESTClient. +func New(c rest.Interface) *SchedulingV1Client { + return &SchedulingV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *SchedulingV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1beta1/doc.go b/pkg/client/clientset/versioned/typed/scheduling/v1beta1/doc.go index e6ffabf9..2536d959 100644 --- a/pkg/client/clientset/versioned/typed/scheduling/v1beta1/doc.go +++ b/pkg/client/clientset/versioned/typed/scheduling/v1beta1/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1beta1/fake/doc.go b/pkg/client/clientset/versioned/typed/scheduling/v1beta1/fake/doc.go index 3bc0494e..47d3cb36 100644 --- a/pkg/client/clientset/versioned/typed/scheduling/v1beta1/fake/doc.go +++ b/pkg/client/clientset/versioned/typed/scheduling/v1beta1/fake/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1beta1/fake/fake_podgroup.go b/pkg/client/clientset/versioned/typed/scheduling/v1beta1/fake/fake_podgroup.go index 3531b58c..fe2735c8 100644 --- a/pkg/client/clientset/versioned/typed/scheduling/v1beta1/fake/fake_podgroup.go +++ b/pkg/client/clientset/versioned/typed/scheduling/v1beta1/fake/fake_podgroup.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1beta1/fake/fake_queue.go b/pkg/client/clientset/versioned/typed/scheduling/v1beta1/fake/fake_queue.go index 3598dfe0..55fc0a54 100644 --- a/pkg/client/clientset/versioned/typed/scheduling/v1beta1/fake/fake_queue.go +++ b/pkg/client/clientset/versioned/typed/scheduling/v1beta1/fake/fake_queue.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1beta1/fake/fake_scheduling_client.go b/pkg/client/clientset/versioned/typed/scheduling/v1beta1/fake/fake_scheduling_client.go index b653aa86..a3e78649 100644 --- a/pkg/client/clientset/versioned/typed/scheduling/v1beta1/fake/fake_scheduling_client.go +++ b/pkg/client/clientset/versioned/typed/scheduling/v1beta1/fake/fake_scheduling_client.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1beta1/generated_expansion.go b/pkg/client/clientset/versioned/typed/scheduling/v1beta1/generated_expansion.go index b5e7e746..fcf5ee2c 100644 --- a/pkg/client/clientset/versioned/typed/scheduling/v1beta1/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/scheduling/v1beta1/generated_expansion.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1beta1/podgroup.go b/pkg/client/clientset/versioned/typed/scheduling/v1beta1/podgroup.go index 4efffaf0..769a9b71 100644 --- a/pkg/client/clientset/versioned/typed/scheduling/v1beta1/podgroup.go +++ b/pkg/client/clientset/versioned/typed/scheduling/v1beta1/podgroup.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1beta1/queue.go b/pkg/client/clientset/versioned/typed/scheduling/v1beta1/queue.go index 4a822975..0dc52a66 100644 --- a/pkg/client/clientset/versioned/typed/scheduling/v1beta1/queue.go +++ b/pkg/client/clientset/versioned/typed/scheduling/v1beta1/queue.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/scheduling/v1beta1/scheduling_client.go b/pkg/client/clientset/versioned/typed/scheduling/v1beta1/scheduling_client.go index 6d88c436..86b5b686 100644 --- a/pkg/client/clientset/versioned/typed/scheduling/v1beta1/scheduling_client.go +++ b/pkg/client/clientset/versioned/typed/scheduling/v1beta1/scheduling_client.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/batch/interface.go b/pkg/client/informers/externalversions/batch/interface.go index b454739e..5c067854 100644 --- a/pkg/client/informers/externalversions/batch/interface.go +++ b/pkg/client/informers/externalversions/batch/interface.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ limitations under the License. package batch import ( + v1 "volcano.sh/apis/pkg/client/informers/externalversions/batch/v1" v1alpha1 "volcano.sh/apis/pkg/client/informers/externalversions/batch/v1alpha1" internalinterfaces "volcano.sh/apis/pkg/client/informers/externalversions/internalinterfaces" ) @@ -26,6 +27,8 @@ import ( type Interface interface { // V1alpha1 provides access to shared informers for resources in V1alpha1. V1alpha1() v1alpha1.Interface + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface } type group struct { @@ -43,3 +46,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList func (g *group) V1alpha1() v1alpha1.Interface { return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) } + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/batch/v1/interface.go b/pkg/client/informers/externalversions/batch/v1/interface.go new file mode 100644 index 00000000..cb9c3db4 --- /dev/null +++ b/pkg/client/informers/externalversions/batch/v1/interface.go @@ -0,0 +1,44 @@ +/* +Copyright 2022 The Volcano 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "volcano.sh/apis/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Jobs returns a JobInformer. + Jobs() JobInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Jobs returns a JobInformer. +func (v *version) Jobs() JobInformer { + return &jobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/client/informers/externalversions/batch/v1/job.go b/pkg/client/informers/externalversions/batch/v1/job.go new file mode 100644 index 00000000..9126adb8 --- /dev/null +++ b/pkg/client/informers/externalversions/batch/v1/job.go @@ -0,0 +1,89 @@ +/* +Copyright 2022 The Volcano 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + batchv1 "volcano.sh/apis/pkg/apis/batch/v1" + versioned "volcano.sh/apis/pkg/client/clientset/versioned" + internalinterfaces "volcano.sh/apis/pkg/client/informers/externalversions/internalinterfaces" + v1 "volcano.sh/apis/pkg/client/listers/batch/v1" +) + +// JobInformer provides access to a shared informer and lister for +// Jobs. +type JobInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.JobLister +} + +type jobInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewJobInformer constructs a new informer for Job type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredJobInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredJobInformer constructs a new informer for Job type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BatchV1().Jobs(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BatchV1().Jobs(namespace).Watch(context.TODO(), options) + }, + }, + &batchv1.Job{}, + resyncPeriod, + indexers, + ) +} + +func (f *jobInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *jobInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&batchv1.Job{}, f.defaultInformer) +} + +func (f *jobInformer) Lister() v1.JobLister { + return v1.NewJobLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/batch/v1alpha1/interface.go b/pkg/client/informers/externalversions/batch/v1alpha1/interface.go index 0511921d..5d5e8cf1 100644 --- a/pkg/client/informers/externalversions/batch/v1alpha1/interface.go +++ b/pkg/client/informers/externalversions/batch/v1alpha1/interface.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/batch/v1alpha1/job.go b/pkg/client/informers/externalversions/batch/v1alpha1/job.go index 4127107d..e4286603 100644 --- a/pkg/client/informers/externalversions/batch/v1alpha1/job.go +++ b/pkg/client/informers/externalversions/batch/v1alpha1/job.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/bus/interface.go b/pkg/client/informers/externalversions/bus/interface.go index 87f2e644..45906f74 100644 --- a/pkg/client/informers/externalversions/bus/interface.go +++ b/pkg/client/informers/externalversions/bus/interface.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ limitations under the License. package bus import ( + v1 "volcano.sh/apis/pkg/client/informers/externalversions/bus/v1" v1alpha1 "volcano.sh/apis/pkg/client/informers/externalversions/bus/v1alpha1" internalinterfaces "volcano.sh/apis/pkg/client/informers/externalversions/internalinterfaces" ) @@ -26,6 +27,8 @@ import ( type Interface interface { // V1alpha1 provides access to shared informers for resources in V1alpha1. V1alpha1() v1alpha1.Interface + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface } type group struct { @@ -43,3 +46,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList func (g *group) V1alpha1() v1alpha1.Interface { return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) } + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/bus/v1/command.go b/pkg/client/informers/externalversions/bus/v1/command.go new file mode 100644 index 00000000..48e0b9c0 --- /dev/null +++ b/pkg/client/informers/externalversions/bus/v1/command.go @@ -0,0 +1,89 @@ +/* +Copyright 2022 The Volcano 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + busv1 "volcano.sh/apis/pkg/apis/bus/v1" + versioned "volcano.sh/apis/pkg/client/clientset/versioned" + internalinterfaces "volcano.sh/apis/pkg/client/informers/externalversions/internalinterfaces" + v1 "volcano.sh/apis/pkg/client/listers/bus/v1" +) + +// CommandInformer provides access to a shared informer and lister for +// Commands. +type CommandInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.CommandLister +} + +type commandInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewCommandInformer constructs a new informer for Command type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCommandInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCommandInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredCommandInformer constructs a new informer for Command type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCommandInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BusV1().Commands(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BusV1().Commands(namespace).Watch(context.TODO(), options) + }, + }, + &busv1.Command{}, + resyncPeriod, + indexers, + ) +} + +func (f *commandInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCommandInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *commandInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&busv1.Command{}, f.defaultInformer) +} + +func (f *commandInformer) Lister() v1.CommandLister { + return v1.NewCommandLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/bus/v1/interface.go b/pkg/client/informers/externalversions/bus/v1/interface.go new file mode 100644 index 00000000..74145352 --- /dev/null +++ b/pkg/client/informers/externalversions/bus/v1/interface.go @@ -0,0 +1,44 @@ +/* +Copyright 2022 The Volcano 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "volcano.sh/apis/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Commands returns a CommandInformer. + Commands() CommandInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Commands returns a CommandInformer. +func (v *version) Commands() CommandInformer { + return &commandInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/client/informers/externalversions/bus/v1alpha1/command.go b/pkg/client/informers/externalversions/bus/v1alpha1/command.go index 8d8fe07f..b0205a2e 100644 --- a/pkg/client/informers/externalversions/bus/v1alpha1/command.go +++ b/pkg/client/informers/externalversions/bus/v1alpha1/command.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/bus/v1alpha1/interface.go b/pkg/client/informers/externalversions/bus/v1alpha1/interface.go index b807cc26..f1f5a95d 100644 --- a/pkg/client/informers/externalversions/bus/v1alpha1/interface.go +++ b/pkg/client/informers/externalversions/bus/v1alpha1/interface.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/factory.go b/pkg/client/informers/externalversions/factory.go index 05dc6a0a..6af33e8d 100644 --- a/pkg/client/informers/externalversions/factory.go +++ b/pkg/client/informers/externalversions/factory.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/flow/interface.go b/pkg/client/informers/externalversions/flow/interface.go index 6deeaf3a..965f67ef 100644 --- a/pkg/client/informers/externalversions/flow/interface.go +++ b/pkg/client/informers/externalversions/flow/interface.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/flow/v1alpha1/interface.go b/pkg/client/informers/externalversions/flow/v1alpha1/interface.go index 53fbb130..3878c901 100644 --- a/pkg/client/informers/externalversions/flow/v1alpha1/interface.go +++ b/pkg/client/informers/externalversions/flow/v1alpha1/interface.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/flow/v1alpha1/jobflow.go b/pkg/client/informers/externalversions/flow/v1alpha1/jobflow.go index f5c33f92..a088255b 100644 --- a/pkg/client/informers/externalversions/flow/v1alpha1/jobflow.go +++ b/pkg/client/informers/externalversions/flow/v1alpha1/jobflow.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/flow/v1alpha1/jobtemplate.go b/pkg/client/informers/externalversions/flow/v1alpha1/jobtemplate.go index d3d512a7..8ac75ca9 100644 --- a/pkg/client/informers/externalversions/flow/v1alpha1/jobtemplate.go +++ b/pkg/client/informers/externalversions/flow/v1alpha1/jobtemplate.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 1021deb1..83862eb8 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,10 +22,13 @@ import ( schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" + v1 "volcano.sh/apis/pkg/apis/batch/v1" v1alpha1 "volcano.sh/apis/pkg/apis/batch/v1alpha1" + busv1 "volcano.sh/apis/pkg/apis/bus/v1" busv1alpha1 "volcano.sh/apis/pkg/apis/bus/v1alpha1" flowv1alpha1 "volcano.sh/apis/pkg/apis/flow/v1alpha1" nodeinfov1alpha1 "volcano.sh/apis/pkg/apis/nodeinfo/v1alpha1" + schedulingv1 "volcano.sh/apis/pkg/apis/scheduling/v1" v1beta1 "volcano.sh/apis/pkg/apis/scheduling/v1beta1" ) @@ -55,10 +58,18 @@ func (f *genericInformer) Lister() cache.GenericLister { // TODO extend this to unknown resources with a client pool func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { - // Group=batch.volcano.sh, Version=v1alpha1 + // Group=batch.volcano.sh, Version=v1 + case v1.SchemeGroupVersion.WithResource("jobs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Batch().V1().Jobs().Informer()}, nil + + // Group=batch.volcano.sh, Version=v1alpha1 case v1alpha1.SchemeGroupVersion.WithResource("jobs"): return &genericInformer{resource: resource.GroupResource(), informer: f.Batch().V1alpha1().Jobs().Informer()}, nil + // Group=bus.volcano.sh, Version=v1 + case busv1.SchemeGroupVersion.WithResource("commands"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Bus().V1().Commands().Informer()}, nil + // Group=bus.volcano.sh, Version=v1alpha1 case busv1alpha1.SchemeGroupVersion.WithResource("commands"): return &genericInformer{resource: resource.GroupResource(), informer: f.Bus().V1alpha1().Commands().Informer()}, nil @@ -73,6 +84,12 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case nodeinfov1alpha1.SchemeGroupVersion.WithResource("numatopologies"): return &genericInformer{resource: resource.GroupResource(), informer: f.Nodeinfo().V1alpha1().Numatopologies().Informer()}, nil + // Group=scheduling.volcano.sh, Version=v1 + case schedulingv1.SchemeGroupVersion.WithResource("podgroups"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1().PodGroups().Informer()}, nil + case schedulingv1.SchemeGroupVersion.WithResource("queues"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1().Queues().Informer()}, nil + // Group=scheduling.volcano.sh, Version=v1beta1 case v1beta1.SchemeGroupVersion.WithResource("podgroups"): return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1beta1().PodGroups().Informer()}, nil diff --git a/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go index be2b269e..6032693a 100644 --- a/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go +++ b/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/nodeinfo/interface.go b/pkg/client/informers/externalversions/nodeinfo/interface.go index 406d56c6..665dd3ab 100644 --- a/pkg/client/informers/externalversions/nodeinfo/interface.go +++ b/pkg/client/informers/externalversions/nodeinfo/interface.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/nodeinfo/v1alpha1/interface.go b/pkg/client/informers/externalversions/nodeinfo/v1alpha1/interface.go index c8b3df28..3d0511b4 100644 --- a/pkg/client/informers/externalversions/nodeinfo/v1alpha1/interface.go +++ b/pkg/client/informers/externalversions/nodeinfo/v1alpha1/interface.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/nodeinfo/v1alpha1/numatopology.go b/pkg/client/informers/externalversions/nodeinfo/v1alpha1/numatopology.go index 08cc5983..6586c256 100644 --- a/pkg/client/informers/externalversions/nodeinfo/v1alpha1/numatopology.go +++ b/pkg/client/informers/externalversions/nodeinfo/v1alpha1/numatopology.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/scheduling/interface.go b/pkg/client/informers/externalversions/scheduling/interface.go index a63d1185..68782282 100644 --- a/pkg/client/informers/externalversions/scheduling/interface.go +++ b/pkg/client/informers/externalversions/scheduling/interface.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ package scheduling import ( internalinterfaces "volcano.sh/apis/pkg/client/informers/externalversions/internalinterfaces" + v1 "volcano.sh/apis/pkg/client/informers/externalversions/scheduling/v1" v1beta1 "volcano.sh/apis/pkg/client/informers/externalversions/scheduling/v1beta1" ) @@ -26,6 +27,8 @@ import ( type Interface interface { // V1beta1 provides access to shared informers for resources in V1beta1. V1beta1() v1beta1.Interface + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface } type group struct { @@ -43,3 +46,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList func (g *group) V1beta1() v1beta1.Interface { return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) } + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/scheduling/v1/interface.go b/pkg/client/informers/externalversions/scheduling/v1/interface.go new file mode 100644 index 00000000..0efe130e --- /dev/null +++ b/pkg/client/informers/externalversions/scheduling/v1/interface.go @@ -0,0 +1,51 @@ +/* +Copyright 2022 The Volcano 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "volcano.sh/apis/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // PodGroups returns a PodGroupInformer. + PodGroups() PodGroupInformer + // Queues returns a QueueInformer. + Queues() QueueInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// PodGroups returns a PodGroupInformer. +func (v *version) PodGroups() PodGroupInformer { + return &podGroupInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Queues returns a QueueInformer. +func (v *version) Queues() QueueInformer { + return &queueInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/client/informers/externalversions/scheduling/v1/podgroup.go b/pkg/client/informers/externalversions/scheduling/v1/podgroup.go new file mode 100644 index 00000000..1ab8bca1 --- /dev/null +++ b/pkg/client/informers/externalversions/scheduling/v1/podgroup.go @@ -0,0 +1,89 @@ +/* +Copyright 2022 The Volcano 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + schedulingv1 "volcano.sh/apis/pkg/apis/scheduling/v1" + versioned "volcano.sh/apis/pkg/client/clientset/versioned" + internalinterfaces "volcano.sh/apis/pkg/client/informers/externalversions/internalinterfaces" + v1 "volcano.sh/apis/pkg/client/listers/scheduling/v1" +) + +// PodGroupInformer provides access to a shared informer and lister for +// PodGroups. +type PodGroupInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.PodGroupLister +} + +type podGroupInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPodGroupInformer constructs a new informer for PodGroup type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodGroupInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPodGroupInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPodGroupInformer constructs a new informer for PodGroup type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPodGroupInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1().PodGroups(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1().PodGroups(namespace).Watch(context.TODO(), options) + }, + }, + &schedulingv1.PodGroup{}, + resyncPeriod, + indexers, + ) +} + +func (f *podGroupInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPodGroupInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *podGroupInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&schedulingv1.PodGroup{}, f.defaultInformer) +} + +func (f *podGroupInformer) Lister() v1.PodGroupLister { + return v1.NewPodGroupLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/scheduling/v1/queue.go b/pkg/client/informers/externalversions/scheduling/v1/queue.go new file mode 100644 index 00000000..59ea8efe --- /dev/null +++ b/pkg/client/informers/externalversions/scheduling/v1/queue.go @@ -0,0 +1,88 @@ +/* +Copyright 2022 The Volcano 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + schedulingv1 "volcano.sh/apis/pkg/apis/scheduling/v1" + versioned "volcano.sh/apis/pkg/client/clientset/versioned" + internalinterfaces "volcano.sh/apis/pkg/client/informers/externalversions/internalinterfaces" + v1 "volcano.sh/apis/pkg/client/listers/scheduling/v1" +) + +// QueueInformer provides access to a shared informer and lister for +// Queues. +type QueueInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.QueueLister +} + +type queueInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewQueueInformer constructs a new informer for Queue type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewQueueInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredQueueInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredQueueInformer constructs a new informer for Queue type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredQueueInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1().Queues().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1().Queues().Watch(context.TODO(), options) + }, + }, + &schedulingv1.Queue{}, + resyncPeriod, + indexers, + ) +} + +func (f *queueInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredQueueInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *queueInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&schedulingv1.Queue{}, f.defaultInformer) +} + +func (f *queueInformer) Lister() v1.QueueLister { + return v1.NewQueueLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/scheduling/v1beta1/interface.go b/pkg/client/informers/externalversions/scheduling/v1beta1/interface.go index b42dea4e..3a335c1d 100644 --- a/pkg/client/informers/externalversions/scheduling/v1beta1/interface.go +++ b/pkg/client/informers/externalversions/scheduling/v1beta1/interface.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/scheduling/v1beta1/podgroup.go b/pkg/client/informers/externalversions/scheduling/v1beta1/podgroup.go index 242ecf63..e4066bdc 100644 --- a/pkg/client/informers/externalversions/scheduling/v1beta1/podgroup.go +++ b/pkg/client/informers/externalversions/scheduling/v1beta1/podgroup.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/scheduling/v1beta1/queue.go b/pkg/client/informers/externalversions/scheduling/v1beta1/queue.go index 99b92ebd..0a5fcea1 100644 --- a/pkg/client/informers/externalversions/scheduling/v1beta1/queue.go +++ b/pkg/client/informers/externalversions/scheduling/v1beta1/queue.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/listers/batch/v1/expansion_generated.go b/pkg/client/listers/batch/v1/expansion_generated.go new file mode 100644 index 00000000..cea028e9 --- /dev/null +++ b/pkg/client/listers/batch/v1/expansion_generated.go @@ -0,0 +1,26 @@ +/* +Copyright 2022 The Volcano 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 lister-gen. DO NOT EDIT. + +package v1 + +// JobListerExpansion allows custom methods to be added to +// JobLister. +type JobListerExpansion interface{} + +// JobNamespaceListerExpansion allows custom methods to be added to +// JobNamespaceLister. +type JobNamespaceListerExpansion interface{} diff --git a/pkg/client/listers/batch/v1/job.go b/pkg/client/listers/batch/v1/job.go new file mode 100644 index 00000000..5b2780f5 --- /dev/null +++ b/pkg/client/listers/batch/v1/job.go @@ -0,0 +1,98 @@ +/* +Copyright 2022 The Volcano 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1 "volcano.sh/apis/pkg/apis/batch/v1" +) + +// JobLister helps list Jobs. +// All objects returned here must be treated as read-only. +type JobLister interface { + // List lists all Jobs in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Job, err error) + // Jobs returns an object that can list and get Jobs. + Jobs(namespace string) JobNamespaceLister + JobListerExpansion +} + +// jobLister implements the JobLister interface. +type jobLister struct { + indexer cache.Indexer +} + +// NewJobLister returns a new JobLister. +func NewJobLister(indexer cache.Indexer) JobLister { + return &jobLister{indexer: indexer} +} + +// List lists all Jobs in the indexer. +func (s *jobLister) List(selector labels.Selector) (ret []*v1.Job, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Job)) + }) + return ret, err +} + +// Jobs returns an object that can list and get Jobs. +func (s *jobLister) Jobs(namespace string) JobNamespaceLister { + return jobNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// JobNamespaceLister helps list and get Jobs. +// All objects returned here must be treated as read-only. +type JobNamespaceLister interface { + // List lists all Jobs in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Job, err error) + // Get retrieves the Job from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Job, error) + JobNamespaceListerExpansion +} + +// jobNamespaceLister implements the JobNamespaceLister +// interface. +type jobNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Jobs in the indexer for a given namespace. +func (s jobNamespaceLister) List(selector labels.Selector) (ret []*v1.Job, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Job)) + }) + return ret, err +} + +// Get retrieves the Job from the indexer for a given namespace and name. +func (s jobNamespaceLister) Get(name string) (*v1.Job, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("job"), name) + } + return obj.(*v1.Job), nil +} diff --git a/pkg/client/listers/batch/v1alpha1/expansion_generated.go b/pkg/client/listers/batch/v1alpha1/expansion_generated.go index d8b768b0..d26cc480 100644 --- a/pkg/client/listers/batch/v1alpha1/expansion_generated.go +++ b/pkg/client/listers/batch/v1alpha1/expansion_generated.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/listers/batch/v1alpha1/job.go b/pkg/client/listers/batch/v1alpha1/job.go index bb63d77d..428898a8 100644 --- a/pkg/client/listers/batch/v1alpha1/job.go +++ b/pkg/client/listers/batch/v1alpha1/job.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/listers/bus/v1/command.go b/pkg/client/listers/bus/v1/command.go new file mode 100644 index 00000000..56cc286f --- /dev/null +++ b/pkg/client/listers/bus/v1/command.go @@ -0,0 +1,98 @@ +/* +Copyright 2022 The Volcano 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1 "volcano.sh/apis/pkg/apis/bus/v1" +) + +// CommandLister helps list Commands. +// All objects returned here must be treated as read-only. +type CommandLister interface { + // List lists all Commands in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Command, err error) + // Commands returns an object that can list and get Commands. + Commands(namespace string) CommandNamespaceLister + CommandListerExpansion +} + +// commandLister implements the CommandLister interface. +type commandLister struct { + indexer cache.Indexer +} + +// NewCommandLister returns a new CommandLister. +func NewCommandLister(indexer cache.Indexer) CommandLister { + return &commandLister{indexer: indexer} +} + +// List lists all Commands in the indexer. +func (s *commandLister) List(selector labels.Selector) (ret []*v1.Command, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Command)) + }) + return ret, err +} + +// Commands returns an object that can list and get Commands. +func (s *commandLister) Commands(namespace string) CommandNamespaceLister { + return commandNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// CommandNamespaceLister helps list and get Commands. +// All objects returned here must be treated as read-only. +type CommandNamespaceLister interface { + // List lists all Commands in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Command, err error) + // Get retrieves the Command from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Command, error) + CommandNamespaceListerExpansion +} + +// commandNamespaceLister implements the CommandNamespaceLister +// interface. +type commandNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Commands in the indexer for a given namespace. +func (s commandNamespaceLister) List(selector labels.Selector) (ret []*v1.Command, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Command)) + }) + return ret, err +} + +// Get retrieves the Command from the indexer for a given namespace and name. +func (s commandNamespaceLister) Get(name string) (*v1.Command, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("command"), name) + } + return obj.(*v1.Command), nil +} diff --git a/pkg/client/listers/bus/v1/expansion_generated.go b/pkg/client/listers/bus/v1/expansion_generated.go new file mode 100644 index 00000000..ed725f1a --- /dev/null +++ b/pkg/client/listers/bus/v1/expansion_generated.go @@ -0,0 +1,26 @@ +/* +Copyright 2022 The Volcano 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 lister-gen. DO NOT EDIT. + +package v1 + +// CommandListerExpansion allows custom methods to be added to +// CommandLister. +type CommandListerExpansion interface{} + +// CommandNamespaceListerExpansion allows custom methods to be added to +// CommandNamespaceLister. +type CommandNamespaceListerExpansion interface{} diff --git a/pkg/client/listers/bus/v1alpha1/command.go b/pkg/client/listers/bus/v1alpha1/command.go index a68564de..ebc9e14c 100644 --- a/pkg/client/listers/bus/v1alpha1/command.go +++ b/pkg/client/listers/bus/v1alpha1/command.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/listers/bus/v1alpha1/expansion_generated.go b/pkg/client/listers/bus/v1alpha1/expansion_generated.go index bca31109..51a2b49a 100644 --- a/pkg/client/listers/bus/v1alpha1/expansion_generated.go +++ b/pkg/client/listers/bus/v1alpha1/expansion_generated.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/listers/flow/v1alpha1/expansion_generated.go b/pkg/client/listers/flow/v1alpha1/expansion_generated.go index 12bb7ec5..5ba842f6 100644 --- a/pkg/client/listers/flow/v1alpha1/expansion_generated.go +++ b/pkg/client/listers/flow/v1alpha1/expansion_generated.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/listers/flow/v1alpha1/jobflow.go b/pkg/client/listers/flow/v1alpha1/jobflow.go index 02976353..9d6cd3ac 100644 --- a/pkg/client/listers/flow/v1alpha1/jobflow.go +++ b/pkg/client/listers/flow/v1alpha1/jobflow.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/listers/flow/v1alpha1/jobtemplate.go b/pkg/client/listers/flow/v1alpha1/jobtemplate.go index 96947956..af3c6881 100644 --- a/pkg/client/listers/flow/v1alpha1/jobtemplate.go +++ b/pkg/client/listers/flow/v1alpha1/jobtemplate.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/listers/nodeinfo/v1alpha1/expansion_generated.go b/pkg/client/listers/nodeinfo/v1alpha1/expansion_generated.go index 8884c336..24684591 100644 --- a/pkg/client/listers/nodeinfo/v1alpha1/expansion_generated.go +++ b/pkg/client/listers/nodeinfo/v1alpha1/expansion_generated.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/listers/nodeinfo/v1alpha1/numatopology.go b/pkg/client/listers/nodeinfo/v1alpha1/numatopology.go index f11e09bc..edadea85 100644 --- a/pkg/client/listers/nodeinfo/v1alpha1/numatopology.go +++ b/pkg/client/listers/nodeinfo/v1alpha1/numatopology.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/listers/scheduling/v1/expansion_generated.go b/pkg/client/listers/scheduling/v1/expansion_generated.go new file mode 100644 index 00000000..59d8dc45 --- /dev/null +++ b/pkg/client/listers/scheduling/v1/expansion_generated.go @@ -0,0 +1,30 @@ +/* +Copyright 2022 The Volcano 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 lister-gen. DO NOT EDIT. + +package v1 + +// PodGroupListerExpansion allows custom methods to be added to +// PodGroupLister. +type PodGroupListerExpansion interface{} + +// PodGroupNamespaceListerExpansion allows custom methods to be added to +// PodGroupNamespaceLister. +type PodGroupNamespaceListerExpansion interface{} + +// QueueListerExpansion allows custom methods to be added to +// QueueLister. +type QueueListerExpansion interface{} diff --git a/pkg/client/listers/scheduling/v1/podgroup.go b/pkg/client/listers/scheduling/v1/podgroup.go new file mode 100644 index 00000000..0882ed5b --- /dev/null +++ b/pkg/client/listers/scheduling/v1/podgroup.go @@ -0,0 +1,98 @@ +/* +Copyright 2022 The Volcano 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1 "volcano.sh/apis/pkg/apis/scheduling/v1" +) + +// PodGroupLister helps list PodGroups. +// All objects returned here must be treated as read-only. +type PodGroupLister interface { + // List lists all PodGroups in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.PodGroup, err error) + // PodGroups returns an object that can list and get PodGroups. + PodGroups(namespace string) PodGroupNamespaceLister + PodGroupListerExpansion +} + +// podGroupLister implements the PodGroupLister interface. +type podGroupLister struct { + indexer cache.Indexer +} + +// NewPodGroupLister returns a new PodGroupLister. +func NewPodGroupLister(indexer cache.Indexer) PodGroupLister { + return &podGroupLister{indexer: indexer} +} + +// List lists all PodGroups in the indexer. +func (s *podGroupLister) List(selector labels.Selector) (ret []*v1.PodGroup, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PodGroup)) + }) + return ret, err +} + +// PodGroups returns an object that can list and get PodGroups. +func (s *podGroupLister) PodGroups(namespace string) PodGroupNamespaceLister { + return podGroupNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// PodGroupNamespaceLister helps list and get PodGroups. +// All objects returned here must be treated as read-only. +type PodGroupNamespaceLister interface { + // List lists all PodGroups in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.PodGroup, err error) + // Get retrieves the PodGroup from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.PodGroup, error) + PodGroupNamespaceListerExpansion +} + +// podGroupNamespaceLister implements the PodGroupNamespaceLister +// interface. +type podGroupNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all PodGroups in the indexer for a given namespace. +func (s podGroupNamespaceLister) List(selector labels.Selector) (ret []*v1.PodGroup, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PodGroup)) + }) + return ret, err +} + +// Get retrieves the PodGroup from the indexer for a given namespace and name. +func (s podGroupNamespaceLister) Get(name string) (*v1.PodGroup, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("podgroup"), name) + } + return obj.(*v1.PodGroup), nil +} diff --git a/pkg/client/listers/scheduling/v1/queue.go b/pkg/client/listers/scheduling/v1/queue.go new file mode 100644 index 00000000..af498e8e --- /dev/null +++ b/pkg/client/listers/scheduling/v1/queue.go @@ -0,0 +1,67 @@ +/* +Copyright 2022 The Volcano 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1 "volcano.sh/apis/pkg/apis/scheduling/v1" +) + +// QueueLister helps list Queues. +// All objects returned here must be treated as read-only. +type QueueLister interface { + // List lists all Queues in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Queue, err error) + // Get retrieves the Queue from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Queue, error) + QueueListerExpansion +} + +// queueLister implements the QueueLister interface. +type queueLister struct { + indexer cache.Indexer +} + +// NewQueueLister returns a new QueueLister. +func NewQueueLister(indexer cache.Indexer) QueueLister { + return &queueLister{indexer: indexer} +} + +// List lists all Queues in the indexer. +func (s *queueLister) List(selector labels.Selector) (ret []*v1.Queue, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Queue)) + }) + return ret, err +} + +// Get retrieves the Queue from the index for a given name. +func (s *queueLister) Get(name string) (*v1.Queue, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("queue"), name) + } + return obj.(*v1.Queue), nil +} diff --git a/pkg/client/listers/scheduling/v1beta1/expansion_generated.go b/pkg/client/listers/scheduling/v1beta1/expansion_generated.go index 9894d480..4dea4e81 100644 --- a/pkg/client/listers/scheduling/v1beta1/expansion_generated.go +++ b/pkg/client/listers/scheduling/v1beta1/expansion_generated.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/listers/scheduling/v1beta1/podgroup.go b/pkg/client/listers/scheduling/v1beta1/podgroup.go index d893dec8..b177a6f9 100644 --- a/pkg/client/listers/scheduling/v1beta1/podgroup.go +++ b/pkg/client/listers/scheduling/v1beta1/podgroup.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/client/listers/scheduling/v1beta1/queue.go b/pkg/client/listers/scheduling/v1beta1/queue.go index e72765ad..d0764869 100644 --- a/pkg/client/listers/scheduling/v1beta1/queue.go +++ b/pkg/client/listers/scheduling/v1beta1/queue.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Volcano Authors. +Copyright 2022 The Volcano Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.