mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-12 08:00:06 +01:00
Initial refactoring for kubenix 2.0
Implemented features: - Improved and reimplemented submodule system, independent of kubernetes module definitions - Pre-generated kubernetes module definitions with explicit API versioning support
This commit is contained in:
parent
7287c4ed9e
commit
3dc1e615c4
20 changed files with 207916 additions and 751 deletions
67
examples/module/nginx.nix
Normal file
67
examples/module/nginx.nix
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
{ config, lib, pkgs, kubenix, k8s, submodule, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
name = submodule.name;
|
||||
in {
|
||||
imports = [
|
||||
kubenix.k8s
|
||||
];
|
||||
|
||||
options.args = {
|
||||
replicas = mkOption {
|
||||
type = types.int;
|
||||
description = "Number of nginx replicas to run";
|
||||
default = 1;
|
||||
};
|
||||
|
||||
simpleAuth = k8s.mkSecretOption {
|
||||
description = "Simple auth";
|
||||
default = {
|
||||
key = "name";
|
||||
name = "value";
|
||||
};
|
||||
};
|
||||
|
||||
image = mkOption {
|
||||
description = "Image";
|
||||
type = types.str;
|
||||
default = "nginx";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
submodule = {
|
||||
name = "nginx";
|
||||
version = "1.0.0";
|
||||
description = "Nginx module";
|
||||
passthru = {
|
||||
kubernetes.objects = config.kubernetes.objects;
|
||||
};
|
||||
};
|
||||
|
||||
kubernetes.api.Deployment.nginx = {
|
||||
metadata = {
|
||||
name = name;
|
||||
labels = {
|
||||
module = config.submodule.name;
|
||||
};
|
||||
};
|
||||
|
||||
spec = {
|
||||
replicas = config.args.replicas;
|
||||
selector.matchLabels.app = "nginx";
|
||||
template.metadata.labels.app = "nginx";
|
||||
template.spec = {
|
||||
containers.nginx = {
|
||||
image = config.args.image;
|
||||
env = {
|
||||
SIMPLE_AUTH = k8s.secretToEnv config.args.simpleAuth;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue