mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-12 16:10:05 +01:00
first commit
This commit is contained in:
commit
cbf84e25a5
22 changed files with 131008 additions and 0 deletions
54
test/modules.nix
Normal file
54
test/modules.nix
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
{lib, k8s, ...}:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
kubernetes.moduleDefinitions.nginx.module = {name, config, ...}: {
|
||||
options = {
|
||||
port = mkOption {
|
||||
description = "Port for nginx to listen on";
|
||||
type = types.int;
|
||||
default = 80;
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
kubernetes.resources.deployments.nginx = mkMerge [
|
||||
(k8s.loadJSON ./deployment.json)
|
||||
{
|
||||
metadata.name = "${name}-nginx";
|
||||
|
||||
spec.template.spec.containers.nginx.ports."80" = {
|
||||
containerPort = config.port;
|
||||
};
|
||||
|
||||
spec.template.spec.containers.nginx.env.name.valueFrom.secretKeyRef = {
|
||||
name = config.kubernetes.resources.configMaps.nginx.metadata.name;
|
||||
key = "somekey";
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
kubernetes.resources.configMaps.nginx = mkMerge [
|
||||
(k8s.loadJSON ./configMap.json)
|
||||
{
|
||||
metadata.name = mkForce "${name}-nginx";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
kubernetes.modules.app-v1.module = "nginx";
|
||||
kubernetes.modules.app-v2 = {
|
||||
module = "nginx";
|
||||
configuration.port = 8080;
|
||||
};
|
||||
|
||||
kubernetes.resources.services.nginx = k8s.loadJSON ./service.json;
|
||||
|
||||
kubernetes.defaultModuleConfiguration = [{
|
||||
kubernetes.defaults.deployments.spec.replicas = 3;
|
||||
}];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue