set vscode formatter to alejandra, format repo

This commit is contained in:
Bryton Hall 2022-08-13 18:20:59 -04:00
parent 1a02818ca8
commit f251d55857
9 changed files with 16246 additions and 24556 deletions

View file

@ -1,6 +1,5 @@
{ {
"recommendations": [ "recommendations": [
"EditorConfig.EditorConfig",
"mkhl.direnv" "mkhl.direnv"
] ]
} }

3
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,3 @@
{
"nix.formatterPath": "alejandra"
}

View file

@ -1,28 +1,21 @@
# Example: kubernetes nginx deployment # nginx deployment
A simple example creating kubernetes nginx deployment and associated docker A simple example creating an nginx docker image and deployment.
image
## Usage ## Usage
### Building and applying kubernetes configuration ### Building and applying kubernetes configuration
```
nix eval -f ./. --json result | kubectl apply -f - nix eval -f ./. --json result | kubectl apply -f -
```
### Building and pushing docker images ### Building and pushing docker images
```
nix run -f ./. pushDockerImages -c copy-docker-images nix run -f ./. pushDockerImages -c copy-docker-images
```
### Running tests ### Running tests
Test will spawn vm with kubernetes and run test script, which checks if everyting Test will spawn vm with Kubernetes and run test script, which checks if everything
works as expected. works as expected.
```
nix build -f ./. test-script nix build -f ./. test-script
cat result | jq '.' cat result | jq '.'
```

View file

@ -12,8 +12,8 @@ in {
docker.images.nginx.image = nginx; docker.images.nginx.image = nginx;
kubernetes.resources.deployments.nginx = { kubernetes.resources = {
spec = { deployments.nginx.spec = {
replicas = 10; replicas = 10;
selector.matchLabels.app = "nginx"; selector.matchLabels.app = "nginx";
template = { template = {
@ -23,17 +23,21 @@ in {
containers.nginx = { containers.nginx = {
image = config.docker.images.nginx.path; image = config.docker.images.nginx.path;
imagePullPolicy = "IfNotPresent"; imagePullPolicy = "IfNotPresent";
volumeMounts."/etc/nginx".name = "config"; volumeMounts = {
volumeMounts."/var/lib/html".name = "static"; "/etc/nginx".name = "config";
"/var/lib/html".name = "static";
}; };
volumes.config.configMap.name = "nginx-config"; };
volumes.static.configMap.name = "nginx-static"; volumes = {
config.configMap.name = "nginx-config";
static.configMap.name = "nginx-static";
}; };
}; };
}; };
}; };
kubernetes.resources.configMaps.nginx-config.data."nginx.conf" = '' configMaps = {
nginx-config.data."nginx.conf" = ''
user nginx nginx; user nginx nginx;
daemon off; daemon off;
error_log /dev/stdout info; error_log /dev/stdout info;
@ -51,12 +55,12 @@ in {
} }
''; '';
kubernetes.resources.configMaps.nginx-static.data."index.html" = '' nginx-static.data."index.html" = ''
<html><body><h1>Hello from NGINX</h1></body></html> <html><body><h1>Hello from NGINX</h1></body></html>
''; '';
};
kubernetes.resources.services.nginx = { services.nginx.spec = {
spec = {
ports = [ ports = [
{ {
name = "http"; name = "http";

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff