docker-stack: add label and docs for options

This commit is contained in:
Dmitriy Pleshevskiy 2023-03-14 23:24:03 +03:00
parent af160ab156
commit 8fcf7d9bdf
Signed by: pleshevskiy
GPG key ID: 79C4487B44403985

View file

@ -75,8 +75,7 @@ let
networks = mkOption {
type = types.listOf types.str;
default = [ ];
description = lib.mdDoc ''
'';
description = lib.mdDoc "Networks to join.";
example = literalExpression ''
[
"backend_internal"
@ -88,24 +87,44 @@ let
extra_hosts = mkOption {
type = types.listOf types.str;
default = [ ];
description = lib.mdDoc ''
'';
description = lib.mdDoc "Add hostname mappings.";
example = literalExpression ''
[
"host.docker.internal:host-gateway"
"otherhost:50.31.209.229"
]
'';
};
deploy = {
labels = {
default = [ ];
type = types.listOf types.str;
description = lib.mdDoc "Specify labels for the service.";
example = literalExpression ''
[
"com.example.description=This label will appear on the web service"
]
'';
};
placement = {
constraints = mkOption {
default = [ ];
type = types.listOf types.str;
description = lib.mdDoc "";
example = [ "node.role==manager" ];
description = lib.mdDoc ''
You can limit the set of nodes where a task can be scheduled by defining constraint expressions.
Constraint expressions can either use a match (==) or exclude (!=) rule.
Multiple constraints find nodes that satisfy every expression (AND match).
'';
example = literalExample ''
[
"node.role==manager"
];
'';
};
};
update_config = {
order = mkOption {
default = "stop-first";
@ -127,9 +146,12 @@ let
networkOptions = { ... }: {
options = with lib; {
external = mkOption {
default = null;
default = false;
type = types.nullOr types.bool;
description = lib.mdDoc "";
description = lib.mdDoc ''
If set to true, specifies that this volume has been created outside of Compose.
The systemd service does not attempt to create it, and raises an error if it doesnt exist.
'';
example = "true";
};
};