mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-12 16:10:05 +01:00
feat(lib): make explicit secretToEnv function that converts mkSecretOption to env
This commit is contained in:
parent
699511bf54
commit
642a31b0d0
3 changed files with 10 additions and 12 deletions
|
|
@ -14,7 +14,7 @@ let
|
||||||
args = {
|
args = {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
name = "default";
|
name = "default";
|
||||||
k8s = { inherit loadJSON loadYAML toYAML toBase64 octalToDecimal mkSecretOption; };
|
k8s = { inherit loadJSON loadYAML toYAML toBase64 octalToDecimal mkSecretOption secretToEnv; };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
12
lib.nix
12
lib.nix
|
|
@ -62,11 +62,11 @@ rec {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
apply = value: if value == null then null else {
|
|
||||||
valueFrom.secretKeyRef = {
|
|
||||||
inherit (value) name key;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
secretToEnv = value: {
|
||||||
|
valueFrom.secretKeyRef = {
|
||||||
|
inherit (value) name key;
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,7 @@ with lib;
|
||||||
|
|
||||||
password = mkSecretOption {
|
password = mkSecretOption {
|
||||||
description = "Nginx simple auth credentials";
|
description = "Nginx simple auth credentials";
|
||||||
default = {
|
default = null;
|
||||||
key = "test";
|
|
||||||
name = "test";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -32,7 +29,8 @@ with lib;
|
||||||
containerPort = config.port;
|
containerPort = config.port;
|
||||||
};
|
};
|
||||||
|
|
||||||
spec.template.spec.containers.nginx.env.name = mkIf (config.password != null) config.password;
|
spec.template.spec.containers.nginx.env.name =
|
||||||
|
mkIf (config.password != null) (secretToEnv config.password);
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue