From 91391eb84f02a5a186cc409f9ca95ec546f91f62 Mon Sep 17 00:00:00 2001 From: AhmedGrati <48932084+AhmedGrati@users.noreply.github.com> Date: Thu, 1 Dec 2022 09:47:50 +0100 Subject: [PATCH] Fix: Make the out flag print to one file using seperator (#1541) * fix: make the out flag print to one file using seperator * fix: comment an unused function * fix: update test script * fix: update output k8s * fix: update the json output error condition * fix: update envvars interpolation tests * chore: update e2e tests to support yaml generation instead of JSON format * fix: update e2e tests according to ci environment * fix: apply PR changes --- pkg/transformer/kubernetes/k8sutils.go | 44 +- script/test/cmd/lib.sh | 14 +- script/test/cmd/tests_new.sh | 141 ++-- .../output-k8s-empty-vols-template.json | 170 ----- .../output-k8s-empty-vols-template.yaml | 108 +++ .../change-in-volume/output-k8s-template.json | 217 ------ .../fixtures/change-in-volume/output-k8s.yaml | 109 +++ .../output-os-empty-vols-template.json | 286 -------- .../output-os-empty-vols-template.yaml | 189 +++++ .../change-in-volume/output-os-template.json | 296 -------- .../fixtures/change-in-volume/output-os.yaml | 189 +++++ .../output-k8s-withlabel.json | 202 ------ .../output-k8s-withlabel.yaml | 129 ++++ .../fixtures/configmap-volume/output-k8s.json | 190 ----- .../fixtures/configmap-volume/output-k8s.yaml | 121 ++++ .../configmap-volume/output-os-withlabel.json | 314 --------- .../configmap-volume/output-os-withlabel.yaml | 207 ++++++ .../fixtures/configmap-volume/output-os.json | 308 -------- .../fixtures/configmap-volume/output-os.yaml | 203 ++++++ .../placement/output-placement-k8s.json | 132 ---- .../placement/output-placement-k8s.yaml | 77 ++ .../deploy/placement/output-placement-os.json | 192 ----- .../deploy/placement/output-placement-os.yaml | 118 ++++ .../envvars-interpolation/output-k8s.json | 60 -- .../envvars-interpolation/output-k8s.yaml | 35 + .../envvars-interpolation/output-os.json | 120 ---- .../envvars-interpolation/output-os.yaml | 76 ++ script/test/fixtures/expose/output-k8s.json | 233 ------- script/test/fixtures/expose/output-k8s.yaml | 148 ++++ script/test/fixtures/expose/output-ocp.json | 300 -------- script/test/fixtures/expose/output-os.yaml | 202 ++++++ .../healthcheck/output-healthcheck-k8s.json | 401 ----------- .../healthcheck/output-healthcheck-k8s.yaml | 284 ++++++++ .../healthcheck/output-healthcheck-os.json | 660 ------------------ .../healthcheck/output-healthcheck-os.yaml | 459 ++++++++++++ .../fixtures/multiple-files/output-k8s.json | 85 --- .../fixtures/multiple-files/output-k8s.yaml | 53 ++ .../fixtures/multiple-files/output-ocp.json | 205 ------ .../fixtures/multiple-files/output-os.yaml | 136 ++++ .../multiple-type-volumes/output-k8s.json | 200 ------ .../multiple-type-volumes/output-k8s.yaml | 128 ++++ .../multiple-type-volumes/output-os.json | 312 --------- .../multiple-type-volumes/output-os.yaml | 206 ++++++ .../fixtures/service-group/output-k8s.json | 139 ---- .../fixtures/service-group/output-k8s.yaml | 84 +++ .../single-file-output/docker-compose.yaml | 12 + .../single-file-output/output-k8s.yaml | 85 +++ .../test/fixtures/statefulset/output-k8s.json | 249 ------- .../test/fixtures/statefulset/output-k8s.yaml | 152 ++++ .../test/fixtures/statefulset/output-os.json | 503 ------------- .../test/fixtures/statefulset/output-os.yaml | 314 +++++++++ script/test/fixtures/v2/output-k8s.json | 397 ----------- script/test/fixtures/v2/output-k8s.yaml | 233 +++++++ script/test/fixtures/v2/output-os.json | 454 ------------ script/test/fixtures/v2/output-os.yaml | 272 ++++++++ script/test/fixtures/v3.0/output-k8s.json | 223 ------ script/test/fixtures/v3.0/output-k8s.yaml | 141 ++++ script/test/fixtures/v3.0/output-os.json | 256 ------- script/test/fixtures/v3.0/output-os.yaml | 173 +++++ .../volume-mounts/windows/output-k8s.json | 115 --- .../volume-mounts/windows/output-k8s.yaml | 71 ++ .../volume-mounts/windows/output-os.json | 174 ----- .../volume-mounts/windows/output-os.yaml | 112 +++ 63 files changed, 4919 insertions(+), 7499 deletions(-) delete mode 100644 script/test/fixtures/change-in-volume/output-k8s-empty-vols-template.json create mode 100644 script/test/fixtures/change-in-volume/output-k8s-empty-vols-template.yaml delete mode 100644 script/test/fixtures/change-in-volume/output-k8s-template.json create mode 100644 script/test/fixtures/change-in-volume/output-k8s.yaml delete mode 100644 script/test/fixtures/change-in-volume/output-os-empty-vols-template.json create mode 100644 script/test/fixtures/change-in-volume/output-os-empty-vols-template.yaml delete mode 100644 script/test/fixtures/change-in-volume/output-os-template.json create mode 100644 script/test/fixtures/change-in-volume/output-os.yaml delete mode 100644 script/test/fixtures/configmap-volume/output-k8s-withlabel.json create mode 100644 script/test/fixtures/configmap-volume/output-k8s-withlabel.yaml delete mode 100644 script/test/fixtures/configmap-volume/output-k8s.json create mode 100644 script/test/fixtures/configmap-volume/output-k8s.yaml delete mode 100644 script/test/fixtures/configmap-volume/output-os-withlabel.json create mode 100644 script/test/fixtures/configmap-volume/output-os-withlabel.yaml delete mode 100644 script/test/fixtures/configmap-volume/output-os.json create mode 100644 script/test/fixtures/configmap-volume/output-os.yaml delete mode 100644 script/test/fixtures/deploy/placement/output-placement-k8s.json create mode 100644 script/test/fixtures/deploy/placement/output-placement-k8s.yaml delete mode 100644 script/test/fixtures/deploy/placement/output-placement-os.json create mode 100644 script/test/fixtures/deploy/placement/output-placement-os.yaml delete mode 100644 script/test/fixtures/envvars-interpolation/output-k8s.json create mode 100644 script/test/fixtures/envvars-interpolation/output-k8s.yaml delete mode 100644 script/test/fixtures/envvars-interpolation/output-os.json create mode 100644 script/test/fixtures/envvars-interpolation/output-os.yaml delete mode 100644 script/test/fixtures/expose/output-k8s.json create mode 100644 script/test/fixtures/expose/output-k8s.yaml delete mode 100644 script/test/fixtures/expose/output-ocp.json create mode 100644 script/test/fixtures/expose/output-os.yaml delete mode 100644 script/test/fixtures/healthcheck/output-healthcheck-k8s.json create mode 100644 script/test/fixtures/healthcheck/output-healthcheck-k8s.yaml delete mode 100644 script/test/fixtures/healthcheck/output-healthcheck-os.json create mode 100644 script/test/fixtures/healthcheck/output-healthcheck-os.yaml delete mode 100644 script/test/fixtures/multiple-files/output-k8s.json create mode 100644 script/test/fixtures/multiple-files/output-k8s.yaml delete mode 100644 script/test/fixtures/multiple-files/output-ocp.json create mode 100644 script/test/fixtures/multiple-files/output-os.yaml delete mode 100644 script/test/fixtures/multiple-type-volumes/output-k8s.json create mode 100644 script/test/fixtures/multiple-type-volumes/output-k8s.yaml delete mode 100644 script/test/fixtures/multiple-type-volumes/output-os.json create mode 100644 script/test/fixtures/multiple-type-volumes/output-os.yaml delete mode 100644 script/test/fixtures/service-group/output-k8s.json create mode 100644 script/test/fixtures/service-group/output-k8s.yaml create mode 100644 script/test/fixtures/single-file-output/docker-compose.yaml create mode 100644 script/test/fixtures/single-file-output/output-k8s.yaml delete mode 100644 script/test/fixtures/statefulset/output-k8s.json create mode 100644 script/test/fixtures/statefulset/output-k8s.yaml delete mode 100644 script/test/fixtures/statefulset/output-os.json create mode 100644 script/test/fixtures/statefulset/output-os.yaml delete mode 100644 script/test/fixtures/v2/output-k8s.json create mode 100644 script/test/fixtures/v2/output-k8s.yaml delete mode 100644 script/test/fixtures/v2/output-os.json create mode 100644 script/test/fixtures/v2/output-os.yaml delete mode 100644 script/test/fixtures/v3.0/output-k8s.json create mode 100644 script/test/fixtures/v3.0/output-k8s.yaml delete mode 100644 script/test/fixtures/v3.0/output-os.json create mode 100644 script/test/fixtures/v3.0/output-os.yaml delete mode 100644 script/test/fixtures/volume-mounts/windows/output-k8s.json create mode 100644 script/test/fixtures/volume-mounts/windows/output-k8s.yaml delete mode 100644 script/test/fixtures/volume-mounts/windows/output-os.json create mode 100644 script/test/fixtures/volume-mounts/windows/output-os.yaml diff --git a/pkg/transformer/kubernetes/k8sutils.go b/pkg/transformer/kubernetes/k8sutils.go index a1b7823e..0ab048ee 100644 --- a/pkg/transformer/kubernetes/k8sutils.go +++ b/pkg/transformer/kubernetes/k8sutils.go @@ -148,17 +148,6 @@ func getDirName(opt kobject.ConvertOptions) string { return dirName } -func objectToRaw(object runtime.Object) runtime.RawExtension { - r := runtime.RawExtension{ - Object: object, - } - - bytes, _ := json.Marshal(object) - r.Raw = bytes - - return r -} - // PrintList will take the data converted and decide on the commandline attributes given func PrintList(objects []runtime.Object, opt kobject.ConvertOptions) error { var f *os.File @@ -192,36 +181,31 @@ func PrintList(objects []runtime.Object, opt kobject.ConvertOptions) error { } var files []string - // if asked to print to stdout or to put in single file // we will create a list if opt.ToStdout || f != nil { - list := &api.List{} // convert objects to versioned and add them to list + if opt.GenerateJSON { + return fmt.Errorf("cannot convert to one file while specifying a json output file or stdout option") + } for _, object := range objects { versionedObject, err := convertToVersion(object) if err != nil { return err } - list.Items = append(list.Items, objectToRaw(versionedObject)) + data, err := marshal(versionedObject, opt.GenerateJSON, opt.YAMLIndent) + if err != nil { + return fmt.Errorf("error in marshalling the List: %v", err) + } + // this part add --- which unifies the file + data = []byte(fmt.Sprintf("---\n%s", data)) + printVal, err := transformer.Print("", dirName, "", data, opt.ToStdout, opt.GenerateJSON, f, opt.Provider) + if err != nil { + return errors.Wrap(err, "transformer to print to one single file failed") + } + files = append(files, printVal) } - // version list itself - list.Kind = "List" - list.APIVersion = "v1" - convertedList, err := convertToVersion(list) - if err != nil { - return err - } - data, err := marshal(convertedList, opt.GenerateJSON, opt.YAMLIndent) - if err != nil { - return fmt.Errorf("error in marshalling the List: %v", err) - } - printVal, err := transformer.Print("", dirName, "", data, opt.ToStdout, opt.GenerateJSON, f, opt.Provider) - if err != nil { - return errors.Wrap(err, "transformer.Print failed") - } - files = append(files, printVal) } else { finalDirName := dirName if opt.CreateChart { diff --git a/script/test/cmd/lib.sh b/script/test/cmd/lib.sh index b42fcc78..77e3c41e 100644 --- a/script/test/cmd/lib.sh +++ b/script/test/cmd/lib.sh @@ -100,13 +100,11 @@ function convert::match_output() { convert::run_cmd $cmd exit_status=$? if [ $exit_status -ne 0 ]; then FAIL_MSGS=$FAIL_MSGS"exit status: $exit_status\n"; return $exit_status; fi - - match=$(jq --argfile a $TEMP_STDOUT --argfile b $expected_output -n 'def post_recurse(f): def r: (f | select(. != null) | r), .; r; def post_recurse: post_recurse(.[]?); ($a | (post_recurse | arrays) |= sort) as $a | ($b | (post_recurse | arrays) |= sort) as $b | $a == $b') - $cmd > /tmp/test.json - diff /tmp/test.json $expected_output > /tmp/diff - rm /tmp/test.json - if [ "$match" = true ]; then SUCCESS_MSGS=$SUCCESS_MSGS"converted output matches\n"; return 0; - else FAIL_MSGS=$FAIL_MSGS"converted output does not match\n"; cat /tmp/diff; rm /tmp/diff; return 1; fi + match=$(diff <(yq -P 'sort_keys(....)' $expected_output) <(yq -P 'sort_keys(....)' $TEMP_STDOUT)) + echo "$match" > /tmp/diff + if [ "$match" == "" ]; then SUCCESS_MSGS=$SUCCESS_MSGS"converted output matches\n"; return 0; + else FAIL_MSGS=$FAIL_MSGS"converted output does not match\n"; cat /tmp/diff; rm /tmp/diff; return 1; + fi } readonly -f convert::match_output @@ -221,4 +219,4 @@ function convert::check_artifacts_generated() { convert::teardown return $exit_status } -readonly -f convert::check_artifacts_generated \ No newline at end of file +readonly -f convert::check_artifacts_generated diff --git a/script/test/cmd/tests_new.sh b/script/test/cmd/tests_new.sh index 34a10185..2cb5836a 100755 --- a/script/test/cmd/tests_new.sh +++ b/script/test/cmd/tests_new.sh @@ -41,24 +41,24 @@ sed -e "s;%VERSION%;$version;g" -e "s;%URI%;$uri;g" -e "s;%REF%;$branch;g" $KOMP -## TEST V2 +# ## TEST V2 DIR="v2" -k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/$DIR/docker-compose.yaml convert --stdout -j --with-kompose-annotation=false" -os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/$DIR/docker-compose.yaml convert --stdout -j --with-kompose-annotation=false" -k8s_output="$KOMPOSE_ROOT/script/test/fixtures/$DIR/output-k8s.json" -os_output="$KOMPOSE_ROOT/script/test/fixtures/$DIR/output-os.json" +k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/$DIR/docker-compose.yaml convert --stdout --with-kompose-annotation=false" +os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/$DIR/docker-compose.yaml convert --stdout --with-kompose-annotation=false" +k8s_output="$KOMPOSE_ROOT/script/test/fixtures/$DIR/output-k8s.yaml" +os_output="$KOMPOSE_ROOT/script/test/fixtures/$DIR/output-os.yaml" -convert::expect_success "$k8s_cmd" "$k8s_output" -convert::expect_success "$os_cmd" "$os_output" +convert::expect_success_and_warning "$k8s_cmd" "$k8s_output" +convert::expect_success_and_warning "$os_cmd" "$os_output" ## TEST V3 DIR="v3.0" -k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/$DIR/docker-compose.yaml convert --stdout -j --with-kompose-annotation=false" -os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/$DIR/docker-compose.yaml convert --stdout -j --with-kompose-annotation=false" -k8s_output="$KOMPOSE_ROOT/script/test/fixtures/$DIR/output-k8s.json" -os_output="$KOMPOSE_ROOT/script/test/fixtures/$DIR/output-os.json" +k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/$DIR/docker-compose.yaml convert --stdout --with-kompose-annotation=false" +os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/$DIR/docker-compose.yaml convert --stdout --with-kompose-annotation=false" +k8s_output="$KOMPOSE_ROOT/script/test/fixtures/$DIR/output-k8s.yaml" +os_output="$KOMPOSE_ROOT/script/test/fixtures/$DIR/output-os.yaml" convert::expect_success_and_warning "$k8s_cmd" "$k8s_output" convert::expect_success_and_warning "$os_cmd" "$os_output" @@ -96,7 +96,7 @@ convert::check_artifacts_generated "kompose --build local -f $KOMPOSE_ROOT/scrip relative_path=$(realpath --relative-to="$PWD" "$KOMPOSE_ROOT/script/test/fixtures/buildconfig/docker-compose-v3.yml") convert::check_artifacts_generated "kompose --build local -f $relative_path convert -o $TEMP_DIR/output_file" "$TEMP_DIR/output_file" -##### +# ##### # Test the build config with push image # see tests_push_image.sh for local push test # Should warn when push image disabled @@ -104,110 +104,115 @@ cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/buildconfig/docker-compose-bu convert::expect_warning "$cmd" "Push image registry 'whatever' is specified but push image is disabled, skipping pushing to repository" #TEST the kompose.volume.storage-class-name label -convert::check_artifacts_generated "kompose -f $KOMPOSE_ROOT/script/test/fixtures/storage-class-name/docker-compose.yml convert -o $TEMP_DIR/output-k8s.json -j" "$TEMP_DIR/output-k8s.json" -convert::check_artifacts_generated "kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/storage-class-name/docker-compose.yml convert -o $TEMP_DIR/output-os.json -j" "$TEMP_DIR/output-os.json" +convert::check_artifacts_generated "kompose -f $KOMPOSE_ROOT/script/test/fixtures/storage-class-name/docker-compose.yml convert -o $TEMP_DIR/output-k8s.yaml" "$TEMP_DIR/output-k8s.yaml" +convert::check_artifacts_generated "kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/storage-class-name/docker-compose.yml convert -o $TEMP_DIR/output-os.yaml -j" "$TEMP_DIR/output-os.yaml" # TEST the windows volume # windows host path to windows container -k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/volume-mounts/windows/docker-compose.yaml convert --stdout -j --with-kompose-annotation=false" -os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/volume-mounts/windows/docker-compose.yaml convert --stdout -j --with-kompose-annotation=false" -k8s_output="$KOMPOSE_ROOT/script/test/fixtures/volume-mounts/windows/output-k8s.json" -os_output="$KOMPOSE_ROOT/script/test/fixtures/volume-mounts/windows/output-os.json" -convert::expect_success "$k8s_cmd" "$k8s_output" -convert::expect_success "$os_cmd" "$os_output" +k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/volume-mounts/windows/docker-compose.yaml convert --stdout --with-kompose-annotation=false" +os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/volume-mounts/windows/docker-compose.yaml convert --stdout --with-kompose-annotation=false" +k8s_output="$KOMPOSE_ROOT/script/test/fixtures/volume-mounts/windows/output-k8s.yaml" +os_output="$KOMPOSE_ROOT/script/test/fixtures/volume-mounts/windows/output-os.yaml" +convert::expect_success_and_warning "$k8s_cmd" "$k8s_output" +convert::expect_success_and_warning "$os_cmd" "$os_output" -# TEST the placement +# # TEST the placement # should convert placement to affinity -k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/deploy/placement/docker-compose-placement.yaml convert --stdout -j --with-kompose-annotation=false" -os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/deploy/placement/docker-compose-placement.yaml convert --stdout -j --with-kompose-annotation=false" -k8s_output="$KOMPOSE_ROOT/script/test/fixtures/deploy/placement/output-placement-k8s.json" -os_output="$KOMPOSE_ROOT/script/test/fixtures/deploy/placement/output-placement-os.json" +k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/deploy/placement/docker-compose-placement.yaml convert --stdout --with-kompose-annotation=false" +os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/deploy/placement/docker-compose-placement.yaml convert --stdout --with-kompose-annotation=false" +k8s_output="$KOMPOSE_ROOT/script/test/fixtures/deploy/placement/output-placement-k8s.yaml" +os_output="$KOMPOSE_ROOT/script/test/fixtures/deploy/placement/output-placement-os.yaml" convert::expect_success_and_warning "$k8s_cmd" "$k8s_output" convert::expect_success_and_warning "$os_cmd" "$os_output" # test configmap volume -k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/configmap-volume/docker-compose.yml convert --stdout -j --with-kompose-annotation=false --volumes=configMap" -os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/configmap-volume/docker-compose.yml convert --stdout -j --with-kompose-annotation=false --volumes=configMap" -k8s_output="$KOMPOSE_ROOT/script/test/fixtures/configmap-volume/output-k8s.json" -os_output="$KOMPOSE_ROOT/script/test/fixtures/configmap-volume/output-os.json" +k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/configmap-volume/docker-compose.yml convert --stdout --with-kompose-annotation=false --volumes=configMap" +os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/configmap-volume/docker-compose.yml convert --stdout --with-kompose-annotation=false --volumes=configMap" +k8s_output="$KOMPOSE_ROOT/script/test/fixtures/configmap-volume/output-k8s.yaml" +os_output="$KOMPOSE_ROOT/script/test/fixtures/configmap-volume/output-os.yaml" convert::expect_success_and_warning "$k8s_cmd" "$k8s_output" convert::expect_success "$os_cmd" "$os_output" # test configmap volume using service label -k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/configmap-volume/docker-compose-withlabel.yml convert --stdout -j --with-kompose-annotation=false" -os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/configmap-volume/docker-compose-withlabel.yml convert --stdout -j --with-kompose-annotation=false" -k8s_output="$KOMPOSE_ROOT/script/test/fixtures/configmap-volume/output-k8s-withlabel.json" -os_output="$KOMPOSE_ROOT/script/test/fixtures/configmap-volume/output-os-withlabel.json" +k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/configmap-volume/docker-compose-withlabel.yml convert --stdout --with-kompose-annotation=false" +os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/configmap-volume/docker-compose-withlabel.yml convert --stdout --with-kompose-annotation=false" +k8s_output="$KOMPOSE_ROOT/script/test/fixtures/configmap-volume/output-k8s-withlabel.yaml" +os_output="$KOMPOSE_ROOT/script/test/fixtures/configmap-volume/output-os-withlabel.yaml" convert::expect_success_and_warning "$k8s_cmd" "$k8s_output" convert::expect_success "$os_cmd" "$os_output" # Test that emptyDir works -k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/change-in-volume/docker-compose.yml convert --with-kompose-annotation=false --stdout -j --volumes emptyDir" -k8s_output="$KOMPOSE_ROOT/script/test/fixtures/change-in-volume/output-k8s-empty-vols-template.json" -os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/change-in-volume/docker-compose.yml convert --with-kompose-annotation=false --stdout -j --volumes emptyDir" -os_output="$KOMPOSE_ROOT/script/test/fixtures/change-in-volume/output-os-empty-vols-template.json" +k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/change-in-volume/docker-compose.yml convert --with-kompose-annotation=false --stdout --volumes emptyDir" +k8s_output="$KOMPOSE_ROOT/script/test/fixtures/change-in-volume/output-k8s-empty-vols-template.yaml" +os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/change-in-volume/docker-compose.yml convert --with-kompose-annotation=false --stdout --volumes emptyDir" +os_output="$KOMPOSE_ROOT/script/test/fixtures/change-in-volume/output-os-empty-vols-template.yaml" convert::expect_success_and_warning "$k8s_cmd" "$k8s_output" convert::expect_success_and_warning "$os_cmd" "$os_output" # Test that emptyvols works -k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/change-in-volume/docker-compose.yml convert --with-kompose-annotation=false --stdout -j --emptyvols" -k8s_output="$KOMPOSE_ROOT/script/test/fixtures/change-in-volume/output-k8s-empty-vols-template.json" -os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/change-in-volume/docker-compose.yml convert --with-kompose-annotation=false --stdout -j --emptyvols" -os_output="$KOMPOSE_ROOT/script/test/fixtures/change-in-volume/output-os-empty-vols-template.json" +k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/change-in-volume/docker-compose.yml convert --with-kompose-annotation=false --stdout --emptyvols" +k8s_output="$KOMPOSE_ROOT/script/test/fixtures/change-in-volume/output-k8s.yaml" +os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/change-in-volume/docker-compose.yml convert --with-kompose-annotation=false --stdout --emptyvols" +os_output="$KOMPOSE_ROOT/script/test/fixtures/change-in-volume/output-os.yaml" convert::expect_success_and_warning "$k8s_cmd" "$k8s_output" convert::expect_success_and_warning "$os_cmd" "$os_output" # test service expose -k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/expose/compose.yaml convert --stdout -j --with-kompose-annotation=false" -ocp_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/expose/compose.yaml convert --stdout -j --with-kompose-annotation=false" -k8s_output="$KOMPOSE_ROOT/script/test/fixtures/expose/output-k8s.json" -ocp_output="$KOMPOSE_ROOT/script/test/fixtures/expose/output-ocp.json" +k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/expose/compose.yaml convert --stdout --with-kompose-annotation=false" +ocp_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/expose/compose.yaml convert --stdout --with-kompose-annotation=false" +k8s_output="$KOMPOSE_ROOT/script/test/fixtures/expose/output-k8s.yaml" +ocp_output="$KOMPOSE_ROOT/script/test/fixtures/expose/output-os.yaml" convert::expect_success "$k8s_cmd" "$k8s_output" convert::expect_success "$ocp_cmd" "$ocp_output" # test service group by volume, not support openshift for now -k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/service-group/compose.yaml convert --stdout -j --with-kompose-annotation=false --service-group-mode=volume" -k8s_output="$KOMPOSE_ROOT/script/test/fixtures/service-group/output-k8s.json" +k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/service-group/compose.yaml convert --stdout --with-kompose-annotation=false --service-group-mode=volume" +k8s_output="$KOMPOSE_ROOT/script/test/fixtures/service-group/output-k8s.yaml" convert::expect_success_and_warning "$k8s_cmd" "$k8s_output" # test merge multiple compose files -k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/multiple-files/first.yaml -f $KOMPOSE_ROOT/script/test/fixtures/multiple-files/second.yaml convert --stdout -j --with-kompose-annotation=false" -ocp_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/multiple-files/first.yaml -f $KOMPOSE_ROOT/script/test/fixtures/multiple-files/second.yaml convert --stdout -j --with-kompose-annotation=false" -k8s_output="$KOMPOSE_ROOT/script/test/fixtures/multiple-files/output-k8s.json" -ocp_output="$KOMPOSE_ROOT/script/test/fixtures/multiple-files/output-ocp.json" +k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/multiple-files/first.yaml -f $KOMPOSE_ROOT/script/test/fixtures/multiple-files/second.yaml convert --stdout --with-kompose-annotation=false" +ocp_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/multiple-files/first.yaml -f $KOMPOSE_ROOT/script/test/fixtures/multiple-files/second.yaml convert --stdout --with-kompose-annotation=false" +k8s_output="$KOMPOSE_ROOT/script/test/fixtures/multiple-files/output-k8s.yaml" +ocp_output="$KOMPOSE_ROOT/script/test/fixtures/multiple-files/output-os.yaml" convert::expect_success_and_warning "$k8s_cmd" "$k8s_output" convert::expect_success "$ocp_cmd" "$ocp_output" # test health check -k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/healthcheck/docker-compose-healthcheck.yaml convert --stdout -j --service-group-mode=label --with-kompose-annotation=false" -os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/healthcheck/docker-compose-healthcheck.yaml convert --stdout -j --service-group-mode=label --with-kompose-annotation=false" -k8s_output="$KOMPOSE_ROOT/script/test/fixtures/healthcheck/output-healthcheck-k8s.json" -os_output="$KOMPOSE_ROOT/script/test/fixtures/healthcheck/output-healthcheck-os.json" -convert::expect_success "$k8s_cmd" "$k8s_output" +k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/healthcheck/docker-compose-healthcheck.yaml convert --stdout --service-group-mode=label --with-kompose-annotation=false" +os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/healthcheck/docker-compose-healthcheck.yaml convert --stdout --service-group-mode=label --with-kompose-annotation=false" +k8s_output="$KOMPOSE_ROOT/script/test/fixtures/healthcheck/output-healthcheck-k8s.yaml" +os_output="$KOMPOSE_ROOT/script/test/fixtures/healthcheck/output-healthcheck-os.yaml" +convert::expect_success_and_warning "$k8s_cmd" "$k8s_output" convert::expect_success "$os_cmd" "$os_output" # test statefulset -k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/statefulset/docker-compose.yaml convert --stdout -j --with-kompose-annotation=false --controller statefulset" -ocp_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/statefulset/docker-compose.yaml convert --stdout -j --with-kompose-annotation=false --controller statefulset" -k8s_output="$KOMPOSE_ROOT/script/test/fixtures/statefulset/output-k8s.json" -ocp_output="$KOMPOSE_ROOT/script/test/fixtures/statefulset/output-os.json" +k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/statefulset/docker-compose.yaml convert --stdout --with-kompose-annotation=false --controller statefulset" +ocp_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/statefulset/docker-compose.yaml convert --stdout --with-kompose-annotation=false --controller statefulset" +k8s_output="$KOMPOSE_ROOT/script/test/fixtures/statefulset/output-k8s.yaml" +ocp_output="$KOMPOSE_ROOT/script/test/fixtures/statefulset/output-os.yaml" convert::expect_success "$k8s_cmd" "$k8s_output" convert::expect_success "$ocp_cmd" "$ocp_output" # test specifying volume type using service label -k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/multiple-type-volumes/docker-compose.yaml convert --stdout -j --with-kompose-annotation=false" -os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/multiple-type-volumes/docker-compose.yaml convert --stdout -j --with-kompose-annotation=false" -k8s_output="$KOMPOSE_ROOT/script/test/fixtures/multiple-type-volumes/output-k8s.json" -os_output="$KOMPOSE_ROOT/script/test/fixtures/multiple-type-volumes/output-os.json" +k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/multiple-type-volumes/docker-compose.yaml convert --stdout --with-kompose-annotation=false" +os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/multiple-type-volumes/docker-compose.yaml convert --stdout --with-kompose-annotation=false" +k8s_output="$KOMPOSE_ROOT/script/test/fixtures/multiple-type-volumes/output-k8s.yaml" +os_output="$KOMPOSE_ROOT/script/test/fixtures/multiple-type-volumes/output-os.yaml" convert::expect_success_and_warning "$k8s_cmd" "$k8s_output" convert::expect_success "$os_cmd" "$os_output" # Test environment variables interpolation -k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/envvars-interpolation/docker-compose.yaml convert --stdout -j --with-kompose-annotation=false" -os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/envvars-interpolation/docker-compose.yaml convert --stdout -j --with-kompose-annotation=false" -k8s_output="$KOMPOSE_ROOT/script/test/fixtures/envvars-interpolation/output-k8s.json" -os_output="$KOMPOSE_ROOT/script/test/fixtures/envvars-interpolation/output-os.json" +k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/envvars-interpolation/docker-compose.yaml convert --stdout --with-kompose-annotation=false" +os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/envvars-interpolation/docker-compose.yaml convert --stdout --with-kompose-annotation=false" +k8s_output="$KOMPOSE_ROOT/script/test/fixtures/envvars-interpolation/output-k8s.yaml" +os_output="$KOMPOSE_ROOT/script/test/fixtures/envvars-interpolation/output-os.yaml" convert::expect_success_and_warning "$k8s_cmd" "$k8s_output" convert::expect_success "$os_cmd" "$os_output" + +# Test single file output feature +k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/single-file-output/docker-compose.yaml convert --stdout --with-kompose-annotation=false" +k8s_output="$KOMPOSE_ROOT/script/test/fixtures/single-file-output/output-k8s.yaml" +convert::expect_success_and_warning "$k8s_cmd" "$k8s_output" diff --git a/script/test/fixtures/change-in-volume/output-k8s-empty-vols-template.json b/script/test/fixtures/change-in-volume/output-k8s-empty-vols-template.json deleted file mode 100644 index a8eb9474..00000000 --- a/script/test/fixtures/change-in-volume/output-k8s-empty-vols-template.json +++ /dev/null @@ -1,170 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - }, - "annotations": { - "kompose.service.type": "headless" - } - }, - "spec": { - "ports": [ - { - "name": "headless", - "port": 55555, - "targetPort": 0 - } - ], - "selector": { - "io.kompose.service": "redis" - }, - "clusterIP": "None" - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "web", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "spec": { - "ports": [ - { - "name": "5000", - "port": 5000, - "targetPort": 5000 - } - ], - "selector": { - "io.kompose.service": "web" - } - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "Deployment", - "apiVersion": "apps/v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - }, - "annotations": { - "kompose.service.type": "headless" - } - }, - "spec": { - "replicas": 1, - "selector": { - "matchLabels": { - "io.kompose.service": "redis" - } - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - }, - "annotations": { - "kompose.service.type": "headless" - } - }, - "spec": { - "containers": [ - { - "name": "redis", - "image": "redis", - "resources": {} - } - ], - "restartPolicy": "Always" - } - }, - "strategy": {} - }, - "status": {} - }, - { - "kind": "Deployment", - "apiVersion": "apps/v1", - "metadata": { - "name": "web", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "spec": { - "replicas": 1, - "selector": { - "matchLabels": { - "io.kompose.service": "web" - } - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "spec": { - "volumes": [ - { - "name": "code-volume", - "emptyDir": {} - } - ], - "containers": [ - { - "name": "web", - "image": "flask_web", - "args": [ - "python", - "app.py" - ], - "ports": [ - { - "containerPort": 5000 - } - ], - "resources": {}, - "volumeMounts": [ - { - "name": "code-volume", - "mountPath": "/code" - } - ] - } - ], - "restartPolicy": "Always" - } - }, - "strategy": { - "type": "Recreate" - } - }, - "status": {} - } - ] -} diff --git a/script/test/fixtures/change-in-volume/output-k8s-empty-vols-template.yaml b/script/test/fixtures/change-in-volume/output-k8s-empty-vols-template.yaml new file mode 100644 index 00000000..acc86e97 --- /dev/null +++ b/script/test/fixtures/change-in-volume/output-k8s-empty-vols-template.yaml @@ -0,0 +1,108 @@ +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.service.type: headless + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + clusterIP: None + ports: + - name: headless + port: 55555 + targetPort: 0 + selector: + io.kompose.service: redis +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: Service +metadata: + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + ports: + - name: "5000" + port: 5000 + targetPort: 5000 + selector: + io.kompose.service: web +status: + loadBalancer: {} + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.service.type: headless + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: redis + strategy: {} + template: + metadata: + annotations: + kompose.service.type: headless + creationTimestamp: null + labels: + io.kompose.service: redis + spec: + containers: + - image: redis + name: redis + resources: {} + restartPolicy: Always +status: {} + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: web + strategy: + type: Recreate + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: web + spec: + containers: + - args: + - python + - app.py + image: flask_web + name: web + ports: + - containerPort: 5000 + resources: {} + volumeMounts: + - mountPath: /code + name: code-volume + restartPolicy: Always + volumes: + - emptyDir: {} + name: code-volume +status: {} diff --git a/script/test/fixtures/change-in-volume/output-k8s-template.json b/script/test/fixtures/change-in-volume/output-k8s-template.json deleted file mode 100644 index 1447ce7c..00000000 --- a/script/test/fixtures/change-in-volume/output-k8s-template.json +++ /dev/null @@ -1,217 +0,0 @@ -{ - "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.service.type": "headless", - "kompose.version": "%VERSION%" - } - }, - "spec": { - "ports": [ - { - "name": "headless", - "port": 55555, - "targetPort": 0 - } - ], - "selector": { - "io.kompose.service": "redis" - }, - "clusterIP": "None" - }, - "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": {} - } - }, - { - "apiVersion": "apps/v1", - "kind": "Deployment", - "metadata": { - "annotations": { - "kompose.cmd": "%CMD%", - "kompose.service.type": "headless", - "kompose.version": "%VERSION%" - }, - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - }, - "name": "redis" - }, - "spec": { - "replicas": 1, - "selector": { - "matchLabels": { - "io.kompose.service": "redis" - } - }, - "strategy": {}, - "template": { - "metadata": { - "annotations": { - "kompose.cmd": "%CMD%", - "kompose.service.type": "headless", - "kompose.version": "%VERSION%" - }, - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - } - }, - "spec": { - "containers": [ - { - "image": "redis", - "imagePullPolicy": "", - "name": "redis", - "resources": {} - } - ], - "restartPolicy": "Always", - "serviceAccountName": "", - "volumes": null - } - } - }, - "status": {} - }, - { - "apiVersion": "apps/v1", - "kind": "Deployment", - "metadata": { - "annotations": { - "kompose.cmd": "%CMD%", - "kompose.version": "%VERSION%" - }, - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - }, - "name": "web" - }, - "spec": { - "replicas": 1, - "selector": { - "matchLabels": { - "io.kompose.service": "web" - } - }, - "strategy": { - "type": "Recreate" - }, - "template": { - "metadata": { - "annotations": { - "kompose.cmd": "%CMD%", - "kompose.version": "%VERSION%" - }, - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "spec": { - "containers": [ - { - "args": [ - "python", - "app.py" - ], - "image": "flask_web", - "imagePullPolicy": "", - "name": "web", - "ports": [ - { - "containerPort": 5000 - } - ], - "resources": {}, - "volumeMounts": [ - { - "mountPath": "/code", - "name": "web-claim0" - } - ] - } - ], - "restartPolicy": "Always", - "serviceAccountName": "", - "volumes": [ - { - "name": "web-claim0", - "persistentVolumeClaim": { - "claimName": "web-claim0" - } - } - ] - } - } - }, - "status": {} - }, - { - "kind": "PersistentVolumeClaim", - "apiVersion": "v1", - "metadata": { - "name": "web-claim0", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web-claim0" - } - }, - "spec": { - "accessModes": [ - "ReadWriteOnce" - ], - "resources": { - "requests": { - "storage": "100Mi" - } - } - }, - "status": {} - } - ] -} diff --git a/script/test/fixtures/change-in-volume/output-k8s.yaml b/script/test/fixtures/change-in-volume/output-k8s.yaml new file mode 100644 index 00000000..f885f0e8 --- /dev/null +++ b/script/test/fixtures/change-in-volume/output-k8s.yaml @@ -0,0 +1,109 @@ +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.service.type: headless + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + clusterIP: None + ports: + - name: headless + port: 55555 + targetPort: 0 + selector: + io.kompose.service: redis +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: Service +metadata: + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + ports: + - name: "5000" + port: 5000 + targetPort: 5000 + selector: + io.kompose.service: web +status: + loadBalancer: {} + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.service.type: headless + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: redis + strategy: {} + template: + metadata: + annotations: + kompose.service.type: headless + creationTimestamp: null + labels: + io.kompose.service: redis + spec: + containers: + - image: redis + name: redis + resources: {} + restartPolicy: Always +status: {} + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: web + strategy: + type: Recreate + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: web + spec: + containers: + - args: + - python + - app.py + image: flask_web + name: web + ports: + - containerPort: 5000 + resources: {} + volumeMounts: + - mountPath: /code + name: code-volume + restartPolicy: Always + volumes: + - emptyDir: {} + name: code-volume +status: {} + diff --git a/script/test/fixtures/change-in-volume/output-os-empty-vols-template.json b/script/test/fixtures/change-in-volume/output-os-empty-vols-template.json deleted file mode 100644 index 4f56f904..00000000 --- a/script/test/fixtures/change-in-volume/output-os-empty-vols-template.json +++ /dev/null @@ -1,286 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - }, - "annotations": { - "kompose.service.type": "headless" - } - }, - "spec": { - "ports": [ - { - "name": "headless", - "port": 55555, - "targetPort": 0 - } - ], - "selector": { - "io.kompose.service": "redis" - }, - "clusterIP": "None" - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "web", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "spec": { - "ports": [ - { - "name": "5000", - "port": 5000, - "targetPort": 5000 - } - ], - "selector": { - "io.kompose.service": "web" - } - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - }, - "annotations": { - "kompose.service.type": "headless" - } - }, - "spec": { - "strategy": { - "resources": {} - }, - "triggers": [ - { - "type": "ConfigChange" - }, - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "redis" - ], - "from": { - "kind": "ImageStreamTag", - "name": "redis:latest" - } - } - } - ], - "replicas": 1, - "test": false, - "selector": { - "io.kompose.service": "redis" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - } - }, - "spec": { - "containers": [ - { - "name": "redis", - "image": " ", - "resources": {} - } - ], - "restartPolicy": "Always" - } - } - }, - "status": { - "latestVersion": 0, - "observedGeneration": 0, - "replicas": 0, - "updatedReplicas": 0, - "availableReplicas": 0, - "unavailableReplicas": 0 - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - } - }, - "spec": { - "lookupPolicy": { - "local": false - }, - "tags": [ - { - "name": "latest", - "annotations": null, - "from": { - "kind": "DockerImage", - "name": "redis" - }, - "generation": null, - "importPolicy": {}, - "referencePolicy": { - "type": "" - } - } - ] - }, - "status": { - "dockerImageRepository": "" - } - }, - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "web", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "spec": { - "strategy": { - "type": "Recreate", - "resources": {} - }, - "triggers": [ - { - "type": "ConfigChange" - }, - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "web" - ], - "from": { - "kind": "ImageStreamTag", - "name": "web:latest" - } - } - } - ], - "replicas": 1, - "test": false, - "selector": { - "io.kompose.service": "web" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "spec": { - "volumes": [ - { - "name": "code-volume", - "emptyDir": {} - } - ], - "containers": [ - { - "name": "web", - "image": " ", - "args": [ - "python", - "app.py" - ], - "ports": [ - { - "containerPort": 5000 - } - ], - "resources": {}, - "volumeMounts": [ - { - "name": "code-volume", - "mountPath": "/code" - } - ] - } - ], - "restartPolicy": "Always" - } - } - }, - "status": { - "latestVersion": 0, - "observedGeneration": 0, - "replicas": 0, - "updatedReplicas": 0, - "availableReplicas": 0, - "unavailableReplicas": 0 - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "web", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "spec": { - "lookupPolicy": { - "local": false - }, - "tags": [ - { - "name": "latest", - "annotations": null, - "from": { - "kind": "DockerImage", - "name": "flask_web" - }, - "generation": null, - "importPolicy": {}, - "referencePolicy": { - "type": "" - } - } - ] - }, - "status": { - "dockerImageRepository": "" - } - } - ] -} diff --git a/script/test/fixtures/change-in-volume/output-os-empty-vols-template.yaml b/script/test/fixtures/change-in-volume/output-os-empty-vols-template.yaml new file mode 100644 index 00000000..12abf953 --- /dev/null +++ b/script/test/fixtures/change-in-volume/output-os-empty-vols-template.yaml @@ -0,0 +1,189 @@ +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.service.type: headless + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + clusterIP: None + ports: + - name: headless + port: 55555 + targetPort: 0 + selector: + io.kompose.service: redis +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: Service +metadata: + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + ports: + - name: "5000" + port: 5000 + targetPort: 5000 + selector: + io.kompose.service: web +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + annotations: + kompose.service.type: headless + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + replicas: 1 + selector: + io.kompose.service: redis + strategy: + resources: {} + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: redis + spec: + containers: + - image: ' ' + name: redis + resources: {} + restartPolicy: Always + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - redis + from: + kind: ImageStreamTag + name: redis:latest + type: ImageChange +status: + availableReplicas: 0 + latestVersion: 0 + observedGeneration: 0 + replicas: 0 + unavailableReplicas: 0 + updatedReplicas: 0 + +--- +apiVersion: v1 +kind: ImageStream +metadata: + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + lookupPolicy: + local: false + tags: + - annotations: null + from: + kind: DockerImage + name: redis + generation: null + importPolicy: {} + name: latest + referencePolicy: + type: "" +status: + dockerImageRepository: "" + +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + replicas: 1 + selector: + io.kompose.service: web + strategy: + resources: {} + type: Recreate + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: web + spec: + containers: + - args: + - python + - app.py + image: ' ' + name: web + ports: + - containerPort: 5000 + resources: {} + volumeMounts: + - mountPath: /code + name: code-volume + restartPolicy: Always + volumes: + - emptyDir: {} + name: code-volume + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - web + from: + kind: ImageStreamTag + name: web:latest + type: ImageChange +status: + availableReplicas: 0 + latestVersion: 0 + observedGeneration: 0 + replicas: 0 + unavailableReplicas: 0 + updatedReplicas: 0 + +--- +apiVersion: v1 +kind: ImageStream +metadata: + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + lookupPolicy: + local: false + tags: + - annotations: null + from: + kind: DockerImage + name: flask_web + generation: null + importPolicy: {} + name: latest + referencePolicy: + type: "" +status: + dockerImageRepository: "" + diff --git a/script/test/fixtures/change-in-volume/output-os-template.json b/script/test/fixtures/change-in-volume/output-os-template.json deleted file mode 100644 index 05d5c299..00000000 --- a/script/test/fixtures/change-in-volume/output-os-template.json +++ /dev/null @@ -1,296 +0,0 @@ -{ - "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.service.type": "headless", - "kompose.version": "%VERSION%" - } - }, - "spec": { - "ports": [ - { - "name": "headless", - "port": 55555, - "targetPort": 0 - } - ], - "selector": { - "io.kompose.service": "redis" - }, - "clusterIP": "None" - }, - "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": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - }, - "annotations": { - "kompose.cmd": "%CMD%", - "kompose.service.type": "headless", - "kompose.version": "%VERSION%" - } - }, - "spec": { - "strategy": { - "resources": {} - }, - "triggers": [ - { - "type": "ConfigChange" - }, - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "redis" - ], - "from": { - "kind": "ImageStreamTag", - "name": "redis:latest" - } - } - } - ], - "replicas": 1, - "test": false, - "selector": { - "io.kompose.service": "redis" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - } - }, - "spec": { - "containers": [ - { - "name": "redis", - "image": " ", - "resources": {} - } - ], - "restartPolicy": "Always" - } - } - }, - "status": {} - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - } - }, - "spec": { - "tags": [ - { - "name": "latest", - "annotations": null, - "from": { - "kind": "DockerImage", - "name": "redis" - }, - "generation": null, - "importPolicy": {} - } - ] - }, - "status": { - "dockerImageRepository": "" - } - }, - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "web", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - }, - "annotations": { - "kompose.cmd": "%CMD%", - "kompose.version": "%VERSION%" - } - }, - "spec": { - "strategy": { - "type": "Recreate", - "resources": {} - }, - "triggers": [ - { - "type": "ConfigChange" - }, - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "web" - ], - "from": { - "kind": "ImageStreamTag", - "name": "web:latest" - } - } - } - ], - "replicas": 1, - "test": false, - "selector": { - "io.kompose.service": "web" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "spec": { - "volumes": [ - { - "name": "web-claim0", - "persistentVolumeClaim": { - "claimName": "web-claim0" - } - } - ], - "containers": [ - { - "name": "web", - "image": " ", - "args": [ - "python", - "app.py" - ], - "ports": [ - { - "containerPort": 5000 - } - ], - "resources": {}, - "volumeMounts": [ - { - "name": "web-claim0", - "mountPath": "/code" - } - ] - } - ], - "restartPolicy": "Always" - } - } - }, - "status": {} - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "web", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "spec": { - "tags": [ - { - "name": "latest", - "annotations": null, - "from": { - "kind": "DockerImage", - "name": "flask_web" - }, - "generation": null, - "importPolicy": {} - } - ] - }, - "status": { - "dockerImageRepository": "" - } - }, - { - "kind": "PersistentVolumeClaim", - "apiVersion": "v1", - "metadata": { - "name": "web-claim0", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web-claim0" - } - }, - "spec": { - "accessModes": [ - "ReadWriteOnce" - ], - "resources": { - "requests": { - "storage": "100Mi" - } - } - }, - "status": {} - } - ] -} diff --git a/script/test/fixtures/change-in-volume/output-os.yaml b/script/test/fixtures/change-in-volume/output-os.yaml new file mode 100644 index 00000000..12abf953 --- /dev/null +++ b/script/test/fixtures/change-in-volume/output-os.yaml @@ -0,0 +1,189 @@ +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.service.type: headless + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + clusterIP: None + ports: + - name: headless + port: 55555 + targetPort: 0 + selector: + io.kompose.service: redis +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: Service +metadata: + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + ports: + - name: "5000" + port: 5000 + targetPort: 5000 + selector: + io.kompose.service: web +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + annotations: + kompose.service.type: headless + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + replicas: 1 + selector: + io.kompose.service: redis + strategy: + resources: {} + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: redis + spec: + containers: + - image: ' ' + name: redis + resources: {} + restartPolicy: Always + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - redis + from: + kind: ImageStreamTag + name: redis:latest + type: ImageChange +status: + availableReplicas: 0 + latestVersion: 0 + observedGeneration: 0 + replicas: 0 + unavailableReplicas: 0 + updatedReplicas: 0 + +--- +apiVersion: v1 +kind: ImageStream +metadata: + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + lookupPolicy: + local: false + tags: + - annotations: null + from: + kind: DockerImage + name: redis + generation: null + importPolicy: {} + name: latest + referencePolicy: + type: "" +status: + dockerImageRepository: "" + +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + replicas: 1 + selector: + io.kompose.service: web + strategy: + resources: {} + type: Recreate + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: web + spec: + containers: + - args: + - python + - app.py + image: ' ' + name: web + ports: + - containerPort: 5000 + resources: {} + volumeMounts: + - mountPath: /code + name: code-volume + restartPolicy: Always + volumes: + - emptyDir: {} + name: code-volume + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - web + from: + kind: ImageStreamTag + name: web:latest + type: ImageChange +status: + availableReplicas: 0 + latestVersion: 0 + observedGeneration: 0 + replicas: 0 + unavailableReplicas: 0 + updatedReplicas: 0 + +--- +apiVersion: v1 +kind: ImageStream +metadata: + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + lookupPolicy: + local: false + tags: + - annotations: null + from: + kind: DockerImage + name: flask_web + generation: null + importPolicy: {} + name: latest + referencePolicy: + type: "" +status: + dockerImageRepository: "" + diff --git a/script/test/fixtures/configmap-volume/output-k8s-withlabel.json b/script/test/fixtures/configmap-volume/output-k8s-withlabel.json deleted file mode 100644 index dd994eaf..00000000 --- a/script/test/fixtures/configmap-volume/output-k8s-withlabel.json +++ /dev/null @@ -1,202 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "Deployment", - "apiVersion": "apps/v1", - "metadata": { - "name": "db", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - }, - "annotations": { - "kompose.volume.type": "configMap" - } - }, - "spec": { - "replicas": 1, - "selector": { - "matchLabels": { - "io.kompose.service": "db" - } - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - }, - "annotations": { - "kompose.volume.type": "configMap" - } - }, - "spec": { - "volumes": [ - { - "name": "db-cm0", - "configMap": { - "name": "db-cm0", - "items": [ - { - "key": "configs.tar", - "path": "configs.tar" - } - ] - } - } - ], - "containers": [ - { - "name": "db", - "image": "mysql", - "resources": {}, - "volumeMounts": [ - { - "name": "db-cm0", - "mountPath": "/data/configs.tar", - "subPath": "configs.tar" - } - ] - } - ], - "restartPolicy": "Always" - } - }, - "strategy": { - "type": "Recreate" - } - }, - "status": {} - }, - { - "kind": "ConfigMap", - "apiVersion": "v1", - "metadata": { - "name": "db-cm0", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - }, - "annotations": { - "use-subpath": "true" - } - }, - "binaryData": { - "configs.tar": "SDRzSUFId3pMVjhBQSsxV3pXc1RRUlFmQ3lMdVJRL2lRVkNHVmFsSVBtWm12N0tXRkFvRksxSU1UU29GVjhLWVRHc2tYK3h1WkV1SjlPaS80TkdiWjIrQ2wrSk4vQ3M4OTZ4WFo3K3lTWGFEc1NZcEpmdExabWJmNC9mbXZielpOeThsNm13eFdtZG12dFpwN3pjT0xEQjdJSVEwUllGQTh4Q3RLQUJHQkdKSnd4S1JzS0xKRUJGRVpCVkFadzZ4eE5DemJHcnlVTXl1MVdVbU0ra0Uzdk1uTzVYZDhvYXgyV25SUmh2dVdzd2N5WlgvVStCZ3ZTREFCWGpRcUJleHJoTkZ3YXFHQks3cGVScFoxeVFkUzdJZ0lkaXlHeTFXeElxdWFycFdJQ2lueWhqcC9Lc0w1LzBMVXZ3UGdxclB6OU5IV1AvSC9ObFdQNzF6MTdmZlRuK2hDT1AxajVBQ29ETFBvRUlzZWYySDUxOGE5SUZjdFU1dG1udGpkZG96OHNIem9jcnk1UHNmY1dIMC9JbWt5T245dndoTWMvOFRMZkgreHdVbHZmd3ZPc0w2bjMzVlJ3anIveGdrMy84eWtjZnJIeEgrL3cvTlBKSUVMSG45ZzhzM3I0QVZBTFpwRFQ0cnd6MFl3TldCcTN3UVBuN3l3ZVZMTjZiYmNxTlMyZkdmUEl1dmZPeU5VVllDL1hVQWJ0VTZyUnp0ZHBzczE2U1czYk5ZbmIrSzdHNnBISEIvOExFRndMV0kxNksxSmxlZWttelZKYnkzbjk3M3FYY2Uvbjc5NE9Qai91ZnZINm9uWDA1dW56VXB5NE40LzUvOVBYQ0cvcy9GdFA4dkFtbi9YMjZFOVQrLzd2L1gvbzlsTkY3L1dNVlMydjhYZ1JjQ2hFZUMyL0ZGeHhFZlFZd3lvZVRKN2lwT3BmSWVNKzY4Rmd3SERxWTFMR2RITmQ0MG9nL1VlY2NRTTlEd3RqVDQzdjZUVTNWOFJYL1l0ZWZidDh1dXIzUHF2WndoK2diUXA3c2ZPT1ExTXhYWkR3NW1qRVEyRHpHaVJ6dTdVVTNlUFRtZUFOeldjR0syc1p3RjgzaWdtU1RIM0hpVEhnNmJRY2ZMYldETEpXaTBvLzJQM0xrZitmTHlEWXR3ZGVoMEJoNVh4ODdmZjROODJYMkpQTEgvajV3WUswNmpOYnZSYWROWFRiYk5xTlV6V2VXd3l4S3NTRklBNGxBdUJ0a1hPYVV2dkR6dk1reVJJa1dLaGVNUENNUUc3Z0FjQUFBPQ==" - } - }, - { - "kind": "Deployment", - "apiVersion": "apps/v1", - "metadata": { - "name": "web", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - }, - "annotations": { - "kompose.volume.type": "configMap" - } - }, - "spec": { - "replicas": 1, - "selector": { - "matchLabels": { - "io.kompose.service": "web" - } - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - }, - "annotations": { - "kompose.volume.type": "configMap" - } - }, - "spec": { - "volumes": [ - { - "name": "web-cm0", - "configMap": { - "name": "web-cm0" - } - }, - { - "name": "web-cm1", - "configMap": { - "name": "web-cm1", - "items": [ - { - "key": "a.key", - "path": "test-a-key.key" - } - ] - } - } - ], - "containers": [ - { - "name": "web", - "image": "nginx", - "resources": {}, - "volumeMounts": [ - { - "name": "web-cm0", - "mountPath": "/etc/tls" - }, - { - "name": "web-cm1", - "mountPath": "/etc/test-a-key.key", - "subPath": "test-a-key.key" - } - ] - } - ], - "restartPolicy": "Always" - } - }, - "strategy": { - "type": "Recreate" - } - }, - "status": {} - }, - { - "kind": "ConfigMap", - "apiVersion": "v1", - "metadata": { - "name": "web-cm0", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "data": { - "a.crt": "test-crt-data...", - "a.key": "test-key-data...." - } - }, - { - "kind": "ConfigMap", - "apiVersion": "v1", - "metadata": { - "name": "web-cm1", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - }, - "annotations": { - "use-subpath": "true" - } - }, - "data": { - "a.key": "test-key-data...." - } - } - ] -} diff --git a/script/test/fixtures/configmap-volume/output-k8s-withlabel.yaml b/script/test/fixtures/configmap-volume/output-k8s-withlabel.yaml new file mode 100644 index 00000000..40020eba --- /dev/null +++ b/script/test/fixtures/configmap-volume/output-k8s-withlabel.yaml @@ -0,0 +1,129 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.volume.type: configMap + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: db + strategy: + type: Recreate + template: + metadata: + annotations: + kompose.volume.type: configMap + creationTimestamp: null + labels: + io.kompose.service: db + spec: + containers: + - image: mysql + name: db + resources: {} + volumeMounts: + - mountPath: /data/configs.tar + name: db-cm0 + subPath: configs.tar + restartPolicy: Always + volumes: + - configMap: + items: + - key: configs.tar + path: configs.tar + name: db-cm0 + name: db-cm0 +status: {} + +--- +apiVersion: v1 +binaryData: + configs.tar: SDRzSUFId3pMVjhBQSsxV3pXc1RRUlFmQ3lMdVJRL2lRVkNHVmFsSVBtWm12N0tXRkFvRksxSU1UU29GVjhLWVRHc2tYK3h1WkV1SjlPaS80TkdiWjIrQ2wrSk4vQ3M4OTZ4WFo3K3lTWGFEc1NZcEpmdExabWJmNC9mbXZielpOeThsNm13eFdtZG12dFpwN3pjT0xEQjdJSVEwUllGQTh4Q3RLQUJHQkdKSnd4S1JzS0xKRUJGRVpCVkFadzZ4eE5DemJHcnlVTXl1MVdVbU0ra0Uzdk1uTzVYZDhvYXgyV25SUmh2dVdzd2N5WlgvVStCZ3ZTREFCWGpRcUJleHJoTkZ3YXFHQks3cGVScFoxeVFkUzdJZ0lkaXlHeTFXeElxdWFycFdJQ2lueWhqcC9Lc0w1LzBMVXZ3UGdxclB6OU5IV1AvSC9ObFdQNzF6MTdmZlRuK2hDT1AxajVBQ29ETFBvRUlzZWYySDUxOGE5SUZjdFU1dG1udGpkZG96OHNIem9jcnk1UHNmY1dIMC9JbWt5T245dndoTWMvOFRMZkgreHdVbHZmd3ZPc0w2bjMzVlJ3anIveGdrMy84eWtjZnJIeEgrL3cvTlBKSUVMSG45ZzhzM3I0QVZBTFpwRFQ0cnd6MFl3TldCcTN3UVBuN3l3ZVZMTjZiYmNxTlMyZkdmUEl1dmZPeU5VVllDL1hVQWJ0VTZyUnp0ZHBzczE2U1czYk5ZbmIrSzdHNnBISEIvOExFRndMV0kxNksxSmxlZWttelZKYnkzbjk3M3FYY2Uvbjc5NE9Qai91ZnZINm9uWDA1dW56VXB5NE40LzUvOVBYQ0cvcy9GdFA4dkFtbi9YMjZFOVQrLzd2L1gvbzlsTkY3L1dNVlMydjhYZ1JjQ2hFZUMyL0ZGeHhFZlFZd3lvZVRKN2lwT3BmSWVNKzY4Rmd3SERxWTFMR2RITmQ0MG9nL1VlY2NRTTlEd3RqVDQzdjZUVTNWOFJYL1l0ZWZidDh1dXIzUHF2WndoK2diUXA3c2ZPT1ExTXhYWkR3NW1qRVEyRHpHaVJ6dTdVVTNlUFRtZUFOeldjR0syc1p3RjgzaWdtU1RIM0hpVEhnNmJRY2ZMYldETEpXaTBvLzJQM0xrZitmTHlEWXR3ZGVoMEJoNVh4ODdmZjROODJYMkpQTEgvajV3WUswNmpOYnZSYWROWFRiYk5xTlV6V2VXd3l4S3NTRklBNGxBdUJ0a1hPYVV2dkR6dk1reVJJa1dLaGVNUENNUUc3Z0FjQUFBPQ== +kind: ConfigMap +metadata: + annotations: + use-subpath: "true" + creationTimestamp: null + labels: + io.kompose.service: db + name: db-cm0 + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.volume.type: configMap + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: web + strategy: + type: Recreate + template: + metadata: + annotations: + kompose.volume.type: configMap + creationTimestamp: null + labels: + io.kompose.service: web + spec: + containers: + - image: nginx + name: web + resources: {} + volumeMounts: + - mountPath: /etc/tls + name: web-cm0 + - mountPath: /etc/test-a-key.key + name: web-cm1 + subPath: test-a-key.key + restartPolicy: Always + volumes: + - configMap: + name: web-cm0 + name: web-cm0 + - configMap: + items: + - key: a.key + path: test-a-key.key + name: web-cm1 + name: web-cm1 +status: {} + +--- +apiVersion: v1 +data: + a.crt: test-crt-data... + a.key: test-key-data.... +kind: ConfigMap +metadata: + creationTimestamp: null + labels: + io.kompose.service: web + name: web-cm0 + +--- +apiVersion: v1 +data: + a.key: test-key-data.... +kind: ConfigMap +metadata: + annotations: + use-subpath: "true" + creationTimestamp: null + labels: + io.kompose.service: web + name: web-cm1 + diff --git a/script/test/fixtures/configmap-volume/output-k8s.json b/script/test/fixtures/configmap-volume/output-k8s.json deleted file mode 100644 index 20802676..00000000 --- a/script/test/fixtures/configmap-volume/output-k8s.json +++ /dev/null @@ -1,190 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "Deployment", - "apiVersion": "apps/v1", - "metadata": { - "name": "db", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - } - }, - "spec": { - "replicas": 1, - "selector": { - "matchLabels": { - "io.kompose.service": "db" - } - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - } - }, - "spec": { - "volumes": [ - { - "name": "db-cm0", - "configMap": { - "name": "db-cm0", - "items": [ - { - "key": "configs.tar", - "path": "configs.tar" - } - ] - } - } - ], - "containers": [ - { - "name": "db", - "image": "mysql", - "resources": {}, - "volumeMounts": [ - { - "name": "db-cm0", - "mountPath": "/data/configs.tar", - "subPath": "configs.tar" - } - ] - } - ], - "restartPolicy": "Always" - } - }, - "strategy": { - "type": "Recreate" - } - }, - "status": {} - }, - { - "kind": "ConfigMap", - "apiVersion": "v1", - "metadata": { - "name": "db-cm0", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - }, - "annotations": { - "use-subpath": "true" - } - }, - "binaryData": { - "configs.tar": "SDRzSUFId3pMVjhBQSsxV3pXc1RRUlFmQ3lMdVJRL2lRVkNHVmFsSVBtWm12N0tXRkFvRksxSU1UU29GVjhLWVRHc2tYK3h1WkV1SjlPaS80TkdiWjIrQ2wrSk4vQ3M4OTZ4WFo3K3lTWGFEc1NZcEpmdExabWJmNC9mbXZielpOeThsNm13eFdtZG12dFpwN3pjT0xEQjdJSVEwUllGQTh4Q3RLQUJHQkdKSnd4S1JzS0xKRUJGRVpCVkFadzZ4eE5DemJHcnlVTXl1MVdVbU0ra0Uzdk1uTzVYZDhvYXgyV25SUmh2dVdzd2N5WlgvVStCZ3ZTREFCWGpRcUJleHJoTkZ3YXFHQks3cGVScFoxeVFkUzdJZ0lkaXlHeTFXeElxdWFycFdJQ2lueWhqcC9Lc0w1LzBMVXZ3UGdxclB6OU5IV1AvSC9ObFdQNzF6MTdmZlRuK2hDT1AxajVBQ29ETFBvRUlzZWYySDUxOGE5SUZjdFU1dG1udGpkZG96OHNIem9jcnk1UHNmY1dIMC9JbWt5T245dndoTWMvOFRMZkgreHdVbHZmd3ZPc0w2bjMzVlJ3anIveGdrMy84eWtjZnJIeEgrL3cvTlBKSUVMSG45ZzhzM3I0QVZBTFpwRFQ0cnd6MFl3TldCcTN3UVBuN3l3ZVZMTjZiYmNxTlMyZkdmUEl1dmZPeU5VVllDL1hVQWJ0VTZyUnp0ZHBzczE2U1czYk5ZbmIrSzdHNnBISEIvOExFRndMV0kxNksxSmxlZWttelZKYnkzbjk3M3FYY2Uvbjc5NE9Qai91ZnZINm9uWDA1dW56VXB5NE40LzUvOVBYQ0cvcy9GdFA4dkFtbi9YMjZFOVQrLzd2L1gvbzlsTkY3L1dNVlMydjhYZ1JjQ2hFZUMyL0ZGeHhFZlFZd3lvZVRKN2lwT3BmSWVNKzY4Rmd3SERxWTFMR2RITmQ0MG9nL1VlY2NRTTlEd3RqVDQzdjZUVTNWOFJYL1l0ZWZidDh1dXIzUHF2WndoK2diUXA3c2ZPT1ExTXhYWkR3NW1qRVEyRHpHaVJ6dTdVVTNlUFRtZUFOeldjR0syc1p3RjgzaWdtU1RIM0hpVEhnNmJRY2ZMYldETEpXaTBvLzJQM0xrZitmTHlEWXR3ZGVoMEJoNVh4ODdmZjROODJYMkpQTEgvajV3WUswNmpOYnZSYWROWFRiYk5xTlV6V2VXd3l4S3NTRklBNGxBdUJ0a1hPYVV2dkR6dk1reVJJa1dLaGVNUENNUUc3Z0FjQUFBPQ==" - } - }, - { - "kind": "Deployment", - "apiVersion": "apps/v1", - "metadata": { - "name": "web", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "spec": { - "replicas": 1, - "selector": { - "matchLabels": { - "io.kompose.service": "web" - } - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "spec": { - "volumes": [ - { - "name": "web-cm0", - "configMap": { - "name": "web-cm0" - } - }, - { - "name": "web-cm1", - "configMap": { - "name": "web-cm1", - "items": [ - { - "key": "a.key", - "path": "test-a-key.key" - } - ] - } - } - ], - "containers": [ - { - "name": "web", - "image": "nginx", - "resources": {}, - "volumeMounts": [ - { - "name": "web-cm0", - "mountPath": "/etc/tls" - }, - { - "name": "web-cm1", - "mountPath": "/etc/test-a-key.key", - "subPath": "test-a-key.key" - } - ] - } - ], - "restartPolicy": "Always" - } - }, - "strategy": { - "type": "Recreate" - } - }, - "status": {} - }, - { - "kind": "ConfigMap", - "apiVersion": "v1", - "metadata": { - "name": "web-cm0", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "data": { - "a.crt": "test-crt-data...", - "a.key": "test-key-data...." - } - }, - { - "kind": "ConfigMap", - "apiVersion": "v1", - "metadata": { - "name": "web-cm1", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - }, - "annotations": { - "use-subpath": "true" - } - }, - "data": { - "a.key": "test-key-data...." - } - } - ] -} diff --git a/script/test/fixtures/configmap-volume/output-k8s.yaml b/script/test/fixtures/configmap-volume/output-k8s.yaml new file mode 100644 index 00000000..f1fcae50 --- /dev/null +++ b/script/test/fixtures/configmap-volume/output-k8s.yaml @@ -0,0 +1,121 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: db + strategy: + type: Recreate + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: db + spec: + containers: + - image: mysql + name: db + resources: {} + volumeMounts: + - mountPath: /data/configs.tar + name: db-cm0 + subPath: configs.tar + restartPolicy: Always + volumes: + - configMap: + items: + - key: configs.tar + path: configs.tar + name: db-cm0 + name: db-cm0 +status: {} + +--- +apiVersion: v1 +binaryData: + configs.tar: SDRzSUFId3pMVjhBQSsxV3pXc1RRUlFmQ3lMdVJRL2lRVkNHVmFsSVBtWm12N0tXRkFvRksxSU1UU29GVjhLWVRHc2tYK3h1WkV1SjlPaS80TkdiWjIrQ2wrSk4vQ3M4OTZ4WFo3K3lTWGFEc1NZcEpmdExabWJmNC9mbXZielpOeThsNm13eFdtZG12dFpwN3pjT0xEQjdJSVEwUllGQTh4Q3RLQUJHQkdKSnd4S1JzS0xKRUJGRVpCVkFadzZ4eE5DemJHcnlVTXl1MVdVbU0ra0Uzdk1uTzVYZDhvYXgyV25SUmh2dVdzd2N5WlgvVStCZ3ZTREFCWGpRcUJleHJoTkZ3YXFHQks3cGVScFoxeVFkUzdJZ0lkaXlHeTFXeElxdWFycFdJQ2lueWhqcC9Lc0w1LzBMVXZ3UGdxclB6OU5IV1AvSC9ObFdQNzF6MTdmZlRuK2hDT1AxajVBQ29ETFBvRUlzZWYySDUxOGE5SUZjdFU1dG1udGpkZG96OHNIem9jcnk1UHNmY1dIMC9JbWt5T245dndoTWMvOFRMZkgreHdVbHZmd3ZPc0w2bjMzVlJ3anIveGdrMy84eWtjZnJIeEgrL3cvTlBKSUVMSG45ZzhzM3I0QVZBTFpwRFQ0cnd6MFl3TldCcTN3UVBuN3l3ZVZMTjZiYmNxTlMyZkdmUEl1dmZPeU5VVllDL1hVQWJ0VTZyUnp0ZHBzczE2U1czYk5ZbmIrSzdHNnBISEIvOExFRndMV0kxNksxSmxlZWttelZKYnkzbjk3M3FYY2Uvbjc5NE9Qai91ZnZINm9uWDA1dW56VXB5NE40LzUvOVBYQ0cvcy9GdFA4dkFtbi9YMjZFOVQrLzd2L1gvbzlsTkY3L1dNVlMydjhYZ1JjQ2hFZUMyL0ZGeHhFZlFZd3lvZVRKN2lwT3BmSWVNKzY4Rmd3SERxWTFMR2RITmQ0MG9nL1VlY2NRTTlEd3RqVDQzdjZUVTNWOFJYL1l0ZWZidDh1dXIzUHF2WndoK2diUXA3c2ZPT1ExTXhYWkR3NW1qRVEyRHpHaVJ6dTdVVTNlUFRtZUFOeldjR0syc1p3RjgzaWdtU1RIM0hpVEhnNmJRY2ZMYldETEpXaTBvLzJQM0xrZitmTHlEWXR3ZGVoMEJoNVh4ODdmZjROODJYMkpQTEgvajV3WUswNmpOYnZSYWROWFRiYk5xTlV6V2VXd3l4S3NTRklBNGxBdUJ0a1hPYVV2dkR6dk1reVJJa1dLaGVNUENNUUc3Z0FjQUFBPQ== +kind: ConfigMap +metadata: + annotations: + use-subpath: "true" + creationTimestamp: null + labels: + io.kompose.service: db + name: db-cm0 + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: web + strategy: + type: Recreate + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: web + spec: + containers: + - image: nginx + name: web + resources: {} + volumeMounts: + - mountPath: /etc/tls + name: web-cm0 + - mountPath: /etc/test-a-key.key + name: web-cm1 + subPath: test-a-key.key + restartPolicy: Always + volumes: + - configMap: + name: web-cm0 + name: web-cm0 + - configMap: + items: + - key: a.key + path: test-a-key.key + name: web-cm1 + name: web-cm1 +status: {} + +--- +apiVersion: v1 +data: + a.crt: test-crt-data... + a.key: test-key-data.... +kind: ConfigMap +metadata: + creationTimestamp: null + labels: + io.kompose.service: web + name: web-cm0 + +--- +apiVersion: v1 +data: + a.key: test-key-data.... +kind: ConfigMap +metadata: + annotations: + use-subpath: "true" + creationTimestamp: null + labels: + io.kompose.service: web + name: web-cm1 + diff --git a/script/test/fixtures/configmap-volume/output-os-withlabel.json b/script/test/fixtures/configmap-volume/output-os-withlabel.json deleted file mode 100644 index eb2a2aa5..00000000 --- a/script/test/fixtures/configmap-volume/output-os-withlabel.json +++ /dev/null @@ -1,314 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "db", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - }, - "annotations": { - "kompose.volume.type": "configMap" - } - }, - "spec": { - "strategy": { - "type": "Recreate", - "resources": {} - }, - "triggers": [ - { - "type": "ConfigChange" - }, - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "db" - ], - "from": { - "kind": "ImageStreamTag", - "name": "db:latest" - } - } - } - ], - "replicas": 1, - "test": false, - "selector": { - "io.kompose.service": "db" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - } - }, - "spec": { - "volumes": [ - { - "name": "db-cm0", - "configMap": { - "name": "db-cm0", - "items": [ - { - "key": "configs.tar", - "path": "configs.tar" - } - ] - } - } - ], - "containers": [ - { - "name": "db", - "image": " ", - "resources": {}, - "volumeMounts": [ - { - "name": "db-cm0", - "mountPath": "/data/configs.tar", - "subPath": "configs.tar" - } - ] - } - ], - "restartPolicy": "Always" - } - } - }, - "status": { - "latestVersion": 0, - "observedGeneration": 0, - "replicas": 0, - "updatedReplicas": 0, - "availableReplicas": 0, - "unavailableReplicas": 0 - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "db", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - } - }, - "spec": { - "lookupPolicy": { - "local": false - }, - "tags": [ - { - "name": "latest", - "annotations": null, - "from": { - "kind": "DockerImage", - "name": "mysql" - }, - "generation": null, - "importPolicy": {}, - "referencePolicy": { - "type": "" - } - } - ] - }, - "status": { - "dockerImageRepository": "" - } - }, - { - "kind": "ConfigMap", - "apiVersion": "v1", - "metadata": { - "name": "db-cm0", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - }, - "annotations": { - "use-subpath": "true" - } - }, - "binaryData": { - "configs.tar": "SDRzSUFId3pMVjhBQSsxV3pXc1RRUlFmQ3lMdVJRL2lRVkNHVmFsSVBtWm12N0tXRkFvRksxSU1UU29GVjhLWVRHc2tYK3h1WkV1SjlPaS80TkdiWjIrQ2wrSk4vQ3M4OTZ4WFo3K3lTWGFEc1NZcEpmdExabWJmNC9mbXZielpOeThsNm13eFdtZG12dFpwN3pjT0xEQjdJSVEwUllGQTh4Q3RLQUJHQkdKSnd4S1JzS0xKRUJGRVpCVkFadzZ4eE5DemJHcnlVTXl1MVdVbU0ra0Uzdk1uTzVYZDhvYXgyV25SUmh2dVdzd2N5WlgvVStCZ3ZTREFCWGpRcUJleHJoTkZ3YXFHQks3cGVScFoxeVFkUzdJZ0lkaXlHeTFXeElxdWFycFdJQ2lueWhqcC9Lc0w1LzBMVXZ3UGdxclB6OU5IV1AvSC9ObFdQNzF6MTdmZlRuK2hDT1AxajVBQ29ETFBvRUlzZWYySDUxOGE5SUZjdFU1dG1udGpkZG96OHNIem9jcnk1UHNmY1dIMC9JbWt5T245dndoTWMvOFRMZkgreHdVbHZmd3ZPc0w2bjMzVlJ3anIveGdrMy84eWtjZnJIeEgrL3cvTlBKSUVMSG45ZzhzM3I0QVZBTFpwRFQ0cnd6MFl3TldCcTN3UVBuN3l3ZVZMTjZiYmNxTlMyZkdmUEl1dmZPeU5VVllDL1hVQWJ0VTZyUnp0ZHBzczE2U1czYk5ZbmIrSzdHNnBISEIvOExFRndMV0kxNksxSmxlZWttelZKYnkzbjk3M3FYY2Uvbjc5NE9Qai91ZnZINm9uWDA1dW56VXB5NE40LzUvOVBYQ0cvcy9GdFA4dkFtbi9YMjZFOVQrLzd2L1gvbzlsTkY3L1dNVlMydjhYZ1JjQ2hFZUMyL0ZGeHhFZlFZd3lvZVRKN2lwT3BmSWVNKzY4Rmd3SERxWTFMR2RITmQ0MG9nL1VlY2NRTTlEd3RqVDQzdjZUVTNWOFJYL1l0ZWZidDh1dXIzUHF2WndoK2diUXA3c2ZPT1ExTXhYWkR3NW1qRVEyRHpHaVJ6dTdVVTNlUFRtZUFOeldjR0syc1p3RjgzaWdtU1RIM0hpVEhnNmJRY2ZMYldETEpXaTBvLzJQM0xrZitmTHlEWXR3ZGVoMEJoNVh4ODdmZjROODJYMkpQTEgvajV3WUswNmpOYnZSYWROWFRiYk5xTlV6V2VXd3l4S3NTRklBNGxBdUJ0a1hPYVV2dkR6dk1reVJJa1dLaGVNUENNUUc3Z0FjQUFBPQ==" - } - }, - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "web", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - }, - "annotations": { - "kompose.volume.type": "configMap" - } - }, - "spec": { - "strategy": { - "type": "Recreate", - "resources": {} - }, - "triggers": [ - { - "type": "ConfigChange" - }, - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "web" - ], - "from": { - "kind": "ImageStreamTag", - "name": "web:latest" - } - } - } - ], - "replicas": 1, - "test": false, - "selector": { - "io.kompose.service": "web" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "spec": { - "volumes": [ - { - "name": "web-cm0", - "configMap": { - "name": "web-cm0" - } - }, - { - "name": "web-cm1", - "configMap": { - "name": "web-cm1", - "items": [ - { - "key": "a.key", - "path": "test-a-key.key" - } - ] - } - } - ], - "containers": [ - { - "name": "web", - "image": " ", - "resources": {}, - "volumeMounts": [ - { - "name": "web-cm0", - "mountPath": "/etc/tls" - }, - { - "name": "web-cm1", - "mountPath": "/etc/test-a-key.key", - "subPath": "test-a-key.key" - } - ] - } - ], - "restartPolicy": "Always" - } - } - }, - "status": { - "latestVersion": 0, - "observedGeneration": 0, - "replicas": 0, - "updatedReplicas": 0, - "availableReplicas": 0, - "unavailableReplicas": 0 - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "web", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "spec": { - "lookupPolicy": { - "local": false - }, - "tags": [ - { - "name": "latest", - "annotations": null, - "from": { - "kind": "DockerImage", - "name": "nginx" - }, - "generation": null, - "importPolicy": {}, - "referencePolicy": { - "type": "" - } - } - ] - }, - "status": { - "dockerImageRepository": "" - } - }, - { - "kind": "ConfigMap", - "apiVersion": "v1", - "metadata": { - "name": "web-cm0", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "data": { - "a.crt": "test-crt-data...", - "a.key": "test-key-data...." - } - }, - { - "kind": "ConfigMap", - "apiVersion": "v1", - "metadata": { - "name": "web-cm1", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - }, - "annotations": { - "use-subpath": "true" - } - }, - "data": { - "a.key": "test-key-data...." - } - } - ] -} diff --git a/script/test/fixtures/configmap-volume/output-os-withlabel.yaml b/script/test/fixtures/configmap-volume/output-os-withlabel.yaml new file mode 100644 index 00000000..926211b8 --- /dev/null +++ b/script/test/fixtures/configmap-volume/output-os-withlabel.yaml @@ -0,0 +1,207 @@ +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + annotations: + kompose.volume.type: configMap + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + replicas: 1 + selector: + io.kompose.service: db + strategy: + resources: {} + type: Recreate + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: db + spec: + containers: + - image: ' ' + name: db + resources: {} + volumeMounts: + - mountPath: /data/configs.tar + name: db-cm0 + subPath: configs.tar + restartPolicy: Always + volumes: + - configMap: + items: + - key: configs.tar + path: configs.tar + name: db-cm0 + name: db-cm0 + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - db + from: + kind: ImageStreamTag + name: db:latest + type: ImageChange +status: + availableReplicas: 0 + latestVersion: 0 + observedGeneration: 0 + replicas: 0 + unavailableReplicas: 0 + updatedReplicas: 0 + +--- +apiVersion: v1 +kind: ImageStream +metadata: + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + lookupPolicy: + local: false + tags: + - annotations: null + from: + kind: DockerImage + name: mysql + generation: null + importPolicy: {} + name: latest + referencePolicy: + type: "" +status: + dockerImageRepository: "" + +--- +apiVersion: v1 +binaryData: + configs.tar: SDRzSUFId3pMVjhBQSsxV3pXc1RRUlFmQ3lMdVJRL2lRVkNHVmFsSVBtWm12N0tXRkFvRksxSU1UU29GVjhLWVRHc2tYK3h1WkV1SjlPaS80TkdiWjIrQ2wrSk4vQ3M4OTZ4WFo3K3lTWGFEc1NZcEpmdExabWJmNC9mbXZielpOeThsNm13eFdtZG12dFpwN3pjT0xEQjdJSVEwUllGQTh4Q3RLQUJHQkdKSnd4S1JzS0xKRUJGRVpCVkFadzZ4eE5DemJHcnlVTXl1MVdVbU0ra0Uzdk1uTzVYZDhvYXgyV25SUmh2dVdzd2N5WlgvVStCZ3ZTREFCWGpRcUJleHJoTkZ3YXFHQks3cGVScFoxeVFkUzdJZ0lkaXlHeTFXeElxdWFycFdJQ2lueWhqcC9Lc0w1LzBMVXZ3UGdxclB6OU5IV1AvSC9ObFdQNzF6MTdmZlRuK2hDT1AxajVBQ29ETFBvRUlzZWYySDUxOGE5SUZjdFU1dG1udGpkZG96OHNIem9jcnk1UHNmY1dIMC9JbWt5T245dndoTWMvOFRMZkgreHdVbHZmd3ZPc0w2bjMzVlJ3anIveGdrMy84eWtjZnJIeEgrL3cvTlBKSUVMSG45ZzhzM3I0QVZBTFpwRFQ0cnd6MFl3TldCcTN3UVBuN3l3ZVZMTjZiYmNxTlMyZkdmUEl1dmZPeU5VVllDL1hVQWJ0VTZyUnp0ZHBzczE2U1czYk5ZbmIrSzdHNnBISEIvOExFRndMV0kxNksxSmxlZWttelZKYnkzbjk3M3FYY2Uvbjc5NE9Qai91ZnZINm9uWDA1dW56VXB5NE40LzUvOVBYQ0cvcy9GdFA4dkFtbi9YMjZFOVQrLzd2L1gvbzlsTkY3L1dNVlMydjhYZ1JjQ2hFZUMyL0ZGeHhFZlFZd3lvZVRKN2lwT3BmSWVNKzY4Rmd3SERxWTFMR2RITmQ0MG9nL1VlY2NRTTlEd3RqVDQzdjZUVTNWOFJYL1l0ZWZidDh1dXIzUHF2WndoK2diUXA3c2ZPT1ExTXhYWkR3NW1qRVEyRHpHaVJ6dTdVVTNlUFRtZUFOeldjR0syc1p3RjgzaWdtU1RIM0hpVEhnNmJRY2ZMYldETEpXaTBvLzJQM0xrZitmTHlEWXR3ZGVoMEJoNVh4ODdmZjROODJYMkpQTEgvajV3WUswNmpOYnZSYWROWFRiYk5xTlV6V2VXd3l4S3NTRklBNGxBdUJ0a1hPYVV2dkR6dk1reVJJa1dLaGVNUENNUUc3Z0FjQUFBPQ== +kind: ConfigMap +metadata: + annotations: + use-subpath: "true" + creationTimestamp: null + labels: + io.kompose.service: db + name: db-cm0 + +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + annotations: + kompose.volume.type: configMap + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + replicas: 1 + selector: + io.kompose.service: web + strategy: + resources: {} + type: Recreate + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: web + spec: + containers: + - image: ' ' + name: web + resources: {} + volumeMounts: + - mountPath: /etc/tls + name: web-cm0 + - mountPath: /etc/test-a-key.key + name: web-cm1 + subPath: test-a-key.key + restartPolicy: Always + volumes: + - configMap: + name: web-cm0 + name: web-cm0 + - configMap: + items: + - key: a.key + path: test-a-key.key + name: web-cm1 + name: web-cm1 + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - web + from: + kind: ImageStreamTag + name: web:latest + type: ImageChange +status: + availableReplicas: 0 + latestVersion: 0 + observedGeneration: 0 + replicas: 0 + unavailableReplicas: 0 + updatedReplicas: 0 + +--- +apiVersion: v1 +kind: ImageStream +metadata: + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + lookupPolicy: + local: false + tags: + - annotations: null + from: + kind: DockerImage + name: nginx + generation: null + importPolicy: {} + name: latest + referencePolicy: + type: "" +status: + dockerImageRepository: "" + +--- +apiVersion: v1 +data: + a.crt: test-crt-data... + a.key: test-key-data.... +kind: ConfigMap +metadata: + creationTimestamp: null + labels: + io.kompose.service: web + name: web-cm0 + +--- +apiVersion: v1 +data: + a.key: test-key-data.... +kind: ConfigMap +metadata: + annotations: + use-subpath: "true" + creationTimestamp: null + labels: + io.kompose.service: web + name: web-cm1 + diff --git a/script/test/fixtures/configmap-volume/output-os.json b/script/test/fixtures/configmap-volume/output-os.json deleted file mode 100644 index 18e5a2a9..00000000 --- a/script/test/fixtures/configmap-volume/output-os.json +++ /dev/null @@ -1,308 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "db", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - } - }, - "spec": { - "strategy": { - "type": "Recreate", - "resources": {} - }, - "triggers": [ - { - "type": "ConfigChange" - }, - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "db" - ], - "from": { - "kind": "ImageStreamTag", - "name": "db:latest" - } - } - } - ], - "replicas": 1, - "test": false, - "selector": { - "io.kompose.service": "db" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - } - }, - "spec": { - "volumes": [ - { - "name": "db-cm0", - "configMap": { - "name": "db-cm0", - "items": [ - { - "key": "configs.tar", - "path": "configs.tar" - } - ] - } - } - ], - "containers": [ - { - "name": "db", - "image": " ", - "resources": {}, - "volumeMounts": [ - { - "name": "db-cm0", - "mountPath": "/data/configs.tar", - "subPath": "configs.tar" - } - ] - } - ], - "restartPolicy": "Always" - } - } - }, - "status": { - "latestVersion": 0, - "observedGeneration": 0, - "replicas": 0, - "updatedReplicas": 0, - "availableReplicas": 0, - "unavailableReplicas": 0 - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "db", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - } - }, - "spec": { - "lookupPolicy": { - "local": false - }, - "tags": [ - { - "name": "latest", - "annotations": null, - "from": { - "kind": "DockerImage", - "name": "mysql" - }, - "generation": null, - "importPolicy": {}, - "referencePolicy": { - "type": "" - } - } - ] - }, - "status": { - "dockerImageRepository": "" - } - }, - { - "kind": "ConfigMap", - "apiVersion": "v1", - "metadata": { - "name": "db-cm0", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - }, - "annotations": { - "use-subpath": "true" - } - }, - "binaryData": { - "configs.tar": "SDRzSUFId3pMVjhBQSsxV3pXc1RRUlFmQ3lMdVJRL2lRVkNHVmFsSVBtWm12N0tXRkFvRksxSU1UU29GVjhLWVRHc2tYK3h1WkV1SjlPaS80TkdiWjIrQ2wrSk4vQ3M4OTZ4WFo3K3lTWGFEc1NZcEpmdExabWJmNC9mbXZielpOeThsNm13eFdtZG12dFpwN3pjT0xEQjdJSVEwUllGQTh4Q3RLQUJHQkdKSnd4S1JzS0xKRUJGRVpCVkFadzZ4eE5DemJHcnlVTXl1MVdVbU0ra0Uzdk1uTzVYZDhvYXgyV25SUmh2dVdzd2N5WlgvVStCZ3ZTREFCWGpRcUJleHJoTkZ3YXFHQks3cGVScFoxeVFkUzdJZ0lkaXlHeTFXeElxdWFycFdJQ2lueWhqcC9Lc0w1LzBMVXZ3UGdxclB6OU5IV1AvSC9ObFdQNzF6MTdmZlRuK2hDT1AxajVBQ29ETFBvRUlzZWYySDUxOGE5SUZjdFU1dG1udGpkZG96OHNIem9jcnk1UHNmY1dIMC9JbWt5T245dndoTWMvOFRMZkgreHdVbHZmd3ZPc0w2bjMzVlJ3anIveGdrMy84eWtjZnJIeEgrL3cvTlBKSUVMSG45ZzhzM3I0QVZBTFpwRFQ0cnd6MFl3TldCcTN3UVBuN3l3ZVZMTjZiYmNxTlMyZkdmUEl1dmZPeU5VVllDL1hVQWJ0VTZyUnp0ZHBzczE2U1czYk5ZbmIrSzdHNnBISEIvOExFRndMV0kxNksxSmxlZWttelZKYnkzbjk3M3FYY2Uvbjc5NE9Qai91ZnZINm9uWDA1dW56VXB5NE40LzUvOVBYQ0cvcy9GdFA4dkFtbi9YMjZFOVQrLzd2L1gvbzlsTkY3L1dNVlMydjhYZ1JjQ2hFZUMyL0ZGeHhFZlFZd3lvZVRKN2lwT3BmSWVNKzY4Rmd3SERxWTFMR2RITmQ0MG9nL1VlY2NRTTlEd3RqVDQzdjZUVTNWOFJYL1l0ZWZidDh1dXIzUHF2WndoK2diUXA3c2ZPT1ExTXhYWkR3NW1qRVEyRHpHaVJ6dTdVVTNlUFRtZUFOeldjR0syc1p3RjgzaWdtU1RIM0hpVEhnNmJRY2ZMYldETEpXaTBvLzJQM0xrZitmTHlEWXR3ZGVoMEJoNVh4ODdmZjROODJYMkpQTEgvajV3WUswNmpOYnZSYWROWFRiYk5xTlV6V2VXd3l4S3NTRklBNGxBdUJ0a1hPYVV2dkR6dk1reVJJa1dLaGVNUENNUUc3Z0FjQUFBPQ==" - } - }, - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "web", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "spec": { - "strategy": { - "type": "Recreate", - "resources": {} - }, - "triggers": [ - { - "type": "ConfigChange" - }, - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "web" - ], - "from": { - "kind": "ImageStreamTag", - "name": "web:latest" - } - } - } - ], - "replicas": 1, - "test": false, - "selector": { - "io.kompose.service": "web" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "spec": { - "volumes": [ - { - "name": "web-cm0", - "configMap": { - "name": "web-cm0" - } - }, - { - "name": "web-cm1", - "configMap": { - "name": "web-cm1", - "items": [ - { - "key": "a.key", - "path": "test-a-key.key" - } - ] - } - } - ], - "containers": [ - { - "name": "web", - "image": " ", - "resources": {}, - "volumeMounts": [ - { - "name": "web-cm0", - "mountPath": "/etc/tls" - }, - { - "name": "web-cm1", - "mountPath": "/etc/test-a-key.key", - "subPath": "test-a-key.key" - } - ] - } - ], - "restartPolicy": "Always" - } - } - }, - "status": { - "latestVersion": 0, - "observedGeneration": 0, - "replicas": 0, - "updatedReplicas": 0, - "availableReplicas": 0, - "unavailableReplicas": 0 - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "web", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "spec": { - "lookupPolicy": { - "local": false - }, - "tags": [ - { - "name": "latest", - "annotations": null, - "from": { - "kind": "DockerImage", - "name": "nginx" - }, - "generation": null, - "importPolicy": {}, - "referencePolicy": { - "type": "" - } - } - ] - }, - "status": { - "dockerImageRepository": "" - } - }, - { - "kind": "ConfigMap", - "apiVersion": "v1", - "metadata": { - "name": "web-cm0", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "data": { - "a.crt": "test-crt-data...", - "a.key": "test-key-data...." - } - }, - { - "kind": "ConfigMap", - "apiVersion": "v1", - "metadata": { - "name": "web-cm1", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - }, - "annotations": { - "use-subpath": "true" - } - }, - "data": { - "a.key": "test-key-data...." - } - } - ] -} diff --git a/script/test/fixtures/configmap-volume/output-os.yaml b/script/test/fixtures/configmap-volume/output-os.yaml new file mode 100644 index 00000000..522894a8 --- /dev/null +++ b/script/test/fixtures/configmap-volume/output-os.yaml @@ -0,0 +1,203 @@ +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + replicas: 1 + selector: + io.kompose.service: db + strategy: + resources: {} + type: Recreate + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: db + spec: + containers: + - image: ' ' + name: db + resources: {} + volumeMounts: + - mountPath: /data/configs.tar + name: db-cm0 + subPath: configs.tar + restartPolicy: Always + volumes: + - configMap: + items: + - key: configs.tar + path: configs.tar + name: db-cm0 + name: db-cm0 + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - db + from: + kind: ImageStreamTag + name: db:latest + type: ImageChange +status: + availableReplicas: 0 + latestVersion: 0 + observedGeneration: 0 + replicas: 0 + unavailableReplicas: 0 + updatedReplicas: 0 + +--- +apiVersion: v1 +kind: ImageStream +metadata: + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + lookupPolicy: + local: false + tags: + - annotations: null + from: + kind: DockerImage + name: mysql + generation: null + importPolicy: {} + name: latest + referencePolicy: + type: "" +status: + dockerImageRepository: "" + +--- +apiVersion: v1 +binaryData: + configs.tar: SDRzSUFId3pMVjhBQSsxV3pXc1RRUlFmQ3lMdVJRL2lRVkNHVmFsSVBtWm12N0tXRkFvRksxSU1UU29GVjhLWVRHc2tYK3h1WkV1SjlPaS80TkdiWjIrQ2wrSk4vQ3M4OTZ4WFo3K3lTWGFEc1NZcEpmdExabWJmNC9mbXZielpOeThsNm13eFdtZG12dFpwN3pjT0xEQjdJSVEwUllGQTh4Q3RLQUJHQkdKSnd4S1JzS0xKRUJGRVpCVkFadzZ4eE5DemJHcnlVTXl1MVdVbU0ra0Uzdk1uTzVYZDhvYXgyV25SUmh2dVdzd2N5WlgvVStCZ3ZTREFCWGpRcUJleHJoTkZ3YXFHQks3cGVScFoxeVFkUzdJZ0lkaXlHeTFXeElxdWFycFdJQ2lueWhqcC9Lc0w1LzBMVXZ3UGdxclB6OU5IV1AvSC9ObFdQNzF6MTdmZlRuK2hDT1AxajVBQ29ETFBvRUlzZWYySDUxOGE5SUZjdFU1dG1udGpkZG96OHNIem9jcnk1UHNmY1dIMC9JbWt5T245dndoTWMvOFRMZkgreHdVbHZmd3ZPc0w2bjMzVlJ3anIveGdrMy84eWtjZnJIeEgrL3cvTlBKSUVMSG45ZzhzM3I0QVZBTFpwRFQ0cnd6MFl3TldCcTN3UVBuN3l3ZVZMTjZiYmNxTlMyZkdmUEl1dmZPeU5VVllDL1hVQWJ0VTZyUnp0ZHBzczE2U1czYk5ZbmIrSzdHNnBISEIvOExFRndMV0kxNksxSmxlZWttelZKYnkzbjk3M3FYY2Uvbjc5NE9Qai91ZnZINm9uWDA1dW56VXB5NE40LzUvOVBYQ0cvcy9GdFA4dkFtbi9YMjZFOVQrLzd2L1gvbzlsTkY3L1dNVlMydjhYZ1JjQ2hFZUMyL0ZGeHhFZlFZd3lvZVRKN2lwT3BmSWVNKzY4Rmd3SERxWTFMR2RITmQ0MG9nL1VlY2NRTTlEd3RqVDQzdjZUVTNWOFJYL1l0ZWZidDh1dXIzUHF2WndoK2diUXA3c2ZPT1ExTXhYWkR3NW1qRVEyRHpHaVJ6dTdVVTNlUFRtZUFOeldjR0syc1p3RjgzaWdtU1RIM0hpVEhnNmJRY2ZMYldETEpXaTBvLzJQM0xrZitmTHlEWXR3ZGVoMEJoNVh4ODdmZjROODJYMkpQTEgvajV3WUswNmpOYnZSYWROWFRiYk5xTlV6V2VXd3l4S3NTRklBNGxBdUJ0a1hPYVV2dkR6dk1reVJJa1dLaGVNUENNUUc3Z0FjQUFBPQ== +kind: ConfigMap +metadata: + annotations: + use-subpath: "true" + creationTimestamp: null + labels: + io.kompose.service: db + name: db-cm0 + +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + replicas: 1 + selector: + io.kompose.service: web + strategy: + resources: {} + type: Recreate + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: web + spec: + containers: + - image: ' ' + name: web + resources: {} + volumeMounts: + - mountPath: /etc/tls + name: web-cm0 + - mountPath: /etc/test-a-key.key + name: web-cm1 + subPath: test-a-key.key + restartPolicy: Always + volumes: + - configMap: + name: web-cm0 + name: web-cm0 + - configMap: + items: + - key: a.key + path: test-a-key.key + name: web-cm1 + name: web-cm1 + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - web + from: + kind: ImageStreamTag + name: web:latest + type: ImageChange +status: + availableReplicas: 0 + latestVersion: 0 + observedGeneration: 0 + replicas: 0 + unavailableReplicas: 0 + updatedReplicas: 0 + +--- +apiVersion: v1 +kind: ImageStream +metadata: + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + lookupPolicy: + local: false + tags: + - annotations: null + from: + kind: DockerImage + name: nginx + generation: null + importPolicy: {} + name: latest + referencePolicy: + type: "" +status: + dockerImageRepository: "" + +--- +apiVersion: v1 +data: + a.crt: test-crt-data... + a.key: test-key-data.... +kind: ConfigMap +metadata: + creationTimestamp: null + labels: + io.kompose.service: web + name: web-cm0 + +--- +apiVersion: v1 +data: + a.key: test-key-data.... +kind: ConfigMap +metadata: + annotations: + use-subpath: "true" + creationTimestamp: null + labels: + io.kompose.service: web + name: web-cm1 + diff --git a/script/test/fixtures/deploy/placement/output-placement-k8s.json b/script/test/fixtures/deploy/placement/output-placement-k8s.json deleted file mode 100644 index 321d5c83..00000000 --- a/script/test/fixtures/deploy/placement/output-placement-k8s.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - } - }, - "spec": { - "ports": [ - { - "name": "6379", - "port": 6379, - "targetPort": 6379 - } - ], - "selector": { - "io.kompose.service": "redis" - } - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "Deployment", - "apiVersion": "apps/v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - } - }, - "spec": { - "replicas": 1, - "selector": { - "matchLabels": { - "io.kompose.service": "redis" - } - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - } - }, - "spec": { - "containers": [ - { - "name": "redis", - "image": "redis", - "ports": [ - { - "containerPort": 6379 - } - ], - "resources": {} - } - ], - "restartPolicy": "Always", - "affinity": { - "nodeAffinity": { - "requiredDuringSchedulingIgnoredDuringExecution": { - "nodeSelectorTerms": [ - { - "matchExpressions": [ - { - "key": "kubernetes.io/hostname", - "operator": "In", - "values": [ - "machine" - ] - }, - { - "key": "kubernetes.io/os", - "operator": "In", - "values": [ - "ubuntu 14.04" - ] - }, - { - "key": "foo", - "operator": "NotIn", - "values": [ - "bar" - ] - } - ] - } - ] - } - } - }, - "topologySpreadConstraints": [ - { - "maxSkew": 2, - "topologyKey": "zone", - "whenUnsatisfiable": "ScheduleAnyway", - "labelSelector": { - "matchLabels": { - "io.kompose.service": "redis" - } - } - }, - { - "maxSkew": 1, - "topologyKey": "ssd", - "whenUnsatisfiable": "ScheduleAnyway", - "labelSelector": { - "matchLabels": { - "io.kompose.service": "redis" - } - } - } - ] - } - }, - "strategy": {} - }, - "status": {} - } - ] -} \ No newline at end of file diff --git a/script/test/fixtures/deploy/placement/output-placement-k8s.yaml b/script/test/fixtures/deploy/placement/output-placement-k8s.yaml new file mode 100644 index 00000000..cae39db4 --- /dev/null +++ b/script/test/fixtures/deploy/placement/output-placement-k8s.yaml @@ -0,0 +1,77 @@ +--- +apiVersion: v1 +kind: Service +metadata: + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + ports: + - name: "6379" + port: 6379 + targetPort: 6379 + selector: + io.kompose.service: redis +status: + loadBalancer: {} + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: redis + strategy: {} + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: redis + spec: + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - machine + - key: kubernetes.io/os + operator: In + values: + - ubuntu 14.04 + - key: foo + operator: NotIn + values: + - bar + containers: + - image: redis + name: redis + ports: + - containerPort: 6379 + resources: {} + restartPolicy: Always + topologySpreadConstraints: + - labelSelector: + matchLabels: + io.kompose.service: redis + maxSkew: 2 + topologyKey: zone + whenUnsatisfiable: ScheduleAnyway + - labelSelector: + matchLabels: + io.kompose.service: redis + maxSkew: 1 + topologyKey: ssd + whenUnsatisfiable: ScheduleAnyway +status: {} + diff --git a/script/test/fixtures/deploy/placement/output-placement-os.json b/script/test/fixtures/deploy/placement/output-placement-os.json deleted file mode 100644 index ad75384e..00000000 --- a/script/test/fixtures/deploy/placement/output-placement-os.json +++ /dev/null @@ -1,192 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - } - }, - "spec": { - "ports": [ - { - "name": "6379", - "port": 6379, - "targetPort": 6379 - } - ], - "selector": { - "io.kompose.service": "redis" - } - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - } - }, - "spec": { - "strategy": { - "resources": {} - }, - "triggers": [ - { - "type": "ConfigChange" - }, - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "redis" - ], - "from": { - "kind": "ImageStreamTag", - "name": "redis:latest" - } - } - } - ], - "replicas": 1, - "test": false, - "selector": { - "io.kompose.service": "redis" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - } - }, - "spec": { - "containers": [ - { - "name": "redis", - "image": " ", - "ports": [ - { - "containerPort": 6379 - } - ], - "resources": {} - } - ], - "restartPolicy": "Always", - "affinity": { - "nodeAffinity": { - "requiredDuringSchedulingIgnoredDuringExecution": { - "nodeSelectorTerms": [ - { - "matchExpressions": [ - { - "key": "kubernetes.io/hostname", - "operator": "In", - "values": [ - "machine" - ] - }, - { - "key": "kubernetes.io/os", - "operator": "In", - "values": [ - "ubuntu 14.04" - ] - }, - { - "key": "foo", - "operator": "NotIn", - "values": [ - "bar" - ] - } - ] - } - ] - } - } - }, - "topologySpreadConstraints": [ - { - "maxSkew": 2, - "topologyKey": "zone", - "whenUnsatisfiable": "ScheduleAnyway", - "labelSelector": { - "matchLabels": { - "io.kompose.service": "redis" - } - } - }, - { - "maxSkew": 1, - "topologyKey": "ssd", - "whenUnsatisfiable": "ScheduleAnyway", - "labelSelector": { - "matchLabels": { - "io.kompose.service": "redis" - } - } - } - ] - } - } - }, - "status": { - "latestVersion": 0, - "observedGeneration": 0, - "replicas": 0, - "updatedReplicas": 0, - "availableReplicas": 0, - "unavailableReplicas": 0 - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - } - }, - "spec": { - "lookupPolicy": { - "local": false - }, - "tags": [ - { - "name": "latest", - "annotations": null, - "from": { - "kind": "DockerImage", - "name": "redis" - }, - "generation": null, - "importPolicy": {}, - "referencePolicy": { - "type": "" - } - } - ] - }, - "status": { - "dockerImageRepository": "" - } - } - ] -} \ No newline at end of file diff --git a/script/test/fixtures/deploy/placement/output-placement-os.yaml b/script/test/fixtures/deploy/placement/output-placement-os.yaml new file mode 100644 index 00000000..47ac9b4e --- /dev/null +++ b/script/test/fixtures/deploy/placement/output-placement-os.yaml @@ -0,0 +1,118 @@ +--- +apiVersion: v1 +kind: Service +metadata: + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + ports: + - name: "6379" + port: 6379 + targetPort: 6379 + selector: + io.kompose.service: redis +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + replicas: 1 + selector: + io.kompose.service: redis + strategy: + resources: {} + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: redis + spec: + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - machine + - key: kubernetes.io/os + operator: In + values: + - ubuntu 14.04 + - key: foo + operator: NotIn + values: + - bar + containers: + - image: ' ' + name: redis + ports: + - containerPort: 6379 + resources: {} + restartPolicy: Always + topologySpreadConstraints: + - labelSelector: + matchLabels: + io.kompose.service: redis + maxSkew: 2 + topologyKey: zone + whenUnsatisfiable: ScheduleAnyway + - labelSelector: + matchLabels: + io.kompose.service: redis + maxSkew: 1 + topologyKey: ssd + whenUnsatisfiable: ScheduleAnyway + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - redis + from: + kind: ImageStreamTag + name: redis:latest + type: ImageChange +status: + availableReplicas: 0 + latestVersion: 0 + observedGeneration: 0 + replicas: 0 + unavailableReplicas: 0 + updatedReplicas: 0 + +--- +apiVersion: v1 +kind: ImageStream +metadata: + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + lookupPolicy: + local: false + tags: + - annotations: null + from: + kind: DockerImage + name: redis + generation: null + importPolicy: {} + name: latest + referencePolicy: + type: "" +status: + dockerImageRepository: "" + diff --git a/script/test/fixtures/envvars-interpolation/output-k8s.json b/script/test/fixtures/envvars-interpolation/output-k8s.json deleted file mode 100644 index 6ee8b10b..00000000 --- a/script/test/fixtures/envvars-interpolation/output-k8s.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "Deployment", - "apiVersion": "apps/v1", - "metadata": { - "name": "myservice", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "myservice" - } - }, - "spec": { - "replicas": 1, - "selector": { - "matchLabels": { - "io.kompose.service": "myservice" - } - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "myservice" - } - }, - "spec": { - "containers": [ - { - "name": "myservice", - "image": "alpine", - "args": [ - "curl", - "$(PROTOCOL)://$(DOMAIN)/" - ], - "env": [ - { - "name": "DOMAIN", - "value": "google.com" - }, - { - "name": "PROTOCOL", - "value": "https" - } - ], - "resources": {} - } - ], - "restartPolicy": "Always" - } - }, - "strategy": {} - }, - "status": {} - } - ] -} diff --git a/script/test/fixtures/envvars-interpolation/output-k8s.yaml b/script/test/fixtures/envvars-interpolation/output-k8s.yaml new file mode 100644 index 00000000..bacee721 --- /dev/null +++ b/script/test/fixtures/envvars-interpolation/output-k8s.yaml @@ -0,0 +1,35 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + creationTimestamp: null + labels: + io.kompose.service: myservice + name: myservice +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: myservice + strategy: {} + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: myservice + spec: + containers: + - args: + - curl + - $(PROTOCOL)://$(DOMAIN)/ + env: + - name: DOMAIN + value: google.com + - name: PROTOCOL + value: https + image: alpine + name: myservice + resources: {} + restartPolicy: Always +status: {} + diff --git a/script/test/fixtures/envvars-interpolation/output-os.json b/script/test/fixtures/envvars-interpolation/output-os.json deleted file mode 100644 index 8f7796f8..00000000 --- a/script/test/fixtures/envvars-interpolation/output-os.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "myservice", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "myservice" - } - }, - "spec": { - "strategy": { - "resources": {} - }, - "triggers": [ - { - "type": "ConfigChange" - }, - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "myservice" - ], - "from": { - "kind": "ImageStreamTag", - "name": "myservice:latest" - } - } - } - ], - "replicas": 1, - "test": false, - "selector": { - "io.kompose.service": "myservice" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "myservice" - } - }, - "spec": { - "containers": [ - { - "name": "myservice", - "image": " ", - "args": [ - "curl", - "$(PROTOCOL)://$(DOMAIN)/" - ], - "env": [ - { - "name": "DOMAIN", - "value": "google.com" - }, - { - "name": "PROTOCOL", - "value": "https" - } - ], - "resources": {} - } - ], - "restartPolicy": "Always" - } - } - }, - "status": { - "latestVersion": 0, - "observedGeneration": 0, - "replicas": 0, - "updatedReplicas": 0, - "availableReplicas": 0, - "unavailableReplicas": 0 - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "myservice", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "myservice" - } - }, - "spec": { - "lookupPolicy": { - "local": false - }, - "tags": [ - { - "name": "latest", - "annotations": null, - "from": { - "kind": "DockerImage", - "name": "alpine" - }, - "generation": null, - "importPolicy": {}, - "referencePolicy": { - "type": "" - } - } - ] - }, - "status": { - "dockerImageRepository": "" - } - } - ] -} diff --git a/script/test/fixtures/envvars-interpolation/output-os.yaml b/script/test/fixtures/envvars-interpolation/output-os.yaml new file mode 100644 index 00000000..f32ce7a1 --- /dev/null +++ b/script/test/fixtures/envvars-interpolation/output-os.yaml @@ -0,0 +1,76 @@ +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + creationTimestamp: null + labels: + io.kompose.service: myservice + name: myservice +spec: + replicas: 1 + selector: + io.kompose.service: myservice + strategy: + resources: {} + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: myservice + spec: + containers: + - args: + - curl + - $(PROTOCOL)://$(DOMAIN)/ + env: + - name: DOMAIN + value: google.com + - name: PROTOCOL + value: https + image: ' ' + name: myservice + resources: {} + restartPolicy: Always + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - myservice + from: + kind: ImageStreamTag + name: myservice:latest + type: ImageChange +status: + availableReplicas: 0 + latestVersion: 0 + observedGeneration: 0 + replicas: 0 + unavailableReplicas: 0 + updatedReplicas: 0 + +--- +apiVersion: v1 +kind: ImageStream +metadata: + creationTimestamp: null + labels: + io.kompose.service: myservice + name: myservice +spec: + lookupPolicy: + local: false + tags: + - annotations: null + from: + kind: DockerImage + name: alpine + generation: null + importPolicy: {} + name: latest + referencePolicy: + type: "" +status: + dockerImageRepository: "" + diff --git a/script/test/fixtures/expose/output-k8s.json b/script/test/fixtures/expose/output-k8s.json deleted file mode 100644 index 8f30cf6d..00000000 --- a/script/test/fixtures/expose/output-k8s.json +++ /dev/null @@ -1,233 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - } - }, - "spec": { - "ports": [ - { - "name": "6379", - "port": 6379, - "targetPort": 6379 - } - ], - "selector": { - "io.kompose.service": "redis" - } - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "web", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - }, - "annotations": { - "kompose.service.expose": "batman.example.com/dev,batwoman.example.com", - "kompose.service.expose.ingress-class-name": "nginx", - "kompose.service.expose.tls-secret": "test-secret" - } - }, - "spec": { - "ports": [ - { - "name": "5000", - "port": 5000, - "targetPort": 5000 - } - ], - "selector": { - "io.kompose.service": "web" - } - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "Deployment", - "apiVersion": "apps/v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - } - }, - "spec": { - "replicas": 1, - "selector": { - "matchLabels": { - "io.kompose.service": "redis" - } - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - } - }, - "spec": { - "containers": [ - { - "name": "redis", - "image": "redis:3.0", - "ports": [ - { - "containerPort": 6379 - } - ], - "resources": {} - } - ], - "restartPolicy": "Always" - } - }, - "strategy": {} - }, - "status": {} - }, - { - "kind": "Deployment", - "apiVersion": "apps/v1", - "metadata": { - "name": "web", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - }, - "annotations": { - "kompose.service.expose": "batman.example.com/dev,batwoman.example.com", - "kompose.service.expose.ingress-class-name": "nginx", - "kompose.service.expose.tls-secret": "test-secret" - } - }, - "spec": { - "replicas": 1, - "selector": { - "matchLabels": { - "io.kompose.service": "web" - } - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - }, - "annotations": { - "kompose.service.expose": "batman.example.com/dev,batwoman.example.com", - "kompose.service.expose.ingress-class-name": "nginx", - "kompose.service.expose.tls-secret": "test-secret" - } - }, - "spec": { - "containers": [ - { - "name": "web", - "image": "tuna/docker-counter23", - "ports": [ - { - "containerPort": 5000 - } - ], - "resources": {} - } - ], - "restartPolicy": "Always" - } - }, - "strategy": {} - }, - "status": {} - }, - { - "kind": "Ingress", - "apiVersion": "networking.k8s.io/v1", - "metadata": { - "name": "web", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - }, - "annotations": { - "kompose.service.expose": "batman.example.com/dev,batwoman.example.com", - "kompose.service.expose.ingress-class-name": "nginx", - "kompose.service.expose.tls-secret": "test-secret" - } - }, - "spec": { - "ingressClassName": "nginx", - "tls": [ - { - "hosts": [ - "batman.example.com", - "batwoman.example.com" - ], - "secretName": "test-secret" - } - ], - "rules": [ - { - "host": "batman.example.com", - "http": { - "paths": [ - { - "path": "/dev", - "pathType": "Prefix", - "backend": { - "service": { - "name": "web", - "port": { - "number": 5000 - } - } - } - } - ] - } - }, - { - "host": "batwoman.example.com", - "http": { - "paths": [ - { - "path": "/", - "pathType": "Prefix", - "backend": { - "service": { - "name": "web", - "port": { - "number": 5000 - } - } - } - } - ] - } - } - ] - }, - "status": { - "loadBalancer": {} - } - } - ] -} diff --git a/script/test/fixtures/expose/output-k8s.yaml b/script/test/fixtures/expose/output-k8s.yaml new file mode 100644 index 00000000..18f85905 --- /dev/null +++ b/script/test/fixtures/expose/output-k8s.yaml @@ -0,0 +1,148 @@ +--- +apiVersion: v1 +kind: Service +metadata: + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + ports: + - name: "6379" + port: 6379 + targetPort: 6379 + selector: + io.kompose.service: redis +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.service.expose: batman.example.com/dev,batwoman.example.com + kompose.service.expose.ingress-class-name: nginx + kompose.service.expose.tls-secret: test-secret + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + ports: + - name: "5000" + port: 5000 + targetPort: 5000 + selector: + io.kompose.service: web +status: + loadBalancer: {} + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: redis + strategy: {} + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: redis + spec: + containers: + - image: redis:3.0 + name: redis + ports: + - containerPort: 6379 + resources: {} + restartPolicy: Always +status: {} + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.service.expose: batman.example.com/dev,batwoman.example.com + kompose.service.expose.ingress-class-name: nginx + kompose.service.expose.tls-secret: test-secret + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: web + strategy: {} + template: + metadata: + annotations: + kompose.service.expose: batman.example.com/dev,batwoman.example.com + kompose.service.expose.ingress-class-name: nginx + kompose.service.expose.tls-secret: test-secret + creationTimestamp: null + labels: + io.kompose.service: web + spec: + containers: + - image: tuna/docker-counter23 + name: web + ports: + - containerPort: 5000 + resources: {} + restartPolicy: Always +status: {} + +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + kompose.service.expose: batman.example.com/dev,batwoman.example.com + kompose.service.expose.ingress-class-name: nginx + kompose.service.expose.tls-secret: test-secret + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + ingressClassName: nginx + rules: + - host: batman.example.com + http: + paths: + - backend: + service: + name: web + port: + number: 5000 + path: /dev + pathType: Prefix + - host: batwoman.example.com + http: + paths: + - backend: + service: + name: web + port: + number: 5000 + path: / + pathType: Prefix + tls: + - hosts: + - batman.example.com + - batwoman.example.com + secretName: test-secret +status: + loadBalancer: {} diff --git a/script/test/fixtures/expose/output-ocp.json b/script/test/fixtures/expose/output-ocp.json deleted file mode 100644 index bc734d7f..00000000 --- a/script/test/fixtures/expose/output-ocp.json +++ /dev/null @@ -1,300 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - } - }, - "spec": { - "ports": [ - { - "name": "6379", - "port": 6379, - "targetPort": 6379 - } - ], - "selector": { - "io.kompose.service": "redis" - } - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "web", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - }, - "annotations": { - "kompose.service.expose": "batman.example.com/dev,batwoman.example.com", - "kompose.service.expose.ingress-class-name": "nginx", - "kompose.service.expose.tls-secret": "test-secret" - } - }, - "spec": { - "ports": [ - { - "name": "5000", - "port": 5000, - "targetPort": 5000 - } - ], - "selector": { - "io.kompose.service": "web" - } - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - } - }, - "spec": { - "strategy": { - "resources": {} - }, - "triggers": [ - { - "type": "ConfigChange" - }, - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "redis" - ], - "from": { - "kind": "ImageStreamTag", - "name": "redis:3.0" - } - } - } - ], - "replicas": 1, - "test": false, - "selector": { - "io.kompose.service": "redis" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - } - }, - "spec": { - "containers": [ - { - "name": "redis", - "image": " ", - "ports": [ - { - "containerPort": 6379 - } - ], - "resources": {} - } - ], - "restartPolicy": "Always" - } - } - }, - "status": { - "latestVersion": 0, - "observedGeneration": 0, - "replicas": 0, - "updatedReplicas": 0, - "availableReplicas": 0, - "unavailableReplicas": 0 - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - } - }, - "spec": { - "lookupPolicy": { - "local": false - }, - "tags": [ - { - "name": "3.0", - "annotations": null, - "from": { - "kind": "DockerImage", - "name": "redis:3.0" - }, - "generation": null, - "importPolicy": {}, - "referencePolicy": { - "type": "" - } - } - ] - }, - "status": { - "dockerImageRepository": "" - } - }, - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "web", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - }, - "annotations": { - "kompose.service.expose": "batman.example.com/dev,batwoman.example.com", - "kompose.service.expose.ingress-class-name": "nginx", - "kompose.service.expose.tls-secret": "test-secret" - } - }, - "spec": { - "strategy": { - "resources": {} - }, - "triggers": [ - { - "type": "ConfigChange" - }, - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "web" - ], - "from": { - "kind": "ImageStreamTag", - "name": "web:latest" - } - } - } - ], - "replicas": 1, - "test": false, - "selector": { - "io.kompose.service": "web" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "spec": { - "containers": [ - { - "name": "web", - "image": " ", - "ports": [ - { - "containerPort": 5000 - } - ], - "resources": {} - } - ], - "restartPolicy": "Always" - } - } - }, - "status": { - "latestVersion": 0, - "observedGeneration": 0, - "replicas": 0, - "updatedReplicas": 0, - "availableReplicas": 0, - "unavailableReplicas": 0 - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "web", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "spec": { - "lookupPolicy": { - "local": false - }, - "tags": [ - { - "name": "latest", - "annotations": null, - "from": { - "kind": "DockerImage", - "name": "tuna/docker-counter23" - }, - "generation": null, - "importPolicy": {}, - "referencePolicy": { - "type": "" - } - } - ] - }, - "status": { - "dockerImageRepository": "" - } - }, - { - "kind": "Route", - "apiVersion": "v1", - "metadata": { - "name": "web", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "spec": { - "host": "batman.example.com/dev,batwoman.example.com", - "to": { - "kind": "Service", - "name": "web", - "weight": null - }, - "port": { - "targetPort": 5000 - } - }, - "status": {} - } - ] -} diff --git a/script/test/fixtures/expose/output-os.yaml b/script/test/fixtures/expose/output-os.yaml new file mode 100644 index 00000000..8a089442 --- /dev/null +++ b/script/test/fixtures/expose/output-os.yaml @@ -0,0 +1,202 @@ +--- +apiVersion: v1 +kind: Service +metadata: + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + ports: + - name: "6379" + port: 6379 + targetPort: 6379 + selector: + io.kompose.service: redis +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.service.expose: batman.example.com/dev,batwoman.example.com + kompose.service.expose.ingress-class-name: nginx + kompose.service.expose.tls-secret: test-secret + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + ports: + - name: "5000" + port: 5000 + targetPort: 5000 + selector: + io.kompose.service: web +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + replicas: 1 + selector: + io.kompose.service: redis + strategy: + resources: {} + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: redis + spec: + containers: + - image: ' ' + name: redis + ports: + - containerPort: 6379 + resources: {} + restartPolicy: Always + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - redis + from: + kind: ImageStreamTag + name: redis:3.0 + type: ImageChange +status: + availableReplicas: 0 + latestVersion: 0 + observedGeneration: 0 + replicas: 0 + unavailableReplicas: 0 + updatedReplicas: 0 + +--- +apiVersion: v1 +kind: ImageStream +metadata: + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + lookupPolicy: + local: false + tags: + - annotations: null + from: + kind: DockerImage + name: redis:3.0 + generation: null + importPolicy: {} + name: "3.0" + referencePolicy: + type: "" +status: + dockerImageRepository: "" + +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + annotations: + kompose.service.expose: batman.example.com/dev,batwoman.example.com + kompose.service.expose.ingress-class-name: nginx + kompose.service.expose.tls-secret: test-secret + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + replicas: 1 + selector: + io.kompose.service: web + strategy: + resources: {} + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: web + spec: + containers: + - image: ' ' + name: web + ports: + - containerPort: 5000 + resources: {} + restartPolicy: Always + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - web + from: + kind: ImageStreamTag + name: web:latest + type: ImageChange +status: + availableReplicas: 0 + latestVersion: 0 + observedGeneration: 0 + replicas: 0 + unavailableReplicas: 0 + updatedReplicas: 0 + +--- +apiVersion: v1 +kind: ImageStream +metadata: + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + lookupPolicy: + local: false + tags: + - annotations: null + from: + kind: DockerImage + name: tuna/docker-counter23 + generation: null + importPolicy: {} + name: latest + referencePolicy: + type: "" +status: + dockerImageRepository: "" + +--- +apiVersion: v1 +kind: Route +metadata: + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + host: batman.example.com/dev,batwoman.example.com + port: + targetPort: 5000 + to: + kind: Service + name: web + weight: null +status: {} + diff --git a/script/test/fixtures/healthcheck/output-healthcheck-k8s.json b/script/test/fixtures/healthcheck/output-healthcheck-k8s.json deleted file mode 100644 index ef5a29b1..00000000 --- a/script/test/fixtures/healthcheck/output-healthcheck-k8s.json +++ /dev/null @@ -1,401 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "mongo", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "my-group" - }, - "annotations": { - "kompose.service.group": "my-group", - "kompose.service.healthcheck.liveness.tcp_port": "8080", - "kompose.service.healthcheck.readiness.interval": "10s", - "kompose.service.healthcheck.readiness.retries": "5", - "kompose.service.healthcheck.readiness.tcp_port": "9090", - "kompose.service.healthcheck.readiness.timeout": "1s" - } - }, - "spec": { - "ports": [ - { - "name": "27017", - "port": 27017, - "targetPort": 27017 - } - ], - "selector": { - "io.kompose.service": "my-group" - } - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "mysql", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "my-group" - }, - "annotations": { - "kompose.service.group": "my-group", - "kompose.service.healthcheck.liveness.tcp_port": "8081", - "kompose.service.healthcheck.readiness.interval": "11s", - "kompose.service.healthcheck.readiness.retries": "6", - "kompose.service.healthcheck.readiness.tcp_port": "9091", - "kompose.service.healthcheck.readiness.timeout": "2s" - } - }, - "spec": { - "ports": [ - { - "name": "3306", - "port": 3306, - "targetPort": 3306 - } - ], - "selector": { - "io.kompose.service": "my-group" - } - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "postgresql", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "postgresql" - }, - "annotations": { - "kompose.service.healthcheck.liveness.http_get_path": "/health", - "kompose.service.healthcheck.liveness.http_get_port": "8080", - "kompose.service.healthcheck.readiness.http_get_path": "/ready", - "kompose.service.healthcheck.readiness.http_get_port": "8080", - "kompose.service.healthcheck.readiness.interval": "10s", - "kompose.service.healthcheck.readiness.retries": "5", - "kompose.service.healthcheck.readiness.timeout": "1s" - } - }, - "spec": { - "ports": [ - { - "name": "5432", - "port": 5432, - "targetPort": 5432 - } - ], - "selector": { - "io.kompose.service": "postgresql" - } - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - }, - "annotations": { - "kompose.service.healthcheck.readiness.interval": "10s", - "kompose.service.healthcheck.readiness.retries": "5", - "kompose.service.healthcheck.readiness.test": "echo \"liveness\"", - "kompose.service.healthcheck.readiness.timeout": "1s" - } - }, - "spec": { - "ports": [ - { - "name": "6379", - "port": 6379, - "targetPort": 6379 - } - ], - "selector": { - "io.kompose.service": "redis" - } - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "Deployment", - "apiVersion": "apps/v1", - "metadata": { - "name": "my-group", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "my-group" - }, - "annotations": { - "kompose.service.group": "my-group", - "kompose.service.healthcheck.liveness.tcp_port": "8081", - "kompose.service.healthcheck.readiness.interval": "11s", - "kompose.service.healthcheck.readiness.retries": "6", - "kompose.service.healthcheck.readiness.tcp_port": "9091", - "kompose.service.healthcheck.readiness.timeout": "2s" - } - }, - "spec": { - "replicas": 1, - "selector": { - "matchLabels": { - "io.kompose.service": "my-group" - } - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "my-group" - }, - "annotations": { - "kompose.service.group": "my-group", - "kompose.service.healthcheck.liveness.tcp_port": "8080", - "kompose.service.healthcheck.readiness.interval": "10s", - "kompose.service.healthcheck.readiness.retries": "5", - "kompose.service.healthcheck.readiness.tcp_port": "9090", - "kompose.service.healthcheck.readiness.timeout": "1s" - } - }, - "spec": { - "containers": [ - { - "name": "mongo", - "image": "mongo", - "ports": [ - { - "containerPort": 27017 - } - ], - "resources": {}, - "livenessProbe": { - "tcpSocket": { - "port": 8080 - }, - "timeoutSeconds": 1, - "periodSeconds": 10, - "failureThreshold": 5 - }, - "readinessProbe": { - "tcpSocket": { - "port": 9090 - }, - "timeoutSeconds": 1, - "periodSeconds": 10, - "failureThreshold": 5 - } - }, - { - "name": "mysql", - "image": "mysql", - "ports": [ - { - "containerPort": 3306 - } - ], - "resources": {}, - "livenessProbe": { - "tcpSocket": { - "port": 8081 - }, - "timeoutSeconds": 2, - "periodSeconds": 11, - "failureThreshold": 6 - }, - "readinessProbe": { - "tcpSocket": { - "port": 9091 - }, - "timeoutSeconds": 2, - "periodSeconds": 11, - "failureThreshold": 6 - } - } - ], - "restartPolicy": "Always" - } - }, - "strategy": {} - }, - "status": {} - }, - { - "kind": "Deployment", - "apiVersion": "apps/v1", - "metadata": { - "name": "postgresql", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "postgresql" - }, - "annotations": { - "kompose.service.healthcheck.liveness.http_get_path": "/health", - "kompose.service.healthcheck.liveness.http_get_port": "8080", - "kompose.service.healthcheck.readiness.http_get_path": "/ready", - "kompose.service.healthcheck.readiness.http_get_port": "8080", - "kompose.service.healthcheck.readiness.interval": "10s", - "kompose.service.healthcheck.readiness.retries": "5", - "kompose.service.healthcheck.readiness.timeout": "1s" - } - }, - "spec": { - "replicas": 1, - "selector": { - "matchLabels": { - "io.kompose.service": "postgresql" - } - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "postgresql" - }, - "annotations": { - "kompose.service.healthcheck.liveness.http_get_path": "/health", - "kompose.service.healthcheck.liveness.http_get_port": "8080", - "kompose.service.healthcheck.readiness.http_get_path": "/ready", - "kompose.service.healthcheck.readiness.http_get_port": "8080", - "kompose.service.healthcheck.readiness.interval": "10s", - "kompose.service.healthcheck.readiness.retries": "5", - "kompose.service.healthcheck.readiness.timeout": "1s" - } - }, - "spec": { - "containers": [ - { - "name": "postgresql", - "image": "postgresql", - "ports": [ - { - "containerPort": 5432 - } - ], - "resources": {}, - "livenessProbe": { - "httpGet": { - "path": "/health", - "port": 8080 - }, - "timeoutSeconds": 1, - "periodSeconds": 10, - "failureThreshold": 5 - }, - "readinessProbe": { - "httpGet": { - "path": "/ready", - "port": 8080 - }, - "timeoutSeconds": 1, - "periodSeconds": 10, - "failureThreshold": 5 - } - } - ], - "restartPolicy": "Always" - } - }, - "strategy": {} - }, - "status": {} - }, - { - "kind": "Deployment", - "apiVersion": "apps/v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - }, - "annotations": { - "kompose.service.healthcheck.readiness.interval": "10s", - "kompose.service.healthcheck.readiness.retries": "5", - "kompose.service.healthcheck.readiness.test": "echo \"liveness\"", - "kompose.service.healthcheck.readiness.timeout": "1s" - } - }, - "spec": { - "replicas": 1, - "selector": { - "matchLabels": { - "io.kompose.service": "redis" - } - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - }, - "annotations": { - "kompose.service.healthcheck.readiness.interval": "10s", - "kompose.service.healthcheck.readiness.retries": "5", - "kompose.service.healthcheck.readiness.test": "echo \"liveness\"", - "kompose.service.healthcheck.readiness.timeout": "1s" - } - }, - "spec": { - "containers": [ - { - "name": "redis", - "image": "redis", - "ports": [ - { - "containerPort": 6379 - } - ], - "resources": {}, - "livenessProbe": { - "exec": { - "command": [ - "echo \"liveness\"" - ] - }, - "timeoutSeconds": 1, - "periodSeconds": 10, - "failureThreshold": 5 - }, - "readinessProbe": { - "exec": { - "command": [ - "echo", - "liveness" - ] - }, - "timeoutSeconds": 1, - "periodSeconds": 10, - "failureThreshold": 5 - } - } - ], - "restartPolicy": "Always" - } - }, - "strategy": {} - }, - "status": {} - } - ] -} \ No newline at end of file diff --git a/script/test/fixtures/healthcheck/output-healthcheck-k8s.yaml b/script/test/fixtures/healthcheck/output-healthcheck-k8s.yaml new file mode 100644 index 00000000..f3f6cb8c --- /dev/null +++ b/script/test/fixtures/healthcheck/output-healthcheck-k8s.yaml @@ -0,0 +1,284 @@ +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.service.group: my-group + kompose.service.healthcheck.liveness.tcp_port: "8080" + kompose.service.healthcheck.readiness.interval: 10s + kompose.service.healthcheck.readiness.retries: "5" + kompose.service.healthcheck.readiness.tcp_port: "9090" + kompose.service.healthcheck.readiness.timeout: 1s + creationTimestamp: null + labels: + io.kompose.service: my-group + name: mongo +spec: + ports: + - name: "27017" + port: 27017 + targetPort: 27017 + selector: + io.kompose.service: my-group +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.service.group: my-group + kompose.service.healthcheck.liveness.tcp_port: "8081" + kompose.service.healthcheck.readiness.interval: 11s + kompose.service.healthcheck.readiness.retries: "6" + kompose.service.healthcheck.readiness.tcp_port: "9091" + kompose.service.healthcheck.readiness.timeout: 2s + creationTimestamp: null + labels: + io.kompose.service: my-group + name: mysql +spec: + ports: + - name: "3306" + port: 3306 + targetPort: 3306 + selector: + io.kompose.service: my-group +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.service.healthcheck.liveness.http_get_path: /health + kompose.service.healthcheck.liveness.http_get_port: "8080" + kompose.service.healthcheck.readiness.http_get_path: /ready + kompose.service.healthcheck.readiness.http_get_port: "8080" + kompose.service.healthcheck.readiness.interval: 10s + kompose.service.healthcheck.readiness.retries: "5" + kompose.service.healthcheck.readiness.timeout: 1s + creationTimestamp: null + labels: + io.kompose.service: postgresql + name: postgresql +spec: + ports: + - name: "5432" + port: 5432 + targetPort: 5432 + selector: + io.kompose.service: postgresql +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.service.healthcheck.readiness.interval: 10s + kompose.service.healthcheck.readiness.retries: "5" + kompose.service.healthcheck.readiness.test: echo "liveness" + kompose.service.healthcheck.readiness.timeout: 1s + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + ports: + - name: "6379" + port: 6379 + targetPort: 6379 + selector: + io.kompose.service: redis +status: + loadBalancer: {} + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.service.group: my-group + kompose.service.healthcheck.liveness.tcp_port: "8081" + kompose.service.healthcheck.readiness.interval: 11s + kompose.service.healthcheck.readiness.retries: "6" + kompose.service.healthcheck.readiness.tcp_port: "9091" + kompose.service.healthcheck.readiness.timeout: 2s + creationTimestamp: null + labels: + io.kompose.service: my-group + name: my-group +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: my-group + strategy: {} + template: + metadata: + annotations: + kompose.service.group: my-group + kompose.service.healthcheck.liveness.tcp_port: "8080" + kompose.service.healthcheck.readiness.interval: 10s + kompose.service.healthcheck.readiness.retries: "5" + kompose.service.healthcheck.readiness.tcp_port: "9090" + kompose.service.healthcheck.readiness.timeout: 1s + creationTimestamp: null + labels: + io.kompose.service: my-group + spec: + containers: + - image: mongo + livenessProbe: + failureThreshold: 5 + periodSeconds: 10 + tcpSocket: + port: 8080 + timeoutSeconds: 1 + name: mongo + ports: + - containerPort: 27017 + readinessProbe: + failureThreshold: 5 + periodSeconds: 10 + tcpSocket: + port: 9090 + timeoutSeconds: 1 + resources: {} + - image: mysql + livenessProbe: + failureThreshold: 6 + periodSeconds: 11 + tcpSocket: + port: 8081 + timeoutSeconds: 2 + name: mysql + ports: + - containerPort: 3306 + readinessProbe: + failureThreshold: 6 + periodSeconds: 11 + tcpSocket: + port: 9091 + timeoutSeconds: 2 + resources: {} + restartPolicy: Always +status: {} + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.service.healthcheck.liveness.http_get_path: /health + kompose.service.healthcheck.liveness.http_get_port: "8080" + kompose.service.healthcheck.readiness.http_get_path: /ready + kompose.service.healthcheck.readiness.http_get_port: "8080" + kompose.service.healthcheck.readiness.interval: 10s + kompose.service.healthcheck.readiness.retries: "5" + kompose.service.healthcheck.readiness.timeout: 1s + creationTimestamp: null + labels: + io.kompose.service: postgresql + name: postgresql +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: postgresql + strategy: {} + template: + metadata: + annotations: + kompose.service.healthcheck.liveness.http_get_path: /health + kompose.service.healthcheck.liveness.http_get_port: "8080" + kompose.service.healthcheck.readiness.http_get_path: /ready + kompose.service.healthcheck.readiness.http_get_port: "8080" + kompose.service.healthcheck.readiness.interval: 10s + kompose.service.healthcheck.readiness.retries: "5" + kompose.service.healthcheck.readiness.timeout: 1s + creationTimestamp: null + labels: + io.kompose.service: postgresql + spec: + containers: + - image: postgresql + livenessProbe: + failureThreshold: 5 + httpGet: + path: /health + port: 8080 + periodSeconds: 10 + timeoutSeconds: 1 + name: postgresql + ports: + - containerPort: 5432 + readinessProbe: + failureThreshold: 5 + httpGet: + path: /ready + port: 8080 + periodSeconds: 10 + timeoutSeconds: 1 + resources: {} + restartPolicy: Always +status: {} + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.service.healthcheck.readiness.interval: 10s + kompose.service.healthcheck.readiness.retries: "5" + kompose.service.healthcheck.readiness.test: echo "liveness" + kompose.service.healthcheck.readiness.timeout: 1s + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: redis + strategy: {} + template: + metadata: + annotations: + kompose.service.healthcheck.readiness.interval: 10s + kompose.service.healthcheck.readiness.retries: "5" + kompose.service.healthcheck.readiness.test: echo "liveness" + kompose.service.healthcheck.readiness.timeout: 1s + creationTimestamp: null + labels: + io.kompose.service: redis + spec: + containers: + - image: redis + livenessProbe: + exec: + command: + - echo "liveness" + failureThreshold: 5 + periodSeconds: 10 + timeoutSeconds: 1 + name: redis + ports: + - containerPort: 6379 + readinessProbe: + exec: + command: + - echo + - liveness + failureThreshold: 5 + periodSeconds: 10 + timeoutSeconds: 1 + resources: {} + restartPolicy: Always +status: {} + diff --git a/script/test/fixtures/healthcheck/output-healthcheck-os.json b/script/test/fixtures/healthcheck/output-healthcheck-os.json deleted file mode 100644 index 7673fb3a..00000000 --- a/script/test/fixtures/healthcheck/output-healthcheck-os.json +++ /dev/null @@ -1,660 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "mongo", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "mongo" - }, - "annotations": { - "kompose.service.group": "my-group", - "kompose.service.healthcheck.liveness.tcp_port": "8080", - "kompose.service.healthcheck.readiness.interval": "10s", - "kompose.service.healthcheck.readiness.retries": "5", - "kompose.service.healthcheck.readiness.tcp_port": "9090", - "kompose.service.healthcheck.readiness.timeout": "1s" - } - }, - "spec": { - "ports": [ - { - "name": "27017", - "port": 27017, - "targetPort": 27017 - } - ], - "selector": { - "io.kompose.service": "mongo" - } - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "mysql", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "mysql" - }, - "annotations": { - "kompose.service.group": "my-group", - "kompose.service.healthcheck.liveness.tcp_port": "8081", - "kompose.service.healthcheck.readiness.interval": "11s", - "kompose.service.healthcheck.readiness.retries": "6", - "kompose.service.healthcheck.readiness.tcp_port": "9091", - "kompose.service.healthcheck.readiness.timeout": "2s" - } - }, - "spec": { - "ports": [ - { - "name": "3306", - "port": 3306, - "targetPort": 3306 - } - ], - "selector": { - "io.kompose.service": "mysql" - } - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "postgresql", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "postgresql" - }, - "annotations": { - "kompose.service.healthcheck.liveness.http_get_path": "/health", - "kompose.service.healthcheck.liveness.http_get_port": "8080", - "kompose.service.healthcheck.readiness.http_get_path": "/ready", - "kompose.service.healthcheck.readiness.http_get_port": "8080", - "kompose.service.healthcheck.readiness.interval": "10s", - "kompose.service.healthcheck.readiness.retries": "5", - "kompose.service.healthcheck.readiness.timeout": "1s" - } - }, - "spec": { - "ports": [ - { - "name": "5432", - "port": 5432, - "targetPort": 5432 - } - ], - "selector": { - "io.kompose.service": "postgresql" - } - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - }, - "annotations": { - "kompose.service.healthcheck.readiness.interval": "10s", - "kompose.service.healthcheck.readiness.retries": "5", - "kompose.service.healthcheck.readiness.test": "echo \"liveness\"", - "kompose.service.healthcheck.readiness.timeout": "1s" - } - }, - "spec": { - "ports": [ - { - "name": "6379", - "port": 6379, - "targetPort": 6379 - } - ], - "selector": { - "io.kompose.service": "redis" - } - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "mongo", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "mongo" - }, - "annotations": { - "kompose.service.group": "my-group", - "kompose.service.healthcheck.liveness.tcp_port": "8080", - "kompose.service.healthcheck.readiness.interval": "10s", - "kompose.service.healthcheck.readiness.retries": "5", - "kompose.service.healthcheck.readiness.tcp_port": "9090", - "kompose.service.healthcheck.readiness.timeout": "1s" - } - }, - "spec": { - "strategy": { - "resources": {} - }, - "triggers": [ - { - "type": "ConfigChange" - }, - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "mongo" - ], - "from": { - "kind": "ImageStreamTag", - "name": "mongo:latest" - } - } - } - ], - "replicas": 1, - "test": false, - "selector": { - "io.kompose.service": "mongo" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "mongo" - } - }, - "spec": { - "containers": [ - { - "name": "mongo", - "image": " ", - "ports": [ - { - "containerPort": 27017 - } - ], - "resources": {}, - "livenessProbe": { - "tcpSocket": { - "port": 8080 - }, - "timeoutSeconds": 1, - "periodSeconds": 10, - "failureThreshold": 5 - }, - "readinessProbe": { - "tcpSocket": { - "port": 9090 - }, - "timeoutSeconds": 1, - "periodSeconds": 10, - "failureThreshold": 5 - } - } - ], - "restartPolicy": "Always" - } - } - }, - "status": { - "latestVersion": 0, - "observedGeneration": 0, - "replicas": 0, - "updatedReplicas": 0, - "availableReplicas": 0, - "unavailableReplicas": 0 - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "mongo", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "mongo" - } - }, - "spec": { - "lookupPolicy": { - "local": false - }, - "tags": [ - { - "name": "latest", - "annotations": null, - "from": { - "kind": "DockerImage", - "name": "mongo" - }, - "generation": null, - "importPolicy": {}, - "referencePolicy": { - "type": "" - } - } - ] - }, - "status": { - "dockerImageRepository": "" - } - }, - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "mysql", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "mysql" - }, - "annotations": { - "kompose.service.group": "my-group", - "kompose.service.healthcheck.liveness.tcp_port": "8081", - "kompose.service.healthcheck.readiness.interval": "11s", - "kompose.service.healthcheck.readiness.retries": "6", - "kompose.service.healthcheck.readiness.tcp_port": "9091", - "kompose.service.healthcheck.readiness.timeout": "2s" - } - }, - "spec": { - "strategy": { - "resources": {} - }, - "triggers": [ - { - "type": "ConfigChange" - }, - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "mysql" - ], - "from": { - "kind": "ImageStreamTag", - "name": "mysql:latest" - } - } - } - ], - "replicas": 1, - "test": false, - "selector": { - "io.kompose.service": "mysql" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "mysql" - } - }, - "spec": { - "containers": [ - { - "name": "mysql", - "image": " ", - "ports": [ - { - "containerPort": 3306 - } - ], - "resources": {}, - "livenessProbe": { - "tcpSocket": { - "port": 8081 - }, - "timeoutSeconds": 2, - "periodSeconds": 11, - "failureThreshold": 6 - }, - "readinessProbe": { - "tcpSocket": { - "port": 9091 - }, - "timeoutSeconds": 2, - "periodSeconds": 11, - "failureThreshold": 6 - } - } - ], - "restartPolicy": "Always" - } - } - }, - "status": { - "latestVersion": 0, - "observedGeneration": 0, - "replicas": 0, - "updatedReplicas": 0, - "availableReplicas": 0, - "unavailableReplicas": 0 - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "mysql", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "mysql" - } - }, - "spec": { - "lookupPolicy": { - "local": false - }, - "tags": [ - { - "name": "latest", - "annotations": null, - "from": { - "kind": "DockerImage", - "name": "mysql" - }, - "generation": null, - "importPolicy": {}, - "referencePolicy": { - "type": "" - } - } - ] - }, - "status": { - "dockerImageRepository": "" - } - }, - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "postgresql", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "postgresql" - }, - "annotations": { - "kompose.service.healthcheck.liveness.http_get_path": "/health", - "kompose.service.healthcheck.liveness.http_get_port": "8080", - "kompose.service.healthcheck.readiness.http_get_path": "/ready", - "kompose.service.healthcheck.readiness.http_get_port": "8080", - "kompose.service.healthcheck.readiness.interval": "10s", - "kompose.service.healthcheck.readiness.retries": "5", - "kompose.service.healthcheck.readiness.timeout": "1s" - } - }, - "spec": { - "strategy": { - "resources": {} - }, - "triggers": [ - { - "type": "ConfigChange" - }, - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "postgresql" - ], - "from": { - "kind": "ImageStreamTag", - "name": "postgresql:latest" - } - } - } - ], - "replicas": 1, - "test": false, - "selector": { - "io.kompose.service": "postgresql" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "postgresql" - } - }, - "spec": { - "containers": [ - { - "name": "postgresql", - "image": " ", - "ports": [ - { - "containerPort": 5432 - } - ], - "resources": {}, - "livenessProbe": { - "httpGet": { - "path": "/health", - "port": 8080 - }, - "timeoutSeconds": 1, - "periodSeconds": 10, - "failureThreshold": 5 - }, - "readinessProbe": { - "httpGet": { - "path": "/ready", - "port": 8080 - }, - "timeoutSeconds": 1, - "periodSeconds": 10, - "failureThreshold": 5 - } - } - ], - "restartPolicy": "Always" - } - } - }, - "status": { - "latestVersion": 0, - "observedGeneration": 0, - "replicas": 0, - "updatedReplicas": 0, - "availableReplicas": 0, - "unavailableReplicas": 0 - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "postgresql", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "postgresql" - } - }, - "spec": { - "lookupPolicy": { - "local": false - }, - "tags": [ - { - "name": "latest", - "annotations": null, - "from": { - "kind": "DockerImage", - "name": "postgresql" - }, - "generation": null, - "importPolicy": {}, - "referencePolicy": { - "type": "" - } - } - ] - }, - "status": { - "dockerImageRepository": "" - } - }, - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - }, - "annotations": { - "kompose.service.healthcheck.readiness.interval": "10s", - "kompose.service.healthcheck.readiness.retries": "5", - "kompose.service.healthcheck.readiness.test": "echo \"liveness\"", - "kompose.service.healthcheck.readiness.timeout": "1s" - } - }, - "spec": { - "strategy": { - "resources": {} - }, - "triggers": [ - { - "type": "ConfigChange" - }, - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "redis" - ], - "from": { - "kind": "ImageStreamTag", - "name": "redis:latest" - } - } - } - ], - "replicas": 1, - "test": false, - "selector": { - "io.kompose.service": "redis" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - } - }, - "spec": { - "containers": [ - { - "name": "redis", - "image": " ", - "ports": [ - { - "containerPort": 6379 - } - ], - "resources": {}, - "livenessProbe": { - "exec": { - "command": [ - "echo \"liveness\"" - ] - }, - "timeoutSeconds": 1, - "periodSeconds": 10, - "failureThreshold": 5 - }, - "readinessProbe": { - "exec": { - "command": [ - "echo", - "liveness" - ] - }, - "timeoutSeconds": 1, - "periodSeconds": 10, - "failureThreshold": 5 - } - } - ], - "restartPolicy": "Always" - } - } - }, - "status": { - "latestVersion": 0, - "observedGeneration": 0, - "replicas": 0, - "updatedReplicas": 0, - "availableReplicas": 0, - "unavailableReplicas": 0 - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - } - }, - "spec": { - "lookupPolicy": { - "local": false - }, - "tags": [ - { - "name": "latest", - "annotations": null, - "from": { - "kind": "DockerImage", - "name": "redis" - }, - "generation": null, - "importPolicy": {}, - "referencePolicy": { - "type": "" - } - } - ] - }, - "status": { - "dockerImageRepository": "" - } - } - ] -} \ No newline at end of file diff --git a/script/test/fixtures/healthcheck/output-healthcheck-os.yaml b/script/test/fixtures/healthcheck/output-healthcheck-os.yaml new file mode 100644 index 00000000..1b4501fb --- /dev/null +++ b/script/test/fixtures/healthcheck/output-healthcheck-os.yaml @@ -0,0 +1,459 @@ +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.service.group: my-group + kompose.service.healthcheck.liveness.tcp_port: "8080" + kompose.service.healthcheck.readiness.interval: 10s + kompose.service.healthcheck.readiness.retries: "5" + kompose.service.healthcheck.readiness.tcp_port: "9090" + kompose.service.healthcheck.readiness.timeout: 1s + creationTimestamp: null + labels: + io.kompose.service: mongo + name: mongo +spec: + ports: + - name: "27017" + port: 27017 + targetPort: 27017 + selector: + io.kompose.service: mongo +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.service.group: my-group + kompose.service.healthcheck.liveness.tcp_port: "8081" + kompose.service.healthcheck.readiness.interval: 11s + kompose.service.healthcheck.readiness.retries: "6" + kompose.service.healthcheck.readiness.tcp_port: "9091" + kompose.service.healthcheck.readiness.timeout: 2s + creationTimestamp: null + labels: + io.kompose.service: mysql + name: mysql +spec: + ports: + - name: "3306" + port: 3306 + targetPort: 3306 + selector: + io.kompose.service: mysql +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.service.healthcheck.liveness.http_get_path: /health + kompose.service.healthcheck.liveness.http_get_port: "8080" + kompose.service.healthcheck.readiness.http_get_path: /ready + kompose.service.healthcheck.readiness.http_get_port: "8080" + kompose.service.healthcheck.readiness.interval: 10s + kompose.service.healthcheck.readiness.retries: "5" + kompose.service.healthcheck.readiness.timeout: 1s + creationTimestamp: null + labels: + io.kompose.service: postgresql + name: postgresql +spec: + ports: + - name: "5432" + port: 5432 + targetPort: 5432 + selector: + io.kompose.service: postgresql +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.service.healthcheck.readiness.interval: 10s + kompose.service.healthcheck.readiness.retries: "5" + kompose.service.healthcheck.readiness.test: echo "liveness" + kompose.service.healthcheck.readiness.timeout: 1s + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + ports: + - name: "6379" + port: 6379 + targetPort: 6379 + selector: + io.kompose.service: redis +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + annotations: + kompose.service.group: my-group + kompose.service.healthcheck.liveness.tcp_port: "8080" + kompose.service.healthcheck.readiness.interval: 10s + kompose.service.healthcheck.readiness.retries: "5" + kompose.service.healthcheck.readiness.tcp_port: "9090" + kompose.service.healthcheck.readiness.timeout: 1s + creationTimestamp: null + labels: + io.kompose.service: mongo + name: mongo +spec: + replicas: 1 + selector: + io.kompose.service: mongo + strategy: + resources: {} + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: mongo + spec: + containers: + - image: ' ' + livenessProbe: + failureThreshold: 5 + periodSeconds: 10 + tcpSocket: + port: 8080 + timeoutSeconds: 1 + name: mongo + ports: + - containerPort: 27017 + readinessProbe: + failureThreshold: 5 + periodSeconds: 10 + tcpSocket: + port: 9090 + timeoutSeconds: 1 + resources: {} + restartPolicy: Always + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - mongo + from: + kind: ImageStreamTag + name: mongo:latest + type: ImageChange +status: + availableReplicas: 0 + latestVersion: 0 + observedGeneration: 0 + replicas: 0 + unavailableReplicas: 0 + updatedReplicas: 0 + +--- +apiVersion: v1 +kind: ImageStream +metadata: + creationTimestamp: null + labels: + io.kompose.service: mongo + name: mongo +spec: + lookupPolicy: + local: false + tags: + - annotations: null + from: + kind: DockerImage + name: mongo + generation: null + importPolicy: {} + name: latest + referencePolicy: + type: "" +status: + dockerImageRepository: "" + +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + annotations: + kompose.service.group: my-group + kompose.service.healthcheck.liveness.tcp_port: "8081" + kompose.service.healthcheck.readiness.interval: 11s + kompose.service.healthcheck.readiness.retries: "6" + kompose.service.healthcheck.readiness.tcp_port: "9091" + kompose.service.healthcheck.readiness.timeout: 2s + creationTimestamp: null + labels: + io.kompose.service: mysql + name: mysql +spec: + replicas: 1 + selector: + io.kompose.service: mysql + strategy: + resources: {} + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: mysql + spec: + containers: + - image: ' ' + livenessProbe: + failureThreshold: 6 + periodSeconds: 11 + tcpSocket: + port: 8081 + timeoutSeconds: 2 + name: mysql + ports: + - containerPort: 3306 + readinessProbe: + failureThreshold: 6 + periodSeconds: 11 + tcpSocket: + port: 9091 + timeoutSeconds: 2 + resources: {} + restartPolicy: Always + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - mysql + from: + kind: ImageStreamTag + name: mysql:latest + type: ImageChange +status: + availableReplicas: 0 + latestVersion: 0 + observedGeneration: 0 + replicas: 0 + unavailableReplicas: 0 + updatedReplicas: 0 + +--- +apiVersion: v1 +kind: ImageStream +metadata: + creationTimestamp: null + labels: + io.kompose.service: mysql + name: mysql +spec: + lookupPolicy: + local: false + tags: + - annotations: null + from: + kind: DockerImage + name: mysql + generation: null + importPolicy: {} + name: latest + referencePolicy: + type: "" +status: + dockerImageRepository: "" + +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + annotations: + kompose.service.healthcheck.liveness.http_get_path: /health + kompose.service.healthcheck.liveness.http_get_port: "8080" + kompose.service.healthcheck.readiness.http_get_path: /ready + kompose.service.healthcheck.readiness.http_get_port: "8080" + kompose.service.healthcheck.readiness.interval: 10s + kompose.service.healthcheck.readiness.retries: "5" + kompose.service.healthcheck.readiness.timeout: 1s + creationTimestamp: null + labels: + io.kompose.service: postgresql + name: postgresql +spec: + replicas: 1 + selector: + io.kompose.service: postgresql + strategy: + resources: {} + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: postgresql + spec: + containers: + - image: ' ' + livenessProbe: + failureThreshold: 5 + httpGet: + path: /health + port: 8080 + periodSeconds: 10 + timeoutSeconds: 1 + name: postgresql + ports: + - containerPort: 5432 + readinessProbe: + failureThreshold: 5 + httpGet: + path: /ready + port: 8080 + periodSeconds: 10 + timeoutSeconds: 1 + resources: {} + restartPolicy: Always + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - postgresql + from: + kind: ImageStreamTag + name: postgresql:latest + type: ImageChange +status: + availableReplicas: 0 + latestVersion: 0 + observedGeneration: 0 + replicas: 0 + unavailableReplicas: 0 + updatedReplicas: 0 + +--- +apiVersion: v1 +kind: ImageStream +metadata: + creationTimestamp: null + labels: + io.kompose.service: postgresql + name: postgresql +spec: + lookupPolicy: + local: false + tags: + - annotations: null + from: + kind: DockerImage + name: postgresql + generation: null + importPolicy: {} + name: latest + referencePolicy: + type: "" +status: + dockerImageRepository: "" + +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + annotations: + kompose.service.healthcheck.readiness.interval: 10s + kompose.service.healthcheck.readiness.retries: "5" + kompose.service.healthcheck.readiness.test: echo "liveness" + kompose.service.healthcheck.readiness.timeout: 1s + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + replicas: 1 + selector: + io.kompose.service: redis + strategy: + resources: {} + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: redis + spec: + containers: + - image: ' ' + livenessProbe: + exec: + command: + - echo "liveness" + failureThreshold: 5 + periodSeconds: 10 + timeoutSeconds: 1 + name: redis + ports: + - containerPort: 6379 + readinessProbe: + exec: + command: + - echo + - liveness + failureThreshold: 5 + periodSeconds: 10 + timeoutSeconds: 1 + resources: {} + restartPolicy: Always + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - redis + from: + kind: ImageStreamTag + name: redis:latest + type: ImageChange +status: + availableReplicas: 0 + latestVersion: 0 + observedGeneration: 0 + replicas: 0 + unavailableReplicas: 0 + updatedReplicas: 0 + +--- +apiVersion: v1 +kind: ImageStream +metadata: + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + lookupPolicy: + local: false + tags: + - annotations: null + from: + kind: DockerImage + name: redis + generation: null + importPolicy: {} + name: latest + referencePolicy: + type: "" +status: + dockerImageRepository: "" + diff --git a/script/test/fixtures/multiple-files/output-k8s.json b/script/test/fixtures/multiple-files/output-k8s.json deleted file mode 100644 index 13154fa1..00000000 --- a/script/test/fixtures/multiple-files/output-k8s.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "Deployment", - "apiVersion": "apps/v1", - "metadata": { - "name": "bar", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "bar" - } - }, - "spec": { - "replicas": 99, - "selector": { - "matchLabels": { - "io.kompose.service": "bar" - } - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "bar" - } - }, - "spec": { - "containers": [ - { - "name": "bar", - "image": "bar", - "resources": {} - } - ], - "restartPolicy": "Always" - } - }, - "strategy": {} - }, - "status": {} - }, - { - "kind": "Deployment", - "apiVersion": "apps/v1", - "metadata": { - "name": "foo", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "foo" - } - }, - "spec": { - "replicas": 3, - "selector": { - "matchLabels": { - "io.kompose.service": "foo" - } - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "foo" - } - }, - "spec": { - "containers": [ - { - "name": "foo", - "image": "foo", - "resources": {} - } - ], - "restartPolicy": "Always" - } - }, - "strategy": {} - }, - "status": {} - } - ] -} diff --git a/script/test/fixtures/multiple-files/output-k8s.yaml b/script/test/fixtures/multiple-files/output-k8s.yaml new file mode 100644 index 00000000..b45b2b07 --- /dev/null +++ b/script/test/fixtures/multiple-files/output-k8s.yaml @@ -0,0 +1,53 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + creationTimestamp: null + labels: + io.kompose.service: bar + name: bar +spec: + replicas: 99 + selector: + matchLabels: + io.kompose.service: bar + strategy: {} + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: bar + spec: + containers: + - image: bar + name: bar + resources: {} + restartPolicy: Always +status: {} + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + creationTimestamp: null + labels: + io.kompose.service: foo + name: foo +spec: + replicas: 3 + selector: + matchLabels: + io.kompose.service: foo + strategy: {} + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: foo + spec: + containers: + - image: foo + name: foo + resources: {} + restartPolicy: Always +status: {} diff --git a/script/test/fixtures/multiple-files/output-ocp.json b/script/test/fixtures/multiple-files/output-ocp.json deleted file mode 100644 index 6b19f6da..00000000 --- a/script/test/fixtures/multiple-files/output-ocp.json +++ /dev/null @@ -1,205 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "bar", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "bar" - } - }, - "spec": { - "strategy": { - "resources": {} - }, - "triggers": [ - { - "type": "ConfigChange" - }, - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "bar" - ], - "from": { - "kind": "ImageStreamTag", - "name": "bar:latest" - } - } - } - ], - "replicas": 99, - "test": false, - "selector": { - "io.kompose.service": "bar" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "bar" - } - }, - "spec": { - "containers": [ - { - "name": "bar", - "image": " ", - "resources": {} - } - ], - "restartPolicy": "Always" - } - } - }, - "status": { - "latestVersion": 0, - "observedGeneration": 0, - "replicas": 0, - "updatedReplicas": 0, - "availableReplicas": 0, - "unavailableReplicas": 0 - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "bar", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "bar" - } - }, - "spec": { - "lookupPolicy": { - "local": false - }, - "tags": [ - { - "name": "latest", - "annotations": null, - "from": { - "kind": "DockerImage", - "name": "bar" - }, - "generation": null, - "importPolicy": {}, - "referencePolicy": { - "type": "" - } - } - ] - }, - "status": { - "dockerImageRepository": "" - } - }, - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "foo", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "foo" - } - }, - "spec": { - "strategy": { - "resources": {} - }, - "triggers": [ - { - "type": "ConfigChange" - }, - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "foo" - ], - "from": { - "kind": "ImageStreamTag", - "name": "foo:latest" - } - } - } - ], - "replicas": 3, - "test": false, - "selector": { - "io.kompose.service": "foo" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "foo" - } - }, - "spec": { - "containers": [ - { - "name": "foo", - "image": " ", - "resources": {} - } - ], - "restartPolicy": "Always" - } - } - }, - "status": { - "latestVersion": 0, - "observedGeneration": 0, - "replicas": 0, - "updatedReplicas": 0, - "availableReplicas": 0, - "unavailableReplicas": 0 - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "foo", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "foo" - } - }, - "spec": { - "lookupPolicy": { - "local": false - }, - "tags": [ - { - "name": "latest", - "annotations": null, - "from": { - "kind": "DockerImage", - "name": "foo" - }, - "generation": null, - "importPolicy": {}, - "referencePolicy": { - "type": "" - } - } - ] - }, - "status": { - "dockerImageRepository": "" - } - } - ] -} diff --git a/script/test/fixtures/multiple-files/output-os.yaml b/script/test/fixtures/multiple-files/output-os.yaml new file mode 100644 index 00000000..00681afe --- /dev/null +++ b/script/test/fixtures/multiple-files/output-os.yaml @@ -0,0 +1,136 @@ +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + creationTimestamp: null + labels: + io.kompose.service: bar + name: bar +spec: + replicas: 99 + selector: + io.kompose.service: bar + strategy: + resources: {} + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: bar + spec: + containers: + - image: ' ' + name: bar + resources: {} + restartPolicy: Always + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - bar + from: + kind: ImageStreamTag + name: bar:latest + type: ImageChange +status: + availableReplicas: 0 + latestVersion: 0 + observedGeneration: 0 + replicas: 0 + unavailableReplicas: 0 + updatedReplicas: 0 + +--- +apiVersion: v1 +kind: ImageStream +metadata: + creationTimestamp: null + labels: + io.kompose.service: bar + name: bar +spec: + lookupPolicy: + local: false + tags: + - annotations: null + from: + kind: DockerImage + name: bar + generation: null + importPolicy: {} + name: latest + referencePolicy: + type: "" +status: + dockerImageRepository: "" + +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + creationTimestamp: null + labels: + io.kompose.service: foo + name: foo +spec: + replicas: 3 + selector: + io.kompose.service: foo + strategy: + resources: {} + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: foo + spec: + containers: + - image: ' ' + name: foo + resources: {} + restartPolicy: Always + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - foo + from: + kind: ImageStreamTag + name: foo:latest + type: ImageChange +status: + availableReplicas: 0 + latestVersion: 0 + observedGeneration: 0 + replicas: 0 + unavailableReplicas: 0 + updatedReplicas: 0 + +--- +apiVersion: v1 +kind: ImageStream +metadata: + creationTimestamp: null + labels: + io.kompose.service: foo + name: foo +spec: + lookupPolicy: + local: false + tags: + - annotations: null + from: + kind: DockerImage + name: foo + generation: null + importPolicy: {} + name: latest + referencePolicy: + type: "" +status: + dockerImageRepository: "" + diff --git a/script/test/fixtures/multiple-type-volumes/output-k8s.json b/script/test/fixtures/multiple-type-volumes/output-k8s.json deleted file mode 100644 index 46b765f5..00000000 --- a/script/test/fixtures/multiple-type-volumes/output-k8s.json +++ /dev/null @@ -1,200 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "Deployment", - "apiVersion": "apps/v1", - "metadata": { - "name": "db", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - }, - "annotations": { - "kompose.volume.type": "persistentVolumeClaim" - } - }, - "spec": { - "replicas": 1, - "selector": { - "matchLabels": { - "io.kompose.service": "db" - } - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - }, - "annotations": { - "kompose.volume.type": "persistentVolumeClaim" - } - }, - "spec": { - "volumes": [ - { - "name": "db-data", - "persistentVolumeClaim": { - "claimName": "db-data" - } - } - ], - "containers": [ - { - "name": "db", - "image": "mysql", - "resources": {}, - "volumeMounts": [ - { - "name": "db-data", - "mountPath": "/var/lib/mysql" - } - ] - } - ], - "restartPolicy": "Always" - } - }, - "strategy": { - "type": "Recreate" - } - }, - "status": {} - }, - { - "kind": "PersistentVolumeClaim", - "apiVersion": "v1", - "metadata": { - "name": "db-data", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db-data" - } - }, - "spec": { - "accessModes": [ - "ReadWriteOnce" - ], - "resources": { - "requests": { - "storage": "100Mi" - } - } - }, - "status": {} - }, - { - "kind": "Deployment", - "apiVersion": "apps/v1", - "metadata": { - "name": "web", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - }, - "annotations": { - "kompose.volume.type": "configMap" - } - }, - "spec": { - "replicas": 1, - "selector": { - "matchLabels": { - "io.kompose.service": "web" - } - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - }, - "annotations": { - "kompose.volume.type": "configMap" - } - }, - "spec": { - "volumes": [ - { - "name": "web-cm0", - "configMap": { - "name": "web-cm0" - } - }, - { - "name": "web-cm1", - "configMap": { - "name": "web-cm1", - "items": [ - { - "key": "a.key", - "path": "test-a-key.key" - } - ] - } - } - ], - "containers": [ - { - "name": "web", - "image": "nginx", - "resources": {}, - "volumeMounts": [ - { - "name": "web-cm0", - "mountPath": "/etc/tls" - }, - { - "name": "web-cm1", - "mountPath": "/etc/test-a-key.key", - "subPath": "test-a-key.key" - } - ] - } - ], - "restartPolicy": "Always" - } - }, - "strategy": { - "type": "Recreate" - } - }, - "status": {} - }, - { - "kind": "ConfigMap", - "apiVersion": "v1", - "metadata": { - "name": "web-cm0", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "data": { - "a.crt": "test-crt-data...", - "a.key": "test-key-data...." - } - }, - { - "kind": "ConfigMap", - "apiVersion": "v1", - "metadata": { - "name": "web-cm1", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - }, - "annotations": { - "use-subpath": "true" - } - }, - "data": { - "a.key": "test-key-data...." - } - } - ] -} diff --git a/script/test/fixtures/multiple-type-volumes/output-k8s.yaml b/script/test/fixtures/multiple-type-volumes/output-k8s.yaml new file mode 100644 index 00000000..f6a47524 --- /dev/null +++ b/script/test/fixtures/multiple-type-volumes/output-k8s.yaml @@ -0,0 +1,128 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.volume.type: persistentVolumeClaim + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: db + strategy: + type: Recreate + template: + metadata: + annotations: + kompose.volume.type: persistentVolumeClaim + creationTimestamp: null + labels: + io.kompose.service: db + spec: + containers: + - image: mysql + name: db + resources: {} + volumeMounts: + - mountPath: /var/lib/mysql + name: db-data + restartPolicy: Always + volumes: + - name: db-data + persistentVolumeClaim: + claimName: db-data +status: {} + +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + io.kompose.service: db-data + name: db-data +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +status: {} + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.volume.type: configMap + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: web + strategy: + type: Recreate + template: + metadata: + annotations: + kompose.volume.type: configMap + creationTimestamp: null + labels: + io.kompose.service: web + spec: + containers: + - image: nginx + name: web + resources: {} + volumeMounts: + - mountPath: /etc/tls + name: web-cm0 + - mountPath: /etc/test-a-key.key + name: web-cm1 + subPath: test-a-key.key + restartPolicy: Always + volumes: + - configMap: + name: web-cm0 + name: web-cm0 + - configMap: + items: + - key: a.key + path: test-a-key.key + name: web-cm1 + name: web-cm1 +status: {} + +--- +apiVersion: v1 +data: + a.crt: test-crt-data... + a.key: test-key-data.... +kind: ConfigMap +metadata: + creationTimestamp: null + labels: + io.kompose.service: web + name: web-cm0 + +--- +apiVersion: v1 +data: + a.key: test-key-data.... +kind: ConfigMap +metadata: + annotations: + use-subpath: "true" + creationTimestamp: null + labels: + io.kompose.service: web + name: web-cm1 + diff --git a/script/test/fixtures/multiple-type-volumes/output-os.json b/script/test/fixtures/multiple-type-volumes/output-os.json deleted file mode 100644 index 6fc2b8d0..00000000 --- a/script/test/fixtures/multiple-type-volumes/output-os.json +++ /dev/null @@ -1,312 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "db", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - }, - "annotations": { - "kompose.volume.type": "persistentVolumeClaim" - } - }, - "spec": { - "strategy": { - "type": "Recreate", - "resources": {} - }, - "triggers": [ - { - "type": "ConfigChange" - }, - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "db" - ], - "from": { - "kind": "ImageStreamTag", - "name": "db:latest" - } - } - } - ], - "replicas": 1, - "test": false, - "selector": { - "io.kompose.service": "db" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - } - }, - "spec": { - "volumes": [ - { - "name": "db-data", - "persistentVolumeClaim": { - "claimName": "db-data" - } - } - ], - "containers": [ - { - "name": "db", - "image": " ", - "resources": {}, - "volumeMounts": [ - { - "name": "db-data", - "mountPath": "/var/lib/mysql" - } - ] - } - ], - "restartPolicy": "Always" - } - } - }, - "status": { - "latestVersion": 0, - "observedGeneration": 0, - "replicas": 0, - "updatedReplicas": 0, - "availableReplicas": 0, - "unavailableReplicas": 0 - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "db", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - } - }, - "spec": { - "lookupPolicy": { - "local": false - }, - "tags": [ - { - "name": "latest", - "annotations": null, - "from": { - "kind": "DockerImage", - "name": "mysql" - }, - "generation": null, - "importPolicy": {}, - "referencePolicy": { - "type": "" - } - } - ] - }, - "status": { - "dockerImageRepository": "" - } - }, - { - "kind": "PersistentVolumeClaim", - "apiVersion": "v1", - "metadata": { - "name": "db-data", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db-data" - } - }, - "spec": { - "accessModes": [ - "ReadWriteOnce" - ], - "resources": { - "requests": { - "storage": "100Mi" - } - } - }, - "status": {} - }, - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "web", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - }, - "annotations": { - "kompose.volume.type": "configMap" - } - }, - "spec": { - "strategy": { - "type": "Recreate", - "resources": {} - }, - "triggers": [ - { - "type": "ConfigChange" - }, - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "web" - ], - "from": { - "kind": "ImageStreamTag", - "name": "web:latest" - } - } - } - ], - "replicas": 1, - "test": false, - "selector": { - "io.kompose.service": "web" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "spec": { - "volumes": [ - { - "name": "web-cm0", - "configMap": { - "name": "web-cm0" - } - }, - { - "name": "web-cm1", - "configMap": { - "name": "web-cm1", - "items": [ - { - "key": "a.key", - "path": "test-a-key.key" - } - ] - } - } - ], - "containers": [ - { - "name": "web", - "image": " ", - "resources": {}, - "volumeMounts": [ - { - "name": "web-cm0", - "mountPath": "/etc/tls" - }, - { - "name": "web-cm1", - "mountPath": "/etc/test-a-key.key", - "subPath": "test-a-key.key" - } - ] - } - ], - "restartPolicy": "Always" - } - } - }, - "status": { - "latestVersion": 0, - "observedGeneration": 0, - "replicas": 0, - "updatedReplicas": 0, - "availableReplicas": 0, - "unavailableReplicas": 0 - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "web", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "spec": { - "lookupPolicy": { - "local": false - }, - "tags": [ - { - "name": "latest", - "annotations": null, - "from": { - "kind": "DockerImage", - "name": "nginx" - }, - "generation": null, - "importPolicy": {}, - "referencePolicy": { - "type": "" - } - } - ] - }, - "status": { - "dockerImageRepository": "" - } - }, - { - "kind": "ConfigMap", - "apiVersion": "v1", - "metadata": { - "name": "web-cm0", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - } - }, - "data": { - "a.crt": "test-crt-data...", - "a.key": "test-key-data...." - } - }, - { - "kind": "ConfigMap", - "apiVersion": "v1", - "metadata": { - "name": "web-cm1", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "web" - }, - "annotations": { - "use-subpath": "true" - } - }, - "data": { - "a.key": "test-key-data...." - } - } - ] -} diff --git a/script/test/fixtures/multiple-type-volumes/output-os.yaml b/script/test/fixtures/multiple-type-volumes/output-os.yaml new file mode 100644 index 00000000..7433f320 --- /dev/null +++ b/script/test/fixtures/multiple-type-volumes/output-os.yaml @@ -0,0 +1,206 @@ +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + annotations: + kompose.volume.type: persistentVolumeClaim + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + replicas: 1 + selector: + io.kompose.service: db + strategy: + resources: {} + type: Recreate + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: db + spec: + containers: + - image: ' ' + name: db + resources: {} + volumeMounts: + - mountPath: /var/lib/mysql + name: db-data + restartPolicy: Always + volumes: + - name: db-data + persistentVolumeClaim: + claimName: db-data + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - db + from: + kind: ImageStreamTag + name: db:latest + type: ImageChange +status: + availableReplicas: 0 + latestVersion: 0 + observedGeneration: 0 + replicas: 0 + unavailableReplicas: 0 + updatedReplicas: 0 + +--- +apiVersion: v1 +kind: ImageStream +metadata: + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + lookupPolicy: + local: false + tags: + - annotations: null + from: + kind: DockerImage + name: mysql + generation: null + importPolicy: {} + name: latest + referencePolicy: + type: "" +status: + dockerImageRepository: "" + +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + io.kompose.service: db-data + name: db-data +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +status: {} + +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + annotations: + kompose.volume.type: configMap + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + replicas: 1 + selector: + io.kompose.service: web + strategy: + resources: {} + type: Recreate + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: web + spec: + containers: + - image: ' ' + name: web + resources: {} + volumeMounts: + - mountPath: /etc/tls + name: web-cm0 + - mountPath: /etc/test-a-key.key + name: web-cm1 + subPath: test-a-key.key + restartPolicy: Always + volumes: + - configMap: + name: web-cm0 + name: web-cm0 + - configMap: + items: + - key: a.key + path: test-a-key.key + name: web-cm1 + name: web-cm1 + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - web + from: + kind: ImageStreamTag + name: web:latest + type: ImageChange +status: + availableReplicas: 0 + latestVersion: 0 + observedGeneration: 0 + replicas: 0 + unavailableReplicas: 0 + updatedReplicas: 0 + +--- +apiVersion: v1 +kind: ImageStream +metadata: + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + lookupPolicy: + local: false + tags: + - annotations: null + from: + kind: DockerImage + name: nginx + generation: null + importPolicy: {} + name: latest + referencePolicy: + type: "" +status: + dockerImageRepository: "" + +--- +apiVersion: v1 +data: + a.crt: test-crt-data... + a.key: test-key-data.... +kind: ConfigMap +metadata: + creationTimestamp: null + labels: + io.kompose.service: web + name: web-cm0 + +--- +apiVersion: v1 +data: + a.key: test-key-data.... +kind: ConfigMap +metadata: + annotations: + use-subpath: "true" + creationTimestamp: null + labels: + io.kompose.service: web + name: web-cm1 + diff --git a/script/test/fixtures/service-group/output-k8s.json b/script/test/fixtures/service-group/output-k8s.json deleted file mode 100644 index 710d460d..00000000 --- a/script/test/fixtures/service-group/output-k8s.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "librenms", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "librenms-dispatcher" - } - }, - "spec": { - "ports": [ - { - "name": "8000", - "port": 8000, - "targetPort": 8000 - } - ], - "selector": { - "io.kompose.service": "librenms-dispatcher" - } - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "Deployment", - "apiVersion": "apps/v1", - "metadata": { - "name": "librenms-dispatcher", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "librenms-dispatcher" - } - }, - "spec": { - "replicas": 1, - "selector": { - "matchLabels": { - "io.kompose.service": "librenms-dispatcher" - } - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "librenms-dispatcher" - } - }, - "spec": { - "volumes": [ - { - "name": "librenms-dispatcher-claim0", - "persistentVolumeClaim": { - "claimName": "librenms-dispatcher-claim0" - } - } - ], - "containers": [ - { - "name": "librenms", - "image": "librenms/librenms:latest", - "ports": [ - { - "containerPort": 8000 - } - ], - "env": [ - { - "name": "TZ", - "value": "${TZ}" - } - ], - "resources": {}, - "volumeMounts": [ - { - "name": "librenms-dispatcher-claim0", - "mountPath": "/data" - } - ] - }, - { - "name": "dispatcher", - "image": "librenms/dispatcher:latest", - "env": [ - { - "name": "TZ", - "value": "${TZ}" - } - ], - "resources": {}, - "volumeMounts": [ - { - "name": "librenms-dispatcher-claim0", - "mountPath": "/data" - } - ] - } - ], - "restartPolicy": "Always", - "hostname": "dispatcher" - } - }, - "strategy": { - "type": "Recreate" - } - }, - "status": {} - }, - { - "kind": "PersistentVolumeClaim", - "apiVersion": "v1", - "metadata": { - "name": "librenms-dispatcher-claim0", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "librenms-dispatcher-claim0" - } - }, - "spec": { - "accessModes": [ - "ReadWriteOnce" - ], - "resources": { - "requests": { - "storage": "100Mi" - } - } - }, - "status": {} - } - ] -} diff --git a/script/test/fixtures/service-group/output-k8s.yaml b/script/test/fixtures/service-group/output-k8s.yaml new file mode 100644 index 00000000..542df687 --- /dev/null +++ b/script/test/fixtures/service-group/output-k8s.yaml @@ -0,0 +1,84 @@ +--- +apiVersion: v1 +kind: Service +metadata: + creationTimestamp: null + labels: + io.kompose.service: librenms-dispatcher + name: librenms +spec: + ports: + - name: "8000" + port: 8000 + targetPort: 8000 + selector: + io.kompose.service: librenms-dispatcher +status: + loadBalancer: {} + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + creationTimestamp: null + labels: + io.kompose.service: librenms-dispatcher + name: librenms-dispatcher +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: librenms-dispatcher + strategy: + type: Recreate + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: librenms-dispatcher + spec: + containers: + - env: + - name: TZ + value: ${TZ} + image: librenms/librenms:latest + name: librenms + ports: + - containerPort: 8000 + resources: {} + volumeMounts: + - mountPath: /data + name: librenms-dispatcher-claim0 + - env: + - name: TZ + value: ${TZ} + image: librenms/dispatcher:latest + name: dispatcher + resources: {} + volumeMounts: + - mountPath: /data + name: librenms-dispatcher-claim0 + hostname: dispatcher + restartPolicy: Always + volumes: + - name: librenms-dispatcher-claim0 + persistentVolumeClaim: + claimName: librenms-dispatcher-claim0 +status: {} + +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + io.kompose.service: librenms-dispatcher-claim0 + name: librenms-dispatcher-claim0 +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +status: {} + diff --git a/script/test/fixtures/single-file-output/docker-compose.yaml b/script/test/fixtures/single-file-output/docker-compose.yaml new file mode 100644 index 00000000..bce8a977 --- /dev/null +++ b/script/test/fixtures/single-file-output/docker-compose.yaml @@ -0,0 +1,12 @@ +version: "3.8" + +services: + front_end: + image: gcr.io/google-samples/gb-frontend:v4 + ports: + - "80:80" + environment: + - GET_HOSTS_FROM=dns + labels: + kompose.service.expose: lb + kompose.service.expose.ingress-class-name: nginx diff --git a/script/test/fixtures/single-file-output/output-k8s.yaml b/script/test/fixtures/single-file-output/output-k8s.yaml new file mode 100644 index 00000000..da456831 --- /dev/null +++ b/script/test/fixtures/single-file-output/output-k8s.yaml @@ -0,0 +1,85 @@ +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.service.expose: lb + kompose.service.expose.ingress-class-name: nginx + creationTimestamp: null + labels: + io.kompose.service: front-end + name: front_end +spec: + ports: + - name: "80" + port: 80 + targetPort: 80 + selector: + io.kompose.service: front-end +status: + loadBalancer: {} + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.service.expose: lb + kompose.service.expose.ingress-class-name: nginx + creationTimestamp: null + labels: + io.kompose.service: front-end + name: front-end +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: front-end + strategy: {} + template: + metadata: + annotations: + kompose.service.expose: lb + kompose.service.expose.ingress-class-name: nginx + creationTimestamp: null + labels: + io.kompose.service: front-end + spec: + containers: + - env: + - name: GET_HOSTS_FROM + value: dns + image: gcr.io/google-samples/gb-frontend:v4 + name: front-end + ports: + - containerPort: 80 + resources: {} + restartPolicy: Always +status: {} + +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + kompose.service.expose: lb + kompose.service.expose.ingress-class-name: nginx + creationTimestamp: null + labels: + io.kompose.service: front-end + name: front-end +spec: + ingressClassName: nginx + rules: + - host: lb + http: + paths: + - backend: + service: + name: front-end + port: + number: 80 + path: / + pathType: Prefix +status: + loadBalancer: {} diff --git a/script/test/fixtures/statefulset/output-k8s.json b/script/test/fixtures/statefulset/output-k8s.json deleted file mode 100644 index 5c1e339a..00000000 --- a/script/test/fixtures/statefulset/output-k8s.json +++ /dev/null @@ -1,249 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "db", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - } - }, - "spec": { - "ports": [ - { - "name": "3306", - "port": 3306, - "targetPort": 3306 - } - ], - "selector": { - "io.kompose.service": "db" - }, - "clusterIP": "None", - "type": "ClusterIP" - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "wordpress", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "wordpress" - } - }, - "spec": { - "ports": [ - { - "name": "8000", - "port": 8000, - "targetPort": 80 - } - ], - "selector": { - "io.kompose.service": "wordpress" - }, - "clusterIP": "None", - "type": "ClusterIP" - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "StatefulSet", - "apiVersion": "apps/v1", - "metadata": { - "name": "db", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - } - }, - "spec": { - "replicas": 1, - "selector": { - "matchLabels": { - "io.kompose.service": "db" - } - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - } - }, - "spec": { - "containers": [ - { - "name": "db", - "image": "mysql:5.7", - "ports": [ - { - "containerPort": 3306 - } - ], - "env": [ - { - "name": "MYSQL_DATABASE", - "value": "wordpress" - }, - { - "name": "MYSQL_PASSWORD", - "value": "wordpress" - }, - { - "name": "MYSQL_ROOT_PASSWORD", - "value": "somewordpress" - }, - { - "name": "MYSQL_USER", - "value": "wordpress" - } - ], - "resources": {}, - "volumeMounts": [ - { - "name": "db-data", - "mountPath": "/var/lib/mysql" - } - ] - } - ], - "restartPolicy": "Always" - } - }, - "volumeClaimTemplates": [ - { - "metadata": { - "name": "db-data", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db-data" - } - }, - "spec": { - "accessModes": [ - "ReadWriteOnce" - ], - "resources": { - "requests": { - "storage": "100Mi" - } - } - }, - "status": {} - } - ], - "serviceName": "db", - "updateStrategy": {} - }, - "status": { - "replicas": 0 - } - }, - { - "kind": "StatefulSet", - "apiVersion": "apps/v1", - "metadata": { - "name": "wordpress", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "wordpress" - } - }, - "spec": { - "replicas": 1, - "selector": { - "matchLabels": { - "io.kompose.service": "wordpress" - } - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "wordpress" - } - }, - "spec": { - "containers": [ - { - "name": "wordpress", - "image": "wordpress:latest", - "ports": [ - { - "containerPort": 80 - } - ], - "env": [ - { - "name": "WORDPRESS_DB_HOST", - "value": "db:3306" - }, - { - "name": "WORDPRESS_DB_NAME", - "value": "wordpress" - }, - { - "name": "WORDPRESS_DB_PASSWORD", - "value": "wordpress" - }, - { - "name": "WORDPRESS_DB_USER", - "value": "wordpress" - } - ], - "resources": {}, - "volumeMounts": [ - { - "name": "wordpress-data", - "mountPath": "/var/www/html" - } - ] - } - ], - "restartPolicy": "Always" - } - }, - "volumeClaimTemplates": [ - { - "metadata": { - "name": "wordpress-data", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "wordpress-data" - } - }, - "spec": { - "accessModes": [ - "ReadWriteOnce" - ], - "resources": { - "requests": { - "storage": "100Mi" - } - } - }, - "status": {} - } - ], - "serviceName": "wordpress", - "updateStrategy": {} - }, - "status": { - "replicas": 0 - } - } - ] -} diff --git a/script/test/fixtures/statefulset/output-k8s.yaml b/script/test/fixtures/statefulset/output-k8s.yaml new file mode 100644 index 00000000..92506241 --- /dev/null +++ b/script/test/fixtures/statefulset/output-k8s.yaml @@ -0,0 +1,152 @@ +--- +apiVersion: v1 +kind: Service +metadata: + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + clusterIP: None + ports: + - name: "3306" + port: 3306 + targetPort: 3306 + selector: + io.kompose.service: db + type: ClusterIP +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: Service +metadata: + creationTimestamp: null + labels: + io.kompose.service: wordpress + name: wordpress +spec: + clusterIP: None + ports: + - name: "8000" + port: 8000 + targetPort: 80 + selector: + io.kompose.service: wordpress + type: ClusterIP +status: + loadBalancer: {} + +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: db + serviceName: db + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: db + spec: + containers: + - env: + - name: MYSQL_DATABASE + value: wordpress + - name: MYSQL_PASSWORD + value: wordpress + - name: MYSQL_ROOT_PASSWORD + value: somewordpress + - name: MYSQL_USER + value: wordpress + image: mysql:5.7 + name: db + ports: + - containerPort: 3306 + resources: {} + volumeMounts: + - mountPath: /var/lib/mysql + name: db-data + restartPolicy: Always + updateStrategy: {} + volumeClaimTemplates: + - metadata: + creationTimestamp: null + labels: + io.kompose.service: db-data + name: db-data + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi + status: {} +status: + replicas: 0 + +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + creationTimestamp: null + labels: + io.kompose.service: wordpress + name: wordpress +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: wordpress + serviceName: wordpress + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: wordpress + spec: + containers: + - env: + - name: WORDPRESS_DB_HOST + value: db:3306 + - name: WORDPRESS_DB_NAME + value: wordpress + - name: WORDPRESS_DB_PASSWORD + value: wordpress + - name: WORDPRESS_DB_USER + value: wordpress + image: wordpress:latest + name: wordpress + ports: + - containerPort: 80 + resources: {} + volumeMounts: + - mountPath: /var/www/html + name: wordpress-data + restartPolicy: Always + updateStrategy: {} + volumeClaimTemplates: + - metadata: + creationTimestamp: null + labels: + io.kompose.service: wordpress-data + name: wordpress-data + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi + status: {} +status: + replicas: 0 + diff --git a/script/test/fixtures/statefulset/output-os.json b/script/test/fixtures/statefulset/output-os.json deleted file mode 100644 index 25b2881c..00000000 --- a/script/test/fixtures/statefulset/output-os.json +++ /dev/null @@ -1,503 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "db", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - } - }, - "spec": { - "ports": [ - { - "name": "3306", - "port": 3306, - "targetPort": 3306 - } - ], - "selector": { - "io.kompose.service": "db" - } - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "wordpress", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "wordpress" - } - }, - "spec": { - "ports": [ - { - "name": "8000", - "port": 8000, - "targetPort": 80 - } - ], - "selector": { - "io.kompose.service": "wordpress" - } - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "StatefulSet", - "apiVersion": "apps/v1", - "metadata": { - "name": "db", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - } - }, - "spec": { - "replicas": 1, - "selector": { - "matchLabels": { - "io.kompose.service": "db" - } - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - } - }, - "spec": { - "containers": [ - { - "name": "db", - "image": "mysql:5.7", - "ports": [ - { - "containerPort": 3306 - } - ], - "env": [ - { - "name": "MYSQL_DATABASE", - "value": "wordpress" - }, - { - "name": "MYSQL_PASSWORD", - "value": "wordpress" - }, - { - "name": "MYSQL_ROOT_PASSWORD", - "value": "somewordpress" - }, - { - "name": "MYSQL_USER", - "value": "wordpress" - } - ], - "resources": {}, - "volumeMounts": [ - { - "name": "db-data", - "mountPath": "/var/lib/mysql" - } - ] - } - ], - "restartPolicy": "Always" - } - }, - "volumeClaimTemplates": [ - { - "metadata": { - "name": "db-data", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db-data" - } - }, - "spec": { - "accessModes": [ - "ReadWriteOnce" - ], - "resources": { - "requests": { - "storage": "100Mi" - } - } - }, - "status": {} - } - ], - "serviceName": "db", - "updateStrategy": {} - }, - "status": { - "replicas": 0 - } - }, - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "db", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - } - }, - "spec": { - "strategy": { - "type": "Recreate", - "resources": {} - }, - "triggers": [ - { - "type": "ConfigChange" - }, - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "db" - ], - "from": { - "kind": "ImageStreamTag", - "name": "db:5.7" - } - } - } - ], - "replicas": 1, - "test": false, - "selector": { - "io.kompose.service": "db" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - } - }, - "spec": { - "containers": [ - { - "name": "db", - "image": " ", - "ports": [ - { - "containerPort": 3306 - } - ], - "env": [ - { - "name": "MYSQL_DATABASE", - "value": "wordpress" - }, - { - "name": "MYSQL_PASSWORD", - "value": "wordpress" - }, - { - "name": "MYSQL_ROOT_PASSWORD", - "value": "somewordpress" - }, - { - "name": "MYSQL_USER", - "value": "wordpress" - } - ], - "resources": {}, - "volumeMounts": [ - { - "name": "db-data", - "mountPath": "/var/lib/mysql" - } - ] - } - ], - "restartPolicy": "Always" - } - } - }, - "status": { - "latestVersion": 0, - "observedGeneration": 0, - "replicas": 0, - "updatedReplicas": 0, - "availableReplicas": 0, - "unavailableReplicas": 0 - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "db", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - } - }, - "spec": { - "lookupPolicy": { - "local": false - }, - "tags": [ - { - "name": "5.7", - "annotations": null, - "from": { - "kind": "DockerImage", - "name": "mysql:5.7" - }, - "generation": null, - "importPolicy": {}, - "referencePolicy": { - "type": "" - } - } - ] - }, - "status": { - "dockerImageRepository": "" - } - }, - { - "kind": "StatefulSet", - "apiVersion": "apps/v1", - "metadata": { - "name": "wordpress", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "wordpress" - } - }, - "spec": { - "replicas": 1, - "selector": { - "matchLabels": { - "io.kompose.service": "wordpress" - } - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "wordpress" - } - }, - "spec": { - "containers": [ - { - "name": "wordpress", - "image": "wordpress:latest", - "ports": [ - { - "containerPort": 80 - } - ], - "env": [ - { - "name": "WORDPRESS_DB_HOST", - "value": "db:3306" - }, - { - "name": "WORDPRESS_DB_NAME", - "value": "wordpress" - }, - { - "name": "WORDPRESS_DB_PASSWORD", - "value": "wordpress" - }, - { - "name": "WORDPRESS_DB_USER", - "value": "wordpress" - } - ], - "resources": {}, - "volumeMounts": [ - { - "name": "wordpress-data", - "mountPath": "/var/www/html" - } - ] - } - ], - "restartPolicy": "Always" - } - }, - "volumeClaimTemplates": [ - { - "metadata": { - "name": "wordpress-data", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "wordpress-data" - } - }, - "spec": { - "accessModes": [ - "ReadWriteOnce" - ], - "resources": { - "requests": { - "storage": "100Mi" - } - } - }, - "status": {} - } - ], - "serviceName": "wordpress", - "updateStrategy": {} - }, - "status": { - "replicas": 0 - } - }, - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "wordpress", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "wordpress" - } - }, - "spec": { - "strategy": { - "type": "Recreate", - "resources": {} - }, - "triggers": [ - { - "type": "ConfigChange" - }, - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "wordpress" - ], - "from": { - "kind": "ImageStreamTag", - "name": "wordpress:latest" - } - } - } - ], - "replicas": 1, - "test": false, - "selector": { - "io.kompose.service": "wordpress" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "wordpress" - } - }, - "spec": { - "containers": [ - { - "name": "wordpress", - "image": " ", - "ports": [ - { - "containerPort": 80 - } - ], - "env": [ - { - "name": "WORDPRESS_DB_HOST", - "value": "db:3306" - }, - { - "name": "WORDPRESS_DB_NAME", - "value": "wordpress" - }, - { - "name": "WORDPRESS_DB_PASSWORD", - "value": "wordpress" - }, - { - "name": "WORDPRESS_DB_USER", - "value": "wordpress" - } - ], - "resources": {}, - "volumeMounts": [ - { - "name": "wordpress-data", - "mountPath": "/var/www/html" - } - ] - } - ], - "restartPolicy": "Always" - } - } - }, - "status": { - "latestVersion": 0, - "observedGeneration": 0, - "replicas": 0, - "updatedReplicas": 0, - "availableReplicas": 0, - "unavailableReplicas": 0 - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "wordpress", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "wordpress" - } - }, - "spec": { - "lookupPolicy": { - "local": false - }, - "tags": [ - { - "name": "latest", - "annotations": null, - "from": { - "kind": "DockerImage", - "name": "wordpress:latest" - }, - "generation": null, - "importPolicy": {}, - "referencePolicy": { - "type": "" - } - } - ] - }, - "status": { - "dockerImageRepository": "" - } - } - ] -} diff --git a/script/test/fixtures/statefulset/output-os.yaml b/script/test/fixtures/statefulset/output-os.yaml new file mode 100644 index 00000000..5e3a742a --- /dev/null +++ b/script/test/fixtures/statefulset/output-os.yaml @@ -0,0 +1,314 @@ +--- +apiVersion: v1 +kind: Service +metadata: + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + ports: + - name: "3306" + port: 3306 + targetPort: 3306 + selector: + io.kompose.service: db +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: Service +metadata: + creationTimestamp: null + labels: + io.kompose.service: wordpress + name: wordpress +spec: + ports: + - name: "8000" + port: 8000 + targetPort: 80 + selector: + io.kompose.service: wordpress +status: + loadBalancer: {} + +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: db + serviceName: db + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: db + spec: + containers: + - env: + - name: MYSQL_DATABASE + value: wordpress + - name: MYSQL_PASSWORD + value: wordpress + - name: MYSQL_ROOT_PASSWORD + value: somewordpress + - name: MYSQL_USER + value: wordpress + image: mysql:5.7 + name: db + ports: + - containerPort: 3306 + resources: {} + volumeMounts: + - mountPath: /var/lib/mysql + name: db-data + restartPolicy: Always + updateStrategy: {} + volumeClaimTemplates: + - metadata: + creationTimestamp: null + labels: + io.kompose.service: db-data + name: db-data + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi + status: {} +status: + replicas: 0 + +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + replicas: 1 + selector: + io.kompose.service: db + strategy: + resources: {} + type: Recreate + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: db + spec: + containers: + - env: + - name: MYSQL_DATABASE + value: wordpress + - name: MYSQL_PASSWORD + value: wordpress + - name: MYSQL_ROOT_PASSWORD + value: somewordpress + - name: MYSQL_USER + value: wordpress + image: ' ' + name: db + ports: + - containerPort: 3306 + resources: {} + volumeMounts: + - mountPath: /var/lib/mysql + name: db-data + restartPolicy: Always + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - db + from: + kind: ImageStreamTag + name: db:5.7 + type: ImageChange +status: + availableReplicas: 0 + latestVersion: 0 + observedGeneration: 0 + replicas: 0 + unavailableReplicas: 0 + updatedReplicas: 0 + +--- +apiVersion: v1 +kind: ImageStream +metadata: + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + lookupPolicy: + local: false + tags: + - annotations: null + from: + kind: DockerImage + name: mysql:5.7 + generation: null + importPolicy: {} + name: "5.7" + referencePolicy: + type: "" +status: + dockerImageRepository: "" + +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + creationTimestamp: null + labels: + io.kompose.service: wordpress + name: wordpress +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: wordpress + serviceName: wordpress + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: wordpress + spec: + containers: + - env: + - name: WORDPRESS_DB_HOST + value: db:3306 + - name: WORDPRESS_DB_NAME + value: wordpress + - name: WORDPRESS_DB_PASSWORD + value: wordpress + - name: WORDPRESS_DB_USER + value: wordpress + image: wordpress:latest + name: wordpress + ports: + - containerPort: 80 + resources: {} + volumeMounts: + - mountPath: /var/www/html + name: wordpress-data + restartPolicy: Always + updateStrategy: {} + volumeClaimTemplates: + - metadata: + creationTimestamp: null + labels: + io.kompose.service: wordpress-data + name: wordpress-data + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi + status: {} +status: + replicas: 0 + +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + creationTimestamp: null + labels: + io.kompose.service: wordpress + name: wordpress +spec: + replicas: 1 + selector: + io.kompose.service: wordpress + strategy: + resources: {} + type: Recreate + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: wordpress + spec: + containers: + - env: + - name: WORDPRESS_DB_HOST + value: db:3306 + - name: WORDPRESS_DB_NAME + value: wordpress + - name: WORDPRESS_DB_PASSWORD + value: wordpress + - name: WORDPRESS_DB_USER + value: wordpress + image: ' ' + name: wordpress + ports: + - containerPort: 80 + resources: {} + volumeMounts: + - mountPath: /var/www/html + name: wordpress-data + restartPolicy: Always + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - wordpress + from: + kind: ImageStreamTag + name: wordpress:latest + type: ImageChange +status: + availableReplicas: 0 + latestVersion: 0 + observedGeneration: 0 + replicas: 0 + unavailableReplicas: 0 + updatedReplicas: 0 + +--- +apiVersion: v1 +kind: ImageStream +metadata: + creationTimestamp: null + labels: + io.kompose.service: wordpress + name: wordpress +spec: + lookupPolicy: + local: false + tags: + - annotations: null + from: + kind: DockerImage + name: wordpress:latest + generation: null + importPolicy: {} + name: latest + referencePolicy: + type: "" +status: + dockerImageRepository: "" + diff --git a/script/test/fixtures/v2/output-k8s.json b/script/test/fixtures/v2/output-k8s.json deleted file mode 100644 index bf82482e..00000000 --- a/script/test/fixtures/v2/output-k8s.json +++ /dev/null @@ -1,397 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "foo", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "foo" - } - }, - "spec": { - "ports": [ - { - "name": "6379", - "port": 6379, - "targetPort": 6379 - }, - { - "name": "6379-udp", - "protocol": "UDP", - "port": 6379, - "targetPort": 6379 - }, - { - "name": "3000", - "port": 3000, - "targetPort": 3000 - }, - { - "name": "3000-tcp", - "port": 3000, - "targetPort": 3000 - }, - { - "name": "3001", - "port": 3001, - "targetPort": 3001 - }, - { - "name": "3002", - "port": 3002, - "targetPort": 3002 - }, - { - "name": "3003", - "port": 3003, - "targetPort": 3003 - }, - { - "name": "3004", - "port": 3004, - "targetPort": 3004 - }, - { - "name": "3005", - "port": 3005, - "targetPort": 3005 - }, - { - "name": "8000", - "port": 8000, - "targetPort": 8000 - }, - { - "name": "9090", - "port": 9090, - "targetPort": 8080 - }, - { - "name": "9091", - "port": 9091, - "targetPort": 8081 - }, - { - "name": "49100", - "port": 49100, - "targetPort": 22 - }, - { - "name": "8001", - "port": 8001, - "targetPort": 8001 - }, - { - "name": "5000", - "port": 5000, - "targetPort": 5000 - }, - { - "name": "5001", - "port": 5001, - "targetPort": 5001 - }, - { - "name": "5002", - "port": 5002, - "targetPort": 5002 - }, - { - "name": "5003", - "port": 5003, - "targetPort": 5003 - }, - { - "name": "5004", - "port": 5004, - "targetPort": 5004 - }, - { - "name": "5005", - "port": 5005, - "targetPort": 5005 - }, - { - "name": "5006", - "port": 5006, - "targetPort": 5006 - }, - { - "name": "5007", - "port": 5007, - "targetPort": 5007 - }, - { - "name": "5008", - "port": 5008, - "targetPort": 5008 - }, - { - "name": "5009", - "port": 5009, - "targetPort": 5009 - }, - { - "name": "5010", - "port": 5010, - "targetPort": 5010 - } - ], - "selector": { - "io.kompose.service": "foo" - } - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "redis-tcp", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis-tcp" - }, - "annotations": { - "kompose.service.type": "loadbalancer" - } - }, - "spec": { - "ports": [ - { - "name": "6379", - "port": 6379, - "targetPort": 6379 - } - ], - "selector": { - "io.kompose.service": "redis" - }, - "type": "LoadBalancer" - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "redis-udp", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis-udp" - }, - "annotations": { - "kompose.service.type": "loadbalancer" - } - }, - "spec": { - "ports": [ - { - "name": "1234", - "protocol": "UDP", - "port": 1234, - "targetPort": 1235 - } - ], - "selector": { - "io.kompose.service": "redis" - }, - "type": "LoadBalancer" - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "Pod", - "apiVersion": "v1", - "metadata": { - "name": "foo", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "foo" - } - }, - "spec": { - "containers": [ - { - "name": "foo", - "image": "foobar", - "ports": [ - { - "containerPort": 6379 - }, - { - "containerPort": 6379, - "protocol": "UDP" - }, - { - "containerPort": 3000 - }, - { - "containerPort": 3001 - }, - { - "containerPort": 3002 - }, - { - "containerPort": 3003 - }, - { - "containerPort": 3004 - }, - { - "containerPort": 3005 - }, - { - "containerPort": 8000 - }, - { - "containerPort": 8080 - }, - { - "containerPort": 8081 - }, - { - "containerPort": 22 - }, - { - "containerPort": 8001, - "hostIP": "127.0.0.1" - }, - { - "containerPort": 5000, - "hostIP": "127.0.0.1" - }, - { - "containerPort": 5001, - "hostIP": "127.0.0.1" - }, - { - "containerPort": 5002, - "hostIP": "127.0.0.1" - }, - { - "containerPort": 5003, - "hostIP": "127.0.0.1" - }, - { - "containerPort": 5004, - "hostIP": "127.0.0.1" - }, - { - "containerPort": 5005, - "hostIP": "127.0.0.1" - }, - { - "containerPort": 5006, - "hostIP": "127.0.0.1" - }, - { - "containerPort": 5007, - "hostIP": "127.0.0.1" - }, - { - "containerPort": 5008, - "hostIP": "127.0.0.1" - }, - { - "containerPort": 5009, - "hostIP": "127.0.0.1" - }, - { - "containerPort": 5010, - "hostIP": "127.0.0.1" - } - ], - "env": [ - { - "name": "GITHUB", - "value": "surajssd" - } - ], - "resources": { - "limits": { - "memory": "10e3" - } - } - } - ], - "restartPolicy": "Never", - "securityContext": { - "supplementalGroups": [ - 1234 - ] - } - }, - "status": {} - }, - { - "kind": "Deployment", - "apiVersion": "apps/v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - }, - "annotations": { - "kompose.service.type": "loadbalancer" - } - }, - "spec": { - "replicas": 1, - "selector": { - "matchLabels": { - "io.kompose.service": "redis" - } - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - }, - "annotations": { - "kompose.service.type": "loadbalancer" - } - }, - "spec": { - "containers": [ - { - "name": "redis", - "image": "redis:3.0", - "ports": [ - { - "containerPort": 6379 - }, - { - "containerPort": 1235, - "protocol": "UDP" - } - ], - "resources": { - "limits": { - "memory": "10485760e3" - } - } - } - ], - "restartPolicy": "Always" - } - }, - "strategy": {} - }, - "status": {} - } - ] -} diff --git a/script/test/fixtures/v2/output-k8s.yaml b/script/test/fixtures/v2/output-k8s.yaml new file mode 100644 index 00000000..e92a6965 --- /dev/null +++ b/script/test/fixtures/v2/output-k8s.yaml @@ -0,0 +1,233 @@ +--- +apiVersion: v1 +kind: Service +metadata: + creationTimestamp: null + labels: + io.kompose.service: foo + name: foo +spec: + ports: + - name: "6379" + port: 6379 + targetPort: 6379 + - name: 6379-udp + port: 6379 + protocol: UDP + targetPort: 6379 + - name: "3000" + port: 3000 + targetPort: 3000 + - name: 3000-tcp + port: 3000 + targetPort: 3000 + - name: "3001" + port: 3001 + targetPort: 3001 + - name: "3002" + port: 3002 + targetPort: 3002 + - name: "3003" + port: 3003 + targetPort: 3003 + - name: "3004" + port: 3004 + targetPort: 3004 + - name: "3005" + port: 3005 + targetPort: 3005 + - name: "8000" + port: 8000 + targetPort: 8000 + - name: "9090" + port: 9090 + targetPort: 8080 + - name: "9091" + port: 9091 + targetPort: 8081 + - name: "49100" + port: 49100 + targetPort: 22 + - name: "8001" + port: 8001 + targetPort: 8001 + - name: "5000" + port: 5000 + targetPort: 5000 + - name: "5001" + port: 5001 + targetPort: 5001 + - name: "5002" + port: 5002 + targetPort: 5002 + - name: "5003" + port: 5003 + targetPort: 5003 + - name: "5004" + port: 5004 + targetPort: 5004 + - name: "5005" + port: 5005 + targetPort: 5005 + - name: "5006" + port: 5006 + targetPort: 5006 + - name: "5007" + port: 5007 + targetPort: 5007 + - name: "5008" + port: 5008 + targetPort: 5008 + - name: "5009" + port: 5009 + targetPort: 5009 + - name: "5010" + port: 5010 + targetPort: 5010 + selector: + io.kompose.service: foo +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.service.type: loadbalancer + creationTimestamp: null + labels: + io.kompose.service: redis-tcp + name: redis-tcp +spec: + ports: + - name: "6379" + port: 6379 + targetPort: 6379 + selector: + io.kompose.service: redis + type: LoadBalancer +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.service.type: loadbalancer + creationTimestamp: null + labels: + io.kompose.service: redis-udp + name: redis-udp +spec: + ports: + - name: "1234" + port: 1234 + protocol: UDP + targetPort: 1235 + selector: + io.kompose.service: redis + type: LoadBalancer +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: Pod +metadata: + creationTimestamp: null + labels: + io.kompose.service: foo + name: foo +spec: + containers: + - env: + - name: GITHUB + value: surajssd + image: foobar + name: foo + ports: + - containerPort: 6379 + - containerPort: 6379 + protocol: UDP + - containerPort: 3000 + - containerPort: 3001 + - containerPort: 3002 + - containerPort: 3003 + - containerPort: 3004 + - containerPort: 3005 + - containerPort: 8000 + - containerPort: 8080 + - containerPort: 8081 + - containerPort: 22 + - containerPort: 8001 + hostIP: 127.0.0.1 + - containerPort: 5000 + hostIP: 127.0.0.1 + - containerPort: 5001 + hostIP: 127.0.0.1 + - containerPort: 5002 + hostIP: 127.0.0.1 + - containerPort: 5003 + hostIP: 127.0.0.1 + - containerPort: 5004 + hostIP: 127.0.0.1 + - containerPort: 5005 + hostIP: 127.0.0.1 + - containerPort: 5006 + hostIP: 127.0.0.1 + - containerPort: 5007 + hostIP: 127.0.0.1 + - containerPort: 5008 + hostIP: 127.0.0.1 + - containerPort: 5009 + hostIP: 127.0.0.1 + - containerPort: 5010 + hostIP: 127.0.0.1 + resources: + limits: + memory: "10e3" + restartPolicy: Never + securityContext: + supplementalGroups: + - 1234 +status: {} + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.service.type: loadbalancer + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: redis + strategy: {} + template: + metadata: + annotations: + kompose.service.type: loadbalancer + creationTimestamp: null + labels: + io.kompose.service: redis + spec: + containers: + - image: redis:3.0 + name: redis + ports: + - containerPort: 6379 + - containerPort: 1235 + protocol: UDP + resources: + limits: + memory: "10485760e3" + restartPolicy: Always +status: {} + diff --git a/script/test/fixtures/v2/output-os.json b/script/test/fixtures/v2/output-os.json deleted file mode 100644 index a253e67f..00000000 --- a/script/test/fixtures/v2/output-os.json +++ /dev/null @@ -1,454 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "foo", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "foo" - } - }, - "spec": { - "ports": [ - { - "name": "6379", - "port": 6379, - "targetPort": 6379 - }, - { - "name": "6379-udp", - "protocol": "UDP", - "port": 6379, - "targetPort": 6379 - }, - { - "name": "3000", - "port": 3000, - "targetPort": 3000 - }, - { - "name": "3000-tcp", - "port": 3000, - "targetPort": 3000 - }, - { - "name": "3001", - "port": 3001, - "targetPort": 3001 - }, - { - "name": "3002", - "port": 3002, - "targetPort": 3002 - }, - { - "name": "3003", - "port": 3003, - "targetPort": 3003 - }, - { - "name": "3004", - "port": 3004, - "targetPort": 3004 - }, - { - "name": "3005", - "port": 3005, - "targetPort": 3005 - }, - { - "name": "8000", - "port": 8000, - "targetPort": 8000 - }, - { - "name": "9090", - "port": 9090, - "targetPort": 8080 - }, - { - "name": "9091", - "port": 9091, - "targetPort": 8081 - }, - { - "name": "49100", - "port": 49100, - "targetPort": 22 - }, - { - "name": "8001", - "port": 8001, - "targetPort": 8001 - }, - { - "name": "5000", - "port": 5000, - "targetPort": 5000 - }, - { - "name": "5001", - "port": 5001, - "targetPort": 5001 - }, - { - "name": "5002", - "port": 5002, - "targetPort": 5002 - }, - { - "name": "5003", - "port": 5003, - "targetPort": 5003 - }, - { - "name": "5004", - "port": 5004, - "targetPort": 5004 - }, - { - "name": "5005", - "port": 5005, - "targetPort": 5005 - }, - { - "name": "5006", - "port": 5006, - "targetPort": 5006 - }, - { - "name": "5007", - "port": 5007, - "targetPort": 5007 - }, - { - "name": "5008", - "port": 5008, - "targetPort": 5008 - }, - { - "name": "5009", - "port": 5009, - "targetPort": 5009 - }, - { - "name": "5010", - "port": 5010, - "targetPort": 5010 - } - ], - "selector": { - "io.kompose.service": "foo" - } - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "redis-tcp", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis-tcp" - }, - "annotations": { - "kompose.service.type": "loadbalancer" - } - }, - "spec": { - "ports": [ - { - "name": "6379", - "port": 6379, - "targetPort": 6379 - } - ], - "selector": { - "io.kompose.service": "redis" - }, - "type": "LoadBalancer" - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "redis-udp", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis-udp" - }, - "annotations": { - "kompose.service.type": "loadbalancer" - } - }, - "spec": { - "ports": [ - { - "name": "1234", - "protocol": "UDP", - "port": 1234, - "targetPort": 1235 - } - ], - "selector": { - "io.kompose.service": "redis" - }, - "type": "LoadBalancer" - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "Pod", - "apiVersion": "v1", - "metadata": { - "name": "foo", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "foo" - } - }, - "spec": { - "containers": [ - { - "name": "foo", - "image": "foobar", - "ports": [ - { - "containerPort": 6379 - }, - { - "containerPort": 6379, - "protocol": "UDP" - }, - { - "containerPort": 3000 - }, - { - "containerPort": 3001 - }, - { - "containerPort": 3002 - }, - { - "containerPort": 3003 - }, - { - "containerPort": 3004 - }, - { - "containerPort": 3005 - }, - { - "containerPort": 8000 - }, - { - "containerPort": 8080 - }, - { - "containerPort": 8081 - }, - { - "containerPort": 22 - }, - { - "containerPort": 8001, - "hostIP": "127.0.0.1" - }, - { - "containerPort": 5000, - "hostIP": "127.0.0.1" - }, - { - "containerPort": 5001, - "hostIP": "127.0.0.1" - }, - { - "containerPort": 5002, - "hostIP": "127.0.0.1" - }, - { - "containerPort": 5003, - "hostIP": "127.0.0.1" - }, - { - "containerPort": 5004, - "hostIP": "127.0.0.1" - }, - { - "containerPort": 5005, - "hostIP": "127.0.0.1" - }, - { - "containerPort": 5006, - "hostIP": "127.0.0.1" - }, - { - "containerPort": 5007, - "hostIP": "127.0.0.1" - }, - { - "containerPort": 5008, - "hostIP": "127.0.0.1" - }, - { - "containerPort": 5009, - "hostIP": "127.0.0.1" - }, - { - "containerPort": 5010, - "hostIP": "127.0.0.1" - } - ], - "env": [ - { - "name": "GITHUB", - "value": "surajssd" - } - ], - "resources": { - "limits": { - "memory": "10e3" - } - } - } - ], - "restartPolicy": "Never", - "securityContext": { - "supplementalGroups": [ - 1234 - ] - } - }, - "status": {} - }, - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - }, - "annotations": { - "kompose.service.type": "loadbalancer" - } - }, - "spec": { - "strategy": { - "resources": {} - }, - "triggers": [ - { - "type": "ConfigChange" - }, - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "redis" - ], - "from": { - "kind": "ImageStreamTag", - "name": "redis:3.0" - } - } - } - ], - "replicas": 1, - "test": false, - "selector": { - "io.kompose.service": "redis" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - } - }, - "spec": { - "containers": [ - { - "name": "redis", - "image": " ", - "ports": [ - { - "containerPort": 6379 - }, - { - "containerPort": 1235, - "protocol": "UDP" - } - ], - "resources": { - "limits": { - "memory": "10485760e3" - } - } - } - ], - "restartPolicy": "Always" - } - } - }, - "status": { - "latestVersion": 0, - "observedGeneration": 0, - "replicas": 0, - "updatedReplicas": 0, - "availableReplicas": 0, - "unavailableReplicas": 0 - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - } - }, - "spec": { - "lookupPolicy": { - "local": false - }, - "tags": [ - { - "name": "3.0", - "annotations": null, - "from": { - "kind": "DockerImage", - "name": "redis:3.0" - }, - "generation": null, - "importPolicy": {}, - "referencePolicy": { - "type": "" - } - } - ] - }, - "status": { - "dockerImageRepository": "" - } - } - ] -} diff --git a/script/test/fixtures/v2/output-os.yaml b/script/test/fixtures/v2/output-os.yaml new file mode 100644 index 00000000..59c230df --- /dev/null +++ b/script/test/fixtures/v2/output-os.yaml @@ -0,0 +1,272 @@ +--- +apiVersion: v1 +kind: Service +metadata: + creationTimestamp: null + labels: + io.kompose.service: foo + name: foo +spec: + ports: + - name: "6379" + port: 6379 + targetPort: 6379 + - name: 6379-udp + port: 6379 + protocol: UDP + targetPort: 6379 + - name: "3000" + port: 3000 + targetPort: 3000 + - name: 3000-tcp + port: 3000 + targetPort: 3000 + - name: "3001" + port: 3001 + targetPort: 3001 + - name: "3002" + port: 3002 + targetPort: 3002 + - name: "3003" + port: 3003 + targetPort: 3003 + - name: "3004" + port: 3004 + targetPort: 3004 + - name: "3005" + port: 3005 + targetPort: 3005 + - name: "8000" + port: 8000 + targetPort: 8000 + - name: "9090" + port: 9090 + targetPort: 8080 + - name: "9091" + port: 9091 + targetPort: 8081 + - name: "49100" + port: 49100 + targetPort: 22 + - name: "8001" + port: 8001 + targetPort: 8001 + - name: "5000" + port: 5000 + targetPort: 5000 + - name: "5001" + port: 5001 + targetPort: 5001 + - name: "5002" + port: 5002 + targetPort: 5002 + - name: "5003" + port: 5003 + targetPort: 5003 + - name: "5004" + port: 5004 + targetPort: 5004 + - name: "5005" + port: 5005 + targetPort: 5005 + - name: "5006" + port: 5006 + targetPort: 5006 + - name: "5007" + port: 5007 + targetPort: 5007 + - name: "5008" + port: 5008 + targetPort: 5008 + - name: "5009" + port: 5009 + targetPort: 5009 + - name: "5010" + port: 5010 + targetPort: 5010 + selector: + io.kompose.service: foo +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.service.type: loadbalancer + creationTimestamp: null + labels: + io.kompose.service: redis-tcp + name: redis-tcp +spec: + ports: + - name: "6379" + port: 6379 + targetPort: 6379 + selector: + io.kompose.service: redis + type: LoadBalancer +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.service.type: loadbalancer + creationTimestamp: null + labels: + io.kompose.service: redis-udp + name: redis-udp +spec: + ports: + - name: "1234" + port: 1234 + protocol: UDP + targetPort: 1235 + selector: + io.kompose.service: redis + type: LoadBalancer +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: Pod +metadata: + creationTimestamp: null + labels: + io.kompose.service: foo + name: foo +spec: + containers: + - env: + - name: GITHUB + value: surajssd + image: foobar + name: foo + ports: + - containerPort: 6379 + - containerPort: 6379 + protocol: UDP + - containerPort: 3000 + - containerPort: 3001 + - containerPort: 3002 + - containerPort: 3003 + - containerPort: 3004 + - containerPort: 3005 + - containerPort: 8000 + - containerPort: 8080 + - containerPort: 8081 + - containerPort: 22 + - containerPort: 8001 + hostIP: 127.0.0.1 + - containerPort: 5000 + hostIP: 127.0.0.1 + - containerPort: 5001 + hostIP: 127.0.0.1 + - containerPort: 5002 + hostIP: 127.0.0.1 + - containerPort: 5003 + hostIP: 127.0.0.1 + - containerPort: 5004 + hostIP: 127.0.0.1 + - containerPort: 5005 + hostIP: 127.0.0.1 + - containerPort: 5006 + hostIP: 127.0.0.1 + - containerPort: 5007 + hostIP: 127.0.0.1 + - containerPort: 5008 + hostIP: 127.0.0.1 + - containerPort: 5009 + hostIP: 127.0.0.1 + - containerPort: 5010 + hostIP: 127.0.0.1 + resources: + limits: + memory: "10e3" + restartPolicy: Never + securityContext: + supplementalGroups: + - 1234 +status: {} + +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + annotations: + kompose.service.type: loadbalancer + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + replicas: 1 + selector: + io.kompose.service: redis + strategy: + resources: {} + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: redis + spec: + containers: + - image: ' ' + name: redis + ports: + - containerPort: 6379 + - containerPort: 1235 + protocol: UDP + resources: + limits: + memory: "10485760e3" + restartPolicy: Always + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - redis + from: + kind: ImageStreamTag + name: redis:3.0 + type: ImageChange +status: + availableReplicas: 0 + latestVersion: 0 + observedGeneration: 0 + replicas: 0 + unavailableReplicas: 0 + updatedReplicas: 0 + +--- +apiVersion: v1 +kind: ImageStream +metadata: + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + lookupPolicy: + local: false + tags: + - annotations: null + from: + kind: DockerImage + name: redis:3.0 + generation: null + importPolicy: {} + name: "3.0" + referencePolicy: + type: "" +status: + dockerImageRepository: "" + diff --git a/script/test/fixtures/v3.0/output-k8s.json b/script/test/fixtures/v3.0/output-k8s.json deleted file mode 100644 index c3cdaf74..00000000 --- a/script/test/fixtures/v3.0/output-k8s.json +++ /dev/null @@ -1,223 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - }, - "annotations": { - "kompose.service.type": "headless" - } - }, - "spec": { - "ports": [ - { - "name": "headless", - "port": 55555, - "targetPort": 0 - } - ], - "selector": { - "io.kompose.service": "redis" - }, - "clusterIP": "None" - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "Deployment", - "apiVersion": "apps/v1", - "metadata": { - "name": "foo", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "foo" - } - }, - "spec": { - "replicas": 1, - "selector": { - "matchLabels": { - "io.kompose.service": "foo" - } - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.network/app-network": "true", - "io.kompose.network/normalized-network": "true", - "io.kompose.network/web-network": "true", - "io.kompose.service": "foo" - } - }, - "spec": { - "containers": [ - { - "name": "foo", - "image": "foo:latest", - "args": [ - "sh", - "-c", - "echo Hello Foo" - ], - "resources": {} - } - ], - "restartPolicy": "Always" - } - }, - "strategy": {} - }, - "status": {} - }, - { - "kind": "NetworkPolicy", - "apiVersion": "networking.k8s.io/v1", - "metadata": { - "name": "app-network", - "creationTimestamp": null - }, - "spec": { - "podSelector": { - "matchLabels": { - "io.kompose.network/app-network": "true" - } - }, - "ingress": [ - { - "from": [ - { - "podSelector": { - "matchLabels": { - "io.kompose.network/app-network": "true" - } - } - } - ] - } - ] - } - }, - { - "kind": "NetworkPolicy", - "apiVersion": "networking.k8s.io/v1", - "metadata": { - "name": "normalized-network", - "creationTimestamp": null - }, - "spec": { - "podSelector": { - "matchLabels": { - "io.kompose.network/normalized-network": "true" - } - }, - "ingress": [ - { - "from": [ - { - "podSelector": { - "matchLabels": { - "io.kompose.network/normalized-network": "true" - } - } - } - ] - } - ] - } - }, - { - "kind": "NetworkPolicy", - "apiVersion": "networking.k8s.io/v1", - "metadata": { - "name": "web-network", - "creationTimestamp": null - }, - "spec": { - "podSelector": { - "matchLabels": { - "io.kompose.network/web-network": "true" - } - }, - "ingress": [ - { - "from": [ - { - "podSelector": { - "matchLabels": { - "io.kompose.network/web-network": "true" - } - } - } - ] - } - ] - } - }, - { - "kind": "Deployment", - "apiVersion": "apps/v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - }, - "annotations": { - "kompose.service.type": "headless" - } - }, - "spec": { - "replicas": 1, - "selector": { - "matchLabels": { - "io.kompose.service": "redis" - } - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - }, - "annotations": { - "kompose.service.type": "headless" - } - }, - "spec": { - "containers": [ - { - "name": "redis", - "image": "redis", - "resources": {}, - "livenessProbe": { - "exec": { - "command": [ - "echo \"hello world\"" - ] - }, - "timeoutSeconds": 1, - "periodSeconds": 10, - "failureThreshold": 5 - } - } - ], - "restartPolicy": "Always" - } - }, - "strategy": {} - }, - "status": {} - } - ] -} diff --git a/script/test/fixtures/v3.0/output-k8s.yaml b/script/test/fixtures/v3.0/output-k8s.yaml new file mode 100644 index 00000000..2a2f6f9a --- /dev/null +++ b/script/test/fixtures/v3.0/output-k8s.yaml @@ -0,0 +1,141 @@ +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.service.type: headless + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + clusterIP: None + ports: + - name: headless + port: 55555 + targetPort: 0 + selector: + io.kompose.service: redis +status: + loadBalancer: {} + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + creationTimestamp: null + labels: + io.kompose.service: foo + name: foo +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: foo + strategy: {} + template: + metadata: + creationTimestamp: null + labels: + io.kompose.network/app-network: "true" + io.kompose.network/normalized-network: "true" + io.kompose.network/web-network: "true" + io.kompose.service: foo + spec: + containers: + - args: + - sh + - -c + - echo Hello Foo + image: foo:latest + name: foo + resources: {} + restartPolicy: Always +status: {} + +--- +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + creationTimestamp: null + name: app-network +spec: + ingress: + - from: + - podSelector: + matchLabels: + io.kompose.network/app-network: "true" + podSelector: + matchLabels: + io.kompose.network/app-network: "true" + +--- +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + creationTimestamp: null + name: web-network +spec: + ingress: + - from: + - podSelector: + matchLabels: + io.kompose.network/web-network: "true" + podSelector: + matchLabels: + io.kompose.network/web-network: "true" + +--- +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + creationTimestamp: null + name: normalized-network +spec: + ingress: + - from: + - podSelector: + matchLabels: + io.kompose.network/normalized-network: "true" + podSelector: + matchLabels: + io.kompose.network/normalized-network: "true" + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.service.type: headless + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: redis + strategy: {} + template: + metadata: + annotations: + kompose.service.type: headless + creationTimestamp: null + labels: + io.kompose.service: redis + spec: + containers: + - image: redis + livenessProbe: + exec: + command: + - echo "hello world" + failureThreshold: 5 + periodSeconds: 10 + timeoutSeconds: 1 + name: redis + resources: {} + restartPolicy: Always +status: {} + diff --git a/script/test/fixtures/v3.0/output-os.json b/script/test/fixtures/v3.0/output-os.json deleted file mode 100644 index c7163fa0..00000000 --- a/script/test/fixtures/v3.0/output-os.json +++ /dev/null @@ -1,256 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - }, - "annotations": { - "kompose.service.type": "headless" - } - }, - "spec": { - "ports": [ - { - "name": "headless", - "port": 55555, - "targetPort": 0 - } - ], - "selector": { - "io.kompose.service": "redis" - }, - "clusterIP": "None" - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "foo", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "foo" - } - }, - "spec": { - "strategy": { - "resources": {} - }, - "triggers": [ - { - "type": "ConfigChange" - }, - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "foo" - ], - "from": { - "kind": "ImageStreamTag", - "name": "foo:latest" - } - } - } - ], - "replicas": 1, - "test": false, - "selector": { - "io.kompose.service": "foo" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.network/app-network": "true", - "io.kompose.network/normalized-network": "true", - "io.kompose.network/web-network": "true", - "io.kompose.service": "foo" - } - }, - "spec": { - "containers": [ - { - "name": "foo", - "image": " ", - "args": [ - "sh", - "-c", - "echo Hello Foo" - ], - "resources": {} - } - ], - "restartPolicy": "Always" - } - } - }, - "status": { - "latestVersion": 0, - "observedGeneration": 0, - "replicas": 0, - "updatedReplicas": 0, - "availableReplicas": 0, - "unavailableReplicas": 0 - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "foo", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "foo" - } - }, - "spec": { - "lookupPolicy": { - "local": false - }, - "tags": [ - { - "name": "latest", - "annotations": null, - "from": { - "kind": "DockerImage", - "name": "foo:latest" - }, - "generation": null, - "importPolicy": {}, - "referencePolicy": { - "type": "" - } - } - ] - }, - "status": { - "dockerImageRepository": "" - } - }, - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - }, - "annotations": { - "kompose.service.type": "headless" - } - }, - "spec": { - "strategy": { - "resources": {} - }, - "triggers": [ - { - "type": "ConfigChange" - }, - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "redis" - ], - "from": { - "kind": "ImageStreamTag", - "name": "redis:latest" - } - } - } - ], - "replicas": 1, - "test": false, - "selector": { - "io.kompose.service": "redis" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - } - }, - "spec": { - "containers": [ - { - "name": "redis", - "image": " ", - "resources": {}, - "livenessProbe": { - "exec": { - "command": [ - "echo \"hello world\"" - ] - }, - "timeoutSeconds": 1, - "periodSeconds": 10, - "failureThreshold": 5 - } - } - ], - "restartPolicy": "Always" - } - } - }, - "status": { - "latestVersion": 0, - "observedGeneration": 0, - "replicas": 0, - "updatedReplicas": 0, - "availableReplicas": 0, - "unavailableReplicas": 0 - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "redis", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "redis" - } - }, - "spec": { - "lookupPolicy": { - "local": false - }, - "tags": [ - { - "name": "latest", - "annotations": null, - "from": { - "kind": "DockerImage", - "name": "redis" - }, - "generation": null, - "importPolicy": {}, - "referencePolicy": { - "type": "" - } - } - ] - }, - "status": { - "dockerImageRepository": "" - } - } - ] -} diff --git a/script/test/fixtures/v3.0/output-os.yaml b/script/test/fixtures/v3.0/output-os.yaml new file mode 100644 index 00000000..edb58a33 --- /dev/null +++ b/script/test/fixtures/v3.0/output-os.yaml @@ -0,0 +1,173 @@ +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.service.type: headless + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + clusterIP: None + ports: + - name: headless + port: 55555 + targetPort: 0 + selector: + io.kompose.service: redis +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + creationTimestamp: null + labels: + io.kompose.service: foo + name: foo +spec: + replicas: 1 + selector: + io.kompose.service: foo + strategy: + resources: {} + template: + metadata: + creationTimestamp: null + labels: + io.kompose.network/app-network: "true" + io.kompose.network/normalized-network: "true" + io.kompose.network/web-network: "true" + io.kompose.service: foo + spec: + containers: + - args: + - sh + - -c + - echo Hello Foo + image: ' ' + name: foo + resources: {} + restartPolicy: Always + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - foo + from: + kind: ImageStreamTag + name: foo:latest + type: ImageChange +status: + availableReplicas: 0 + latestVersion: 0 + observedGeneration: 0 + replicas: 0 + unavailableReplicas: 0 + updatedReplicas: 0 + +--- +apiVersion: v1 +kind: ImageStream +metadata: + creationTimestamp: null + labels: + io.kompose.service: foo + name: foo +spec: + lookupPolicy: + local: false + tags: + - annotations: null + from: + kind: DockerImage + name: foo:latest + generation: null + importPolicy: {} + name: latest + referencePolicy: + type: "" +status: + dockerImageRepository: "" + +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + annotations: + kompose.service.type: headless + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + replicas: 1 + selector: + io.kompose.service: redis + strategy: + resources: {} + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: redis + spec: + containers: + - image: ' ' + livenessProbe: + exec: + command: + - echo "hello world" + failureThreshold: 5 + periodSeconds: 10 + timeoutSeconds: 1 + name: redis + resources: {} + restartPolicy: Always + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - redis + from: + kind: ImageStreamTag + name: redis:latest + type: ImageChange +status: + availableReplicas: 0 + latestVersion: 0 + observedGeneration: 0 + replicas: 0 + unavailableReplicas: 0 + updatedReplicas: 0 + +--- +apiVersion: v1 +kind: ImageStream +metadata: + creationTimestamp: null + labels: + io.kompose.service: redis + name: redis +spec: + lookupPolicy: + local: false + tags: + - annotations: null + from: + kind: DockerImage + name: redis + generation: null + importPolicy: {} + name: latest + referencePolicy: + type: "" +status: + dockerImageRepository: "" + diff --git a/script/test/fixtures/volume-mounts/windows/output-k8s.json b/script/test/fixtures/volume-mounts/windows/output-k8s.json deleted file mode 100644 index ed134219..00000000 --- a/script/test/fixtures/volume-mounts/windows/output-k8s.json +++ /dev/null @@ -1,115 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "db", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - } - }, - "spec": { - "ports": [ - { - "name": "80", - "port": 80, - "targetPort": 80 - } - ], - "selector": { - "io.kompose.service": "db" - } - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "Deployment", - "apiVersion": "apps/v1", - "metadata": { - "name": "db", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - } - }, - "spec": { - "replicas": 1, - "selector": { - "matchLabels": { - "io.kompose.service": "db" - } - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - } - }, - "spec": { - "volumes": [ - { - "name": "db-claim0", - "persistentVolumeClaim": { - "claimName": "db-claim0" - } - } - ], - "containers": [ - { - "name": "db", - "image": "nginx:latest", - "ports": [ - { - "containerPort": 80 - } - ], - "resources": {}, - "volumeMounts": [ - { - "name": "db-claim0", - "mountPath": "D:\\config" - } - ] - } - ], - "restartPolicy": "Always" - } - }, - "strategy": { - "type": "Recreate" - } - }, - "status": {} - }, - { - "kind": "PersistentVolumeClaim", - "apiVersion": "v1", - "metadata": { - "name": "db-claim0", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db-claim0" - } - }, - "spec": { - "accessModes": [ - "ReadWriteOnce" - ], - "resources": { - "requests": { - "storage": "100Mi" - } - } - }, - "status": {} - } - ] -} diff --git a/script/test/fixtures/volume-mounts/windows/output-k8s.yaml b/script/test/fixtures/volume-mounts/windows/output-k8s.yaml new file mode 100644 index 00000000..223c7a41 --- /dev/null +++ b/script/test/fixtures/volume-mounts/windows/output-k8s.yaml @@ -0,0 +1,71 @@ +--- +apiVersion: v1 +kind: Service +metadata: + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + ports: + - name: "80" + port: 80 + targetPort: 80 + selector: + io.kompose.service: db +status: + loadBalancer: {} + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: db + strategy: + type: Recreate + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: db + spec: + containers: + - image: nginx:latest + name: db + ports: + - containerPort: 80 + resources: {} + volumeMounts: + - mountPath: D:\config + name: db-claim0 + restartPolicy: Always + volumes: + - name: db-claim0 + persistentVolumeClaim: + claimName: db-claim0 +status: {} + +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + io.kompose.service: db-claim0 + name: db-claim0 +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +status: {} + diff --git a/script/test/fixtures/volume-mounts/windows/output-os.json b/script/test/fixtures/volume-mounts/windows/output-os.json deleted file mode 100644 index dd6892f5..00000000 --- a/script/test/fixtures/volume-mounts/windows/output-os.json +++ /dev/null @@ -1,174 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "db", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - } - }, - "spec": { - "ports": [ - { - "name": "80", - "port": 80, - "targetPort": 80 - } - ], - "selector": { - "io.kompose.service": "db" - } - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "db", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - } - }, - "spec": { - "strategy": { - "type": "Recreate", - "resources": {} - }, - "triggers": [ - { - "type": "ConfigChange" - }, - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "db" - ], - "from": { - "kind": "ImageStreamTag", - "name": "db:latest" - } - } - } - ], - "replicas": 1, - "test": false, - "selector": { - "io.kompose.service": "db" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - } - }, - "spec": { - "volumes": [ - { - "name": "db-claim0", - "persistentVolumeClaim": { - "claimName": "db-claim0" - } - } - ], - "containers": [ - { - "name": "db", - "image": " ", - "ports": [ - { - "containerPort": 80 - } - ], - "resources": {}, - "volumeMounts": [ - { - "name": "db-claim0", - "mountPath": "D:\\config" - } - ] - } - ], - "restartPolicy": "Always" - } - } - }, - "status": { - "latestVersion": 0, - "observedGeneration": 0, - "replicas": 0, - "updatedReplicas": 0, - "availableReplicas": 0, - "unavailableReplicas": 0 - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "db", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db" - } - }, - "spec": { - "lookupPolicy": { - "local": false - }, - "tags": [ - { - "name": "latest", - "annotations": null, - "from": { - "kind": "DockerImage", - "name": "nginx:latest" - }, - "generation": null, - "importPolicy": {}, - "referencePolicy": { - "type": "" - } - } - ] - }, - "status": { - "dockerImageRepository": "" - } - }, - { - "kind": "PersistentVolumeClaim", - "apiVersion": "v1", - "metadata": { - "name": "db-claim0", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "db-claim0" - } - }, - "spec": { - "accessModes": [ - "ReadWriteOnce" - ], - "resources": { - "requests": { - "storage": "100Mi" - } - } - }, - "status": {} - } - ] -} diff --git a/script/test/fixtures/volume-mounts/windows/output-os.yaml b/script/test/fixtures/volume-mounts/windows/output-os.yaml new file mode 100644 index 00000000..a0f50159 --- /dev/null +++ b/script/test/fixtures/volume-mounts/windows/output-os.yaml @@ -0,0 +1,112 @@ +--- +apiVersion: v1 +kind: Service +metadata: + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + ports: + - name: "80" + port: 80 + targetPort: 80 + selector: + io.kompose.service: db +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + replicas: 1 + selector: + io.kompose.service: db + strategy: + resources: {} + type: Recreate + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: db + spec: + containers: + - image: ' ' + name: db + ports: + - containerPort: 80 + resources: {} + volumeMounts: + - mountPath: D:\config + name: db-claim0 + restartPolicy: Always + volumes: + - name: db-claim0 + persistentVolumeClaim: + claimName: db-claim0 + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - db + from: + kind: ImageStreamTag + name: db:latest + type: ImageChange +status: + availableReplicas: 0 + latestVersion: 0 + observedGeneration: 0 + replicas: 0 + unavailableReplicas: 0 + updatedReplicas: 0 + +--- +apiVersion: v1 +kind: ImageStream +metadata: + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + lookupPolicy: + local: false + tags: + - annotations: null + from: + kind: DockerImage + name: nginx:latest + generation: null + importPolicy: {} + name: latest + referencePolicy: + type: "" +status: + dockerImageRepository: "" + +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + io.kompose.service: db-claim0 + name: db-claim0 +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +status: {} +