41 lines
1.4 KiB
Go
41 lines
1.4 KiB
Go
/*
|
|
Copyright 2021 The Kruise 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 store
|
|
|
|
import (
|
|
"context"
|
|
|
|
kruiseclientset "github.com/openkruise/kruise-api/client/clientset/versioned"
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
"k8s.io/apimachinery/pkg/runtime"
|
|
"k8s.io/apimachinery/pkg/watch"
|
|
"k8s.io/client-go/tools/cache"
|
|
generator "k8s.io/kube-state-metrics/v2/pkg/metric_generator"
|
|
)
|
|
|
|
func cloneSetMetricFamilies(allowLabelsList []string) []generator.FamilyGenerator {
|
|
return []generator.FamilyGenerator{}
|
|
}
|
|
|
|
func createCloneSetListWatch(kruiseClient kruiseclientset.Interface, ns string) cache.ListerWatcher {
|
|
return &cache.ListWatch{
|
|
ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) {
|
|
return kruiseClient.AppsV1alpha1().CloneSets(ns).List(context.TODO(), opts)
|
|
},
|
|
WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) {
|
|
return kruiseClient.AppsV1alpha1().CloneSets(ns).Watch(context.TODO(), opts)
|
|
},
|
|
}
|
|
}
|