Merge pull request #9527 from offlinehacker/nixos/kube/options

kubernetes service: add a few options

Changed files
+55 -12
nixos
modules
services
cluster
+55 -12
nixos/modules/services/cluster/kubernetes.nix
···
tokenAuth = mkOption {
description = ''
Kubernetes apiserver token authentication file. See
-
<link xlink:href="https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/authentication.md"/>
+
<link xlink:href="http://kubernetes.io/v1.0/docs/admin/authentication.html"/>
'';
default = {};
example = literalExample ''
···
authorizationMode = mkOption {
description = ''
Kubernetes apiserver authorization mode (AlwaysAllow/AlwaysDeny/ABAC). See
-
<link xlink:href="https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/authorization.md"/>
+
<link xlink:href="http://kubernetes.io/v1.0/docs/admin/authorization.html"/>
'';
default = "AlwaysAllow";
type = types.enum ["AlwaysAllow" "AlwaysDeny" "ABAC"];
···
authorizationPolicy = mkOption {
description = ''
Kubernetes apiserver authorization policy file. See
-
<link xlink:href="https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/authorization.md"/>
+
<link xlink:href="http://kubernetes.io/v1.0/docs/admin/authorization.html"/>
'';
default = [];
example = literalExample ''
···
};
runtimeConfig = mkOption {
-
description = "Api runtime configuration";
+
description = ''
+
Api runtime configuration. See
+
<link xlink:href="http://kubernetes.io/v1.0/docs/admin/cluster-management.html"/>
+
'';
default = "";
example = "api/all=false,api/v1=true";
type = types.str;
};
admissionControl = mkOption {
-
description = "Kubernetes admission control plugins to use.";
+
description = ''
+
Kubernetes admission control plugins to use. See
+
<link xlink:href="http://kubernetes.io/v1.0/docs/admin/admission-controllers.html"/>
+
'';
default = ["AlwaysAdmit"];
+
example = [
+
"NamespaceLifecycle" "NamespaceExists" "LimitRanger"
+
"SecurityContextDeny" "ServiceAccount" "ResourceQuota"
+
];
type = types.listOf types.str;
+
};
+
+
serviceAccountKey = mkOption {
+
description = ''
+
Kubernetes apiserver PEM-encoded x509 RSA private or public key file,
+
used to verify ServiceAccount tokens.
+
'';
+
default = null;
+
type = types.nullOr types.path;
};
extraOpts = mkOption {
···
type = types.str;
};
+
serviceAccountPrivateKey = mkOption {
+
description = ''
+
Kubernetes controller manager PEM-encoded private RSA key file used to
+
sign service account tokens
+
'';
+
default = null;
+
type = types.nullOr types.path;
+
};
+
+
rootCaFile = mkOption {
+
description = ''
+
Kubernetes controller manager certificate authority file included in
+
service account's token secret.
+
'';
+
default = null;
+
type = types.nullOr types.path;
+
};
+
extraOpts = mkOption {
-
description = "Kubernetes controller extra command line options.";
+
description = "Kubernetes controller manager extra command line options.";
default = "";
type = types.str;
};
···
};
apiServers = mkOption {
-
description = "Kubernetes kubelet list of Kubernetes API servers for publishing events, and reading pods and services.";
+
description = ''
+
Kubernetes kubelet list of Kubernetes API servers for publishing events,
+
and reading pods and services.
+
'';
default = ["${cfg.apiserver.address}:${toString cfg.apiserver.port}"];
type = types.listOf types.str;
};
···
${optionalString (cfg.apiserver.runtimeConfig!="")
"--runtime-config=${cfg.apiserver.runtimeConfig}"} \
--admission_control=${concatStringsSep "," cfg.apiserver.admissionControl} \
+
${optionalString (cfg.apiserver.serviceAccountKey!=null)
+
"--service-account-key-file=${cfg.apiserver.serviceAccountKey}"} \
--logtostderr=true \
${optionalString cfg.verbose "--v=6 --log-flush-frequency=1s"} \
${cfg.apiserver.extraOpts}
'';
User = "kubernetes";
};
-
postStart = ''
-
until ${pkgs.curl}/bin/curl -s -o /dev/null 'http://${cfg.apiserver.address}:${toString cfg.apiserver.port}/'; do
-
sleep 1;
-
done
-
'';
};
})
···
--address=${cfg.controllerManager.address} \
--port=${toString cfg.controllerManager.port} \
--master=${cfg.controllerManager.master} \
+
${optionalString (cfg.controllerManager.serviceAccountPrivateKey!=null)
+
"--service-account-private-key-file=${cfg.controllerManager.serviceAccountPrivateKey}"} \
+
${optionalString (cfg.controllerManager.rootCaFile!=null)
+
"--root-ca-file=${cfg.controllerManager.rootCaFile}"} \
--logtostderr=true \
${optionalString cfg.verbose "--v=6 --log-flush-frequency=1s"} \
${cfg.controllerManager.extraOpts}
···
${optionalString cfg.verbose "--v=6 --log-flush-frequency=1s"} \
${cfg.proxy.extraOpts}
'';
+
Restart = "always"; # Retry connection
+
RestartSec = "5s";
};
};
})