Repository navigation
Conversation
…lder Add feature = "discovery-kubernetes", KubernetesSdConfig validation and path resolution, #[non_exhaustive] Kubernetes resource models, and build_pod_target_group matching Prometheus pod.go. Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
Query the Kubernetes API server over reqwest for pods and optional attach_metadata resources (nodes, namespaces with 404 tolerance, ReplicaSets, Jobs), supporting explicit api_server, in-cluster env/token/CA resolution, and !Send LocalSet execution. Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the
discovery-kubernetesCargo feature (["discovery", "http-config"]) withKubernetesSdConfigvalidation,build_pod_target_groupmatching Prometheuspod.go, andKubernetesPodDiscoveryquerying the Kubernetes REST API directly viareqwestwithoutkube-rsork8s-openapi. Part of prometheus/scrape.rs#36.Stack:
discovery: add TargetGroup, StaticConfig, and Prometheus duration helpersdiscovery/dns: add DNS service discovery (dns_sd_configs)http_config: add Prometheus HTTPClientConfig and reqwest client builderdiscovery/kubernetes: add pod service discovery (role: pod)(this PR)Commits in reading order:
discovery/kubernetes: add KubernetesSdConfig and pod target group builderdiscovery/kubernetes: add reqwest-based KubernetesPodDiscovery runnerIntentional differences from Go
KubernetesPodDiscoveryqueries Kubernetes REST list/get endpoints (pods,nodes,namespaces,replicasets,jobs) directly withreqwestinstead of runningclient-goshared index informers as in discovery/kubernetes/kubernetes.go#L284 and discovery/kubernetes/pod.go#L63. Target group and__meta_kubernetes_*label construction inbuild_pod_target_groupmatches discovery/kubernetes/pod.go#L366.KubernetesSdConfigparses and validates all six Prometheus roles andkubeconfig_filein discovery/kubernetes/kubernetes.go#L108-L111.KubernetesPodDiscovery::newcurrently executesrole: podusing explicitapi_serveror in-cluster environment and serviceaccount files in discovery/kubernetes/kubernetes.go#L307, and returnsDiscoveryError::InvalidConfigwhenkubeconfig_filein discovery/kubernetes/kubernetes.go#L299-L300 or another role is requested.