provider

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: Apache-2.0 Imports: 20 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")
	// ClusterProviderK3S identifies k3s cluster provider.
	ClusterProviderK3S = ClusterProvider("k3s")
	// 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 (
	// GRPCRouteCountKey is report key under which the number of GRPCRoutes in the cluster
	// will be provided.
	GRPCRouteCountKey = types.ProviderReportKey("k8s_grpcroutes_count")
	// GRPCRouteCountKind represents the GRPCRoute count provider kind.
	GRPCRouteCountKind = Kind(GRPCRouteCountKey)
)
View Source
const (
	// HTTPRouteCountKey is report key under which the number of HTTPRoutes in the cluster
	// will be provided.
	HTTPRouteCountKey = types.ProviderReportKey("k8s_httproutes_count")
	// HTTPRouteCountKind represents the HTTPRoute count provider kind.
	HTTPRouteCountKind = Kind(HTTPRouteCountKey)
)
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 (
	// ReferenceGrantCountKey is report key under which the number of ReferenceGrants in the cluster
	// will be provided.
	ReferenceGrantCountKey = types.ProviderReportKey("k8s_referencegrants_count")
	// ReferenceGrantCountKind represents the ReferenceGrant count provider kind.
	ReferenceGrantCountKind = Kind(ReferenceGrantCountKey)
)
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 (
	// TCPRouteCountKey is report key under which the number of TCPRoutes in the cluster
	// will be provided.
	TCPRouteCountKey = types.ProviderReportKey("k8s_tcproutes_count")
	// TCPRouteCountKind represents the TCPRoute count provider kind.
	TCPRouteCountKind = Kind(TCPRouteCountKey)
)
View Source
const (
	// GatewayClassCountKey is report key under which the number of GatewayClasses in the cluster
	// will be provided.
	GatewayClassCountKey = types.ProviderReportKey("k8s_gatewayclasses_count")
	// GatewayClassCountKind represents the GatewayClass count provider kind.
	GatewayClassCountKind = Kind(GatewayClassCountKey)
)
View Source
const (
	// TLSRouteCountKey is report key under which the number of TLSRoutes in the cluster
	// will be provided.
	TLSRouteCountKey = types.ProviderReportKey("k8s_tlsroutes_count")
	// TLSRouteCountKind represents the TLSRoute count provider kind.
	TLSRouteCountKind = Kind(TLSRouteCountKey)
)
View Source
const (
	// UDPRouteCountKey is report key under which the number of UDPRoutes in the cluster
	// will be provided.
	UDPRouteCountKey = types.ProviderReportKey("k8s_udproutes_count")
	// UDPRouteCountKind represents the UDPRoute count provider kind.
	UDPRouteCountKind = Kind(UDPRouteCountKey)
)
View Source
const (
	// OpenShiftVersionKey is a report key used to report the OpenShift version, if any.
	OpenShiftVersionKey = types.ProviderReportKey("openshift_version")
	// OpenShiftVersionKind is the OpenShift cluster version kind.
	OpenShiftVersionKind = Kind(OpenShiftVersionKey)

	// OpenShiftVersionPodNamespace is a namespace expected to contain pods whose environment includes OpenShift version
	// information.
	OpenShiftVersionPodNamespace = "openshift-apiserver-operator"
	// OpenShiftVersionPodApp is a value for the "app" label to select pods whose environment includes OpenShift version
	// information.
	OpenShiftVersionPodApp = "openshift-apiserver-operator"

	// ImageVersionVariable is the environment variable whose value contains the operator image version. For OpenShift
	// operators, this matches the OpenShift version.
	ImageVersionVariable = "OPERATOR_IMAGE_VERSION"
)
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 ErrGVRNotAvailable added in v0.0.6

type ErrGVRNotAvailable struct {
	GVR    schema.GroupVersionResource
	Reason error
}

ErrGVRNotAvailable is an error which indicates that a GVR is not available. It contains the reason error which can help find the root cause.

func (ErrGVRNotAvailable) Error added in v0.0.6

func (e ErrGVRNotAvailable) Error() string

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 NewK8sGRPCRouteCountProvider added in v0.0.5

func NewK8sGRPCRouteCountProvider(name string, d dynamic.Interface, rm meta.RESTMapper) (Provider, error)

NewK8sGRPCRouteCountProvider creates telemetry data provider that will query the configured k8s cluster - using the provided client - to get a GRPCRoute count from the cluster.

func NewK8sGatewayClassCountProvider added in v0.0.5

func NewK8sGatewayClassCountProvider(name string, d dynamic.Interface, rm meta.RESTMapper) (Provider, error)

NewK8sGatewayClassCountProvider creates telemetry data provider that will query the configured k8s cluster - using the provided client - to get a GatewayClass count from the cluster.

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 NewK8sHTTPRouteCountProvider added in v0.0.5

func NewK8sHTTPRouteCountProvider(name string, d dynamic.Interface, rm meta.RESTMapper) (Provider, error)

NewK8sHTTPRouteCountProvider creates telemetry data provider that will query the configured k8s cluster - using the provided client - to get a HTTPRoute 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 NewK8sReferenceGrantCountProvider added in v0.0.5

func NewK8sReferenceGrantCountProvider(name string, d dynamic.Interface, rm meta.RESTMapper) (Provider, error)

NewK8sReferenceGrantCountProvider creates telemetry data provider that will query the configured k8s cluster - using the provided client - to get a ReferenceGrant 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 NewK8sTCPRouteCountProvider added in v0.0.5

func NewK8sTCPRouteCountProvider(name string, d dynamic.Interface, rm meta.RESTMapper) (Provider, error)

NewK8sTCPRouteCountProvider creates telemetry data provider that will query the configured k8s cluster - using the provided client - to get a TCPRoute count from the cluster.

func NewK8sTLSRouteCountProvider added in v0.0.5

func NewK8sTLSRouteCountProvider(name string, d dynamic.Interface, rm meta.RESTMapper) (Provider, error)

NewK8sTLSRouteCountProvider creates telemetry data provider that will query the configured k8s cluster - using the provided client - to get a TLSRoute count from the cluster.

func NewK8sUDPRouteCountProvider added in v0.0.5

func NewK8sUDPRouteCountProvider(name string, d dynamic.Interface, rm meta.RESTMapper) (Provider, error)

NewK8sUDPRouteCountProvider creates telemetry data provider that will query the configured k8s cluster - using the provided client - to get a UDPRoute 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 NewOpenShiftVersionProvider added in v0.1.0

func NewOpenShiftVersionProvider(name string, kc kubernetes.Interface) (Provider, error)

NewOpenShiftVersionProvider provides the OpenShift version, or nothing if the cluster is not OpenShift.

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