fake

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnvilAtPath

func AnvilAtPath(path string, opts ...core.MetaMutator) ast.FileObject

AnvilAtPath returns an Anvil Custom Resource.

func CRDClusterConfigObject

func CRDClusterConfigObject(opts ...ClusterConfigMutator) *v1.ClusterConfig

CRDClusterConfigObject initializes a valid CRDClusterConfig.

func Cluster

func Cluster(opts ...core.MetaMutator) ast.FileObject

Cluster returns a K8S Cluster resource in a FileObject.

func ClusterAtPath

func ClusterAtPath(path string, opts ...core.MetaMutator) ast.FileObject

ClusterAtPath returns a Cluster at the specified path.

func ClusterConfigObject

func ClusterConfigObject(opts ...ClusterConfigMutator) *v1.ClusterConfig

ClusterConfigObject initializes a ClusterConfig.

func ClusterObject

func ClusterObject(opts ...core.MetaMutator) *clusterregistry.Cluster

ClusterObject returns a fake Cluster object

func ClusterRole

func ClusterRole(opts ...core.MetaMutator) ast.FileObject

ClusterRole returns an rbacv1 ClusterRole at the specified path.

func ClusterRoleAtPath

func ClusterRoleAtPath(path string, opts ...core.MetaMutator) ast.FileObject

ClusterRoleAtPath returns a ClusterRole at the specified path.

func ClusterRoleBinding

func ClusterRoleBinding(opts ...core.MetaMutator) ast.FileObject

ClusterRoleBinding returns an initialized ClusterRoleBinding.

func ClusterRoleBindingAtPath

func ClusterRoleBindingAtPath(path string, opts ...core.MetaMutator) ast.FileObject

ClusterRoleBindingAtPath returns a ClusterRoleBinding at the specified path.

func ClusterRoleBindingObject

func ClusterRoleBindingObject(opts ...core.MetaMutator) *rbacv1.ClusterRoleBinding

ClusterRoleBindingObject initializes a ClusterRoleBinding.

func ClusterRoleBindingV1Beta1Object

func ClusterRoleBindingV1Beta1Object(opts ...core.MetaMutator) *rbacv1beta1.ClusterRoleBinding

ClusterRoleBindingV1Beta1Object initializes a v1beta1 ClusterRoleBinding.

func ClusterRoleObject

func ClusterRoleObject(opts ...core.MetaMutator) *rbacv1.ClusterRole

ClusterRoleObject returns an rbacv1 ClusterRole.

func ClusterSelector

func ClusterSelector(opts ...core.MetaMutator) ast.FileObject

ClusterSelector returns a Nomos ClusterSelector.

func ClusterSelectorAtPath

func ClusterSelectorAtPath(path string, opts ...core.MetaMutator) ast.FileObject

ClusterSelectorAtPath returns a ClusterSelector at the specified path.

func ClusterSelectorObject

func ClusterSelectorObject(opts ...core.MetaMutator) *v1.ClusterSelector

ClusterSelectorObject initializes a ClusterSelector object.

func ConfigMap

func ConfigMap(opts ...core.MetaMutator) ast.FileObject

ConfigMap returns a ConfigMap with a default file path.

func ConfigMapObject

func ConfigMapObject(opts ...core.MetaMutator) *corev1.ConfigMap

ConfigMapObject returns an initialized ConfigMap.

func ContainerObject

func ContainerObject(name string) *v1.Container

ContainerObject returns an initialized Container.

func CustomResourceDefinitionV1

func CustomResourceDefinitionV1(opts ...core.MetaMutator) ast.FileObject

CustomResourceDefinitionV1 returns a FileObject containing a CustomResourceDefinition at a default path.

func CustomResourceDefinitionV1Beta1

func CustomResourceDefinitionV1Beta1(opts ...core.MetaMutator) ast.FileObject

CustomResourceDefinitionV1Beta1 returns a FileObject containing a CustomResourceDefinition at a default path.

func CustomResourceDefinitionV1Beta1Object

func CustomResourceDefinitionV1Beta1Object(opts ...core.MetaMutator) *v1beta1.CustomResourceDefinition

CustomResourceDefinitionV1Beta1Object returns an initialized CustomResourceDefinition.

func CustomResourceDefinitionV1Beta1Unstructured

func CustomResourceDefinitionV1Beta1Unstructured(opts ...core.MetaMutator) *unstructured.Unstructured

CustomResourceDefinitionV1Beta1Unstructured returns a v1Beta1 CRD as an unstructured

func CustomResourceDefinitionV1Object

func CustomResourceDefinitionV1Object(opts ...core.MetaMutator) *apiextensionsv1.CustomResourceDefinition

CustomResourceDefinitionV1Object returns an initialized CustomResourceDefinition.

func CustomResourceDefinitionV1Unstructured

func CustomResourceDefinitionV1Unstructured(opts ...core.MetaMutator) *unstructured.Unstructured

CustomResourceDefinitionV1Unstructured returns a v1 CRD as an unstructured

func Deployment

func Deployment(dir string, opts ...core.MetaMutator) ast.FileObject

