crooked-helicopter-55521
03/26/2020, 8:05 PMcore.v1.ConfigMap
object. Having a bit of trouble, curious if anyone has any ideas (threading the details){
"kind": "Policy",
"apiVersion": "v1",
"metadata": {
"name": "scheduler-policy-config",
"namespace": "kube-system"
},
"predicates": [
{
"name": "PodFitsHostPorts"
},
{
"name": "PodFitsResources"
},
{
"name": "NoDiskConflict"
},
{
"name": "NoVolumeZoneConflict"
},
{
"name": "PodToleratesNodeTaints"
},
{
"name": "MatchNodeSelector"
},
{
"name": "HostName"
}
],
"priorities": [
{
"name": "LeastRequestedPriority",
"weight": 1
},
{
"name": "BalancedResourceAllocation",
"weight": 1
},
{
"name": "SelectorSpreadPriority",
"weight": 10
},
{
"name": "ServiceSpreadingPriority",
"weight": 1
},
{
"name": "EqualPriority",
"weight": 1
}
]
}
then I run
kubectl create configmap scheduler-policy-config --from-file=./policy.cfg
which gives me a config map that looks like this:
Data
====
policy.cfg:
----
{
"kind" : "Policy",
"apiVersion" : "v1",
"metadata" : {
"name": "scheduler-policy-config",
"namespace": "kube-system"
},
"predicates" : [
{"name" : "PodFitsHostPorts"},
...
],
"priorities" : [
{"name" : "LeastRequestedPriority", "weight" : 1},
....
]
}
billowy-army-68599
JSON.stringify
on an object, for example
const policy = {
"kind": "Policy"
// insert rest of JSON here
}
const scheduler-policy-config = new k8s.core.v1.ConfigMap("scheduler-policy-config", {
metadata: { namespace: "kube-system" },
data: {
"policy.cfg": JSON.stringify(policy)
},
});
crooked-helicopter-55521
03/26/2020, 8:12 PM