provider

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
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)
)
View Source
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")
)
View Source
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)
)
View Source
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)
)
View Source
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)
)
View Source
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")
)
View Source
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)
)
View Source
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)
)
View Source
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)
)
View Source
const (
	// HostnameKey is the report key that under which one can find hostname.
	HostnameKey = types.ProviderReportKey("hn")
)
View Source
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 Kind

type Kind string

Kind presents provider's kind.

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

func NewHostnameProvider(name string) (Provider, error)

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

func NewK8sNodeCountProvider(name string, d dynamic.Interface) (Provider, error)

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

func NewK8sPodCountProvider(name string, d dynamic.Interface) (Provider, error)

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

func NewK8sServiceCountProvider(name string, d dynamic.Interface) (Provider, error)

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

func NewUptimeProvider(name string) (Provider, error)

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.

Jump to

Keyboard shortcuts

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