Adding antiAffinity field to DSL
* global and local antiaffinity support added * dsl doc updated * dsl version bumped to 0.2.0 Change-Id: I832b00e75bc546f7de1446d660f178c58dc3b1b4
This commit is contained in:
parent
631bf4dc62
commit
d318db272a
|
@ -16,6 +16,7 @@ Application definition template
|
|||
- internal-port:external-port
|
||||
hostNetwork: true
|
||||
hostPID: true
|
||||
antiAffinity: local
|
||||
containers:
|
||||
- name: container-name
|
||||
image: container-image
|
||||
|
@ -102,6 +103,10 @@ service
|
|||
| | old Pods by new ones | | ["RollingUpdate",| |
|
||||
| | | | "Recreate"] | |
|
||||
+---------------+-----------------------------------------------+----------+------------------+---------------+
|
||||
| antiAffinity | Restrict scheduling of pods on the same host: | false | one of: | null |
|
||||
| | local - within namespace | | [null, "global", | |
|
||||
| | global - within k8s cluster | | "local"] | |
|
||||
+---------------+-----------------------------------------------+----------+------------------+---------------+
|
||||
|
||||
.. _container:
|
||||
|
||||
|
|
|
@ -17,4 +17,4 @@ import pbr.version
|
|||
|
||||
version_info = pbr.version.VersionInfo("fuel_ccp")
|
||||
__version__ = version_info.version_string()
|
||||
dsl_version = "0.1.0"
|
||||
dsl_version = "0.2.0"
|
||||
|
|
|
@ -345,7 +345,7 @@ def serialize_affinity(service, topology):
|
|||
}
|
||||
}
|
||||
}
|
||||
if service.get("hostNetwork"):
|
||||
if service.get("hostNetwork") or service.get("antiAffinity") == 'global':
|
||||
policy["podAntiAffinity"] = {
|
||||
"requiredDuringSchedulingIgnoredDuringExecution": [{
|
||||
"labelSelector": {
|
||||
|
@ -357,7 +357,8 @@ def serialize_affinity(service, topology):
|
|||
"namespaces": []
|
||||
}]
|
||||
}
|
||||
elif service.get("kind") == "DaemonSet":
|
||||
elif service.get("kind") == "DaemonSet" or service.get(
|
||||
"antiAffinity") == 'local':
|
||||
policy["podAntiAffinity"] = {
|
||||
"requiredDuringSchedulingIgnoredDuringExecution": [{
|
||||
"labelSelector": {
|
||||
|
|
|
@ -210,6 +210,9 @@ SERVICE_SCHEMA = {
|
|||
"strategy": {
|
||||
"enum": ["RollingUpdate", "Recreate"]
|
||||
},
|
||||
"antiAffinity": {
|
||||
"enum": [None, "local", "global"]
|
||||
},
|
||||
"containers": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
|
@ -260,7 +263,7 @@ SERVICE_SCHEMA = {
|
|||
"valueFrom": {"type": "object"}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue