1 Star 0 Fork 0

李童/training-operator

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
paddlejob.go 3.61 KB
一键复制 编辑 原始数据 按行查看 历史
李童 提交于 2024-10-04 16:54 . feat: update module
// Copyright 2021 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 v1
import (
"context"
time "time"
kubefloworgv1 "gitee.com/vak80/training-operator/pkg/apis/kubeflow.org/v1"
versioned "gitee.com/vak80/training-operator/pkg/client/clientset/versioned"
internalinterfaces "gitee.com/vak80/training-operator/pkg/client/informers/externalversions/internalinterfaces"
v1 "gitee.com/vak80/training-operator/pkg/client/listers/kubeflow.org/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
)
// PaddleJobInformer provides access to a shared informer and lister for
// PaddleJobs.
type PaddleJobInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1.PaddleJobLister
}
type paddleJobInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewPaddleJobInformer constructs a new informer for PaddleJob 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 NewPaddleJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredPaddleJobInformer(client, namespace, resyncPeriod, indexers, nil)
}
// NewFilteredPaddleJobInformer constructs a new informer for PaddleJob 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 NewFilteredPaddleJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.KubeflowV1().PaddleJobs(namespace).List(context.TODO(), options)
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.KubeflowV1().PaddleJobs(namespace).Watch(context.TODO(), options)
},
},
&kubefloworgv1.PaddleJob{},
resyncPeriod,
indexers,
)
}
func (f *paddleJobInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredPaddleJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *paddleJobInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&kubefloworgv1.PaddleJob{}, f.defaultInformer)
}
func (f *paddleJobInformer) Lister() v1.PaddleJobLister {
return v1.NewPaddleJobLister(f.Informer().GetIndexer())
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/vak80/training-operator.git
git@gitee.com:vak80/training-operator.git
vak80
training-operator
training-operator
67a6a5191879

搜索帮助