forked from LaconicNetwork/kompose
Merge pull request #738 from cdrage/add-cpus
Add CPU limit, CPU Reservation and Memory Reservation
This commit is contained in:
@@ -270,6 +270,9 @@ cd $CURRENT_DIR
|
||||
|
||||
# Test V3 Support of Docker Compose
|
||||
|
||||
# Test support for cpu and memory limits + reservations
|
||||
convert::expect_success "kompose convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/v3/docker-compose-memcpu.yaml" "$KOMPOSE_ROOT/script/test/fixtures/v3/output-memcpu-k8s.json"
|
||||
|
||||
# Test volumes are passed correctly
|
||||
convert::expect_success "kompose convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/v3/docker-compose-volumes.yaml" "$KOMPOSE_ROOT/script/test/fixtures/v3/output-volumes-k8s.json"
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
foo:
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '0.01'
|
||||
memory: 50M
|
||||
reservations:
|
||||
cpus: '0.001'
|
||||
memory: 20M
|
||||
image: redis
|
||||
@@ -155,7 +155,11 @@
|
||||
],
|
||||
"resources": {
|
||||
"limits": {
|
||||
"cpu": "1",
|
||||
"memory": "52428800"
|
||||
},
|
||||
"requests": {
|
||||
"memory": "20971520"
|
||||
}
|
||||
},
|
||||
"volumeMounts": [
|
||||
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"kind": "List",
|
||||
"apiVersion": "v1",
|
||||
"metadata": {},
|
||||
"items": [
|
||||
{
|
||||
"kind": "Service",
|
||||
"apiVersion": "v1",
|
||||
"metadata": {
|
||||
"name": "foo",
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"io.kompose.service": "foo"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
"ports": [
|
||||
{
|
||||
"name": "headless",
|
||||
"port": 55555,
|
||||
"targetPort": 0
|
||||
}
|
||||
],
|
||||
"selector": {
|
||||
"io.kompose.service": "foo"
|
||||
},
|
||||
"clusterIP": "None"
|
||||
},
|
||||
"status": {
|
||||
"loadBalancer": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"kind": "Deployment",
|
||||
"apiVersion": "extensions/v1beta1",
|
||||
"metadata": {
|
||||
"name": "foo",
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"io.kompose.service": "foo"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
"replicas": 1,
|
||||
"template": {
|
||||
"metadata": {
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"io.kompose.service": "foo"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
"containers": [
|
||||
{
|
||||
"name": "foo",
|
||||
"image": "redis",
|
||||
"resources": {
|
||||
"limits": {
|
||||
"cpu": "10",
|
||||
"memory": "52428800"
|
||||
},
|
||||
"requests": {
|
||||
"cpu": "1",
|
||||
"memory": "20971520"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"restartPolicy": "Always"
|
||||
}
|
||||
},
|
||||
"strategy": {}
|
||||
},
|
||||
"status": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -155,7 +155,11 @@
|
||||
],
|
||||
"resources": {
|
||||
"limits": {
|
||||
"cpu": "1",
|
||||
"memory": "52428800"
|
||||
},
|
||||
"requests": {
|
||||
"memory": "20971520"
|
||||
}
|
||||
},
|
||||
"volumeMounts": [
|
||||
|
||||
Reference in New Issue
Block a user