Deployment returns a Deployment in a FileObject.

func DeploymentObject

func DeploymentObject(opts ...core.MetaMutator) *appsv1.Deployment

DeploymentObject initializes a Deployment.

func Error

func Error(code string) status.Error

Error returns a fake error for use in tests which matches errors with the specified KNV code. This is preferable to requiring test authors to specify fields they don't really care about.

func Errors

func Errors(codes ...string) status.MultiError

Errors returns a MultiError consisting of fake errors. For use in unit tests where multiple errors are expected to be returned.

In all cases where a single error is expected, it is safe to use fake.Error instead.

func FileObject

func FileObject(object client.Object, path string) ast.FileObject

FileObject is a shorthand for converting to an ast.FileObject. path is the slash-delimited path from the POLICY_DIR root.

func HierarchyConfig

func HierarchyConfig(opts ...core.MetaMutator) ast.FileObject

HierarchyConfig initializes HierarchyConfig in a FileObject.

func HierarchyConfigAtPath

func HierarchyConfigAtPath(path string, opts ...core.MetaMutator) ast.FileObject

HierarchyConfigAtPath returns a HierarchyConfig at the specified path.

func HierarchyConfigKind

func HierarchyConfigKind(mode v1.HierarchyModeType, gvk schema.GroupVersionKind) core.MetaMutator

HierarchyConfigKind adds a single GVK to a HierarchyConfig.

func HierarchyConfigObject

func HierarchyConfigObject(opts ...core.MetaMutator) *v1.HierarchyConfig

HierarchyConfigObject initializes a HierarchyConfig.

func HierarchyConfigResource

func HierarchyConfigResource(mode v1.HierarchyModeType, gv schema.GroupVersion, kinds ...string) core.MetaMutator

HierarchyConfigResource adds a HierarchyConfigResource to a HierarchyConfig.

func Namespace

func Namespace(dir string, opts ...core.MetaMutator) ast.FileObject

Namespace returns a Namespace FileObject with the passed opts.

namespaceDir is the directory path within namespaces/ to the Namespace. Parses namespacesDir to determine valid default metadata.Name.

func NamespaceAtPath

func NamespaceAtPath(path string, opts ...core.MetaMutator) ast.FileObject

NamespaceAtPath returns a Namespace at exactly the passed path.

func NamespaceConfigObject

func NamespaceConfigObject(opts ...core.MetaMutator) *v1.NamespaceConfig

NamespaceConfigObject initializes a NamespaceConfig.

func NamespaceObject

func NamespaceObject(name string, opts ...core.MetaMutator) *v1.Namespace

NamespaceObject returns an initialized Namespace.

func NamespaceSelector

func NamespaceSelector(opts ...core.MetaMutator) ast.FileObject

NamespaceSelector returns a Nomos NamespaceSelector at a default path.

func NamespaceSelectorAtPath

func NamespaceSelectorAtPath(path string, opts ...core.MetaMutator) ast.FileObject

NamespaceSelectorAtPath returns a NamespaceSelector at the specified path.

func NamespaceSelectorAtPathWithName

func NamespaceSelectorAtPathWithName(path string, name string, opts ...core.MetaMutator) ast.FileObject

NamespaceSelectorAtPathWithName returns a NamespaceSelector at the specified path with the specified name.

func NamespaceSelectorObject

func NamespaceSelectorObject(opts ...core.MetaMutator) *v1.NamespaceSelector

NamespaceSelectorObject returns an initialized NamespaceSelector.

func OwnerReference

func OwnerReference(name string, gvk schema.GroupVersionKind) core.MetaMutator

OwnerReference adds an OwnerReference to the passed Object. Panics if the type does not define metadata.ownerReferences.

func PersistentVolumeObject

func PersistentVolumeObject(opts ...core.MetaMutator) *corev1.PersistentVolume

PersistentVolumeObject returns a PersistentVolume Object.

func PodObject

func PodObject(name string, containers []v1.Container, opts ...core.MetaMutator) *v1.Pod

PodObject returns an initialized Pod.

func Repo

func Repo(opts ...core.MetaMutator) ast.FileObject

Repo returns a default Repo with sensible defaults.

func RepoAtPath

func RepoAtPath(path string, opts ...core.MetaMutator) ast.FileObject

RepoAtPath returns a Repo at a specified path.

func RepoObject

func RepoObject(opts ...core.MetaMutator) *v1.Repo

RepoObject returns an initialized Repo.

func RepoSyncObjectV1Alpha1

func RepoSyncObjectV1Alpha1(ns, name string, opts ...core.MetaMutator) *v1alpha1.RepoSync

RepoSyncObjectV1Alpha1 initializes a RepoSync with version v1alpha1.

func RepoSyncObjectV1Beta1

func RepoSyncObjectV1Beta1(ns, name string, opts ...core.MetaMutator) *v1beta1.RepoSync

RepoSyncObjectV1Beta1 initializes a RepoSync with version v1beta1.

func RepoSyncV1Beta1

func RepoSyncV1Beta1(ns, name string, opts ...core.MetaMutator) ast.FileObject

