V2 池参考
下表描述了所有可能的配置选项。大部分字段具有合理的默认值,应谨慎修改。
配置指南
- 如果未设置默认值,即使是对象,也将留空。
- 在离 root 对象最远的对象中设置默认值。
- 始终为阵列设置默认值。
- “nullable”的目的是允许将输出 JSON 字段设置为 golang“零值”。如果没有“nullable”,则该字段将从生成的 JSON 中完全删除。
- 实际的验证是在代码中进行的,而不是在 swagger 中。
- 空的 boolean 被解释为“false”,因此,不设置默认值。
- CamelCase。
- 如果是顶级定义,那么 Swagger 只能进行 enum 验证。
池
池包含有关池所需资源的信息。对此部分所做的更改将重新启动任务。
密钥 |
类型 |
Nullable |
属性 |
说明 |
apiVersion |
string |
|
|
The api/schema version of this pool object. Should be V2 for new pools. |
name |
string |
|
|
The pool name. |
namespace |
string |
true |
|
The DC/OS space (sometimes also referred to as a “group”). |
packageName |
string |
|
|
|
packageVersion |
string |
|
|
|
role |
string |
|
|
Mesos role for load balancers. Defaults to “slave_public” so that load balancers will be run on public agents. Use “*” to run load balancers on private agents. Read more about Mesos roles at http://mesos.apache.org/documentation/latest/roles/. |
cpus |
number |
|
|
|
cpusAdminOverhead |
number |
|
|
|
mem |
int32 |
|
|
Memory requirements (in MB). |
memAdminOverhead |
int32 |
|
|
Memory requirements (in MB). |
disk |
int32 |
|
|
Disk size (in MB). |
count |
integer |
true |
|
Number of load balancer instances in the pool. |
constraints |
string |
true |
|
Marathon style constraints for load balancer instance placement. |
ports |
array |
|
|
- Override ports to allocate for each load balancer instance.
- Defaults to {{haproxy.frontend.objs[].bindPort}} and {{haproxy.stats.bindPort}}.
- Use this field to pre-allocate all needed ports with or without the frontends present. For example: [80, 443, 9090].
- If the length of the ports array is not zero, only the ports specified will be allocated by the pool scheduler.
|
items |
int32 |
|
|
|
secrets |
array |
|
|
DC/OS secrets. |
environmentVariables |
object |
|
additionalProperties |
Environment variables to pass to tasks. Prefix with ELB_FILE_ and it will be written to a file. For example, the contents of ELB_FILE_MYENV will be written to $ENVFILE/ELB_FILE_MYENV . |
autoCertificate |
boolean |
|
|
Autogenerate a self-signed SSL/TLS certificate. It is not generated by default. It will be written to $AUTOCERT . |
virtualNetworks |
array |
|
|
Virtual networks to join. |
haproxy |
|
|
|
|
pool.secrets
pool.secrets.secret
密钥 |
类型 |
说明 |
secret |
string |
Secret name. |
file |
string |
File name. The file myfile will be found at $SECRETS/myfile . |
pool.environmentVariables
密钥 |
类型 |
说明 |
additionalProperties |
string |
Environment variables to pass to tasks. Prefix with “ELB_FILE_” and it will be written to a file. For example, the contents of “ELB_FILE_MYENV” will be written to “$ENVFILE/ELB_FILE_MYENV”. |
pool.virtualNetworks
Key |
Type |
Description |
name |
string |
The name of the virtual network to join. |
labels |
string |
Labels to pass to the virtual network plugin. |
pool.haproxy
Key |
Type |
Description |
stats |
|
|
frontends |
array |
Array of frontends. |
backends |
array |
Array of backends. |
pool.haproxy.stats
密钥 |
类型 |
bindAddress |
string |
bindPort |
int 32 |
pool.haproxy.frontend
密钥 |
类型 |
属性 |
说明 |
x-nullable |
格式 |
name |
string |
|
Defaults to frontend_{{bindAddress}}_{{bindPort}} . |
|
|
bindPort |
integer |
|
The port (e.g. 80 for HTTP or 443 for HTTPS) that this frontend will bind to. |
|
int32 |
bindModifier |
string |
|
Additional text to put in the bind field |
|
|
certificates |
array |
|
SSL/TLS certificates in the load balancer.
For secrets, use $SECRETS/my_file_name For environment files, use $ENVFILE/my_file_name For autoCertificate, use $AUTOCERT . type: string |
|
|
redirectToHttps |
object |
|
Setting this to the empty object is enough to redirect all traffic from HTTP (this frontend) to HTTPS (port 443). Default: except: [] |
|
|
miscStrs |
array of strings |
|
Additional template lines inserted before use_backend |
|
|
protocol |
|
|
The frontend protocol is how clients/users communicate with HAProxy. |
|
|
linkBackend |
object |
|
This describes what backends to send traffic to. This can be expressed with a variety of filters such as matching on the hostname or the HTTP URL path. Default: map: [] |
|
|
pool.haproxy.frontend.redirectToHttps
密钥 |
类型 |
属性 |
说明 |
except |
array |
|
You can additionally set a whitelist of fields that must be matched to allow HTTP. |
items |
object |
|
Boolean AND will be applied with every selected value. |
pool.frontend.redirectToHttps.items
Key |
Type |
Description |
host |
string |
Match on host. |
pathBeg |
string |
Math on path. |
pool.haproxy.frontend.linkBackend
Key |
Type |
Properties |
Description |
defaultBackend |
string |
|
This is default backend that is routed to if none of the other filters are matched. |
map |
array |
|
This is an optional field that specifies a mapping to various backends. These rules are applied in order. “Backend” and at least one of the condition fields must be filled out. If multiple conditions are filled out, they will be combined with a boolean “AND”. |
pool.frontend.linkBackend.map
密钥 |
类型 |
说明 |
backend |
string |
|
hostEq |
string |
Must be all lowercase. |
hostReg |
string |
Must be all lowercase. It is possible for a port (e.g. foo.com:80 ) to be in this regex. |
pathBeg |
string |
|
pathEnd |
string |
|
pathReg |
string |
|
pool.haproxy.backend
密钥 |
类型 |
属性 |
说明 |
name |
string |
|
The name the frontend refers to. |
protocol |
string |
|
The backend protocol is how HAProxy communicates with the servers it is load balancing. |
rewriteHttp |
|
|
Manipulate HTTP headers. There is no effect unless the protocol is either HTTP or HTTPS. |
balance |
string |
|
Load balancing strategy. E.g., roundrobin, leastconn, etc. |
customCheck |
object |
|
Specify alternate forms of healthchecks. |
miscStrs |
array of strings |
|
Additional template lines inserted before servers |
services |
array |
|
Array of backend service selectors. |
pool.haproxy.backend.customCheck
Key |
Type |
httpchk |
boolean |
httpchkMiscStr |
string |
sslHelloChk |
boolean |
miscStr |
string |
pool.haproxy.backend.rewriteHttp
Key |
Type |
Properties |
Description |
host |
string |
|
Set the host header value. |
path |
object |
|
Rewrite the HTTP URL path. All fields required, otherwise it’s ignored. |
request |
|
|
|
response |
|
|
|
sticky |
object |
|
Sticky sessions via a cookie. To use the default values (recommended), set this field to the empty object. |
pool.haproxy.backend.rewriteHttp.path
密钥 |
类型 |
fromPath |
string |
toPath |
string |
pool.haproxy.backend.rewriteHttp.sticky
Key |
Type |
nullable |
enabled |
boolean |
true |
customStr |
string |
|
pool.haproxy.backend.rewriteHttp.request
Key |
Type |
nullable |
forwardfor |
boolean |
正确 |
xForwardedPort |
boolean |
正确 |
xForwardedProtoHttpSiFtls |
|
正确 |
setHostHeader |
boolean |
正确 |
rewritePath |
boolean |
正确 |
pool.haproxy.backend.rewriteHttp.response
密钥 |
类型 |
nullable |
rewriteLocation |
boolean |
true |
pool.haproxy.backend.service
Key |
Type |
marathon |
object |
mesos |
object |
endpoint |
object |
pool.haproxy.backend.service.marathon
Key |
Type |
Description |
serviceID |
string |
Marathon pod or application ID. |
serviceIDPattern |
string |
serviceID as a regex pattern. |
containerName |
string |
Marathon pod container name, optional unless using Marathon pods. |
containerNamePattern |
string |
containerName as a regex pattern. |
pool.haproxy.backend.service.mesos
密钥 |
类型 |
说明 |
frameworkName |
string |
Mesos framework name. |
frameworkNamePattern |
string |
frameworkName as a regex pattern. |
frameworkID |
string |
Mesos framework ID. |
frameworkIDPattern |
string |
frameworkID as a regex pattern. |
taskName |
string |
Mesos task name. |
taskNamePattern |
string |
taskName as a regex pattern. |
taskID |
string |
Mesos task ID. |
taskIDPattern |
string |
taskID as a regex pattern. |
pool.haproxy.backend.service.endpoint
Key |
Type |
Description |
type |
string |
Enum field, can be AUTO_IP , AGENT_IP , CONTAINER_IP , or ADDRESS . Default is AUTO_IP . |
miscStr |
string |
Append arbitrary string to add to the end of the “server” directive. |
check |
object |
Enable health checks. These are by default TCP health checks. For more options see “customCheck”. These are required for DNS resolution to function properly. |
address |
string |
Server address override, can be used to specify a cluster internal address such as a VIP. Only allowed when using type ADDRESS . |
port |
integer |
Port number. |
portName |
integer |
Name of port. |
allPorts |
boolean |
Selects all ports defined in service when true . |
pool.haproxy.backend.service.endpoint.check
密钥 |
类型 |
enabled |
boolean |
customStr |
string |
错误
密钥 |
类型 |
code |
int32 |
message |
string |