kubetest

package
v1.65.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2023 License: Apache-2.0 Imports: 30 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FakeIstioAnnotations added in v0.15.0

func FakeIstioAnnotations() map[string]string

func FakeNamespace added in v0.11.0

func FakeNamespace(name string) *core_v1.Namespace

func FakePodList added in v0.11.0

func FakePodList() []core_v1.Pod

func FakeService added in v0.11.0

func FakeService(namespace, name string) core_v1.Service

Types

type FakeK8sClient added in v1.62.0

type FakeK8sClient struct {
	OpenShift         bool
	GatewayAPIEnabled bool
	kialikube.ClientInterface

	// Underlying kubernetes clientset.
	KubeClientset kubernetes.Interface
	// Underlying istio clientset.
	IstioClientset istio.Interface
	// Underlying gateway api clientset.
	GatewayAPIClientset gatewayapi.Interface
	// Token is the kiali token this client uses.
	Token string
	// contains filtered or unexported fields
}

FakeK8sClient is an implementation of the kiali Kubernetes client interface used for tests.

func NewFakeK8sClient added in v1.62.0

func NewFakeK8sClient(objects ...runtime.Object) *FakeK8sClient

func (*FakeK8sClient) GetDeploymentConfig added in v1.62.0

func (c *FakeK8sClient) GetDeploymentConfig(namespace string, name string) (*osapps_v1.DeploymentConfig, error)

func (*FakeK8sClient) GetDeploymentConfigs added in v1.62.0

func (c *FakeK8sClient) GetDeploymentConfigs(namespace string) ([]osapps_v1.DeploymentConfig, error)

func (*FakeK8sClient) GetProject added in v1.62.0

func (c *FakeK8sClient) GetProject(name string) (*osproject_v1.Project, error)

The openshift resources are stubbed out because Kiali talks directly to the kube api for these instead of using the openshift client-go.

func (*FakeK8sClient) GetProjects added in v1.62.0

func (c *FakeK8sClient) GetProjects(labelSelector string) ([]osproject_v1.Project, error)

The openshift resources are stubbed out because Kiali talks directly to the kube api for these instead of using the openshift client-go.

func (*FakeK8sClient) GetToken added in v1.64.0

func (c *FakeK8sClient) GetToken() string

func (*FakeK8sClient) IsGatewayAPI added in v1.62.0

func (c *FakeK8sClient) IsGatewayAPI() bool

func (*FakeK8sClient) IsOpenShift added in v1.62.0

func (c *FakeK8sClient) IsOpenShift() bool

type K8SClientFactoryMock added in v0.16.0

type K8SClientFactoryMock struct {
	Clients map[string]kubernetes.ClientInterface
	// contains filtered or unexported fields
}

func NewK8SClientFactoryMock added in v0.16.0

func NewK8SClientFactoryMock(k8s kubernetes.ClientInterface) *K8SClientFactoryMock

Constructor

func (*K8SClientFactoryMock) GetClient added in v0.17.0

func (o *K8SClientFactoryMock) GetClient(authInfo *api.AuthInfo) (kubernetes.ClientInterface, error)

Business Methods

func (*K8SClientFactoryMock) GetClusterNames added in v1.64.0

func (o *K8SClientFactoryMock) GetClusterNames() []string

func (*K8SClientFactoryMock) GetSAClient added in v1.64.0

func (o *K8SClientFactoryMock) GetSAClient(cluster string) kubernetes.ClientInterface

func (*K8SClientFactoryMock) GetSAHomeClusterClient added in v1.64.0

func (o *K8SClientFactoryMock) GetSAHomeClusterClient() kubernetes.ClientInterface

func (*K8SClientFactoryMock) SetClients added in v1.64.0

func (o *K8SClientFactoryMock) SetClients(clients map[string]kubernetes.ClientInterface)

Testing specific methods

type K8SClientMock

type K8SClientMock struct {
	mock.Mock
	// contains filtered or unexported fields
}

func NewK8SClientMock added in v0.8.0

func NewK8SClientMock() *K8SClientMock

func (*K8SClientMock) CanConnectToIstiod added in v1.59.0

func (o *K8SClientMock) CanConnectToIstiod() (kubernetes.IstioComponentStatus, error)

func (*K8SClientMock) GatewayAPI added in v1.57.0

func (o *K8SClientMock) GatewayAPI() gatewayapiclient.Interface

func (*K8SClientMock) GetAuthInfo added in v1.29.0

func (o *K8SClientMock) GetAuthInfo() *api.AuthInfo

GetAuthInfo returns the AuthInfo struct for the client

func (*K8SClientMock) GetClusterNames added in v1.64.0

func (o *K8SClientMock) GetClusterNames() []string

