mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2026-02-02 09:25:10 +01:00
switch formatting to nixpkgs-fmt
This commit is contained in:
parent
3598716c73
commit
2712e89716
65 changed files with 4839 additions and 5222 deletions
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
deployment = import ./deployment {};
|
||||
testing = import ./testing {};
|
||||
deployment = import ./deployment { };
|
||||
testing = import ./testing { };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
{kubenix ? import ../../../..}:
|
||||
{ kubenix ? import ../../../.. }:
|
||||
kubenix.evalModules.${builtins.currentSystem} {
|
||||
module = {kubenix, ...}: {
|
||||
module = { kubenix, ... }: {
|
||||
# instead of defining everything inline, let's import it
|
||||
imports = [./module.nix];
|
||||
imports = [ ./module.nix ];
|
||||
|
||||
# annotate the generated resources with a project name
|
||||
kubenix.project = "example";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{kubenix, ...}: {
|
||||
imports = [kubenix.modules.k8s];
|
||||
{ kubenix, ... }: {
|
||||
imports = [ kubenix.modules.k8s ];
|
||||
|
||||
kubernetes.resources = {
|
||||
deployments.nginx.spec = {
|
||||
|
|
@ -50,12 +50,10 @@
|
|||
|
||||
services.nginx.spec = {
|
||||
selector.app = "nginx";
|
||||
ports = [
|
||||
{
|
||||
name = "http";
|
||||
port = 80;
|
||||
}
|
||||
];
|
||||
ports = [{
|
||||
name = "http";
|
||||
port = 80;
|
||||
}];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{kubenix ? import ../../../..}:
|
||||
{ kubenix ? import ../../../.. }:
|
||||
kubenix.evalModules.${builtins.currentSystem} {
|
||||
module = {kubenix, ...}: {
|
||||
imports = [kubenix.modules.helm];
|
||||
module = { kubenix, ... }: {
|
||||
imports = [ kubenix.modules.helm ];
|
||||
kubernetes.helm.releases.example = {
|
||||
chart = kubenix.lib.helm.fetch {
|
||||
repo = "https://charts.bitnami.com/bitnami";
|
||||
|
|
|
|||
|
|
@ -1,15 +1,10 @@
|
|||
{kubenix ? import ../../../..}:
|
||||
{ kubenix ? import ../../../.. }:
|
||||
kubenix.evalModules.${builtins.currentSystem} {
|
||||
module = {
|
||||
kubenix,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
imports = with kubenix.modules; [k8s docker];
|
||||
module = { kubenix, config, pkgs, ... }: {
|
||||
imports = with kubenix.modules; [ k8s docker ];
|
||||
docker = {
|
||||
registry.url = "docker.somewhere.io";
|
||||
images.example.image = pkgs.callPackage ./image.nix {};
|
||||
images.example.image = pkgs.callPackage ./image.nix { };
|
||||
};
|
||||
kubernetes.resources.pods.example.spec.containers = {
|
||||
custom.image = config.docker.images.example.path;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
{
|
||||
dockerTools,
|
||||
nginx,
|
||||
}:
|
||||
{ dockerTools, nginx }:
|
||||
dockerTools.buildLayeredImage {
|
||||
name = "nginx";
|
||||
contents = [nginx];
|
||||
contents = [ nginx ];
|
||||
extraCommands = ''
|
||||
mkdir -p etc
|
||||
chmod u+w etc
|
||||
|
|
@ -12,9 +9,9 @@ dockerTools.buildLayeredImage {
|
|||
echo "nginx:x:1000:nginx" > etc/group
|
||||
'';
|
||||
config = {
|
||||
Cmd = ["nginx" "-c" "/etc/nginx/nginx.conf"];
|
||||
Cmd = [ "nginx" "-c" "/etc/nginx/nginx.conf" ];
|
||||
ExposedPorts = {
|
||||
"80/tcp" = {};
|
||||
"80/tcp" = { };
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{kubenix ? import ../../../..}:
|
||||
{ kubenix ? import ../../../.. }:
|
||||
kubenix.evalModules.${builtins.currentSystem} {
|
||||
module = {kubenix, ...}: {
|
||||
imports = [./module.nix];
|
||||
module = { kubenix, ... }: {
|
||||
imports = [ ./module.nix ];
|
||||
|
||||
kubenix.project = "multi-namespace-example";
|
||||
kubernetes.version = "1.24";
|
||||
|
|
|
|||
|
|
@ -1,11 +1,5 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
kubenix,
|
||||
...
|
||||
}: {
|
||||
imports = with kubenix.modules; [submodules k8s];
|
||||
{ config, lib, pkgs, kubenix, ... }: {
|
||||
imports = with kubenix.modules; [ submodules k8s ];
|
||||
|
||||
# Import submodule.
|
||||
submodules.imports = [
|
||||
|
|
@ -26,12 +20,10 @@
|
|||
# Now we can set the args options defined in the submodule.
|
||||
args.kubernetes.resources = {
|
||||
services.nginx.spec = {
|
||||
ports = [
|
||||
{
|
||||
name = "http";
|
||||
port = 80;
|
||||
}
|
||||
];
|
||||
ports = [{
|
||||
name = "http";
|
||||
port = 80;
|
||||
}];
|
||||
selector.app = "nginx";
|
||||
};
|
||||
};
|
||||
|
|
@ -41,12 +33,10 @@
|
|||
submodule = "namespaced";
|
||||
args.kubernetes.resources = {
|
||||
services.nginx.spec = {
|
||||
ports = [
|
||||
{
|
||||
name = "https";
|
||||
port = 443;
|
||||
}
|
||||
];
|
||||
ports = [{
|
||||
name = "https";
|
||||
port = 443;
|
||||
}];
|
||||
selector.app = "nginx";
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
{
|
||||
config,
|
||||
kubenix,
|
||||
lib,
|
||||
# Name of submodule instance.
|
||||
name,
|
||||
# This is a shorthand for config.submodule.args and contains
|
||||
{ config
|
||||
, kubenix
|
||||
, lib
|
||||
, # Name of submodule instance.
|
||||
name
|
||||
, # This is a shorthand for config.submodule.args and contains
|
||||
# final values of the args options.
|
||||
args,
|
||||
...
|
||||
args
|
||||
, ...
|
||||
}: {
|
||||
imports = with kubenix.modules; [
|
||||
# This needs to be imported in order to define a submodule.
|
||||
|
|
@ -25,7 +24,7 @@
|
|||
# to set kubernetes options from the k8s module which are already
|
||||
# precisely typed.
|
||||
type = lib.types.attrs;
|
||||
default = {};
|
||||
default = { };
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -54,9 +53,9 @@
|
|||
|
||||
kubernetes = lib.mkMerge [
|
||||
# Use instance name as namespace
|
||||
{namespace = name;}
|
||||
{ namespace = name; }
|
||||
# Create namespace object
|
||||
{resources.namespaces.${name} = {};}
|
||||
{ resources.namespaces.${name} = { }; }
|
||||
# All resources defined here will use the above namespace
|
||||
args.kubernetes
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
# let's creata a function whose only input is the kubenix package
|
||||
{kubenix ? import ../../../..}:
|
||||
{ kubenix ? import ../../../.. }:
|
||||
# evalModules is our main entrypoint
|
||||
kubenix.evalModules.${builtins.currentSystem} {
|
||||
# to it, we pass a module that accepts a (different) kubenix object
|
||||
module = {kubenix, ...}: {
|
||||
module = { kubenix, ... }: {
|
||||
# in order to define options, we need to import their definitions
|
||||
imports = [kubenix.modules.k8s];
|
||||
imports = [ kubenix.modules.k8s ];
|
||||
# now we have full access to define Kubernetes resources
|
||||
kubernetes.resources.pods = {
|
||||
# "example" is the name of our pod
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{kubenix ? import ../../../..}:
|
||||
{ kubenix ? import ../../../.. }:
|
||||
kubenix.evalModules.${builtins.currentSystem} {
|
||||
module = {kubenix, ...}: {
|
||||
imports = [kubenix.modules.k8s];
|
||||
module = { kubenix, ... }: {
|
||||
imports = [ kubenix.modules.k8s ];
|
||||
kubernetes.resources.secrets.example.stringData = {
|
||||
password = "ref+file:///path/to/secret";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,17 +1,15 @@
|
|||
{kubenix ? import ../../../..}:
|
||||
{ kubenix ? import ../../../.. }:
|
||||
kubenix.evalModules.x86_64-linux {
|
||||
module = {kubenix, ...}: {
|
||||
imports = [kubenix.modules.testing];
|
||||
module = { kubenix, ... }: {
|
||||
imports = [ kubenix.modules.testing ];
|
||||
testing = {
|
||||
tests = [./test.nix];
|
||||
common = [
|
||||
{
|
||||
features = ["k8s"];
|
||||
options = {
|
||||
kubernetes.version = "1.24";
|
||||
};
|
||||
}
|
||||
];
|
||||
tests = [ ./test.nix ];
|
||||
common = [{
|
||||
features = [ "k8s" ];
|
||||
options = {
|
||||
kubernetes.version = "1.24";
|
||||
};
|
||||
}];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
{
|
||||
kubenix,
|
||||
test,
|
||||
...
|
||||
}: {
|
||||
imports = [kubenix.modules.test];
|
||||
{ kubenix, test, ... }: {
|
||||
imports = [ kubenix.modules.test ];
|
||||
|
||||
test = {
|
||||
name = "example";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue