-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial Chaos Test integration for SharedInformers
- Loading branch information
Showing
16 changed files
with
1,015 additions
and
5 deletions.
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
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,58 @@ | ||
# Chaos Mesh tests for Kubernetes Client SharedInformer | ||
|
||
This module will run automated Chaos Tests for the SharedInformers | ||
|
||
### Setup | ||
|
||
Start minikube, e.g.: | ||
|
||
```bash | ||
minikube start --driver=docker --memory 8192 --cpus 3 | ||
``` | ||
|
||
Install ChaosMesh on minikube: | ||
|
||
```bash | ||
curl -sSL https://mirrors.chaos-mesh.org/v2.6.0/install.sh | bash | ||
``` | ||
|
||
Wait for the pods to be all ready: | ||
|
||
```bash | ||
kubectl wait --for=condition=Ready pods -n chaos-mesh --all --timeout=600s | ||
``` | ||
|
||
Build the control and checker Docker images in the minikube docker-env: | ||
|
||
```bash | ||
eval $(minikube -p minikube docker-env) | ||
mvn -Pitests -Phttpclient-jdk -Pchecker clean package k8s:build -pl chaos-tests -DskipTests | ||
mvn -Pitests -Phttpclient-jdk -Pcontrol clean package k8s:build -pl chaos-tests -DskipTests | ||
``` | ||
|
||
and finally run the test: | ||
|
||
```bash | ||
mvn -Pitests verify -pl chaos-tests | ||
``` | ||
|
||
### Glossary | ||
|
||
- checker: run the SharedInformer to get notifications over the shared resource | ||
- control: apply timely changes to the shared resource | ||
|
||
## What's going on? | ||
|
||
As of today this is the main flow of the tests(please double-check the implementation if this documentation is not accurate anymore): | ||
|
||
- Starts a "Checker" application(as a Pod in a cluster) which starts a SharedInformer on a ConfigMap | ||
- Starts a "Control" application(as a Pod in the cluster) which keeps incrementing a counter stored in the previously mentioned ConfigMap | ||
- The "Checker" is waiting for the number to reach a specific value N | ||
- The "Control" keeps incrementing the counter up to the same number N | ||
- We start a Chaos Experiment targeting the "Checker" app, in this setup, we are using 3 different Network disruption scenarios | ||
- The Chaos Experiment lasts for 12 minutes | ||
- After the Experiment is finished we do expect that the "Checker" app SharedInformer recovers and eventually reaches the target N | ||
- Eventually, both the 2 Control and Checker Pods should be in a Successful state | ||
|
||
We are testing the resiliency of the WebSocket communication used under the cover by the SharedInformers and we guarantee that they do recover appropriately when something happens. | ||
We guarantee that we don't have regressions and this tests can be used as a gate for other HTTP client implementations. |
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,225 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (C) 2015 Red Hat, Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<artifactId>kubernetes-client-project</artifactId> | ||
<groupId>io.fabric8</groupId> | ||
<version>6.8-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>chaos-tests</artifactId> | ||
<packaging>jar</packaging> | ||
<name>Fabric8 :: Chaos Tests</name> | ||
|
||
<properties> | ||
<jkube.version>1.13.1</jkube.version> | ||
<picocli.version>4.7.4</picocli.version> | ||
</properties> | ||
|
||
<repositories> | ||
<repository> | ||
<id>sonatype-snapshots</id> | ||
<url>https://oss.sonatype.org/content/repositories/snapshots</url> | ||
<releases><enabled>false</enabled></releases> | ||
<snapshots><enabled>true</enabled></snapshots> | ||
</repository> | ||
</repositories> | ||
|
||
<dependencies> | ||
<!-- Support applications --> | ||
<dependency> | ||
<groupId>info.picocli</groupId> | ||
<artifactId>picocli</artifactId> | ||
<version>${picocli.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>kubernetes-client</artifactId> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>kubernetes-httpclient-okhttp</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>kubernetes-httpclient-okhttp</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-simple</artifactId> | ||
<scope>compile</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>kubernetes-junit-jupiter</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.awaitility</groupId> | ||
<artifactId>awaitility</artifactId> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<!-- We cleanup system properties an env vars, so that we can test in a predictable env --> | ||
<environmentVariables> | ||
<KUBERNETES_MASTER /> | ||
<KUBERNETES_API_VERSION /> | ||
<KUBERNETES_TRUST_CERTIFICATES /> | ||
<KUBERNETES_CERTS_CA_FILE /> | ||
<KUBERNETES_CERTS_CA_DATA /> | ||
<KUBERNETES_CERTS_CLIENT_FILE /> | ||
<KUBERNETES_CERTS_CLIENT_DATA /> | ||
<KUBERNETES_CERTS_CLIENT_KEY_FILE /> | ||
<KUBERNETES_CERTS_CLIENT_KEY_DATA /> | ||
<KUBERNETES_CERTS_CLIENT_KEY_ALGO /> | ||
<KUBERNETES_CERTS_CLIENT_KEY_PASSPHRASE /> | ||
<KUBERNETES_AUTH_BASIC_USERNAME /> | ||
<KUBERNETES_AUTH_BASIC_PASSWORD /> | ||
<KUBERNETES_AUTH_TRYKUBECONFIG /> | ||
<KUBERNETES_AUTH_TRYSERVICEACCOUNT /> | ||
<KUBERNETES_AUTH_TOKEN /> | ||
<KUBERNETES_WATCH_RECONNECTINTERVAL /> | ||
<KUBERNETES_WATCH_RECONNECTLIMIT /> | ||
<KUBERNETES_REQUEST_TIMEOUT /> | ||
<KUBERNETES_NAMESPACE /> | ||
<KUBERNETES_TLS_VERSIONS>TLSv1.2,TLSv1.1,TLSv1</KUBERNETES_TLS_VERSIONS> | ||
</environmentVariables> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>shade</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.eclipse.jkube</groupId> | ||
<artifactId>kubernetes-maven-plugin</artifactId> | ||
<version>${jkube.version}</version> | ||
<configuration> | ||
<images> | ||
<image> | ||
<name>chaos-test-${app-name}:latest</name> | ||
<build> | ||
<from>openjdk:latest</from> | ||
<cmd>java -jar /maven/${project.artifactId}-${project.version}.jar</cmd> | ||
</build> | ||
</image> | ||
</images> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<configuration> | ||
<archive> | ||
<manifest> | ||
<mainClass>${main-class}</mainClass> | ||
</manifest> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<profiles> | ||
<!-- HTTP client injection --> | ||
<profile> | ||
<id>httpclient-okhttp</id> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>kubernetes-httpclient-okhttp</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</profile> | ||
<profile> | ||
<id>httpclient-jdk</id> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>kubernetes-httpclient-jdk</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</profile> | ||
<profile> | ||
<id>httpclient-vertx</id> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>kubernetes-httpclient-vertx</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</profile> | ||
<profile> | ||
<id>httpclient-jetty</id> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>kubernetes-httpclient-jetty</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</profile> | ||
|
||
<!-- Support Apps container configuration --> | ||
<profile> | ||
<id>checker</id> | ||
<properties> | ||
<app-name>checker</app-name> | ||
<main-class>io.fabric8.it.CheckerCommand</main-class> | ||
</properties> | ||
</profile> | ||
<profile> | ||
<id>control</id> | ||
<properties> | ||
<app-name>control</app-name> | ||
<main-class>io.fabric8.it.ControlCommand</main-class> | ||
</properties> | ||
</profile> | ||
</profiles> | ||
|
||
</project> |
Oops, something went wrong.