Commit Graph

67 Commits

Author SHA1 Message Date
Lubomir I. Ivanov
6ec8dbe5b5 cmd/kube-apiserver: avoid importing the kubeadm pkiutils package
The package "k8s.io/kubernetes/cmd/kubeadm/app/util/pkiutil"
is used for a couple of function calls:
- pkiutil.NewCertAndKey() to generate a cert/key pair
- pkiutil.WriteCertAndKey() to write the pair to disk

Unroll and simplify the functions to obtain the same functionality
while removing the cmd/kubeadm dependency.
2023-09-05 14:14:47 +03:00
Richa Banker
c1aef65640 Add integration test 2023-07-18 17:36:30 -07:00
Kubernetes Prow Robot
20e60a03df
Merge pull request #110863 from claudiubelu/path-filepath-update-2
Replaces path.Operation with filepath.Operation (part 2)
2023-07-13 09:56:37 -07:00
Kubernetes Prow Robot
e5efa0a5ee
Merge pull request #117108 from pohly/test-integration-race-detection-component-base-logs
component-base/logs: improve handling of re-applying a configuration
2023-07-05 21:29:08 -07:00
Patrick Ohly
02efe09abe component-base/logs: improve handling of re-applying a configuration
Normal binaries should never have to do this. It's not safe when there are
already some goroutines running which might do logging. Therefore the new
default is to return an error when a binary accidentally re-applies.

A few unit ensure that there are no goroutines and have to call the functions
more then once. The new ResetForTest API gets used by those to enable changing the
logging settings more than once in the same process.

Integration tests use the same code as the normal binaries. To make reuse of
that code safe, component-base/logs can be configured to silently ignore any
additional calls. This addresses data races that were found when enabling -race
for integration tests. To catch cases where the integration test does want
to modify the config, the old and new config get compared and an error is
raised when it's not the same.

To avoid having to modify all integration tests which start test servers,
reconfiguring component-base/logs is done by the test server packages.
2023-07-05 19:08:54 +02:00
Dr. Stefan Schimanski
764da8a01d
FIXUP: cmd/kube-apiserver/app/options: split apart controlplane part 2023-06-26 21:50:38 +02:00
Dr. Stefan Schimanski
6e079545c4
cmd/kube-apiserver: move options completion into options package 2023-06-26 15:20:40 +02:00
Dr. Stefan Schimanski
9be6e7bb33
STRUCTURE: cmd/kube-apiserver/app: stratify construction with options/config/server 2023-06-07 10:05:43 +03:00
Jordan Liggitt
e4102d5e30
Test APIService safe handling at startup 2023-05-18 12:17:37 -04:00
Claudiu Belu
87f094c5e8 Replaces path.Operation with filepath.Operation (part 2)
The path module has a few different functions:
Clean, Split, Join, Ext, Dir, Base, IsAbs. These functions do not
take into account the OS-specific path separator, meaning that they
won't behave as intended on Windows.

For example, Dir is supposed to return all but the last element of the
path. For the path "C:\some\dir\somewhere", it is supposed to return
"C:\some\dir\", however, it returns ".".

Instead of these functions, the ones in filepath should be used instead.
2023-01-01 00:15:30 +00:00
Jordan Liggitt
78cb3862f1
Fix indentation/spacing in comments to render correctly in godoc 2022-12-17 23:27:38 -05:00
Monis Khan
22e540bc48
kms: add wiring to support automatic encryption config reload
This change adds a flag --encryption-provider-config-automatic-reload
which will be used to drive automatic reloading of the encryption
config at runtime.  While this flag is set to true, or when KMS v2
plugins are used without KMS v1 plugins, the /healthz endpoints
associated with said plugins are collapsed into a single endpoint at
/healthz/kms-providers - in this state, it is not possible to
configure exclusions for specific KMS providers while including the
remaining ones - ex: using /readyz?exclude=kms-provider-1 to exclude
a particular KMS is not possible.  This single healthz check handles
checking  all configured KMS providers.  When reloading is enabled
but no KMS providers are configured, it is a no-op.

k8s.io/apiserver does not support dynamic addition and removal of
healthz checks at runtime.  Reloading will instead have a single
static healthz check and swap the underlying implementation at
runtime when a config change occurs.

