Documentation
¶
Overview ¶
Reusable testing libraries for testing backends
Index ¶
- Constants
- Variables
- func APITimeoutContext() (context.Context, context.CancelFunc)
- func BasicGetFindSearchTests(t *testing.T, query string, source ResourceSource)
- func GetAllNamespaceNames(cs *kubernetes.Clientset) ([]string, error)
- func GetK8sMeta(s metaV1.Object) map[string]interface{}
- func LabelSelectorToQuery(labelSelector *metaV1.LabelSelector) string
- func ListOptionsToQuery(lo *metaV1.ListOptions) string
- func MapClusterRoleBindingGet(i interface{}) (*sdp.Item, error)
- func MapClusterRoleBindingList(i interface{}) ([]*sdp.Item, error)
- func MapClusterRoleGet(i interface{}) (*sdp.Item, error)
- func MapClusterRoleList(i interface{}) ([]*sdp.Item, error)
- func MapConfigMapGet(i interface{}) (*sdp.Item, error)
- func MapConfigMapList(i interface{}) ([]*sdp.Item, error)
- func MapCronJobGet(i interface{}) (*sdp.Item, error)
- func MapCronJobList(i interface{}) ([]*sdp.Item, error)
- func MapDaemonSetGet(i interface{}) (*sdp.Item, error)
- func MapDaemonSetList(i interface{}) ([]*sdp.Item, error)
- func MapDeploymentGet(i interface{}) (*sdp.Item, error)
- func MapDeploymentList(i interface{}) ([]*sdp.Item, error)
- func MapEndpointGet(i interface{}) (*sdp.Item, error)
- func MapEndpointList(i interface{}) ([]*sdp.Item, error)
- func MapEndpointSliceGet(i interface{}) (*sdp.Item, error)
- func MapEndpointSliceList(i interface{}) ([]*sdp.Item, error)
- func MapHorizontalPodAutoscalerGet(i interface{}) (*sdp.Item, error)
- func MapHorizontalPodAutoscalerList(i interface{}) ([]*sdp.Item, error)
- func MapIngressGet(i interface{}) (*sdp.Item, error)
- func MapIngressList(i interface{}) ([]*sdp.Item, error)
- func MapJobGet(i interface{}) (*sdp.Item, error)
- func MapJobList(i interface{}) ([]*sdp.Item, error)
- func MapLimitRangeGet(i interface{}) (*sdp.Item, error)
- func MapLimitRangeList(i interface{}) ([]*sdp.Item, error)
- func MapNamespaceGet(i interface{}) (*sdp.Item, error)
- func MapNamespaceList(i interface{}) ([]*sdp.Item, error)
- func MapNetworkPolicyGet(i interface{}) (*sdp.Item, error)
- func MapNetworkPolicyList(i interface{}) ([]*sdp.Item, error)
- func MapPVCGet(i interface{}) (*sdp.Item, error)
- func MapPVCList(i interface{}) ([]*sdp.Item, error)
- func MapPersistentVolumeGet(i interface{}) (*sdp.Item, error)
- func MapPersistentVolumeList(i interface{}) ([]*sdp.Item, error)
- func MapPodDisruptionBudgetGet(i interface{}) (*sdp.Item, error)
- func MapPodDisruptionBudgetList(i interface{}) ([]*sdp.Item, error)
- func MapPodGet(i interface{}) (*sdp.Item, error)
- func MapPodList(i interface{}) ([]*sdp.Item, error)
- func MapPriorityClassGet(i interface{}) (*sdp.Item, error)
- func MapPriorityClassList(i interface{}) ([]*sdp.Item, error)
- func MapReplicaSetGet(i interface{}) (*sdp.Item, error)
- func MapReplicaSetList(i interface{}) ([]*sdp.Item, error)
- func MapReplicationControllerGet(i interface{}) (*sdp.Item, error)
- func MapReplicationControllerList(i interface{}) ([]*sdp.Item, error)
- func MapResourceQuotaGet(i interface{}) (*sdp.Item, error)
- func MapResourceQuotaList(i interface{}) ([]*sdp.Item, error)
- func MapRoleBindingGet(i interface{}) (*sdp.Item, error)
- func MapRoleBindingList(i interface{}) ([]*sdp.Item, error)
- func MapRoleGet(i interface{}) (*sdp.Item, error)
- func MapRoleList(i interface{}) ([]*sdp.Item, error)
- func MapSecretGet(i interface{}) (*sdp.Item, error)
- func MapSecretList(i interface{}) ([]*sdp.Item, error)
- func MapServiceAccountGet(i interface{}) (*sdp.Item, error)
- func MapServiceAccountList(i interface{}) ([]*sdp.Item, error)
- func MapServiceGet(i interface{}) (*sdp.Item, error)
- func MapServiceList(i interface{}) ([]*sdp.Item, error)
- func MapStatefulSetGet(i interface{}) (*sdp.Item, error)
- func MapStatefulSetList(i interface{}) ([]*sdp.Item, error)
- func MapStorageClassGet(i interface{}) (*sdp.Item, error)
- func MapStorageClassList(i interface{}) ([]*sdp.Item, error)
- func ObjectReferenceToLIR(ref *coreV1.ObjectReference, parentContext string) *sdp.ItemRequest
- func QueryToListOptions(query string) (metaV1.ListOptions, error)
- func TestValidateItem(t *testing.T, i *sdp.Item)
- func TestValidateItems(t *testing.T, is []*sdp.Item)
- func ThroughJSON(i interface{}) (interface{}, error)
- type ContextDetails
- type NamespaceStorage
- type NamespacedSourceFunction
- type NonNamespacedSourceFunction
- type ResourceSource
- func ClusterRoleBindingSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func ClusterRoleSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func ConfigMapSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func CronJobSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func DaemonSetSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func DeploymentSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func EndpointSliceSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func EndpointSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func HorizontalPodAutoscalerSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func IngressSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func JobSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func LimitRangeSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func NamespaceSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func NetworkPolicySource(cs *kubernetes.Clientset) (ResourceSource, error)
- func NodeSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func PVCSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func PersistentVolumeSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func PodDisruptionBudgetSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func PodSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func PriorityClassSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func ReplicaSetSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func ReplicationControllerSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func ResourceQuotaSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func RoleBindingSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func RoleSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func SecretSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func ServiceAccountSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func ServiceSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func StatefulSetSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func StorageClassSource(cs *kubernetes.Clientset) (ResourceSource, error)
- func (rs *ResourceSource) Contexts() []string
- func (rs *ResourceSource) Find(ctx context.Context, itemContext string) ([]*sdp.Item, error)
- func (rs *ResourceSource) Get(ctx context.Context, itemContext string, name string) (*sdp.Item, error)
- func (rs *ResourceSource) LoadFunction(interfaceFunction interface{}) error
- func (rs *ResourceSource) MapNodeGet(i interface{}) (*sdp.Item, error)
- func (rs *ResourceSource) MapNodeList(i interface{}) ([]*sdp.Item, error)
- func (rs *ResourceSource) Name() string
- func (rs *ResourceSource) Search(ctx context.Context, itemContext string, query string) ([]*sdp.Item, error)
- func (rs *ResourceSource) Type() string
- func (rs *ResourceSource) Weight() int
- type Selector
- type SourceFunction
Constants ¶
const PVCType = "persistentVolumeClaim"
PVCType is the name of the PVC type. I'm saving this as a const since it's a bit nasty and I might want to change it later
Variables ¶
var ClusterName string
ClusterName stores the name of the cluster, this is also used as the context for non-namespaced items. This designed to be user by namespaced items to create linked item requests on non-namespaced items
var ClusterNamespaceRegex = regexp.MustCompile(`(?P<clusterName>.+:.+?)(\.(?P<namespace>[a-z0-9]([-a-z0-9]*[a-z0-9])?))?$`)
ClusterNamespaceRegex matches the cluster name and namespace from a string that is in the format {clusterName}.{namespace}
This is possible due to the fact namespaces have a limited set of characters so we can use a regex to find the last instance of a namespace-compliant string after a trailing
var SourceFunctions = []SourceFunction{ PodSource, ServiceSource, PVCSource, SecretSource, ConfigMapSource, EndpointSource, ServiceAccountSource, LimitRangeSource, ReplicationControllerSource, ResourceQuotaSource, DaemonSetSource, ReplicaSetSource, DeploymentSource, HorizontalPodAutoscalerSource, StatefulSetSource, JobSource, CronJobSource, IngressSource, NetworkPolicySource, PodDisruptionBudgetSource, RoleBindingSource, RoleSource, EndpointSliceSource, NamespaceSource, NodeSource, PersistentVolumeSource, ClusterRoleSource, ClusterRoleBindingSource, StorageClassSource, PriorityClassSource, }
SourceFunctions is the list of functions to load
Functions ¶
func APITimeoutContext ¶
func APITimeoutContext() (context.Context, context.CancelFunc)
APITimeoutContext Returns a context representing the configured timeout for API calls. This is configured in the "apitimeout" setting and is represented in seconds
func BasicGetFindSearchTests ¶
func BasicGetFindSearchTests(t *testing.T, query string, source ResourceSource)
BasicGetFindSearchTests Executes a series of basic tests against a kubernetes source. These tests include:
- Searching with a given query for items
- Grabbing the name of one of the found items and making sure that we can Get() it
- Running a Find() and ensuring that there is > 0 results
func GetAllNamespaceNames ¶
func GetAllNamespaceNames(cs *kubernetes.Clientset) ([]string, error)
GetAllNamespaceNames gets the names of all namespaces that can be found for a given connection
func GetK8sMeta ¶
GetK8sMeta will assign attributes to an existing attributes hash that are taken from Kubernetes ObjectMetadata
func LabelSelectorToQuery ¶
func LabelSelectorToQuery(labelSelector *metaV1.LabelSelector) string
TODO: Rename to LabelSelectorToQuery
func ListOptionsToQuery ¶
func ListOptionsToQuery(lo *metaV1.ListOptions) string
func MapClusterRoleBindingGet ¶
MapClusterRoleBindingGet maps an interface that is underneath a *rbacV1Beta1.ClusterRoleBinding to an item. If the interface isn't actually a *rbacV1Beta1.ClusterRoleBinding this will fail
func MapClusterRoleBindingList ¶
MapClusterRoleBindingList maps an interface that is underneath a *rbacV1Beta1.ClusterRoleBindingList to a list of Items
func MapClusterRoleGet ¶
MapClusterRoleGet maps an interface that is underneath a *rbacV1Beta1.ClusterRole to an item. If the interface isn't actually a *rbacV1Beta1.ClusterRole this will fail
func MapClusterRoleList ¶
MapClusterRoleList maps an interface that is underneath a *rbacV1Beta1.ClusterRoleList to a list of Items
func MapConfigMapGet ¶
MapConfigMapGet maps an interface that is underneath a *coreV1.ConfigMap to an item. If the interface isn't actually a *coreV1.ConfigMap this will fail
func MapConfigMapList ¶
MapConfigMapList maps an interface that is underneath a *coreV1.ConfigMapList to a list of Items
func MapCronJobGet ¶
MapCronJobGet maps an interface that is underneath a *batchV1beta1.CronJob to an item. If the interface isn't actually a *batchV1beta1.CronJob this will fail
func MapCronJobList ¶
MapCronJobList maps an interface that is underneath a *batchV1beta1.CronJobList to a list of Items
func MapDaemonSetGet ¶
MapDaemonSetGet maps an interface that is underneath a *appsV1.DaemonSet to an item. If the interface isn't actually a *appsV1.DaemonSet this will fail
func MapDaemonSetList ¶
MapDaemonSetList maps an interface that is underneath a *appsV1.DaemonSetList to a list of Items
func MapDeploymentGet ¶
MapDeploymentGet maps an interface that is underneath a *appsV1.Deployment to an item. If the interface isn't actually a *appsV1.Deployment this will fail
func MapDeploymentList ¶
MapDeploymentList maps an interface that is underneath a *appsV1.DeploymentList to a list of Items
func MapEndpointGet ¶
MapEndpointGet maps an interface that is underneath a *coreV1.Endpoints to an item. If the interface isn't actually a *coreV1.Endpoints this will fail
func MapEndpointList ¶
MapEndpointList maps an interface that is underneath a *coreV1.EndpointsList to a list of Items
func MapEndpointSliceGet ¶
MapEndpointSliceGet maps an interface that is underneath a *discoveryV1beta1.EndpointSlice to an item. If the interface isn't actually a *discoveryV1beta1.EndpointSlice this will fail
func MapEndpointSliceList ¶
MapEndpointSliceList maps an interface that is underneath a *discoveryV1beta1.EndpointSliceList to a list of Items
func MapHorizontalPodAutoscalerGet ¶
MapHorizontalPodAutoscalerGet maps an interface that is underneath a *autoscalingV1.HorizontalPodAutoscaler to an item. If the interface isn't actually a *autoscalingV1.HorizontalPodAutoscaler this will fail
func MapHorizontalPodAutoscalerList ¶
MapHorizontalPodAutoscalerList maps an interface that is underneath a *autoscalingV1.HorizontalPodAutoscalerList to a list of Items
func MapIngressGet ¶
MapIngressGet maps an interface that is underneath a *networkingV1.Ingress to an item. If the interface isn't actually a *networkingV1.Ingress this will fail
func MapIngressList ¶
MapIngressList maps an interface that is underneath a *networkingV1.IngressList to a list of Items
func MapJobGet ¶
MapJobGet maps an interface that is underneath a *batchV1.Job to an item. If the interface isn't actually a *batchV1.Job this will fail
func MapJobList ¶
MapJobList maps an interface that is underneath a *batchV1.JobList to a list of Items
func MapLimitRangeGet ¶
MapLimitRangeGet maps an interface that is underneath a *coreV1.LimitRange to an item. If the interface isn't actually a *coreV1.LimitRange this will fail
func MapLimitRangeList ¶
MapLimitRangeList maps an interface that is underneath a *coreV1.LimitRangeList to a list of Items
func MapNamespaceGet ¶
MapNamespaceGet maps an interface that is underneath a *coreV1.Namespace to an item. If the interface isn't actually a *coreV1.Namespace this will fail
func MapNamespaceList ¶
MapNamespaceList maps an interface that is underneath a *coreV1.NamespaceList to a list of Items
func MapNetworkPolicyGet ¶
MapNetworkPolicyGet maps an interface that is underneath a *networkingV1.NetworkPolicy to an item. If the interface isn't actually a *networkingV1.NetworkPolicy this will fail
func MapNetworkPolicyList ¶
MapNetworkPolicyList maps an interface that is underneath a *networkingV1.NetworkPolicyList to a list of Items
func MapPVCGet ¶
MapPVCGet maps an interface that is underneath a *coreV1.PersistentVolumeClaim to an item. If the interface isn't actually a *coreV1.PersistentVolumeClaim this will fail
func MapPVCList ¶
MapPVCList maps an interface that is underneath a *coreV1.PersistentVolumeClaimList to a list of Items
func MapPersistentVolumeGet ¶
MapPersistentVolumeGet maps an interface that is underneath a *coreV1.PersistentVolume to an item. If the interface isn't actually a *coreV1.PersistentVolume this will fail
func MapPersistentVolumeList ¶
MapPersistentVolumeList maps an interface that is underneath a *coreV1.PersistentVolumeList to a list of Items
func MapPodDisruptionBudgetGet ¶
MapPodDisruptionBudgetGet maps an interface that is underneath a *policyV1beta1.PodDisruptionBudget to an item. If the interface isn't actually a *policyV1beta1.PodDisruptionBudget this will fail
func MapPodDisruptionBudgetList ¶
MapPodDisruptionBudgetList maps an interface that is underneath a *policyV1beta1.PodDisruptionBudgetList to a list of Items
func MapPodGet ¶
MapPodGet maps an interface that is underneath a *coreV1.Pod to an item. If the interface isn't actually a *coreV1.Pod this will fail
func MapPodList ¶
MapPodList maps an interface that is underneath a *coreV1.PodList to a list of Items
func MapPriorityClassGet ¶
MapPriorityClassGet maps an interface that is underneath a *coreV1.PriorityClass to an item. If the interface isn't actually a *coreV1.PriorityClass this will fail
func MapPriorityClassList ¶
MapPriorityClassList maps an interface that is underneath a *coreV1.PriorityClassList to a list of Items
func MapReplicaSetGet ¶
MapReplicaSetGet maps an interface that is underneath a *appsV1.ReplicaSet to an item. If the interface isn't actually a *appsV1.ReplicaSet this will fail
func MapReplicaSetList ¶
MapReplicaSetList maps an interface that is underneath a *appsV1.ReplicaSetList to a list of Items
func MapReplicationControllerGet ¶
MapReplicationControllerGet maps an interface that is underneath a *coreV1.ReplicationController to an item. If the interface isn't actually a *coreV1.ReplicationController this will fail
func MapReplicationControllerList ¶
MapReplicationControllerList maps an interface that is underneath a *coreV1.ReplicationControllerList to a list of Items
func MapResourceQuotaGet ¶
MapResourceQuotaGet maps an interface that is underneath a *coreV1.ResourceQuota to an item. If the interface isn't actually a *coreV1.ResourceQuota this will fail
func MapResourceQuotaList ¶
MapResourceQuotaList maps an interface that is underneath a *coreV1.ResourceQuotaList to a list of Items
func MapRoleBindingGet ¶
MapRoleBindingGet maps an interface that is underneath a *rbacV1.RoleBinding to an item. If the interface isn't actually a *rbacV1.RoleBinding this will fail
func MapRoleBindingList ¶
MapRoleBindingList maps an interface that is underneath a *rbacV1.RoleBindingList to a list of Items
func MapRoleGet ¶
MapRoleGet maps an interface that is underneath a *rbacV1.Role to an item. If the interface isn't actually a *rbacV1.Role this will fail
func MapRoleList ¶
MapRoleList maps an interface that is underneath a *rbacV1.RoleList to a list of Items
func MapSecretGet ¶
MapSecretGet maps an interface that is underneath a *coreV1.Secret to an item. If the interface isn't actually a *coreV1.Secret this will fail
func MapSecretList ¶
MapSecretList maps an interface that is underneath a *coreV1.SecretList to a list of Items
func MapServiceAccountGet ¶
MapServiceAccountGet maps an interface that is underneath a *coreV1.ServiceAccount to an item. If the interface isn't actually a *coreV1.ServiceAccount this will fail
func MapServiceAccountList ¶
MapServiceAccountList maps an interface that is underneath a *coreV1.ServiceAccountList to a list of Items
func MapServiceGet ¶
MapServiceGet Maps an interface (which is the result of out Get function) to a service item
func MapServiceList ¶
MapServiceList Maps the interface output of our list function to a list of items
func MapStatefulSetGet ¶
MapStatefulSetGet maps an interface that is underneath a *appsV1.StatefulSet to an item. If the interface isn't actually a *appsV1.StatefulSet this will fail
func MapStatefulSetList ¶
MapStatefulSetList maps an interface that is underneath a *appsV1.StatefulSetList to a list of Items
func MapStorageClassGet ¶
MapStorageClassGet maps an interface that is underneath a *storageV1.StorageClass to an item. If the interface isn't actually a *storageV1.StorageClass this will fail
func MapStorageClassList ¶
MapStorageClassList maps an interface that is underneath a *storageV1.StorageClassList to a list of Items
func ObjectReferenceToLIR ¶
func ObjectReferenceToLIR(ref *coreV1.ObjectReference, parentContext string) *sdp.ItemRequest
ObjectReferenceToLIR Converts a K8s ObjectReference to a linked item request. Note that you must provide the parent context (the name of the cluster) since the reference could be an object in a different namespace and therefore context. If the parent context is empty, the context will be assumed to be the same as the current object
func QueryToListOptions ¶
func QueryToListOptions(query string) (metaV1.ListOptions, error)
QueryToListOptions converts a Search() query string to a ListOptions object that can be used to query the API
func TestValidateItem ¶
TestValidateItem Checks an item to ensure it is a valid SDP item. This includes checking that all required attributes are populated
func TestValidateItems ¶
TestValidateItems Runs TestValidateItem on many items
func ThroughJSON ¶
func ThroughJSON(i interface{}) (interface{}, error)
ThroughJSON Converts the object though JSON and back returning an interface with all other type data stripped
Types ¶
type ContextDetails ¶
func ParseContext ¶
func ParseContext(itemContext string) (ContextDetails, error)
ParseContext Parses the custer and context name out of a given SDP context given that the naming convention is {clusterName}.{namespace}
type NamespaceStorage ¶
type NamespaceStorage struct {
CS *kubernetes.Clientset
CacheDuration time.Duration
// contains filtered or unexported fields
}
NamespaceStorage is an object that is used for storing the list of namespaces. Many of the non-namespaced resources will need to know what thee list of namespaces is in order for them to create LinkedItemRequests. This object stores them to ensure that we don't unnecessarily spam the API
func (*NamespaceStorage) Namespaces ¶
func (ns *NamespaceStorage) Namespaces() ([]string, error)
Namespaces returns the list of namespaces, updating if required
type NamespacedSourceFunction ¶
type NamespacedSourceFunction func(cs *kubernetes.Clientset) ResourceSource
NamespacedSourceFunction is a function that accepts a kubernetes client and namespace, and returns a ResourceSource for a given type. This also satisfies the Backend interface
type NonNamespacedSourceFunction ¶
type NonNamespacedSourceFunction func(cs *kubernetes.Clientset) ResourceSource
NonNamespacedSourceFunction is a function that accepts a kubernetes client and returns a ResourceSource for a given type. This also satisfies the Backend interface
type ResourceSource ¶
type ResourceSource struct {
// The type of items that will be returned from this source
ItemType string
// A function that will accept an interface and return a list of items. The
// interface that is passed will be the first item returned from
// "listFunction", as an interface. The function should covert this to
// whatever format it is expecting, the proceed to map to Items
MapList func(interface{}) ([]*sdp.Item, error)
// A function that will accept an interface and return an item. The
// interface that is passed will be the first item returned from
// "getFunction", as an interface. The function should covert this to
// whatever format it is expecting, the proceed to map to an item
MapGet func(interface{}) (*sdp.Item, error)
// Whether or not this source is for namespaced resources
Namespaced bool
// NSS Namespace storage for when backends need to lookup the list of
// namespaces
NSS *NamespaceStorage
// contains filtered or unexported fields
}
ResourceSource represents a source of Kubernetes resources. one of these sources needs to be created, and then have its get and list functions registered by calling the LoadFunctions method. Note that in order for this to be able to discover any time of Kubernetes resource it uses as significant amount of reflection. The LoadFunctions method should do enough error checking to ensure that the methods on this struct don't cause any panics, but there is still a very real chance that there will be panics so be careful doing anything non-standard with this struct
func ClusterRoleBindingSource ¶
func ClusterRoleBindingSource(cs *kubernetes.Clientset) (ResourceSource, error)
ClusterRoleBindingSource returns a ResourceSource for ClusterRoleBindingClaims for a given client
func ClusterRoleSource ¶
func ClusterRoleSource(cs *kubernetes.Clientset) (ResourceSource, error)
ClusterRoleSource returns a ResourceSource for ClusterRoleClaims for a given client
func ConfigMapSource ¶
func ConfigMapSource(cs *kubernetes.Clientset) (ResourceSource, error)
ConfigMapSource returns a ResourceSource for PersistentVolumeClaims for a given client and namespace
func CronJobSource ¶
func CronJobSource(cs *kubernetes.Clientset) (ResourceSource, error)
CronJobSource returns a ResourceSource for PersistentVolumeClaims for a given client and namespace
func DaemonSetSource ¶
func DaemonSetSource(cs *kubernetes.Clientset) (ResourceSource, error)
DaemonSetSource returns a ResourceSource for PersistentVolumeClaims for a given client and namespace
func DeploymentSource ¶
func DeploymentSource(cs *kubernetes.Clientset) (ResourceSource, error)
DeploymentSource returns a ResourceSource for PersistentVolumeClaims for a given client and namespace
func EndpointSliceSource ¶
func EndpointSliceSource(cs *kubernetes.Clientset) (ResourceSource, error)
EndpointSliceSource returns a ResourceSource for PersistentVolumeClaims for a given client and namespace
func EndpointSource ¶
func EndpointSource(cs *kubernetes.Clientset) (ResourceSource, error)
EndpointSource returns a ResourceSource for PersistentVolumeClaims for a given client and namespace
func HorizontalPodAutoscalerSource ¶
func HorizontalPodAutoscalerSource(cs *kubernetes.Clientset) (ResourceSource, error)
HorizontalPodAutoscalerSource returns a ResourceSource for PersistentVolumeClaims for a given client and namespace
func IngressSource ¶
func IngressSource(cs *kubernetes.Clientset) (ResourceSource, error)
IngressSource returns a ResourceSource for PersistentVolumeClaims for a given client and namespace
func JobSource ¶
func JobSource(cs *kubernetes.Clientset) (ResourceSource, error)
JobSource returns a ResourceSource for PersistentVolumeClaims for a given client and namespace
func LimitRangeSource ¶
func LimitRangeSource(cs *kubernetes.Clientset) (ResourceSource, error)
LimitRangeSource returns a ResourceSource for PersistentVolumeClaims for a given client and namespace
func NamespaceSource ¶
func NamespaceSource(cs *kubernetes.Clientset) (ResourceSource, error)
NamespaceSource returns a ResourceSource for PersistentVolumeClaims for a given client and namespace
func NetworkPolicySource ¶
func NetworkPolicySource(cs *kubernetes.Clientset) (ResourceSource, error)
NetworkPolicySource returns a ResourceSource for PersistentVolumeClaims for a given client and namespace
func NodeSource ¶
func NodeSource(cs *kubernetes.Clientset) (ResourceSource, error)
NodeSource returns a ResourceSource for PersistentVolumeClaims for a given client
func PVCSource ¶
func PVCSource(cs *kubernetes.Clientset) (ResourceSource, error)
PVCSource returns a ResourceSource for PersistentVolumeClaims for a given client and namespace
func PersistentVolumeSource ¶
func PersistentVolumeSource(cs *kubernetes.Clientset) (ResourceSource, error)
PersistentVolumeSource returns a ResourceSource for PersistentVolumeClaims for a given client
func PodDisruptionBudgetSource ¶
func PodDisruptionBudgetSource(cs *kubernetes.Clientset) (ResourceSource, error)
PodDisruptionBudgetSource returns a ResourceSource for PersistentVolumeClaims for a given client and namespace
func PodSource ¶
func PodSource(cs *kubernetes.Clientset) (ResourceSource, error)
PodSource returns a ResourceSource for Pods for a given client and namespace
func PriorityClassSource ¶
func PriorityClassSource(cs *kubernetes.Clientset) (ResourceSource, error)
PriorityClassSource returns a ResourceSource for PriorityClassClaims for a given client
func ReplicaSetSource ¶
func ReplicaSetSource(cs *kubernetes.Clientset) (ResourceSource, error)
ReplicaSetSource returns a ResourceSource for PersistentVolumeClaims for a given client and namespace
func ReplicationControllerSource ¶
func ReplicationControllerSource(cs *kubernetes.Clientset) (ResourceSource, error)
ReplicationControllerSource returns a ResourceSource for PersistentVolumeClaims for a given client and namespace
func ResourceQuotaSource ¶
func ResourceQuotaSource(cs *kubernetes.Clientset) (ResourceSource, error)
ResourceQuotaSource returns a ResourceSource for PersistentVolumeClaims for a given client and namespace
func RoleBindingSource ¶
func RoleBindingSource(cs *kubernetes.Clientset) (ResourceSource, error)
RoleBindingSource returns a ResourceSource for PersistentVolumeClaims for a given client and namespace
func RoleSource ¶
func RoleSource(cs *kubernetes.Clientset) (ResourceSource, error)
RoleSource returns a ResourceSource for PersistentVolumeClaims for a given client and namespace
func SecretSource ¶
func SecretSource(cs *kubernetes.Clientset) (ResourceSource, error)
SecretSource returns a ResourceSource for PersistentVolumeClaims for a given client and namespace
Secret Sauce ¶
* 1/4 cup salad dressing (like Miracle Whip) * 1/4 cup mayonnaise * 3 tablespoons French salad dressing (Wishbone brand) * 1/2 tablespoon sweet pickle relish (Heinz brand) * 1 1/2 tablespoons dill pickle relish (Vlasic or Heinz brand) * 1 teaspoon sugar * 1 teaspoon dried minced onion * 1 teaspoon white vinegar * 1 teaspoon ketchup * 1/8 teaspoon salt
func ServiceAccountSource ¶
func ServiceAccountSource(cs *kubernetes.Clientset) (ResourceSource, error)
ServiceAccountSource returns a ResourceSource for PersistentVolumeClaims for a given client and namespace
func ServiceSource ¶
func ServiceSource(cs *kubernetes.Clientset) (ResourceSource, error)
ServiceSource returns a ResourceSource for Pods for a given client and namespace
func StatefulSetSource ¶
func StatefulSetSource(cs *kubernetes.Clientset) (ResourceSource, error)
StatefulSetSource returns a ResourceSource for PersistentVolumeClaims for a given client and namespace
func StorageClassSource ¶
func StorageClassSource(cs *kubernetes.Clientset) (ResourceSource, error)
StorageClassSource returns a ResourceSource for StorageClassClaims for a given client
func (*ResourceSource) Contexts ¶
func (rs *ResourceSource) Contexts() []string
Context Returns the list of contexts that this source is capable of findinf items for. This is usually the name of the cluster, plus any namespaces in the format {clusterName}.{namespace}
func (*ResourceSource) Find ¶
Find finds all items that the backend possibly can. It maybe be possible that this might not be an exhaustive list though in the case of kubernetes it is unlikely
func (*ResourceSource) Get ¶
func (rs *ResourceSource) Get(ctx context.Context, itemContext string, name string) (*sdp.Item, error)
Get takes the UniqueAttribute value as a parameter (also referred to as the "name" of the item) and returns a full item will all details. This function must return an item whose UniqueAttribute value exactly matches the supplied parameter. If the item cannot be found it should return an ItemNotFoundError (Required)
func (*ResourceSource) LoadFunction ¶
func (rs *ResourceSource) LoadFunction(interfaceFunction interface{}) error
LoadFunctions performs validation on the supplied interface function. This function should retrun an interface which has Get() and List() methods
A Get should be:
func(ctx context.Context, name string, opts metaV1.GetOptions)
A List should be:
List(ctx context.Context, opts metaV1.ListOptions)
func (*ResourceSource) MapNodeGet ¶
func (rs *ResourceSource) MapNodeGet(i interface{}) (*sdp.Item, error)
MapNodeGet maps an interface that is underneath a *coreV1.Node to an item. If the interface isn't actually a *coreV1.Node this will fail
func (*ResourceSource) MapNodeList ¶
func (rs *ResourceSource) MapNodeList(i interface{}) ([]*sdp.Item, error)
MapNodeList maps an interface that is underneath a *coreV1.NodeList to a list of Items
func (*ResourceSource) Name ¶
func (rs *ResourceSource) Name() string
Name returns a descriptive name for the source, used in logging and metadata
func (*ResourceSource) Search ¶
func (rs *ResourceSource) Search(ctx context.Context, itemContext string, query string) ([]*sdp.Item, error)
Search This search for items that match a given ListOptions. The query must be provided as a JSON object that can be cast to a [ListOptions](https://pkg.go.dev/k8s.io/apimachinery/pkg/apis/meta/v1#ListOptions) object.
*Note:* Additional changes will be made to the ListOptions object after deserialization such as limiting the scope to items of the same type as the current ResourceSource, and drooping any options such as "Watch"
func (*ResourceSource) Type ¶
func (rs *ResourceSource) Type() string
Type is the type of items that this returns (Required)
func (*ResourceSource) Weight ¶
func (rs *ResourceSource) Weight() int
Weight The weight of this source, used for conflict resolution. Currently returns a static value of 100
type SourceFunction ¶
type SourceFunction func(cs *kubernetes.Clientset) (ResourceSource, error)
SourceFunction is a function that accepts a kubernetes client and returns a ResourceSource for a given type. This also satisfies the discovery.Source interface
Source Files
¶
- clusterrole.go
- clusterrolebinding.go
- configmap.go
- cronjob.go
- daemonset.go
- deployment.go
- endpoint.go
- endpointslice.go
- horizontalpodautoscaler.go
- ingress.go
- job.go
- limitrange.go
- namespace.go
- networkpolicy.go
- node.go
- persistentvolume.go
- poddisruptionbudget.go
- pods.go
- priorityclass.go
- pvc.go
- replicaset.go
- replicationcontroller.go
- resourcequota.go
- role.go
- rolebinding.go
- secret.go
- service.go
- serviceaccount.go
- shared_api.go
- shared_namespacestorage.go
- shared_resourcesource.go
- shared_tests.go
- shared_util.go
- statefulset.go
- storageclass.go