-
Notifications
You must be signed in to change notification settings - Fork 2
/
spec.go
55 lines (44 loc) · 1.67 KB
/
spec.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
package apptest
import (
"context"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/client"
)
type Interface interface {
// InstallApps creates appcatalog and app CRs for use in automated tests
// and ensures they are installed by our app platform.
InstallApps(ctx context.Context, apps []App) error
// UpgradeApp find matching current app CR and change the spec
// to follow desired app CR.
UpgradeApp(ctx context.Context, current, desired App) error
// EnsureCRDs will register the passed CRDs in the k8s API used by the client.
EnsureCRDs(ctx context.Context, crds []*apiextensionsv1.CustomResourceDefinition) error
// K8sClient returns a Kubernetes clienset for use in automated tests.
K8sClient() kubernetes.Interface
// CtrlClient returns a controller-runtime client for use in automated tests.
CtrlClient() client.Client
// CleanUp removes created resources while installing apps.
CleanUp(ctx context.Context, apps []App) error
// RESTConfig returns a Kubernetes REST config for use in automated tests.
RESTConfig() *rest.Config
}
type App struct {
AppCRName string
AppCRNamespace string
AppOperatorVersion string
CatalogName string
CatalogURL string
ClusterID string
KubeConfig string
Name string
Namespace string
SHA string
ValuesYAML string
Version string
WaitForDeploy bool
}
// schemeBuilder is used to extend the known types of the client-go scheme.
type schemeBuilder []func(*runtime.Scheme) error