Signed-off-by: Monis Khan <mok@microsoft.com>
2022-11-07 12:03:18 -05:00
Monis Khan
ec283e526b
Expand aggregated API server integration test to include CRUD
This change updates TestAggregatedAPIServer and the related test
server wiring to exercise the full network path between the Kube API
server and the aggregated API server.  We now assert that the wardle
API service and Kube API server discovery endpoints are fully healthy.
CRUD operations are performed through the Kube API server to the
wardle API server.

Signed-off-by: Monis Khan <mok@microsoft.com>
2022-08-30 10:44:01 -04:00
Davanum Srinivas
a9593d634c
Generate and format files
- Run hack/update-codegen.sh
- Run hack/update-generated-device-plugin.sh
- Run hack/update-generated-protobuf.sh
- Run hack/update-generated-runtime.sh
- Run hack/update-generated-swagger-docs.sh
- Run hack/update-openapi-spec.sh
- Run hack/update-gofmt.sh

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2022-07-26 13:14:05 -04:00
Wojciech Tyczyński
6f706775bc Clean shutdown of test apiserver 2022-05-26 10:42:48 +02:00
Wojciech Tyczyński
2dd44d6226 Cleanup no-longer used storage cleanup method 2022-05-11 20:11:37 +02:00
Wojciech Tyczyński
0527a0dd45 Cleanup rest storage resources on shutdown 2022-04-19 15:59:13 +02:00
ahrtr
972dc46a1f replace deprecated io/ioutil with os and io for cmd 2022-02-01 13:59:41 +08:00
maruiyan
da4aaf81cd Error should be checked first, then go to other steps. 2021-06-30 11:00:55 +08:00
Jordan Liggitt
2979c3325e Switch to go.etcd.io/etcd/client/v3 2021-06-15 09:53:06 -04:00
Shihang Zhang
925900317e allow multiple of --service-account-issuer 2021-04-19 09:54:11 -07:00
David Eads
a473ef6c0a use direct etcd creation to verify migrated v1beta1 admissionwebhooks 2021-03-03 17:33:27 -05:00
Benjamin Elder
56e092e382 hack/update-bazel.sh 2021-02-28 15:17:29 -08:00
Haowei Cai
dc047b183b storage version integration test: check the test server's health before running
we disabled the /healthz check because our test blocks one post-start
hook from finishing. Instead we should check all the other /healthz/...
endpoints before running the tests
2021-02-02 18:31:53 -08:00
Haowei Cai
b5b93004b5 generated 2020-11-08 18:53:40 -08:00
Chao Xu
fa1805cc5c Add an integration test.
To make sure that the storage version filter can block certain requests until
the storage version updates are completed, and that the apiserver works
properly after the storage version updates are done.
2020-11-08 18:53:40 -08:00
knight42
cfc2b330a7
refactor(apiserver): ignore the insecure flags
Leave the insecure flags intact but stop serving on insecure port.
2020-10-29 23:20:17 +08:00
Jordan Liggitt
22c9236741 Allow integration test servers extra time to start 2020-07-23 17:46:59 -04:00
Mike Danese
bd290e924f fix some fixture path calculations
Current calculations assume that -trimpath is not passed to go tool
compile, which is not the case for test binaries built with bazel. This
causes issues for integration tests right now but is generally not
correct.

The approach taken here is a bit of a hack but it works on the
assumption that if and only if trimpath is passed, we are running under
bazel. I didn't see a good spot for pkgPath(), so I just copied it
around.
2020-05-12 15:34:55 -07:00
Mike Danese
3aa59f7f30 generated: run refactor 2020-02-07 18:16:47 -08:00
Tim Allclair
9d3670f358 Ensure testing credentials are labeled as such 2020-02-04 10:36:05 -08:00
Mike Danese
d55d6175f8 refactor 2020-01-29 08:50:45 -08:00
David Eads
3fbfe60ed2 make client authentication optional for test kube-apiserver 2019-11-13 10:25:28 -05:00
David Eads
3aede35b3b dynamic reload cluster authentication info for aggregated API servers 2019-11-13 07:54:27 -05:00
Kubernetes Prow Robot
7acb066dbc
Merge pull request #81969 from logicalhan/livez
add `/livez` endpoint for liveness probing on the kube-apiserver
2019-08-29 19:56:31 -07:00
Han Kang
aa1b2d6d35 add /livez as a liveness endpoint for kube-apiserver
go fmt

