Documentation ¶
Index ¶
- Constants
- type ClientGoProvideFunc
- type ClusterProvider
- type ControllerRuntimeProvideFunc
- type Kind
- type Provider
- func NewFixedValueProvider(name string, data types.ProviderReport) (Provider, error)
- func NewFunctorProvider(name string, f ReportFunctor) (Provider, error)
- func NewHostnameProvider(name string) (Provider, error)
- func NewK8sClientGoBase(name string, kind Kind, kc kubernetes.Interface, f ClientGoProvideFunc) (Provider, error)
- func NewK8sClusterArchProvider(name string, kc kubernetes.Interface) (Provider, error)
- func NewK8sClusterProviderProvider(name string, kc kubernetes.Interface) (Provider, error)
- func NewK8sClusterVersionProvider(name string, kc kubernetes.Interface) (Provider, error)
- func NewK8sControllerRuntimeBase(name string, kind Kind, cl client.Client, f ControllerRuntimeProvideFunc) (Provider, error)
- func NewK8sGatewayCountProvider(name string, d dynamic.Interface, rm meta.RESTMapper) (Provider, error)
- func NewK8sNodeCountProvider(name string, d dynamic.Interface) (Provider, error)
- func NewK8sObjectCountProvider(name string, kind Kind, d dynamic.Interface, gvr schema.GroupVersionResource) (Provider, error)
- func NewK8sObjectCountProviderWithRESTMapper(name string, kind Kind, d dynamic.Interface, gvr schema.GroupVersionResource, ...) (Provider, error)
- func NewK8sPodCountProvider(name string, d dynamic.Interface) (Provider, error)
- func NewK8sServiceCountProvider(name string, d dynamic.Interface) (Provider, error)
- func NewMeshDetectProvider(name string, cl client.Client, pod, publishService apitypes.NamespacedName) (Provider, error)
- func NewUptimeProvider(name string) (Provider, error)
- type ReportFunctor
Constants ¶
const ( // ClusterProviderKey is report key under which the cluster provider will be provided. ClusterProviderKey = types.ProviderReportKey("k8s_provider") // ClusterProviderKind represents cluster provider kind. ClusterProviderKind = Kind(ClusterProviderKey) )
const ( // ClusterProviderGKE identifies Google's GKE cluster provider. ClusterProviderGKE = ClusterProvider("GKE") // ClusterProviderAWS identifies Amazon's AWS cluster provider. ClusterProviderAWS = ClusterProvider("AWS") // ClusterProviderKubernetesInDocker identifies kind (kubernetes in docker) as cluster provider. ClusterProviderKubernetesInDocker = ClusterProvider("kind") // ClusterProviderUnknown represents an unknown cluster provider. ClusterProviderUnknown = ClusterProvider("UNKNOWN") )
const ( // ClusterArchKey is report key under which cluster architecture will be provided. ClusterArchKey = types.ProviderReportKey("k8s_arch") // ClusterArchKind represents cluster arch provider kind. ClusterArchKind = Kind(ClusterArchKey) )
const ( // ClusterVersionKey is the report key under which cluster k8s version will // be provided as returned by the /version API. ClusterVersionKey = types.ProviderReportKey("k8sv") // ClusterVersionSemverKey is the report key under which cluster k8s semver // version will be provided. ClusterVersionSemverKey = types.ProviderReportKey("k8sv_semver") // ClusterVersionKind represents cluster version provider kind. ClusterVersionKind = Kind(ClusterVersionKey) )
const ( // GatewayCountKey is report key under which the number of pods in the cluster // will be provided. GatewayCountKey = types.ProviderReportKey("k8s_gateways_count") // GatewayCountKind represents the pod count provider kind. GatewayCountKind = Kind(GatewayCountKey) )
const ( // MeshDetectProviderKey is report key under which the mesh detectino info // will be provided. MeshDetectProviderKey = types.ProviderReportKey("mesh_detect") // MeshDetectKind represents the mesh detect provider kind. MeshDetectKind = Kind("mesh_detect") )
const ( // NodeCountKey is the report key under which the number of nodes in the cluster // will be provided. NodeCountKey = types.ProviderReportKey("k8s_nodes_count") // NodeCountKind represents the node count provider kind. NodeCountKind = Kind(NodeCountKey) )
const ( // PodCountKey is report key under which the number of pods in the cluster // will be provided. PodCountKey = types.ProviderReportKey("k8s_pods_count") // PodCountKind represents the pod count provider kind. PodCountKind = Kind(PodCountKey) )
const ( // ServiceCountKey is report key under which the number of services in the cluster // will be provided. ServiceCountKey = types.ProviderReportKey("k8s_services_count") // ServiceCountKind represents the service count provider kind. ServiceCountKind = Kind(ServiceCountKey) )
const ( // HostnameKey is the report key that under which one can find hostname. HostnameKey = types.ProviderReportKey("hn") )
const ( // UptimeKey is the report key that under which one can find uptime. UptimeKey = types.ProviderReportKey("uptime") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientGoProvideFunc ¶
type ClientGoProvideFunc func(ctx context.Context, kc kubernetes.Interface) (types.ProviderReport, error)
ClientGoProvideFunc defines a provider func for client-go based providers.
type ClusterProvider ¶
type ClusterProvider string
ClusterProvider identifies a particular clsuter provider like AWS, GKE, Azure etc.
type ControllerRuntimeProvideFunc ¶
type ControllerRuntimeProvideFunc func(ctx context.Context, cl client.Client) (types.ProviderReport, error)
ControllerRuntimeProvideFunc defines a provider func for controller-runtime based providers.
type Provider ¶
type Provider interface { Name() string Kind() Kind Provide(context.Context) (types.ProviderReport, error) }
Provider defines how a telemetry provider can be used.
func NewFixedValueProvider ¶
func NewFixedValueProvider(name string, data types.ProviderReport) (Provider, error)
NewFixedValueProvider creates fixed value provider which upon calling Provide will always provide the same telemetry report.
func NewFunctorProvider ¶
func NewFunctorProvider(name string, f ReportFunctor) (Provider, error)
NewFunctorProvider creates a new functor provider that allows to define one's own telemetry retrieval logic by providing a ReportFunctor as parameter.
func NewHostnameProvider ¶
NewHostnameProvider creates hostname provider.
func NewK8sClientGoBase ¶
func NewK8sClientGoBase(name string, kind Kind, kc kubernetes.Interface, f ClientGoProvideFunc) (Provider, error)
NewK8sClientGoBase returns a kubernetes provider (based on client-go) by creating a kubernetes client based on the provided config and returning telemetry data using the logic in provided func.
func NewK8sClusterArchProvider ¶
func NewK8sClusterArchProvider(name string, kc kubernetes.Interface) (Provider, error)
NewK8sClusterArchProvider creates telemetry data provider that will query the configured k8s cluster - using the provided client - to get cluster architecture.
func NewK8sClusterProviderProvider ¶
func NewK8sClusterProviderProvider(name string, kc kubernetes.Interface) (Provider, error)
NewK8sClusterProviderProvider creates telemetry data provider that will return the cluster provider name based on a set of heuristics.
func NewK8sClusterVersionProvider ¶
func NewK8sClusterVersionProvider(name string, kc kubernetes.Interface) (Provider, error)
NewK8sClusterVersionProvider creates telemetry data provider that will query the configured k8s cluster - using the provided client - to get cluster k8s version.
func NewK8sControllerRuntimeBase ¶
func NewK8sControllerRuntimeBase(name string, kind Kind, cl client.Client, f ControllerRuntimeProvideFunc) (Provider, error)
NewK8sControllerRuntimeBase returns a kubernetes provider (based on controller-runtime) by creating a kubernetes client based on the provided config and returning telemetry data using the logic in provided func.
func NewK8sGatewayCountProvider ¶
func NewK8sGatewayCountProvider(name string, d dynamic.Interface, rm meta.RESTMapper) (Provider, error)
NewK8sGatewayCountProvider creates telemetry data provider that will query the configured k8s cluster - using the provided client - to get a gateway count from the cluster.
func NewK8sNodeCountProvider ¶
NewK8sNodeCountProvider creates telemetry data provider that will query the configured k8s cluster - using the provided client - to get a node count from the cluster.
func NewK8sObjectCountProvider ¶
func NewK8sObjectCountProvider(name string, kind Kind, d dynamic.Interface, gvr schema.GroupVersionResource) (Provider, error)
NewK8sObjectCountProvider returns a k8s object count provider, which will provide a count of specified resource.
func NewK8sObjectCountProviderWithRESTMapper ¶
func NewK8sObjectCountProviderWithRESTMapper(name string, kind Kind, d dynamic.Interface, gvr schema.GroupVersionResource, rm meta.RESTMapper) (Provider, error)
NewK8sObjectCountProviderWithRESTMapper returns a k8s object count provider and it will use the provided rest mapper to check if there is a kind for the provided group version resource, available on the cluster.
func NewK8sPodCountProvider ¶
NewK8sPodCountProvider creates telemetry data provider that will query the configured k8s cluster - using the provided client - to get a pod count from the cluster.
func NewK8sServiceCountProvider ¶
NewK8sServiceCountProvider creates telemetry data provider that will query the configured k8s cluster - using the provided client - to get a service count from the cluster.
func NewMeshDetectProvider ¶
func NewMeshDetectProvider(name string, cl client.Client, pod, publishService apitypes.NamespacedName) (Provider, error)
NewMeshDetectProvider returns a mesh detection provider, which will provide a information about detected meshes in kubernetes cluster.
func NewUptimeProvider ¶
NewUptimeProvider provides new uptime provider which will return uptime counted since the provider creation time.
type ReportFunctor ¶
type ReportFunctor func(context.Context) (types.ProviderReport, error)
ReportFunctor defines a function type that functor provider accepts as means for delivering telemetry data.
Source Files ¶
- base.go
- fixedvalueprovider.go
- functorprovider.go
- hostnameprovider.go
- k8sbase.go
- k8scloudproviderprovider.go
- k8sclusterarchprovider.go
- k8sclusterversionprovider.go
- k8sgatewayscountprovider.go
- k8smeshdetectprovider.go
- k8snodescountprovider.go
- k8sobjectcountprovider.go
- k8spodscountprovider.go
- k8sservicecountprovider.go
- provider.go
- uptimeprovider.go