-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add kube_ingress_status metric #2433
Open
isuyyy
wants to merge
3
commits into
kubernetes:main
Choose a base branch
from
isuyyy:add_kube_ingress_status_metric
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,12 +40,14 @@ func TestIngressStore(t *testing.T) { | |
# HELP kube_ingress_metadata_resource_version Resource version representing a specific version of ingress. | ||
# HELP kube_ingress_path [STABLE] Ingress host, paths and backend service information. | ||
# HELP kube_ingress_tls [STABLE] Ingress TLS host and secret information. | ||
# HELP kube_ingress_status Ingress status. | ||
# TYPE kube_ingress_created gauge | ||
# TYPE kube_ingress_info gauge | ||
# TYPE kube_ingress_labels gauge | ||
# TYPE kube_ingress_metadata_resource_version gauge | ||
# TYPE kube_ingress_path gauge | ||
# TYPE kube_ingress_tls gauge | ||
# TYPE kube_ingress_status gauge | ||
` | ||
cases := []generateMetricsTestCase{ | ||
{ | ||
|
@@ -97,7 +99,7 @@ func TestIngressStore(t *testing.T) { | |
kube_ingress_created{namespace="ns2",ingress="ingress2"} 1.501569018e+09 | ||
kube_ingress_metadata_resource_version{namespace="ns2",ingress="ingress2"} 123456 | ||
`, | ||
MetricNames: []string{"kube_ingress_info", "kube_ingress_metadata_resource_version", "kube_ingress_created", "kube_ingress_labels", "kube_ingress_path", "kube_ingress_tls"}, | ||
MetricNames: []string{"kube_ingress_info", "kube_ingress_metadata_resource_version", "kube_ingress_created", "kube_ingress_labels", "kube_ingress_path", "kube_ingress_tls", "kube_ingress_status"}, | ||
}, | ||
{ | ||
Obj: &networkingv1.Ingress{ | ||
|
@@ -113,7 +115,7 @@ func TestIngressStore(t *testing.T) { | |
kube_ingress_info{namespace="ns3",ingress="ingress3",ingressclass="_default"} 1 | ||
kube_ingress_created{namespace="ns3",ingress="ingress3"} 1.501569018e+09 | ||
`, | ||
MetricNames: []string{"kube_ingress_info", "kube_ingress_metadata_resource_version", "kube_ingress_created", "kube_ingress_labels", "kube_ingress_path", "kube_ingress_tls"}, | ||
MetricNames: []string{"kube_ingress_info", "kube_ingress_metadata_resource_version", "kube_ingress_created", "kube_ingress_labels", "kube_ingress_path", "kube_ingress_tls", "kube_ingress_status"}, | ||
}, | ||
{ | ||
Obj: &networkingv1.Ingress{ | ||
|
@@ -167,7 +169,7 @@ func TestIngressStore(t *testing.T) { | |
kube_ingress_path{namespace="ns4",ingress="ingress4",host="somehost",path="/somepath",service_name="someservice",service_port="1234"} 1 | ||
kube_ingress_path{namespace="ns4",ingress="ingress4",host="somehost",path="/somepath2",resource_api_group="",resource_kind="somekind",resource_name="somename"} 1 | ||
`, | ||
MetricNames: []string{"kube_ingress_info", "kube_ingress_metadata_resource_version", "kube_ingress_created", "kube_ingress_labels", "kube_ingress_path", "kube_ingress_tls"}, | ||
MetricNames: []string{"kube_ingress_info", "kube_ingress_metadata_resource_version", "kube_ingress_created", "kube_ingress_labels", "kube_ingress_path", "kube_ingress_tls", "kube_ingress_status"}, | ||
}, | ||
{ | ||
Obj: &networkingv1.Ingress{ | ||
|
@@ -193,7 +195,7 @@ func TestIngressStore(t *testing.T) { | |
kube_ingress_tls{namespace="ns5",ingress="ingress5",tls_host="somehost1",secret="somesecret"} 1 | ||
kube_ingress_tls{namespace="ns5",ingress="ingress5",tls_host="somehost2",secret="somesecret"} 1 | ||
`, | ||
MetricNames: []string{"kube_ingress_info", "kube_ingress_metadata_resource_version", "kube_ingress_created", "kube_ingress_labels", "kube_ingress_path", "kube_ingress_tls"}, | ||
MetricNames: []string{"kube_ingress_info", "kube_ingress_metadata_resource_version", "kube_ingress_created", "kube_ingress_labels", "kube_ingress_path", "kube_ingress_tls", "kube_ingress_status"}, | ||
}, | ||
{ | ||
Obj: &networkingv1.Ingress{ | ||
|
@@ -212,7 +214,7 @@ func TestIngressStore(t *testing.T) { | |
kube_ingress_created{namespace="ns6",ingress="ingress6"} 1.501569018e+09 | ||
kube_ingress_metadata_resource_version{namespace="ns6",ingress="ingress6"} 123456 | ||
`, | ||
MetricNames: []string{"kube_ingress_info", "kube_ingress_metadata_resource_version", "kube_ingress_created", "kube_ingress_labels", "kube_ingress_path", "kube_ingress_tls"}, | ||
MetricNames: []string{"kube_ingress_info", "kube_ingress_metadata_resource_version", "kube_ingress_created", "kube_ingress_labels", "kube_ingress_path", "kube_ingress_tls", "kube_ingress_status"}, | ||
}, | ||
{ | ||
Obj: &networkingv1.Ingress{ | ||
|
@@ -231,7 +233,42 @@ func TestIngressStore(t *testing.T) { | |
kube_ingress_created{namespace="ns7",ingress="ingress7"} 1.501569018e+09 | ||
kube_ingress_metadata_resource_version{namespace="ns7",ingress="ingress7"} 123456 | ||
`, | ||
MetricNames: []string{"kube_ingress_info", "kube_ingress_metadata_resource_version", "kube_ingress_created", "kube_ingress_labels", "kube_ingress_path", "kube_ingress_tls"}, | ||
MetricNames: []string{"kube_ingress_info", "kube_ingress_metadata_resource_version", "kube_ingress_created", "kube_ingress_labels", "kube_ingress_path", "kube_ingress_tls", "kube_ingress_status"}, | ||
}, | ||
{ | ||
Obj: &networkingv1.Ingress{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: "ingress8", | ||
Namespace: "ns8", | ||
CreationTimestamp: metav1StartTime, | ||
ResourceVersion: "123456", | ||
}, | ||
Status: networkingv1.IngressStatus{ | ||
LoadBalancer: networkingv1.IngressLoadBalancerStatus{ | ||
Ingress: []networkingv1.IngressLoadBalancerIngress{ | ||
{ | ||
|
||
IP: "1.2.3.4", | ||
Hostname: "www.example.com", | ||
Ports: []networkingv1.IngressPortStatus{ | ||
{ | ||
Port: 8888, | ||
Protocol: "TCP", | ||
Error: nil, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we expose this error somehow as well? I assume it can potentially cause high cardinality, but it will be interesting to know if there's an error on the IngressPortStatus? |
||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
Want: metadata + ` | ||
kube_ingress_created{namespace="ns8",ingress="ingress8"} 1.501569018e+09 | ||
kube_ingress_info{namespace="ns8",ingress="ingress8",ingressclass="_default"} 1 | ||
kube_ingress_metadata_resource_version{namespace="ns8",ingress="ingress8"} 123456 | ||
kube_ingress_status{namespace="ns8",ingress="ingress8",hostname="www.example.com",port="8888",protocol="TCP"} 1 | ||
`, | ||
MetricNames: []string{"kube_ingress_info", "kube_ingress_metadata_resource_version", "kube_ingress_created", "kube_ingress_labels", "kube_ingress_path", "kube_ingress_tls", "kube_ingress_status"}, | ||
}, | ||
} | ||
for i, c := range cases { | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit torn on this name.
Maybe:
kube_ingress_status_loadbalancer (just wondering if additional fields get added to _status this might be difficult to include)