func (*K8SClientMock) GetClusterServicesByLabels added in v1.34.1

func (o *K8SClientMock) GetClusterServicesByLabels(labelsSelector string) ([]core_v1.Service, error)

func (*K8SClientMock) GetConfigDump added in v1.28.0

func (o *K8SClientMock) GetConfigDump(namespace string, podName string) (*kubernetes.ConfigDump, error)

func (*K8SClientMock) GetConfigMap added in v1.17.0

func (o *K8SClientMock) GetConfigMap(namespace, name string) (*core_v1.ConfigMap, error)

func (*K8SClientMock) GetCronJobs added in v0.9.0

func (o *K8SClientMock) GetCronJobs(namespace string) ([]batch_v1.CronJob, error)

func (*K8SClientMock) GetDaemonSet added in v1.33.0

func (o *K8SClientMock) GetDaemonSet(namespace string, name string) (*apps_v1.DaemonSet, error)

func (*K8SClientMock) GetDaemonSets added in v1.33.0

func (o *K8SClientMock) GetDaemonSets(namespace string) ([]apps_v1.DaemonSet, error)

func (*K8SClientMock) GetDeployment added in v0.6.0

func (o *K8SClientMock) GetDeployment(namespace string, name string) (*apps_v1.Deployment, error)

func (*K8SClientMock) GetDeploymentConfig added in v0.9.0

func (o *K8SClientMock) GetDeploymentConfig(namespace string, name string) (*osapps_v1.DeploymentConfig, error)

func (*K8SClientMock) GetDeploymentConfigs added in v0.9.0

func (o *K8SClientMock) GetDeploymentConfigs(namespace string) ([]osapps_v1.DeploymentConfig, error)

func (*K8SClientMock) GetDeployments added in v0.6.0

func (o *K8SClientMock) GetDeployments(namespace string) ([]apps_v1.Deployment, error)

func (*K8SClientMock) GetDeploymentsByLabel added in v0.20.0

func (o *K8SClientMock) GetDeploymentsByLabel(namespace string, labelSelector string) ([]apps_v1.Deployment, error)

func (*K8SClientMock) GetEndpoints added in v0.8.0

func (o *K8SClientMock) GetEndpoints(namespace string, name string) (*core_v1.Endpoints, error)

func (*K8SClientMock) GetJobs added in v0.9.0

func (o *K8SClientMock) GetJobs(namespace string) ([]batch_v1.Job, error)

func (*K8SClientMock) GetNamespace added in v0.9.1

func (o *K8SClientMock) GetNamespace(namespace string) (*core_v1.Namespace, error)

func (*K8SClientMock) GetNamespaces

func (o *K8SClientMock) GetNamespaces(labelSelector string) ([]core_v1.Namespace, error)

func (*K8SClientMock) GetPod added in v0.18.0

func (o *K8SClientMock) GetPod(namespace, name string) (*core_v1.Pod, error)

func (*K8SClientMock) GetPods

func (o *K8SClientMock) GetPods(namespace, labelSelector string) ([]core_v1.Pod, error)

func (*K8SClientMock) GetProject added in v0.9.1

func (o *K8SClientMock) GetProject(project string) (*osproject_v1.Project, error)

func (*K8SClientMock) GetProjects added in v0.8.0

func (o *K8SClientMock) GetProjects(labelSelector string) ([]osproject_v1.Project, error)

func (*K8SClientMock) GetProxyStatus added in v1.25.0

func (o *K8SClientMock) GetProxyStatus() ([]*kubernetes.ProxyStatus, error)

func (*K8SClientMock) GetRegistryConfiguration added in v1.44.0

func (o *K8SClientMock) GetRegistryConfiguration() (*kubernetes.RegistryConfiguration, error)

func (*K8SClientMock) GetRegistryEndpoints added in v1.44.0

func (o *K8SClientMock) GetRegistryEndpoints() ([]*kubernetes.RegistryEndpoint, error)

func (*K8SClientMock) GetRegistryServices added in v1.44.0

func (o *K8SClientMock) GetRegistryServices() ([]*kubernetes.RegistryService, error)

func (*K8SClientMock) GetReplicaSets added in v0.9.0

func (o *K8SClientMock) GetReplicaSets(namespace string) ([]apps_v1.ReplicaSet, error)

func (*K8SClientMock) GetReplicationControllers added in v0.9.0

func (o *K8SClientMock) GetReplicationControllers(namespace string) ([]core_v1.ReplicationController, error)

func (*K8SClientMock) GetRoute added in v0.20.0

func (o *K8SClientMock) GetRoute(namespace, name string) (*osroutes_v1.Route, error)

func (*K8SClientMock) GetSecret added in v1.40.0

