kubenix/examples/nginx-deployment/default.nix

41 lines
990 B
Nix
Raw Normal View History

{ kubenix ? import ../.. {}, registry ? "docker.io/gatehub" }:
2019-03-07 18:03:51 +01:00
with kubenix.lib;
rec {
2019-03-07 18:03:51 +01:00
# 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;
});
}
2019-03-07 18:03:51 +01:00
];
}).config;
# e2e test
test = config.testing.result;
# nixos test script for running the test
test-script = config.testing.testsByName.nginx-deployment.test;
2019-03-07 18:03:51 +01:00
# hashed kubernetes List object
result = k8s.mkHashedList { items = config.kubernetes.objects; };
2019-03-07 18:03:51 +01:00
# YAML file you can deploy to kubernetes
yaml = toYAML k8s-result;
2019-03-07 18:03:51 +01:00
# Exported docker images
images = config.docker.export;
# script to push docker images to registry
pushDockerImages = config.docker.copyScript;
2019-03-07 18:03:51 +01:00
}