mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-11 23:50:06 +01:00
feat(legacy): refactor legacy kubenix support
This commit is contained in:
parent
a8dcc69d54
commit
9f05cd56b1
8 changed files with 139 additions and 98 deletions
|
|
@ -30,7 +30,7 @@ let
|
|||
./k8s/order.nix
|
||||
./k8s/submodule.nix
|
||||
./k8s/imports.nix
|
||||
./k8s/v1/modules.nix
|
||||
./k8s/legacy.nix
|
||||
./helm/simple.nix
|
||||
./istio/bookinfo.nix
|
||||
./submodules/simple.nix
|
||||
|
|
|
|||
58
tests/k8s/legacy.nix
Normal file
58
tests/k8s/legacy.nix
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
{ config, lib, kubenix, pkgs, k8sVersion, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
|
||||
imports = with kubenix.modules; [ test k8s legacy ];
|
||||
|
||||
test = {
|
||||
name = "k8s-legacy";
|
||||
description = "Simple test tesing kubenix legacy support";
|
||||
assertions = [];
|
||||
};
|
||||
|
||||
kubernetes.version = k8sVersion;
|
||||
|
||||
kubernetes.moduleDefinitions.app.module = { config, k8s, ... }: {
|
||||
options = {
|
||||
replicas = mkOption {
|
||||
description = "Number of replicas to run";
|
||||
type = types.int;
|
||||
default = 2;
|
||||
};
|
||||
};
|
||||
|
||||
config.kubernetes.defaults = {
|
||||
all = [{
|
||||
metadata.labels.default = "value";
|
||||
}];
|
||||
|
||||
deployments = [{
|
||||
metadata.labels.default2 = "value2";
|
||||
} {
|
||||
metadata.labels.default3 = "value3";
|
||||
}];
|
||||
};
|
||||
|
||||
config.kubernetes.resources.deployments.app = {
|
||||
spec = {
|
||||
replicas = config.replicas;
|
||||
selector = {
|
||||
matchLabels.app = "app";
|
||||
};
|
||||
template.spec = {
|
||||
containers.app = {
|
||||
image = "hello-world";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
kubernetes.modules.myapp = {
|
||||
module = "app";
|
||||
namespace = "test";
|
||||
configuration.replicas = 3;
|
||||
};
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
{ config, lib, kubenix, pkgs, k8sVersion, ... }: {
|
||||
|
||||
imports = with kubenix.modules; [ test k8s v1.modules ];
|
||||
|
||||
test = {
|
||||
name = "k8s-v1-modules";
|
||||
description = "Simple test tesing CRD";
|
||||
assertions = [];
|
||||
};
|
||||
|
||||
kubernetes.version = k8sVersion;
|
||||
|
||||
kubernetes.moduleDefinitions.app.module = { config, k8s, ... }: {
|
||||
kubernetes.resources.deployments.app = {
|
||||
spec = {
|
||||
replicas = 2;
|
||||
selector = {
|
||||
matchLabels.app = "app";
|
||||
};
|
||||
template.spec = {
|
||||
containers.app = {
|
||||
image = "hello-world";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
kubernetes.modules.myapp = {
|
||||
module = "app";
|
||||
namespace = "test";
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue