Commit Graph

68 Commits

Author SHA1 Message Date
Patrick Ohly
3e760310b2 e2e: revise import restrictions
- test/e2e/framework/*.go should have very minimal dependencies.
  We can enforce that via import-boss.

- What each test/e2e/framework/* sub-package uses is less relevant,
  although ideally it also should be as minimal as possible in each case.

Enforcing this via import-boss ensures that new dependencies get flagged as
problem and thus will get additional scrutiny. It might be okay to add them,
but it needs to be considered.
2023-02-12 14:56:45 +01:00
Richa Banker
452343367c Enable ComponentSLIs as beta feature 2023-01-26 17:46:21 -08:00
Richa Banker
eb55e2b980 Add e2e test for checking /metrics/slis endpoint for API server 2023-01-26 17:46:21 -08:00
Patrick Ohly
2f6c4f5eab e2e: use Ginkgo context
All code must use the context from Ginkgo when doing API calls or polling for a
change, otherwise the code would not return immediately when the test gets
aborted.
2022-12-16 20:14:04 +01:00
Patrick Ohly
d4729008ef e2e: simplify test cleanup
ginkgo.DeferCleanup has multiple advantages:
- The cleanup operation can get registered if and only if needed.
- No need to return a cleanup function that the caller must invoke.
- Automatically determines whether a context is needed, which will
  simplify the introduction of context parameters.
- Ginkgo's timeline shows when it executes the cleanup operation.
2022-12-13 08:09:01 +01:00
Patrick Ohly
7454c3ff81 e2e metrics: remove incorrect comment
The "should report resource usage through the resource metrics api" E2E test
calls getResourceMetrics, which calls GrabKubeletMetricsWithoutProxy.
2022-12-12 11:30:07 +01:00
Artur Żyliński
9f31669a53 New histogram: Pod start SLI duration 2022-10-26 11:28:17 +02:00
Patrick Ohly
5614a9d064 e2e framework: eliminate interim sub packages
The "todo" packages were necessary while moving code around to avoid hitting
cyclic dependencies. Now that any sub package can depend on the framework, they
are no longer needed and the code can be moved into the normal sub packages.
2022-10-06 08:16:47 +02:00
Patrick Ohly
2d21acb1be e2e framework: eliminate redundant framework/[log|ginkgowrapper]
These sub packages were created by mistake. Logging and failure handling are
core features and must be implemented in the framework package.
2022-10-06 08:16:47 +02:00
ahrtr
fe95aa614c io/ioutil has already been deprecated in golang 1.16, so replace all ioutil with io and os 2022-02-03 05:32:12 +08:00
Kenichi Omichi
c6ba451235 Fix err of GrabFromAPIServer()
If getting an error from internal funcation call, GrabFromAPIServer()
didn't return it to the caller.
This fixes it.
2021-09-02 21:31:04 +00:00
Antonio Ojea
34f4959633 replace e2e WaitForPodsReady by WaitTimeoutForPodReadyInNamespace 2021-08-01 19:24:52 +02:00
Mauricio Poppe
9103b7187c Fetch metrics from controller manager & scheduler no run once 2021-07-21 17:16:42 +00:00
Patrick Ohly
a4c7e91b59 e2e metrics: skip tests when metrics grabbing is disabled
The MetricsGrabber checked whether a component supported metrics
grabbing, but then tests didn't have an API to use the result of that
check. Because metrics grabbing is an optional debug feature, tests
must skip checks that depend on metrics data or, when the entire
test is about metrics data, skip the test.

This is now supported with a special error that gets wrapped and
returned by the individual Grab functions.
2021-06-16 12:02:41 +02:00
Patrick Ohly
1d3420ca72 e2e metrics: check whether debug handlers are available
This can be checked by trying to retrieve log output. As in the case
of no pod found, a warning gets emitted when log retrieval fails and
metrics grabbing gets disabled.

Logging is checked instead of actual metrics retrieval because the
latter is more complex and thus more likely to fail for other reasons.
2021-06-16 12:02:41 +02:00
Patrick Ohly
5e9076da93 e2e: grab controller and scheduler metrics via port forwarding
The previous approach with grabbing via a nginx proxy had some
drawbacks:
- it did not work when the pods only listened on localhost (as
  configured by kubeadm) and the proxy got deployed on a different
  node
- starting the proxy raced with starting the pods, causing
  sporadic test failures because the proxy was not set up
  properly unless it saw all pods when starting the e2e.test
- the proxy was always started, whether it is needed or not
- the proxy was left running after a test and then the next
  test run triggered potentially confusing messages when
  it failed to create objects for the proxy

The new approach is similar to "kubectl port-forward" + "kubectl get
--raw". It uses the port forwarding feature to establish a TCP
connection via a custom dialer, then lets client-go handle TLS and
credentials.

Somehow verifying the server certificate did not work. As this
shouldn't be a big concern for E2E testing, certificate checking gets
disabled on the client side instead of investigating this further.
2021-06-16 12:02:40 +02:00
Kubernetes Prow Robot
c495744436
Merge pull request #101960 from knight42/fix/deflake-metrics-proxy
Deflake tests that need to grab metrics from controller-manager or scheduler
2021-05-27 03:40:23 -07:00
Jian Zeng
781c65a40c fix: skip pods with empty ip 2021-05-27 16:06:34 +08:00
Grant Griffiths
564e531aa7 Add Snapshot Controller e2e metric tests
Signed-off-by: Grant Griffiths <ggriffiths@purestorage.com>
2021-05-20 23:29:23 -07:00
Jian Zeng
32c14da902
fix(metrics-proxy): wait for enough component pods to show up first
Signed-off-by: Jian Zeng <zengjian.zj@bytedance.com>
2021-05-15 22:07:05 +08:00
pacoxu
c496b1d335 e2e: waiting for scheduler pod to expose metrics once
Signed-off-by: pacoxu <paco.xu@daocloud.io>
2021-05-13 16:54:35 +08:00
Jian Zeng
c4c2574778
refactor(e2e): grab metrics from controller-manager via nginx
Signed-off-by: Jian Zeng <zengjian.zj@bytedance.com>
2021-05-03 00:12:06 +08:00
Benjamin Elder
56e092e382 hack/update-bazel.sh 2021-02-28 15:17:29 -08:00
Kenichi Omichi
176c8e219f Avoid DeprecatedMightBeMasterNode() in e2e metrics
As its name, DeprecatedMightBeMasterNode is deprecated.
In e2e metrics, the function was used for knowing master node name to
get metrics from kube-scheduler and kube-controller-manager pods.
This make e2e metrics get these metrics directly by getting those pod
names without calling DeprecatedMightBeMasterNode().
2020-06-25 23:08:24 +00:00
Davanum Srinivas
07d88617e5
Run hack/update-vendor.sh
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-05-16 07:54:33 -04:00
Davanum Srinivas
442a69c3bd
switch over k/k to use klog v2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-05-16 07:54:27 -04:00
gavinfish
e50afd00e9 e2e/framework: remove direct imports to /pkg/kubelet/... 2020-03-31 09:31:54 +08:00
Andrew Sy Kim
f0f6c6fc81 e2e/framework: remove imports to pkg/master/ports
Signed-off-by: Andrew Sy Kim <kim.andrewsy@gmail.com>
2020-03-17 17:42:43 -04:00
Antonio Ojea
2a095f434b e2e wait until controller manager pod ready 2020-03-14 12:17:25 +01:00
Antonio Ojea
334d46eed5
fix logging on e2e metrics grabber test 2020-03-13 09:48:39 +01:00
Antonio Ojea
4361f8f052 wait until /metrics are ready on e2e test
Some e2e tests depend on the controller-manager to expose metrics
on the path /metrics.

It may happen that when the test runs, the pod is not available or the
URL not ready, causing it to fail.

Previously, the test were waiting until the pod was running, but we
need to wait until the /metrics URL is ready.
2020-03-11 14:32:03 +01:00
Kubernetes Prow Robot
a35f54e3e8
Merge pull request #88982 from aojea/flakyvolumes
e2e: wait for controller manager pod to be ready
2020-03-10 03:29:36 -07:00
Kubernetes Prow Robot
b1c1187cca e2e: wait for controller manager pod to be ready
The MetricsGrabber may use the controller-manager pod
to gather metrics, however, it doesn't wait until
it is ready to serve, failing the test if this is the
case.

We wait until the controller-manager pod is running
before trying to get metrics from it.
2020-03-09 22:04:16 +01:00
andrewsykim
674e539fca test/e2e/framework: remove dependencies to internal APIs
Signed-off-by: andrewsykim <kim.andrewsy@gmail.com>
2020-03-02 16:09:15 -05:00
tanjunchen
efec7e64ce remove TODO and use framework.SingleCallTimeout 2020-02-14 01:12:46 +08:00
Mike Danese
3aa59f7f30 generated: run refactor 2020-02-07 18:16:47 -08:00
Mike Danese
d55d6175f8 refactor 2020-01-29 08:50:45 -08:00
Haosdent Huang
8d3a8d5a6c e2e: move funs of framework/metrics to e2e_node 2019-12-16 00:27:58 +08:00
YuikoTakada
cd7859901c Fix func VerifyLatencyWithinThreshold() to local 2019-12-03 06:53:41 +00:00
RainbowMango
5e0695e339 Hide apiserver metrics that have been deprecated in 1.14
Update E2E test accordingly.
2019-11-14 09:56:48 +08:00
YuikoTakada
2eac9a0f17 Remove unused func and struct from pod.go 2019-11-13 04:17:24 +00:00
YuikoTakada
3ebe59c8df delete unused func in latencies.go 2019-11-07 08:21:00 +00:00
Ziheng Liu
2ca513a15d Prevent 2 goroutines from being leaked if proxy hangs
Signed-off-by: Ziheng Liu <lzhfromustc@gmail.com>
2019-10-28 19:06:43 -04:00
Marek Siarkowicz
09329b5bbc Remove prometheus references in test/integration
This PR does minimal changes to interface to allow removing all
references to prometheus from `test` directory. In future I would expect
wrapping prometheus samples to provide better abstraction. Changes:

Move generic_metrics.go to testutil/metrics.go
Remove etcd.go as it was not called
Move prometheus label consts to testutil.
2019-10-28 11:40:32 +01:00
Kenichi Omichi
7c23ba1b34 Copy PrettyPrintJSON to core framework
PrettyPrintJSON is most used e2emetrics function and that doesn't seem
specific for metrics. The implementation itself is generic, so it is
nice to move it to core framework for avoiding circular dependency.
2019-09-23 18:10:50 +00:00
Clayton Coleman
a49a554211
Move the IsMasterNode function to tests and mark it Deprecated
A future change will stop using this signal and instead use a
label selector passed on creation.
2019-08-28 11:17:27 -04:00
Kenichi Omichi
47a4d1a8ec Rename MetricsForE2E for golint failure
This renames MetricsForE2E to ComponentCollection for solving golint
failure.
2019-08-08 04:15:36 +00:00
WanLinghao
92b0310cc5 Refactor and clean up e2e framework utils, this patch handles test/e2e/framework/kubelet_stats.go file 2019-08-01 17:40:02 +08:00
mlmhl
f2cf68b2a0 report error message when reset scheduler metrics in e2e test 2019-07-30 14:30:48 +08:00
alejandrox1
348fd0805e Refactored metrics-related functions from framework/metrics_util.go
This a refactoring of framework/metrics_utils.go into framework/metrics.

Signed-off-by: alejandrox1 <alarcj137@gmail.com>
2019-07-08 19:35:10 -04:00