jenvtest/docs at main · java-operator-sdk/jenvtest

User Documentation

jenvtest is a relatively simple test that support integration testing with Kubernetes API Server. The whole concept and implementation is relatively simple, this doc describes some high level concepts and provides some more detailed information.

Samples

Samples are provided in form of unit tests in the sample package in core.

For fabric8 client in this package

Configuration Options

See available configuration options documented in KubeAPIServerConfig

Not all those properties can be overridden using @EnableKubeAPIServer annotation, since might not make sense to do it for an individual test case. However, those can be passed to KubeApiServer and also configured globally using environment variables, see KubeAPIServerConfigBuilder

Updating kube config file

In general, it is not advised but if instructed kube config file (~/kube/config) is updated by the framework. See related property in @EnableKubeAPIServer annotation. The config file is automatically cleaned up on stop.

How does it work

In the background Kubernetes and etcd (and kubectl) binaries are downloaded if not found locally. All the certificates for the Kube API Server and for the client is generated. The client certificates are generated with group system:masters;

Downloading binaries

Binaries are downloaded automatically under ~/.jenvtest/k8s/[target-platform-and-version] if no binary found locally. If there are multiple binaries found, the latest if selected (unless a target version is not specified).

Also setup-envtest can be used to download binaries manually. By executing setup-envtest use --bin-dir ~/.jenvtest will download the latest required binaries to the default directory. This is useful if always running the tests in offline mode.