feat(examples/nginx-deployment): minor refactor, fixes and e2e test

This commit is contained in:
Jaka Hudoklin 2019-03-07 23:24:28 +01:00
parent eac2d78667
commit fc9abaa519
No known key found for this signature in database
GPG key ID: 6A08896BFD32BD95
4 changed files with 54 additions and 14 deletions

View file

@ -1,26 +1,36 @@
{ kubenix ? import ../.. {} }:
{ kubenix ? import ../.. {}, registry ? "docker.io/gatehub" }:
with kubenix.lib;
let
registry = "docker.io/gatehub";
in rec {
rec {
# evaluated configuration
config = (kubenix.evalModules {
modules = [
./module.nix
{ docker.registry.url = registry; }
kubenix.modules.testing
{
testing.tests = [ ./test.nix ];
testing.defaults = ({ lib, ... }: with lib; {
docker.registry.url = mkForce "";
kubernetes.version = config.kubernetes.version;
});
}
];
}).config;
# list of kubernetes objects
objects = config.kubernetes.objects;
# e2e test
test = config.testing.result;
# nixos test script for running the test
test-script = config.testing.testsByName.nginx-deployment.test;
# hashed kubernetes List object
listObject = k8s.mkHashedList { items = config.kubernetes.objects; };
result = k8s.mkHashedList { items = config.kubernetes.objects; };
# YAML file you can deploy to kubernetes
yaml = toYAML listObject;
yaml = toYAML k8s-result;
# Exported docker images
images = config.docker.export;