From 53374c46caaf3fea36653c65e5bf5670825f0ed5 Mon Sep 17 00:00:00 2001 From: Pascal Vicaire <25757005+vicaire@users.noreply.github.com> Date: Wed, 23 May 2018 18:11:34 -0700 Subject: [PATCH 1/2] CRD for scheduling Argo workflows We named this CRD a "schedule": It schedules workflows for now but we will add support for other K8 resources (e.g., jobs). It supports: - executing pipelines using a cron schedule - executing pipelines using a periodic interval - An optional start date and an end date. - Backfilling (by specifying a start date in the past). - A maximum number of concurrent workflows. --- .gitignore | 8 + hack/custom-boilerplate.go.txt | 13 + hack/update-codegen.sh | 32 ++ hack/verify-codegen.sh | 51 +++ pkg/apis/schedule/register.go | 23 ++ pkg/apis/schedule/v1alpha1/doc.go | 19 + pkg/apis/schedule/v1alpha1/register.go | 51 +++ pkg/apis/schedule/v1alpha1/types.go | 234 +++++++++++ .../v1alpha1/zz_generated.deepcopy.go | 382 ++++++++++++++++++ pkg/client/clientset/versioned/clientset.go | 96 +++++ pkg/client/clientset/versioned/doc.go | 18 + .../versioned/fake/clientset_generated.go | 80 ++++ pkg/client/clientset/versioned/fake/doc.go | 18 + .../clientset/versioned/fake/register.go | 52 +++ pkg/client/clientset/versioned/scheme/doc.go | 18 + .../clientset/versioned/scheme/register.go | 52 +++ .../versioned/typed/schedule/v1alpha1/doc.go | 18 + .../typed/schedule/v1alpha1/fake/doc.go | 18 + .../schedule/v1alpha1/fake/fake_schedule.go | 126 ++++++ .../v1alpha1/fake/fake_schedule_client.go | 38 ++ .../schedule/v1alpha1/generated_expansion.go | 19 + .../typed/schedule/v1alpha1/schedule.go | 155 +++++++ .../schedule/v1alpha1/schedule_client.go | 88 ++++ .../informers/externalversions/factory.go | 178 ++++++++ .../informers/externalversions/generic.go | 60 +++ .../internalinterfaces/factory_interfaces.go | 36 ++ .../externalversions/schedule/interface.go | 44 ++ .../schedule/v1alpha1/interface.go | 43 ++ .../schedule/v1alpha1/schedule.go | 87 ++++ .../schedule/v1alpha1/expansion_generated.go | 25 ++ .../listers/schedule/v1alpha1/schedule.go | 92 +++++ pkg/signals/signal.go | 41 ++ pkg/signals/signal_posix.go | 22 + 33 files changed, 2237 insertions(+) create mode 100644 .gitignore create mode 100644 hack/custom-boilerplate.go.txt create mode 100755 hack/update-codegen.sh create mode 100755 hack/verify-codegen.sh create mode 100644 pkg/apis/schedule/register.go create mode 100644 pkg/apis/schedule/v1alpha1/doc.go create mode 100644 pkg/apis/schedule/v1alpha1/register.go create mode 100644 pkg/apis/schedule/v1alpha1/types.go create mode 100644 pkg/apis/schedule/v1alpha1/zz_generated.deepcopy.go create mode 100644 pkg/client/clientset/versioned/clientset.go create mode 100644 pkg/client/clientset/versioned/doc.go create mode 100644 pkg/client/clientset/versioned/fake/clientset_generated.go create mode 100644 pkg/client/clientset/versioned/fake/doc.go create mode 100644 pkg/client/clientset/versioned/fake/register.go create mode 100644 pkg/client/clientset/versioned/scheme/doc.go create mode 100644 pkg/client/clientset/versioned/scheme/register.go create mode 100644 pkg/client/clientset/versioned/typed/schedule/v1alpha1/doc.go create mode 100644 pkg/client/clientset/versioned/typed/schedule/v1alpha1/fake/doc.go create mode 100644 pkg/client/clientset/versioned/typed/schedule/v1alpha1/fake/fake_schedule.go create mode 100644 pkg/client/clientset/versioned/typed/schedule/v1alpha1/fake/fake_schedule_client.go create mode 100644 pkg/client/clientset/versioned/typed/schedule/v1alpha1/generated_expansion.go create mode 100644 pkg/client/clientset/versioned/typed/schedule/v1alpha1/schedule.go create mode 100644 pkg/client/clientset/versioned/typed/schedule/v1alpha1/schedule_client.go create mode 100644 pkg/client/informers/externalversions/factory.go create mode 100644 pkg/client/informers/externalversions/generic.go create mode 100644 pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go create mode 100644 pkg/client/informers/externalversions/schedule/interface.go create mode 100644 pkg/client/informers/externalversions/schedule/v1alpha1/interface.go create mode 100644 pkg/client/informers/externalversions/schedule/v1alpha1/schedule.go create mode 100644 pkg/client/listers/schedule/v1alpha1/expansion_generated.go create mode 100644 pkg/client/listers/schedule/v1alpha1/schedule.go create mode 100644 pkg/signals/signal.go create mode 100644 pkg/signals/signal_posix.go diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000000..43b312e38a6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +# IDE +.idea/ + +# Vendor +vendor/ + +# Merge files +*.orig diff --git a/hack/custom-boilerplate.go.txt b/hack/custom-boilerplate.go.txt new file mode 100644 index 00000000000..adcfb4f1395 --- /dev/null +++ b/hack/custom-boilerplate.go.txt @@ -0,0 +1,13 @@ +// Copyright YEAR The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh new file mode 100755 index 00000000000..86987b95ead --- /dev/null +++ b/hack/update-codegen.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# Copyright 2017 The Kubernetes 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. + +# This shell is used to auto generate some useful tools for k8s, such as lister, +# informer, deepcopy, defaulter and so on. + +set -o errexit +set -o nounset +set -o pipefail + +SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/.. +echo "SCRIPT_ROOT is $SCRIPT_ROOT" +CODEGEN_PKG=${SCRIPT_ROOT}/../../../k8s.io/code-generator +echo "CODEGEN_PKG is $CODEGEN_PKG" + +${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \ + github.com/kubeflow/pipelines/pkg/client github.com/kubeflow/pipelines/pkg/apis \ + schedule:v1alpha1 \ + --go-header-file ${SCRIPT_ROOT}/hack/custom-boilerplate.go.txt diff --git a/hack/verify-codegen.sh b/hack/verify-codegen.sh new file mode 100755 index 00000000000..5048d36c22a --- /dev/null +++ b/hack/verify-codegen.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +# Copyright 2017 The Kubernetes 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. + +# This shell is used to auto generate some useful tools for k8s, such as lister, +# informer, deepcopy, defaulter and so on. + +set -o errexit +set -o nounset +set -o pipefail + +SCRIPT_ROOT=$(dirname "${BASH_SOURCE}")/.. + +DIFFROOT="${SCRIPT_ROOT}/pkg" +TMP_DIFFROOT="${SCRIPT_ROOT}/_tmp/pkg" +_tmp="${SCRIPT_ROOT}/_tmp" + +cleanup() { + rm -rf "${_tmp}" +} +trap "cleanup" EXIT SIGINT + +cleanup + +mkdir -p "${TMP_DIFFROOT}" +cp -a "${DIFFROOT}"/* "${TMP_DIFFROOT}" + +"${SCRIPT_ROOT}/hack/update-codegen.sh" +echo "diffing ${DIFFROOT} against freshly generated codegen" +ret=0 +diff -Naupr "${DIFFROOT}" "${TMP_DIFFROOT}" || ret=$? +cp -a "${TMP_DIFFROOT}"/* "${DIFFROOT}" +if [[ $ret -eq 0 ]] +then + echo "${DIFFROOT} up to date." +else + echo "${DIFFROOT} is out of date. Please run hack/update-codegen.sh" + exit 1 +fi diff --git a/pkg/apis/schedule/register.go b/pkg/apis/schedule/register.go new file mode 100644 index 00000000000..69237094de4 --- /dev/null +++ b/pkg/apis/schedule/register.go @@ -0,0 +1,23 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package schedule + +const ( + Kind string = "Schedule" + GroupName string = "kubeflow.org" + Singular string = "schedule" + Plural string = "schedules" + FullName string = Plural + "." + GroupName +) diff --git a/pkg/apis/schedule/v1alpha1/doc.go b/pkg/apis/schedule/v1alpha1/doc.go new file mode 100644 index 00000000000..9421eb43884 --- /dev/null +++ b/pkg/apis/schedule/v1alpha1/doc.go @@ -0,0 +1,19 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +k8s:deepcopy-gen=package + +// Package v1alpha1 is the v1alpha1 version of the API. +// +groupName=schedule.kubeflow.org +package v1alpha1 diff --git a/pkg/apis/schedule/v1alpha1/register.go b/pkg/apis/schedule/v1alpha1/register.go new file mode 100644 index 00000000000..b1143acc03d --- /dev/null +++ b/pkg/apis/schedule/v1alpha1/register.go @@ -0,0 +1,51 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + + schedulecontroller "ml/pkg/apis/schedule" +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: schedulecontroller.GroupName, Version: "v1alpha1"} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme +) + +// Adds the list of known types to Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Schedule{}, + &ScheduleList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/pkg/apis/schedule/v1alpha1/types.go b/pkg/apis/schedule/v1alpha1/types.go new file mode 100644 index 00000000000..9180e1b258d --- /dev/null +++ b/pkg/apis/schedule/v1alpha1/types.go @@ -0,0 +1,234 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" + "k8s.io/apimachinery/pkg/types" +) + +// SchedulePhase summarizes the state of the schedule. +type SchedulePhase string + +// Schedule phases +const ( + ScheduleEnabled SchedulePhase = "Enabled" + ScheduleDisabled SchedulePhase = "Disabled" + ScheduleRunning SchedulePhase = "Running" + ScheduleSucceeded SchedulePhase = "Succeeded" + ScheduleError SchedulePhase = "Error" +) + +// +genclient +// +genclient:noStatus +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Schedule is a specification for a Schedule resource +type Schedule struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ScheduleSpec `json:"spec"` + Status ScheduleStatus `json:"status"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ScheduleList is a list of Schedule resources +type ScheduleList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []Schedule `json:"items"` +} + +// ScheduleSpec is the spec for a Schedule resource +type ScheduleSpec struct { + + // A human readable description of the schedule. + Description string `json:"description,omitempty"` + + // If the schedule is disabled, it does not create any new workflow. + Enabled bool `json:"enabled,omitempty"` + + // Max number of created workflows that can coexist. + // If MaxConcurrency is not specified, maxConcurrency is 1. + // MaxConcurrency cannot be smaller than 1. + // MaxConcurrency cannot be larger than 10. + // +optional + MaxConcurrency *int64 `json:"maxConcurrency,omitempty"` + + // Max number of completed workflows to keep track of. + // If MaxHistory is not specified, MaxHistory is 10. + // MaxHistory cannot be smaller than 0. + // MaxHistory cannot be larger than 100. + // +optional + MaxHistory *int64 `json:"maxHistory,omitempty"` + + // Trigger describes when to create a new workflow. + Trigger `json:"trigger,omitempty"` + + // Specification of the workflow to schedule. + // +optional + Workflow *WorkflowResource `json:"workflow, omitempty"` + + // TODO: support additional resource types: K8 jobs, etc. + +} + +type WorkflowResource struct { + // List of parameters to substitute in the workflow template. + // The parameter values may include special strings that the controller will substitute: + // [[ScheduledTime]] is substituted by the scheduled time of the workflow (default format) + // [[CurrentTime]] is substituted by the current time (default format) + // [[Index]] is substituted by the index of the workflow (e.g. 3 mins that it was the 3rd workflow created) + // [[ScheduledTime.15-04-05]] is substituted by the sheduled time (custom format specified as a Go time format: https://golang.org/pkg/time/#Parse) + // [[CurrentTime.15-04-05]] is substituted by the current time (custom format specified as a Go time format: https://golang.org/pkg/time/#Parse) + + Parameters []Parameter `json:"parameters,omitempty"` + + // Specification of the workflow to start. + Spec v1alpha1.WorkflowSpec `json:"spec,omitempty"` +} + +type Parameter struct { + // Name of the parameter. + Name string `json:"name,omitempty"` + + // Value of the parameter. + Value string `json:"value,omitempty"` +} + +// Trigger specifies when to create a new workflow. +type Trigger struct { + // If all the following fields are nil, the schedule create a single workflow + // immediately. + + // Create workflows according to a cron schedule. + CronSchedule *CronSchedule `json:"cronSchedule,omitempty"` + + // Create workflows periodically. + PeriodicSchedule *PeriodicSchedule `json:"periodicSchedule,omitempty"` +} + +type CronSchedule struct { + // Time at which scheduling starts. + // If no start time is specified, the StartTime is the creation time of the schedule. + // +optional + StartTime *metav1.Time `json:"startTime,omitempty"` + + // Time at which scheduling ends. + // If not end time is specified, the EndTime is the end of time. + // +optional + EndTime *metav1.Time `json:"endTime,omitempty"` + + // Cron string describing when a workflow should be created within the + // time interval defined by StartTime and EndTime. + // +optional + Cron string `json:"cron,omitempty"` +} + +type PeriodicSchedule struct { + // Time at which scheduling starts. + // If no start time is specified, the StartTime is the creation time of the schedule. + // +optional + StartTime *metav1.Time `json:"startTime,omitempty"` + + // Time at which scheduling ends. + // If not end time is specified, the EndTime is the end of time. + // +optional + EndTime *metav1.Time `json:"endTime,omitempty"` + + // Cron string describing when a workflow should be created within the + // time interval defined by StartTime and EndTime. + // +optional + IntervalSecond int64 `json:"intervalSecond,omitempty"` +} + +// ScheduleStatus is the status for a Schedule resource. +type ScheduleStatus struct { + // Time at which this schedule was last updated. + UpdatedAt metav1.Time `json:"updatedAt,omitempty"` + + // Status is a simple, high-level summary of the state of the schedule. + Status SchedulePhase `json:"status,omitempty"` + + // Message provides additional information about the state of the schedule (if needed). + Message string `json:"message,omitempty"` + + // TriggerStatus provides status info depending on the type of triggering. + Trigger TriggerStatus `json:"trigger,omitempty"` + + // Status of workflow resources. + WorkflowHistory *WorkflowHistory `json:"workflowHistory,omitempty"` +} + +type TriggerStatus struct { + // Time of the last creation of a workflow. + LastTriggeredTime *metav1.Time `json:lastTriggeredTime,omitempty` + + // Time of the next creation of a workflow (assuming that the schedule is enabled). + NextTriggeredTime *metav1.Time `json:nextTriggeredTime,omitempty` + + // Index of the last workflow created. + LastIndex *int64 `json:lastWorkflowIndex,omitempty` + +} + +type WorkflowHistory struct { + // The list of active workflows started by this schedule. + Active []WorkflowStatus `json:"active,omitempty"` + + // The list of completed workflows started by this schedule. + Completed []WorkflowStatus `json:"completed,omitempty"` +} + +type WorkflowStatus struct { + // The name of the workflow. + Name string `json:"name,omitempty"` + + // The namespace of the workflow. + Namespace string `json:"namespace,omitempty"` + + // URL representing this object. + SelfLink string `json:"selfLink,omitempty"` + + // UID is the unique identifier in time and space for the workflow. + UID types.UID `json:"uid,omitempty"` + + // Phase is a high level summary of the status of the workflow. + Phase v1alpha1.NodePhase `json:phase,omitempty` + + // A human readable message indicating details about why the workflow is in + // this condition. + Message string `json:"message,omitempty"` + + // Time at which this workflow was created. + CreatedAt metav1.Time `json:"createdAt,omitempty"` + + // Time at which this workflow started. + StartedAt metav1.Time `json:"startedAt,omitempty"` + + // Time at which this workflow completed + FinishedAt metav1.Time `json:"finishedAt,omitempty"` + + // Time at which the workflow was triggered. + ScheduledAt metav1.Time `json:"scheduledAt,omitempty"` + + // The index of the workflow. For instance, if this workflow is the second one + // to execute as part of this schedule, the index is 1. + Index int64 `json:"index,omitempty"` +} \ No newline at end of file diff --git a/pkg/apis/schedule/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/schedule/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 00000000000..ca78f7ee358 --- /dev/null +++ b/pkg/apis/schedule/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,382 @@ +// +build !ignore_autogenerated + +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + 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 *CronSchedule) DeepCopyInto(out *CronSchedule) { + *out = *in + if in.StartTime != nil { + in, out := &in.StartTime, &out.StartTime + if *in == nil { + *out = nil + } else { + *out = (*in).DeepCopy() + } + } + if in.EndTime != nil { + in, out := &in.EndTime, &out.EndTime + if *in == nil { + *out = nil + } else { + *out = (*in).DeepCopy() + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CronSchedule. +func (in *CronSchedule) DeepCopy() *CronSchedule { + if in == nil { + return nil + } + out := new(CronSchedule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Parameter) DeepCopyInto(out *Parameter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Parameter. +func (in *Parameter) DeepCopy() *Parameter { + if in == nil { + return nil + } + out := new(Parameter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PeriodicSchedule) DeepCopyInto(out *PeriodicSchedule) { + *out = *in + if in.StartTime != nil { + in, out := &in.StartTime, &out.StartTime + if *in == nil { + *out = nil + } else { + *out = (*in).DeepCopy() + } + } + if in.EndTime != nil { + in, out := &in.EndTime, &out.EndTime + if *in == nil { + *out = nil + } else { + *out = (*in).DeepCopy() + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PeriodicSchedule. +func (in *PeriodicSchedule) DeepCopy() *PeriodicSchedule { + if in == nil { + return nil + } + out := new(PeriodicSchedule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Schedule) DeepCopyInto(out *Schedule) { + *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 Schedule. +func (in *Schedule) DeepCopy() *Schedule { + if in == nil { + return nil + } + out := new(Schedule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Schedule) 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 *ScheduleList) DeepCopyInto(out *ScheduleList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Schedule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduleList. +func (in *ScheduleList) DeepCopy() *ScheduleList { + if in == nil { + return nil + } + out := new(ScheduleList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ScheduleList) 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 *ScheduleSpec) DeepCopyInto(out *ScheduleSpec) { + *out = *in + if in.MaxConcurrency != nil { + in, out := &in.MaxConcurrency, &out.MaxConcurrency + if *in == nil { + *out = nil + } else { + *out = new(int64) + **out = **in + } + } + if in.MaxHistory != nil { + in, out := &in.MaxHistory, &out.MaxHistory + if *in == nil { + *out = nil + } else { + *out = new(int64) + **out = **in + } + } + in.Trigger.DeepCopyInto(&out.Trigger) + if in.Workflow != nil { + in, out := &in.Workflow, &out.Workflow + if *in == nil { + *out = nil + } else { + *out = new(WorkflowResource) + (*in).DeepCopyInto(*out) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduleSpec. +func (in *ScheduleSpec) DeepCopy() *ScheduleSpec { + if in == nil { + return nil + } + out := new(ScheduleSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ScheduleStatus) DeepCopyInto(out *ScheduleStatus) { + *out = *in + in.UpdatedAt.DeepCopyInto(&out.UpdatedAt) + in.Trigger.DeepCopyInto(&out.Trigger) + if in.WorkflowHistory != nil { + in, out := &in.WorkflowHistory, &out.WorkflowHistory + if *in == nil { + *out = nil + } else { + *out = new(WorkflowHistory) + (*in).DeepCopyInto(*out) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduleStatus. +func (in *ScheduleStatus) DeepCopy() *ScheduleStatus { + if in == nil { + return nil + } + out := new(ScheduleStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Trigger) DeepCopyInto(out *Trigger) { + *out = *in + if in.CronSchedule != nil { + in, out := &in.CronSchedule, &out.CronSchedule + if *in == nil { + *out = nil + } else { + *out = new(CronSchedule) + (*in).DeepCopyInto(*out) + } + } + if in.PeriodicSchedule != nil { + in, out := &in.PeriodicSchedule, &out.PeriodicSchedule + if *in == nil { + *out = nil + } else { + *out = new(PeriodicSchedule) + (*in).DeepCopyInto(*out) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Trigger. +func (in *Trigger) DeepCopy() *Trigger { + if in == nil { + return nil + } + out := new(Trigger) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TriggerStatus) DeepCopyInto(out *TriggerStatus) { + *out = *in + if in.LastTriggeredTime != nil { + in, out := &in.LastTriggeredTime, &out.LastTriggeredTime + if *in == nil { + *out = nil + } else { + *out = (*in).DeepCopy() + } + } + if in.NextTriggeredTime != nil { + in, out := &in.NextTriggeredTime, &out.NextTriggeredTime + if *in == nil { + *out = nil + } else { + *out = (*in).DeepCopy() + } + } + if in.LastIndex != nil { + in, out := &in.LastIndex, &out.LastIndex + if *in == nil { + *out = nil + } else { + *out = new(int64) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TriggerStatus. +func (in *TriggerStatus) DeepCopy() *TriggerStatus { + if in == nil { + return nil + } + out := new(TriggerStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkflowHistory) DeepCopyInto(out *WorkflowHistory) { + *out = *in + if in.Active != nil { + in, out := &in.Active, &out.Active + *out = make([]WorkflowStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Completed != nil { + in, out := &in.Completed, &out.Completed + *out = make([]WorkflowStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkflowHistory. +func (in *WorkflowHistory) DeepCopy() *WorkflowHistory { + if in == nil { + return nil + } + out := new(WorkflowHistory) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkflowResource) DeepCopyInto(out *WorkflowResource) { + *out = *in + if in.Parameters != nil { + in, out := &in.Parameters, &out.Parameters + *out = make([]Parameter, len(*in)) + copy(*out, *in) + } + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkflowResource. +func (in *WorkflowResource) DeepCopy() *WorkflowResource { + if in == nil { + return nil + } + out := new(WorkflowResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkflowStatus) DeepCopyInto(out *WorkflowStatus) { + *out = *in + in.CreatedAt.DeepCopyInto(&out.CreatedAt) + in.StartedAt.DeepCopyInto(&out.StartedAt) + in.FinishedAt.DeepCopyInto(&out.FinishedAt) + in.ScheduledAt.DeepCopyInto(&out.ScheduledAt) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkflowStatus. +func (in *WorkflowStatus) DeepCopy() *WorkflowStatus { + if in == nil { + return nil + } + out := new(WorkflowStatus) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go new file mode 100644 index 00000000000..178728d6e78 --- /dev/null +++ b/pkg/client/clientset/versioned/clientset.go @@ -0,0 +1,96 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by client-gen. DO NOT EDIT. + +package versioned + +import ( + schedulev1alpha1 "github.com/kubeflow/pipelines/pkg/client/clientset/versioned/typed/schedule/v1alpha1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + ScheduleV1alpha1() schedulev1alpha1.ScheduleV1alpha1Interface + // Deprecated: please explicitly pick a version if possible. + Schedule() schedulev1alpha1.ScheduleV1alpha1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + scheduleV1alpha1 *schedulev1alpha1.ScheduleV1alpha1Client +} + +// ScheduleV1alpha1 retrieves the ScheduleV1alpha1Client +func (c *Clientset) ScheduleV1alpha1() schedulev1alpha1.ScheduleV1alpha1Interface { + return c.scheduleV1alpha1 +} + +// Deprecated: Schedule retrieves the default version of ScheduleClient. +// Please explicitly pick a version. +func (c *Clientset) Schedule() schedulev1alpha1.ScheduleV1alpha1Interface { + return c.scheduleV1alpha1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var cs Clientset + var err error + cs.scheduleV1alpha1, err = schedulev1alpha1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + var cs Clientset + cs.scheduleV1alpha1 = schedulev1alpha1.NewForConfigOrDie(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.scheduleV1alpha1 = schedulev1alpha1.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 new file mode 100644 index 00000000000..bce96cb6a1f --- /dev/null +++ b/pkg/client/clientset/versioned/doc.go @@ -0,0 +1,18 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated clientset. +package versioned diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 00000000000..016140d18cb --- /dev/null +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,80 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + clientset "github.com/kubeflow/pipelines/pkg/client/clientset/versioned" + schedulev1alpha1 "github.com/kubeflow/pipelines/pkg/client/clientset/versioned/typed/schedule/v1alpha1" + fakeschedulev1alpha1 "github.com/kubeflow/pipelines/pkg/client/clientset/versioned/typed/schedule/v1alpha1/fake" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + cs := &Clientset{} + cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} + cs.AddReactor("*", "*", testing.ObjectReaction(o)) + cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns) + if err != nil { + return false, nil, err + } + return true, watch, nil + }) + + return cs +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +var _ clientset.Interface = &Clientset{} + +// ScheduleV1alpha1 retrieves the ScheduleV1alpha1Client +func (c *Clientset) ScheduleV1alpha1() schedulev1alpha1.ScheduleV1alpha1Interface { + return &fakeschedulev1alpha1.FakeScheduleV1alpha1{Fake: &c.Fake} +} + +// Schedule retrieves the ScheduleV1alpha1Client +func (c *Clientset) Schedule() schedulev1alpha1.ScheduleV1alpha1Interface { + return &fakeschedulev1alpha1.FakeScheduleV1alpha1{Fake: &c.Fake} +} diff --git a/pkg/client/clientset/versioned/fake/doc.go b/pkg/client/clientset/versioned/fake/doc.go new file mode 100644 index 00000000000..ed08b811440 --- /dev/null +++ b/pkg/client/clientset/versioned/fake/doc.go @@ -0,0 +1,18 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go new file mode 100644 index 00000000000..6544a5b7e07 --- /dev/null +++ b/pkg/client/clientset/versioned/fake/register.go @@ -0,0 +1,52 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + schedulev1alpha1 "github.com/kubeflow/pipelines/pkg/apis/schedule/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) +var parameterCodec = runtime.NewParameterCodec(scheme) + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + schedulev1alpha1.AddToScheme(scheme) +} diff --git a/pkg/client/clientset/versioned/scheme/doc.go b/pkg/client/clientset/versioned/scheme/doc.go new file mode 100644 index 00000000000..a9e70c54909 --- /dev/null +++ b/pkg/client/clientset/versioned/scheme/doc.go @@ -0,0 +1,18 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by client-gen. DO NOT EDIT. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go new file mode 100644 index 00000000000..fcce8390d77 --- /dev/null +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -0,0 +1,52 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by client-gen. DO NOT EDIT. + +package scheme + +import ( + schedulev1alpha1 "github.com/kubeflow/pipelines/pkg/apis/schedule/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(Scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + schedulev1alpha1.AddToScheme(scheme) +} diff --git a/pkg/client/clientset/versioned/typed/schedule/v1alpha1/doc.go b/pkg/client/clientset/versioned/typed/schedule/v1alpha1/doc.go new file mode 100644 index 00000000000..7c6f02e5302 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/schedule/v1alpha1/doc.go @@ -0,0 +1,18 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1alpha1 diff --git a/pkg/client/clientset/versioned/typed/schedule/v1alpha1/fake/doc.go b/pkg/client/clientset/versioned/typed/schedule/v1alpha1/fake/doc.go new file mode 100644 index 00000000000..c3f1566b39f --- /dev/null +++ b/pkg/client/clientset/versioned/typed/schedule/v1alpha1/fake/doc.go @@ -0,0 +1,18 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// 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/schedule/v1alpha1/fake/fake_schedule.go b/pkg/client/clientset/versioned/typed/schedule/v1alpha1/fake/fake_schedule.go new file mode 100644 index 00000000000..5c6e9e04ff3 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/schedule/v1alpha1/fake/fake_schedule.go @@ -0,0 +1,126 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/kubeflow/pipelines/pkg/apis/schedule/v1alpha1" + 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" +) + +// FakeSchedules implements ScheduleInterface +type FakeSchedules struct { + Fake *FakeScheduleV1alpha1 + ns string +} + +var schedulesResource = schema.GroupVersionResource{Group: "schedule.kubeflow.org", Version: "v1alpha1", Resource: "schedules"} + +var schedulesKind = schema.GroupVersionKind{Group: "schedule.kubeflow.org", Version: "v1alpha1", Kind: "Schedule"} + +// Get takes name of the schedule, and returns the corresponding schedule object, and an error if there is any. +func (c *FakeSchedules) Get(name string, options v1.GetOptions) (result *v1alpha1.Schedule, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(schedulesResource, c.ns, name), &v1alpha1.Schedule{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Schedule), err +} + +// List takes label and field selectors, and returns the list of Schedules that match those selectors. +func (c *FakeSchedules) List(opts v1.ListOptions) (result *v1alpha1.ScheduleList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(schedulesResource, schedulesKind, c.ns, opts), &v1alpha1.ScheduleList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.ScheduleList{ListMeta: obj.(*v1alpha1.ScheduleList).ListMeta} + for _, item := range obj.(*v1alpha1.ScheduleList).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 schedules. +func (c *FakeSchedules) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(schedulesResource, c.ns, opts)) + +} + +// Create takes the representation of a schedule and creates it. Returns the server's representation of the schedule, and an error, if there is any. +func (c *FakeSchedules) Create(schedule *v1alpha1.Schedule) (result *v1alpha1.Schedule, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(schedulesResource, c.ns, schedule), &v1alpha1.Schedule{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Schedule), err +} + +// Update takes the representation of a schedule and updates it. Returns the server's representation of the schedule, and an error, if there is any. +func (c *FakeSchedules) Update(schedule *v1alpha1.Schedule) (result *v1alpha1.Schedule, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(schedulesResource, c.ns, schedule), &v1alpha1.Schedule{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Schedule), err +} + +// Delete takes name of the schedule and deletes it. Returns an error if one occurs. +func (c *FakeSchedules) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(schedulesResource, c.ns, name), &v1alpha1.Schedule{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeSchedules) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(schedulesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.ScheduleList{}) + return err +} + +// Patch applies the patch and returns the patched schedule. +func (c *FakeSchedules) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Schedule, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(schedulesResource, c.ns, name, data, subresources...), &v1alpha1.Schedule{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Schedule), err +} diff --git a/pkg/client/clientset/versioned/typed/schedule/v1alpha1/fake/fake_schedule_client.go b/pkg/client/clientset/versioned/typed/schedule/v1alpha1/fake/fake_schedule_client.go new file mode 100644 index 00000000000..cff61b39000 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/schedule/v1alpha1/fake/fake_schedule_client.go @@ -0,0 +1,38 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/kubeflow/pipelines/pkg/client/clientset/versioned/typed/schedule/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeScheduleV1alpha1 struct { + *testing.Fake +} + +func (c *FakeScheduleV1alpha1) Schedules(namespace string) v1alpha1.ScheduleInterface { + return &FakeSchedules{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeScheduleV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/schedule/v1alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/schedule/v1alpha1/generated_expansion.go new file mode 100644 index 00000000000..48b8ed8c77b --- /dev/null +++ b/pkg/client/clientset/versioned/typed/schedule/v1alpha1/generated_expansion.go @@ -0,0 +1,19 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +type ScheduleExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/schedule/v1alpha1/schedule.go b/pkg/client/clientset/versioned/typed/schedule/v1alpha1/schedule.go new file mode 100644 index 00000000000..e85a13f00d2 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/schedule/v1alpha1/schedule.go @@ -0,0 +1,155 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/kubeflow/pipelines/pkg/apis/schedule/v1alpha1" + scheme "github.com/kubeflow/pipelines/pkg/client/clientset/versioned/scheme" + v1 "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" +) + +// SchedulesGetter has a method to return a ScheduleInterface. +// A group's client should implement this interface. +type SchedulesGetter interface { + Schedules(namespace string) ScheduleInterface +} + +// ScheduleInterface has methods to work with Schedule resources. +type ScheduleInterface interface { + Create(*v1alpha1.Schedule) (*v1alpha1.Schedule, error) + Update(*v1alpha1.Schedule) (*v1alpha1.Schedule, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.Schedule, error) + List(opts v1.ListOptions) (*v1alpha1.ScheduleList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Schedule, err error) + ScheduleExpansion +} + +// schedules implements ScheduleInterface +type schedules struct { + client rest.Interface + ns string +} + +// newSchedules returns a Schedules +func newSchedules(c *ScheduleV1alpha1Client, namespace string) *schedules { + return &schedules{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the schedule, and returns the corresponding schedule object, and an error if there is any. +func (c *schedules) Get(name string, options v1.GetOptions) (result *v1alpha1.Schedule, err error) { + result = &v1alpha1.Schedule{} + err = c.client.Get(). + Namespace(c.ns). + Resource("schedules"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Schedules that match those selectors. +func (c *schedules) List(opts v1.ListOptions) (result *v1alpha1.ScheduleList, err error) { + result = &v1alpha1.ScheduleList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("schedules"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested schedules. +func (c *schedules) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("schedules"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a schedule and creates it. Returns the server's representation of the schedule, and an error, if there is any. +func (c *schedules) Create(schedule *v1alpha1.Schedule) (result *v1alpha1.Schedule, err error) { + result = &v1alpha1.Schedule{} + err = c.client.Post(). + Namespace(c.ns). + Resource("schedules"). + Body(schedule). + Do(). + Into(result) + return +} + +// Update takes the representation of a schedule and updates it. Returns the server's representation of the schedule, and an error, if there is any. +func (c *schedules) Update(schedule *v1alpha1.Schedule) (result *v1alpha1.Schedule, err error) { + result = &v1alpha1.Schedule{} + err = c.client.Put(). + Namespace(c.ns). + Resource("schedules"). + Name(schedule.Name). + Body(schedule). + Do(). + Into(result) + return +} + +// Delete takes name of the schedule and deletes it. Returns an error if one occurs. +func (c *schedules) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("schedules"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *schedules) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("schedules"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched schedule. +func (c *schedules) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Schedule, err error) { + result = &v1alpha1.Schedule{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("schedules"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/schedule/v1alpha1/schedule_client.go b/pkg/client/clientset/versioned/typed/schedule/v1alpha1/schedule_client.go new file mode 100644 index 00000000000..e7fd00f8229 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/schedule/v1alpha1/schedule_client.go @@ -0,0 +1,88 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/kubeflow/pipelines/pkg/apis/schedule/v1alpha1" + "github.com/kubeflow/pipelines/pkg/client/clientset/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type ScheduleV1alpha1Interface interface { + RESTClient() rest.Interface + SchedulesGetter +} + +// ScheduleV1alpha1Client is used to interact with features provided by the schedule.kubeflow.org group. +type ScheduleV1alpha1Client struct { + restClient rest.Interface +} + +func (c *ScheduleV1alpha1Client) Schedules(namespace string) ScheduleInterface { + return newSchedules(c, namespace) +} + +// NewForConfig creates a new ScheduleV1alpha1Client for the given config. +func NewForConfig(c *rest.Config) (*ScheduleV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &ScheduleV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new ScheduleV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *ScheduleV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new ScheduleV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *ScheduleV1alpha1Client { + return &ScheduleV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + 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 *ScheduleV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/informers/externalversions/factory.go b/pkg/client/informers/externalversions/factory.go new file mode 100644 index 00000000000..8f6262b5841 --- /dev/null +++ b/pkg/client/informers/externalversions/factory.go @@ -0,0 +1,178 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by informer-gen. DO NOT EDIT. + +package externalversions + +import ( + reflect "reflect" + sync "sync" + time "time" + + versioned "github.com/kubeflow/pipelines/pkg/client/clientset/versioned" + internalinterfaces "github.com/kubeflow/pipelines/pkg/client/informers/externalversions/internalinterfaces" + schedule "github.com/kubeflow/pipelines/pkg/client/informers/externalversions/schedule" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// SharedInformerOption defines the functional option type for SharedInformerFactory. +type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory + +type sharedInformerFactory struct { + client versioned.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool +} + +// WithCustomResyncConfig sets a custom resync period for the specified informer types. +func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + for k, v := range resyncConfig { + factory.customResync[reflect.TypeOf(k)] = v + } + return factory + } +} + +// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory. +func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.tweakListOptions = tweakListOptions + return factory + } +} + +// WithNamespace limits the SharedInformerFactory to the specified namespace. +func WithNamespace(namespace string) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.namespace = namespace + return factory + } +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync) +} + +// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory. +// Listers obtained via this SharedInformerFactory will be subject to the same filters +// as specified here. +// Deprecated: Please use NewSharedInformerFactoryWithOptions instead +func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions)) +} + +// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. +func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { + factory := &sharedInformerFactory{ + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), + } + + // Apply all options + for _, opt := range options { + factory = opt(factory) + } + + return factory +} + +// Start initializes all requested informers. +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + + resyncPeriod, exists := f.customResync[informerType] + if !exists { + resyncPeriod = f.defaultResync + } + + informer = newFunc(f.client, resyncPeriod) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + Schedule() schedule.Interface +} + +func (f *sharedInformerFactory) Schedule() schedule.Interface { + return schedule.New(f, f.namespace, f.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go new file mode 100644 index 00000000000..93fb6804c61 --- /dev/null +++ b/pkg/client/informers/externalversions/generic.go @@ -0,0 +1,60 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by informer-gen. DO NOT EDIT. + +package externalversions + +import ( + "fmt" + + v1alpha1 "github.com/kubeflow/pipelines/pkg/apis/schedule/v1alpha1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=schedule.kubeflow.org, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithResource("schedules"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Schedule().V1alpha1().Schedules().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 00000000000..74b01203081 --- /dev/null +++ b/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,36 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by informer-gen. DO NOT EDIT. + +package internalinterfaces + +import ( + time "time" + + versioned "github.com/kubeflow/pipelines/pkg/client/clientset/versioned" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" +) + +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} + +type TweakListOptionsFunc func(*v1.ListOptions) diff --git a/pkg/client/informers/externalversions/schedule/interface.go b/pkg/client/informers/externalversions/schedule/interface.go new file mode 100644 index 00000000000..2034ecbe9a8 --- /dev/null +++ b/pkg/client/informers/externalversions/schedule/interface.go @@ -0,0 +1,44 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by informer-gen. DO NOT EDIT. + +package schedule + +import ( + internalinterfaces "github.com/kubeflow/pipelines/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kubeflow/pipelines/pkg/client/informers/externalversions/schedule/v1alpha1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface +} + +type group 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 &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/schedule/v1alpha1/interface.go b/pkg/client/informers/externalversions/schedule/v1alpha1/interface.go new file mode 100644 index 00000000000..1d7b556232f --- /dev/null +++ b/pkg/client/informers/externalversions/schedule/v1alpha1/interface.go @@ -0,0 +1,43 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "github.com/kubeflow/pipelines/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Schedules returns a ScheduleInformer. + Schedules() ScheduleInformer +} + +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} +} + +// Schedules returns a ScheduleInformer. +func (v *version) Schedules() ScheduleInformer { + return &scheduleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/client/informers/externalversions/schedule/v1alpha1/schedule.go b/pkg/client/informers/externalversions/schedule/v1alpha1/schedule.go new file mode 100644 index 00000000000..ea26d5d0008 --- /dev/null +++ b/pkg/client/informers/externalversions/schedule/v1alpha1/schedule.go @@ -0,0 +1,87 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + time "time" + + schedule_v1alpha1 "github.com/kubeflow/pipelines/pkg/apis/schedule/v1alpha1" + versioned "github.com/kubeflow/pipelines/pkg/client/clientset/versioned" + internalinterfaces "github.com/kubeflow/pipelines/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kubeflow/pipelines/pkg/client/listers/schedule/v1alpha1" + v1 "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" +) + +// ScheduleInformer provides access to a shared informer and lister for +// Schedules. +type ScheduleInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.ScheduleLister +} + +type scheduleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewScheduleInformer constructs a new informer for Schedule 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 NewScheduleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredScheduleInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredScheduleInformer constructs a new informer for Schedule 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 NewFilteredScheduleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ScheduleV1alpha1().Schedules(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ScheduleV1alpha1().Schedules(namespace).Watch(options) + }, + }, + &schedule_v1alpha1.Schedule{}, + resyncPeriod, + indexers, + ) +} + +func (f *scheduleInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredScheduleInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *scheduleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&schedule_v1alpha1.Schedule{}, f.defaultInformer) +} + +func (f *scheduleInformer) Lister() v1alpha1.ScheduleLister { + return v1alpha1.NewScheduleLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/listers/schedule/v1alpha1/expansion_generated.go b/pkg/client/listers/schedule/v1alpha1/expansion_generated.go new file mode 100644 index 00000000000..2cd91a6f38d --- /dev/null +++ b/pkg/client/listers/schedule/v1alpha1/expansion_generated.go @@ -0,0 +1,25 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +// ScheduleListerExpansion allows custom methods to be added to +// ScheduleLister. +type ScheduleListerExpansion interface{} + +// ScheduleNamespaceListerExpansion allows custom methods to be added to +// ScheduleNamespaceLister. +type ScheduleNamespaceListerExpansion interface{} diff --git a/pkg/client/listers/schedule/v1alpha1/schedule.go b/pkg/client/listers/schedule/v1alpha1/schedule.go new file mode 100644 index 00000000000..8d5a3d9848d --- /dev/null +++ b/pkg/client/listers/schedule/v1alpha1/schedule.go @@ -0,0 +1,92 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/kubeflow/pipelines/pkg/apis/schedule/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ScheduleLister helps list Schedules. +type ScheduleLister interface { + // List lists all Schedules in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.Schedule, err error) + // Schedules returns an object that can list and get Schedules. + Schedules(namespace string) ScheduleNamespaceLister + ScheduleListerExpansion +} + +// scheduleLister implements the ScheduleLister interface. +type scheduleLister struct { + indexer cache.Indexer +} + +// NewScheduleLister returns a new ScheduleLister. +func NewScheduleLister(indexer cache.Indexer) ScheduleLister { + return &scheduleLister{indexer: indexer} +} + +// List lists all Schedules in the indexer. +func (s *scheduleLister) List(selector labels.Selector) (ret []*v1alpha1.Schedule, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.Schedule)) + }) + return ret, err +} + +// Schedules returns an object that can list and get Schedules. +func (s *scheduleLister) Schedules(namespace string) ScheduleNamespaceLister { + return scheduleNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ScheduleNamespaceLister helps list and get Schedules. +type ScheduleNamespaceLister interface { + // List lists all Schedules in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha1.Schedule, err error) + // Get retrieves the Schedule from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.Schedule, error) + ScheduleNamespaceListerExpansion +} + +// scheduleNamespaceLister implements the ScheduleNamespaceLister +// interface. +type scheduleNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Schedules in the indexer for a given namespace. +func (s scheduleNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Schedule, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.Schedule)) + }) + return ret, err +} + +// Get retrieves the Schedule from the indexer for a given namespace and name. +func (s scheduleNamespaceLister) Get(name string) (*v1alpha1.Schedule, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("schedule"), name) + } + return obj.(*v1alpha1.Schedule), nil +} diff --git a/pkg/signals/signal.go b/pkg/signals/signal.go new file mode 100644 index 00000000000..52b41deb30f --- /dev/null +++ b/pkg/signals/signal.go @@ -0,0 +1,41 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package signals + +import ( + "os" + "os/signal" +) + +var onlyOneSignalHandler = make(chan struct{}) + +// SetupSignalHandler registered for SIGTERM and SIGINT. A stop channel is returned +// which is closed on one of these signals. If a second signal is caught, the program +// is terminated with exit code 1. +func SetupSignalHandler() (stopCh <-chan struct{}) { + close(onlyOneSignalHandler) // panics when called twice + + stop := make(chan struct{}) + c := make(chan os.Signal, 2) + signal.Notify(c, shutdownSignals...) + go func() { + <-c + close(stop) + <-c + os.Exit(1) // second signal. Exit directly. + }() + + return stop +} \ No newline at end of file diff --git a/pkg/signals/signal_posix.go b/pkg/signals/signal_posix.go new file mode 100644 index 00000000000..2abdc64f1af --- /dev/null +++ b/pkg/signals/signal_posix.go @@ -0,0 +1,22 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package signals + +import ( +"os" +"syscall" +) + +var shutdownSignals = []os.Signal{os.Interrupt, syscall.SIGTERM} \ No newline at end of file From a66811e8387e7981c6eaea45c53340c61508be40 Mon Sep 17 00:00:00 2001 From: Pascal Vicaire <25757005+vicaire@users.noreply.github.com> Date: Thu, 24 May 2018 19:56:30 -0700 Subject: [PATCH 2/2] Addressing code review comments. --- hack/update-codegen.sh | 2 +- .../register.go | 8 +- .../v1alpha1/doc.go | 2 +- .../v1alpha1/register.go | 8 +- .../v1alpha1/types.go | 86 +++++----- .../v1alpha1/zz_generated.deepcopy.go | 64 +++++--- pkg/client/clientset/versioned/clientset.go | 26 +-- .../versioned/fake/clientset_generated.go | 16 +- .../clientset/versioned/fake/register.go | 4 +- .../clientset/versioned/scheme/register.go | 4 +- .../schedule/v1alpha1/fake/fake_schedule.go | 40 ++--- .../typed/schedule/v1alpha1/schedule.go | 34 ++-- .../schedule/v1alpha1/schedule_client.go | 2 +- .../typed/scheduledworkflow/v1alpha1/doc.go | 18 ++ .../scheduledworkflow/v1alpha1/fake/doc.go | 18 ++ .../v1alpha1/fake/fake_scheduledworkflow.go | 126 ++++++++++++++ .../fake/fake_scheduledworkflow_client.go | 38 +++++ .../v1alpha1/generated_expansion.go | 19 +++ .../v1alpha1/scheduledworkflow.go | 155 ++++++++++++++++++ .../v1alpha1/scheduledworkflow_client.go | 88 ++++++++++ .../informers/externalversions/factory.go | 8 +- .../informers/externalversions/generic.go | 8 +- .../schedule/v1alpha1/schedule.go | 10 +- .../scheduledworkflow/interface.go | 44 +++++ .../scheduledworkflow/v1alpha1/interface.go | 43 +++++ .../v1alpha1/scheduledworkflow.go | 87 ++++++++++ .../listers/schedule/v1alpha1/schedule.go | 24 +-- .../v1alpha1/expansion_generated.go | 25 +++ .../v1alpha1/scheduledworkflow.go | 92 +++++++++++ 29 files changed, 943 insertions(+), 156 deletions(-) rename pkg/apis/{schedule => scheduledworkflow}/register.go (82%) rename pkg/apis/{schedule => scheduledworkflow}/v1alpha1/doc.go (93%) rename pkg/apis/{schedule => scheduledworkflow}/v1alpha1/register.go (87%) rename pkg/apis/{schedule => scheduledworkflow}/v1alpha1/types.go (75%) rename pkg/apis/{schedule => scheduledworkflow}/v1alpha1/zz_generated.deepcopy.go (82%) create mode 100644 pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/doc.go create mode 100644 pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/fake/doc.go create mode 100644 pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/fake/fake_scheduledworkflow.go create mode 100644 pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/fake/fake_scheduledworkflow_client.go create mode 100644 pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/generated_expansion.go create mode 100644 pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/scheduledworkflow.go create mode 100644 pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/scheduledworkflow_client.go create mode 100644 pkg/client/informers/externalversions/scheduledworkflow/interface.go create mode 100644 pkg/client/informers/externalversions/scheduledworkflow/v1alpha1/interface.go create mode 100644 pkg/client/informers/externalversions/scheduledworkflow/v1alpha1/scheduledworkflow.go create mode 100644 pkg/client/listers/scheduledworkflow/v1alpha1/expansion_generated.go create mode 100644 pkg/client/listers/scheduledworkflow/v1alpha1/scheduledworkflow.go diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 86987b95ead..ad4944151cc 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -28,5 +28,5 @@ echo "CODEGEN_PKG is $CODEGEN_PKG" ${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \ github.com/kubeflow/pipelines/pkg/client github.com/kubeflow/pipelines/pkg/apis \ - schedule:v1alpha1 \ + scheduledworkflow:v1alpha1 \ --go-header-file ${SCRIPT_ROOT}/hack/custom-boilerplate.go.txt diff --git a/pkg/apis/schedule/register.go b/pkg/apis/scheduledworkflow/register.go similarity index 82% rename from pkg/apis/schedule/register.go rename to pkg/apis/scheduledworkflow/register.go index 69237094de4..fdc5b74e2f5 100644 --- a/pkg/apis/schedule/register.go +++ b/pkg/apis/scheduledworkflow/register.go @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -package schedule +package scheduledworkflow const ( - Kind string = "Schedule" + Kind string = "ScheduledWorkflow" GroupName string = "kubeflow.org" - Singular string = "schedule" - Plural string = "schedules" + Singular string = "scheduledWorkflow" + Plural string = "scheduledworkflows" FullName string = Plural + "." + GroupName ) diff --git a/pkg/apis/schedule/v1alpha1/doc.go b/pkg/apis/scheduledworkflow/v1alpha1/doc.go similarity index 93% rename from pkg/apis/schedule/v1alpha1/doc.go rename to pkg/apis/scheduledworkflow/v1alpha1/doc.go index 9421eb43884..f87c127b6e3 100644 --- a/pkg/apis/schedule/v1alpha1/doc.go +++ b/pkg/apis/scheduledworkflow/v1alpha1/doc.go @@ -15,5 +15,5 @@ // +k8s:deepcopy-gen=package // Package v1alpha1 is the v1alpha1 version of the API. -// +groupName=schedule.kubeflow.org +// +groupName=scheduledworkflow.kubeflow.org package v1alpha1 diff --git a/pkg/apis/schedule/v1alpha1/register.go b/pkg/apis/scheduledworkflow/v1alpha1/register.go similarity index 87% rename from pkg/apis/schedule/v1alpha1/register.go rename to pkg/apis/scheduledworkflow/v1alpha1/register.go index b1143acc03d..66b698357f4 100644 --- a/pkg/apis/schedule/v1alpha1/register.go +++ b/pkg/apis/scheduledworkflow/v1alpha1/register.go @@ -19,11 +19,11 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - schedulecontroller "ml/pkg/apis/schedule" + controller "github.com/kubeflow/pipelines/pkg/apis/scheduledworkflow" ) // SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: schedulecontroller.GroupName, Version: "v1alpha1"} +var SchemeGroupVersion = schema.GroupVersion{Group: controller.GroupName, Version: "v1alpha1"} // Kind takes an unqualified kind and returns back a Group qualified GroupKind func Kind(kind string) schema.GroupKind { @@ -43,8 +43,8 @@ var ( // Adds the list of known types to Scheme. func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, - &Schedule{}, - &ScheduleList{}, + &ScheduledWorkflow{}, + &ScheduledWorkflowList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil diff --git a/pkg/apis/schedule/v1alpha1/types.go b/pkg/apis/scheduledworkflow/v1alpha1/types.go similarity index 75% rename from pkg/apis/schedule/v1alpha1/types.go rename to pkg/apis/scheduledworkflow/v1alpha1/types.go index 9180e1b258d..d977d093d52 100644 --- a/pkg/apis/schedule/v1alpha1/types.go +++ b/pkg/apis/scheduledworkflow/v1alpha1/types.go @@ -18,49 +18,34 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" "k8s.io/apimachinery/pkg/types" -) - -// SchedulePhase summarizes the state of the schedule. -type SchedulePhase string - -// Schedule phases -const ( - ScheduleEnabled SchedulePhase = "Enabled" - ScheduleDisabled SchedulePhase = "Disabled" - ScheduleRunning SchedulePhase = "Running" - ScheduleSucceeded SchedulePhase = "Succeeded" - ScheduleError SchedulePhase = "Error" + api "k8s.io/kubernetes/pkg/apis/core" ) // +genclient // +genclient:noStatus // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// Schedule is a specification for a Schedule resource -type Schedule struct { +// ScheduledWorkflow is a specification for a ScheduledWorkflow resource +type ScheduledWorkflow struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - Spec ScheduleSpec `json:"spec"` - Status ScheduleStatus `json:"status"` + Spec ScheduledWorkflowSpec `json:"spec"` + Status ScheduledWorkflowStatus `json:"status"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// ScheduleList is a list of Schedule resources -type ScheduleList struct { +// ScheduledWorkflowList is a list of ScheduledWorkflow resources +type ScheduledWorkflowList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata"` - Items []Schedule `json:"items"` + Items []ScheduledWorkflow `json:"items"` } -// ScheduleSpec is the spec for a Schedule resource -type ScheduleSpec struct { - - // A human readable description of the schedule. - Description string `json:"description,omitempty"` - +// ScheduledWorkflowSpec is the spec for a ScheduledWorkflow resource +type ScheduledWorkflowSpec struct { // If the schedule is disabled, it does not create any new workflow. Enabled bool `json:"enabled,omitempty"` @@ -94,7 +79,7 @@ type WorkflowResource struct { // The parameter values may include special strings that the controller will substitute: // [[ScheduledTime]] is substituted by the scheduled time of the workflow (default format) // [[CurrentTime]] is substituted by the current time (default format) - // [[Index]] is substituted by the index of the workflow (e.g. 3 mins that it was the 3rd workflow created) + // [[Index]] is substituted by the index of the workflow (e.g. 3 means that it was the 3rd workflow created) // [[ScheduledTime.15-04-05]] is substituted by the sheduled time (custom format specified as a Go time format: https://golang.org/pkg/time/#Parse) // [[CurrentTime.15-04-05]] is substituted by the current time (custom format specified as a Go time format: https://golang.org/pkg/time/#Parse) @@ -131,7 +116,7 @@ type CronSchedule struct { StartTime *metav1.Time `json:"startTime,omitempty"` // Time at which scheduling ends. - // If not end time is specified, the EndTime is the end of time. + // If no end time is specified, the EndTime is the end of time. // +optional EndTime *metav1.Time `json:"endTime,omitempty"` @@ -148,7 +133,7 @@ type PeriodicSchedule struct { StartTime *metav1.Time `json:"startTime,omitempty"` // Time at which scheduling ends. - // If not end time is specified, the EndTime is the end of time. + // If no end time is specified, the EndTime is the end of time. // +optional EndTime *metav1.Time `json:"endTime,omitempty"` @@ -158,16 +143,12 @@ type PeriodicSchedule struct { IntervalSecond int64 `json:"intervalSecond,omitempty"` } -// ScheduleStatus is the status for a Schedule resource. -type ScheduleStatus struct { - // Time at which this schedule was last updated. - UpdatedAt metav1.Time `json:"updatedAt,omitempty"` +// ScheduledWorkflowStatus is the status for a ScheduledWorkflow resource. +type ScheduledWorkflowStatus struct { - // Status is a simple, high-level summary of the state of the schedule. - Status SchedulePhase `json:"status,omitempty"` - - // Message provides additional information about the state of the schedule (if needed). - Message string `json:"message,omitempty"` + // The latest available observations of an object's current state. + // +optional + Conditions []ScheduledWorkflowCondition `json:"conditions,omitempty"` // TriggerStatus provides status info depending on the type of triggering. Trigger TriggerStatus `json:"trigger,omitempty"` @@ -176,6 +157,36 @@ type ScheduleStatus struct { WorkflowHistory *WorkflowHistory `json:"workflowHistory,omitempty"` } +type ScheduledWorkflowConditionType string + +// These are valid conditions of a ScheduledWorkflow. +const ( + ScheduledWorkflowEnabled ScheduledWorkflowConditionType = "Enabled" + ScheduledWorkflowDisabled ScheduledWorkflowConditionType = "Disabled" + ScheduledWorkflowRunning ScheduledWorkflowConditionType = "Running" + ScheduledWorkflowSucceeded ScheduledWorkflowConditionType = "Succeeded" + ScheduledWorkflowError ScheduledWorkflowConditionType = "Error" +) + +type ScheduledWorkflowCondition struct { + // Type of job condition, Complete or Failed. + Type ScheduledWorkflowConditionType `json:"type,omitempty"` + // Status of the condition, one of True, False, Unknown. + Status api.ConditionStatus `json:"status,omitempty"` + // Last time the condition was checked. + // +optional + LastProbeTime metav1.Time `json:"lastHeartbeatTime,omitempty"` + // Last time the condition transit from one status to another. + // +optional + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` + // (brief) reason for the condition's last transition. + // +optional + Reason string `json:"reason,omitempty"` + // Human readable message indicating details about last transition. + // +optional + Message string `json:"message,omitempty"` +} + type TriggerStatus struct { // Time of the last creation of a workflow. LastTriggeredTime *metav1.Time `json:lastTriggeredTime,omitempty` @@ -185,7 +196,6 @@ type TriggerStatus struct { // Index of the last workflow created. LastIndex *int64 `json:lastWorkflowIndex,omitempty` - } type WorkflowHistory struct { diff --git a/pkg/apis/schedule/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/scheduledworkflow/v1alpha1/zz_generated.deepcopy.go similarity index 82% rename from pkg/apis/schedule/v1alpha1/zz_generated.deepcopy.go rename to pkg/apis/scheduledworkflow/v1alpha1/zz_generated.deepcopy.go index ca78f7ee358..026f511ff47 100644 --- a/pkg/apis/schedule/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/scheduledworkflow/v1alpha1/zz_generated.deepcopy.go @@ -103,7 +103,7 @@ func (in *PeriodicSchedule) DeepCopy() *PeriodicSchedule { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Schedule) DeepCopyInto(out *Schedule) { +func (in *ScheduledWorkflow) DeepCopyInto(out *ScheduledWorkflow) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) @@ -112,18 +112,18 @@ func (in *Schedule) DeepCopyInto(out *Schedule) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Schedule. -func (in *Schedule) DeepCopy() *Schedule { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledWorkflow. +func (in *ScheduledWorkflow) DeepCopy() *ScheduledWorkflow { if in == nil { return nil } - out := new(Schedule) + out := new(ScheduledWorkflow) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Schedule) DeepCopyObject() runtime.Object { +func (in *ScheduledWorkflow) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -131,13 +131,31 @@ func (in *Schedule) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ScheduleList) DeepCopyInto(out *ScheduleList) { +func (in *ScheduledWorkflowCondition) DeepCopyInto(out *ScheduledWorkflowCondition) { + *out = *in + in.LastProbeTime.DeepCopyInto(&out.LastProbeTime) + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledWorkflowCondition. +func (in *ScheduledWorkflowCondition) DeepCopy() *ScheduledWorkflowCondition { + if in == nil { + return nil + } + out := new(ScheduledWorkflowCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ScheduledWorkflowList) DeepCopyInto(out *ScheduledWorkflowList) { *out = *in out.TypeMeta = in.TypeMeta out.ListMeta = in.ListMeta if in.Items != nil { in, out := &in.Items, &out.Items - *out = make([]Schedule, len(*in)) + *out = make([]ScheduledWorkflow, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -145,18 +163,18 @@ func (in *ScheduleList) DeepCopyInto(out *ScheduleList) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduleList. -func (in *ScheduleList) DeepCopy() *ScheduleList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledWorkflowList. +func (in *ScheduledWorkflowList) DeepCopy() *ScheduledWorkflowList { if in == nil { return nil } - out := new(ScheduleList) + out := new(ScheduledWorkflowList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ScheduleList) DeepCopyObject() runtime.Object { +func (in *ScheduledWorkflowList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -164,7 +182,7 @@ func (in *ScheduleList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ScheduleSpec) DeepCopyInto(out *ScheduleSpec) { +func (in *ScheduledWorkflowSpec) DeepCopyInto(out *ScheduledWorkflowSpec) { *out = *in if in.MaxConcurrency != nil { in, out := &in.MaxConcurrency, &out.MaxConcurrency @@ -197,20 +215,26 @@ func (in *ScheduleSpec) DeepCopyInto(out *ScheduleSpec) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduleSpec. -func (in *ScheduleSpec) DeepCopy() *ScheduleSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledWorkflowSpec. +func (in *ScheduledWorkflowSpec) DeepCopy() *ScheduledWorkflowSpec { if in == nil { return nil } - out := new(ScheduleSpec) + out := new(ScheduledWorkflowSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ScheduleStatus) DeepCopyInto(out *ScheduleStatus) { +func (in *ScheduledWorkflowStatus) DeepCopyInto(out *ScheduledWorkflowStatus) { *out = *in - in.UpdatedAt.DeepCopyInto(&out.UpdatedAt) + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]ScheduledWorkflowCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } in.Trigger.DeepCopyInto(&out.Trigger) if in.WorkflowHistory != nil { in, out := &in.WorkflowHistory, &out.WorkflowHistory @@ -224,12 +248,12 @@ func (in *ScheduleStatus) DeepCopyInto(out *ScheduleStatus) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduleStatus. -func (in *ScheduleStatus) DeepCopy() *ScheduleStatus { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledWorkflowStatus. +func (in *ScheduledWorkflowStatus) DeepCopy() *ScheduledWorkflowStatus { if in == nil { return nil } - out := new(ScheduleStatus) + out := new(ScheduledWorkflowStatus) in.DeepCopyInto(out) return out } diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index 178728d6e78..11311ab0d51 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -17,7 +17,7 @@ package versioned import ( - schedulev1alpha1 "github.com/kubeflow/pipelines/pkg/client/clientset/versioned/typed/schedule/v1alpha1" + scheduledworkflowv1alpha1 "github.com/kubeflow/pipelines/pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -25,27 +25,27 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface - ScheduleV1alpha1() schedulev1alpha1.ScheduleV1alpha1Interface + ScheduledworkflowV1alpha1() scheduledworkflowv1alpha1.ScheduledworkflowV1alpha1Interface // Deprecated: please explicitly pick a version if possible. - Schedule() schedulev1alpha1.ScheduleV1alpha1Interface + Scheduledworkflow() scheduledworkflowv1alpha1.ScheduledworkflowV1alpha1Interface } // Clientset contains the clients for groups. Each group has exactly one // version included in a Clientset. type Clientset struct { *discovery.DiscoveryClient - scheduleV1alpha1 *schedulev1alpha1.ScheduleV1alpha1Client + scheduledworkflowV1alpha1 *scheduledworkflowv1alpha1.ScheduledworkflowV1alpha1Client } -// ScheduleV1alpha1 retrieves the ScheduleV1alpha1Client -func (c *Clientset) ScheduleV1alpha1() schedulev1alpha1.ScheduleV1alpha1Interface { - return c.scheduleV1alpha1 +// ScheduledworkflowV1alpha1 retrieves the ScheduledworkflowV1alpha1Client +func (c *Clientset) ScheduledworkflowV1alpha1() scheduledworkflowv1alpha1.ScheduledworkflowV1alpha1Interface { + return c.scheduledworkflowV1alpha1 } -// Deprecated: Schedule retrieves the default version of ScheduleClient. +// Deprecated: Scheduledworkflow retrieves the default version of ScheduledworkflowClient. // Please explicitly pick a version. -func (c *Clientset) Schedule() schedulev1alpha1.ScheduleV1alpha1Interface { - return c.scheduleV1alpha1 +func (c *Clientset) Scheduledworkflow() scheduledworkflowv1alpha1.ScheduledworkflowV1alpha1Interface { + return c.scheduledworkflowV1alpha1 } // Discovery retrieves the DiscoveryClient @@ -64,7 +64,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { } var cs Clientset var err error - cs.scheduleV1alpha1, err = schedulev1alpha1.NewForConfig(&configShallowCopy) + cs.scheduledworkflowV1alpha1, err = scheduledworkflowv1alpha1.NewForConfig(&configShallowCopy) if err != nil { return nil, err } @@ -80,7 +80,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { // panics if there is an error in the config. func NewForConfigOrDie(c *rest.Config) *Clientset { var cs Clientset - cs.scheduleV1alpha1 = schedulev1alpha1.NewForConfigOrDie(c) + cs.scheduledworkflowV1alpha1 = scheduledworkflowv1alpha1.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) return &cs @@ -89,7 +89,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset - cs.scheduleV1alpha1 = schedulev1alpha1.New(c) + cs.scheduledworkflowV1alpha1 = scheduledworkflowv1alpha1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index 016140d18cb..2e325337605 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -18,8 +18,8 @@ package fake import ( clientset "github.com/kubeflow/pipelines/pkg/client/clientset/versioned" - schedulev1alpha1 "github.com/kubeflow/pipelines/pkg/client/clientset/versioned/typed/schedule/v1alpha1" - fakeschedulev1alpha1 "github.com/kubeflow/pipelines/pkg/client/clientset/versioned/typed/schedule/v1alpha1/fake" + scheduledworkflowv1alpha1 "github.com/kubeflow/pipelines/pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1" + fakescheduledworkflowv1alpha1 "github.com/kubeflow/pipelines/pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -69,12 +69,12 @@ func (c *Clientset) Discovery() discovery.DiscoveryInterface { var _ clientset.Interface = &Clientset{} -// ScheduleV1alpha1 retrieves the ScheduleV1alpha1Client -func (c *Clientset) ScheduleV1alpha1() schedulev1alpha1.ScheduleV1alpha1Interface { - return &fakeschedulev1alpha1.FakeScheduleV1alpha1{Fake: &c.Fake} +// ScheduledworkflowV1alpha1 retrieves the ScheduledworkflowV1alpha1Client +func (c *Clientset) ScheduledworkflowV1alpha1() scheduledworkflowv1alpha1.ScheduledworkflowV1alpha1Interface { + return &fakescheduledworkflowv1alpha1.FakeScheduledworkflowV1alpha1{Fake: &c.Fake} } -// Schedule retrieves the ScheduleV1alpha1Client -func (c *Clientset) Schedule() schedulev1alpha1.ScheduleV1alpha1Interface { - return &fakeschedulev1alpha1.FakeScheduleV1alpha1{Fake: &c.Fake} +// Scheduledworkflow retrieves the ScheduledworkflowV1alpha1Client +func (c *Clientset) Scheduledworkflow() scheduledworkflowv1alpha1.ScheduledworkflowV1alpha1Interface { + return &fakescheduledworkflowv1alpha1.FakeScheduledworkflowV1alpha1{Fake: &c.Fake} } diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index 6544a5b7e07..a020cce62d7 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -17,7 +17,7 @@ package fake import ( - schedulev1alpha1 "github.com/kubeflow/pipelines/pkg/apis/schedule/v1alpha1" + scheduledworkflowv1alpha1 "github.com/kubeflow/pipelines/pkg/apis/scheduledworkflow/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -48,5 +48,5 @@ func init() { // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. func AddToScheme(scheme *runtime.Scheme) { - schedulev1alpha1.AddToScheme(scheme) + scheduledworkflowv1alpha1.AddToScheme(scheme) } diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index fcce8390d77..6bb8aee8cd7 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -17,7 +17,7 @@ package scheme import ( - schedulev1alpha1 "github.com/kubeflow/pipelines/pkg/apis/schedule/v1alpha1" + scheduledworkflowv1alpha1 "github.com/kubeflow/pipelines/pkg/apis/scheduledworkflow/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -48,5 +48,5 @@ func init() { // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. func AddToScheme(scheme *runtime.Scheme) { - schedulev1alpha1.AddToScheme(scheme) + scheduledworkflowv1alpha1.AddToScheme(scheme) } diff --git a/pkg/client/clientset/versioned/typed/schedule/v1alpha1/fake/fake_schedule.go b/pkg/client/clientset/versioned/typed/schedule/v1alpha1/fake/fake_schedule.go index 5c6e9e04ff3..bc719b10cc7 100644 --- a/pkg/client/clientset/versioned/typed/schedule/v1alpha1/fake/fake_schedule.go +++ b/pkg/client/clientset/versioned/typed/schedule/v1alpha1/fake/fake_schedule.go @@ -17,7 +17,7 @@ package fake import ( - v1alpha1 "github.com/kubeflow/pipelines/pkg/apis/schedule/v1alpha1" + v1alpha1 "github.com/kubeflow/pipelines/pkg/apis/scheduledworkflow/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -34,23 +34,23 @@ type FakeSchedules struct { var schedulesResource = schema.GroupVersionResource{Group: "schedule.kubeflow.org", Version: "v1alpha1", Resource: "schedules"} -var schedulesKind = schema.GroupVersionKind{Group: "schedule.kubeflow.org", Version: "v1alpha1", Kind: "Schedule"} +var schedulesKind = schema.GroupVersionKind{Group: "schedule.kubeflow.org", Version: "v1alpha1", Kind: "ScheduledWorkflow"} // Get takes name of the schedule, and returns the corresponding schedule object, and an error if there is any. -func (c *FakeSchedules) Get(name string, options v1.GetOptions) (result *v1alpha1.Schedule, err error) { +func (c *FakeSchedules) Get(name string, options v1.GetOptions) (result *v1alpha1.ScheduledWorkflow, err error) { obj, err := c.Fake. - Invokes(testing.NewGetAction(schedulesResource, c.ns, name), &v1alpha1.Schedule{}) + Invokes(testing.NewGetAction(schedulesResource, c.ns, name), &v1alpha1.ScheduledWorkflow{}) if obj == nil { return nil, err } - return obj.(*v1alpha1.Schedule), err + return obj.(*v1alpha1.ScheduledWorkflow), err } // List takes label and field selectors, and returns the list of Schedules that match those selectors. -func (c *FakeSchedules) List(opts v1.ListOptions) (result *v1alpha1.ScheduleList, err error) { +func (c *FakeSchedules) List(opts v1.ListOptions) (result *v1alpha1.ScheduledWorkflowList, err error) { obj, err := c.Fake. - Invokes(testing.NewListAction(schedulesResource, schedulesKind, c.ns, opts), &v1alpha1.ScheduleList{}) + Invokes(testing.NewListAction(schedulesResource, schedulesKind, c.ns, opts), &v1alpha1.ScheduledWorkflowList{}) if obj == nil { return nil, err @@ -60,8 +60,8 @@ func (c *FakeSchedules) List(opts v1.ListOptions) (result *v1alpha1.ScheduleList if label == nil { label = labels.Everything() } - list := &v1alpha1.ScheduleList{ListMeta: obj.(*v1alpha1.ScheduleList).ListMeta} - for _, item := range obj.(*v1alpha1.ScheduleList).Items { + list := &v1alpha1.ScheduledWorkflowList{ListMeta: obj.(*v1alpha1.ScheduledWorkflowList).ListMeta} + for _, item := range obj.(*v1alpha1.ScheduledWorkflowList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -77,31 +77,31 @@ func (c *FakeSchedules) Watch(opts v1.ListOptions) (watch.Interface, error) { } // Create takes the representation of a schedule and creates it. Returns the server's representation of the schedule, and an error, if there is any. -func (c *FakeSchedules) Create(schedule *v1alpha1.Schedule) (result *v1alpha1.Schedule, err error) { +func (c *FakeSchedules) Create(schedule *v1alpha1.ScheduledWorkflow) (result *v1alpha1.ScheduledWorkflow, err error) { obj, err := c.Fake. - Invokes(testing.NewCreateAction(schedulesResource, c.ns, schedule), &v1alpha1.Schedule{}) + Invokes(testing.NewCreateAction(schedulesResource, c.ns, schedule), &v1alpha1.ScheduledWorkflow{}) if obj == nil { return nil, err } - return obj.(*v1alpha1.Schedule), err + return obj.(*v1alpha1.ScheduledWorkflow), err } // Update takes the representation of a schedule and updates it. Returns the server's representation of the schedule, and an error, if there is any. -func (c *FakeSchedules) Update(schedule *v1alpha1.Schedule) (result *v1alpha1.Schedule, err error) { +func (c *FakeSchedules) Update(schedule *v1alpha1.ScheduledWorkflow) (result *v1alpha1.ScheduledWorkflow, err error) { obj, err := c.Fake. - Invokes(testing.NewUpdateAction(schedulesResource, c.ns, schedule), &v1alpha1.Schedule{}) + Invokes(testing.NewUpdateAction(schedulesResource, c.ns, schedule), &v1alpha1.ScheduledWorkflow{}) if obj == nil { return nil, err } - return obj.(*v1alpha1.Schedule), err + return obj.(*v1alpha1.ScheduledWorkflow), err } // Delete takes name of the schedule and deletes it. Returns an error if one occurs. func (c *FakeSchedules) Delete(name string, options *v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(schedulesResource, c.ns, name), &v1alpha1.Schedule{}) + Invokes(testing.NewDeleteAction(schedulesResource, c.ns, name), &v1alpha1.ScheduledWorkflow{}) return err } @@ -110,17 +110,17 @@ func (c *FakeSchedules) Delete(name string, options *v1.DeleteOptions) error { func (c *FakeSchedules) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { action := testing.NewDeleteCollectionAction(schedulesResource, c.ns, listOptions) - _, err := c.Fake.Invokes(action, &v1alpha1.ScheduleList{}) + _, err := c.Fake.Invokes(action, &v1alpha1.ScheduledWorkflowList{}) return err } // Patch applies the patch and returns the patched schedule. -func (c *FakeSchedules) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Schedule, err error) { +func (c *FakeSchedules) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ScheduledWorkflow, err error) { obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(schedulesResource, c.ns, name, data, subresources...), &v1alpha1.Schedule{}) + Invokes(testing.NewPatchSubresourceAction(schedulesResource, c.ns, name, data, subresources...), &v1alpha1.ScheduledWorkflow{}) if obj == nil { return nil, err } - return obj.(*v1alpha1.Schedule), err + return obj.(*v1alpha1.ScheduledWorkflow), err } diff --git a/pkg/client/clientset/versioned/typed/schedule/v1alpha1/schedule.go b/pkg/client/clientset/versioned/typed/schedule/v1alpha1/schedule.go index e85a13f00d2..4bf7a1de50c 100644 --- a/pkg/client/clientset/versioned/typed/schedule/v1alpha1/schedule.go +++ b/pkg/client/clientset/versioned/typed/schedule/v1alpha1/schedule.go @@ -17,7 +17,7 @@ package v1alpha1 import ( - v1alpha1 "github.com/kubeflow/pipelines/pkg/apis/schedule/v1alpha1" + v1alpha1 "github.com/kubeflow/pipelines/pkg/apis/scheduledworkflow/v1alpha1" scheme "github.com/kubeflow/pipelines/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -31,16 +31,16 @@ type SchedulesGetter interface { Schedules(namespace string) ScheduleInterface } -// ScheduleInterface has methods to work with Schedule resources. +// ScheduleInterface has methods to work with ScheduledWorkflow resources. type ScheduleInterface interface { - Create(*v1alpha1.Schedule) (*v1alpha1.Schedule, error) - Update(*v1alpha1.Schedule) (*v1alpha1.Schedule, error) + Create(*v1alpha1.ScheduledWorkflow) (*v1alpha1.ScheduledWorkflow, error) + Update(*v1alpha1.ScheduledWorkflow) (*v1alpha1.ScheduledWorkflow, error) Delete(name string, options *v1.DeleteOptions) error DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1alpha1.Schedule, error) - List(opts v1.ListOptions) (*v1alpha1.ScheduleList, error) + Get(name string, options v1.GetOptions) (*v1alpha1.ScheduledWorkflow, error) + List(opts v1.ListOptions) (*v1alpha1.ScheduledWorkflowList, error) Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Schedule, err error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ScheduledWorkflow, err error) ScheduleExpansion } @@ -59,8 +59,8 @@ func newSchedules(c *ScheduleV1alpha1Client, namespace string) *schedules { } // Get takes name of the schedule, and returns the corresponding schedule object, and an error if there is any. -func (c *schedules) Get(name string, options v1.GetOptions) (result *v1alpha1.Schedule, err error) { - result = &v1alpha1.Schedule{} +func (c *schedules) Get(name string, options v1.GetOptions) (result *v1alpha1.ScheduledWorkflow, err error) { + result = &v1alpha1.ScheduledWorkflow{} err = c.client.Get(). Namespace(c.ns). Resource("schedules"). @@ -72,8 +72,8 @@ func (c *schedules) Get(name string, options v1.GetOptions) (result *v1alpha1.Sc } // List takes label and field selectors, and returns the list of Schedules that match those selectors. -func (c *schedules) List(opts v1.ListOptions) (result *v1alpha1.ScheduleList, err error) { - result = &v1alpha1.ScheduleList{} +func (c *schedules) List(opts v1.ListOptions) (result *v1alpha1.ScheduledWorkflowList, err error) { + result = &v1alpha1.ScheduledWorkflowList{} err = c.client.Get(). Namespace(c.ns). Resource("schedules"). @@ -94,8 +94,8 @@ func (c *schedules) Watch(opts v1.ListOptions) (watch.Interface, error) { } // Create takes the representation of a schedule and creates it. Returns the server's representation of the schedule, and an error, if there is any. -func (c *schedules) Create(schedule *v1alpha1.Schedule) (result *v1alpha1.Schedule, err error) { - result = &v1alpha1.Schedule{} +func (c *schedules) Create(schedule *v1alpha1.ScheduledWorkflow) (result *v1alpha1.ScheduledWorkflow, err error) { + result = &v1alpha1.ScheduledWorkflow{} err = c.client.Post(). Namespace(c.ns). Resource("schedules"). @@ -106,8 +106,8 @@ func (c *schedules) Create(schedule *v1alpha1.Schedule) (result *v1alpha1.Schedu } // Update takes the representation of a schedule and updates it. Returns the server's representation of the schedule, and an error, if there is any. -func (c *schedules) Update(schedule *v1alpha1.Schedule) (result *v1alpha1.Schedule, err error) { - result = &v1alpha1.Schedule{} +func (c *schedules) Update(schedule *v1alpha1.ScheduledWorkflow) (result *v1alpha1.ScheduledWorkflow, err error) { + result = &v1alpha1.ScheduledWorkflow{} err = c.client.Put(). Namespace(c.ns). Resource("schedules"). @@ -141,8 +141,8 @@ func (c *schedules) DeleteCollection(options *v1.DeleteOptions, listOptions v1.L } // Patch applies the patch and returns the patched schedule. -func (c *schedules) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Schedule, err error) { - result = &v1alpha1.Schedule{} +func (c *schedules) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ScheduledWorkflow, err error) { + result = &v1alpha1.ScheduledWorkflow{} err = c.client.Patch(pt). Namespace(c.ns). Resource("schedules"). diff --git a/pkg/client/clientset/versioned/typed/schedule/v1alpha1/schedule_client.go b/pkg/client/clientset/versioned/typed/schedule/v1alpha1/schedule_client.go index e7fd00f8229..f8d47e7bb51 100644 --- a/pkg/client/clientset/versioned/typed/schedule/v1alpha1/schedule_client.go +++ b/pkg/client/clientset/versioned/typed/schedule/v1alpha1/schedule_client.go @@ -17,7 +17,7 @@ package v1alpha1 import ( - v1alpha1 "github.com/kubeflow/pipelines/pkg/apis/schedule/v1alpha1" + v1alpha1 "github.com/kubeflow/pipelines/pkg/apis/scheduledworkflow/v1alpha1" "github.com/kubeflow/pipelines/pkg/client/clientset/versioned/scheme" serializer "k8s.io/apimachinery/pkg/runtime/serializer" rest "k8s.io/client-go/rest" diff --git a/pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/doc.go b/pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/doc.go new file mode 100644 index 00000000000..7c6f02e5302 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/doc.go @@ -0,0 +1,18 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1alpha1 diff --git a/pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/fake/doc.go b/pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/fake/doc.go new file mode 100644 index 00000000000..c3f1566b39f --- /dev/null +++ b/pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/fake/doc.go @@ -0,0 +1,18 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// 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/scheduledworkflow/v1alpha1/fake/fake_scheduledworkflow.go b/pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/fake/fake_scheduledworkflow.go new file mode 100644 index 00000000000..a905035f5d4 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/fake/fake_scheduledworkflow.go @@ -0,0 +1,126 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/kubeflow/pipelines/pkg/apis/scheduledworkflow/v1alpha1" + 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" +) + +// FakeScheduledWorkflows implements ScheduledWorkflowInterface +type FakeScheduledWorkflows struct { + Fake *FakeScheduledworkflowV1alpha1 + ns string +} + +var scheduledworkflowsResource = schema.GroupVersionResource{Group: "scheduledworkflow.kubeflow.org", Version: "v1alpha1", Resource: "scheduledworkflows"} + +var scheduledworkflowsKind = schema.GroupVersionKind{Group: "scheduledworkflow.kubeflow.org", Version: "v1alpha1", Kind: "ScheduledWorkflow"} + +// Get takes name of the scheduledWorkflow, and returns the corresponding scheduledWorkflow object, and an error if there is any. +func (c *FakeScheduledWorkflows) Get(name string, options v1.GetOptions) (result *v1alpha1.ScheduledWorkflow, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(scheduledworkflowsResource, c.ns, name), &v1alpha1.ScheduledWorkflow{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ScheduledWorkflow), err +} + +// List takes label and field selectors, and returns the list of ScheduledWorkflows that match those selectors. +func (c *FakeScheduledWorkflows) List(opts v1.ListOptions) (result *v1alpha1.ScheduledWorkflowList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(scheduledworkflowsResource, scheduledworkflowsKind, c.ns, opts), &v1alpha1.ScheduledWorkflowList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.ScheduledWorkflowList{ListMeta: obj.(*v1alpha1.ScheduledWorkflowList).ListMeta} + for _, item := range obj.(*v1alpha1.ScheduledWorkflowList).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 scheduledWorkflows. +func (c *FakeScheduledWorkflows) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(scheduledworkflowsResource, c.ns, opts)) + +} + +// Create takes the representation of a scheduledWorkflow and creates it. Returns the server's representation of the scheduledWorkflow, and an error, if there is any. +func (c *FakeScheduledWorkflows) Create(scheduledWorkflow *v1alpha1.ScheduledWorkflow) (result *v1alpha1.ScheduledWorkflow, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(scheduledworkflowsResource, c.ns, scheduledWorkflow), &v1alpha1.ScheduledWorkflow{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ScheduledWorkflow), err +} + +// Update takes the representation of a scheduledWorkflow and updates it. Returns the server's representation of the scheduledWorkflow, and an error, if there is any. +func (c *FakeScheduledWorkflows) Update(scheduledWorkflow *v1alpha1.ScheduledWorkflow) (result *v1alpha1.ScheduledWorkflow, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(scheduledworkflowsResource, c.ns, scheduledWorkflow), &v1alpha1.ScheduledWorkflow{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ScheduledWorkflow), err +} + +// Delete takes name of the scheduledWorkflow and deletes it. Returns an error if one occurs. +func (c *FakeScheduledWorkflows) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(scheduledworkflowsResource, c.ns, name), &v1alpha1.ScheduledWorkflow{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeScheduledWorkflows) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(scheduledworkflowsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.ScheduledWorkflowList{}) + return err +} + +// Patch applies the patch and returns the patched scheduledWorkflow. +func (c *FakeScheduledWorkflows) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ScheduledWorkflow, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(scheduledworkflowsResource, c.ns, name, data, subresources...), &v1alpha1.ScheduledWorkflow{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ScheduledWorkflow), err +} diff --git a/pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/fake/fake_scheduledworkflow_client.go b/pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/fake/fake_scheduledworkflow_client.go new file mode 100644 index 00000000000..33698639dda --- /dev/null +++ b/pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/fake/fake_scheduledworkflow_client.go @@ -0,0 +1,38 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/kubeflow/pipelines/pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeScheduledworkflowV1alpha1 struct { + *testing.Fake +} + +func (c *FakeScheduledworkflowV1alpha1) ScheduledWorkflows(namespace string) v1alpha1.ScheduledWorkflowInterface { + return &FakeScheduledWorkflows{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeScheduledworkflowV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/generated_expansion.go new file mode 100644 index 00000000000..cab82287301 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/generated_expansion.go @@ -0,0 +1,19 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +type ScheduledWorkflowExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/scheduledworkflow.go b/pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/scheduledworkflow.go new file mode 100644 index 00000000000..ae886112f1d --- /dev/null +++ b/pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/scheduledworkflow.go @@ -0,0 +1,155 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/kubeflow/pipelines/pkg/apis/scheduledworkflow/v1alpha1" + scheme "github.com/kubeflow/pipelines/pkg/client/clientset/versioned/scheme" + v1 "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" +) + +// ScheduledWorkflowsGetter has a method to return a ScheduledWorkflowInterface. +// A group's client should implement this interface. +type ScheduledWorkflowsGetter interface { + ScheduledWorkflows(namespace string) ScheduledWorkflowInterface +} + +// ScheduledWorkflowInterface has methods to work with ScheduledWorkflow resources. +type ScheduledWorkflowInterface interface { + Create(*v1alpha1.ScheduledWorkflow) (*v1alpha1.ScheduledWorkflow, error) + Update(*v1alpha1.ScheduledWorkflow) (*v1alpha1.ScheduledWorkflow, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.ScheduledWorkflow, error) + List(opts v1.ListOptions) (*v1alpha1.ScheduledWorkflowList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ScheduledWorkflow, err error) + ScheduledWorkflowExpansion +} + +// scheduledWorkflows implements ScheduledWorkflowInterface +type scheduledWorkflows struct { + client rest.Interface + ns string +} + +// newScheduledWorkflows returns a ScheduledWorkflows +func newScheduledWorkflows(c *ScheduledworkflowV1alpha1Client, namespace string) *scheduledWorkflows { + return &scheduledWorkflows{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the scheduledWorkflow, and returns the corresponding scheduledWorkflow object, and an error if there is any. +func (c *scheduledWorkflows) Get(name string, options v1.GetOptions) (result *v1alpha1.ScheduledWorkflow, err error) { + result = &v1alpha1.ScheduledWorkflow{} + err = c.client.Get(). + Namespace(c.ns). + Resource("scheduledworkflows"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ScheduledWorkflows that match those selectors. +func (c *scheduledWorkflows) List(opts v1.ListOptions) (result *v1alpha1.ScheduledWorkflowList, err error) { + result = &v1alpha1.ScheduledWorkflowList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("scheduledworkflows"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested scheduledWorkflows. +func (c *scheduledWorkflows) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("scheduledworkflows"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a scheduledWorkflow and creates it. Returns the server's representation of the scheduledWorkflow, and an error, if there is any. +func (c *scheduledWorkflows) Create(scheduledWorkflow *v1alpha1.ScheduledWorkflow) (result *v1alpha1.ScheduledWorkflow, err error) { + result = &v1alpha1.ScheduledWorkflow{} + err = c.client.Post(). + Namespace(c.ns). + Resource("scheduledworkflows"). + Body(scheduledWorkflow). + Do(). + Into(result) + return +} + +// Update takes the representation of a scheduledWorkflow and updates it. Returns the server's representation of the scheduledWorkflow, and an error, if there is any. +func (c *scheduledWorkflows) Update(scheduledWorkflow *v1alpha1.ScheduledWorkflow) (result *v1alpha1.ScheduledWorkflow, err error) { + result = &v1alpha1.ScheduledWorkflow{} + err = c.client.Put(). + Namespace(c.ns). + Resource("scheduledworkflows"). + Name(scheduledWorkflow.Name). + Body(scheduledWorkflow). + Do(). + Into(result) + return +} + +// Delete takes name of the scheduledWorkflow and deletes it. Returns an error if one occurs. +func (c *scheduledWorkflows) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("scheduledworkflows"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *scheduledWorkflows) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("scheduledworkflows"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched scheduledWorkflow. +func (c *scheduledWorkflows) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ScheduledWorkflow, err error) { + result = &v1alpha1.ScheduledWorkflow{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("scheduledworkflows"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/scheduledworkflow_client.go b/pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/scheduledworkflow_client.go new file mode 100644 index 00000000000..f83104ad1fa --- /dev/null +++ b/pkg/client/clientset/versioned/typed/scheduledworkflow/v1alpha1/scheduledworkflow_client.go @@ -0,0 +1,88 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/kubeflow/pipelines/pkg/apis/scheduledworkflow/v1alpha1" + "github.com/kubeflow/pipelines/pkg/client/clientset/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type ScheduledworkflowV1alpha1Interface interface { + RESTClient() rest.Interface + ScheduledWorkflowsGetter +} + +// ScheduledworkflowV1alpha1Client is used to interact with features provided by the scheduledworkflow.kubeflow.org group. +type ScheduledworkflowV1alpha1Client struct { + restClient rest.Interface +} + +func (c *ScheduledworkflowV1alpha1Client) ScheduledWorkflows(namespace string) ScheduledWorkflowInterface { + return newScheduledWorkflows(c, namespace) +} + +// NewForConfig creates a new ScheduledworkflowV1alpha1Client for the given config. +func NewForConfig(c *rest.Config) (*ScheduledworkflowV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &ScheduledworkflowV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new ScheduledworkflowV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *ScheduledworkflowV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new ScheduledworkflowV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *ScheduledworkflowV1alpha1Client { + return &ScheduledworkflowV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + 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 *ScheduledworkflowV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/informers/externalversions/factory.go b/pkg/client/informers/externalversions/factory.go index 8f6262b5841..7f0f6ec6c0d 100644 --- a/pkg/client/informers/externalversions/factory.go +++ b/pkg/client/informers/externalversions/factory.go @@ -23,7 +23,7 @@ import ( versioned "github.com/kubeflow/pipelines/pkg/client/clientset/versioned" internalinterfaces "github.com/kubeflow/pipelines/pkg/client/informers/externalversions/internalinterfaces" - schedule "github.com/kubeflow/pipelines/pkg/client/informers/externalversions/schedule" + scheduledworkflow "github.com/kubeflow/pipelines/pkg/client/informers/externalversions/scheduledworkflow" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -170,9 +170,9 @@ type SharedInformerFactory interface { ForResource(resource schema.GroupVersionResource) (GenericInformer, error) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool - Schedule() schedule.Interface + Scheduledworkflow() scheduledworkflow.Interface } -func (f *sharedInformerFactory) Schedule() schedule.Interface { - return schedule.New(f, f.namespace, f.tweakListOptions) +func (f *sharedInformerFactory) Scheduledworkflow() scheduledworkflow.Interface { + return scheduledworkflow.New(f, f.namespace, f.tweakListOptions) } diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 93fb6804c61..71fc73f2d60 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -19,7 +19,7 @@ package externalversions import ( "fmt" - v1alpha1 "github.com/kubeflow/pipelines/pkg/apis/schedule/v1alpha1" + v1alpha1 "github.com/kubeflow/pipelines/pkg/apis/scheduledworkflow/v1alpha1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -50,9 +50,9 @@ 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=schedule.kubeflow.org, Version=v1alpha1 - case v1alpha1.SchemeGroupVersion.WithResource("schedules"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Schedule().V1alpha1().Schedules().Informer()}, nil + // Group=scheduledworkflow.kubeflow.org, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithResource("scheduledworkflows"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduledworkflow().V1alpha1().ScheduledWorkflows().Informer()}, nil } diff --git a/pkg/client/informers/externalversions/schedule/v1alpha1/schedule.go b/pkg/client/informers/externalversions/schedule/v1alpha1/schedule.go index ea26d5d0008..331f3e3b515 100644 --- a/pkg/client/informers/externalversions/schedule/v1alpha1/schedule.go +++ b/pkg/client/informers/externalversions/schedule/v1alpha1/schedule.go @@ -19,7 +19,7 @@ package v1alpha1 import ( time "time" - schedule_v1alpha1 "github.com/kubeflow/pipelines/pkg/apis/schedule/v1alpha1" + schedule_v1alpha1 "github.com/kubeflow/pipelines/pkg/apis/scheduledworkflow/v1alpha1" versioned "github.com/kubeflow/pipelines/pkg/client/clientset/versioned" internalinterfaces "github.com/kubeflow/pipelines/pkg/client/informers/externalversions/internalinterfaces" v1alpha1 "github.com/kubeflow/pipelines/pkg/client/listers/schedule/v1alpha1" @@ -42,14 +42,14 @@ type scheduleInformer struct { namespace string } -// NewScheduleInformer constructs a new informer for Schedule type. +// NewScheduleInformer constructs a new informer for ScheduledWorkflow 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 NewScheduleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredScheduleInformer(client, namespace, resyncPeriod, indexers, nil) } -// NewFilteredScheduleInformer constructs a new informer for Schedule type. +// NewFilteredScheduleInformer constructs a new informer for ScheduledWorkflow 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 NewFilteredScheduleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { @@ -68,7 +68,7 @@ func NewFilteredScheduleInformer(client versioned.Interface, namespace string, r return client.ScheduleV1alpha1().Schedules(namespace).Watch(options) }, }, - &schedule_v1alpha1.Schedule{}, + &schedule_v1alpha1.ScheduledWorkflow{}, resyncPeriod, indexers, ) @@ -79,7 +79,7 @@ func (f *scheduleInformer) defaultInformer(client versioned.Interface, resyncPer } func (f *scheduleInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&schedule_v1alpha1.Schedule{}, f.defaultInformer) + return f.factory.InformerFor(&schedule_v1alpha1.ScheduledWorkflow{}, f.defaultInformer) } func (f *scheduleInformer) Lister() v1alpha1.ScheduleLister { diff --git a/pkg/client/informers/externalversions/scheduledworkflow/interface.go b/pkg/client/informers/externalversions/scheduledworkflow/interface.go new file mode 100644 index 00000000000..d5e344f95c4 --- /dev/null +++ b/pkg/client/informers/externalversions/scheduledworkflow/interface.go @@ -0,0 +1,44 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by informer-gen. DO NOT EDIT. + +package scheduledworkflow + +import ( + internalinterfaces "github.com/kubeflow/pipelines/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kubeflow/pipelines/pkg/client/informers/externalversions/scheduledworkflow/v1alpha1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface +} + +type group 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 &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/scheduledworkflow/v1alpha1/interface.go b/pkg/client/informers/externalversions/scheduledworkflow/v1alpha1/interface.go new file mode 100644 index 00000000000..4a5f2ac98e5 --- /dev/null +++ b/pkg/client/informers/externalversions/scheduledworkflow/v1alpha1/interface.go @@ -0,0 +1,43 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "github.com/kubeflow/pipelines/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ScheduledWorkflows returns a ScheduledWorkflowInformer. + ScheduledWorkflows() ScheduledWorkflowInformer +} + +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} +} + +// ScheduledWorkflows returns a ScheduledWorkflowInformer. +func (v *version) ScheduledWorkflows() ScheduledWorkflowInformer { + return &scheduledWorkflowInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/client/informers/externalversions/scheduledworkflow/v1alpha1/scheduledworkflow.go b/pkg/client/informers/externalversions/scheduledworkflow/v1alpha1/scheduledworkflow.go new file mode 100644 index 00000000000..837e2898548 --- /dev/null +++ b/pkg/client/informers/externalversions/scheduledworkflow/v1alpha1/scheduledworkflow.go @@ -0,0 +1,87 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + time "time" + + scheduledworkflow_v1alpha1 "github.com/kubeflow/pipelines/pkg/apis/scheduledworkflow/v1alpha1" + versioned "github.com/kubeflow/pipelines/pkg/client/clientset/versioned" + internalinterfaces "github.com/kubeflow/pipelines/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kubeflow/pipelines/pkg/client/listers/scheduledworkflow/v1alpha1" + v1 "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" +) + +// ScheduledWorkflowInformer provides access to a shared informer and lister for +// ScheduledWorkflows. +type ScheduledWorkflowInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.ScheduledWorkflowLister +} + +type scheduledWorkflowInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewScheduledWorkflowInformer constructs a new informer for ScheduledWorkflow 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 NewScheduledWorkflowInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredScheduledWorkflowInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredScheduledWorkflowInformer constructs a new informer for ScheduledWorkflow 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 NewFilteredScheduledWorkflowInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ScheduledworkflowV1alpha1().ScheduledWorkflows(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ScheduledworkflowV1alpha1().ScheduledWorkflows(namespace).Watch(options) + }, + }, + &scheduledworkflow_v1alpha1.ScheduledWorkflow{}, + resyncPeriod, + indexers, + ) +} + +func (f *scheduledWorkflowInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredScheduledWorkflowInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *scheduledWorkflowInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&scheduledworkflow_v1alpha1.ScheduledWorkflow{}, f.defaultInformer) +} + +func (f *scheduledWorkflowInformer) Lister() v1alpha1.ScheduledWorkflowLister { + return v1alpha1.NewScheduledWorkflowLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/listers/schedule/v1alpha1/schedule.go b/pkg/client/listers/schedule/v1alpha1/schedule.go index 8d5a3d9848d..acad8437683 100644 --- a/pkg/client/listers/schedule/v1alpha1/schedule.go +++ b/pkg/client/listers/schedule/v1alpha1/schedule.go @@ -17,7 +17,7 @@ package v1alpha1 import ( - v1alpha1 "github.com/kubeflow/pipelines/pkg/apis/schedule/v1alpha1" + v1alpha1 "github.com/kubeflow/pipelines/pkg/apis/scheduledworkflow/v1alpha1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" @@ -26,7 +26,7 @@ import ( // ScheduleLister helps list Schedules. type ScheduleLister interface { // List lists all Schedules in the indexer. - List(selector labels.Selector) (ret []*v1alpha1.Schedule, err error) + List(selector labels.Selector) (ret []*v1alpha1.ScheduledWorkflow, err error) // Schedules returns an object that can list and get Schedules. Schedules(namespace string) ScheduleNamespaceLister ScheduleListerExpansion @@ -43,9 +43,9 @@ func NewScheduleLister(indexer cache.Indexer) ScheduleLister { } // List lists all Schedules in the indexer. -func (s *scheduleLister) List(selector labels.Selector) (ret []*v1alpha1.Schedule, err error) { +func (s *scheduleLister) List(selector labels.Selector) (ret []*v1alpha1.ScheduledWorkflow, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Schedule)) + ret = append(ret, m.(*v1alpha1.ScheduledWorkflow)) }) return ret, err } @@ -58,9 +58,9 @@ func (s *scheduleLister) Schedules(namespace string) ScheduleNamespaceLister { // ScheduleNamespaceLister helps list and get Schedules. type ScheduleNamespaceLister interface { // List lists all Schedules in the indexer for a given namespace. - List(selector labels.Selector) (ret []*v1alpha1.Schedule, err error) - // Get retrieves the Schedule from the indexer for a given namespace and name. - Get(name string) (*v1alpha1.Schedule, error) + List(selector labels.Selector) (ret []*v1alpha1.ScheduledWorkflow, err error) + // Get retrieves the ScheduledWorkflow from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.ScheduledWorkflow, error) ScheduleNamespaceListerExpansion } @@ -72,15 +72,15 @@ type scheduleNamespaceLister struct { } // List lists all Schedules in the indexer for a given namespace. -func (s scheduleNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Schedule, err error) { +func (s scheduleNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ScheduledWorkflow, err error) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Schedule)) + ret = append(ret, m.(*v1alpha1.ScheduledWorkflow)) }) return ret, err } -// Get retrieves the Schedule from the indexer for a given namespace and name. -func (s scheduleNamespaceLister) Get(name string) (*v1alpha1.Schedule, error) { +// Get retrieves the ScheduledWorkflow from the indexer for a given namespace and name. +func (s scheduleNamespaceLister) Get(name string) (*v1alpha1.ScheduledWorkflow, error) { obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) if err != nil { return nil, err @@ -88,5 +88,5 @@ func (s scheduleNamespaceLister) Get(name string) (*v1alpha1.Schedule, error) { if !exists { return nil, errors.NewNotFound(v1alpha1.Resource("schedule"), name) } - return obj.(*v1alpha1.Schedule), nil + return obj.(*v1alpha1.ScheduledWorkflow), nil } diff --git a/pkg/client/listers/scheduledworkflow/v1alpha1/expansion_generated.go b/pkg/client/listers/scheduledworkflow/v1alpha1/expansion_generated.go new file mode 100644 index 00000000000..52e8db5820e --- /dev/null +++ b/pkg/client/listers/scheduledworkflow/v1alpha1/expansion_generated.go @@ -0,0 +1,25 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +// ScheduledWorkflowListerExpansion allows custom methods to be added to +// ScheduledWorkflowLister. +type ScheduledWorkflowListerExpansion interface{} + +// ScheduledWorkflowNamespaceListerExpansion allows custom methods to be added to +// ScheduledWorkflowNamespaceLister. +type ScheduledWorkflowNamespaceListerExpansion interface{} diff --git a/pkg/client/listers/scheduledworkflow/v1alpha1/scheduledworkflow.go b/pkg/client/listers/scheduledworkflow/v1alpha1/scheduledworkflow.go new file mode 100644 index 00000000000..200c7fa53c3 --- /dev/null +++ b/pkg/client/listers/scheduledworkflow/v1alpha1/scheduledworkflow.go @@ -0,0 +1,92 @@ +// Copyright 2018 The Kubeflow Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/kubeflow/pipelines/pkg/apis/scheduledworkflow/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ScheduledWorkflowLister helps list ScheduledWorkflows. +type ScheduledWorkflowLister interface { + // List lists all ScheduledWorkflows in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.ScheduledWorkflow, err error) + // ScheduledWorkflows returns an object that can list and get ScheduledWorkflows. + ScheduledWorkflows(namespace string) ScheduledWorkflowNamespaceLister + ScheduledWorkflowListerExpansion +} + +// scheduledWorkflowLister implements the ScheduledWorkflowLister interface. +type scheduledWorkflowLister struct { + indexer cache.Indexer +} + +// NewScheduledWorkflowLister returns a new ScheduledWorkflowLister. +func NewScheduledWorkflowLister(indexer cache.Indexer) ScheduledWorkflowLister { + return &scheduledWorkflowLister{indexer: indexer} +} + +// List lists all ScheduledWorkflows in the indexer. +func (s *scheduledWorkflowLister) List(selector labels.Selector) (ret []*v1alpha1.ScheduledWorkflow, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ScheduledWorkflow)) + }) + return ret, err +} + +// ScheduledWorkflows returns an object that can list and get ScheduledWorkflows. +func (s *scheduledWorkflowLister) ScheduledWorkflows(namespace string) ScheduledWorkflowNamespaceLister { + return scheduledWorkflowNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ScheduledWorkflowNamespaceLister helps list and get ScheduledWorkflows. +type ScheduledWorkflowNamespaceLister interface { + // List lists all ScheduledWorkflows in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha1.ScheduledWorkflow, err error) + // Get retrieves the ScheduledWorkflow from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.ScheduledWorkflow, error) + ScheduledWorkflowNamespaceListerExpansion +} + +// scheduledWorkflowNamespaceLister implements the ScheduledWorkflowNamespaceLister +// interface. +type scheduledWorkflowNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ScheduledWorkflows in the indexer for a given namespace. +func (s scheduledWorkflowNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ScheduledWorkflow, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ScheduledWorkflow)) + }) + return ret, err +} + +// Get retrieves the ScheduledWorkflow from the indexer for a given namespace and name. +func (s scheduledWorkflowNamespaceLister) Get(name string) (*v1alpha1.ScheduledWorkflow, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("scheduledworkflow"), name) + } + return obj.(*v1alpha1.ScheduledWorkflow), nil +}