Add missing pod ano (#1303)

This commit is contained in:
Hang Yan 2020-08-06 23:42:58 +08:00 committed by GitHub
parent dc6975223a
commit d780067bf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 51 additions and 6 deletions

View File

@ -1085,8 +1085,9 @@ func (k *Kubernetes) InitPod(name string, service kobject.ServiceConfig) *api.Po
APIVersion: "v1",
},
ObjectMeta: api.ObjectMeta{
Name: name,
Labels: transformer.ConfigLabels(name),
Name: name,
Labels: transformer.ConfigLabels(name),
Annotations: transformer.ConfigAnnotations(service),
},
Spec: k.InitPodSpec(name, service.Image, service.ImagePullSecret),
}

View File

@ -295,15 +295,29 @@ convert::expect_success_and_warning "$cmd" "/tmp/output-os.json" "Unsupported de
######
# Test related to restart options in docker-compose
# kubernetes test
convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/restart-options/docker-compose-restart-no.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/restart-options/output-k8s-restart-no.json"
convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/restart-options/docker-compose-restart-onfail.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/restart-options/output-k8s-restart-onfail.json"
cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/restart-options/docker-compose-restart-no.yml convert --stdout -j"
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" "$KOMPOSE_ROOT/script/test/fixtures/restart-options/output-k8s-restart-no.json" > /tmp/output-k8s.json
convert::expect_success "$cmd" /tmp/output-k8s.json
cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/restart-options/docker-compose-restart-onfail.yml convert --stdout -j"
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" "$KOMPOSE_ROOT/script/test/fixtures/restart-options/output-k8s-restart-onfail.json" > /tmp/output-k8s.json
convert::expect_success "$cmd" /tmp/output-k8s.json
# convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/restart-options/docker-compose-restart-no.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/restart-options/output-k8s-restart-no.json"
# convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/restart-options/docker-compose-restart-onfail.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/restart-options/output-k8s-restart-onfail.json"
cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/restart-options/docker-compose-restart-unless-stopped.yml convert --stdout -j"
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" "$KOMPOSE_ROOT/script/test/fixtures/restart-options/output-k8s-restart-unless-stopped.json" > /tmp/output-k8s.json
convert::expect_success_and_warning "$cmd" /tmp/output-k8s.json
# openshift test
convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/restart-options/docker-compose-restart-no.yml --provider openshift convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/restart-options/output-os-restart-no.json"
convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/restart-options/docker-compose-restart-onfail.yml --provider openshift convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/restart-options/output-os-restart-onfail.json"
cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/restart-options/docker-compose-restart-no.yml --provider openshift convert --stdout -j"
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" "$KOMPOSE_ROOT/script/test/fixtures/restart-options/output-os-restart-no.json" > /tmp/output-os.json
convert::expect_success "$cmd" /tmp/output-os.json
cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/restart-options/docker-compose-restart-onfail.yml --provider openshift convert --stdout -j"
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" "$KOMPOSE_ROOT/script/test/fixtures/restart-options/output-os-restart-onfail.json" > /tmp/output-os.json
convert::expect_success "$cmd" /tmp/output-os.json
cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/restart-options/docker-compose-restart-unless-stopped.yml --provider openshift convert --stdout -j"
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" "$KOMPOSE_ROOT/script/test/fixtures/restart-options/output-os-restart-unless-stopped.json" > /tmp/output-os.json
convert::expect_success_and_warning "$cmd" /tmp/output-os.json

View File

@ -11,6 +11,10 @@
"creationTimestamp": null,
"labels": {
"io.kompose.service": "foo"
},
"annotations": {
"kompose.cmd": "%CMD%",
"kompose.version": "%VERSION%"
}
},
"spec": {

View File

@ -11,6 +11,10 @@
"creationTimestamp": null,
"labels": {
"io.kompose.service": "foo"
},
"annotations": {
"kompose.cmd": "%CMD%",
"kompose.version": "%VERSION%"
}
},
"spec": {

View File

@ -11,6 +11,10 @@
"creationTimestamp": null,
"labels": {
"io.kompose.service": "foo"
},
"annotations": {
"kompose.cmd": "%CMD%",
"kompose.version": "%VERSION%"
}
},
"spec": {

View File

@ -11,6 +11,10 @@
"creationTimestamp": null,
"labels": {
"io.kompose.service": "foo"
},
"annotations": {
"kompose.cmd": "%CMD%",
"kompose.version": "%VERSION%"
}
},
"spec": {

View File

@ -157,6 +157,13 @@
"io.kompose.network/other-other-network": "true",
"io.kompose.network/some-network": "true",
"io.kompose.service": "foo"
},
"annotations": {
"com.example.description": "Accounting webapp",
"com.example.empty-label": "",
"com.example.number": "42",
"kompose.cmd": "%CMD%",
"kompose.version": "%VERSION%"
}
},
"spec": {

View File

@ -157,6 +157,13 @@
"io.kompose.network/other-other-network": "true",
"io.kompose.network/some-network": "true",
"io.kompose.service": "foo"
},
"annotations": {
"com.example.description": "Accounting webapp",
"com.example.empty-label": "",
"com.example.number": "42",
"kompose.cmd": "%CMD%",
"kompose.version": "%VERSION%"
}
},
"spec": {