RepoSyncV1Beta1 returns a K8S RepoSync resource in a FileObject.

func RepoVersion

func RepoVersion(version string) core.MetaMutator

RepoVersion sets the Spec.Version of a Repo.

func ResourceGroupObject

func ResourceGroupObject(opts ...core.MetaMutator) *unstructured.Unstructured

ResourceGroupObject initializes a ResourceGroup.

func ResourceQuotaObject

func ResourceQuotaObject(opts ...core.MetaMutator) *corev1.ResourceQuota

ResourceQuotaObject initializes a ResouceQuota.

func Role

func Role(opts ...core.MetaMutator) ast.FileObject

Role returns a Role with a default file path.

func RoleAtPath

func RoleAtPath(path string, opts ...core.MetaMutator) ast.FileObject

RoleAtPath returns an initialized Role in a FileObject.

func RoleBinding

func RoleBinding(opts ...core.MetaMutator) ast.FileObject

RoleBinding returns an rbacv1 RoleBinding.

func RoleBindingAtPath

func RoleBindingAtPath(path string, opts ...core.MetaMutator) ast.FileObject

RoleBindingAtPath returns a RoleBinding at the specified path.

func RoleBindingObject

func RoleBindingObject(opts ...core.MetaMutator) *rbacv1.RoleBinding

RoleBindingObject initializes a RoleBinding.

func RoleBindingV1Beta1

func RoleBindingV1Beta1(opts ...core.MetaMutator) ast.FileObject

RoleBindingV1Beta1 returns an rbacv1beta1 RoleBinding.

func RoleBindingV1Beta1AtPath

func RoleBindingV1Beta1AtPath(path string, opts ...core.MetaMutator) ast.FileObject

RoleBindingV1Beta1AtPath returns a RoleBinding at the specified path.

func RoleBindingV1Beta1Object

func RoleBindingV1Beta1Object(opts ...core.MetaMutator) *rbacv1beta1.RoleBinding

RoleBindingV1Beta1Object initializes a v1beta1 RoleBinding.

func RoleObject

func RoleObject(opts ...core.MetaMutator) *rbacv1.Role

RoleObject initializes a Role.

func RootSyncObjectV1Alpha1

func RootSyncObjectV1Alpha1(name string, opts ...core.MetaMutator) *v1alpha1.RootSync

RootSyncObjectV1Alpha1 initializes a RootSync.

func RootSyncObjectV1Beta1

func RootSyncObjectV1Beta1(name string, opts ...core.MetaMutator) *v1beta1.RootSync

RootSyncObjectV1Beta1 initializes a RootSync with version v1beta1.

func RootSyncV1Beta1

func RootSyncV1Beta1(name string, opts ...core.MetaMutator) ast.FileObject

RootSyncV1Beta1 returns a K8S RootSync resource in a FileObject.

func SecretObject

func SecretObject(name string, opts ...core.MetaMutator) *corev1.Secret

SecretObject returns an initialized Secret.

func ServiceAccountObject

func ServiceAccountObject(name string, opts ...core.MetaMutator) *corev1.ServiceAccount

ServiceAccountObject returns an initialized ServiceAccount.

func ServiceObject

func ServiceObject(opts ...core.MetaMutator) *corev1.Service

ServiceObject returns a default-initialized Service with the passed opts applied.

func SyncObject

func SyncObject(gk schema.GroupKind, opts ...core.MetaMutator) *v1.Sync

SyncObject returns a Sync configured for a particular

func ToTypeMeta

func ToTypeMeta(gvk schema.GroupVersionKind) metav1.TypeMeta

ToTypeMeta creates the TypeMeta that corresponds to the passed GroupVersionKind.

func Unstructured

func Unstructured(gvk schema.GroupVersionKind, opts ...core.MetaMutator) ast.FileObject

Unstructured initializes an Unstructured.

func UnstructuredAtPath

func UnstructuredAtPath(gvk schema.GroupVersionKind, path string, opts ...core.MetaMutator) ast.FileObject

UnstructuredAtPath returns an Unstructured with the specified gvk.

func UnstructuredObject

func UnstructuredObject(gvk schema.GroupVersionKind, opts ...core.MetaMutator) *unstructured.Unstructured

UnstructuredObject initializes an unstructured.Unstructured.

func WithRepoSyncSourceType

func WithRepoSyncSourceType(sourceType v1beta1.SourceType) core.MetaMutator

WithRepoSyncSourceType sets the sourceType of the RepoSync object.

func WithRootSyncSourceType

func WithRootSyncSourceType(sourceType v1beta1.SourceType) core.MetaMutator

WithRootSyncSourceType sets the sourceType of the RootSync object.

Types

type ClusterConfigMutator

type ClusterConfigMutator func(cc *v1.ClusterConfig)

ClusterConfigMutator mutates a ClusterConfig.

func ClusterConfigMeta

func ClusterConfigMeta(opts ...core.MetaMutator) ClusterConfigMutator

ClusterConfigMeta wraps a MetaMutator for modifying ClusterConfigs.

Jump to

Keyboard shortcuts

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