-
Notifications
You must be signed in to change notification settings - Fork 360
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
e2e: eg controlplane metrics #2106
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
95b154c
e2e: eg controlplane metrics
zirain 482e13a
update
zirain 1ae52b8
update
zirain 39c8514
update name
zirain 43d2c63
rename
zirain 4fe491b
wait more
zirain 52eccb0
add comment
zirain 5a863e3
update
zirain 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: envoy-gateway-metrics-lb | ||
namespace: envoy-gateway-system | ||
labels: | ||
control-plane: envoy-gateway | ||
spec: | ||
selector: | ||
control-plane: envoy-gateway | ||
app.kubernetes.io/instance: eg | ||
ports: | ||
- name: http-metrics | ||
port: 19001 | ||
protocol: TCP | ||
targetPort: 19001 | ||
type: LoadBalancer |
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 |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// Copyright Envoy Gateway Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// The full text of the Apache license is available in the LICENSE file at | ||
// the root of the repo. | ||
|
||
//go:build e2e | ||
// +build e2e | ||
|
||
package tests | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
"time" | ||
|
||
corev1 "k8s.io/api/core/v1" | ||
"k8s.io/apimachinery/pkg/types" | ||
"k8s.io/apimachinery/pkg/util/wait" | ||
"sigs.k8s.io/gateway-api/conformance/utils/suite" | ||
) | ||
|
||
func init() { | ||
ConformanceTests = append(ConformanceTests, ControlPlaneMetricTest) | ||
} | ||
|
||
var ControlPlaneMetricTest = suite.ConformanceTest{ | ||
ShortName: "ControlPlane", | ||
Description: "Make sure control plane prometheus endpoint is working", | ||
Manifests: []string{"testdata/prometheus.yaml"}, | ||
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { | ||
t.Run("Prometheus", func(t *testing.T) { | ||
nn := types.NamespacedName{Name: "envoy-gateway-metrics-lb", Namespace: "envoy-gateway-system"} | ||
if err := wait.PollUntilContextTimeout(context.TODO(), time.Second, time.Minute, true, | ||
func(_ context.Context) (done bool, err error) { | ||
svc := corev1.Service{} | ||
if err := suite.Client.Get(context.Background(), nn, &svc); err != nil { | ||
return false, nil | ||
} | ||
|
||
host := "" | ||
switch svc.Spec.Type { | ||
case corev1.ServiceTypeLoadBalancer: | ||
for _, ing := range svc.Status.LoadBalancer.Ingress { | ||
if ing.IP != "" { | ||
host = ing.IP | ||
break | ||
} | ||
} | ||
default: | ||
// do nothing | ||
} | ||
|
||
if host == "" { | ||
return false, nil | ||
} | ||
|
||
return true, nil | ||
}); err != nil { | ||
t.Errorf("failed to get service %s : %v", nn.String(), err) | ||
} | ||
|
||
// too much flakes in the test if timeout is 1 minute | ||
// this should not take so long, but we give it a long timeout to be safe, and poll every second | ||
if err := wait.PollUntilContextTimeout(context.TODO(), time.Second, 2*time.Minute, true, | ||
func(_ context.Context) (done bool, err error) { | ||
if err := ScrapeMetrics(t, suite.Client, nn, 19001, "/metrics"); err != nil { | ||
t.Logf("failed to get metric: %v", err) | ||
return false, nil | ||
} | ||
return true, nil | ||
}); err != nil { | ||
t.Errorf("failed to scrape metrics: %v", err) | ||
} | ||
}) | ||
}, | ||
} |
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
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.
also being created in #2108
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.
this one
LoadBalancer
type