kubenix/examples/nginx-deployment
David Arnold 0c99276b50
fix: test kubernetes manifest
nix-repl> test-nginx = g.config.testing.testsByName.nginx-deployment.evaled.config.kubernetes.resources.deployments.nginx
nix-repl> test-nginx.spec.template.spec.containers.nginx.image
"nginx:dy4y4j45arjj9sgyjb90sv035sxglpv8"

vs

nix-repl> nginx = g.config.kubernetes.resources.deployments.nginx
nix-repl> nginx.spec.template.spec.containers.nginx.image
"docker.io/gatehub/nginx:dy4y4j45arjj9sgyjb90sv035sxglpv8"
2021-05-31 21:46:13 -05:00
..
default.nix fixup tests 2021-05-31 21:14:39 -05:00
image.nix fmt 2021-05-13 17:33:58 -04:00
module.nix fmt 2021-05-13 17:33:58 -04:00
README.md feat(examples/nginx-deployment): use nix eval for applying configuration 2019-03-12 21:08:54 +01:00
test.nix fix: test kubernetes manifest 2021-05-31 21:46:13 -05:00

Example: kubernetes nginx deployment

A simple example creating kubernetes nginx deployment and associated docker image

Usage

Building and applying kubernetes configuration

nix eval -f ./. --json result | kubectl apply -f -

Building and pushing docker images

nix run -f ./. pushDockerImages -c copy-docker-images

Running tests

Test will spawn vm with kubernetes and run test script, which checks if everyting works as expected.

nix build -f ./. test-script
cat result | jq '.'