diff --git a/config/crd/bases/config.katalyst.kubewharf.io_hyperparameterconfigurations.yaml b/config/crd/bases/config.katalyst.kubewharf.io_hyperparameterconfigurations.yaml new file mode 100644 index 0000000..bcb7de8 --- /dev/null +++ b/config/crd/bases/config.katalyst.kubewharf.io_hyperparameterconfigurations.yaml @@ -0,0 +1,142 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.9.0 + creationTimestamp: null + name: hyperparameterconfigurations.config.katalyst.kubewharf.io +spec: + group: config.katalyst.kubewharf.io + names: + kind: HyperParameterConfiguration + listKind: HyperParameterConfigurationList + plural: hyperparameterconfigurations + shortNames: + - hpc + singular: hyperparameterconfiguration + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: AGE + type: date + - jsonPath: .spec.nodeLabelSelector + name: SELECTOR + type: string + - jsonPath: .spec.priority + name: PRIORITY + type: string + - jsonPath: .spec.ephemeralSelector.nodeNames + name: NODES + type: string + - jsonPath: .spec.ephemeralSelector.lastDuration + name: DURATION + type: string + - jsonPath: .status.conditions[?(@.type=="Valid")].status + name: VALID + type: string + - jsonPath: .status.conditions[?(@.type=="Valid")].reason + name: REASON + type: string + - jsonPath: .status.conditions[?(@.type=="Valid")].message + name: MESSAGE + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + description: HyperParameterConfiguration is the Schema for the hyperparameterconfigurations + API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: HyperParameterConfigurationSpec defines the desired state + of HyperParameterConfiguration + properties: + config: + properties: + borweinProvisionConfig: + description: BorweinProvisionConfig is configuration related to + Borwein provision policy + properties: + borweinProvisionParams: + description: BorweinProvisionParams is the list of parameter + set for Borwein provision policy + items: + properties: + indicatorTargetOffsetMax: + type: number + indicatorTargetOffsetMin: + type: number + indicatorTargetRampDownStep: + type: number + indicatorTargetRampUpStep: + type: number + modelAbnormalRatioThreshold: + type: number + paramID: + type: integer + paramVersion: + type: integer + type: object + type: array + type: object + type: object + type: object + status: + properties: + collisionCount: + description: Count of hash collisions for this cr. The kcc controller + uses this field as a collision avoidance mechanism when it needs + to create the name for the newest ControllerRevision. + format: int32 + type: integer + conditions: + description: Represents the latest available observations of a config's + current state. + items: + properties: + lastTransitionTime: + description: Last time the condition transit from one status + to another. + format: date-time + type: string + message: + description: message is a human-readable explanation containing + details about the transition + type: string + reason: + description: reason is the reason for the condition's last transition. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of config condition + type: string + required: + - status + - type + type: object + type: array + observedGeneration: + description: The most recent generation observed by the kcc controller. + format: int64 + type: integer + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/pkg/apis/config/v1alpha1/hpc.go b/pkg/apis/config/v1alpha1/hpc.go new file mode 100644 index 0000000..58f62ba --- /dev/null +++ b/pkg/apis/config/v1alpha1/hpc.go @@ -0,0 +1,92 @@ +/* +Copyright 2022 The Katalyst 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" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=hyperparameterconfigurations,shortName=hpc +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="AGE",type=date,JSONPath=.metadata.creationTimestamp +// +kubebuilder:printcolumn:name="SELECTOR",type=string,JSONPath=".spec.nodeLabelSelector" +// +kubebuilder:printcolumn:name="PRIORITY",type=string,JSONPath=".spec.priority" +// +kubebuilder:printcolumn:name="NODES",type=string,JSONPath=".spec.ephemeralSelector.nodeNames" +// +kubebuilder:printcolumn:name="DURATION",type=string,JSONPath=".spec.ephemeralSelector.lastDuration" +// +kubebuilder:printcolumn:name="VALID",type=string,JSONPath=".status.conditions[?(@.type==\"Valid\")].status" +// +kubebuilder:printcolumn:name="REASON",type=string,JSONPath=".status.conditions[?(@.type==\"Valid\")].reason" +// +kubebuilder:printcolumn:name="MESSAGE",type=string,JSONPath=".status.conditions[?(@.type==\"Valid\")].message" + +// HyperParameterConfiguration is the Schema for the hyperparameterconfigurations API +type HyperParameterConfiguration struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec HyperParameterConfigurationSpec `json:"spec,omitempty"` + Status GenericConfigStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true + +// HyperParameterConfigurationList contains a list of HyperParameterConfiguration +type HyperParameterConfigurationList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + Items []HyperParameterConfiguration `json:"items"` +} + +// HyperParameterConfigurationSpec defines the desired state of HyperParameterConfiguration +type HyperParameterConfigurationSpec struct { + // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster + // Important: Run "make" to regenerate code after modifying this file + + Config HyperParameterConfig `json:"config,omitempty"` +} + +type BorweinProvisionParam struct { + // +optional + ModelAbnormalRatioThreshold float64 `json:"modelAbnormalRatioThreshold,omitempty"` + // +optional + IndicatorTargetOffsetMax float64 `json:"indicatorTargetOffsetMax,omitempty"` + // +optional + IndicatorTargetOffsetMin float64 `json:"indicatorTargetOffsetMin,omitempty"` + // +optional + IndicatorTargetRampUpStep float64 `json:"indicatorTargetRampUpStep,omitempty"` + // +optional + IndicatorTargetRampDownStep float64 `json:"indicatorTargetRampDownStep,omitempty"` + // +optional + ParamVersion int `json:"paramVersion,omitempty"` + // +optional + ParamID int `json:"paramID,omitempty"` +} + +type BorweinProvisionConfig struct { + // BorweinProvisionParams is the list of parameter set for Borwein provision policy + // +optional + BorweinProvisionParams []BorweinProvisionParam `json:"borweinProvisionParams,omitempty"` +} + +type HyperParameterConfig struct { + // BorweinProvisionConfig is configuration related to Borwein provision policy + // +optional + BorweinProvisionConfig *BorweinProvisionConfig `json:"borweinProvisionConfig,omitempty"` +} diff --git a/pkg/apis/config/v1alpha1/register.go b/pkg/apis/config/v1alpha1/register.go index 894a6d9..45d085a 100644 --- a/pkg/apis/config/v1alpha1/register.go +++ b/pkg/apis/config/v1alpha1/register.go @@ -41,11 +41,12 @@ var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha // ResourceName const is used to construct standard gvr const ( - ResourceNameKatalystCustomConfigs = "katalystcustomconfigs" - ResourceNameCustomNodeConfigs = "customnodeconfigs" - ResourceNameAdminQoSConfigurations = "adminqosconfigurations" - ResourceNameAuthConfigurations = "authconfigurations" - ResourceNameTMOConfigurations = "transparentmemoryoffloadingconfigurations" + ResourceNameKatalystCustomConfigs = "katalystcustomconfigs" + ResourceNameCustomNodeConfigs = "customnodeconfigs" + ResourceNameAdminQoSConfigurations = "adminqosconfigurations" + ResourceNameAuthConfigurations = "authconfigurations" + ResourceNameTMOConfigurations = "transparentmemoryoffloadingconfigurations" + ResourceNameHyperParameterConfigurations = "hyperparameterconfigurations" ) // Resource takes an unqualified resource and returns a Group qualified GroupResource @@ -81,6 +82,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &AuthConfigurationList{}, &TransparentMemoryOffloadingConfiguration{}, &TransparentMemoryOffloadingConfigurationList{}, + &HyperParameterConfiguration{}, + &HyperParameterConfigurationList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) diff --git a/pkg/apis/config/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/config/v1alpha1/zz_generated.deepcopy.go index b790105..1aa6e3f 100644 --- a/pkg/apis/config/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/config/v1alpha1/zz_generated.deepcopy.go @@ -325,6 +325,43 @@ func (in *BasicAuthConfig) DeepCopy() *BasicAuthConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BorweinProvisionConfig) DeepCopyInto(out *BorweinProvisionConfig) { + *out = *in + if in.BorweinProvisionParams != nil { + in, out := &in.BorweinProvisionParams, &out.BorweinProvisionParams + *out = make([]BorweinProvisionParam, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BorweinProvisionConfig. +func (in *BorweinProvisionConfig) DeepCopy() *BorweinProvisionConfig { + if in == nil { + return nil + } + out := new(BorweinProvisionConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BorweinProvisionParam) DeepCopyInto(out *BorweinProvisionParam) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BorweinProvisionParam. +func (in *BorweinProvisionParam) DeepCopy() *BorweinProvisionParam { + if in == nil { + return nil + } + out := new(BorweinProvisionParam) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CPUHeadroomConfig) DeepCopyInto(out *CPUHeadroomConfig) { *out = *in @@ -702,6 +739,105 @@ func (in *GenericConfigStatus) DeepCopy() *GenericConfigStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HyperParameterConfig) DeepCopyInto(out *HyperParameterConfig) { + *out = *in + if in.BorweinProvisionConfig != nil { + in, out := &in.BorweinProvisionConfig, &out.BorweinProvisionConfig + *out = new(BorweinProvisionConfig) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HyperParameterConfig. +func (in *HyperParameterConfig) DeepCopy() *HyperParameterConfig { + if in == nil { + return nil + } + out := new(HyperParameterConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HyperParameterConfiguration) DeepCopyInto(out *HyperParameterConfiguration) { + *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 HyperParameterConfiguration. +func (in *HyperParameterConfiguration) DeepCopy() *HyperParameterConfiguration { + if in == nil { + return nil + } + out := new(HyperParameterConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *HyperParameterConfiguration) 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 *HyperParameterConfigurationList) DeepCopyInto(out *HyperParameterConfigurationList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]HyperParameterConfiguration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HyperParameterConfigurationList. +func (in *HyperParameterConfigurationList) DeepCopy() *HyperParameterConfigurationList { + if in == nil { + return nil + } + out := new(HyperParameterConfigurationList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *HyperParameterConfigurationList) 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 *HyperParameterConfigurationSpec) DeepCopyInto(out *HyperParameterConfigurationSpec) { + *out = *in + in.Config.DeepCopyInto(&out.Config) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HyperParameterConfigurationSpec. +func (in *HyperParameterConfigurationSpec) DeepCopy() *HyperParameterConfigurationSpec { + if in == nil { + return nil + } + out := new(HyperParameterConfigurationSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *KatalystCustomConfig) DeepCopyInto(out *KatalystCustomConfig) { *out = *in diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index 9aaf89e..0f7d311 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -51,14 +51,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{ // 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" -// ) +// 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) +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index ffa9cdb..17ad6fb 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -51,14 +51,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{ // 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" -// ) +// 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) +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. diff --git a/pkg/client/clientset/versioned/typed/config/v1alpha1/config_client.go b/pkg/client/clientset/versioned/typed/config/v1alpha1/config_client.go index c9725c7..f2d9bca 100644 --- a/pkg/client/clientset/versioned/typed/config/v1alpha1/config_client.go +++ b/pkg/client/clientset/versioned/typed/config/v1alpha1/config_client.go @@ -29,6 +29,7 @@ import ( type ConfigV1alpha1Interface interface { RESTClient() rest.Interface CustomNodeConfigsGetter + HyperParameterConfigurationsGetter KatalystCustomConfigsGetter } @@ -41,6 +42,10 @@ func (c *ConfigV1alpha1Client) CustomNodeConfigs() CustomNodeConfigInterface { return newCustomNodeConfigs(c) } +func (c *ConfigV1alpha1Client) HyperParameterConfigurations(namespace string) HyperParameterConfigurationInterface { + return newHyperParameterConfigurations(c, namespace) +} + func (c *ConfigV1alpha1Client) KatalystCustomConfigs(namespace string) KatalystCustomConfigInterface { return newKatalystCustomConfigs(c, namespace) } diff --git a/pkg/client/clientset/versioned/typed/config/v1alpha1/fake/fake_config_client.go b/pkg/client/clientset/versioned/typed/config/v1alpha1/fake/fake_config_client.go index a7ce1ed..bf2985b 100644 --- a/pkg/client/clientset/versioned/typed/config/v1alpha1/fake/fake_config_client.go +++ b/pkg/client/clientset/versioned/typed/config/v1alpha1/fake/fake_config_client.go @@ -32,6 +32,10 @@ func (c *FakeConfigV1alpha1) CustomNodeConfigs() v1alpha1.CustomNodeConfigInterf return &FakeCustomNodeConfigs{c} } +func (c *FakeConfigV1alpha1) HyperParameterConfigurations(namespace string) v1alpha1.HyperParameterConfigurationInterface { + return &FakeHyperParameterConfigurations{c, namespace} +} + func (c *FakeConfigV1alpha1) KatalystCustomConfigs(namespace string) v1alpha1.KatalystCustomConfigInterface { return &FakeKatalystCustomConfigs{c, namespace} } diff --git a/pkg/client/clientset/versioned/typed/config/v1alpha1/fake/fake_hyperparameterconfiguration.go b/pkg/client/clientset/versioned/typed/config/v1alpha1/fake/fake_hyperparameterconfiguration.go new file mode 100644 index 0000000..d9b1e00 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/config/v1alpha1/fake/fake_hyperparameterconfiguration.go @@ -0,0 +1,142 @@ +/* +Copyright 2022 The Katalyst Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1alpha1 "github.com/kubewharf/katalyst-api/pkg/apis/config/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" +) + +// FakeHyperParameterConfigurations implements HyperParameterConfigurationInterface +type FakeHyperParameterConfigurations struct { + Fake *FakeConfigV1alpha1 + ns string +} + +var hyperparameterconfigurationsResource = schema.GroupVersionResource{Group: "config.katalyst.kubewharf.io", Version: "v1alpha1", Resource: "hyperparameterconfigurations"} + +var hyperparameterconfigurationsKind = schema.GroupVersionKind{Group: "config.katalyst.kubewharf.io", Version: "v1alpha1", Kind: "HyperParameterConfiguration"} + +// Get takes name of the hyperParameterConfiguration, and returns the corresponding hyperParameterConfiguration object, and an error if there is any. +func (c *FakeHyperParameterConfigurations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.HyperParameterConfiguration, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(hyperparameterconfigurationsResource, c.ns, name), &v1alpha1.HyperParameterConfiguration{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.HyperParameterConfiguration), err +} + +// List takes label and field selectors, and returns the list of HyperParameterConfigurations that match those selectors. +func (c *FakeHyperParameterConfigurations) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.HyperParameterConfigurationList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(hyperparameterconfigurationsResource, hyperparameterconfigurationsKind, c.ns, opts), &v1alpha1.HyperParameterConfigurationList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.HyperParameterConfigurationList{ListMeta: obj.(*v1alpha1.HyperParameterConfigurationList).ListMeta} + for _, item := range obj.(*v1alpha1.HyperParameterConfigurationList).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 hyperParameterConfigurations. +func (c *FakeHyperParameterConfigurations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(hyperparameterconfigurationsResource, c.ns, opts)) + +} + +// Create takes the representation of a hyperParameterConfiguration and creates it. Returns the server's representation of the hyperParameterConfiguration, and an error, if there is any. +func (c *FakeHyperParameterConfigurations) Create(ctx context.Context, hyperParameterConfiguration *v1alpha1.HyperParameterConfiguration, opts v1.CreateOptions) (result *v1alpha1.HyperParameterConfiguration, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(hyperparameterconfigurationsResource, c.ns, hyperParameterConfiguration), &v1alpha1.HyperParameterConfiguration{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.HyperParameterConfiguration), err +} + +// Update takes the representation of a hyperParameterConfiguration and updates it. Returns the server's representation of the hyperParameterConfiguration, and an error, if there is any. +func (c *FakeHyperParameterConfigurations) Update(ctx context.Context, hyperParameterConfiguration *v1alpha1.HyperParameterConfiguration, opts v1.UpdateOptions) (result *v1alpha1.HyperParameterConfiguration, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(hyperparameterconfigurationsResource, c.ns, hyperParameterConfiguration), &v1alpha1.HyperParameterConfiguration{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.HyperParameterConfiguration), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeHyperParameterConfigurations) UpdateStatus(ctx context.Context, hyperParameterConfiguration *v1alpha1.HyperParameterConfiguration, opts v1.UpdateOptions) (*v1alpha1.HyperParameterConfiguration, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(hyperparameterconfigurationsResource, "status", c.ns, hyperParameterConfiguration), &v1alpha1.HyperParameterConfiguration{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.HyperParameterConfiguration), err +} + +// Delete takes name of the hyperParameterConfiguration and deletes it. Returns an error if one occurs. +func (c *FakeHyperParameterConfigurations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(hyperparameterconfigurationsResource, c.ns, name, opts), &v1alpha1.HyperParameterConfiguration{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeHyperParameterConfigurations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(hyperparameterconfigurationsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.HyperParameterConfigurationList{}) + return err +} + +// Patch applies the patch and returns the patched hyperParameterConfiguration. +func (c *FakeHyperParameterConfigurations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.HyperParameterConfiguration, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(hyperparameterconfigurationsResource, c.ns, name, pt, data, subresources...), &v1alpha1.HyperParameterConfiguration{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.HyperParameterConfiguration), err +} diff --git a/pkg/client/clientset/versioned/typed/config/v1alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/config/v1alpha1/generated_expansion.go index 949a4e2..5951de9 100644 --- a/pkg/client/clientset/versioned/typed/config/v1alpha1/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/config/v1alpha1/generated_expansion.go @@ -20,4 +20,6 @@ package v1alpha1 type CustomNodeConfigExpansion interface{} +type HyperParameterConfigurationExpansion interface{} + type KatalystCustomConfigExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/config/v1alpha1/hyperparameterconfiguration.go b/pkg/client/clientset/versioned/typed/config/v1alpha1/hyperparameterconfiguration.go new file mode 100644 index 0000000..a46560e --- /dev/null +++ b/pkg/client/clientset/versioned/typed/config/v1alpha1/hyperparameterconfiguration.go @@ -0,0 +1,195 @@ +/* +Copyright 2022 The Katalyst 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 ( + "context" + "time" + + v1alpha1 "github.com/kubewharf/katalyst-api/pkg/apis/config/v1alpha1" + scheme "github.com/kubewharf/katalyst-api/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" +) + +// HyperParameterConfigurationsGetter has a method to return a HyperParameterConfigurationInterface. +// A group's client should implement this interface. +type HyperParameterConfigurationsGetter interface { + HyperParameterConfigurations(namespace string) HyperParameterConfigurationInterface +} + +// HyperParameterConfigurationInterface has methods to work with HyperParameterConfiguration resources. +type HyperParameterConfigurationInterface interface { + Create(ctx context.Context, hyperParameterConfiguration *v1alpha1.HyperParameterConfiguration, opts v1.CreateOptions) (*v1alpha1.HyperParameterConfiguration, error) + Update(ctx context.Context, hyperParameterConfiguration *v1alpha1.HyperParameterConfiguration, opts v1.UpdateOptions) (*v1alpha1.HyperParameterConfiguration, error) + UpdateStatus(ctx context.Context, hyperParameterConfiguration *v1alpha1.HyperParameterConfiguration, opts v1.UpdateOptions) (*v1alpha1.HyperParameterConfiguration, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.HyperParameterConfiguration, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.HyperParameterConfigurationList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.HyperParameterConfiguration, err error) + HyperParameterConfigurationExpansion +} + +// hyperParameterConfigurations implements HyperParameterConfigurationInterface +type hyperParameterConfigurations struct { + client rest.Interface + ns string +} + +// newHyperParameterConfigurations returns a HyperParameterConfigurations +func newHyperParameterConfigurations(c *ConfigV1alpha1Client, namespace string) *hyperParameterConfigurations { + return &hyperParameterConfigurations{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the hyperParameterConfiguration, and returns the corresponding hyperParameterConfiguration object, and an error if there is any. +func (c *hyperParameterConfigurations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.HyperParameterConfiguration, err error) { + result = &v1alpha1.HyperParameterConfiguration{} + err = c.client.Get(). + Namespace(c.ns). + Resource("hyperparameterconfigurations"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of HyperParameterConfigurations that match those selectors. +func (c *hyperParameterConfigurations) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.HyperParameterConfigurationList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.HyperParameterConfigurationList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("hyperparameterconfigurations"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested hyperParameterConfigurations. +func (c *hyperParameterConfigurations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("hyperparameterconfigurations"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a hyperParameterConfiguration and creates it. Returns the server's representation of the hyperParameterConfiguration, and an error, if there is any. +func (c *hyperParameterConfigurations) Create(ctx context.Context, hyperParameterConfiguration *v1alpha1.HyperParameterConfiguration, opts v1.CreateOptions) (result *v1alpha1.HyperParameterConfiguration, err error) { + result = &v1alpha1.HyperParameterConfiguration{} + err = c.client.Post(). + Namespace(c.ns). + Resource("hyperparameterconfigurations"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(hyperParameterConfiguration). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a hyperParameterConfiguration and updates it. Returns the server's representation of the hyperParameterConfiguration, and an error, if there is any. +func (c *hyperParameterConfigurations) Update(ctx context.Context, hyperParameterConfiguration *v1alpha1.HyperParameterConfiguration, opts v1.UpdateOptions) (result *v1alpha1.HyperParameterConfiguration, err error) { + result = &v1alpha1.HyperParameterConfiguration{} + err = c.client.Put(). + Namespace(c.ns). + Resource("hyperparameterconfigurations"). + Name(hyperParameterConfiguration.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(hyperParameterConfiguration). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *hyperParameterConfigurations) UpdateStatus(ctx context.Context, hyperParameterConfiguration *v1alpha1.HyperParameterConfiguration, opts v1.UpdateOptions) (result *v1alpha1.HyperParameterConfiguration, err error) { + result = &v1alpha1.HyperParameterConfiguration{} + err = c.client.Put(). + Namespace(c.ns). + Resource("hyperparameterconfigurations"). + Name(hyperParameterConfiguration.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(hyperParameterConfiguration). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the hyperParameterConfiguration and deletes it. Returns an error if one occurs. +func (c *hyperParameterConfigurations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("hyperparameterconfigurations"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *hyperParameterConfigurations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("hyperparameterconfigurations"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched hyperParameterConfiguration. +func (c *hyperParameterConfigurations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.HyperParameterConfiguration, err error) { + result = &v1alpha1.HyperParameterConfiguration{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("hyperparameterconfigurations"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/informers/externalversions/config/v1alpha1/hyperparameterconfiguration.go b/pkg/client/informers/externalversions/config/v1alpha1/hyperparameterconfiguration.go new file mode 100644 index 0000000..6e2905c --- /dev/null +++ b/pkg/client/informers/externalversions/config/v1alpha1/hyperparameterconfiguration.go @@ -0,0 +1,90 @@ +/* +Copyright 2022 The Katalyst 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 ( + "context" + time "time" + + configv1alpha1 "github.com/kubewharf/katalyst-api/pkg/apis/config/v1alpha1" + versioned "github.com/kubewharf/katalyst-api/pkg/client/clientset/versioned" + internalinterfaces "github.com/kubewharf/katalyst-api/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kubewharf/katalyst-api/pkg/client/listers/config/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" +) + +// HyperParameterConfigurationInformer provides access to a shared informer and lister for +// HyperParameterConfigurations. +type HyperParameterConfigurationInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.HyperParameterConfigurationLister +} + +type hyperParameterConfigurationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewHyperParameterConfigurationInformer constructs a new informer for HyperParameterConfiguration 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 NewHyperParameterConfigurationInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredHyperParameterConfigurationInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredHyperParameterConfigurationInformer constructs a new informer for HyperParameterConfiguration 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 NewFilteredHyperParameterConfigurationInformer(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.ConfigV1alpha1().HyperParameterConfigurations(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ConfigV1alpha1().HyperParameterConfigurations(namespace).Watch(context.TODO(), options) + }, + }, + &configv1alpha1.HyperParameterConfiguration{}, + resyncPeriod, + indexers, + ) +} + +func (f *hyperParameterConfigurationInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredHyperParameterConfigurationInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *hyperParameterConfigurationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&configv1alpha1.HyperParameterConfiguration{}, f.defaultInformer) +} + +func (f *hyperParameterConfigurationInformer) Lister() v1alpha1.HyperParameterConfigurationLister { + return v1alpha1.NewHyperParameterConfigurationLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/config/v1alpha1/interface.go b/pkg/client/informers/externalversions/config/v1alpha1/interface.go index 4912afc..da753cc 100644 --- a/pkg/client/informers/externalversions/config/v1alpha1/interface.go +++ b/pkg/client/informers/externalversions/config/v1alpha1/interface.go @@ -26,6 +26,8 @@ import ( type Interface interface { // CustomNodeConfigs returns a CustomNodeConfigInformer. CustomNodeConfigs() CustomNodeConfigInformer + // HyperParameterConfigurations returns a HyperParameterConfigurationInformer. + HyperParameterConfigurations() HyperParameterConfigurationInformer // KatalystCustomConfigs returns a KatalystCustomConfigInformer. KatalystCustomConfigs() KatalystCustomConfigInformer } @@ -46,6 +48,11 @@ func (v *version) CustomNodeConfigs() CustomNodeConfigInformer { return &customNodeConfigInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } +// HyperParameterConfigurations returns a HyperParameterConfigurationInformer. +func (v *version) HyperParameterConfigurations() HyperParameterConfigurationInformer { + return &hyperParameterConfigurationInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + // KatalystCustomConfigs returns a KatalystCustomConfigInformer. func (v *version) KatalystCustomConfigs() KatalystCustomConfigInformer { return &katalystCustomConfigInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 969bb67..8845a53 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -72,6 +72,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource // Group=config.katalyst.kubewharf.io, Version=v1alpha1 case configv1alpha1.SchemeGroupVersion.WithResource("customnodeconfigs"): return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1alpha1().CustomNodeConfigs().Informer()}, nil + case configv1alpha1.SchemeGroupVersion.WithResource("hyperparameterconfigurations"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1alpha1().HyperParameterConfigurations().Informer()}, nil case configv1alpha1.SchemeGroupVersion.WithResource("katalystcustomconfigs"): return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1alpha1().KatalystCustomConfigs().Informer()}, nil diff --git a/pkg/client/listers/config/v1alpha1/expansion_generated.go b/pkg/client/listers/config/v1alpha1/expansion_generated.go index 6590153..58e3a1a 100644 --- a/pkg/client/listers/config/v1alpha1/expansion_generated.go +++ b/pkg/client/listers/config/v1alpha1/expansion_generated.go @@ -22,6 +22,14 @@ package v1alpha1 // CustomNodeConfigLister. type CustomNodeConfigListerExpansion interface{} +// HyperParameterConfigurationListerExpansion allows custom methods to be added to +// HyperParameterConfigurationLister. +type HyperParameterConfigurationListerExpansion interface{} + +// HyperParameterConfigurationNamespaceListerExpansion allows custom methods to be added to +// HyperParameterConfigurationNamespaceLister. +type HyperParameterConfigurationNamespaceListerExpansion interface{} + // KatalystCustomConfigListerExpansion allows custom methods to be added to // KatalystCustomConfigLister. type KatalystCustomConfigListerExpansion interface{} diff --git a/pkg/client/listers/config/v1alpha1/hyperparameterconfiguration.go b/pkg/client/listers/config/v1alpha1/hyperparameterconfiguration.go new file mode 100644 index 0000000..5d29e5e --- /dev/null +++ b/pkg/client/listers/config/v1alpha1/hyperparameterconfiguration.go @@ -0,0 +1,99 @@ +/* +Copyright 2022 The Katalyst 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/kubewharf/katalyst-api/pkg/apis/config/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// HyperParameterConfigurationLister helps list HyperParameterConfigurations. +// All objects returned here must be treated as read-only. +type HyperParameterConfigurationLister interface { + // List lists all HyperParameterConfigurations in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.HyperParameterConfiguration, err error) + // HyperParameterConfigurations returns an object that can list and get HyperParameterConfigurations. + HyperParameterConfigurations(namespace string) HyperParameterConfigurationNamespaceLister + HyperParameterConfigurationListerExpansion +} + +// hyperParameterConfigurationLister implements the HyperParameterConfigurationLister interface. +type hyperParameterConfigurationLister struct { + indexer cache.Indexer +} + +// NewHyperParameterConfigurationLister returns a new HyperParameterConfigurationLister. +func NewHyperParameterConfigurationLister(indexer cache.Indexer) HyperParameterConfigurationLister { + return &hyperParameterConfigurationLister{indexer: indexer} +} + +// List lists all HyperParameterConfigurations in the indexer. +func (s *hyperParameterConfigurationLister) List(selector labels.Selector) (ret []*v1alpha1.HyperParameterConfiguration, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.HyperParameterConfiguration)) + }) + return ret, err +} + +// HyperParameterConfigurations returns an object that can list and get HyperParameterConfigurations. +func (s *hyperParameterConfigurationLister) HyperParameterConfigurations(namespace string) HyperParameterConfigurationNamespaceLister { + return hyperParameterConfigurationNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// HyperParameterConfigurationNamespaceLister helps list and get HyperParameterConfigurations. +// All objects returned here must be treated as read-only. +type HyperParameterConfigurationNamespaceLister interface { + // List lists all HyperParameterConfigurations in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.HyperParameterConfiguration, err error) + // Get retrieves the HyperParameterConfiguration from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.HyperParameterConfiguration, error) + HyperParameterConfigurationNamespaceListerExpansion +} + +// hyperParameterConfigurationNamespaceLister implements the HyperParameterConfigurationNamespaceLister +// interface. +type hyperParameterConfigurationNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all HyperParameterConfigurations in the indexer for a given namespace. +func (s hyperParameterConfigurationNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.HyperParameterConfiguration, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.HyperParameterConfiguration)) + }) + return ret, err +} + +// Get retrieves the HyperParameterConfiguration from the indexer for a given namespace and name. +func (s hyperParameterConfigurationNamespaceLister) Get(name string) (*v1alpha1.HyperParameterConfiguration, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("hyperparameterconfiguration"), name) + } + return obj.(*v1alpha1.HyperParameterConfiguration), nil +}