make func private

refactor config_test

Two primary refactorings:

1. config test checkPath method is now each a distinct test
run (which makes it easier to see what is actually failing)

2. TestNewWithDelegate's root path check now parses the json output and
does a comparison against a list of expected paths (no more whitespace
and ordering issues when updating this test, yay).

go fmt

modify and simplify existing integration test for readyz/livez

simplify integration test

set default rbac policy rules for livez

rename a few functions and the entrypoint command line argument (and etcetera)

simplify interface for installing readyz and livez and make auto-register completion a bootstrapped check

untangle some of the nested functions, restructure the code
2019-08-29 14:13:19 -07:00
Khaled Henidak(Kal)
93c06821e6 Phase 2: service and endpoint processing 2019-08-28 15:59:43 +00:00
Han Kang
2e23788fda rename healthz methodNames to be more consistent w/ present day usages 2019-08-13 12:52:30 -07:00
Dr. Stefan Schimanski
f82bc712de aggregator: wire OpenAPI correctly into PrepareRun flow 2019-07-08 13:59:00 +02:00
Han Kang
54dcf5c9c4 add readyz endpoint for kube-apiserver readiness checks
add startup sequence duration and readyz endpoint

add rbac bootstrapping policy for readyz

add integration test around grace period and readyz

rename startup sequence duration flag

copy health checks to fields

rename health-check installed boolean, refactor clock injection logic

cleanup clock injection code

remove todo about poststarthook url registration from healthz
2019-06-17 11:16:13 -07:00
Clayton Coleman
26a6cdda86
Set integration tests to use distinct namespaces
TestWatchBasedManager was racing with the default namespace creation.
To fix that flake and to ensure integration tests using a shared etcd
don't accidentally overlap in the future, move the three main tests
using the default namespace to separate namespaces, and have
TestWatchBasedManager create that namespace before it runs.

Make StartTestServer wait for default namespace creation, which will
reduce other flakes until future changes completely remove use of default
namespace.

From a failed integration run:

	watch_manager_test.go:66: namespaces "default" not found
	watch_manager_test.go:66: namespaces "default" not found
	watch_manager_test.go:66: namespaces "default" not found
2019-05-30 19:11:50 -04:00
Jordan Liggitt
0b88095a17 Switch admission webhook test to work with shared etcd 2019-05-17 09:54:14 -07:00
Dr. Stefan Schimanski
4860f8732a testservers: return Run method errors correctly 2018-11-06 15:14:24 +01:00
Dr. Stefan Schimanski
42d533e40c apiserver: output flags in logical sections 2018-08-06 08:55:09 +02:00
Dr. Stefan Schimanski
c1c564fd4d apiserver: add SecureServingOptions.ExternalAddress
Before this the advertised IP (which shows up in the server cert) in case of
listening to loopback was the first host interface IP. This makes self-signed
certs non-constant, such that we cannot use fixtures.
2018-07-13 09:49:54 +02:00
Dr. Stefan Schimanski
7deccb5b7a apiserver: use fixtures for self-signed certs in test server 2018-07-13 09:49:54 +02:00
Jeff Grafton
23ceebac22 Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
Kubernetes Submit Queue
bbcd21e0ab
Merge pull request #60890 from rphillips/tests/lease_endpoint
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>.

apiserver: master count and lease endpoint test

**What this PR does / why we need it**: Adds a test to make sure master count and lease endpoint reconcilers work well together, so we can bump LeaseEndpoint to beta. Based on Jordan's comment https://github.com/kubernetes/kubernetes/pull/58474#issuecomment-369954890. 

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Issue: #57617
Followup PR: #58474

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
/cc @kubernetes/sig-cluster-lifecycle-api-reviews @kubernetes/sig-cluster-lifecycle-api-reviews
2018-04-27 16:54:16 -07:00
Ryan Phillips
efe19e4acb master count and lease endpoint tests 2018-04-27 13:03:31 -05:00
David Eads
e7fbbe0e3c eliminate indirection from type registration 2018-04-25 09:02:31 -04:00