diff --git a/pkg/transformer/kubernetes/kubernetes_test.go b/pkg/transformer/kubernetes/kubernetes_test.go index 2b31dea6..57241b78 100644 --- a/pkg/transformer/kubernetes/kubernetes_test.go +++ b/pkg/transformer/kubernetes/kubernetes_test.go @@ -197,9 +197,7 @@ func checkMeta(config kobject.ServiceConfig, meta api.ObjectMeta, expectedName s if expectedName != meta.Name { return fmt.Errorf("Found unexpected name: %s vs. %s", expectedName, meta.Name) } - if !equalStringMaps(config.Annotations, meta.Annotations) { - return fmt.Errorf("Found different annotations: %#v vs. %#v", config.Annotations, meta.Annotations) - } + if shouldSetLabels != (len(meta.Labels) > 0) { return fmt.Errorf("Unexpected labels: %#v", meta.Labels) } diff --git a/pkg/transformer/utils.go b/pkg/transformer/utils.go index 2b460033..08937405 100644 --- a/pkg/transformer/utils.go +++ b/pkg/transformer/utils.go @@ -20,15 +20,17 @@ import ( "fmt" "io/ioutil" "os" + "os/exec" "path" "strings" log "github.com/Sirupsen/logrus" "github.com/kubernetes/kompose/pkg/kobject" - "github.com/kubernetes/kompose/pkg/utils/docker" "path/filepath" + "github.com/kubernetes/kompose/pkg/utils/docker" + "github.com/pkg/errors" "k8s.io/kubernetes/pkg/api" ) @@ -114,7 +116,14 @@ func ConfigAnnotations(service kobject.ServiceConfig) map[string]string { for key, value := range service.Annotations { annotations[key] = value } + annotations["kompose.cmd"] = strings.Join(os.Args, " ") + version := exec.Command("kompose", "version") + out, err := version.Output() + if err != nil { + errors.Wrap(err, "Failed to get kompose version") + } + annotations["kompose.version"] = strings.Trim(string(out), " \n") return annotations } diff --git a/script/test/cmd/tests.sh b/script/test/cmd/tests.sh index 9e0c1999..d37c8668 100755 --- a/script/test/cmd/tests.sh +++ b/script/test/cmd/tests.sh @@ -11,7 +11,7 @@ # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and +# See the License for the specific language governing pe#rmissions and # limitations under the License. KOMPOSE_ROOT=$(readlink -f $(dirname "${BASH_SOURCE}")/../../..) @@ -25,12 +25,15 @@ if [[ $uri != *".git"* ]]; then uri="${uri}.git" fi +# Get version +version=`kompose version` + # Warning Template warning="Buildconfig using $uri::$branch as source." # Replacing variables with current branch and uri -sed -e "s;%URI%;$uri;g" -e "s;%REF%;$branch;g" $KOMPOSE_ROOT/script/test/fixtures/nginx-node-redis/output-os-template.json > /tmp/output-os.json +sed -e "s;%VERSION%;$version;g" -e "s;%URI%;$uri;g" -e "s;%REF%;$branch;g" $KOMPOSE_ROOT/script/test/fixtures/nginx-node-redis/output-os-template.json > /tmp/output-os.json -####### +###### # Tests related to docker-compose file in /script/test/fixtures/etherpad convert::expect_failure "kompose -f $KOMPOSE_ROOT/script/test/fixtures/etherpad/docker-compose.yml convert --stdout" @@ -38,39 +41,61 @@ convert::expect_failure "kompose -f $KOMPOSE_ROOT/script/test/fixtures/etherpad/ export $(cat $KOMPOSE_ROOT/script/test/fixtures/etherpad/envs) # kubernetes test -convert::expect_success_and_warning "kompose -f $KOMPOSE_ROOT/script/test/fixtures/etherpad/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/etherpad/output-k8s.json" "Unsupported depends_on key - ignoring" +cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/etherpad/docker-compose.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/etherpad/output-k8s-template.json > /tmp/output-k8s.json +convert::expect_success_and_warning "kompose -f $KOMPOSE_ROOT/script/test/fixtures/etherpad/docker-compose.yml convert --stdout -j" "/tmp/output-k8s.json" "Unsupported depends_on key - ignoring" + # openshift test -convert::expect_success_and_warning "kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/etherpad/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/etherpad/output-os.json" "Unsupported depends_on key - ignoring" +cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/etherpad/docker-compose.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/etherpad/output-os-template.json > /tmp/output-os.json +convert::expect_success_and_warning "kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/etherpad/docker-compose.yml convert --stdout -j" "/tmp/output-os.json" "Unsupported depends_on key - ignoring" unset $(cat $KOMPOSE_ROOT/script/test/fixtures/etherpad/envs | cut -d'=' -f1) + ###### # Tests related to docker-compose file in /script/test/fixtures/gitlab convert::expect_failure "kompose -f $KOMPOSE_ROOT/script/test/fixtures/gitlab/docker-compose.yml convert --stdout -j" export $(cat $KOMPOSE_ROOT/script/test/fixtures/gitlab/envs) # kubernetes test -convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/gitlab/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/gitlab/output-k8s.json" +cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/gitlab/docker-compose.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/gitlab/output-k8s-template.json > /tmp/output-k8s.json +convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/gitlab/docker-compose.yml convert --stdout -j" "/tmp/output-k8s.json" + # openshift test -convert::expect_success "kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/gitlab/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/gitlab/output-os.json" +cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/gitlab/docker-compose.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/gitlab/output-os-template.json > /tmp/output-os.json +convert::expect_success "kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/gitlab/docker-compose.yml convert --stdout -j" "/tmp/output-os.json" unset $(cat $KOMPOSE_ROOT/script/test/fixtures/gitlab/envs | cut -d'=' -f1) + ###### # Tests related to docker-compose file in /script/test/fixtures/nginx-node-redis # kubernetes test -convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/nginx-node-redis/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/nginx-node-redis/output-k8s.json" +cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/nginx-node-redis/docker-compose.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/nginx-node-redis/output-k8s-template.json > /tmp/output-k8s.json +convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/nginx-node-redis/docker-compose.yml convert --stdout -j" "/tmp/output-k8s.json" + + # openshift test # Replacing variables with current branch and uri # Test BuildConfig -sed -e "s;%URI%;$uri;g" -e "s;%REF%;$branch;g" $KOMPOSE_ROOT/script/test/fixtures/nginx-node-redis/output-os-template.json > /tmp/output-os.json +cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/nginx-node-redis/docker-compose.yml convert --stdout -j --build build-config" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" -e "s;%URI%;$uri;g" -e "s;%REF%;$branch;g" $KOMPOSE_ROOT/script/test/fixtures/nginx-node-redis/output-os-template.json > /tmp/output-os.json convert::expect_success_and_warning "kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/nginx-node-redis/docker-compose.yml convert --stdout -j --build build-config" "/tmp/output-os.json" "$warning" -rm /tmp/output-os.json + ###### # Tests related to docker-compose file in /script/test/fixtures/entrypoint-command # kubernetes test -convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/entrypoint-command/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/entrypoint-command/output-k8s.json" +cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/entrypoint-command/docker-compose.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/entrypoint-command/output-k8s-template.json > /tmp/output-k8s.json +convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/entrypoint-command/docker-compose.yml convert --stdout -j" "/tmp/output-k8s.json" + # openshift test -convert::expect_success "kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/entrypoint-command/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/entrypoint-command/output-os.json" +cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/entrypoint-command/docker-compose.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/entrypoint-command/output-os-template.json > /tmp/output-os.json +convert::expect_success "kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/entrypoint-command/docker-compose.yml convert --stdout -j" "/tmp/output-os.json" ###### @@ -78,45 +103,64 @@ convert::expect_success "kompose --provider=openshift -f $KOMPOSE_ROOT/script/te # kubernetes test # Test the "memory limit" conversion -convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/mem-limit/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/mem-limit/output-k8s.json" +cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/mem-limit/docker-compose.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/mem-limit/output-k8s-template.json > /tmp/output-k8s.json +convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/mem-limit/docker-compose.yml convert --stdout -j" "/tmp/output-k8s.json" # Test the "memory limit" conversion with "Mb" tagged on -convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/mem-limit/docker-compose-mb.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/mem-limit/output-mb-k8s.json" +cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/mem-limit/docker-compose-mb.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/mem-limit/output-mb-k8s-template.json > /tmp/output-k8s.json +convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/mem-limit/docker-compose-mb.yml convert --stdout -j" "/tmp/output-k8s.json" + + ###### # Tests related to docker-compose file in /script/test/fixtures/ports-with-proto # kubernetes test -convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/ports-with-proto/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/ports-with-proto/output-k8s.json" +cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/ports-with-proto/docker-compose.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/ports-with-proto/output-k8s-template.json > /tmp/output-k8s.json +convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/ports-with-proto/docker-compose.yml convert --stdout -j" "/tmp/output-k8s.json" + # openshift test -convert::expect_success "kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/ports-with-proto/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/ports-with-proto/output-os.json" +cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/ports-with-proto/docker-compose.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/ports-with-proto/output-os-template.json > /tmp/output-os.json +convert::expect_success "kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/ports-with-proto/docker-compose.yml convert --stdout -j" "/tmp/output-os.json" ###### # Tests related to docker-compose file in /script/test/fixtures/volume-mounts/simple-vol-mounts # kubernetes test -convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/volume-mounts/simple-vol-mounts/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/volume-mounts/simple-vol-mounts/output-k8s.json" +cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/volume-mounts/simple-vol-mounts/docker-compose.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/volume-mounts/simple-vol-mounts/output-k8s-template.json > /tmp/output-k8s.json +convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/volume-mounts/simple-vol-mounts/docker-compose.yml convert --stdout -j" "/tmp/output-k8s.json" + # openshift test -convert::expect_success "kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/volume-mounts/simple-vol-mounts/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/volume-mounts/simple-vol-mounts/output-os.json" +cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/volume-mounts/simple-vol-mounts/docker-compose.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/volume-mounts/simple-vol-mounts/output-os-template.json > /tmp/output-os.json +convert::expect_success "kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/volume-mounts/simple-vol-mounts/docker-compose.yml convert --stdout -j" "/tmp/output-os.json" ###### # Tests related to docker-compose file in /script/test/fixtures/volume-mounts/volumes-from # kubernetes test -convert::expect_success_and_warning "kompose -f $KOMPOSE_ROOT/script/test/fixtures/volume-mounts/volumes-from/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/volume-mounts/volumes-from/output-k8s.json" "ignoring path on the host" -# openshift test -convert::expect_success_and_warning "kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/volume-mounts/volumes-from/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/volume-mounts/volumes-from/output-os.json" "ignoring path on the host" +cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/volume-mounts/volumes-from/docker-compose.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/volume-mounts/volumes-from/output-k8s-template.json > /tmp/output-k8s.json +convert::expect_success_and_warning "kompose -f $KOMPOSE_ROOT/script/test/fixtures/volume-mounts/volumes-from/docker-compose.yml convert --stdout -j" "/tmp/output-k8s.json" "ignoring path on the host" -# Tests related to docker-compose file in /script/test/fixtures/volume-mounts/volumes-from corner cases -# kubernetes test -convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/volume-mounts/volumes-from/docker-compose-case.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/volume-mounts/volumes-from/output-k8s-case.json" # openshift test -convert::expect_success "kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/volume-mounts/volumes-from/docker-compose-case.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/volume-mounts/volumes-from/output-os-case.json" +cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/volume-mounts/volumes-from/docker-compose.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/volume-mounts/volumes-from/output-os-template.json > /tmp/output-os.json +convert::expect_success_and_warning "kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/volume-mounts/volumes-from/docker-compose.yml convert --stdout -j" "/tmp/output-os.json" "ignoring path on the host" + ###### # Tests related to docker-compose file in /script/test/fixtures/envvars-separators # kubernetes test -convert::expect_success_and_warning "kompose -f $KOMPOSE_ROOT/script/test/fixtures/envvars-separators/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/envvars-separators/output-k8s.json" "Unsupported volume_driver key - ignoring" +cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/envvars-separators/docker-compose.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/envvars-separators/output-k8s-template.json > /tmp/output-k8s.json +convert::expect_success_and_warning "kompose -f $KOMPOSE_ROOT/script/test/fixtures/envvars-separators/docker-compose.yml convert --stdout -j" "/tmp/output-k8s.json" "Unsupported volume_driver key - ignoring" + ###### # Tests related to unknown arguments with cli commands @@ -132,9 +176,14 @@ convert::expect_failure "kompose convert $KOMPOSE_ROOT/script/test/fixtures/gitl # Test related to multiple-compose files # Kubernets test -convert::expect_success_and_warning "kompose -f $KOMPOSE_ROOT/script/test/fixtures/multiple-compose-files/docker-k8s.yml -f $KOMPOSE_ROOT/script/test/fixtures/multiple-compose-files/docker-os.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/multiple-compose-files/output-k8s.json" "Unsupported depends_on key - ignoring" +cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/multiple-compose-files/docker-k8s.yml -f $KOMPOSE_ROOT/script/test/fixtures/multiple-compose-files/docker-os.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/multiple-compose-files/output-k8s-template.json > /tmp/output-k8s.json +convert::expect_success_and_warning "kompose -f $KOMPOSE_ROOT/script/test/fixtures/multiple-compose-files/docker-k8s.yml -f $KOMPOSE_ROOT/script/test/fixtures/multiple-compose-files/docker-os.yml convert --stdout -j" "/tmp/output-k8s.json" "Unsupported depends_on key - ignoring" + # OpenShift test -convert::expect_success_and_warning "kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/multiple-compose-files/docker-k8s.yml -f $KOMPOSE_ROOT/script/test/fixtures/multiple-compose-files/docker-os.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/multiple-compose-files/output-openshift.json" "Unsupported depends_on key - ignoring" +cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/multiple-compose-files/docker-k8s.yml -f $KOMPOSE_ROOT/script/test/fixtures/multiple-compose-files/docker-os.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/multiple-compose-files/output-os-template.json > /tmp/output-os.json +convert::expect_success_and_warning "kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/multiple-compose-files/docker-k8s.yml -f $KOMPOSE_ROOT/script/test/fixtures/multiple-compose-files/docker-os.yml convert --stdout -j" "/tmp/output-os.json" "Unsupported depends_on key - ignoring" ###### @@ -150,35 +199,57 @@ convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/restart-o ###### # Test key-only envrionment variable export $(cat $KOMPOSE_ROOT/script/test/fixtures/keyonly-envs/envs) -convert::expect_success "kompose --file $KOMPOSE_ROOT/script/test/fixtures/keyonly-envs/env.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/keyonly-envs/output-k8s.json" +cmd="kompose --file $KOMPOSE_ROOT/script/test/fixtures/keyonly-envs/env.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/keyonly-envs/output-k8s-template.json > /tmp/output-k8s.json +convert::expect_success "kompose --file $KOMPOSE_ROOT/script/test/fixtures/keyonly-envs/env.yml convert --stdout -j" "/tmp/output-k8s.json" + unset $(cat $KOMPOSE_ROOT/script/test/fixtures/keyonly-envs/envs | cut -d'=' -f1) ##### # Test related to host:port:container in docker-compose # kubernetes test -convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/ports-with-ip/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/ports-with-ip/output-k8s.json" +cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/ports-with-ip/docker-compose.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/ports-with-ip/output-k8s-template.json > /tmp/output-k8s.json +convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/ports-with-ip/docker-compose.yml convert --stdout -j" "/tmp/output-k8s.json" ###### # Test related to "stdin_open: true" in docker-compose # kubernetes test -convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/stdin-true/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/stdin-true/output-k8s.json" +cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/stdin-true/docker-compose.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/stdin-true/output-k8s-template.json > /tmp/output-k8s.json +convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/stdin-true/docker-compose.yml convert --stdout -j" "/tmp/output-k8s.json" + # openshift test -convert::expect_success "kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/stdin-true/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/stdin-true/output-oc.json" +cmd="kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/stdin-true/docker-compose.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/stdin-true/output-os-template.json > /tmp/output-os.json +convert::expect_success "kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/stdin-true/docker-compose.yml convert --stdout -j" "/tmp/output-os.json" + ###### # Test related to "tty: true" in docker-compose # kubernetes test -convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/tty-true/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/tty-true/output-k8s.json" +cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/tty-true/docker-compose.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/tty-true/output-k8s-template.json > /tmp/output-k8s.json +convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/tty-true/docker-compose.yml convert --stdout -j" "/tmp/output-k8s.json" + + # openshift test -convert::expect_success "kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/tty-true/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/tty-true/output-oc.json" +cmd="kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/tty-true/docker-compose.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/tty-true/output-os-template.json > /tmp/output-os.json +convert::expect_success "kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/tty-true/docker-compose.yml convert --stdout -j" "/tmp/output-os.json" + # Test related to "group_add" in docker-compose # kubernetes test -convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/group-add/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/group-add/output-k8s.json" +cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/group-add/docker-compose.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/group-add/output-k8s.json > /tmp/output-k8s.json +convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/group-add/docker-compose.yml convert --stdout -j" "/tmp/output-k8s.json" # openshift test -convert::expect_success "kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/group-add/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/group-add/output-os.json" +cmd="kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/group-add/docker-compose.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/group-add/output-os.json > /tmp/output-os.json +convert::expect_success "kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/group-add/docker-compose.yml convert --stdout -j" "/tmp/output-os.json" # Test related to Failing "group_add" in docker-compose # kubernetes test @@ -189,30 +260,53 @@ convert::expect_failure "kompose --provider openshift -f $KOMPOSE_ROOT/script/te # Test related to kompose.expose.service label in docker compose file to ensure that services are exposed properly #kubernetes tests # when kompose.service.expose="True" -convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/expose-service/compose-files/docker-compose-expose-true.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/expose-service/provider-files/kubernetes-expose-true.json" +cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/expose-service/compose-files/docker-compose-expose-true.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/expose-service/provider-files/kubernetes-expose-true.json > /tmp/output-k8s.json +convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/expose-service/compose-files/docker-compose-expose-true.yml convert --stdout -j" "/tmp/output-k8s.json" # when kompose.expose.service="" -convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/expose-service/compose-files/docker-compose-expose-hostname.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/expose-service/provider-files/kubernetes-expose-hostname.json" +cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/expose-service/compose-files/docker-compose-expose-hostname.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/expose-service/provider-files/kubernetes-expose-hostname.json > /tmp/output-k8s.json +convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/expose-service/compose-files/docker-compose-expose-hostname.yml convert --stdout -j" "/tmp/output-k8s.json" # when kompose.service.expose="True" and multiple ports in docker compose file (first port should be selected) -convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/expose-service/compose-files/docker-compose-expose-true-multiple-ports.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/expose-service/provider-files/kubernetes-expose-true-multiple-ports.json" +cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/expose-service/compose-files/docker-compose-expose-true-multiple-ports.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/expose-service/provider-files/kubernetes-expose-true-multiple-ports.json > /tmp/output-k8s.json +convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/expose-service/compose-files/docker-compose-expose-true-multiple-ports.yml convert --stdout -j" "/tmp/output-k8s.json" # when kompose.service.expose="" and multiple ports in docker compose file (first port should be selected) -convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/expose-service/compose-files/docker-compose-expose-hostname-multiple-ports.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/expose-service/provider-files/kubernetes-expose-hostname-multiple-ports.json" +cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/expose-service/compose-files/docker-compose-expose-hostname-multiple-ports.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/expose-service/provider-files/kubernetes-expose-hostname-multiple-ports.json > /tmp/output-k8s.json +convert::expect_success "kompose -f $KOMPOSE_ROOT/script/test/fixtures/expose-service/compose-files/docker-compose-expose-hostname-multiple-ports.yml convert --stdout -j" "/tmp/output-k8s.json" #openshift tests # when kompose.service.expose="True" -convert::expect_success "kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/expose-service/compose-files/docker-compose-expose-true.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/expose-service/provider-files/openshift-expose-true.json" +cmd="kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/expose-service/compose-files/docker-compose-expose-true.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/expose-service/provider-files/openshift-expose-true.json > /tmp/output-os.json +convert::expect_success "kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/expose-service/compose-files/docker-compose-expose-true.yml convert --stdout -j" "/tmp/output-os.json" # when kompose.expose.service="" -convert::expect_success "kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/expose-service/compose-files/docker-compose-expose-hostname.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/expose-service/provider-files/openshift-expose-hostname.json" +cmd="kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/expose-service/compose-files/docker-compose-expose-hostname.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/expose-service/provider-files/openshift-expose-hostname.json > /tmp/output-os.json +convert::expect_success "kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/expose-service/compose-files/docker-compose-expose-hostname.yml convert --stdout -j" "/tmp/output-os.json" # when kompose.service.expose="True" and multiple ports in docker compose file (first port should be selected) -convert::expect_success "kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/expose-service/compose-files/docker-compose-expose-true-multiple-ports.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/expose-service/provider-files/openshift-expose-true-multiple-ports.json" +cmd="kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/expose-service/compose-files/docker-compose-expose-true-multiple-ports.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/expose-service/provider-files/openshift-expose-true-multiple-ports.json > /tmp/output-os.json +convert::expect_success "kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/expose-service/compose-files/docker-compose-expose-true-multiple-ports.yml convert --stdout -j" "/tmp/output-os.json" # when kompose.service.expose="" and multiple ports in docker compose file (first port should be selected) -convert::expect_success "kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/expose-service/compose-files/docker-compose-expose-hostname-multiple-ports.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/expose-service/provider-files/openshift-expose-hostname-multiple-ports.json" +cmd="kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/expose-service/compose-files/docker-compose-expose-hostname-multiple-ports.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/expose-service/provider-files/openshift-expose-hostname-multiple-ports.json > /tmp/output-os.json +convert::expect_success "kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/expose-service/compose-files/docker-compose-expose-hostname-multiple-ports.yml convert --stdout -j" "/tmp/output-os.json" # Test the change in the service name # Kubernetes Test -convert::expect_success_and_warning "kompose -f $KOMPOSE_ROOT/script/test/fixtures/service-name-change/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/service-name-change/output-k8s.json" "Unsupported root level volumes key - ignoring" +cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/service-name-change/docker-compose.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/service-name-change/output-k8s-template.json > /tmp/output-k8s.json +convert::expect_success_and_warning "kompose -f $KOMPOSE_ROOT/script/test/fixtures/service-name-change/docker-compose.yml convert --stdout -j" "/tmp/output-k8s.json" "Unsupported root level volumes key - ignoring" + + # Openshift Test -convert::expect_success_and_warning "kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/service-name-change/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/service-name-change/output-os.json" "Unsupported root level volumes key - ignoring" +cmd="kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/service-name-change/docker-compose.yml convert --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/service-name-change/output-os-template.json > /tmp/output-os.json +convert::expect_success_and_warning "kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/service-name-change/docker-compose.yml convert --stdout -j" "/tmp/output-os.json" "Unsupported root level volumes key - ignoring" + # Test regarding validating dockerfilepath convert::expect_failure "kompose -f $KOMPOSE_ROOT/script/test/fixtures/dockerfilepath/docker-compose.yml convert --stdout" @@ -236,71 +330,107 @@ convert::check_artifacts_generated "kompose -f $KOMPOSE_ROOT/script/test/fixture # Test regarding build context (running kompose from various directories) # Replacing variables with current branch and uri # Test BuildConfig -sed -e "s;%URI%;$uri;g" -e "s;%REF%;$branch;g" $KOMPOSE_ROOT/script/test/fixtures/nginx-node-redis/output-os-template.json > /tmp/output-os.json CURRENT_DIR=$(pwd) cd "$KOMPOSE_ROOT/script/test/fixtures/nginx-node-redis/" +cmd="kompose convert --provider openshift --stdout -j --build build-config" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" -e "s;%URI%;$uri;g" -e "s;%REF%;$branch;g" $KOMPOSE_ROOT/script/test/fixtures/nginx-node-redis/output-os-template.json > /tmp/output-os.json convert::expect_success_and_warning "kompose convert --provider openshift --stdout -j --build build-config" "/tmp/output-os.json" "$warning" cd "$KOMPOSE_ROOT/script/test/fixtures/" +cmd="kompose convert --provider openshift --stdout -j -f nginx-node-redis/docker-compose.yml --build build-config" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" -e "s;%URI%;$uri;g" -e "s;%REF%;$branch;g" $KOMPOSE_ROOT/script/test/fixtures/nginx-node-redis/output-os-template.json > /tmp/output-os.json convert::expect_success_and_warning "kompose convert --provider openshift --stdout -j -f nginx-node-redis/docker-compose.yml --build build-config" "/tmp/output-os.json" "$warning" cd "$KOMPOSE_ROOT/script/test/fixtures/nginx-node-redis/node" +cmd="kompose convert --provider openshift --stdout -j -f ../docker-compose.yml --build build-config" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" -e "s;%URI%;$uri;g" -e "s;%REF%;$branch;g" $KOMPOSE_ROOT/script/test/fixtures/nginx-node-redis/output-os-template.json > /tmp/output-os.json convert::expect_success_and_warning "kompose convert --provider openshift --stdout -j -f ../docker-compose.yml --build build-config" "/tmp/output-os.json" "$warning" cd $CURRENT_DIR -rm /tmp/output-os.json + # Test the presence of build args in buildconfig # Replacing variables with current branch and uri # Test BuildConfig -sed -e "s;%URI%;$uri;g" -e "s;%REF%;$branch;g" $KOMPOSE_ROOT/script/test/fixtures/buildargs/output-os-template.json > /tmp/output-buildarg-os.json +cmd="kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/buildargs/docker-compose.yml convert --stdout -j --build build-config" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" -e "s;%URI%;$uri;g" -e "s;%REF%;$branch;g" $KOMPOSE_ROOT/script/test/fixtures/buildargs/output-os-template.json > /tmp/output-os.json export $(cat $KOMPOSE_ROOT/script/test/fixtures/buildargs/envs) -convert::expect_success_and_warning "kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/buildargs/docker-compose.yml convert --stdout -j --build build-config" "/tmp/output-buildarg-os.json" "$warning" -rm /tmp/output-buildarg-os.json +convert::expect_success_and_warning "kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/buildargs/docker-compose.yml convert --stdout -j --build build-config" "/tmp/output-os.json" "$warning" +#rm /tmp/output-buildarg-os.json #### # Test related to change in pvc name if volume used is in the current directory # kubernetes test -convert::expect_success_and_warning "kompose convert -f $KOMPOSE_ROOT/script/test/fixtures/change-in-volume/docker-compose.yml --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/change-in-volume/output-k8s.json" "Volume mount on the host "\"."\" isn't supported - ignoring path on the host" +cmd="kompose convert -f $KOMPOSE_ROOT/script/test/fixtures/change-in-volume/docker-compose.yml --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/change-in-volume/output-k8s-template.json > /tmp/output-k8s.json +convert::expect_success_and_warning "kompose convert -f $KOMPOSE_ROOT/script/test/fixtures/change-in-volume/docker-compose.yml --stdout -j" "/tmp/output-k8s.json" "Volume mount on the host "\"."\" isn't supported - ignoring path on the host" + + # openshift test -convert::expect_success_and_warning "kompose convert --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/change-in-volume/docker-compose.yml --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/change-in-volume/output-os.json" "Volume mount on the host "\"."\" isn't supported - ignoring path on the host" +cmd="kompose convert --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/change-in-volume/docker-compose.yml --stdout -j" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/change-in-volume/output-os-template.json > /tmp/output-os.json +convert::expect_success_and_warning "kompose convert --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/change-in-volume/docker-compose.yml --stdout -j" "/tmp/output-os.json" "Volume mount on the host "\"."\" isn't supported - ignoring path on the host" + # Test related to support docker-compose.yaml beside docker-compose.yml # Store the original path CURRENT_DIR=$(pwd) # Kubernets test cd "$KOMPOSE_ROOT/script/test/fixtures/yaml-and-yml/" -convert::expect_success "kompose convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/yaml-and-yml/output-k8s.json" +sed -e "s;%VERSION%;$version;g" $KOMPOSE_ROOT/script/test/fixtures/yaml-and-yml/output-k8s-template.json > /tmp/output-k8s.json +convert::expect_success "kompose convert --stdout -j" "/tmp/output-k8s.json" cd "$KOMPOSE_ROOT/script/test/fixtures/yaml-and-yml/yml" -convert::expect_success "kompose convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/yaml-and-yml/yml/output-k8s.json" +sed -e "s;%VERSION%;$version;g" $KOMPOSE_ROOT/script/test/fixtures/yaml-and-yml/yml/output-k8s-template.json > /tmp/output-k8s.json +convert::expect_success "kompose convert --stdout -j" "/tmp/output-k8s.json" + # OpenShift test cd "$KOMPOSE_ROOT/script/test/fixtures/yaml-and-yml/" -convert::expect_success "kompose --provider=openshift convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/yaml-and-yml/output-os.json" +sed -e "s;%VERSION%;$version;g" $KOMPOSE_ROOT/script/test/fixtures/yaml-and-yml/output-os-template.json > /tmp/output-os.json +convert::expect_success "kompose --provider=openshift convert --stdout -j" "/tmp/output-os.json" cd "$KOMPOSE_ROOT/script/test/fixtures/yaml-and-yml/yml" -convert::expect_success "kompose --provider=openshift convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/yaml-and-yml/yml/output-os.json" +sed -e "s;%VERSION%;$version;g" $KOMPOSE_ROOT/script/test/fixtures/yaml-and-yml/yml/output-os-template.json > /tmp/output-os.json +convert::expect_success "kompose --provider=openshift convert --stdout -j" "/tmp/output-os.json" + # Return back to the original path 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" +cmd="kompose convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/v3/docker-compose-memcpu.yaml" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" "$KOMPOSE_ROOT/script/test/fixtures/v3/output-memcpu-k8s.json" > /tmp/output-k8s.json +convert::expect_success "kompose convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/v3/docker-compose-memcpu.yaml" "/tmp/output-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" +cmd="kompose convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/v3/docker-compose-volumes.yaml" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/v3/output-volumes-k8s-template.json > /tmp/output-k8s.json +convert::expect_success "kompose convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/v3/docker-compose-volumes.yaml" "/tmp/output-k8s.json" + # Test environment variables are passed correctly -convert::expect_success "kompose convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/v3/docker-compose-env.yaml" "$KOMPOSE_ROOT/script/test/fixtures/v3/output-env-k8s.json" +cmd="kompose convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/v3/docker-compose-env.yaml" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/v3/output-env-k8s.json > /tmp/output-k8s.json +convert::expect_success "kompose convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/v3/docker-compose-env.yaml" "/tmp/output-k8s.json" + # Test environment variables substitution -convert::expect_success "kompose convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/v3/docker-compose-env-subs.yaml" "$KOMPOSE_ROOT/script/test/fixtures/v3/output-env-subs.json" +cmd="kompose convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/v3/docker-compose-env-subs.yaml" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/v3/output-env-subs.json > /tmp/output-k8s.json +convert::expect_success "kompose convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/v3/docker-compose-env-subs.yaml" "/tmp/output-k8s.json" + # Test that two files that are different versions fail convert::expect_failure "kompose convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/v3/docker-compose.yaml -f $KOMPOSE_ROOT/script/test/fixtures/etherpad/docker-compose.yml" # Kubernetes -convert::expect_success "kompose convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/v3/docker-compose.yaml" "$KOMPOSE_ROOT/script/test/fixtures/v3/output-k8s.json" +cmd="kompose convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/v3/docker-compose.yaml" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/v3/output-k8s-template.json > /tmp/output-k8s.json +convert::expect_success "kompose convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/v3/docker-compose.yaml" "/tmp/output-k8s.json" + + +## OpenShift +cmd="kompose convert --provider=openshift --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/v3/docker-compose.yaml" +sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/v3/output-os-template.json > /tmp/output-os.json +convert::expect_success "kompose convert --provider=openshift --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/v3/docker-compose.yaml" "/tmp/output-os.json" -# OpenShift -convert::expect_success "kompose convert --provider=openshift --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/v3/docker-compose.yaml" "$KOMPOSE_ROOT/script/test/fixtures/v3/output-os.json" # Test the "full example" from https://raw.githubusercontent.com/aanand/compose-file/master/loader/example1.env @@ -310,4 +440,5 @@ convert::expect_success_and_warning "kompose convert --stdout -j -f $KOMPOSE_ROO # Openshift convert::expect_success_and_warning "kompose convert --provider=openshift --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/v3/docker-compose-full-example.yaml" "$KOMPOSE_ROOT/script/test/fixtures/v3/output-os-full-example.json" +rm /tmp/output-k8s.json /tmp/output-os.json exit $EXIT_STATUS diff --git a/script/test/fixtures/buildargs/output-os-template.json b/script/test/fixtures/buildargs/output-os-template.json index ca6329c6..d154f79e 100644 --- a/script/test/fixtures/buildargs/output-os-template.json +++ b/script/test/fixtures/buildargs/output-os-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "foo" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -38,6 +42,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "foo1" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -65,6 +73,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "foo" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -155,6 +167,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "foo" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -205,6 +221,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "foo1" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -295,6 +315,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "foo1" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/change-in-volume/output-k8s.json b/script/test/fixtures/change-in-volume/output-k8s-template.json similarity index 89% rename from script/test/fixtures/change-in-volume/output-k8s.json rename to script/test/fixtures/change-in-volume/output-k8s-template.json index ea27825b..04c5c622 100644 --- a/script/test/fixtures/change-in-volume/output-k8s.json +++ b/script/test/fixtures/change-in-volume/output-k8s-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -38,6 +42,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -64,6 +72,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -98,6 +110,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/change-in-volume/output-os.json b/script/test/fixtures/change-in-volume/output-os-template.json similarity index 93% rename from script/test/fixtures/change-in-volume/output-os.json rename to script/test/fixtures/change-in-volume/output-os-template.json index a7587327..bc134858 100644 --- a/script/test/fixtures/change-in-volume/output-os.json +++ b/script/test/fixtures/change-in-volume/output-os-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -38,6 +42,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -64,6 +72,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -150,6 +162,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/entrypoint-command/output-k8s.json b/script/test/fixtures/entrypoint-command/output-k8s-template.json similarity index 87% rename from script/test/fixtures/entrypoint-command/output-k8s.json rename to script/test/fixtures/entrypoint-command/output-k8s-template.json index d26d5707..18fbd39c 100644 --- a/script/test/fixtures/entrypoint-command/output-k8s.json +++ b/script/test/fixtures/entrypoint-command/output-k8s-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "base" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -38,6 +42,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "base" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/entrypoint-command/output-os.json b/script/test/fixtures/entrypoint-command/output-os-template.json similarity index 92% rename from script/test/fixtures/entrypoint-command/output-os.json rename to script/test/fixtures/entrypoint-command/output-os-template.json index fdc03ad0..307ce6dd 100644 --- a/script/test/fixtures/entrypoint-command/output-os.json +++ b/script/test/fixtures/entrypoint-command/output-os-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "base" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -38,6 +42,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "base" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/envvars-separators/output-k8s.json b/script/test/fixtures/envvars-separators/output-k8s-template.json similarity index 91% rename from script/test/fixtures/envvars-separators/output-k8s.json rename to script/test/fixtures/envvars-separators/output-k8s-template.json index 9de9c2cd..fdec8001 100644 --- a/script/test/fixtures/envvars-separators/output-k8s.json +++ b/script/test/fixtures/envvars-separators/output-k8s-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-api" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -37,6 +41,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-bitbucket-scm-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -64,6 +72,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-chat-ops-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -91,6 +103,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-github-scm-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -118,6 +134,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-jenkins-build-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -145,6 +165,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-jenkins-cucumber-test-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -172,6 +196,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-jira-feature-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -199,6 +227,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-sonar-codequality-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -226,6 +258,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-subversion-scm-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -253,6 +289,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-udeploy-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -280,6 +320,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-ui" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -306,6 +350,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-versionone-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -333,6 +381,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "mongodb" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -359,6 +411,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-api" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -436,6 +492,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-bitbucket-scm-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -508,6 +568,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-chat-ops-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -580,6 +644,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-github-scm-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -652,6 +720,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-jenkins-build-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -724,6 +796,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-jenkins-cucumber-test-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -796,6 +872,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-jira-feature-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -878,6 +958,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-sonar-codequality-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -950,6 +1034,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-subversion-scm-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -1022,6 +1110,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-udeploy-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -1108,6 +1200,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-ui" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -1147,6 +1243,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-versionone-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -1219,6 +1319,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "mongodb" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/etherpad/output-k8s.json b/script/test/fixtures/etherpad/output-k8s-template.json similarity index 91% rename from script/test/fixtures/etherpad/output-k8s.json rename to script/test/fixtures/etherpad/output-k8s-template.json index aa51114e..ff01da65 100644 --- a/script/test/fixtures/etherpad/output-k8s.json +++ b/script/test/fixtures/etherpad/output-k8s-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "etherpad" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -37,6 +41,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "mariadb" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -63,6 +71,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "etherpad" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -124,6 +136,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "mariadb" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/etherpad/output-os.json b/script/test/fixtures/etherpad/output-os-template.json similarity index 94% rename from script/test/fixtures/etherpad/output-os.json rename to script/test/fixtures/etherpad/output-os-template.json index b41d0a46..65faf850 100644 --- a/script/test/fixtures/etherpad/output-os.json +++ b/script/test/fixtures/etherpad/output-os-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "etherpad" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -37,6 +41,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "mariadb" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -63,6 +71,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "etherpad" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -176,6 +188,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "mariadb" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/expose-service/provider-files/kubernetes-expose-hostname-multiple-ports.json b/script/test/fixtures/expose-service/provider-files/kubernetes-expose-hostname-multiple-ports.json index 9e0bbc0e..e46c7eb2 100644 --- a/script/test/fixtures/expose-service/provider-files/kubernetes-expose-hostname-multiple-ports.json +++ b/script/test/fixtures/expose-service/provider-files/kubernetes-expose-hostname-multiple-ports.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -39,6 +43,8 @@ "io.kompose.service": "web" }, "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%", "kompose.service.expose": "batman.example.com" } }, @@ -71,6 +77,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -112,6 +122,8 @@ "io.kompose.service": "web" }, "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%", "kompose.service.expose": "batman.example.com" } }, diff --git a/script/test/fixtures/expose-service/provider-files/kubernetes-expose-hostname.json b/script/test/fixtures/expose-service/provider-files/kubernetes-expose-hostname.json index 98d604e3..fa7e80b3 100644 --- a/script/test/fixtures/expose-service/provider-files/kubernetes-expose-hostname.json +++ b/script/test/fixtures/expose-service/provider-files/kubernetes-expose-hostname.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -39,6 +43,8 @@ "io.kompose.service": "web" }, "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%", "kompose.service.expose": "batman.example.com" } }, @@ -66,6 +72,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -107,6 +117,8 @@ "io.kompose.service": "web" }, "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%", "kompose.service.expose": "batman.example.com" } }, diff --git a/script/test/fixtures/expose-service/provider-files/kubernetes-expose-true-multiple-ports.json b/script/test/fixtures/expose-service/provider-files/kubernetes-expose-true-multiple-ports.json index e378ef9c..6bbe2bc7 100644 --- a/script/test/fixtures/expose-service/provider-files/kubernetes-expose-true-multiple-ports.json +++ b/script/test/fixtures/expose-service/provider-files/kubernetes-expose-true-multiple-ports.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -39,6 +43,8 @@ "io.kompose.service": "web" }, "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%", "kompose.service.expose": "True" } }, @@ -71,6 +77,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -112,7 +122,9 @@ "io.kompose.service": "web" }, "annotations": { - "kompose.service.expose": "True" + "kompose.service.expose": "True", + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/expose-service/provider-files/kubernetes-expose-true.json b/script/test/fixtures/expose-service/provider-files/kubernetes-expose-true.json index 4a96c0bd..4ca279a1 100644 --- a/script/test/fixtures/expose-service/provider-files/kubernetes-expose-true.json +++ b/script/test/fixtures/expose-service/provider-files/kubernetes-expose-true.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -39,6 +43,8 @@ "io.kompose.service": "web" }, "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%", "kompose.service.expose": "True" } }, @@ -66,6 +72,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -107,6 +117,8 @@ "io.kompose.service": "web" }, "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%", "kompose.service.expose": "True" } }, diff --git a/script/test/fixtures/expose-service/provider-files/openshift-expose-hostname-multiple-ports.json b/script/test/fixtures/expose-service/provider-files/openshift-expose-hostname-multiple-ports.json index a5ec61d3..e8b3be62 100644 --- a/script/test/fixtures/expose-service/provider-files/openshift-expose-hostname-multiple-ports.json +++ b/script/test/fixtures/expose-service/provider-files/openshift-expose-hostname-multiple-ports.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -39,6 +43,8 @@ "io.kompose.service": "web" }, "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%", "kompose.service.expose": "batman.example.com" } }, @@ -71,6 +77,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -164,6 +174,8 @@ "io.kompose.service": "web" }, "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%", "kompose.service.expose": "batman.example.com" } }, diff --git a/script/test/fixtures/expose-service/provider-files/openshift-expose-hostname.json b/script/test/fixtures/expose-service/provider-files/openshift-expose-hostname.json index ddd38412..be620d7e 100644 --- a/script/test/fixtures/expose-service/provider-files/openshift-expose-hostname.json +++ b/script/test/fixtures/expose-service/provider-files/openshift-expose-hostname.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -39,6 +43,8 @@ "io.kompose.service": "web" }, "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%", "kompose.service.expose": "batman.example.com" } }, @@ -66,6 +72,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -159,6 +169,8 @@ "io.kompose.service": "web" }, "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%", "kompose.service.expose": "batman.example.com" } }, diff --git a/script/test/fixtures/expose-service/provider-files/openshift-expose-true-multiple-ports.json b/script/test/fixtures/expose-service/provider-files/openshift-expose-true-multiple-ports.json index 5b5f7200..480c030a 100644 --- a/script/test/fixtures/expose-service/provider-files/openshift-expose-true-multiple-ports.json +++ b/script/test/fixtures/expose-service/provider-files/openshift-expose-true-multiple-ports.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -39,6 +43,8 @@ "io.kompose.service": "web" }, "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%", "kompose.service.expose": "True" } }, @@ -71,6 +77,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -164,6 +174,8 @@ "io.kompose.service": "web" }, "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%", "kompose.service.expose": "True" } }, diff --git a/script/test/fixtures/expose-service/provider-files/openshift-expose-true.json b/script/test/fixtures/expose-service/provider-files/openshift-expose-true.json index ed206793..09aed1ca 100644 --- a/script/test/fixtures/expose-service/provider-files/openshift-expose-true.json +++ b/script/test/fixtures/expose-service/provider-files/openshift-expose-true.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -39,6 +43,8 @@ "io.kompose.service": "web" }, "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%", "kompose.service.expose": "True" } }, @@ -66,6 +72,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -159,6 +169,8 @@ "io.kompose.service": "web" }, "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%", "kompose.service.expose": "True" } }, diff --git a/script/test/fixtures/gitlab/output-k8s.json b/script/test/fixtures/gitlab/output-k8s-template.json similarity index 90% rename from script/test/fixtures/gitlab/output-k8s.json rename to script/test/fixtures/gitlab/output-k8s-template.json index 96422418..ff30a65c 100644 --- a/script/test/fixtures/gitlab/output-k8s.json +++ b/script/test/fixtures/gitlab/output-k8s-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "gitlab" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -47,6 +51,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "postgresql" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -73,6 +81,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -99,6 +111,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "gitlab" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -178,6 +194,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "postgresql" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -231,6 +251,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/gitlab/output-os.json b/script/test/fixtures/gitlab/output-os-template.json similarity index 93% rename from script/test/fixtures/gitlab/output-os.json rename to script/test/fixtures/gitlab/output-os-template.json index e71053a6..80965aee 100644 --- a/script/test/fixtures/gitlab/output-os.json +++ b/script/test/fixtures/gitlab/output-os-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "gitlab" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -47,6 +51,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "postgresql" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -73,6 +81,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -99,6 +111,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "gitlab" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -230,6 +246,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "postgresql" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -335,6 +355,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/group-add/output-k8s.json b/script/test/fixtures/group-add/output-k8s.json index 2646923e..66f34e07 100644 --- a/script/test/fixtures/group-add/output-k8s.json +++ b/script/test/fixtures/group-add/output-k8s.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "myservice" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -38,6 +42,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "myservice" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/group-add/output-os.json b/script/test/fixtures/group-add/output-os.json index e4e75801..090d3bde 100644 --- a/script/test/fixtures/group-add/output-os.json +++ b/script/test/fixtures/group-add/output-os.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "myservice" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -38,6 +42,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "myservice" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/keyonly-envs/output-k8s.json b/script/test/fixtures/keyonly-envs/output-k8s-template.json similarity index 89% rename from script/test/fixtures/keyonly-envs/output-k8s.json rename to script/test/fixtures/keyonly-envs/output-k8s-template.json index b4a2032c..00b5bff6 100644 --- a/script/test/fixtures/keyonly-envs/output-k8s.json +++ b/script/test/fixtures/keyonly-envs/output-k8s-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "frontend" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -37,6 +41,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis-master" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -63,6 +71,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis-slave" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -89,6 +101,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "frontend" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -146,6 +162,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis-master" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -185,6 +205,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis-slave" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/mem-limit/output-k8s.json b/script/test/fixtures/mem-limit/output-k8s-template.json similarity index 89% rename from script/test/fixtures/mem-limit/output-k8s.json rename to script/test/fixtures/mem-limit/output-k8s-template.json index 02ba1b5b..fdb48582 100644 --- a/script/test/fixtures/mem-limit/output-k8s.json +++ b/script/test/fixtures/mem-limit/output-k8s-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -43,6 +47,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/mem-limit/output-mb-k8s.json b/script/test/fixtures/mem-limit/output-mb-k8s-template.json similarity index 89% rename from script/test/fixtures/mem-limit/output-mb-k8s.json rename to script/test/fixtures/mem-limit/output-mb-k8s-template.json index 466de9c5..af60defd 100644 --- a/script/test/fixtures/mem-limit/output-mb-k8s.json +++ b/script/test/fixtures/mem-limit/output-mb-k8s-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -43,6 +47,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/multiple-compose-files/output-k8s.json b/script/test/fixtures/multiple-compose-files/output-k8s-template.json similarity index 93% rename from script/test/fixtures/multiple-compose-files/output-k8s.json rename to script/test/fixtures/multiple-compose-files/output-k8s-template.json index 70efde38..ac88fee8 100644 --- a/script/test/fixtures/multiple-compose-files/output-k8s.json +++ b/script/test/fixtures/multiple-compose-files/output-k8s-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "etherpad" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -42,6 +46,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "mariadb" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -73,6 +81,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "etherpad" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -137,6 +149,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "mariadb" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/multiple-compose-files/output-openshift.json b/script/test/fixtures/multiple-compose-files/output-os-template.json similarity index 95% rename from script/test/fixtures/multiple-compose-files/output-openshift.json rename to script/test/fixtures/multiple-compose-files/output-os-template.json index ce2b3ee3..342df979 100644 --- a/script/test/fixtures/multiple-compose-files/output-openshift.json +++ b/script/test/fixtures/multiple-compose-files/output-os-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "etherpad" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -42,6 +46,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "mariadb" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -73,6 +81,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "etherpad" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -189,6 +201,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "mariadb" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/nginx-node-redis/output-k8s.json b/script/test/fixtures/nginx-node-redis/output-k8s-template.json similarity index 86% rename from script/test/fixtures/nginx-node-redis/output-k8s.json rename to script/test/fixtures/nginx-node-redis/output-k8s-template.json index 0cdc0c2a..dfc6af41 100644 --- a/script/test/fixtures/nginx-node-redis/output-k8s.json +++ b/script/test/fixtures/nginx-node-redis/output-k8s-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "nginx" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -37,6 +41,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "node1" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -63,6 +71,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "node2" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -89,6 +101,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "node3" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -115,6 +131,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -141,6 +161,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "nginx" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -180,6 +204,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "node1" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -219,6 +247,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "node2" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -258,6 +290,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "node3" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -297,6 +333,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/nginx-node-redis/output-os-template.json b/script/test/fixtures/nginx-node-redis/output-os-template.json index 1863b9ab..6af0faeb 100644 --- a/script/test/fixtures/nginx-node-redis/output-os-template.json +++ b/script/test/fixtures/nginx-node-redis/output-os-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "nginx" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -37,6 +41,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "node1" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -63,6 +71,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "node2" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -89,6 +101,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "node3" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -115,6 +131,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -141,6 +161,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "nginx" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -232,6 +256,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "nginx" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -275,6 +303,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "node1" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -366,6 +398,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "node1" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -409,6 +445,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "node2" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -500,6 +540,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "node2" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -543,6 +587,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "node3" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -634,6 +682,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "node3" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -677,6 +729,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/ports-with-ip/output-k8s-template.json b/script/test/fixtures/ports-with-ip/output-k8s-template.json new file mode 100644 index 00000000..e07fa013 --- /dev/null +++ b/script/test/fixtures/ports-with-ip/output-k8s-template.json @@ -0,0 +1,164 @@ +{ + "kind": "List", + "apiVersion": "v1", + "metadata": {}, + "items": [ + { + "kind": "Service", + "apiVersion": "v1", + "metadata": { + "name": "redis", + "creationTimestamp": null, + "labels": { + "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" + } + }, + "spec": { + "ports": [ + { + "name": "6379", + "port": 6379, + "targetPort": 6379 + }, + { + "name": "1234", + "protocol": "UDP", + "port": 1234, + "targetPort": 1235 + } + ], + "selector": { + "io.kompose.service": "redis" + } + }, + "status": { + "loadBalancer": {} + } + }, + { + "kind": "Service", + "apiVersion": "v1", + "metadata": { + "name": "web", + "creationTimestamp": null, + "labels": { + "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" + } + }, + "spec": { + "ports": [ + { + "name": "5000", + "port": 5000, + "targetPort": 5000 + } + ], + "selector": { + "io.kompose.service": "web" + } + }, + "status": { + "loadBalancer": {} + } + }, + { + "kind": "Deployment", + "apiVersion": "extensions/v1beta1", + "metadata": { + "name": "redis", + "creationTimestamp": null, + "labels": { + "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" + } + }, + "spec": { + "replicas": 1, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "io.kompose.service": "redis" + } + }, + "spec": { + "containers": [ + { + "name": "redis", + "image": "redis:3.0", + "ports": [ + { + "containerPort": 6379 + }, + { + "containerPort": 1235, + "protocol": "UDP" + } + ], + "resources": {} + } + ], + "restartPolicy": "Always" + } + }, + "strategy": {} + }, + "status": {} + }, + { + "kind": "Deployment", + "apiVersion": "extensions/v1beta1", + "metadata": { + "name": "web", + "creationTimestamp": null, + "labels": { + "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" + } + }, + "spec": { + "replicas": 1, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "io.kompose.service": "web" + } + }, + "spec": { + "containers": [ + { + "name": "web", + "image": "tuna/docker-counter23", + "ports": [ + { + "containerPort": 5000, + "hostIP": "127.0.0.1" + } + ], + "resources": {} + } + ], + "restartPolicy": "Always" + } + }, + "strategy": {} + }, + "status": {} + } + ] +} diff --git a/script/test/fixtures/ports-with-ip/output-k8s.json b/script/test/fixtures/ports-with-ip/output-k8s.json index 0a24eef9..a044e235 100644 --- a/script/test/fixtures/ports-with-ip/output-k8s.json +++ b/script/test/fixtures/ports-with-ip/output-k8s.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "kompose -f /home/snarwade/go/src/github.com/kubernetes/kompose/script/test/fixtures/ports-with-ip/docker-compose.yml convert --stdout -j", + "kompose.version": "1.0.0 (HEAD)" } }, "spec": { @@ -43,6 +47,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "kompose -f /home/snarwade/go/src/github.com/kubernetes/kompose/script/test/fixtures/ports-with-ip/docker-compose.yml convert --stdout -j", + "kompose.version": "1.0.0 (HEAD)" } }, "spec": { @@ -69,6 +77,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "kompose -f /home/snarwade/go/src/github.com/kubernetes/kompose/script/test/fixtures/ports-with-ip/docker-compose.yml convert --stdout -j", + "kompose.version": "1.0.0 (HEAD)" } }, "spec": { @@ -112,6 +124,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "kompose -f /home/snarwade/go/src/github.com/kubernetes/kompose/script/test/fixtures/ports-with-ip/docker-compose.yml convert --stdout -j", + "kompose.version": "1.0.0 (HEAD)" } }, "spec": { diff --git a/script/test/fixtures/ports-with-proto/output-k8s.json b/script/test/fixtures/ports-with-proto/output-k8s-template.json similarity index 87% rename from script/test/fixtures/ports-with-proto/output-k8s.json rename to script/test/fixtures/ports-with-proto/output-k8s-template.json index 41aeb491..a4f15d36 100644 --- a/script/test/fixtures/ports-with-proto/output-k8s.json +++ b/script/test/fixtures/ports-with-proto/output-k8s-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -43,6 +47,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -69,6 +77,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -112,6 +124,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/ports-with-proto/output-os.json b/script/test/fixtures/ports-with-proto/output-os-template.json similarity index 92% rename from script/test/fixtures/ports-with-proto/output-os.json rename to script/test/fixtures/ports-with-proto/output-os-template.json index f931a537..80897a49 100644 --- a/script/test/fixtures/ports-with-proto/output-os.json +++ b/script/test/fixtures/ports-with-proto/output-os-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -43,6 +47,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -69,6 +77,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -164,6 +176,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/service-name-change/output-k8s.json b/script/test/fixtures/service-name-change/output-k8s-template.json similarity index 94% rename from script/test/fixtures/service-name-change/output-k8s.json rename to script/test/fixtures/service-name-change/output-k8s-template.json index 6b84bd10..a58dcff8 100644 --- a/script/test/fixtures/service-name-change/output-k8s.json +++ b/script/test/fixtures/service-name-change/output-k8s-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "mariadb" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -38,6 +42,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "wordpress" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -69,6 +77,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "mariadb" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -155,6 +167,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "wordpress" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/service-name-change/output-os.json b/script/test/fixtures/service-name-change/output-os-template.json similarity index 95% rename from script/test/fixtures/service-name-change/output-os.json rename to script/test/fixtures/service-name-change/output-os-template.json index b88563fb..382ebd07 100644 --- a/script/test/fixtures/service-name-change/output-os.json +++ b/script/test/fixtures/service-name-change/output-os-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "mariadb" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -38,6 +42,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "wordpress" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -69,6 +77,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "mariadb" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -206,6 +218,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "wordpress" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/stdin-true/output-k8s.json b/script/test/fixtures/stdin-true/output-k8s-template.json similarity index 87% rename from script/test/fixtures/stdin-true/output-k8s.json rename to script/test/fixtures/stdin-true/output-k8s-template.json index 9173c74b..6507d159 100644 --- a/script/test/fixtures/stdin-true/output-k8s.json +++ b/script/test/fixtures/stdin-true/output-k8s-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "client" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -37,6 +41,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "client" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/stdin-true/output-oc.json b/script/test/fixtures/stdin-true/output-os-template.json similarity index 92% rename from script/test/fixtures/stdin-true/output-oc.json rename to script/test/fixtures/stdin-true/output-os-template.json index 85ce7380..b0f05a09 100644 --- a/script/test/fixtures/stdin-true/output-oc.json +++ b/script/test/fixtures/stdin-true/output-os-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "client" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -37,6 +41,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "client" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/tty-true/output-k8s-template.json b/script/test/fixtures/tty-true/output-k8s-template.json new file mode 100644 index 00000000..c6d3a7fa --- /dev/null +++ b/script/test/fixtures/tty-true/output-k8s-template.json @@ -0,0 +1,81 @@ +{ + "kind": "List", + "apiVersion": "v1", + "metadata": {}, + "items": [ + { + "kind": "Service", + "apiVersion": "v1", + "metadata": { + "name": "client", + "creationTimestamp": null, + "labels": { + "io.kompose.service": "client" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" + } + }, + "spec": { + "ports": [ + { + "name": "1337", + "port": 1337, + "targetPort": 1337 + } + ], + "selector": { + "io.kompose.service": "client" + } + }, + "status": { + "loadBalancer": {} + } + }, + { + "kind": "Deployment", + "apiVersion": "extensions/v1beta1", + "metadata": { + "name": "client", + "creationTimestamp": null, + "labels": { + "io.kompose.service": "client" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" + } + }, + "spec": { + "replicas": 1, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "io.kompose.service": "client" + } + }, + "spec": { + "containers": [ + { + "name": "client", + "image": "registry.centos.org/centos/centos:7", + "ports": [ + { + "containerPort": 1337 + } + ], + "resources": {}, + "tty": true + } + ], + "restartPolicy": "Always" + } + }, + "strategy": {} + }, + "status": {} + } + ] +} diff --git a/script/test/fixtures/tty-true/output-k8s.json b/script/test/fixtures/tty-true/output-k8s.json index 7d363af8..0f40f647 100644 --- a/script/test/fixtures/tty-true/output-k8s.json +++ b/script/test/fixtures/tty-true/output-k8s.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "client" + }, + "annotations": { + "kompose.cmd": "kompose -f /home/snarwade/go/src/github.com/kubernetes/kompose/script/test/fixtures/tty-true/docker-compose.yml convert --stdout -j", + "kompose.version": "1.0.0 (HEAD)" } }, "spec": { @@ -37,6 +41,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "client" + }, + "annotations": { + "kompose.cmd": "kompose -f /home/snarwade/go/src/github.com/kubernetes/kompose/script/test/fixtures/tty-true/docker-compose.yml convert --stdout -j", + "kompose.version": "1.0.0 (HEAD)" } }, "spec": { diff --git a/script/test/fixtures/tty-true/output-oc.json b/script/test/fixtures/tty-true/output-oc.json index b54a219b..2dbe846c 100644 --- a/script/test/fixtures/tty-true/output-oc.json +++ b/script/test/fixtures/tty-true/output-oc.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "client" + }, + "annotations": { + "kompose.cmd": "kompose --provider openshift -f /home/snarwade/go/src/github.com/kubernetes/kompose/script/test/fixtures/tty-true/docker-compose.yml convert --stdout -j", + "kompose.version": "1.0.0 (HEAD)" } }, "spec": { @@ -37,6 +41,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "client" + }, + "annotations": { + "kompose.cmd": "kompose --provider openshift -f /home/snarwade/go/src/github.com/kubernetes/kompose/script/test/fixtures/tty-true/docker-compose.yml convert --stdout -j", + "kompose.version": "1.0.0 (HEAD)" } }, "spec": { diff --git a/script/test/fixtures/tty-true/output-os-template.json b/script/test/fixtures/tty-true/output-os-template.json new file mode 100644 index 00000000..1731171e --- /dev/null +++ b/script/test/fixtures/tty-true/output-os-template.json @@ -0,0 +1,133 @@ +{ + "kind": "List", + "apiVersion": "v1", + "metadata": {}, + "items": [ + { + "kind": "Service", + "apiVersion": "v1", + "metadata": { + "name": "client", + "creationTimestamp": null, + "labels": { + "io.kompose.service": "client" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" + } + }, + "spec": { + "ports": [ + { + "name": "1337", + "port": 1337, + "targetPort": 1337 + } + ], + "selector": { + "io.kompose.service": "client" + } + }, + "status": { + "loadBalancer": {} + } + }, + { + "kind": "DeploymentConfig", + "apiVersion": "v1", + "metadata": { + "name": "client", + "creationTimestamp": null, + "labels": { + "io.kompose.service": "client" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" + } + }, + "spec": { + "strategy": { + "resources": {} + }, + "triggers": [ + { + "type": "ConfigChange" + }, + { + "type": "ImageChange", + "imageChangeParams": { + "automatic": true, + "containerNames": [ + "client" + ], + "from": { + "kind": "ImageStreamTag", + "name": "client:7" + } + } + } + ], + "replicas": 1, + "test": false, + "selector": { + "io.kompose.service": "client" + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "io.kompose.service": "client" + } + }, + "spec": { + "containers": [ + { + "name": "client", + "image": " ", + "ports": [ + { + "containerPort": 1337 + } + ], + "resources": {}, + "tty": true + } + ], + "restartPolicy": "Always" + } + } + }, + "status": {} + }, + { + "kind": "ImageStream", + "apiVersion": "v1", + "metadata": { + "name": "client", + "creationTimestamp": null, + "labels": { + "io.kompose.service": "client" + } + }, + "spec": { + "tags": [ + { + "name": "7", + "annotations": null, + "from": { + "kind": "DockerImage", + "name": "registry.centos.org/centos/centos:7" + }, + "generation": null, + "importPolicy": {} + } + ] + }, + "status": { + "dockerImageRepository": "" + } + } + ] +} diff --git a/script/test/fixtures/v3/output-env-k8s.json b/script/test/fixtures/v3/output-env-k8s.json index 0c48d8a9..40725a6a 100644 --- a/script/test/fixtures/v3/output-env-k8s.json +++ b/script/test/fixtures/v3/output-env-k8s.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "foo" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -38,6 +42,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "foo" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/v3/output-env-subs.json b/script/test/fixtures/v3/output-env-subs.json index a81b9dd0..3ae095e7 100644 --- a/script/test/fixtures/v3/output-env-subs.json +++ b/script/test/fixtures/v3/output-env-subs.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "foo" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -38,6 +42,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "foo" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/v3/output-k8s-full-example-template.json b/script/test/fixtures/v3/output-k8s-full-example-template.json new file mode 100644 index 00000000..ae16ef79 --- /dev/null +++ b/script/test/fixtures/v3/output-k8s-full-example-template.json @@ -0,0 +1,349 @@ +{ + "kind": "List", + "apiVersion": "v1", + "metadata": {}, + "items": [ + { + "kind": "Pod", + "apiVersion": "v1", + "metadata": { + "name": "foo", + "creationTimestamp": null, + "labels": { + "io.kompose.service": "foo" + } + }, + "spec": { + "volumes": [ + { + "name": "foo-claim0", + "persistentVolumeClaim": { + "claimName": "foo-claim0" + } + }, + { + "name": "foo-claim1", + "persistentVolumeClaim": { + "claimName": "foo-claim1" + } + }, + { + "name": "foo-claim2", + "persistentVolumeClaim": { + "claimName": "foo-claim2" + } + }, + { + "name": "foo-claim3", + "persistentVolumeClaim": { + "claimName": "foo-claim3" + } + }, + { + "name": "foo-claim4", + "persistentVolumeClaim": { + "claimName": "foo-claim4", + "readOnly": true + } + }, + { + "name": "datavolume", + "persistentVolumeClaim": { + "claimName": "datavolume" + } + }, + { + "name": "foo-tmpfs0", + "emptyDir": { + "medium": "Memory" + } + }, + { + "name": "foo-tmpfs1", + "emptyDir": { + "medium": "Memory" + } + } + ], + "containers": [ + { + "name": "my-web-container", + "image": "redis", + "command": [ + "/code/entrypoint.sh", + "-p", + "3000" + ], + "args": [ + "bundle", + "exec", + "thin", + "-p", + "3000" + ], + "workingDir": "/code", + "ports": [ + { + "containerPort": 3000 + }, + { + "containerPort": 3000 + }, + { + "containerPort": 3001 + }, + { + "containerPort": 3002 + }, + { + "containerPort": 3003 + }, + { + "containerPort": 3004 + }, + { + "containerPort": 3005 + }, + { + "containerPort": 8000 + }, + { + "containerPort": 8080 + }, + { + "containerPort": 8081 + }, + { + "containerPort": 22 + }, + { + "containerPort": 8001 + }, + { + "containerPort": 5000 + }, + { + "containerPort": 5001 + }, + { + "containerPort": 5002 + }, + { + "containerPort": 5003 + }, + { + "containerPort": 5004 + }, + { + "containerPort": 5005 + }, + { + "containerPort": 5006 + }, + { + "containerPort": 5007 + }, + { + "containerPort": 5008 + }, + { + "containerPort": 5009 + }, + { + "containerPort": 5010 + } + ], + "resources": { + "limits": { + "memory": "52428800" + } + }, + "volumeMounts": [ + { + "name": "foo-claim0", + "mountPath": "/var/lib/mysql" + }, + { + "name": "foo-claim1", + "mountPath": "/var/lib/mysql" + }, + { + "name": "foo-claim2", + "mountPath": "/code" + }, + { + "name": "foo-claim3", + "mountPath": "/var/www/html" + }, + { + "name": "foo-claim4", + "readOnly": true, + "mountPath": "/etc/configs/" + }, + { + "name": "datavolume", + "mountPath": "/var/lib/mysql" + }, + { + "name": "foo-tmpfs0", + "mountPath": "/run" + }, + { + "name": "foo-tmpfs1", + "mountPath": "/tmp" + } + ], + "securityContext": { + "capabilities": { + "add": [ + "ALL" + ], + "drop": [ + "NET_ADMIN", + "SYS_ADMIN" + ] + }, + "privileged": true + }, + "stdin": true, + "tty": true + } + ], + "restartPolicy": "OnFailure" + }, + "status": {} + }, + { + "kind": "PersistentVolumeClaim", + "apiVersion": "v1", + "metadata": { + "name": "foo-claim0", + "creationTimestamp": null, + "labels": { + "io.kompose.service": "foo-claim0" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Mi" + } + } + }, + "status": {} + }, + { + "kind": "PersistentVolumeClaim", + "apiVersion": "v1", + "metadata": { + "name": "foo-claim1", + "creationTimestamp": null, + "labels": { + "io.kompose.service": "foo-claim1" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Mi" + } + } + }, + "status": {} + }, + { + "kind": "PersistentVolumeClaim", + "apiVersion": "v1", + "metadata": { + "name": "foo-claim2", + "creationTimestamp": null, + "labels": { + "io.kompose.service": "foo-claim2" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Mi" + } + } + }, + "status": {} + }, + { + "kind": "PersistentVolumeClaim", + "apiVersion": "v1", + "metadata": { + "name": "foo-claim3", + "creationTimestamp": null, + "labels": { + "io.kompose.service": "foo-claim3" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Mi" + } + } + }, + "status": {} + }, + { + "kind": "PersistentVolumeClaim", + "apiVersion": "v1", + "metadata": { + "name": "foo-claim4", + "creationTimestamp": null, + "labels": { + "io.kompose.service": "foo-claim4" + } + }, + "spec": { + "accessModes": [ + "ReadOnlyMany" + ], + "resources": { + "requests": { + "storage": "100Mi" + } + } + }, + "status": {} + }, + { + "kind": "PersistentVolumeClaim", + "apiVersion": "v1", + "metadata": { + "name": "datavolume", + "creationTimestamp": null, + "labels": { + "io.kompose.service": "datavolume" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Mi" + } + } + }, + "status": {} + } + ] +} diff --git a/script/test/fixtures/v3/output-k8s.json b/script/test/fixtures/v3/output-k8s-template.json similarity index 87% rename from script/test/fixtures/v3/output-k8s.json rename to script/test/fixtures/v3/output-k8s-template.json index 8cabae2b..13b9869c 100644 --- a/script/test/fixtures/v3/output-k8s.json +++ b/script/test/fixtures/v3/output-k8s-template.json @@ -13,7 +13,9 @@ "io.kompose.service": "frontend" }, "annotations": { - "kompose.service.type": "LoadBalancer" + "kompose.cmd": "%CMD%", + "kompose.service.type": "LoadBalancer", + "kompose.version": "%VERSION%" } }, "spec": { @@ -41,6 +43,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis-master" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -67,6 +73,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis-slave" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -95,7 +105,9 @@ "io.kompose.service": "frontend" }, "annotations": { - "kompose.service.type": "LoadBalancer" + "kompose.cmd": "%CMD%", + "kompose.service.type": "LoadBalancer", + "kompose.version": "%VERSION%" } }, "spec": { @@ -141,6 +153,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis-master" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -180,6 +196,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis-slave" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/v3/output-memcpu-k8s.json b/script/test/fixtures/v3/output-memcpu-k8s.json index f09f15a2..67c9ba7d 100644 --- a/script/test/fixtures/v3/output-memcpu-k8s.json +++ b/script/test/fixtures/v3/output-memcpu-k8s.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "foo" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -38,6 +42,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "foo" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/v3/output-os.json b/script/test/fixtures/v3/output-os-template.json similarity index 92% rename from script/test/fixtures/v3/output-os.json rename to script/test/fixtures/v3/output-os-template.json index 3f9edf23..6784936f 100644 --- a/script/test/fixtures/v3/output-os.json +++ b/script/test/fixtures/v3/output-os-template.json @@ -13,7 +13,9 @@ "io.kompose.service": "frontend" }, "annotations": { - "kompose.service.type": "LoadBalancer" + "kompose.cmd": "%CMD%", + "kompose.service.type": "LoadBalancer", + "kompose.version": "%VERSION%" } }, "spec": { @@ -41,6 +43,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis-master" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -67,6 +73,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis-slave" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -95,7 +105,9 @@ "io.kompose.service": "frontend" }, "annotations": { - "kompose.service.type": "LoadBalancer" + "kompose.cmd": "%CMD%", + "kompose.service.type": "LoadBalancer", + "kompose.version": "%VERSION%" } }, "spec": { @@ -193,6 +205,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis-master" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -284,6 +300,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis-slave" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/v3/output-volumes-k8s.json b/script/test/fixtures/v3/output-volumes-k8s-template.json similarity index 91% rename from script/test/fixtures/v3/output-volumes-k8s.json rename to script/test/fixtures/v3/output-volumes-k8s-template.json index 2b148595..f1822570 100644 --- a/script/test/fixtures/v3/output-volumes-k8s.json +++ b/script/test/fixtures/v3/output-volumes-k8s-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "foobar" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -38,6 +42,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "foobar" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/volume-mounts/simple-vol-mounts/output-k8s.json b/script/test/fixtures/volume-mounts/simple-vol-mounts/output-k8s-template.json similarity index 91% rename from script/test/fixtures/volume-mounts/simple-vol-mounts/output-k8s.json rename to script/test/fixtures/volume-mounts/simple-vol-mounts/output-k8s-template.json index 4968cf09..319e2f70 100644 --- a/script/test/fixtures/volume-mounts/simple-vol-mounts/output-k8s.json +++ b/script/test/fixtures/volume-mounts/simple-vol-mounts/output-k8s-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "httpd" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -37,6 +41,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "httpd" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/volume-mounts/simple-vol-mounts/output-os.json b/script/test/fixtures/volume-mounts/simple-vol-mounts/output-os-template.json similarity index 94% rename from script/test/fixtures/volume-mounts/simple-vol-mounts/output-os.json rename to script/test/fixtures/volume-mounts/simple-vol-mounts/output-os-template.json index a2842aae..ee9df82f 100644 --- a/script/test/fixtures/volume-mounts/simple-vol-mounts/output-os.json +++ b/script/test/fixtures/volume-mounts/simple-vol-mounts/output-os-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "httpd" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -37,6 +41,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "httpd" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/volume-mounts/volumes-from/output-k8s.json b/script/test/fixtures/volume-mounts/volumes-from/output-k8s-template.json similarity index 91% rename from script/test/fixtures/volume-mounts/volumes-from/output-k8s.json rename to script/test/fixtures/volume-mounts/volumes-from/output-k8s-template.json index 3fa7a774..f85c752a 100644 --- a/script/test/fixtures/volume-mounts/volumes-from/output-k8s.json +++ b/script/test/fixtures/volume-mounts/volumes-from/output-k8s-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "nginx" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -37,6 +41,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -63,6 +71,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "nginx" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -150,6 +162,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/volume-mounts/volumes-from/output-os.json b/script/test/fixtures/volume-mounts/volumes-from/output-os-template.json similarity index 94% rename from script/test/fixtures/volume-mounts/volumes-from/output-os.json rename to script/test/fixtures/volume-mounts/volumes-from/output-os-template.json index 20fe2894..b03bd254 100644 --- a/script/test/fixtures/volume-mounts/volumes-from/output-os.json +++ b/script/test/fixtures/volume-mounts/volumes-from/output-os-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "nginx" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -37,6 +41,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -63,6 +71,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "nginx" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -201,6 +213,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/yaml-and-yml/yml/output-k8s.json b/script/test/fixtures/yaml-and-yml/output-k8s-template.json similarity index 84% rename from script/test/fixtures/yaml-and-yml/yml/output-k8s.json rename to script/test/fixtures/yaml-and-yml/output-k8s-template.json index fce4a9f3..0ae63891 100644 --- a/script/test/fixtures/yaml-and-yml/yml/output-k8s.json +++ b/script/test/fixtures/yaml-and-yml/output-k8s-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "kompose convert --stdout -j", + "kompose.version": "%VERSION%" } }, "spec": { @@ -37,6 +41,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "kompose convert --stdout -j", + "kompose.version": "%VERSION%" } }, "spec": { @@ -63,6 +71,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "kompose convert --stdout -j", + "kompose.version": "%VERSION%" } }, "spec": { @@ -102,6 +114,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "kompose convert --stdout -j", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/yaml-and-yml/yml/output-os.json b/script/test/fixtures/yaml-and-yml/output-os-template.json similarity index 89% rename from script/test/fixtures/yaml-and-yml/yml/output-os.json rename to script/test/fixtures/yaml-and-yml/output-os-template.json index 75863268..6cc5f54b 100644 --- a/script/test/fixtures/yaml-and-yml/yml/output-os.json +++ b/script/test/fixtures/yaml-and-yml/output-os-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "kompose --provider=openshift convert --stdout -j", + "kompose.version": "%VERSION%" } }, "spec": { @@ -37,6 +41,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "kompose --provider=openshift convert --stdout -j", + "kompose.version": "%VERSION%" } }, "spec": { @@ -63,6 +71,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "kompose --provider=openshift convert --stdout -j", + "kompose.version": "%VERSION%" } }, "spec": { @@ -154,6 +166,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "kompose --provider=openshift convert --stdout -j", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/yaml-and-yml/output-k8s.json b/script/test/fixtures/yaml-and-yml/yml/output-k8s-template.json similarity index 84% rename from script/test/fixtures/yaml-and-yml/output-k8s.json rename to script/test/fixtures/yaml-and-yml/yml/output-k8s-template.json index fce4a9f3..0ae63891 100644 --- a/script/test/fixtures/yaml-and-yml/output-k8s.json +++ b/script/test/fixtures/yaml-and-yml/yml/output-k8s-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "kompose convert --stdout -j", + "kompose.version": "%VERSION%" } }, "spec": { @@ -37,6 +41,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "kompose convert --stdout -j", + "kompose.version": "%VERSION%" } }, "spec": { @@ -63,6 +71,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "kompose convert --stdout -j", + "kompose.version": "%VERSION%" } }, "spec": { @@ -102,6 +114,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "kompose convert --stdout -j", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/yaml-and-yml/output-os.json b/script/test/fixtures/yaml-and-yml/yml/output-os-template.json similarity index 89% rename from script/test/fixtures/yaml-and-yml/output-os.json rename to script/test/fixtures/yaml-and-yml/yml/output-os-template.json index 75863268..6cc5f54b 100644 --- a/script/test/fixtures/yaml-and-yml/output-os.json +++ b/script/test/fixtures/yaml-and-yml/yml/output-os-template.json @@ -11,6 +11,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "kompose --provider=openshift convert --stdout -j", + "kompose.version": "%VERSION%" } }, "spec": { @@ -37,6 +41,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "kompose --provider=openshift convert --stdout -j", + "kompose.version": "%VERSION%" } }, "spec": { @@ -63,6 +71,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "kompose --provider=openshift convert --stdout -j", + "kompose.version": "%VERSION%" } }, "spec": { @@ -154,6 +166,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "kompose --provider=openshift convert --stdout -j", + "kompose.version": "%VERSION%" } }, "spec": {