Skip to content

Commit

Permalink
Merge branch 'main' into Update_docs_on_spawning_network_in_k8s
Browse files Browse the repository at this point in the history
  • Loading branch information
Neyromancer authored Nov 15, 2023
2 parents b467424 + 8bfe22d commit edc30f4
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 84 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ supported.

Zombienet releases are available in `github`. Each one provides an executable for both `linux` and
`macos` created with [pkg](https://github.com/vercel/pkg) and allows to run `zombienet` cli
*without* having `Node.js` installed **but** each `provider` defines it's own requirements (e.g.
*without* having `Node.js` installed **but** each `provider` defines its own requirements (e.g.
`k8s`, `podman`).

**Note:** Currently, it is only possible to use `podman` for Zombienet users on Linux machines.
Expand Down Expand Up @@ -60,7 +60,7 @@ Zombienet project has it's own `k8s` cluster in GCP, to use it please ping

### With Podman

Zombienet support [Podman](https://podman.io/) *rootless* as provider, you only need to have
Zombienet supports [Podman](https://podman.io/) *rootless* as provider, you only need to have
`podman` installed in your environment to use and either set in the *network* file or with the
`--provider` flag in the cli. `Podman` for `zombienet` is currently only supported for Linux machines.
This is mostly related to paths and directories used by
Expand All @@ -72,7 +72,7 @@ Zombienet `native` provider allows you to run the nodes as a local process in yo
only need to have the `binaries` used in your `network` (e.g `polkadot` or `polkadot-parachain`).
To use it either set in the *network* file or with the `--provider` flag in the cli.

**NOTE:** The `native` provider **only** use the `command` config for nodes/collators, both relative
**NOTE:** The `native` provider **only** uses the `command` config for nodes/collators, both relative
and absolute paths are supported. You can use `default_command` config to set the binary to spawn
all the `nodes` in the relay chain.

Expand Down Expand Up @@ -437,6 +437,6 @@ Below can be found some of the projects that are currently using Zombienet as in

## Acknowledgement

This project take inspiration and some patterns from
This project takes inspiration and some patterns from
[polkadot-launch](https://github.com/paritytech/polkadot-launch) and
[simnet](https://gitlab.parity.io/parity/simnet/-/tree/master).
5 changes: 4 additions & 1 deletion admissioncontroller/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ def deployment_webhook_mutate():
return admission_response_patch(True, "Adding allow label", json_patch = jsonpatch.JsonPatch([{"op": "add", "path": "/spec/tolerations", "value": [{"effect":"NoExecute", "key":"workload-type",
"operator":"Equal", "value":"large-testnet"}]}, {"op":"add", "path":"/spec/nodeSelector", "value": {"nodetype":"large-network"}}]))
else:
return admission_response_patch(True, "Adding allow label", json_patch = jsonpatch.JsonPatch([{"op": "add", "path": "/spec/tolerations", "value": [{"operator":"Exists"}]}, {"op":"add", "path":"/spec/affinity", "value": {"nodeAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"preference":{"matchExpressions":[{"key":"nodetype","operator":"In","values":["xlarge-network"]}]}},{"weight":50,"preference":{"matchExpressions":[{"key":"nodetype","operator":"In","values":["large-network"]}]}}]}} }]))
return admission_response_patch(True, "Adding allow label", json_patch = jsonpatch.JsonPatch([{"op": "add", "path": "/spec/tolerations", "value": [{"effect":"NoExecute", "key":"workload-type",
"operator":"Equal", "value":"xlarge-testnet"}]}, {"op":"add", "path":"/spec/nodeSelector", "value": {"nodetype":"xlarge-network"}}]))

# return admission_response_patch(True, "Adding allow label", json_patch = jsonpatch.JsonPatch([{"op": "add", "path": "/spec/tolerations", "value": [{"operator":"Exists"}]}, {"op":"add", "path":"/spec/affinity", "value": {"nodeAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"preference":{"matchExpressions":[{"key":"nodetype","operator":"In","values":["xlarge-network"]}]}},{"weight":50,"preference":{"matchExpressions":[{"key":"nodetype","operator":"In","values":["large-network"]}]}}]}} }]))

elif namespace.startswith("zombie-") and not hasNodeSelector:
return admission_response_patch(True, "Adding allow label", json_patch = jsonpatch.JsonPatch([{"op": "add", "path": "/spec/tolerations", "value": [{"effect":"NoExecute", "key":"workload-type",
Expand Down
2 changes: 1 addition & 1 deletion docs/src/acknowledgement.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Acknowledgement

This project take inspiration and some patterns from [polkadot-launch](https://github.com/paritytech/polkadot-launch) and [simnet](https://gitlab.parity.io/parity/simnet/-/tree/master).
This project takes inspiration and some patterns from [polkadot-launch](https://github.com/paritytech/polkadot-launch) and [simnet](https://gitlab.parity.io/parity/simnet/-/tree/master).

12 changes: 6 additions & 6 deletions docs/src/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ CURRENT NAME CLUSTER AUTHINFO NAMESPACE

---

In this example, is shown the alternateive options of a configuration file. The different extensions supported are: `yaml`, `json` and of course `.toml`.
In this example, is shown the alternative options of a configuration file. The different extensions supported are: `yaml`, `json` and of course `.toml`.
This simple config exists only in order to show how the same configuration exists in 3 different formats, and thus uses only 1 relay chain (`rococo-local`) with 2 nodes (`alice` and `bob`);

The configuration files are:
Expand All @@ -33,7 +33,7 @@ The configuration files are:
- [0000-test-config-small-network.yaml](https://github.com/paritytech/zombienet/blob/main/examples/0000-test-config-small-network.yaml);
- [0000-test-config-small-network.toml](https://github.com/paritytech/zombienet/blob/main/examples/0000-test-config-small-network.toml);

and the test files for running each confgiration are:
and the test files for running each configuration are:

- [0000-test-json-config-small-network.zndsl](https://github.com/paritytech/zombienet/blob/main/examples/0000-test-json-config-small-network.zndsl);
- [0000-test-yaml-config-small-network.zndsl](https://github.com/paritytech/zombienet/blob/main/examples/0000-test-yaml-config-small-network.zndsl);
Expand Down Expand Up @@ -138,7 +138,7 @@ alice: reports histogram polkadot_pvf_execution_time has at least 2 samples in b
# logs
bob: log line matches glob "*rted #1*" within 10 seconds
bob: log line matches "Imported #[0-9]+" within 10 seconds
bob: count of log lines maching "Error" is 0 within 10 seconds
bob: count of log lines matching "Error" is 0 within 10 seconds

# system events
bob: system event contains "A candidate was included" within 20 seconds
Expand All @@ -164,7 +164,7 @@ Now, run the tests with the following command to get both the _launching_ output
---

In Example 1, we used some _hardcoded_ default values but sometimes it's more useful to be able to change them dynamically.
For example, if you are building images in your `CI` and those images have an unique tag. To address these cases, Zombienet uses a templating language called [Nunjucks](https://mozilla.github.io/nunjucks/) that allows defining environment variables which then can get updated at _runtime_.
For example, if you are building images in your `CI` and those images have a unique tag. To address these cases, Zombienet uses a templating language called [Nunjucks](https://mozilla.github.io/nunjucks/) that allows defining environment variables which then can get updated at _runtime_.

Following the previous example, we will replace the _images_ with variables that will read the value from the environment. An interesting addon test that needs to be noticed here, is that the bob validator, is using a different version of polkadot (v0.9.37) instead of the latest (which at the time of writing this documentation was v0.9.39):

Expand Down Expand Up @@ -218,7 +218,7 @@ And again we get the network info with direct links:

This example shows that we can use custom environmental variables in our config file in order to dynamically alter the configuration of the network.

In addition that the validators support the capability of running different versions of the image.
In addition the validators support the capability of running different versions of the image.

> Note: In general all the config fields that start with `default_*` can be overridden in the `nodes` or `collators` config.
Expand Down Expand Up @@ -328,7 +328,7 @@ When you use `podman` you can follow the logs of the pods with the command sugge

#### Logs in native

With the `native` provider you can follow the logs of the pods with the command suggestion that `zombienet` gives you when it spawn a new process.
With the `native` provider you can follow the logs of the pods with the command suggestion that `zombienet` gives you when it spawns a new process.
For example:

```
Expand Down
2 changes: 1 addition & 1 deletion docs/src/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Or a particular release can be specified. e.g. to run `v1.3.40`, use:
nix run github:paritytech/zombienet/v1.3.40 -- spawn config.toml
```

Another option is to add he `zombienet` binary to the `PATH` for the current shell. This can be done with:
Another option is to add the `zombienet` binary to the `PATH` for the current shell. This can be done with:

```
nix shell github:paritytech/zombienet/v1.3.40
Expand Down
4 changes: 2 additions & 2 deletions docs/src/intro.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# What is ZombieNet?

ZombieNet aims to be a testing framework for Substrate based blockchains, providing a simple CLI tool that allowS users to spawn and test ephemeral networks. The assertions used in the tests can include on-chain storage, metrics, logs and custom JS scripts that interact with the chain. To make these easy to define, Zombienet uses a built-in natural language tool to write tests as smoothly as possible.
ZombieNet aims to be a testing framework for Substrate based blockchains, providing a simple CLI tool that allows users to spawn and test ephemeral networks. The assertions used in the tests can include on-chain storage, metrics, logs and custom JS scripts that interact with the chain. To make these easy to define, Zombienet uses a built-in natural language tool to write tests as smoothly as possible.

Internally, it's a JS library designed to run on NodeJS and support different backend providers to run the various blockchain nodes. Currently, Kubernetes, Podman and native are the supported providers.
Internally, it's a JS library designed to run on NodeJS and support different backend providers to run the various blockchain nodes. Currently, Kubernetes, Podman and native are the supported providers.
10 changes: 5 additions & 5 deletions docs/src/network-definition-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The network config can be provided both in `json` or `toml` format and each sect
- `chain_spec_path`: (String) Path to the chain spec file, **NOTE** should be the `plain` version to allow customizations.
- `chain_spec_command`: (String) Command to generate the chain spec, **NOTE** can't be used in combination with `chain_spec_path`.
- `default_args`: (Array of strings) An array of arguments to use as default to pass to the `command`.
- `default_substrate_cli_args_version`: (0|1) Allow to set the substrate cli args version (see: https://github.com/paritytech/substrate/pull/13384). By default zombienet will evaluate your binary and set the correct version, but that produce an small overhead that could be skipped if you set directly with this key.
- `default_substrate_cli_args_version`: (0|1) Allow to set the substrate cli args version (see: https://github.com/paritytech/substrate/pull/13384). By default zombienet will evaluate your binary and set the correct version, but that produces a small overhead that could be skipped if you set directly with this key.
- `default_overrides`: (Array of objects) An array of overrides to upload to the nodes, objects with:
- `local_path`: string;
- `remote_name`: string;
Expand All @@ -42,7 +42,7 @@ The network config can be provided both in `json` or `toml` format and each sect
- `command`: (String) Override default command.
- `command_with_args`: (String) Override default command and args.
- `args`: (Array of strings) Arguments to be passed to the `command`.
- `substrate_cli_args_version`: (0|1) By default zombienet will evaluate your binary and set the correct version, but that produce an small overhead that could be skipped if you set directly with this key.
- `substrate_cli_args_version`: (0|1) By default zombienet will evaluate your binary and set the correct version, but that produces a small overhead that could be skipped if you set directly with this key.
- `validator`: (Boolean, default true) Pass the `--validator` flag to the `command`.
- `invulnerable`: (Boolean, default false) If true, the node will be added to `invulnerables` in the chain spec.
- `balance`: (number, default 2000000000000) Balance to set in `balances` for node's account.
Expand Down Expand Up @@ -70,7 +70,7 @@ The network config can be provided both in `json` or `toml` format and each sect
- `overrides`: Array of `overrides` definitions.
- `prometheus_prefix`: A parameter for customizing the metric's prefix for the specific node. Will apply to all the nodes of the group; Defaults to 'substrate'.
- `resources`: (Object) **Only** available in `kubernetes`, represent the resources `limits`/`reservations` needed by the node.
- `substrate_cli_args_version`: (0|1) By default zombienet will evaluate your binary and set the correct version, but that produce an small overhead that could be skipped if you set directly with this key.
- `substrate_cli_args_version`: (0|1) By default zombienet will evaluate your binary and set the correct version, but that produces a small overhead that could be skipped if you set directly with this key.

## `parachains`

Expand All @@ -90,7 +90,7 @@ The network config can be provided both in `json` or `toml` format and each sect
- `image`: (String) Image to use.
- `command`: (String, default `polkadot-parachain`) Command to run.
- `args`: (Array of strings) An array of arguments to use as default to pass to the `command`.
- `packages/orchestrator/src/providers/k8s/index.ts`: (0|1) By default zombienet will evaluate your binary and set the correct version, but that produce an small overhead that could be skipped if you set directly with this key.
- `packages/orchestrator/src/providers/k8s/index.ts`: (0|1) By default zombienet will evaluate your binary and set the correct version, but that produces a small overhead that could be skipped if you set directly with this key.
- `command_with_args`: (String) Overrides `command` and `args`.
- `env`: Array of env vars Object to set in the container.
- name: (String) name of the `env` var.
Expand All @@ -108,7 +108,7 @@ The network config can be provided both in `json` or `toml` format and each sect
- `env`: Array of env vars Object to set in the container.
- name: (String) name of the `env` var.
- value: (String| number) Value of the env var.
- `substrate_cli_args_version`: (0|1) By default zombienet will evaluate your binary and set the correct version, but that produce an small overhead that could be skipped if you set directly with this key.
- `substrate_cli_args_version`: (0|1) By default zombienet will evaluate your binary and set the correct version, but that produces a small overhead that could be skipped if you set directly with this key.

- `onboard_as_parachain`: (Boolean, default true) flag to specify whether the para should be onboarded as a parachain or stay a parathread
- `register_para`: (Boolean, default true) flag to specify whether the para should be registered. The `add_to_genesis` flag **must** be set to false for this flag to have any effect.
Expand Down
Loading

0 comments on commit edc30f4

Please sign in to comment.