Documentation ¶
Index ¶
- Constants
- func EndpointsExtractor(resource *v1.Endpoints, scope string) ([]*sdp.LinkedItemQuery, error)
- func LabelSelectorToQuery(labelSelector *metav1.LabelSelector) string
- func ListOptionsToQuery(lo *metav1.ListOptions) string
- func LoadAllSources(cs *kubernetes.Clientset, cluster string, namespaces []string) []discovery.Source
- func NetworkPolicyExtractor(resource *v1.NetworkPolicy, scope string) ([]*sdp.LinkedItemQuery, error)
- func ObjectReferenceToQuery(ref *corev1.ObjectReference, parentScope ScopeDetails, ...) *sdp.LinkedItemQuery
- func PersistentVolumeClaimExtractor(resource *v1.PersistentVolumeClaim, scope string) ([]*sdp.LinkedItemQuery, error)
- func PersistentVolumeExtractor(resource *v1.PersistentVolume, scope string) ([]*sdp.LinkedItemQuery, error)
- func PodExtractor(resource *v1.Pod, scope string) ([]*sdp.LinkedItemQuery, error)
- func QueryToListOptions(query string) (metav1.ListOptions, error)
- type ClusterInterfaceBuilder
- type ItemInterface
- type KubeTypeSource
- func (s *KubeTypeSource[Resource, ResourceList]) Cache() *sdpcache.Cache
- func (s *KubeTypeSource[Resource, ResourceList]) Get(ctx context.Context, scope string, query string, ignoreCache bool) (*sdp.Item, error)
- func (s *KubeTypeSource[Resource, ResourceList]) List(ctx context.Context, scope string, ignoreCache bool) ([]*sdp.Item, error)
- func (s *KubeTypeSource[Resource, ResourceList]) Name() string
- func (s *KubeTypeSource[Resource, ResourceList]) Scopes() []string
- func (s *KubeTypeSource[Resource, ResourceList]) Search(ctx context.Context, scope string, query string, ignoreCache bool) ([]*sdp.Item, error)
- func (s *KubeTypeSource[Resource, ResourceList]) Type() string
- func (s *KubeTypeSource[Resource, ResourceList]) Validate() error
- func (s *KubeTypeSource[Resource, ResourceList]) Weight() int
- type NamespacedInterfaceBuilder
- type ScopeDetails
- type Selector
- type SourceLoader
Constants ¶
const DefaultCacheDuration = 30 * time.Minute
Variables ¶
This section is empty.
Functions ¶
func EndpointsExtractor ¶
func LabelSelectorToQuery ¶
func LabelSelectorToQuery(labelSelector *metav1.LabelSelector) string
LabelSelectorToQuery converts a LabelSelector to JSON so that it can be passed to a SEARCH query
func ListOptionsToQuery ¶
func ListOptionsToQuery(lo *metav1.ListOptions) string
func LoadAllSources ¶
func NetworkPolicyExtractor ¶
func NetworkPolicyExtractor(resource *v1.NetworkPolicy, scope string) ([]*sdp.LinkedItemQuery, error)
func ObjectReferenceToQuery ¶
func ObjectReferenceToQuery(ref *corev1.ObjectReference, parentScope ScopeDetails, blastProp *sdp.BlastPropagation) *sdp.LinkedItemQuery
ObjectReferenceToQuery Converts a K8s ObjectReference to a linked item request. Note that you must provide the parent scope since the reference could be an object in a different namespace, if it is we need to re-use the cluster name from the parent scope
func PersistentVolumeClaimExtractor ¶ added in v0.3.3
func PersistentVolumeClaimExtractor(resource *v1.PersistentVolumeClaim, scope string) ([]*sdp.LinkedItemQuery, error)
func PersistentVolumeExtractor ¶
func PersistentVolumeExtractor(resource *v1.PersistentVolume, scope string) ([]*sdp.LinkedItemQuery, error)
func PodExtractor ¶
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
Types ¶
type ClusterInterfaceBuilder ¶
type ClusterInterfaceBuilder[Resource metav1.Object, ResourceList any] func() ItemInterface[Resource, ResourceList]
ClusterInterfaceBuilder The function that create a client to query a cluster-wide resource. e.g. `CoreV1().Nodes`
type ItemInterface ¶
type ItemInterface[Resource metav1.Object, ResourceList any] interface { Get(ctx context.Context, name string, opts metav1.GetOptions) (Resource, error) List(ctx context.Context, opts metav1.ListOptions) (ResourceList, error) }
ItemInterface An interface that matches the `Get` and `List` methods for K8s resources since these are the ones that we use for getting Overmind data. Kube's clients are usually namespaced when they are created, so this interface is expected to only returns items from a single namespace
type KubeTypeSource ¶
type KubeTypeSource[Resource metav1.Object, ResourceList any] struct { // The function that creates a client to query a namespaced resource. e.g. // `CoreV1().Pods`. Either this or `NamespacedInterfaceBuilder` must be // specified ClusterInterfaceBuilder ClusterInterfaceBuilder[Resource, ResourceList] // The function that creates a client to query a cluster-wide resource. e.g. // `CoreV1().Nodes`. Either this or `ClusterInterfaceBuilder` must be // specified NamespacedInterfaceBuilder NamespacedInterfaceBuilder[Resource, ResourceList] // A function that extracts a slice of Resources from a ResourceList ListExtractor func(ResourceList) ([]Resource, error) // A function that returns a list of linked item queries for a given // resource and scope LinkedItemQueryExtractor func(resource Resource, scope string) ([]*sdp.LinkedItemQuery, error) // A function that extracts health from the resource, this is optional HealthExtractor func(resource Resource) *sdp.Health // A function that redacts sensitive data from the resource, this is // optional Redact func(resource Resource) Resource // The type of items that this source should return. This should be the // "Kind" of the kubernetes resources, e.g. "Pod", "Node", "ServiceAccount" TypeName string // List of namespaces that this source should query Namespaces []string // The name of the cluster that this source is for. This is used to generate // scopes ClusterName string CacheDuration time.Duration // How long to cache items for // contains filtered or unexported fields }
func (*KubeTypeSource[Resource, ResourceList]) Cache ¶ added in v0.5.4
func (s *KubeTypeSource[Resource, ResourceList]) Cache() *sdpcache.Cache
func (*KubeTypeSource[Resource, ResourceList]) Name ¶
func (s *KubeTypeSource[Resource, ResourceList]) Name() string
func (*KubeTypeSource[Resource, ResourceList]) Scopes ¶
func (s *KubeTypeSource[Resource, ResourceList]) Scopes() []string
func (*KubeTypeSource[Resource, ResourceList]) Type ¶
func (s *KubeTypeSource[Resource, ResourceList]) Type() string
func (*KubeTypeSource[Resource, ResourceList]) Validate ¶
func (s *KubeTypeSource[Resource, ResourceList]) Validate() error
validate Validates that the source is correctly set up
func (*KubeTypeSource[Resource, ResourceList]) Weight ¶
func (s *KubeTypeSource[Resource, ResourceList]) Weight() int
type NamespacedInterfaceBuilder ¶
type NamespacedInterfaceBuilder[Resource metav1.Object, ResourceList any] func(namespace string) ItemInterface[Resource, ResourceList]
NamespacedInterfaceBuilder The function that create a client to query a namespaced resource. e.g. `CoreV1().Pods`
type ScopeDetails ¶
func ParseScope ¶
func ParseScope(itemScope string, namespaced bool) (ScopeDetails, error)
ParseScope Parses the custer and scope name out of a given SDP scope given that the naming convention is {clusterName}.{namespace}. Since all sources know whether they are namespaced or not, we can just pass that in to make parsing easier
func (ScopeDetails) String ¶
func (sd ScopeDetails) String() string
type SourceLoader ¶
Source Files ¶
- clusterrole.go
- clusterrolebinding.go
- configmap.go
- cronjob.go
- daemonset.go
- deployment.go
- endpoints.go
- endpointslice.go
- generic_source.go
- horizontalpodautoscaler.go
- ingress.go
- job.go
- limitrange.go
- main.go
- networkpolicy.go
- node.go
- persistentvolume.go
- persistentvolumeclaim.go
- poddisruptionbudget.go
- pods.go
- priorityclass.go
- replicaset.go
- replicationcontroller.go
- resourcequota.go
- role.go
- rolebinding.go
- secret.go
- service.go
- serviceaccount.go
- shared_util.go
- statefulset.go
- storageclass.go
- volumeattachment.go