func (o *K8SClientMock) GetSecret(namespace, name string) (*core_v1.Secret, error)

func (*K8SClientMock) GetSecrets added in v1.29.0

func (o *K8SClientMock) GetSecrets(namespace string, labelSelector string) ([]core_v1.Secret, error)

func (*K8SClientMock) GetSelfSubjectAccessReview added in v0.9.1

func (o *K8SClientMock) GetSelfSubjectAccessReview(ctx context.Context, namespace, api, resourceType string, verbs []string) ([]*auth_v1.SelfSubjectAccessReview, error)

func (*K8SClientMock) GetServerVersion added in v0.20.0

func (o *K8SClientMock) GetServerVersion() (*version.Info, error)

func (*K8SClientMock) GetService

func (o *K8SClientMock) GetService(namespace string, name string) (*core_v1.Service, error)

func (*K8SClientMock) GetServices

func (o *K8SClientMock) GetServices(namespace string, selectorLabels map[string]string) ([]core_v1.Service, error)

func (*K8SClientMock) GetServicesByLabels added in v1.31.0

func (o *K8SClientMock) GetServicesByLabels(namespace string, labelsSelector string) ([]core_v1.Service, error)

func (*K8SClientMock) GetStatefulSet added in v0.9.0

func (o *K8SClientMock) GetStatefulSet(namespace string, name string) (*apps_v1.StatefulSet, error)

func (*K8SClientMock) GetStatefulSets added in v0.9.0

func (o *K8SClientMock) GetStatefulSets(namespace string) ([]apps_v1.StatefulSet, error)

func (*K8SClientMock) GetToken added in v1.9.0

func (o *K8SClientMock) GetToken() string

func (*K8SClientMock) GetTokenSubject added in v1.29.0

func (o *K8SClientMock) GetTokenSubject(authInfo *api.AuthInfo) (string, error)

GetTokenSubject returns the subject of the authInfo using the TokenReview api

func (*K8SClientMock) IsGatewayAPI added in v1.57.0

func (o *K8SClientMock) IsGatewayAPI() bool

func (*K8SClientMock) IsMaistraApi added in v1.0.4

func (o *K8SClientMock) IsMaistraApi() bool

func (*K8SClientMock) IsOpenShift added in v0.8.0

func (o *K8SClientMock) IsOpenShift() bool

func (*K8SClientMock) Istio added in v1.42.0

func (o *K8SClientMock) Istio() istio.Interface

func (*K8SClientMock) Kube added in v1.64.0

func (*K8SClientMock) MockEmptyWorkload added in v0.15.0

func (o *K8SClientMock) MockEmptyWorkload(namespace interface{}, workload interface{})

MockEmptyWorkload setup the current mock to return an empty workload for every type of workloads (deployment, dc, rs, jobs, etc.)

func (*K8SClientMock) MockEmptyWorkloads added in v0.15.0

func (o *K8SClientMock) MockEmptyWorkloads(namespace interface{})

MockEmptyWorkloads setup the current mock to return empty workloads for every type of workloads (deployment, dc, rs, jobs, etc.)

func (*K8SClientMock) MockGatewayApi added in v1.57.0

func (o *K8SClientMock) MockGatewayApi(objects ...runtime.Object)

func (*K8SClientMock) MockIstio added in v1.42.0

func (o *K8SClientMock) MockIstio(objects ...runtime.Object)

func (*K8SClientMock) MockService added in v0.16.0

func (o *K8SClientMock) MockService(namespace, name string)

func (*K8SClientMock) MockServices added in v0.16.0

func (o *K8SClientMock) MockServices(namespace string, names []string)

func (*K8SClientMock) SetProxyLogLevel added in v1.41.0

func (o *K8SClientMock) SetProxyLogLevel(namespace, podName, level string) error

func (*K8SClientMock) StreamPodLogs added in v1.53.0

func (o *K8SClientMock) StreamPodLogs(namespace, name string, opts *core_v1.PodLogOptions) (io.ReadCloser, error)

func (*K8SClientMock) UpdateNamespace added in v1.22.1

func (o *K8SClientMock) UpdateNamespace(namespace string, jsonPatch string) (*core_v1.Namespace, error)

func (*K8SClientMock) UpdateProject added in v1.22.1

func (o *K8SClientMock) UpdateProject(project string, jsonPatch string) (*osproject_v1.Project, error)

func (*K8SClientMock) UpdateService added in v1.30.0

func (o *K8SClientMock) UpdateService(namespace string, name string, jsonPatch string, patchType string) error

func (*K8SClientMock) UpdateWorkload added in v1.22.0

func (o *K8SClientMock) UpdateWorkload(namespace string, name string, workloadType string, jsonPatch string, patchType string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL