Commit Graph

81 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
602ba9a714
Merge pull request #116611 from dims/missed-registering-kubelet-config-file-for-make-test-e2e-node-usecase
missed registering kubelet-config-file for the command line use case running test-e2e-node target
2023-03-14 19:27:21 -07:00
Sergey Kanzhelev
1e6281e4a2 first iteration to add standalone mode 2023-03-14 20:46:41 +00:00
Davanum Srinivas
ee294de56d
missed registering kubelet-config-file for the command line use case running test-e2e-node target
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2023-03-14 15:46:31 -04:00
Davanum Srinivas
a889cc7f79
prevent initializing the same flag more than once
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2023-03-13 17:07:00 -04:00
Patrick Ohly
136f89dfc5 e2e: use error wrapping with %w
The recently introduced failure handling in ExpectNoError depends on error
wrapping: if an error prefix gets added with `fmt.Errorf("foo: %v", err)`, then
ExpectNoError cannot detect that the root cause is an assertion failure and
then will add another useless "unexpected error" prefix and will not dump the
additional failure information (currently the backtrace inside the E2E
framework).

Instead of manually deciding on a case-by-case basis where %w is needed, all
error wrapping was updated automatically with

    sed -i "s/fmt.Errorf\(.*\): '*\(%s\|%v\)'*\",\(.* err)\)/fmt.Errorf\1: %w\",\3/" $(git grep -l 'fmt.Errorf' test/e2e*)

This may be unnecessary in some cases, but it's not wrong.
2023-02-06 15:39:13 +01:00
Antonio Ojea
7f5ae1c0c1
Revert "e2e: wait for pods with gomega" 2023-02-06 12:08:22 +01:00
Patrick Ohly
222f655062 e2e: use error wrapping with %w
The recently introduced failure handling in ExpectNoError depends on error
wrapping: if an error prefix gets added with `fmt.Errorf("foo: %v", err)`, then
ExpectNoError cannot detect that the root cause is an assertion failure and
then will add another useless "unexpected error" prefix and will not dump the
additional failure information (currently the backtrace inside the E2E
framework).

Instead of manually deciding on a case-by-case basis where %w is needed, all
error wrapping was updated automatically with

    sed -i "s/fmt.Errorf\(.*\): '*\(%s\|%v\)'*\",\(.* err)\)/fmt.Errorf\1: %w\",\3/" $(git grep -l 'fmt.Errorf' test/e2e*)

This may be unnecessary in some cases, but it's not wrong.
2023-01-31 13:01:39 +01:00
David Porter
048ed7ddc0 test: Stop kubelet systemd service after node e2e
Currently, when running node e2e it's not possible to use the ginkgo `--repeat`
flag to run the test suite multiple times. This is useful when debugging tests
and ensuring they are not flaky by re-running them several times. Currently if
using `--repeat` ginkgo flag, the 2nd run of the test will fail due to kubelet
not starting with message like:

```
Failed to start transient service unit: Unit kubelet-20221020T040841.service already exists.
```

This is because during the test startup, kubelet is started as a transient unit
file via `systemd-run`. The unit is started with the `--remain-after-exit` flag
to ensure that the unit will remain even if the kubelet is restarted. The test
suite currently uses `systemd kill` command to stop kubelet. This works fine for
stopping the kubelet, but on the second run, when `systemd-run` is used to start
systemd unit again it will fail because the unit already exists. This is because
`systemd kill` will not delete the systemd unit, only send SIGTERM signal to it.

To fix this, add `unitName` as a field to the `server` struct. When
kubelet server is constructed, set the unit name. As part of e2e test
termination, in `E2EServices.Stop()``, stop the kubelet systemd unit. By
stopping the kubelet systemd unit, systemd will delete the systemd
transient unit, allowing it to be created and started again in a
subsequent e2e run.

Signed-off-by: David Porter <david@porter.me>
2022-10-20 13:31:23 -07:00
Patrick Ohly
41619ace15 stop using deprecated klog flags
Some scripts and tools still relied on the deprecated flags, the ones
which are about to be removed.

This is intentionally not a complete removal of all those flags in the entire
repo. This would lead to much more code churn also in places where commands
still accept the flags because they use klog directly.
2022-09-04 21:02:43 +02:00
Kubernetes Prow Robot
c1ad54dfe3
Merge pull request #109649 from pohly/e2e-feature-gates
e2e: move feature gate support from test/e2e to test/e2e_node
2022-05-04 02:35:18 -07:00
Patrick Ohly
2664740043 e2e: move feature gate support from test/e2e to test/e2e_node
The test/e2e suite has never supported feature gates:
- it cannot discover at runtime how the cluster is configured
- its --feature-gates parameter had no effect

Despite that, tests were written that used
e2eskipper.SkipUnlessFeatureGateEnabled even though that function then only
checked the default feature gate state.  To catch such mistakes, e2e tests
suites now must explicitly enable feature gate checking via
e2eskipper.InitFeatureGates. They also must register their own command line
flag. When that is not done, then using SkipUnlessFeatureGateEnabled or
SkipIfFeatureGateEnabled leads to a test failure.

test/e2e_node does both and therefore continues to work as before.
2022-04-25 15:41:41 +02:00
Abhijit Hoskeri
49dc59873b e2e_node/{service,util}: use kubelet healthz port.
The readonly port could be disabled.

Since we are only using the /healthz endpoint,
we can use the healthz port for this.

Change-Id: Ie0e05a5ab4ec6f51e4d3c63226aa23c1b3a69956
2022-04-22 16:14:31 -07:00
Ciprian Hacman
7d5afb322d Remove unused --container-runtime e2e.test flag
Signed-off-by: Ciprian Hacman <ciprian@hakman.dev>
2022-02-14 08:49:56 +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
Sergey Kanzhelev
7e7bc6d53b remove DynamicKubeletConfig logic from kubelet 2022-01-19 22:38:04 +00:00
cyclinder
07999dac70 Clean up dockershim flags in the kubelet
Signed-off-by: cyclinder <qifeng.guo@daocloud.io>
Co-authored-by: Ciprian Hacman <ciprian@hakman.dev>
Signed-off-by: Ciprian Hacman <ciprian@hakman.dev>
2022-01-14 16:02:50 +02:00
Elana Hashman
5401551d12
Append node e2e logs to file where possible
Functionality added in systemd 240:
1977d1477f/NEWS (L3919-L3921)
2021-11-11 11:16:51 -08:00
Danielle Lancashire
4ae64bd799 e2e_node: add a default kubeletconfig fallback 2021-11-02 15:10:29 +01:00
Danielle Lancashire
a4cf3a90a2 e2e_node: support passing kubelet-config-file to local runs 2021-11-02 15:10:29 +01:00
Danielle Lancashire
6e9e436026 e2e_node: kubelet config: move to file where possible 2021-11-02 15:10:28 +01:00
Danielle Lancashire
4097a3d472 e2e_node: allow customizing the base kubeletconfig
This commit forces Kubelet Configuration files to always be generated
and when possible will use the kubeletconfig file that has been provided
by the test orchestrator
2021-11-02 15:09:56 +01:00
Elana Hashman
a77f4f4c29
Log e2e-node kubelet output directly to file
For some reason when we send them to journald, many log lines are
consistently dropped as soon as the PLEG is started.

If we log directly to file, we don't have this problem. As a bonus, if
the tests crash, the kubelet logs will always be available since they
were already written; otherwise we normally wait until the end of the
test run to collect them from journald, meaning that we often end up
with empty logs.
2021-07-30 15:35:42 -07:00
Kubernetes Prow Robot
af60bebde3
Merge pull request #97028 from knabben/e2e-restart-kubelet
Adding restart kubelet flag on e2e test
2021-06-22 21:00:09 -07:00
he.qingguo
ced98afe56 remove unused constant of kubeletPort in e2e test
Signed-off-by: he.qingguo <he.qingguo@zte.com.cn>
2021-01-02 12:16:07 +08:00
Amim Knabben
00da68dbc2 Adding restart kubelet flag on e2e test 2020-12-02 18:05:22 -05:00
knight42
d321ac52a2
refactor: migrate node e2e tests off insecure port
Signed-off-by: knight42 <anonymousknight96@gmail.com>
2020-10-20 00:12:58 +08: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
Giuseppe Scrivano
b21b1a5436
test, e2e_node: drop superfluous systemd properties
commit 43c56eb403 introduced a change
where CPUAccounting, CPUAccounting and TasksAccounting are enabled for
the systemd service.

It causes a regression on RHEL 7.8 where systemd-run doesn't allow to
set TasksAccounting.

Since Delegate= already enables all the controllers, it is superfluous
to specify them.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-05-04 09:22:35 +02:00
Giuseppe Scrivano
43c56eb403
e2e_node: adapt tests to cgroup v2
and fix node_container_manager_test to run with the systemd cgroup
manager.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-04-09 16:18:05 +02:00
Kubernetes Prow Robot
bc33fc8dfe
Merge pull request #74177 from dims/stop-testing-containerized-kubelet-in-e2e-node
Stop testing containerized kubelet in e2e-node
2019-07-12 10:57:05 -07:00
Dan Williams
8739ade3fa kubelet: add CNI cache dir option and plumb through to CNI and kubenet
libcni 0.7.0 caches ADD operation results and allows the runtime to
retrieve these from the cache. In case the user wants a different
cache directory than the defaul, plumb that through like we do
for --cni-bin-dir and --cni-conf-dir.
2019-07-01 12:14:07 -05:00
chaowang
9ba0d47465
Remove deprecated Kubelet security controls
Change-Id: I9f770e6780b60e881092690f6f177d726f474fe3
2019-05-16 13:33:52 -04:00
SataQiu
7fa953fcb5 fix golint failures of test/e2e_node/services 2019-05-15 15:37:21 +08:00
Dr. Stefan Schimanski
37046e3028 Handle feature gate errors 2019-04-03 16:52:05 +02:00
Davanum Srinivas
985a4201e9
Stop testing containerized kubelet in e2e-node
Change-Id: I2d948f9ff29a2c84358c39ac07627e7c1a8ee44d
2019-02-17 14:20:56 -05:00
Marek Counts
7744f90830 Moved flag and globalflag
Moved all flag code from `staging/src/k8s.io/apiserver/pkg/util/[flag|globalflag]` to `component-base/cli/[flag|globalflag]` except for the term function because of unwanted dependencies.
2019-02-15 10:28:13 -05:00
Jordan Liggitt
d440ecdd3b Update non-test code to use DefaultMutableFeatureGate 2018-11-21 11:51:33 -05:00
Davanum Srinivas
954996e231
Move from glog to klog
- Move from the old github.com/golang/glog to k8s.io/klog
- klog as explicit InitFlags() so we add them as necessary
- we update the other repositories that we vendor that made a similar
change from glog to klog
  * github.com/kubernetes/repo-infra
  * k8s.io/gengo/
  * k8s.io/kube-openapi/
  * github.com/google/cadvisor
- Entirely remove all references to glog
- Fix some tests by explicit InitFlags in their init() methods

Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135
2018-11-10 07:50:31 -05:00
mooncake
4894f5583d Remove the duplicated words in test files
Signed-off-by: mooncake <xcoder@tenxcloud.com>
2018-10-05 22:55:16 +08:00
SataQiu
94a653f100 fix typo 2018-09-28 23:41:24 +08:00
Lucas Käldström
8b6a7ee075
autogenerated go code, godeps, bazel and gofmt 2018-09-02 14:38:59 +03:00
Lucas Käldström
0707b1274f
Automated package reference rename 2018-09-02 14:15:38 +03:00
Lucas Käldström
7a840cb4c8
automated: Rename all package references 2018-08-29 19:07:52 +03:00
Jan Chaloupka
0d4a5b4cbd Have the /rootfs rw for containerized node e2e 2018-06-19 22:28:05 +02:00
Jan Chaloupka
ee83021182 Mount the kubeletConfigPath rw when running containerized node e2e tests
The kubelet needs to create dynamic-kubelet-config directory under the kubeletConfigPath
when initialing dynamic config directory.
2018-05-31 14:45:20 +02:00
Kubernetes Submit Queue
452b8c9e0d
Merge pull request #62101 from bart0sh/PR0010-e2e_node-kubelet-command-line-fix
Automatic merge from submit-queue (batch tested with PRs 58474, 60034, 62101, 63198). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix wrong usage of kubelet option

**What this PR does / why we need it**:

"--allow-privileged true" is incorrect usage of boolean option.
It means setting '--allow-priviledged' to its default value plus
non-existing subcommand 'true'.

"--allow-privileged false" is even more confusing as it sets
allow-priviledged flag to its default value 'true'

This is true for any boolean command line option.

Fixed this by using correct syntax --allow-priviledged=true

**Special notes for your reviewer**:
This is a show-stopper for PR #61833 

**Release note**:

```release-note
NONE
```
2018-04-30 13:24:12 -07:00
Kubernetes Submit Queue
44b57338d5
Merge pull request #59692 from mtaufen/dkcfg-unpack-configmaps
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

unpack dynamic kubelet config payloads to files

This PR unpacks the downloaded ConfigMap to a set of files on the node.

This enables other config files to ride alongside the
KubeletConfiguration, and the KubeletConfiguration to refer to these
cohabitants with relative paths.

This PR also stops storing dynamic config metadata (e.g. current,
last-known-good config records) in the same directory as config
checkpoints. Instead, it splits the storage into `meta` and
`checkpoints` dirs.

The current store dir structure is as follows:
```
- dir named by --dynamic-config-dir (root for managing dynamic config)
| - meta (dir for metadata, e.g. which config source is currently assigned, last-known-good)
  | - current (a serialized v1 NodeConfigSource object, indicating the assigned config)
  | - last-known-good (a serialized v1 NodeConfigSource object, indicating the last-known-good config)
| - checkpoints (dir for config checkpoints)
  | - uid1 (dir for unpacked config, identified by uid1)
    | - file1
    | - file2
    | - ...
  | - uid2
  | - ...
```

There are some likely changes to the above structure before dynamic config goes beta, such as renaming "current" to "assigned" for clarity, and extending the checkpoint identifier to include a resource version, as part of resolving #61643.

```release-note
NONE
```

/cc @luxas @smarterclayton
2018-04-24 12:01:37 -07:00
Michael Taufen
c9d398d01e unpack dynamic kubelet config payloads to files
This PR unpacks the downloaded ConfigMap to a set of files on the node.

This enables other config files to ride alongside the
KubeletConfiguration, and the KubeletConfiguration to refer to these
cohabitants with relative paths.

This PR also stops storing dynamic config metadata (e.g. current,
last-known-good config records) in the same directory as config
checkpoints. Instead, it splits the storage into `meta` and
`checkpoints` dirs.
2018-04-19 09:18:53 -07:00
Lantao Liu
27105c90ec Fix kubelet flags.
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-04-16 20:42:40 +00:00
Ed Bartosh
7e3d28b30f Fix wrong usage of kubelet options
"--allow-privileged true" is incorrect usage of boolean option.
It means setting '--allow-priviledged' to its default value plus
non-existing subcommand 'true'.

"--allow-privileged false" is even more confusing as it sets
allow-priviledged flag to its default value 'true'

This is true for any boolean command line option.

Fixed this by using correct syntax --allow-priviledged=true

Fixed generating of kubelet command line in addKubeletConfigFlags
function.
2018-04-12 15:19:49 +03:00