-
Notifications
You must be signed in to change notification settings - Fork 14
/
clientset.go
57 lines (48 loc) · 1.38 KB
/
clientset.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright 2020-Present VMware, Inc.
// SPDX-License-Identifier: Apache-2.0
package testhelpers
import (
kpackfakes "github.com/pivotal/kpack/pkg/client/clientset/versioned/fake"
k8sfakes "k8s.io/client-go/kubernetes/fake"
"github.com/vmware-tanzu/kpack-cli/pkg/k8s"
)
type FakeClientSetProvider struct {
clientSet k8s.ClientSet
}
func (f FakeClientSetProvider) GetClientSet(namespace string) (clientSet k8s.ClientSet, err error) {
if namespace != "" {
f.clientSet.Namespace = namespace
}
return f.clientSet, nil
}
func GetFakeKpackProvider(kpackClient *kpackfakes.Clientset, namespace string) FakeClientSetProvider {
return FakeClientSetProvider{
clientSet: k8s.ClientSet{
KpackClient: kpackClient,
Namespace: namespace,
},
}
}
func GetFakeKpackClusterProvider(kpackClient *kpackfakes.Clientset) FakeClientSetProvider {
return FakeClientSetProvider{
clientSet: k8s.ClientSet{
KpackClient: kpackClient,
},
}
}
func GetFakeK8sProvider(k8sClient *k8sfakes.Clientset, namespace string) FakeClientSetProvider {
return FakeClientSetProvider{
clientSet: k8s.ClientSet{
K8sClient: k8sClient,
Namespace: namespace,
},
}
}
func GetFakeClusterProvider(k8sClient *k8sfakes.Clientset, kpackClient *kpackfakes.Clientset) FakeClientSetProvider {
return FakeClientSetProvider{
clientSet: k8s.ClientSet{
K8sClient: k8sClient,
KpackClient: kpackClient,
},
}
}