kmesh-net / kmesh

High Performance ServiceMesh Data Plane Based on Programmable Kernel
https://kmesh.net
Apache License 2.0
362 stars 46 forks source link

use peer_metadata to get pod metadata info from istiod #411

Closed YaoZengzeng closed 4 weeks ago

YaoZengzeng commented 4 weeks ago

What type of PR is this?

/kind enhancement

use peer_metadata http filter to get pod metadata from istiod

What this PR does / why we need it:

So we could get necessary fields to fill observability information

Before this modification, the metric is :

istio_requests_total{reporter="destination",source_workload="unknown",source_canonical_service="unknown",source_canonical_revision="latest",source_workload_namespace="unknown",source_principal="unknown",source_app="unknown",source_version="unknown",source_cluster="unknown",destination_workload="reviews-v1",destination_workload_namespace="default",destination_principal="unknown",destination_app="unknown",destination_version="unknown",destination_service="reviews.default.svc.cluster.local",destination_canonical_service="reviews",destination_canonical_revision="v1",destination_service_name="reviews",destination_service_namespace="default",destination_cluster="Kubernetes",request_protocol="http",response_code="200",grpc_response_status="",response_flags="-",connection_security_policy="none"} 93

After this modification:

istio_requests_total{reporter="destination",source_workload="productpage-v1",source_canonical_service="productpage",source_canonical_revision="v1",source_workload_namespace="default",source_principal="unknown",source_app="productpage",source_version="v1",source_cluster="Kubernetes",destination_workload="reviews-v1",destination_workload_namespace="default",destination_principal="unknown",destination_app="unknown",destination_version="unknown",destination_service="reviews.default.svc.cluster.local",destination_canonical_service="reviews",destination_canonical_revision="v1",destination_service_name="reviews",destination_service_namespace="default",destination_cluster="Kubernetes",request_protocol="http",response_code="200",grpc_response_status="",response_flags="-",connection_security_policy="none"} 1

And the metric from waypoint in ambient mesh:

istio_requests_total{reporter="destination",source_workload="productpage-v1",source_canonical_service="productpage",source_canonical_revision="v1",source_workload_namespace="default",source_principal="spiffe://cluster.local/ns/default/sa/bookinfo-productpage",source_app="productpage",source_version="v1",source_cluster="Kubernetes",destination_workload="reviews-v1",destination_workload_namespace="default",destination_principal="spiffe://cluster.local/ns/default/sa/bookinfo-reviews-istio-waypoint",destination_app="unknown",destination_version="unknown",destination_service="reviews.default.svc.cluster.local",destination_canonical_service="reviews",destination_canonical_revision="v1",destination_service_name="reviews",destination_service_namespace="default",destination_cluster="Kubernetes",request_protocol="http",response_code="200",grpc_response_status="",response_flags="-",connection_security_policy="mutual_tls"} 34

We have basically filled in all the fields, compared with ambient.

Which issue(s) this PR fixes: Fixes part of #320

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

codecov-commenter commented 4 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Flag Coverage Δ
unittests 30.99% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

kmesh-bot commented 4 weeks ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hzxuzhonghu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kmesh-net/kmesh/blob/main/OWNERS)~~ [hzxuzhonghu] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment