mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-12 08:00:06 +01:00
Refactor:
- Support for module features - Remove kubenix.module and rather use explicit modules - Make tests framework independent of k8s module - Remove metacontroller submodule, which will go to kubenix-modules - Improved submodule propagation and passthru - Added additional test for k8s-submodule
This commit is contained in:
parent
b670139906
commit
6183fcc190
30 changed files with 513 additions and 508 deletions
56
tests/k8s/submodule.nix
Normal file
56
tests/k8s/submodule.nix
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
{ name, config, lib, kubenix, images, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.submodules.instances.passthru;
|
||||
in {
|
||||
imports = with kubenix.modules; [ test submodules k8s docker ];
|
||||
|
||||
test = {
|
||||
name = "k8s-submodule";
|
||||
description = "Simple k8s submodule test";
|
||||
assertions = [{
|
||||
message = "Submodule has correct name set";
|
||||
assertion = (head config.kubernetes.objects).metadata.name == "passthru";
|
||||
} {
|
||||
message = "Should expose docker image";
|
||||
assertion = (head config.docker.export).imageName == "xtruder/nginx";
|
||||
}];
|
||||
};
|
||||
|
||||
kubenix.project = "test-release";
|
||||
|
||||
kubernetes.namespace = "test-namespace";
|
||||
|
||||
submodules.imports = [{
|
||||
module = {name, config, ...}: {
|
||||
imports = with kubenix.modules; [ submodule k8s docker ];
|
||||
|
||||
config = {
|
||||
submodule.name = "test-submodule";
|
||||
|
||||
kubernetes.api.pods.nginx = {
|
||||
metadata.name = name;
|
||||
spec.containers.nginx.image = config.docker.images.nginx.path;
|
||||
};
|
||||
|
||||
docker.images.nginx.image = images.nginx;
|
||||
};
|
||||
};
|
||||
}];
|
||||
|
||||
kubernetes.api.defaults = [{
|
||||
propagate = true;
|
||||
default.metadata.labels.my-label = "my-value";
|
||||
}];
|
||||
|
||||
submodules.instances.passthru = {
|
||||
submodule = "test-submodule";
|
||||
};
|
||||
|
||||
submodules.instances.no-passthru = {
|
||||
submodule = "test-submodule";
|
||||
passthru.enable = false;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue