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 { networks = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [ ];
description = lib.mdDoc '' description = lib.mdDoc "Networks to join.";
'';
example = literalExpression '' example = literalExpression ''
[ [
"backend_internal" "backend_internal"
@ -88,24 +87,44 @@ let
extra_hosts = mkOption { extra_hosts = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [ ];
description = lib.mdDoc '' description = lib.mdDoc "Add hostname mappings.";
'';
example = literalExpression '' example = literalExpression ''
[ [
"host.docker.internal:host-gateway" "host.docker.internal:host-gateway"
"otherhost:50.31.209.229"
] ]
''; '';
}; };
deploy = { 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 = { placement = {
constraints = mkOption { constraints = mkOption {
default = [ ]; default = [ ];
type = types.listOf types.str; type = types.listOf types.str;
description = lib.mdDoc ""; description = lib.mdDoc ''
example = [ "node.role==manager" ]; 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 = { update_config = {
order = mkOption { order = mkOption {
default = "stop-first"; default = "stop-first";
@ -127,9 +146,12 @@ let
networkOptions = { ... }: { networkOptions = { ... }: {
options = with lib; { options = with lib; {
external = mkOption { external = mkOption {
default = null; default = false;
type = types.nullOr types.bool; 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"; example = "true";
}; };
}; };