View Source
const DefaultNamespace = "namespace"

DefaultNamespace is the namespace that objects will belong to.


This section is empty.


func AssertJSONEqual

func AssertJSONEqual(t *testing.T, expected, actual interface{})

AssertJSONEqual asserts two object's generated JSON is equal.

func CreateAppReplicaSet

func CreateAppReplicaSet(name string) *appsv1.ReplicaSet

CreateAppReplicaSet creates a replica set

func CreateCRD

func CreateCRD(name string, options ...CRDOption) *apiextv1beta1.CustomResourceDefinition

CreateCRD creates a CRD

func CreateClusterRole

func CreateClusterRole(name string) *rbacv1.ClusterRole

CreateClusterRole creates a cluster role.

func CreateClusterRoleBinding

func CreateClusterRoleBinding(name, roleName string, subjects []rbacv1.Subject) *rbacv1.ClusterRoleBinding

CreateClusterRoleBinding creates a cluster role binding

func CreateConfigMap

func CreateConfigMap(name string) *corev1.ConfigMap

CreateConfigMap creates a config map.

func CreateCronJob

func CreateCronJob(name string) *batchv1beta1.CronJob

func CreateCustomResource

func CreateCustomResource(name string) *unstructured.Unstructured

CreateCustomResource creates a custom resource.

func CreateDaemonSet

func CreateDaemonSet(name string) *appsv1.DaemonSet

CreateDaemonSet creates a daemon set

func CreateDeployment

func CreateDeployment(name string, options ...DeploymentOption) *appsv1.Deployment

CreateDeployment creates a deployment

func CreateEvent

func CreateEvent(name string) *corev1.Event

CreateEvent creates a event

func CreateExtReplicaSet

func CreateExtReplicaSet(name string) *extv1beta1.ReplicaSet

CreateExtReplicaSet creates a replica set

func CreateIngress

func CreateIngress(name string) *extv1beta1.Ingress

CreateIngress creates an ingress

func CreateJob

func CreateJob(name string) *batchv1.Job

func CreateNode

func CreateNode(name string) *corev1.Node

func CreatePersistentVolumeClaim

func CreatePersistentVolumeClaim(name string) *corev1.PersistentVolumeClaim

CreatePersistentVolumeClaim creates a persistent volume claim

func CreatePod

func CreatePod(name string, options ...PodOption) *corev1.Pod

CreatePod creates a pod

func CreateReplicationController

func CreateReplicationController(name string) *corev1.ReplicationController

CreateReplicationController creates a replication controller

func CreateRole

func CreateRole(name string) *rbacv1.Role

CreateRole creates a role.

func CreateRoleBinding

func CreateRoleBinding(roleBindingName, roleName string, subjects []rbacv1.Subject) *rbacv1.RoleBinding

func CreateRoleBindingSubject

func CreateRoleBindingSubject(kind, name, namespace string) *rbacv1.Subject

func CreateSecret

func CreateSecret(name string) *corev1.Secret

CreateSecret creates a secret

func CreateService

func CreateService(name string) *corev1.Service

CreateService creates a service

func CreateServiceAccount

func CreateServiceAccount(name string) *corev1.ServiceAccount

CreateServiceAccount creates a service account

func CreateStatefulSet

func CreateStatefulSet(name string) *appsv1.StatefulSet

CreateStatefulSet creates a stateful set

func CreateTimestamp

func CreateTimestamp() *metav1.Time

func LoadObjectFromFile

func LoadObjectFromFile(t *testing.T, objectFile string) runtime.Object

LoadObjectFromFile loads a file from the `testdata` directory. It will assign it a `default` namespace if one is not set.

func LoadTypedObjectFromFile

func LoadTypedObjectFromFile(t *testing.T, objectFile string, into runtime.Object)

LoadTypedObjectFromFile loads a file from the `testdata` directory. It will assign it a `default` namespace if one is not set.

func Time

func Time() time.Time

Time generates a test time

func ToOwnerReferences

func ToOwnerReferences(t *testing.T, object runtime.Object) []metav1.OwnerReference

ToOwnerReferences converts an object to owner references.

func ToUnstructured

func ToUnstructured(t *testing.T, object runtime.Object) *unstructured.Unstructured

ToUnstructured converts an object to an unstructured.

func ToUnstructuredList

func ToUnstructuredList(t *testing.T, objects ...runtime.Object) *unstructured.UnstructuredList

ToUnstructuredList converts a list of objects to a list of unstructured.


type CRDOption

type CRDOption func(definition *apiextv1beta1.CustomResourceDefinition)

CRDOption is an option for configuring CreateCRD.

func WithGenericCRD

func WithGenericCRD() CRDOption

WithGenericCRD creates a crd with group/kind and one version

type DeploymentOption

type DeploymentOption func(d *appsv1.Deployment)

DeploymentOption is an option for configuration CreateDeployment.

func WithGenericDeployment

func WithGenericDeployment() DeploymentOption

type PodOption

type PodOption func(*corev1.Pod)

PodOption is an option for configuring CreatePod.