From 9e102dcd35ca48b470341b060ca5eaab0afd7ab2 Mon Sep 17 00:00:00 2001 From: Prakhar Agarwal Date: Sat, 21 Oct 2023 22:38:30 +0530 Subject: [PATCH] feat: Detecting Golang services and creating plan file (#2) --- assets/assets.go | 31 + .../presets/analyze-docker-compose-only.yaml | 18 + .../built-in/presets/containerize-only.yaml | 2 + assets/built-in/presets/docker-file-only.yaml | 16 + .../enable-containerized-transformers.yaml | 2 + .../presets/use-podman-in-scripts.yaml | 2 + .../cloudfoundry/transformer.yaml | 18 + .../transformers/cnb/transformer.yaml | 23 + .../compose/composeanalyser/transformer.yaml | 20 + .../compose/composegenerator/transformer.yaml | 13 + .../templates/pushimages.bat | 66 ++ .../templates/pushimages.sh | 45 ++ .../transformer.yaml | 17 + .../dockerfiledetector/transformer.yaml | 18 + .../dockerfileparser/transformer.yaml | 16 + .../buildandpushimages_multiarch.bat | 63 ++ .../templates/buildandpushimages_multiarch.sh | 49 ++ .../templates/buildimages.bat | 62 ++ .../templates/buildimages.sh | 43 + .../dockerimagebuildscript/transformer.yaml | 19 + .../common/Dockerfile.license | 13 + .../dotnetcore/templates/Dockerfile | 64 ++ .../dotnetcore/transformer.yaml | 23 + .../golang/mappings/golangversions.yaml | 20 + .../golang/templates/Dockerfile | 27 + .../golang/transformer.yaml | 23 + .../java/earanalyser/transformer.yaml | 19 + .../java/earrouter/transformer.yaml | 24 + .../gradle/templates/Dockerfile.gradle-build | 34 + .../java/gradle/transformer.yaml | 30 + .../java/jar/templates/Dockerfile.jar-run | 9 + .../java/jar/transformer.yaml | 26 + .../java/jboss/templates/Dockerfile.jboss | 38 + .../java/jboss/transformer.yaml | 27 + .../java/liberty/templates/Dockerfile.liberty | 19 + .../java/liberty/transformer.yaml | 27 + .../java/mappings/javapackageversions.yaml | 16 + .../maven/templates/Dockerfile.maven-build | 47 ++ .../java/maven/transformer.yaml | 30 + .../java/tomcat/templates/Dockerfile.tomcat | 26 + .../java/tomcat/transformer.yaml | 24 + .../java/waranalyser/transformer.yaml | 19 + .../java/warrouter/transformer.yaml | 24 + .../java/zuul/transformer.yaml | 17 + .../mappings/nodeversions.yaml | 18 + .../nodejs/templates/Dockerfile | 32 + .../nodejs/transformer.yaml | 21 + .../php/templates/Dockerfile | 23 + .../dockerfilegenerator/php/transformer.yaml | 19 + .../python/templates/Dockerfile | 26 + .../python/transformer.yaml | 19 + .../ruby/templates/Dockerfile | 22 + .../dockerfilegenerator/ruby/transformer.yaml | 19 + .../rust/templates/Dockerfile | 29 + .../dockerfilegenerator/rust/transformer.yaml | 19 + .../mappings/dotnetwindowsversionmapping.yaml | 14 + .../windows/winconsole/templates/Dockerfile | 28 + .../windows/winconsole/transformer.yaml | 20 + .../winsilverlightweb/templates/Dockerfile | 35 + .../winsilverlightweb/transformer.yaml | 20 + .../windows/winweb/templates/Dockerfile | 33 + .../windows/winweb/transformer.yaml | 21 + .../kubernetes/argocd/transformer.yaml | 22 + .../kubernetes/buildconfig/transformer.yaml | 22 + .../clusterselector/clusters/aws-eks.yaml | 155 ++++ .../clusterselector/clusters/azure-aks.yaml | 160 ++++ .../clusterselector/clusters/gcp-gke.yaml | 138 ++++ .../clusterselector/clusters/ibm-iks.yaml | 195 +++++ .../clusters/ibm-openshift.yaml | 291 +++++++ .../clusterselector/clusters/kubernetes.yaml | 135 ++++ .../clusterselector/clusters/openshift.yaml | 272 +++++++ .../clusterselector/transformer.yaml | 23 + .../kubernetes/knative/transformer.yaml | 22 + .../kubernetes/kubernetes/transformer.yaml | 23 + .../kubernetesversionchanger/transformer.yaml | 23 + .../kubernetes/operator/templates/README.md | 14 + .../operator/templates/subscription.yaml | 9 + .../kubernetes/operator/transformer.yaml | 13 + .../kubernetes/operatorsfromtca/Dockerfile | 3 + .../operatorsfromtca/cfservices.yaml | 739 ++++++++++++++++++ .../kubernetes/operatorsfromtca/detect.py | 78 ++ .../kubernetes/operatorsfromtca/preprocess.py | 38 + .../kubernetes/operatorsfromtca/transform.py | 195 +++++ .../operatorsfromtca/transformer.yaml | 30 + .../parameterizers/replicas.yaml | 12 + .../kubernetes/parameterizer/transformer.yaml | 23 + .../kubernetes/tekton/transformer.yaml | 22 + .../readmegenerator/templates/Readme.md | 15 + .../readmegenerator/transformer.yaml | 17 + assets/filepermissions.yaml | 104 +++ common/utils.go | 101 +++ main.go | 18 + scripts/generator/persistpermissions.go | 113 +++ 93 files changed, 4612 insertions(+) create mode 100644 assets/assets.go create mode 100644 assets/built-in/presets/analyze-docker-compose-only.yaml create mode 100644 assets/built-in/presets/containerize-only.yaml create mode 100644 assets/built-in/presets/docker-file-only.yaml create mode 100644 assets/built-in/presets/enable-containerized-transformers.yaml create mode 100644 assets/built-in/presets/use-podman-in-scripts.yaml create mode 100644 assets/built-in/transformers/cloudfoundry/transformer.yaml create mode 100644 assets/built-in/transformers/cnb/transformer.yaml create mode 100644 assets/built-in/transformers/compose/composeanalyser/transformer.yaml create mode 100644 assets/built-in/transformers/compose/composegenerator/transformer.yaml create mode 100755 assets/built-in/transformers/containerimagespushscript/templates/pushimages.bat create mode 100755 assets/built-in/transformers/containerimagespushscript/templates/pushimages.sh create mode 100644 assets/built-in/transformers/containerimagespushscript/transformer.yaml create mode 100644 assets/built-in/transformers/dockerfile/dockerfiledetector/transformer.yaml create mode 100644 assets/built-in/transformers/dockerfile/dockerfileparser/transformer.yaml create mode 100755 assets/built-in/transformers/dockerfile/dockerimagebuildscript/templates/buildandpushimages_multiarch.bat create mode 100755 assets/built-in/transformers/dockerfile/dockerimagebuildscript/templates/buildandpushimages_multiarch.sh create mode 100755 assets/built-in/transformers/dockerfile/dockerimagebuildscript/templates/buildimages.bat create mode 100755 assets/built-in/transformers/dockerfile/dockerimagebuildscript/templates/buildimages.sh create mode 100644 assets/built-in/transformers/dockerfile/dockerimagebuildscript/transformer.yaml create mode 100644 assets/built-in/transformers/dockerfilegenerator/common/Dockerfile.license create mode 100644 assets/built-in/transformers/dockerfilegenerator/dotnetcore/templates/Dockerfile create mode 100644 assets/built-in/transformers/dockerfilegenerator/dotnetcore/transformer.yaml create mode 100644 assets/built-in/transformers/dockerfilegenerator/golang/mappings/golangversions.yaml create mode 100644 assets/built-in/transformers/dockerfilegenerator/golang/templates/Dockerfile create mode 100644 assets/built-in/transformers/dockerfilegenerator/golang/transformer.yaml create mode 100644 assets/built-in/transformers/dockerfilegenerator/java/earanalyser/transformer.yaml create mode 100644 assets/built-in/transformers/dockerfilegenerator/java/earrouter/transformer.yaml create mode 100644 assets/built-in/transformers/dockerfilegenerator/java/gradle/templates/Dockerfile.gradle-build create mode 100644 assets/built-in/transformers/dockerfilegenerator/java/gradle/transformer.yaml create mode 100644 assets/built-in/transformers/dockerfilegenerator/java/jar/templates/Dockerfile.jar-run create mode 100644 assets/built-in/transformers/dockerfilegenerator/java/jar/transformer.yaml create mode 100644 assets/built-in/transformers/dockerfilegenerator/java/jboss/templates/Dockerfile.jboss create mode 100644 assets/built-in/transformers/dockerfilegenerator/java/jboss/transformer.yaml create mode 100644 assets/built-in/transformers/dockerfilegenerator/java/liberty/templates/Dockerfile.liberty create mode 100644 assets/built-in/transformers/dockerfilegenerator/java/liberty/transformer.yaml create mode 100644 assets/built-in/transformers/dockerfilegenerator/java/mappings/javapackageversions.yaml create mode 100644 assets/built-in/transformers/dockerfilegenerator/java/maven/templates/Dockerfile.maven-build create mode 100644 assets/built-in/transformers/dockerfilegenerator/java/maven/transformer.yaml create mode 100644 assets/built-in/transformers/dockerfilegenerator/java/tomcat/templates/Dockerfile.tomcat create mode 100644 assets/built-in/transformers/dockerfilegenerator/java/tomcat/transformer.yaml create mode 100644 assets/built-in/transformers/dockerfilegenerator/java/waranalyser/transformer.yaml create mode 100644 assets/built-in/transformers/dockerfilegenerator/java/warrouter/transformer.yaml create mode 100644 assets/built-in/transformers/dockerfilegenerator/java/zuul/transformer.yaml create mode 100644 assets/built-in/transformers/dockerfilegenerator/mappings/nodeversions.yaml create mode 100644 assets/built-in/transformers/dockerfilegenerator/nodejs/templates/Dockerfile create mode 100644 assets/built-in/transformers/dockerfilegenerator/nodejs/transformer.yaml create mode 100644 assets/built-in/transformers/dockerfilegenerator/php/templates/Dockerfile create mode 100644 assets/built-in/transformers/dockerfilegenerator/php/transformer.yaml create mode 100644 assets/built-in/transformers/dockerfilegenerator/python/templates/Dockerfile create mode 100644 assets/built-in/transformers/dockerfilegenerator/python/transformer.yaml create mode 100644 assets/built-in/transformers/dockerfilegenerator/ruby/templates/Dockerfile create mode 100644 assets/built-in/transformers/dockerfilegenerator/ruby/transformer.yaml create mode 100644 assets/built-in/transformers/dockerfilegenerator/rust/templates/Dockerfile create mode 100644 assets/built-in/transformers/dockerfilegenerator/rust/transformer.yaml create mode 100644 assets/built-in/transformers/dockerfilegenerator/windows/mappings/dotnetwindowsversionmapping.yaml create mode 100644 assets/built-in/transformers/dockerfilegenerator/windows/winconsole/templates/Dockerfile create mode 100644 assets/built-in/transformers/dockerfilegenerator/windows/winconsole/transformer.yaml create mode 100644 assets/built-in/transformers/dockerfilegenerator/windows/winsilverlightweb/templates/Dockerfile create mode 100644 assets/built-in/transformers/dockerfilegenerator/windows/winsilverlightweb/transformer.yaml create mode 100644 assets/built-in/transformers/dockerfilegenerator/windows/winweb/templates/Dockerfile create mode 100644 assets/built-in/transformers/dockerfilegenerator/windows/winweb/transformer.yaml create mode 100644 assets/built-in/transformers/kubernetes/argocd/transformer.yaml create mode 100644 assets/built-in/transformers/kubernetes/buildconfig/transformer.yaml create mode 100644 assets/built-in/transformers/kubernetes/clusterselector/clusters/aws-eks.yaml create mode 100644 assets/built-in/transformers/kubernetes/clusterselector/clusters/azure-aks.yaml create mode 100644 assets/built-in/transformers/kubernetes/clusterselector/clusters/gcp-gke.yaml create mode 100644 assets/built-in/transformers/kubernetes/clusterselector/clusters/ibm-iks.yaml create mode 100644 assets/built-in/transformers/kubernetes/clusterselector/clusters/ibm-openshift.yaml create mode 100644 assets/built-in/transformers/kubernetes/clusterselector/clusters/kubernetes.yaml create mode 100644 assets/built-in/transformers/kubernetes/clusterselector/clusters/openshift.yaml create mode 100644 assets/built-in/transformers/kubernetes/clusterselector/transformer.yaml create mode 100644 assets/built-in/transformers/kubernetes/knative/transformer.yaml create mode 100644 assets/built-in/transformers/kubernetes/kubernetes/transformer.yaml create mode 100644 assets/built-in/transformers/kubernetes/kubernetesversionchanger/transformer.yaml create mode 100644 assets/built-in/transformers/kubernetes/operator/templates/README.md create mode 100644 assets/built-in/transformers/kubernetes/operator/templates/subscription.yaml create mode 100644 assets/built-in/transformers/kubernetes/operator/transformer.yaml create mode 100644 assets/built-in/transformers/kubernetes/operatorsfromtca/Dockerfile create mode 100644 assets/built-in/transformers/kubernetes/operatorsfromtca/cfservices.yaml create mode 100644 assets/built-in/transformers/kubernetes/operatorsfromtca/detect.py create mode 100644 assets/built-in/transformers/kubernetes/operatorsfromtca/preprocess.py create mode 100644 assets/built-in/transformers/kubernetes/operatorsfromtca/transform.py create mode 100644 assets/built-in/transformers/kubernetes/operatorsfromtca/transformer.yaml create mode 100644 assets/built-in/transformers/kubernetes/parameterizer/parameterizers/replicas.yaml create mode 100644 assets/built-in/transformers/kubernetes/parameterizer/transformer.yaml create mode 100644 assets/built-in/transformers/kubernetes/tekton/transformer.yaml create mode 100644 assets/built-in/transformers/readmegenerator/templates/Readme.md create mode 100644 assets/built-in/transformers/readmegenerator/transformer.yaml create mode 100644 assets/filepermissions.yaml create mode 100644 scripts/generator/persistpermissions.go diff --git a/assets/assets.go b/assets/assets.go new file mode 100644 index 0000000..63a118a --- /dev/null +++ b/assets/assets.go @@ -0,0 +1,31 @@ +/* + * Copyright IBM Corporation 2021 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package assets + +import "embed" + +//go:generate go run ../scripts/generator/persistpermissions.go built-in/ filepermissions.yaml + +// AssetsDir is the embedded built-in assets directory +// +//go:embed built-in/* +var AssetsDir embed.FS + +// AssetFilePermissions is embedded file having permissions information for the assets +// +//go:embed filepermissions.yaml +var AssetFilePermissions string diff --git a/assets/built-in/presets/analyze-docker-compose-only.yaml b/assets/built-in/presets/analyze-docker-compose-only.yaml new file mode 100644 index 0000000..9bbcc9c --- /dev/null +++ b/assets/built-in/presets/analyze-docker-compose-only.yaml @@ -0,0 +1,18 @@ +move2kube: + transformers: + types: + - ComposeGenerator + - ComposeAnalyser + - Knative + - ContainerImagesPushScriptGenerator + - DockerfileParser + - DockerfileImageBuildScript + - Kubernetes + - ArgoCD + - Tekton + - Buildconfig + - ClusterSelector + - Parameterizer + - ReadMeGenerator + - DockerfileDetector + transformerselector: "" diff --git a/assets/built-in/presets/containerize-only.yaml b/assets/built-in/presets/containerize-only.yaml new file mode 100644 index 0000000..35610fb --- /dev/null +++ b/assets/built-in/presets/containerize-only.yaml @@ -0,0 +1,2 @@ +move2kube: + transformerselector: "move2kube.konveyor.io/task in (containerization,containerizationscript)" diff --git a/assets/built-in/presets/docker-file-only.yaml b/assets/built-in/presets/docker-file-only.yaml new file mode 100644 index 0000000..1b32a9b --- /dev/null +++ b/assets/built-in/presets/docker-file-only.yaml @@ -0,0 +1,16 @@ +move2kube: + transformers: + types: + - Knative + - ContainerImagesPushScriptGenerator + - DockerfileParser + - DockerfileImageBuildScript + - Kubernetes + - ArgoCD + - Tekton + - Buildconfig + - ClusterSelector + - Parameterizer + - ReadMeGenerator + - DockerfileDetector + transformerselector: "" diff --git a/assets/built-in/presets/enable-containerized-transformers.yaml b/assets/built-in/presets/enable-containerized-transformers.yaml new file mode 100644 index 0000000..a53fb4e --- /dev/null +++ b/assets/built-in/presets/enable-containerized-transformers.yaml @@ -0,0 +1,2 @@ +move2kube: + spawncontainers: true \ No newline at end of file diff --git a/assets/built-in/presets/use-podman-in-scripts.yaml b/assets/built-in/presets/use-podman-in-scripts.yaml new file mode 100644 index 0000000..3539528 --- /dev/null +++ b/assets/built-in/presets/use-podman-in-scripts.yaml @@ -0,0 +1,2 @@ +move2kube: + containerruntime: podman diff --git a/assets/built-in/transformers/cloudfoundry/transformer.yaml b/assets/built-in/transformers/cloudfoundry/transformer.yaml new file mode 100644 index 0000000..6b6a4c0 --- /dev/null +++ b/assets/built-in/transformers/cloudfoundry/transformer.yaml @@ -0,0 +1,18 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: CloudFoundry + labels: + move2kube.konveyor.io/built-in: true +spec: + class: "CloudFoundry" + directoryDetect: + levels: 1 + consumes: + Service: + disabled: false + produces: + IR: + disabled: false + Service: + disabled: false diff --git a/assets/built-in/transformers/cnb/transformer.yaml b/assets/built-in/transformers/cnb/transformer.yaml new file mode 100644 index 0000000..c402252 --- /dev/null +++ b/assets/built-in/transformers/cnb/transformer.yaml @@ -0,0 +1,23 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: CNBContainerizer + labels: + move2kube.konveyor.io/task: containerization + move2kube.konveyor.io/built-in: true + move2kube.konveyor.io/container-based: true +spec: + mode: "Container" + class: "CNBContainerizer" + directoryDetect: + levels: -1 + consumes: + Service: + disabled: false + produces: + CNBDetectedService: + disabled: false + config: + container: + image: "paketobuildpacks/builder:full" + keepAliveCommand: ["tail", "-f", "/dev/null"] diff --git a/assets/built-in/transformers/compose/composeanalyser/transformer.yaml b/assets/built-in/transformers/compose/composeanalyser/transformer.yaml new file mode 100644 index 0000000..8baa5b9 --- /dev/null +++ b/assets/built-in/transformers/compose/composeanalyser/transformer.yaml @@ -0,0 +1,20 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: ComposeAnalyser + labels: + move2kube.konveyor.io/built-in: true +spec: + class: "ComposeAnalyser" + directoryDetect: + levels: 1 + consumes: + Service: + disabled: false + produces: + IR: + disabled: false + Dockerfile: + disabled: false + config: + enableNetworkParsing: false diff --git a/assets/built-in/transformers/compose/composegenerator/transformer.yaml b/assets/built-in/transformers/compose/composegenerator/transformer.yaml new file mode 100644 index 0000000..dde0786 --- /dev/null +++ b/assets/built-in/transformers/compose/composegenerator/transformer.yaml @@ -0,0 +1,13 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: ComposeGenerator + labels: + move2kube.konveyor.io/built-in: true +spec: + class: "ComposeGenerator" + directoryDetect: + levels: 0 + consumes: + IR: + merge: true diff --git a/assets/built-in/transformers/containerimagespushscript/templates/pushimages.bat b/assets/built-in/transformers/containerimagespushscript/templates/pushimages.bat new file mode 100755 index 0000000..5194809 --- /dev/null +++ b/assets/built-in/transformers/containerimagespushscript/templates/pushimages.bat @@ -0,0 +1,66 @@ +:: Copyright IBM Corporation 2021 +:: +:: Licensed under the Apache License, Version 2.0 (the "License"); +:: you may not use this file except in compliance with the License. +:: You may obtain a copy of the License at +:: +:: http://www.apache.org/licenses/LICENSE-2.0 +:: +:: Unless required by applicable law or agreed to in writing, software +:: distributed under the License is distributed on an "AS IS" BASIS, +:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +:: See the License for the specific language governing permissions and +:: limitations under the License. + +:: Invoke as pushimages.bat +:: Examples: +:: 1) pushimages.bat +:: 2) pushimages.bat quay.io your_quay_username +:: 3) pushimages.bat index.docker.io your_registry_namespace podman + +@echo off +IF "%3"=="" GOTO DEFAULT_CONTAINER_RUNTIME +SET CONTAINER_RUNTIME=%3% +GOTO REGISTRY + +:DEFAULT_CONTAINER_RUNTIME + SET CONTAINER_RUNTIME=docker + GOTO REGISTRY + +:REGISTRY + IF "%2"=="" GOTO DEFAULT_REGISTRY + IF "%1"=="" GOTO DEFAULT_REGISTRY + SET REGISTRY_URL=%1 + SET REGISTRY_NAMESPACE=%2 + GOTO DOCKER_CONTAINER_RUNTIME + +:DEFAULT_REGISTRY + SET REGISTRY_URL={{ .RegistryURL }} + SET REGISTRY_NAMESPACE={{ .RegistryNamespace }} + GOTO DOCKER_CONTAINER_RUNTIME + +:DOCKER_CONTAINER_RUNTIME + IF NOT "%CONTAINER_RUNTIME%" == "docker" GOTO PODMAN_CONTAINER_RUNTIME + GOTO MAIN + +:PODMAN_CONTAINER_RUNTIME + IF NOT "%CONTAINER_RUNTIME%" == "podman" GOTO UNSUPPORTED_BUILD_SYSTEM + GOTO MAIN + +:UNSUPPORTED_BUILD_SYSTEM + echo 'Unsupported build system passed as an argument for pushing the images.' + GOTO SKIP + +:MAIN +:: Uncomment the below line if you want to enable login before pushing +:: %CONTAINER_RUNTIME% login %REGISTRY_URL% +{{- range $image := .Images }} + +echo "pushing image {{ $image }}" +%CONTAINER_RUNTIME% tag {{ $image }} %REGISTRY_URL%/%REGISTRY_NAMESPACE%/{{ $image }} +%CONTAINER_RUNTIME% push %REGISTRY_URL%/%REGISTRY_NAMESPACE%/{{ $image }} +{{- end }} + +echo "done" + +:SKIP diff --git a/assets/built-in/transformers/containerimagespushscript/templates/pushimages.sh b/assets/built-in/transformers/containerimagespushscript/templates/pushimages.sh new file mode 100755 index 0000000..9633766 --- /dev/null +++ b/assets/built-in/transformers/containerimagespushscript/templates/pushimages.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +# Copyright IBM Corporation 2020 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Invoke as ./pushimages.sh +# Examples: +# 1) ./pushimages.sh +# 2) ./pushimages.sh quay.io your_quay_username +# 3) ./pushimages.sh index.docker.io your_registry_namespace podman + +REGISTRY_URL={{ .RegistryURL }} +REGISTRY_NAMESPACE={{ .RegistryNamespace }} +CONTAINER_RUNTIME=docker +if [ "$#" -gt 1 ]; then + REGISTRY_URL=$1 + REGISTRY_NAMESPACE=$2 +fi +if [ "$#" -eq 3 ]; then + CONTAINER_RUNTIME=$3 +fi +if [ "${CONTAINER_RUNTIME}" != "docker" ] && [ "${CONTAINER_RUNTIME}" != "podman" ]; then + echo 'Unsupported container runtime passed as an argument for pushing the images: '"${CONTAINER_RUNTIME}" + exit 1 +fi +# Uncomment the below line if you want to enable login before pushing +# ${CONTAINER_RUNTIME} login ${REGISTRY_URL} +{{- range $image := .Images }} + +echo 'pushing image {{ $image }}' +${CONTAINER_RUNTIME} tag {{ $image }} ${REGISTRY_URL}/${REGISTRY_NAMESPACE}/{{ $image }} +${CONTAINER_RUNTIME} push ${REGISTRY_URL}/${REGISTRY_NAMESPACE}/{{ $image }} +{{- end }} + +echo 'done' diff --git a/assets/built-in/transformers/containerimagespushscript/transformer.yaml b/assets/built-in/transformers/containerimagespushscript/transformer.yaml new file mode 100644 index 0000000..572470a --- /dev/null +++ b/assets/built-in/transformers/containerimagespushscript/transformer.yaml @@ -0,0 +1,17 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: ContainerImagesPushScriptGenerator + labels: + move2kube.konveyor.io/task: containerizationscript + move2kube.konveyor.io/built-in: true +spec: + class: "ContainerImagesPushScript" + directoryDetect: + levels: 0 + consumes: + NewImages: + merge: true + produces: + ContainerImagesPushScript: + disabled: false diff --git a/assets/built-in/transformers/dockerfile/dockerfiledetector/transformer.yaml b/assets/built-in/transformers/dockerfile/dockerfiledetector/transformer.yaml new file mode 100644 index 0000000..55f3f3d --- /dev/null +++ b/assets/built-in/transformers/dockerfile/dockerfiledetector/transformer.yaml @@ -0,0 +1,18 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: DockerfileDetector + labels: + move2kube.konveyor.io/built-in: true +spec: + class: "DockerfileDetector" + directoryDetect: + levels: 1 + consumes: + Service: + disabled: false + produces: + Dockerfile: + disabled: false + DockerfileForService: + disabled: false diff --git a/assets/built-in/transformers/dockerfile/dockerfileparser/transformer.yaml b/assets/built-in/transformers/dockerfile/dockerfileparser/transformer.yaml new file mode 100644 index 0000000..523274b --- /dev/null +++ b/assets/built-in/transformers/dockerfile/dockerfileparser/transformer.yaml @@ -0,0 +1,16 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: DockerfileParser + labels: + move2kube.konveyor.io/built-in: true +spec: + class: "DockerfileParser" + directoryDetect: + levels: 0 + consumes: + DockerfileForService: + merge: false + produces: + IR: + disabled: false diff --git a/assets/built-in/transformers/dockerfile/dockerimagebuildscript/templates/buildandpushimages_multiarch.bat b/assets/built-in/transformers/dockerfile/dockerimagebuildscript/templates/buildandpushimages_multiarch.bat new file mode 100755 index 0000000..8bdfc30 --- /dev/null +++ b/assets/built-in/transformers/dockerfile/dockerimagebuildscript/templates/buildandpushimages_multiarch.bat @@ -0,0 +1,63 @@ +:: Copyright IBM Corporation 2021 +:: +:: Licensed under the Apache License, Version 2.0 (the "License"); +:: you may not use this file except in compliance with the License. +:: You may obtain a copy of the License at +:: +:: http://www.apache.org/licenses/LICENSE-2.0 +:: +:: Unless required by applicable law or agreed to in writing, software +:: distributed under the License is distributed on an "AS IS" BASIS, +:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +:: See the License for the specific language governing permissions and +:: limitations under the License. + +:: Invoke as buildandpush_multiarchimages.bat +:: Examples: +:: 1) buildandpush_multiarchimages.bat +:: 2) buildandpush_multiarchimages.bat index.docker.io your_registry_namespace +:: 3) buildandpush_multiarchimages.bat quay.io your_quay_username linux/amd64,linux/arm64,linux/s390x + +@echo off +for /F "delims=" %%i in ("%cd%") do set basename="%%~ni" + +if not %basename% == "scripts" ( + echo "please run this script from the 'scripts' directory" + exit 1 +) + +REM go to the parent directory so that all the relative paths will be correct +cd {{ .RelParentOfSourceDir }} + +IF "%3"=="" GOTO DEFAULT_PLATFORMS +SET PLATFORMS=%3% +GOTO REGISTRY + +:DEFAULT_PLATFORMS + SET PLATFORMS=linux/amd64,linux/arm64,linux/s390x,linux/ppc64le + GOTO REGISTRY + +:REGISTRY + IF "%2"=="" GOTO DEFAULT_REGISTRY + IF "%1"=="" GOTO DEFAULT_REGISTRY + SET REGISTRY_URL=%1 + SET REGISTRY_NAMESPACE=%2 + GOTO MAIN + +:DEFAULT_REGISTRY + SET REGISTRY_URL={{ .RegistryURL }} + SET REGISTRY_NAMESPACE={{ .RegistryNamespace }} + GOTO MAIN + +:MAIN +:: Uncomment the below line if you want to enable login before pushing +:: docker login %REGISTRY_URL% +{{- range $dockerfile := .DockerfilesConfig }} + +echo "building and pushing image {{ $dockerfile.ImageName }}" +pushd {{ $dockerfile.ContextWindows }} +docker buildx build --platform ${PLATFORMS} -f {{ $dockerfile.DockerfileName }} --push --tag ${REGISTRY_URL}/${REGISTRY_NAMESPACE}/{{ $dockerfile.ImageName }} . +popd +{{- end }} + +echo "done" diff --git a/assets/built-in/transformers/dockerfile/dockerimagebuildscript/templates/buildandpushimages_multiarch.sh b/assets/built-in/transformers/dockerfile/dockerimagebuildscript/templates/buildandpushimages_multiarch.sh new file mode 100755 index 0000000..a3ff940 --- /dev/null +++ b/assets/built-in/transformers/dockerfile/dockerimagebuildscript/templates/buildandpushimages_multiarch.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash +# Copyright IBM Corporation 2021 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Invoke as ./buildandpush_multiarchimages.sh +# Examples: +# 1) ./buildandpush_multiarchimages.sh +# 2) ./buildandpush_multiarchimages.sh index.docker.io your_registry_namespace +# 3) ./buildandpush_multiarchimages.sh quay.io your_quay_username linux/amd64,linux/arm64,linux/s390x + +if [[ "$(basename "$PWD")" != 'scripts' ]] ; then + echo 'please run this script from the "scripts" directory' + exit 1 +fi + +cd {{ .RelParentOfSourceDir }} # go to the parent directory so that all the relative paths will be correct + +REGISTRY_URL={{ .RegistryURL }} +REGISTRY_NAMESPACE={{ .RegistryNamespace }} +PLATFORMS="linux/amd64,linux/arm64,linux/s390x,linux/ppc64le" +if [ "$#" -gt 1 ]; then + REGISTRY_URL=$1 + REGISTRY_NAMESPACE=$2 +fi +if [ "$#" -eq 3 ]; then + PLATFORMS=$3 +fi +# Uncomment the below line if you want to enable login before pushing +# docker login ${REGISTRY_URL} +{{- range $dockerfile := .DockerfilesConfig }} + +echo 'building and pushing image {{ $dockerfile.ImageName }}' +cd {{ $dockerfile.ContextUnix }} +docker buildx build --platform ${PLATFORMS} -f {{ $dockerfile.DockerfileName }} --push --tag ${REGISTRY_URL}/${REGISTRY_NAMESPACE}/{{ $dockerfile.ImageName }} . +cd - +{{- end }} + +echo 'done' diff --git a/assets/built-in/transformers/dockerfile/dockerimagebuildscript/templates/buildimages.bat b/assets/built-in/transformers/dockerfile/dockerimagebuildscript/templates/buildimages.bat new file mode 100755 index 0000000..8fd7f26 --- /dev/null +++ b/assets/built-in/transformers/dockerfile/dockerimagebuildscript/templates/buildimages.bat @@ -0,0 +1,62 @@ +:: Copyright IBM Corporation 2021 +:: +:: Licensed under the Apache License, Version 2.0 (the "License"); +:: you may not use this file except in compliance with the License. +:: You may obtain a copy of the License at +:: +:: http://www.apache.org/licenses/LICENSE-2.0 +:: +:: Unless required by applicable law or agreed to in writing, software +:: distributed under the License is distributed on an "AS IS" BASIS, +:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +:: See the License for the specific language governing permissions and +:: limitations under the License. + +:: Invoke as buildimages.bat +:: Examples: +:: 1) buildimages.bat +:: 2) buildimages.bat podman + +@echo off +for /F "delims=" %%i in ("%cd%") do set basename="%%~ni" + +if not %basename% == "scripts" ( + echo "please run this script from the 'scripts' directory" + exit 1 +) + +IF "%1"=="" GOTO DEFAULT_CONTAINER_RUNTIME +SET CONTAINER_RUNTIME=%1% +GOTO DOCKER_CONTAINER_RUNTIME + +:DEFAULT_CONTAINER_RUNTIME + SET CONTAINER_RUNTIME=docker + GOTO MAIN + +:DOCKER_CONTAINER_RUNTIME + IF NOT "%CONTAINER_RUNTIME%" == "docker" GOTO PODMAN_CONTAINER_RUNTIME + GOTO MAIN + +:PODMAN_CONTAINER_RUNTIME + IF NOT "%CONTAINER_RUNTIME%" == "podman" GOTO UNSUPPORTED_BUILD_SYSTEM + GOTO MAIN + +:UNSUPPORTED_BUILD_SYSTEM + echo 'Unsupported build system passed as an argument for pushing the images.' + GOTO SKIP + +:MAIN +REM go to the parent directory so that all the relative paths will be correct +cd {{ .RelParentOfSourceDir }} + +{{- range $dockerfile := .DockerfilesConfig }} + +echo "building image {{ $dockerfile.ImageName }}" +pushd {{ $dockerfile.ContextWindows }} +%CONTAINER_RUNTIME% build -f {{ $dockerfile.DockerfileName }} -t {{ $dockerfile.ImageName }} . +popd +{{- end }} + +echo "done" + +:SKIP diff --git a/assets/built-in/transformers/dockerfile/dockerimagebuildscript/templates/buildimages.sh b/assets/built-in/transformers/dockerfile/dockerimagebuildscript/templates/buildimages.sh new file mode 100755 index 0000000..28f99e0 --- /dev/null +++ b/assets/built-in/transformers/dockerfile/dockerimagebuildscript/templates/buildimages.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +# Copyright IBM Corporation 2021 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Invoke as ./buildimages.sh +# Examples: +# 1) ./buildimages.sh +# 2) ./buildimages.sh podman + +if [[ "$(basename "$PWD")" != 'scripts' ]] ; then + echo 'please run this script from the "scripts" directory' + exit 1 +fi +CONTAINER_RUNTIME=docker +if [ "$#" -eq 1 ]; then + CONTAINER_RUNTIME=$1 +fi +if [ "${CONTAINER_RUNTIME}" != "docker" ] && [ "${CONTAINER_RUNTIME}" != "podman" ]; then + echo 'Unsupported container runtime passed as an argument for building the images: '"${CONTAINER_RUNTIME}" + exit 1 +fi +cd {{ .RelParentOfSourceDir }} # go to the parent directory so that all the relative paths will be correct + +{{- range $dockerfile := .DockerfilesConfig }} + +echo 'building image {{ $dockerfile.ImageName }}' +cd {{ $dockerfile.ContextUnix }} +${CONTAINER_RUNTIME} build -f {{ $dockerfile.DockerfileName }} -t {{ $dockerfile.ImageName }} . +cd - +{{- end }} + +echo 'done' diff --git a/assets/built-in/transformers/dockerfile/dockerimagebuildscript/transformer.yaml b/assets/built-in/transformers/dockerfile/dockerimagebuildscript/transformer.yaml new file mode 100644 index 0000000..01eaae8 --- /dev/null +++ b/assets/built-in/transformers/dockerfile/dockerimagebuildscript/transformer.yaml @@ -0,0 +1,19 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: DockerfileImageBuildScript + labels: + move2kube.konveyor.io/task: containerizationscript + move2kube.konveyor.io/built-in: true +spec: + class: "DockerfileImageBuildScript" + directoryDetect: + levels: 0 + consumes: + Dockerfile: + merge: true + produces: + NewImages: + disabled: false + ContainerImageBuildScript: + disabled: false diff --git a/assets/built-in/transformers/dockerfilegenerator/common/Dockerfile.license b/assets/built-in/transformers/dockerfilegenerator/common/Dockerfile.license new file mode 100644 index 0000000..b8a1fb5 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/common/Dockerfile.license @@ -0,0 +1,13 @@ +# Copyright IBM Corporation 2021 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. \ No newline at end of file diff --git a/assets/built-in/transformers/dockerfilegenerator/dotnetcore/templates/Dockerfile b/assets/built-in/transformers/dockerfilegenerator/dotnetcore/templates/Dockerfile new file mode 100644 index 0000000..bcf4140 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/dotnetcore/templates/Dockerfile @@ -0,0 +1,64 @@ +# Copyright IBM Corporation 2020 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +{{ if .IncludeBuildStage }} + +# Build Stage +FROM mcr.microsoft.com/dotnet/sdk:{{ .BuildStageImageTag }} AS {{ .BuildContainerName }} + +{{- if .IsNodeJSProject }} +RUN apt-get update -y && apt-get install -y xz-utils && \ + {{- if .NodeVersionProperties.url }} + wget {{ .NodeVersionProperties.url }} && \ + {{- else }} + wget https://nodejs.org/dist/{{ .NodeVersion }}/node-{{ .NodeVersion }}-linux-x64.tar.xz && \ + {{- end }} + tar -xJf node-{{ .NodeVersion }}-linux-x64.tar.xz && \ + mv node-{{ .NodeVersion }}-linux-x64 /node && \ + rm -f node-{{ .NodeVersion }}-linux-x64.tar.xz +ENV PATH="$PATH:/node/bin" +{{- end }} + +WORKDIR /src +COPY . . +RUN dotnet restore + +{{- if .PublishProfilePath }} +RUN dotnet publish /p:PublishProfile={{ .PublishProfilePath }} --no-restore +{{- else }} +RUN dotnet publish -c release --no-restore +{{- end }} + +{{- end }} + + +{{ if .IncludeRunStage }} + +# Run Stage +FROM mcr.microsoft.com/dotnet/aspnet:{{ .RunStageImageTag }} +ENV DOTNET_GENERATE_ASPNET_CERTIFICATE=false +WORKDIR /app + +{{- range .Ports }} +EXPOSE {{ . }} +{{- end }} + +{{- range $k, $v := .EnvVariables }} +ENV {{ $k }} {{ $v }} +{{- end }} + +COPY {{ if .BuildContainerName }}--from={{ .BuildContainerName }}{{ end }} {{ .CopyFrom }} ./ +CMD ["dotnet", "{{ .EntryPointPath }}"] + +{{- end }} diff --git a/assets/built-in/transformers/dockerfilegenerator/dotnetcore/transformer.yaml b/assets/built-in/transformers/dockerfilegenerator/dotnetcore/transformer.yaml new file mode 100644 index 0000000..abfc745 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/dotnetcore/transformer.yaml @@ -0,0 +1,23 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: DotNetCore-Dockerfile + labels: + move2kube.konveyor.io/task: containerization + move2kube.konveyor.io/built-in: true +spec: + class: "DotNetCoreDockerfileGenerator" + directoryDetect: + levels: -1 + consumes: + Service: + merge: false + produces: + Dockerfile: + disabled: false + DockerfileForService: + disabled: false + config: + defaultDotNetCoreVersion: "5.0" + externalFiles: + "../mappings/nodeversions.yaml" : mappings/nodeversions.yaml diff --git a/assets/built-in/transformers/dockerfilegenerator/golang/mappings/golangversions.yaml b/assets/built-in/transformers/dockerfilegenerator/golang/mappings/golangversions.yaml new file mode 100644 index 0000000..09d37bb --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/golang/mappings/golangversions.yaml @@ -0,0 +1,20 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: GolangVersionsMapping +metadata: + name: GolangVersionsMapping +spec: + golangVersions: + - version: "1.18" + imageTag: "1.18" + - version: "1.17" + imageTag: "1.17" + - version: "1.16" + imageTag: "1.16.12" + - version: "1.15" + imageTag: "1.15.14" + - version: "1.14" + imageTag: "1.14.12" + - version: "1.13" + imageTag: "1.13.15" + - version: "1.12" + imageTag: "1.12.8" diff --git a/assets/built-in/transformers/dockerfilegenerator/golang/templates/Dockerfile b/assets/built-in/transformers/dockerfilegenerator/golang/templates/Dockerfile new file mode 100644 index 0000000..b5740c7 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/golang/templates/Dockerfile @@ -0,0 +1,27 @@ +# Copyright IBM Corporation 2020 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Build App +FROM registry.access.redhat.com/ubi8/go-toolset:{{ .GolangImageTag }} AS builder +WORKDIR /{{ .AppName }} +COPY . . +RUN go build -o ./bin/{{ .AppName }} + +# Run App +FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3-201 +COPY --from=builder /{{ .AppName }}/bin/{{ .AppName }} /bin/{{ .AppName }} +{{- range $port := .Ports }} +EXPOSE {{ $port }} +{{- end }} +CMD ["{{ .AppName }}"] diff --git a/assets/built-in/transformers/dockerfilegenerator/golang/transformer.yaml b/assets/built-in/transformers/dockerfilegenerator/golang/transformer.yaml new file mode 100644 index 0000000..e6de062 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/golang/transformer.yaml @@ -0,0 +1,23 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: Golang-Dockerfile + labels: + move2kube.konveyor.io/task: containerization + move2kube.konveyor.io/built-in: true +spec: + class: "GolangDockerfileGenerator" + directoryDetect: + levels: -1 + consumes: + Service: + merge: false + produces: + Dockerfile: + disabled: false + DockerfileForService: + disabled: false + config: + defaultGoVersion: "1.18" + externalFiles: + "./mappings/golangversions.yaml" : mappings/golangversions.yaml diff --git a/assets/built-in/transformers/dockerfilegenerator/java/earanalyser/transformer.yaml b/assets/built-in/transformers/dockerfilegenerator/java/earanalyser/transformer.yaml new file mode 100644 index 0000000..e77b251 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/java/earanalyser/transformer.yaml @@ -0,0 +1,19 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: EarAnalyser + labels: + move2kube.konveyor.io/task: containerization + move2kube.konveyor.io/built-in: true +spec: + class: "EarAnalyser" + directoryDetect: + levels: -1 + consumes: + Service: + merge: false + produces: + Ear: + disabled: false + config: + defaultJavaVersion: "17" diff --git a/assets/built-in/transformers/dockerfilegenerator/java/earrouter/transformer.yaml b/assets/built-in/transformers/dockerfilegenerator/java/earrouter/transformer.yaml new file mode 100644 index 0000000..b1d1d1a --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/java/earrouter/transformer.yaml @@ -0,0 +1,24 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: EarRouter + labels: + move2kube.konveyor.io/built-in: true +spec: + class: "Router" + directoryDetect: + levels: 0 + consumes: + Ear: + merge: true + mode: "MandatoryPassThrough" + produces: + Ear: + disabled: false + config: + transformerSelector: + matchLabels: + move2kube.konveyor.io/earprocessor: "true" + question: + id: 'move2kube.services."{{ .name }}".eartransformer' + description: 'Select the transformer to use for the "{{ .name }}" service' \ No newline at end of file diff --git a/assets/built-in/transformers/dockerfilegenerator/java/gradle/templates/Dockerfile.gradle-build b/assets/built-in/transformers/dockerfilegenerator/java/gradle/templates/Dockerfile.gradle-build new file mode 100644 index 0000000..9d38e68 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/java/gradle/templates/Dockerfile.gradle-build @@ -0,0 +1,34 @@ + +FROM registry.access.redhat.com/ubi8/ubi:latest AS {{ .BuildContainerName }} +RUN yum install -y {{ .JavaPackageName }} + +{{- if not .GradlewPresent }} +# install gradle +RUN yum install -y wget unzip && \ + wget https://services.gradle.org/distributions/gradle-{{ .GradleVersion }}-bin.zip -P /tmp && \ + unzip -d /opt/gradle /tmp/gradle-{{ .GradleVersion }}-bin.zip && \ + rm -rf /tmp/gradle-{{ .GradleVersion }}-bin.zip +ENV PATH="$PATH:/opt/gradle/gradle-{{ .GradleVersion }}/bin/" +{{- end }} + +{{- if .EnvVariables }} +# environment variables +{{- range $k, $v := .EnvVariables }} +ENV {{$k}} {{$v}} +{{- end}} +{{- end}} + +WORKDIR /app + +# copy everything, including child modules to do a build using the parent build.gradle +COPY . . + +{{- if .GradlewPresent }} +COPY gradlew . +COPY gradle gradle +{{- else }} +# generate the gradle wrapper script +RUN gradle wrapper +{{- end }} + +RUN ./gradlew clean assemble {{- range $k, $v := .GradleProperties }} -P{{ $k }}={{ $v }} {{- end }} diff --git a/assets/built-in/transformers/dockerfilegenerator/java/gradle/transformer.yaml b/assets/built-in/transformers/dockerfilegenerator/java/gradle/transformer.yaml new file mode 100644 index 0000000..e083624 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/java/gradle/transformer.yaml @@ -0,0 +1,30 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: Gradle + labels: + move2kube.konveyor.io/task: containerization + move2kube.konveyor.io/built-in: true +spec: + class: "GradleAnalyser" + directoryDetect: + levels: -1 + consumes: + Service: + disabled: false + produces: + Jar: + disabled: false + War: + disabled: false + Ear: + disabled: false + Dockerfile: + disabled: false + externalFiles: + "../../common/Dockerfile.license" : templates/Dockerfile.license + "../mappings/javapackageversions.yaml" : mappings/javapackageversions.yaml + config: + defaultJavaVersion: "17" + defaultGradleVersion: "7.3" + appPathInBuildContainer: "/app" diff --git a/assets/built-in/transformers/dockerfilegenerator/java/jar/templates/Dockerfile.jar-run b/assets/built-in/transformers/dockerfilegenerator/java/jar/templates/Dockerfile.jar-run new file mode 100644 index 0000000..08918fc --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/java/jar/templates/Dockerfile.jar-run @@ -0,0 +1,9 @@ + +FROM registry.access.redhat.com/ubi8/ubi-minimal:latest +{{- range $k, $v := .EnvVariables }} +ENV {{$k}} {{$v}} +{{- end }} +RUN microdnf update && microdnf install --nodocs {{ .JavaPackageName }} && microdnf clean all +COPY {{ if .BuildContainerName }}--from= {{ .BuildContainerName }}{{ end }}{{ .DeploymentFilePath }} . +EXPOSE {{ .Port }} +CMD ["java", "-jar", "{{ .DeploymentFilename }}"] diff --git a/assets/built-in/transformers/dockerfilegenerator/java/jar/transformer.yaml b/assets/built-in/transformers/dockerfilegenerator/java/jar/transformer.yaml new file mode 100644 index 0000000..0114f79 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/java/jar/transformer.yaml @@ -0,0 +1,26 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: Jar + labels: + move2kube.konveyor.io/task: containerization + move2kube.konveyor.io/built-in: true +spec: + class: "JarAnalyser" + directoryDetect: + levels: -1 + consumes: + Service: + merge: false + Jar: + merge: false + produces: + Dockerfile: + disabled: false + DockerfileForService: + disabled: false + externalFiles: + "../../common/Dockerfile.license" : templates/Dockerfile.license + "../mappings/javapackageversions.yaml" : mappings/javapackageversions.yaml + config: + defaultJavaVersion: "17" diff --git a/assets/built-in/transformers/dockerfilegenerator/java/jboss/templates/Dockerfile.jboss b/assets/built-in/transformers/dockerfilegenerator/java/jboss/templates/Dockerfile.jboss new file mode 100644 index 0000000..ab9756b --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/java/jboss/templates/Dockerfile.jboss @@ -0,0 +1,38 @@ + +FROM registry.access.redhat.com/ubi8/ubi-minimal:latest + +{{- if .EnvVariables }} + +# environment variables +{{- range $k, $v := .EnvVariables}} +ENV {{$k}} {{$v}} +{{- end}} +{{- end}} + +RUN microdnf update && microdnf install -y {{ .JavaPackageName }} tar gzip shadow-utils && microdnf clean all +# Set the WILDFLY_VERSION env variable +ENV WILDFLY_BASE_VERSION 26.0.0.Final +ENV WILDFLY_VERSION preview-$WILDFLY_BASE_VERSION +ENV WILDFLY_SHA1 d70903c335dd7a5678484c56a3dc45388c7ff9bd +ENV JBOSS_HOME /opt/jboss/wildfly +USER root +# Add the WildFly distribution to /opt, and make wildfly the owner of the extracted tar content +# Make sure the distribution is available from a well-known place +RUN cd $HOME \ + && curl -L -O https://github.com/wildfly/wildfly/releases/download/$WILDFLY_BASE_VERSION/wildfly-$WILDFLY_VERSION.tar.gz \ + && sha1sum wildfly-$WILDFLY_VERSION.tar.gz | grep $WILDFLY_SHA1 \ + && tar xf wildfly-$WILDFLY_VERSION.tar.gz \ + && mkdir -p $JBOSS_HOME \ + && mv $HOME/wildfly-$WILDFLY_VERSION/* $JBOSS_HOME \ + && rm wildfly-$WILDFLY_VERSION.tar.gz \ + && adduser -r jboss \ + && chown -R jboss:0 ${JBOSS_HOME} \ + && chmod -R g+rw ${JBOSS_HOME} +# Ensure signals are forwarded to the JVM process correctly for graceful shutdown +ENV LAUNCH_JBOSS_IN_BACKGROUND true +USER jboss +COPY {{ if .BuildContainerName }}--from={{ .BuildContainerName }} {{ end }}{{ .DeploymentFilePath }} ${JBOSS_HOME}/standalone/deployments/ +EXPOSE {{ .Port }} +# Set the default command to run on boot +# This will boot WildFly in standalone mode and bind to all interfaces +CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0", "-bmanagement", "0.0.0.0"] diff --git a/assets/built-in/transformers/dockerfilegenerator/java/jboss/transformer.yaml b/assets/built-in/transformers/dockerfilegenerator/java/jboss/transformer.yaml new file mode 100644 index 0000000..a20da86 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/java/jboss/transformer.yaml @@ -0,0 +1,27 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: Jboss + labels: + move2kube.konveyor.io/built-in: true + move2kube.konveyor.io/warprocessor: true + move2kube.konveyor.io/earprocessor: true +spec: + class: "Jboss" + directoryDetect: + levels: 0 + consumes: + War: + merge: false + Ear: + merge: false + produces: + Dockerfile: + disabled: false + DockerfileForService: + disabled: false + externalFiles: + "../../common/Dockerfile.license" : templates/Dockerfile.license + "../mappings/javapackageversions.yaml" : mappings/javapackageversions.yaml + config: + defaultJavaVersion: "17" diff --git a/assets/built-in/transformers/dockerfilegenerator/java/liberty/templates/Dockerfile.liberty b/assets/built-in/transformers/dockerfilegenerator/java/liberty/templates/Dockerfile.liberty new file mode 100644 index 0000000..4b29e91 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/java/liberty/templates/Dockerfile.liberty @@ -0,0 +1,19 @@ + +FROM registry.access.redhat.com/ubi8/ubi-minimal:latest +WORKDIR /app +RUN microdnf update && microdnf install -y {{ .JavaPackageName }} wget unzip && microdnf clean all + +{{- if .EnvVariables }} + +# environment variables +{{- range $k, $v := .EnvVariables }} +ENV {{ $k }} {{ $v }} +{{- end }} +{{- end }} + +RUN wget https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/downloads/wlp/21.0.0.12/wlp-jakartaee9-21.0.0.12.zip && \ + unzip wlp-jakartaee9-21.0.0.12.zip && \ + rm wlp-jakartaee9-21.0.0.12.zip +COPY {{ if .BuildContainerName }}--from={{ .BuildContainerName }} {{ end }}{{ .DeploymentFilePath }} wlp/usr/servers/defaultServer/dropins/ +EXPOSE {{ .Port }} +CMD ["wlp/bin/server", "run"] diff --git a/assets/built-in/transformers/dockerfilegenerator/java/liberty/transformer.yaml b/assets/built-in/transformers/dockerfilegenerator/java/liberty/transformer.yaml new file mode 100644 index 0000000..ecda455 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/java/liberty/transformer.yaml @@ -0,0 +1,27 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: Liberty + labels: + move2kube.konveyor.io/built-in: true + move2kube.konveyor.io/warprocessor: true + move2kube.konveyor.io/earprocessor: true +spec: + class: "Liberty" + directoryDetect: + levels: 0 + consumes: + War: + merge: false + Ear: + merge: false + produces: + Dockerfile: + disabled: false + DockerfileForService: + disabled: false + externalFiles: + "../../common/Dockerfile.license": templates/Dockerfile.license + "../mappings/javapackageversions.yaml": mappings/javapackageversions.yaml + config: + defaultJavaVersion: "17" diff --git a/assets/built-in/transformers/dockerfilegenerator/java/mappings/javapackageversions.yaml b/assets/built-in/transformers/dockerfilegenerator/java/mappings/javapackageversions.yaml new file mode 100644 index 0000000..2368494 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/java/mappings/javapackageversions.yaml @@ -0,0 +1,16 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: JavaPackageVersions +metadata: + name: JavaPackageVersions +spec: + packageVersions: + "1.7": "java-1.8.0-openjdk-devel" # only java 8, 11 and 17 are available + "1.8": "java-1.8.0-openjdk-devel" + "7": "java-1.8.0-openjdk-devel" + "8": "java-1.8.0-openjdk-devel" + "11": "java-11-openjdk-devel" + "17": "java-17-openjdk-devel" + "JavaVersion.VERSION_1_7": "java-1.8.0-openjdk-devel" # only java 8, 11 and 17 are available + "JavaVersion.VERSION_1_8": "java-1.8.0-openjdk-devel" + "JavaVersion.VERSION_11": "java-11-openjdk-devel" + "JavaVersion.VERSION_17": "java-17-openjdk-devel" diff --git a/assets/built-in/transformers/dockerfilegenerator/java/maven/templates/Dockerfile.maven-build b/assets/built-in/transformers/dockerfilegenerator/java/maven/templates/Dockerfile.maven-build new file mode 100644 index 0000000..c0735f9 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/java/maven/templates/Dockerfile.maven-build @@ -0,0 +1,47 @@ + +FROM registry.access.redhat.com/ubi8/ubi:latest AS {{ .BuildContainerName }} +RUN yum install -y {{ .JavaPackageName }} + +{{- if not .MvnwPresent }} +# install maven +RUN mkdir -p /usr/share/maven /usr/share/maven/ref \ + && curl -fsSL -o /tmp/apache-maven.tar.gz https://archive.apache.org/dist/maven/maven-3/{{ .MavenVersion }}/binaries/apache-maven-{{ .MavenVersion }}-bin.tar.gz \ + && tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \ + && rm -f /tmp/apache-maven.tar.gz \ + && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn +{{- end }} + +{{- if .EnvVariables }} + +# environment variables +{{- range $k, $v := .EnvVariables }} +ENV {{ $k }} {{ $v }} +{{- end }} +{{- end }} + +WORKDIR /app + +{{- if .IsParentPom }} +# copy everything, including child modules to do a build using the parent pom.xml +COPY . . +{{- else }} +# copy only the pom and download the dependencies for caching purposes +COPY pom.xml . +{{- end }} + +{{- if .MvnwPresent }} +COPY mvnw . +COPY .mvn .mvn +{{- else }} +# generate the maven wrapper script +RUN mvn wrapper:wrapper +{{- end }} + +{{- if not .IsParentPom }} +RUN ./mvnw dependency:go-offline +# copy the source files to do a build +COPY . . +{{- end }} + +RUN ./mvnw clean package -Dmaven.test.skip -Dcheckstyle.skip +{{- if .MavenProfiles }} -P {{$first := true}}{{ range $mp := .MavenProfiles }}{{if $first}}{{$first = false}}{{else}},{{end}}{{$mp}}{{end}} {{- end }} diff --git a/assets/built-in/transformers/dockerfilegenerator/java/maven/transformer.yaml b/assets/built-in/transformers/dockerfilegenerator/java/maven/transformer.yaml new file mode 100644 index 0000000..9c27879 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/java/maven/transformer.yaml @@ -0,0 +1,30 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: Maven + labels: + move2kube.konveyor.io/task: containerization + move2kube.konveyor.io/built-in: true +spec: + class: "MavenAnalyser" + directoryDetect: + levels: -1 + consumes: + Service: + disabled: false + produces: + Jar: + disabled: false + War: + disabled: false + Ear: + disabled: false + Dockerfile: + disabled: false + externalFiles: + "../../common/Dockerfile.license" : templates/Dockerfile.license + "../mappings/javapackageversions.yaml" : mappings/javapackageversions.yaml + config: + defaultMavenVersion: "3.8.4" + defaultJavaVersion: "17" + appPathInBuildContainer: "/app" \ No newline at end of file diff --git a/assets/built-in/transformers/dockerfilegenerator/java/tomcat/templates/Dockerfile.tomcat b/assets/built-in/transformers/dockerfilegenerator/java/tomcat/templates/Dockerfile.tomcat new file mode 100644 index 0000000..9c49b74 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/java/tomcat/templates/Dockerfile.tomcat @@ -0,0 +1,26 @@ + +FROM registry.access.redhat.com/ubi8/ubi-minimal:latest +WORKDIR /usr/local +RUN microdnf update && microdnf install -y {{ .JavaPackageName }} wget tar gzip shadow-utils && microdnf clean all + +# environment variables +ENV CATALINA_PID='/usr/local/tomcat10/temp/tomcat.pid' CATALINA_HOME='/usr/local/tomcat10' CATALINA_BASE='/usr/local/tomcat10' +{{- range $k, $v := .EnvVariables }} +ENV {{ $k }} {{ $v }} +{{- end }} + +# install tomcat +RUN wget https://archive.apache.org/dist/tomcat/tomcat-10/v10.0.16/bin/apache-tomcat-10.0.16.tar.gz && \ + tar -zxf apache-tomcat-10.0.16.tar.gz && \ + rm -f apache-tomcat-10.0.16.tar.gz && \ + mv apache-tomcat-10.0.16 tomcat10 && \ + rm -r "$CATALINA_BASE"/webapps/ROOT && \ + mkdir "$CATALINA_BASE"/webapps-javaee/ && \ + adduser -r tomcat && chown -R tomcat:root tomcat10 && \ + usermod -aG root tomcat && \ + chmod -R g+rwX tomcat10/ +USER tomcat:root + +COPY --chown=tomcat:root {{ if .BuildContainerName }}--from={{ .BuildContainerName }} {{ end }}{{ .DeploymentFilePath }} "$CATALINA_BASE"/webapps-javaee/ +EXPOSE {{ .Port }} +CMD [ "/usr/local/tomcat10/bin/catalina.sh", "run" ] diff --git a/assets/built-in/transformers/dockerfilegenerator/java/tomcat/transformer.yaml b/assets/built-in/transformers/dockerfilegenerator/java/tomcat/transformer.yaml new file mode 100644 index 0000000..6f6ddb5 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/java/tomcat/transformer.yaml @@ -0,0 +1,24 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: Tomcat + labels: + move2kube.konveyor.io/built-in: true + move2kube.konveyor.io/warprocessor: true +spec: + class: "Tomcat" + directoryDetect: + levels: 0 + consumes: + War: + merge: false + produces: + Dockerfile: + disabled: false + DockerfileForService: + disabled: false + externalFiles: + "../../common/Dockerfile.license" : templates/Dockerfile.license + "../mappings/javapackageversions.yaml" : mappings/javapackageversions.yaml + config: + defaultJavaVersion: "17" diff --git a/assets/built-in/transformers/dockerfilegenerator/java/waranalyser/transformer.yaml b/assets/built-in/transformers/dockerfilegenerator/java/waranalyser/transformer.yaml new file mode 100644 index 0000000..024a6f3 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/java/waranalyser/transformer.yaml @@ -0,0 +1,19 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: WarAnalyser + labels: + move2kube.konveyor.io/task: containerization + move2kube.konveyor.io/built-in: true +spec: + class: "WarAnalyser" + directoryDetect: + levels: -1 + consumes: + Service: + merge: false + produces: + War: + disabled: false + config: + defaultJavaVersion: "17" \ No newline at end of file diff --git a/assets/built-in/transformers/dockerfilegenerator/java/warrouter/transformer.yaml b/assets/built-in/transformers/dockerfilegenerator/java/warrouter/transformer.yaml new file mode 100644 index 0000000..d81a6c0 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/java/warrouter/transformer.yaml @@ -0,0 +1,24 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: WarRouter + labels: + move2kube.konveyor.io/built-in: true +spec: + class: "Router" + directoryDetect: + levels: 0 + consumes: + War: + merge: true + mode: "MandatoryPassThrough" + produces: + War: + disabled: false + config: + transformerSelector: + matchLabels: + move2kube.konveyor.io/warprocessor: "true" + question: + id: 'move2kube.services."{{ .name }}".wartransformer' + description: 'Select the transformer to use for the "{{ .name }}" service' \ No newline at end of file diff --git a/assets/built-in/transformers/dockerfilegenerator/java/zuul/transformer.yaml b/assets/built-in/transformers/dockerfilegenerator/java/zuul/transformer.yaml new file mode 100644 index 0000000..446d112 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/java/zuul/transformer.yaml @@ -0,0 +1,17 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: ZuulAnalyser + labels: + move2kube.konveyor.io/built-in: true +spec: + class: "ZuulAnalyser" + directoryDetect: + levels: 0 + consumes: + IR: + merge: true + mode: "MandatoryPassThrough" + produces: + IR: + disabled: false diff --git a/assets/built-in/transformers/dockerfilegenerator/mappings/nodeversions.yaml b/assets/built-in/transformers/dockerfilegenerator/mappings/nodeversions.yaml new file mode 100644 index 0000000..e5920ee --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/mappings/nodeversions.yaml @@ -0,0 +1,18 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: NodeVersionsMapping +metadata: + name: NodeVersionsMapping +spec: + nodeVersions: + - version: "v16.17.1" + url: "https://nodejs.org/dist/v16.17.1/node-v16.17.1-linux-x64.tar.xz" + imageTag: "16.17.1-alpine" + - version: "v14.20.1" + url: "https://nodejs.org/dist/v14.20.1/node-v14.20.1-linux-x64.tar.xz" + imageTag: "14.20.1-alpine" + - version: "v12.22.5" + url: "https://nodejs.org/dist/v12.22.5/node-v12.22.5-linux-x64.tar.xz" + imageTag: "12.22.5-alpine" + - version: "v10.24.0" + url: "https://nodejs.org/dist/v10.24.0/node-v10.24.0-linux-x64.tar.xz" + imageTag: "10.24.0-alpine" diff --git a/assets/built-in/transformers/dockerfilegenerator/nodejs/templates/Dockerfile b/assets/built-in/transformers/dockerfilegenerator/nodejs/templates/Dockerfile new file mode 100644 index 0000000..d9fa4ee --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/nodejs/templates/Dockerfile @@ -0,0 +1,32 @@ +# Copyright IBM Corporation 2020 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM registry.access.redhat.com/ubi8/nodejs-{{ .NodeMajorVersion }} +COPY . . +{{- if eq .PackageManager "npm" }} +USER root +RUN mkdir -p /opt/app-root/src/.npm +RUN chown -R 1001:0 /opt/app-root/src/ +RUN chmod -R 775 /opt/app-root/src/ +USER 1001 +{{- end }} +{{- if eq .PackageManager "yarn" }} +RUN npm install --global yarn +{{- end }} +RUN {{ .PackageManager }} install +{{- if .Build }} +RUN {{ .PackageManager }} run build +{{- end}} +EXPOSE {{ .Port }} +CMD {{ .PackageManager }} run start diff --git a/assets/built-in/transformers/dockerfilegenerator/nodejs/transformer.yaml b/assets/built-in/transformers/dockerfilegenerator/nodejs/transformer.yaml new file mode 100644 index 0000000..b625c7b --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/nodejs/transformer.yaml @@ -0,0 +1,21 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: Nodejs-Dockerfile + labels: + move2kube.konveyor.io/task: containerization + move2kube.konveyor.io/built-in: true +spec: + class: "NodejsDockerfileGenerator" + directoryDetect: + levels: -1 + consumes: + Service: + merge: false + produces: + Dockerfile: + disabled: false + DockerfileForService: + disabled: false + externalFiles: + "../mappings/nodeversions.yaml" : mappings/nodeversions.yaml diff --git a/assets/built-in/transformers/dockerfilegenerator/php/templates/Dockerfile b/assets/built-in/transformers/dockerfilegenerator/php/templates/Dockerfile new file mode 100644 index 0000000..01e8b8c --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/php/templates/Dockerfile @@ -0,0 +1,23 @@ +# Copyright IBM Corporation 2020 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM registry.access.redhat.com/ubi8/php-74:latest +{{- if .ConfFile }} +COPY {{ .ConfFile }} /etc/httpd/conf.d/ +{{- else}} +RUN printf "ServerName localhost\n\nListen {{ .ConfFilePort }}\n\n ServerAdmin webmaster@localhost\n DocumentRoot /var/www/html\n \n Options Indexes FollowSymLinks\n AllowOverride All\n Require all granted\n\n" > /etc/httpd/conf.d/site.conf +{{- end }} +COPY . /var/www/html/ +EXPOSE {{ .ConfFilePort }} +CMD ["httpd", "-D", "FOREGROUND"] diff --git a/assets/built-in/transformers/dockerfilegenerator/php/transformer.yaml b/assets/built-in/transformers/dockerfilegenerator/php/transformer.yaml new file mode 100644 index 0000000..5e2ffb7 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/php/transformer.yaml @@ -0,0 +1,19 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: PHP-Dockerfile + labels: + move2kube.konveyor.io/task: containerization + move2kube.konveyor.io/built-in: true +spec: + class: "PHPDockerfileGenerator" + directoryDetect: + levels: -1 + consumes: + Service: + merge: false + produces: + Dockerfile: + disabled: false + DockerfileForService: + disabled: false \ No newline at end of file diff --git a/assets/built-in/transformers/dockerfilegenerator/python/templates/Dockerfile b/assets/built-in/transformers/dockerfilegenerator/python/templates/Dockerfile new file mode 100644 index 0000000..7fa8db2 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/python/templates/Dockerfile @@ -0,0 +1,26 @@ +# Copyright IBM Corporation 2020 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM registry.access.redhat.com/ubi8/python-36 +WORKDIR /{{ .AppName }} +COPY . . +{{- if .RequirementsTxt }} +RUN pip install -r {{ .RequirementsTxt }} +{{- end }} +EXPOSE {{ .Port }} +{{- if .IsDjango }} +CMD ["python", "{{ .StartingScriptRelPath }}", "runserver", "0.0.0.0:{{ .Port }}"] +{{- else}} +CMD ["python", "{{ .StartingScriptRelPath }}"] +{{- end }} diff --git a/assets/built-in/transformers/dockerfilegenerator/python/transformer.yaml b/assets/built-in/transformers/dockerfilegenerator/python/transformer.yaml new file mode 100644 index 0000000..70d90fa --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/python/transformer.yaml @@ -0,0 +1,19 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: Python-Dockerfile + labels: + move2kube.konveyor.io/task: containerization + move2kube.konveyor.io/built-in: true +spec: + class: "PythonDockerfileGenerator" + directoryDetect: + levels: -1 + consumes: + Service: + merge: false + produces: + Dockerfile: + disabled: false + DockerfileForService: + disabled: false diff --git a/assets/built-in/transformers/dockerfilegenerator/ruby/templates/Dockerfile b/assets/built-in/transformers/dockerfilegenerator/ruby/templates/Dockerfile new file mode 100644 index 0000000..316d7e2 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/ruby/templates/Dockerfile @@ -0,0 +1,22 @@ +# Copyright IBM Corporation 2020 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License + +FROM ruby:2.5 +COPY . /{{ .AppName }} +RUN mkdir -p /{{ .AppName }} +WORKDIR /{{ .AppName }} +RUN cd /{{ .AppName }} +RUN bundle install +EXPOSE {{ .Port }} +CMD ["ruby","/{{ .AppName }}/{{ .AppName }}.rb"] diff --git a/assets/built-in/transformers/dockerfilegenerator/ruby/transformer.yaml b/assets/built-in/transformers/dockerfilegenerator/ruby/transformer.yaml new file mode 100644 index 0000000..7277316 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/ruby/transformer.yaml @@ -0,0 +1,19 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: Ruby-Dockerfile + labels: + move2kube.konveyor.io/task: containerization + move2kube.konveyor.io/built-in: true +spec: + class: "RubyDockerfileGenerator" + directoryDetect: + levels: -1 + consumes: + Service: + merge: false + produces: + Dockerfile: + disabled: false + DockerfileForService: + disabled: false \ No newline at end of file diff --git a/assets/built-in/transformers/dockerfilegenerator/rust/templates/Dockerfile b/assets/built-in/transformers/dockerfilegenerator/rust/templates/Dockerfile new file mode 100644 index 0000000..5b6fe5e --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/rust/templates/Dockerfile @@ -0,0 +1,29 @@ +# Copyright IBM Corporation 2021 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +FROM rust:1 as builder +WORKDIR /{{ .AppName }} +COPY . . +RUN cargo build --release + +FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3-201 +WORKDIR /{{ .AppName }} +COPY --from=builder /{{ .AppName }}/target/release/{{ .AppName }} /{{ .AppName }}/ +{{- if .RocketToml}} +COPY --from=builder /{{ .AppName }}/{{ .RocketToml }} /{{ .AppName }}/ +ENV ROCKET_ADDRESS={{ .RocketAddress }} +{{- end }} +EXPOSE {{ .Port }} +CMD ["./{{ .AppName }}"] diff --git a/assets/built-in/transformers/dockerfilegenerator/rust/transformer.yaml b/assets/built-in/transformers/dockerfilegenerator/rust/transformer.yaml new file mode 100644 index 0000000..e8ab2f7 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/rust/transformer.yaml @@ -0,0 +1,19 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: Rust-Dockerfile + labels: + move2kube.konveyor.io/task: containerization + move2kube.konveyor.io/built-in: true +spec: + class: "RustDockerfileGenerator" + directoryDetect: + levels: -1 + consumes: + Service: + merge: false + produces: + Dockerfile: + disabled: false + DockerfileForService: + disabled: false \ No newline at end of file diff --git a/assets/built-in/transformers/dockerfilegenerator/windows/mappings/dotnetwindowsversionmapping.yaml b/assets/built-in/transformers/dockerfilegenerator/windows/mappings/dotnetwindowsversionmapping.yaml new file mode 100644 index 0000000..cf65265 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/windows/mappings/dotnetwindowsversionmapping.yaml @@ -0,0 +1,14 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: DotNetWindowsVersionMapping +metadata: + name: DotNetWindowsVersionMapping +spec: + # Version compatibility table taken from https://hub.docker.com/_/microsoft-dotnet-framework-aspnet + # imageTagToSupportedVersions is a mapping from image tag to dot net framework versions that image supports. + imageTagToSupportedVersions: + "4.8": ["4.8"] + "4.7.2": ["4.7.2"] + "4.7.1": ["4.7.1"] + "4.7": ["4.7"] + "4.6.2": ["4.6.2"] + "3.5": ["4.7.2", "3.5", "3.0", "2.5"] # windowsservercore-ltsc2019 diff --git a/assets/built-in/transformers/dockerfilegenerator/windows/winconsole/templates/Dockerfile b/assets/built-in/transformers/dockerfilegenerator/windows/winconsole/templates/Dockerfile new file mode 100644 index 0000000..f4cfc18 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/windows/winconsole/templates/Dockerfile @@ -0,0 +1,28 @@ +# Copyright IBM Corporation 2021 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Build Stage +FROM --platform=windows/amd64 mcr.microsoft.com/dotnet/framework/sdk:{{ .BaseImageVersion }} As builder +WORKDIR /app +COPY . . +RUN msbuild /p:Configuration=Release /p:OutputPath=/app/output + +# Run Stage +FROM --platform=windows/amd64 mcr.microsoft.com/dotnet/framework/runtime:{{ .BaseImageVersion }} +{{- range $port := .Ports }} +EXPOSE {{ $port }} +{{- end }} +WORKDIR /app +COPY --from=builder /app/output/ . +CMD {{ .AppName }}.exe \ No newline at end of file diff --git a/assets/built-in/transformers/dockerfilegenerator/windows/winconsole/transformer.yaml b/assets/built-in/transformers/dockerfilegenerator/windows/winconsole/transformer.yaml new file mode 100644 index 0000000..9a57e36 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/windows/winconsole/transformer.yaml @@ -0,0 +1,20 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: WinConsoleApp-Dockerfile + labels: + move2kube.konveyor.io/task: containerization + move2kube.konveyor.io/built-in: true + move2kube.konveyor.io/default-selected: false +spec: + class: "WinConsoleAppDockerfileGenerator" + directoryDetect: + levels: -1 + consumes: + Service: + merge: false + produces: + Dockerfile: + disabled: false + DockerfileForService: + disabled: false \ No newline at end of file diff --git a/assets/built-in/transformers/dockerfilegenerator/windows/winsilverlightweb/templates/Dockerfile b/assets/built-in/transformers/dockerfilegenerator/windows/winsilverlightweb/templates/Dockerfile new file mode 100644 index 0000000..a4117bc --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/windows/winsilverlightweb/templates/Dockerfile @@ -0,0 +1,35 @@ +# Copyright IBM Corporation 2021 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Build stage +FROM --platform=windows/amd64 hugodahl/silverlightbuild:sl5 As builder +WORKDIR /app +COPY . . +RUN msbuild {{ .AppName }}.sln +RUN mkdir output +RUN cp {{ .AppName }}.Web/*.html output/ +RUN cp {{ .AppName }}.Web/*.aspx output/ +RUN cp {{ .AppName }}.Web/*.js output/ +RUN cp {{ .AppName }}.Web/Web.config output/ +RUN cp -r {{ .AppName }}.Web/bin output/ +RUN cp -r {{ .AppName }}.Web/ClientBin output/ + +# Run stage +FROM --platform=windows/amd64 mcr.microsoft.com/windows/servercore/iis +RUN powershell -NoProfile -Command Remove-Item -Recurse C:\inetpub\wwwroot\* +{{- range .Ports}} +EXPOSE {{.}} +{{- end}} +WORKDIR /inetpub/wwwroot +COPY --from=builder /app/output/ . \ No newline at end of file diff --git a/assets/built-in/transformers/dockerfilegenerator/windows/winsilverlightweb/transformer.yaml b/assets/built-in/transformers/dockerfilegenerator/windows/winsilverlightweb/transformer.yaml new file mode 100644 index 0000000..491a860 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/windows/winsilverlightweb/transformer.yaml @@ -0,0 +1,20 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: WinSLWebApp-Dockerfile + labels: + move2kube.konveyor.io/task: containerization + move2kube.konveyor.io/built-in: true + move2kube.konveyor.io/default-selected: false +spec: + class: "WinSilverLightWebAppDockerfileGenerator" + directoryDetect: + levels: -1 + consumes: + Service: + merge: false + produces: + Dockerfile: + disabled: false + DockerfileForService: + disabled: false \ No newline at end of file diff --git a/assets/built-in/transformers/dockerfilegenerator/windows/winweb/templates/Dockerfile b/assets/built-in/transformers/dockerfilegenerator/windows/winweb/templates/Dockerfile new file mode 100644 index 0000000..93a9e83 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/windows/winweb/templates/Dockerfile @@ -0,0 +1,33 @@ +# Copyright IBM Corporation 2021 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +{{ if .IncludeBuildStage }} +# Build Stage +FROM --platform=windows/amd64 mcr.microsoft.com/dotnet/framework/sdk:{{ .BuildStageImageTag }} AS {{ .BuildContainerName }} +WORKDIR /app +COPY . . +RUN nuget restore +RUN msbuild /p:Configuration=Release +{{- end }} + +{{ if .IncludeRunStage }} +# Run Stage +FROM --platform=windows/amd64 mcr.microsoft.com/dotnet/framework/aspnet:{{ .RunStageImageTag }} +ENV DOTNET_GENERATE_ASPNET_CERTIFICATE=false +WORKDIR /inetpub/wwwroot +{{- range .Ports }} +EXPOSE {{ . }} +{{- end }} +COPY {{ if .BuildContainerName }}--from={{ .BuildContainerName }}{{ end }} {{ .CopyFrom }} ./ +{{- end }} diff --git a/assets/built-in/transformers/dockerfilegenerator/windows/winweb/transformer.yaml b/assets/built-in/transformers/dockerfilegenerator/windows/winweb/transformer.yaml new file mode 100644 index 0000000..9884dc1 --- /dev/null +++ b/assets/built-in/transformers/dockerfilegenerator/windows/winweb/transformer.yaml @@ -0,0 +1,21 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: WinWebApp-Dockerfile + labels: + move2kube.konveyor.io/task: containerization + move2kube.konveyor.io/built-in: true +spec: + class: "WinWebAppDockerfileGenerator" + directoryDetect: + levels: -1 + consumes: + Service: + merge: false + produces: + Dockerfile: + disabled: false + DockerfileForService: + disabled: false + externalFiles: + "../mappings/dotnetwindowsversionmapping.yaml" : mappings/dotnetwindowsversionmapping.yaml diff --git a/assets/built-in/transformers/kubernetes/argocd/transformer.yaml b/assets/built-in/transformers/kubernetes/argocd/transformer.yaml new file mode 100644 index 0000000..165686f --- /dev/null +++ b/assets/built-in/transformers/kubernetes/argocd/transformer.yaml @@ -0,0 +1,22 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: ArgoCD + labels: + move2kube.konveyor.io/built-in: true +spec: + class: "ArgoCD" + directoryDetect: + levels: 0 + consumes: + IR: + merge: true + dependency: + matchLabels: + move2kube.konveyor.io/kubernetesclusterselector: "true" + produces: + KubernetesYamls: + disabled: false + config: + outputPath: "deploy/cicd/argocd" + setDefaultValuesInYamls: false diff --git a/assets/built-in/transformers/kubernetes/buildconfig/transformer.yaml b/assets/built-in/transformers/kubernetes/buildconfig/transformer.yaml new file mode 100644 index 0000000..be8009e --- /dev/null +++ b/assets/built-in/transformers/kubernetes/buildconfig/transformer.yaml @@ -0,0 +1,22 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: Buildconfig + labels: + move2kube.konveyor.io/built-in: true +spec: + class: "BuildConfig" + directoryDetect: + levels: 0 + consumes: + IR: + merge: true + produces: + KubernetesYamls: + disabled: false + dependency: + matchLabels: + move2kube.konveyor.io/kubernetesclusterselector: "true" + config: + outputPath: "deploy/cicd/buildconfig" + setDefaultValuesInYamls: false diff --git a/assets/built-in/transformers/kubernetes/clusterselector/clusters/aws-eks.yaml b/assets/built-in/transformers/kubernetes/clusterselector/clusters/aws-eks.yaml new file mode 100644 index 0000000..8576e52 --- /dev/null +++ b/assets/built-in/transformers/kubernetes/clusterselector/clusters/aws-eks.yaml @@ -0,0 +1,155 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: ClusterMetadata +metadata: + name: AWS-EKS +spec: + storageClasses: + - gp2 + apiKindVersionMap: + APIService: + - apiregistration.k8s.io/v1 + - apiregistration.k8s.io/v1beta1 + Binding: + - v1 + CSIDriver: + - storage.k8s.io/v1beta1 + CSINode: + - storage.k8s.io/v1 + - storage.k8s.io/v1beta1 + CertificateSigningRequest: + - certificates.k8s.io/v1beta1 + ClusterRole: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + ClusterRoleBinding: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + ComponentStatus: + - v1 + ConfigMap: + - v1 + ControllerRevision: + - apps/v1 + CronJob: + - batch/v1beta1 + CustomResourceDefinition: + - apiextensions.k8s.io/v1 + - apiextensions.k8s.io/v1beta1 + DaemonSet: + - apps/v1 + Deployment: + - apps/v1 + ENIConfig: + - crd.k8s.amazonaws.com/v1alpha1 + EndpointSlice: + - discovery.k8s.io/v1beta1 + Endpoints: + - v1 + Event: + - events.k8s.io/v1beta1 + - v1 + Eviction: + - v1 + HorizontalPodAutoscaler: + - autoscaling/v1 + - autoscaling/v2beta1 + - autoscaling/v2beta2 + Ingress: + - networking.k8s.io/v1beta1 + - extensions/v1beta1 + Job: + - batch/v1 + Lease: + - coordination.k8s.io/v1 + - coordination.k8s.io/v1beta1 + LimitRange: + - v1 + LocalSubjectAccessReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + MutatingWebhookConfiguration: + - admissionregistration.k8s.io/v1 + - admissionregistration.k8s.io/v1beta1 + Namespace: + - v1 + NetworkPolicy: + - networking.k8s.io/v1 + Node: + - v1 + NodeProxyOptions: + - v1 + PersistentVolume: + - v1 + PersistentVolumeClaim: + - v1 + Pod: + - v1 + PodAttachOptions: + - v1 + PodDisruptionBudget: + - policy/v1beta1 + PodExecOptions: + - v1 + PodPortForwardOptions: + - v1 + PodProxyOptions: + - v1 + PodSecurityPolicy: + - policy/v1beta1 + PodTemplate: + - v1 + PriorityClass: + - scheduling.k8s.io/v1 + - scheduling.k8s.io/v1beta1 + ReplicaSet: + - apps/v1 + ReplicationController: + - v1 + ResourceQuota: + - v1 + Role: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + RoleBinding: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + RuntimeClass: + - node.k8s.io/v1beta1 + Scale: + - apps/v1 + - v1 + Secret: + - v1 + SecurityGroupPolicy: + - vpcresources.k8s.aws/v1beta1 + SelfSubjectAccessReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + SelfSubjectRulesReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + Service: + - v1 + ServiceAccount: + - v1 + ServiceProxyOptions: + - v1 + StatefulSet: + - apps/v1 + StorageClass: + - storage.k8s.io/v1 + - storage.k8s.io/v1beta1 + SubjectAccessReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + TokenRequest: + - v1 + TokenReview: + - authentication.k8s.io/v1 + - authentication.k8s.io/v1beta1 + ValidatingWebhookConfiguration: + - admissionregistration.k8s.io/v1 + - admissionregistration.k8s.io/v1beta1 + VolumeAttachment: + - storage.k8s.io/v1 + - storage.k8s.io/v1beta1 diff --git a/assets/built-in/transformers/kubernetes/clusterselector/clusters/azure-aks.yaml b/assets/built-in/transformers/kubernetes/clusterselector/clusters/azure-aks.yaml new file mode 100644 index 0000000..be49666 --- /dev/null +++ b/assets/built-in/transformers/kubernetes/clusterselector/clusters/azure-aks.yaml @@ -0,0 +1,160 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: ClusterMetadata +metadata: + name: Azure-AKS +spec: + storageClasses: + - azurefile + - azurefile-premium + - default + - managed-premium + apiKindVersionMap: + APIService: + - apiregistration.k8s.io/v1 + - apiregistration.k8s.io/v1beta1 + Binding: + - v1 + CSIDriver: + - storage.k8s.io/v1beta1 + CSINode: + - storage.k8s.io/v1 + - storage.k8s.io/v1beta1 + CertificateSigningRequest: + - certificates.k8s.io/v1beta1 + ClusterRole: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + ClusterRoleBinding: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + ComponentStatus: + - v1 + ConfigMap: + - v1 + ControllerRevision: + - apps/v1 + CronJob: + - batch/v1beta1 + CustomResourceDefinition: + - apiextensions.k8s.io/v1 + - apiextensions.k8s.io/v1beta1 + DaemonSet: + - apps/v1 + Deployment: + - apps/v1 + EndpointSlice: + - discovery.k8s.io/v1beta1 + Endpoints: + - v1 + Event: + - events.k8s.io/v1beta1 + - v1 + Eviction: + - v1 + HealthState: + - azmon.container.insights/v1 + HorizontalPodAutoscaler: + - autoscaling/v1 + - autoscaling/v2beta1 + - autoscaling/v2beta2 + Ingress: + - networking.k8s.io/v1beta1 + - extensions/v1beta1 + Job: + - batch/v1 + Lease: + - coordination.k8s.io/v1 + - coordination.k8s.io/v1beta1 + LimitRange: + - v1 + LocalSubjectAccessReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + MutatingWebhookConfiguration: + - admissionregistration.k8s.io/v1 + - admissionregistration.k8s.io/v1beta1 + Namespace: + - v1 + NetworkPolicy: + - networking.k8s.io/v1 + Node: + - v1 + NodeMetrics: + - metrics.k8s.io/v1beta1 + NodeProxyOptions: + - v1 + PersistentVolume: + - v1 + PersistentVolumeClaim: + - v1 + Pod: + - v1 + PodAttachOptions: + - v1 + PodDisruptionBudget: + - policy/v1beta1 + PodExecOptions: + - v1 + PodMetrics: + - metrics.k8s.io/v1beta1 + PodPortForwardOptions: + - v1 + PodProxyOptions: + - v1 + PodSecurityPolicy: + - policy/v1beta1 + PodTemplate: + - v1 + PriorityClass: + - scheduling.k8s.io/v1 + - scheduling.k8s.io/v1beta1 + ReplicaSet: + - apps/v1 + ReplicationController: + - v1 + ResourceQuota: + - v1 + Role: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + RoleBinding: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + RuntimeClass: + - node.k8s.io/v1beta1 + Scale: + - apps/v1 + - v1 + Secret: + - v1 + SelfSubjectAccessReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + SelfSubjectRulesReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + Service: + - v1 + ServiceAccount: + - v1 + ServiceProxyOptions: + - v1 + StatefulSet: + - apps/v1 + StorageClass: + - storage.k8s.io/v1 + - storage.k8s.io/v1beta1 + SubjectAccessReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + TokenRequest: + - v1 + TokenReview: + - authentication.k8s.io/v1 + - authentication.k8s.io/v1beta1 + ValidatingWebhookConfiguration: + - admissionregistration.k8s.io/v1 + - admissionregistration.k8s.io/v1beta1 + VolumeAttachment: + - storage.k8s.io/v1 + - storage.k8s.io/v1beta1 diff --git a/assets/built-in/transformers/kubernetes/clusterselector/clusters/gcp-gke.yaml b/assets/built-in/transformers/kubernetes/clusterselector/clusters/gcp-gke.yaml new file mode 100644 index 0000000..0d1d780 --- /dev/null +++ b/assets/built-in/transformers/kubernetes/clusterselector/clusters/gcp-gke.yaml @@ -0,0 +1,138 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: ClusterMetadata +metadata: + name: GCP-GKE +spec: + storageClasses: + - standard + apiKindVersionMap: + APIService: + - apiregistration.k8s.io/v1 + BackendConfig: + - cloud.google.com/v1 + Binding: + - v1 + CSIDriver: + - storage.k8s.io/v1beta1 + CSINode: + - storage.k8s.io/v1beta1 + CertificateSigningRequest: + - certificates.k8s.io/v1beta1 + ClusterRole: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + ClusterRoleBinding: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + ComponentStatus: + - v1 + ConfigMap: + - v1 + ControllerRevision: + - apps/v1 + CronJob: + - batch/v1beta1 + CustomResourceDefinition: + - apiextensions.k8s.io/v1 + DaemonSet: + - apps/v1 + Deployment: + - apps/v1 + Endpoints: + - v1 + Event: + - v1 + HorizontalPodAutoscaler: + - autoscaling/v1 + - autoscaling/v2beta1 + - autoscaling/v2beta2 + Ingress: + - networking.k8s.io/v1beta1 + - extensions/v1beta1 + Job: + - batch/v1 + Lease: + - coordination.k8s.io/v1beta1 + - coordination.k8s.io/v1 + LimitRange: + - v1 + LocalSubjectAccessReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + ManagedCertificate: + - networking.gke.io/v1beta2 + MutatingWebhookConfiguration: + - admissionregistration.k8s.io/v1beta1 + - admissionregistration.k8s.io/v1 + Namespace: + - v1 + NetworkPolicy: + - networking.k8s.io/v1 + Node: + - v1 + PersistentVolume: + - v1 + PersistentVolumeClaim: + - v1 + Pod: + - v1 + PodDisruptionBudget: + - policy/v1beta1 + PodSecurityPolicy: + - policy/v1beta1 + PodTemplate: + - v1 + PriorityClass: + - scheduling.k8s.io/v1beta1 + - scheduling.k8s.io/v1 + ReplicaSet: + - apps/v1 + ReplicationController: + - v1 + ResourceQuota: + - v1 + Role: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + RoleBinding: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + RuntimeClass: + - node.k8s.io/v1beta1 + ScalingPolicy: + - scalingpolicy.kope.io/v1alpha1 + Secret: + - v1 + SelfSubjectAccessReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + SelfSubjectRulesReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + Service: + - v1 + ServiceAccount: + - v1 + StatefulSet: + - apps/v1 + StorageClass: + - storage.k8s.io/v1 + - storage.k8s.io/v1beta1 + StorageState: + - migration.k8s.io/v1alpha1 + StorageVersionMigration: + - migration.k8s.io/v1alpha1 + SubjectAccessReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + TokenReview: + - authentication.k8s.io/v1 + - authentication.k8s.io/v1beta1 + UpdateInfo: + - nodemanagement.gke.io/v1alpha1 + ValidatingWebhookConfiguration: + - admissionregistration.k8s.io/v1beta1 + - admissionregistration.k8s.io/v1 + VolumeAttachment: + - storage.k8s.io/v1 + - storage.k8s.io/v1beta1 diff --git a/assets/built-in/transformers/kubernetes/clusterselector/clusters/ibm-iks.yaml b/assets/built-in/transformers/kubernetes/clusterselector/clusters/ibm-iks.yaml new file mode 100644 index 0000000..b6b5162 --- /dev/null +++ b/assets/built-in/transformers/kubernetes/clusterselector/clusters/ibm-iks.yaml @@ -0,0 +1,195 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: ClusterMetadata +metadata: + name: IBM-IKS +spec: + storageClasses: + - default + - ibmc-block-bronze + - ibmc-block-custom + - ibmc-block-gold + - ibmc-block-retain-bronze + - ibmc-block-retain-custom + - ibmc-block-retain-gold + - ibmc-block-retain-silver + - ibmc-block-silver + - ibmc-file-bronze + - ibmc-file-bronze-gid + - ibmc-file-custom + - ibmc-file-gold + - ibmc-file-gold-gid + - ibmc-file-retain-bronze + - ibmc-file-retain-custom + - ibmc-file-retain-gold + - ibmc-file-retain-silver + - ibmc-file-silver + - ibmc-file-silver-gid + apiKindVersionMap: + APIService: + - apiregistration.k8s.io/v1 + BGPConfiguration: + - crd.projectcalico.org/v1 + BGPPeer: + - crd.projectcalico.org/v1 + Binding: + - v1 + BlockAffinity: + - crd.projectcalico.org/v1 + CSIDriver: + - storage.k8s.io/v1 + - storage.k8s.io/v1beta1 + CSINode: + - storage.k8s.io/v1 + - storage.k8s.io/v1beta1 + CatalogSource: + - operators.coreos.com/v1alpha1 + CertificateSigningRequest: + - certificates.k8s.io/v1beta1 + ClusterInformation: + - crd.projectcalico.org/v1 + ClusterRole: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + ClusterRoleBinding: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + ClusterServiceVersion: + - operators.coreos.com/v1alpha1 + ComponentStatus: + - v1 + ConfigMap: + - v1 + ControllerRevision: + - apps/v1 + CronJob: + - batch/v1beta1 + - batch/v2alpha1 + CustomResourceDefinition: + - apiextensions.k8s.io/v1 + DaemonSet: + - apps/v1 + Deployment: + - apps/v1 + EndpointSlice: + - discovery.k8s.io/v1beta1 + Endpoints: + - v1 + Event: + - events.k8s.io/v1beta1 + - v1 + FelixConfiguration: + - crd.projectcalico.org/v1 + GlobalNetworkPolicy: + - crd.projectcalico.org/v1 + GlobalNetworkSet: + - crd.projectcalico.org/v1 + HorizontalPodAutoscaler: + - autoscaling/v1 + - autoscaling/v2beta1 + - autoscaling/v2beta2 + HostEndpoint: + - crd.projectcalico.org/v1 + IPAMBlock: + - crd.projectcalico.org/v1 + IPAMConfig: + - crd.projectcalico.org/v1 + IPAMHandle: + - crd.projectcalico.org/v1 + IPPool: + - crd.projectcalico.org/v1 + Ingress: + - networking.k8s.io/v1 + - networking.k8s.io/v1beta1 + - extensions/v1beta1 + IngressClass: + - networking.k8s.io/v1 + - networking.k8s.io/v1beta1 + InstallPlan: + - operators.coreos.com/v1alpha1 + Job: + - batch/v1 + KubeControllersConfiguration: + - crd.projectcalico.org/v1 + Lease: + - coordination.k8s.io/v1beta1 + - coordination.k8s.io/v1 + LimitRange: + - v1 + LocalSubjectAccessReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + MutatingWebhookConfiguration: + - admissionregistration.k8s.io/v1beta1 + - admissionregistration.k8s.io/v1 + Namespace: + - v1 + NetworkPolicy: + - networking.k8s.io/v1 + NetworkSet: + - crd.projectcalico.org/v1 + Node: + - v1 + Operator: + - operators.coreos.com/v1 + OperatorGroup: + - operators.coreos.com/v1 + PersistentVolume: + - v1 + PersistentVolumeClaim: + - v1 + Pod: + - v1 + PodDisruptionBudget: + - policy/v1beta1 + PodSecurityPolicy: + - policy/v1beta1 + PodTemplate: + - v1 + PriorityClass: + - scheduling.k8s.io/v1beta1 + - scheduling.k8s.io/v1 + RBACSync: + - ibm.com/v1alpha1 + ReplicaSet: + - apps/v1 + ReplicationController: + - v1 + ResourceQuota: + - v1 + Role: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + RoleBinding: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + Secret: + - v1 + SelfSubjectAccessReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + SelfSubjectRulesReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + Service: + - v1 + ServiceAccount: + - v1 + StatefulSet: + - apps/v1 + StorageClass: + - storage.k8s.io/v1 + - storage.k8s.io/v1beta1 + SubjectAccessReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + Subscription: + - operators.coreos.com/v1alpha1 + TokenReview: + - authentication.k8s.io/v1 + - authentication.k8s.io/v1beta1 + ValidatingWebhookConfiguration: + - admissionregistration.k8s.io/v1beta1 + - admissionregistration.k8s.io/v1 + VolumeAttachment: + - storage.k8s.io/v1 + - storage.k8s.io/v1beta1 diff --git a/assets/built-in/transformers/kubernetes/clusterselector/clusters/ibm-openshift.yaml b/assets/built-in/transformers/kubernetes/clusterselector/clusters/ibm-openshift.yaml new file mode 100644 index 0000000..1b38f38 --- /dev/null +++ b/assets/built-in/transformers/kubernetes/clusterselector/clusters/ibm-openshift.yaml @@ -0,0 +1,291 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: ClusterMetadata +metadata: + name: IBM-Openshift +spec: + storageClasses: + - default + - ibmc-block-bronze + - ibmc-block-custom + - ibmc-block-gold + - ibmc-block-retain-bronze + - ibmc-block-retain-custom + - ibmc-block-retain-gold + - ibmc-block-retain-silver + - ibmc-block-silver + - ibmc-file-bronze + - ibmc-file-bronze-gid + - ibmc-file-custom + - ibmc-file-gold + - ibmc-file-gold-gid + - ibmc-file-retain-bronze + - ibmc-file-retain-custom + - ibmc-file-retain-gold + - ibmc-file-retain-silver + - ibmc-file-silver + - ibmc-file-silver-gid + apiKindVersionMap: + APIService: + - apiregistration.k8s.io/v1 + - apiregistration.k8s.io/v1beta1 + Alertmanager: + - monitoring.coreos.com/v1 + AppliedClusterResourceQuota: + - quota.openshift.io/v1 + BinaryBuildRequestOptions: + - build.openshift.io/v1 + Binding: + - v1 + BrokerTemplateInstance: + - template.openshift.io/v1 + Build: + - build.openshift.io/v1 + BuildConfig: + - build.openshift.io/v1 + BuildLog: + - build.openshift.io/v1 + BuildRequest: + - build.openshift.io/v1 + Bundle: + - automationbroker.io/v1alpha1 + BundleBinding: + - automationbroker.io/v1alpha1 + BundleInstance: + - automationbroker.io/v1alpha1 + CertificateSigningRequest: + - certificates.k8s.io/v1beta1 + ClusterNetwork: + - network.openshift.io/v1 + ClusterResourceQuota: + - quota.openshift.io/v1 + ClusterRole: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + - authorization.openshift.io/v1 + ClusterRoleBinding: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + - authorization.openshift.io/v1 + ClusterServiceBroker: + - servicecatalog.k8s.io/v1beta1 + ClusterServiceClass: + - servicecatalog.k8s.io/v1beta1 + ClusterServicePlan: + - servicecatalog.k8s.io/v1beta1 + ComponentStatus: + - v1 + ConfigMap: + - v1 + ControllerRevision: + - apps/v1 + - apps/v1beta1 + - apps/v1beta2 + CronJob: + - batch/v1beta1 + CustomResourceDefinition: + - apiextensions.k8s.io/v1beta1 + DaemonSet: + - apps/v1 + - apps/v1beta2 + - extensions/v1beta1 + Deployment: + - apps/v1 + - apps/v1beta1 + - apps/v1beta2 + - extensions/v1beta1 + DeploymentConfig: + - apps.openshift.io/v1 + DeploymentConfigRollback: + - apps.openshift.io/v1 + DeploymentLog: + - apps.openshift.io/v1 + DeploymentRequest: + - apps.openshift.io/v1 + DeploymentRollback: + - apps/v1beta1 + - extensions/v1beta1 + EgressNetworkPolicy: + - network.openshift.io/v1 + Endpoints: + - v1 + Event: + - events.k8s.io/v1beta1 + - v1 + Eviction: + - v1 + Group: + - user.openshift.io/v1 + HorizontalPodAutoscaler: + - autoscaling/v1 + - autoscaling/v2beta1 + HostSubnet: + - network.openshift.io/v1 + Identity: + - user.openshift.io/v1 + Image: + - image.openshift.io/v1 + ImageSignature: + - image.openshift.io/v1 + ImageStream: + - image.openshift.io/v1 + ImageStreamImage: + - image.openshift.io/v1 + ImageStreamImport: + - image.openshift.io/v1 + ImageStreamLayers: + - image.openshift.io/v1 + ImageStreamMapping: + - image.openshift.io/v1 + ImageStreamTag: + - image.openshift.io/v1 + Ingress: + - extensions/v1beta1 + Job: + - batch/v1 + LimitRange: + - v1 + LocalResourceAccessReview: + - authorization.openshift.io/v1 + LocalSubjectAccessReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + - authorization.openshift.io/v1 + MutatingWebhookConfiguration: + - admissionregistration.k8s.io/v1beta1 + Namespace: + - v1 + NetNamespace: + - network.openshift.io/v1 + NetworkPolicy: + - networking.k8s.io/v1 + - extensions/v1beta1 + Node: + - v1 + OAuthAccessToken: + - oauth.openshift.io/v1 + OAuthAuthorizeToken: + - oauth.openshift.io/v1 + OAuthClient: + - oauth.openshift.io/v1 + OAuthClientAuthorization: + - oauth.openshift.io/v1 + PersistentVolume: + - v1 + PersistentVolumeClaim: + - v1 + Pod: + - v1 + PodDisruptionBudget: + - policy/v1beta1 + PodSecurityPolicy: + - policy/v1beta1 + - extensions/v1beta1 + PodSecurityPolicyReview: + - security.openshift.io/v1 + PodSecurityPolicySelfSubjectReview: + - security.openshift.io/v1 + PodSecurityPolicySubjectReview: + - security.openshift.io/v1 + PodTemplate: + - v1 + PriorityClass: + - scheduling.k8s.io/v1beta1 + Project: + - project.openshift.io/v1 + ProjectRequest: + - project.openshift.io/v1 + Prometheus: + - monitoring.coreos.com/v1 + PrometheusRule: + - monitoring.coreos.com/v1 + RangeAllocation: + - security.openshift.io/v1 + ReplicaSet: + - apps/v1 + - apps/v1beta2 + - extensions/v1beta1 + ReplicationController: + - v1 + ReplicationControllerDummy: + - extensions/v1beta1 + ResourceAccessReview: + - authorization.openshift.io/v1 + ResourceQuota: + - v1 + Role: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + - authorization.openshift.io/v1 + RoleBinding: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + - authorization.openshift.io/v1 + RoleBindingRestriction: + - authorization.openshift.io/v1 + Route: + - route.openshift.io/v1 + Scale: + - apps/v1 + - apps/v1beta1 + - apps/v1beta2 + - extensions/v1beta1 + - v1 + - apps.openshift.io/v1 + Secret: + - v1 + SecretList: + - image.openshift.io/v1 + SecurityContextConstraints: + - v1 + - security.openshift.io/v1 + SelfSubjectAccessReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + SelfSubjectRulesReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + - authorization.openshift.io/v1 + Service: + - v1 + ServiceAccount: + - v1 + ServiceBinding: + - servicecatalog.k8s.io/v1beta1 + ServiceBroker: + - servicecatalog.k8s.io/v1beta1 + ServiceClass: + - servicecatalog.k8s.io/v1beta1 + ServiceInstance: + - servicecatalog.k8s.io/v1beta1 + ServiceMonitor: + - monitoring.coreos.com/v1 + ServicePlan: + - servicecatalog.k8s.io/v1beta1 + StatefulSet: + - apps/v1 + - apps/v1beta1 + - apps/v1beta2 + StorageClass: + - storage.k8s.io/v1 + - storage.k8s.io/v1beta1 + SubjectAccessReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + - authorization.openshift.io/v1 + SubjectRulesReview: + - authorization.openshift.io/v1 + Template: + - template.openshift.io/v1 + TemplateInstance: + - template.openshift.io/v1 + TokenReview: + - authentication.k8s.io/v1 + - authentication.k8s.io/v1beta1 + User: + - user.openshift.io/v1 + UserIdentityMapping: + - user.openshift.io/v1 + ValidatingWebhookConfiguration: + - admissionregistration.k8s.io/v1beta1 + VolumeAttachment: + - storage.k8s.io/v1beta1 diff --git a/assets/built-in/transformers/kubernetes/clusterselector/clusters/kubernetes.yaml b/assets/built-in/transformers/kubernetes/clusterselector/clusters/kubernetes.yaml new file mode 100644 index 0000000..0c00662 --- /dev/null +++ b/assets/built-in/transformers/kubernetes/clusterselector/clusters/kubernetes.yaml @@ -0,0 +1,135 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: ClusterMetadata +metadata: + name: Kubernetes +spec: + storageClasses: + - default + apiKindVersionMap: + APIService: + - apiregistration.k8s.io/v1 + Binding: + - v1 + CSIDriver: + - storage.k8s.io/v1 + - storage.k8s.io/v1beta1 + CSINode: + - storage.k8s.io/v1 + - storage.k8s.io/v1beta1 + CertificateSigningRequest: + - certificates.k8s.io/v1 + - certificates.k8s.io/v1beta1 + ClusterRole: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + ClusterRoleBinding: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + ComponentStatus: + - v1 + ConfigMap: + - v1 + ControllerRevision: + - apps/v1 + CronJob: + - batch/v1beta1 + - batch/v2alpha1 + CustomResourceDefinition: + - apiextensions.k8s.io/v1 + DaemonSet: + - apps/v1 + Deployment: + - apps/v1 + EndpointSlice: + - discovery.k8s.io/v1beta1 + Endpoints: + - v1 + Event: + - events.k8s.io/v1beta1 + - v1 + HorizontalPodAutoscaler: + - autoscaling/v1 + - autoscaling/v2beta1 + - autoscaling/v2beta2 + Ingress: + - networking.k8s.io/v1 + - networking.k8s.io/v1beta1 + - extensions/v1beta1 + IngressClass: + - networking.k8s.io/v1 + - networking.k8s.io/v1beta1 + Job: + - batch/v1 + Lease: + - coordination.k8s.io/v1beta1 + - coordination.k8s.io/v1 + LimitRange: + - v1 + LocalSubjectAccessReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + MutatingWebhookConfiguration: + - admissionregistration.k8s.io/v1beta1 + - admissionregistration.k8s.io/v1 + Namespace: + - v1 + NetworkPolicy: + - networking.k8s.io/v1 + Node: + - v1 + PersistentVolume: + - v1 + PersistentVolumeClaim: + - v1 + Pod: + - v1 + PodDisruptionBudget: + - policy/v1beta1 + PodSecurityPolicy: + - policy/v1beta1 + PodTemplate: + - v1 + PriorityClass: + - scheduling.k8s.io/v1beta1 + - scheduling.k8s.io/v1 + ReplicaSet: + - apps/v1 + ReplicationController: + - v1 + ResourceQuota: + - v1 + Role: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + RoleBinding: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + Secret: + - v1 + SelfSubjectAccessReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + SelfSubjectRulesReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + Service: + - v1 + ServiceAccount: + - v1 + StatefulSet: + - apps/v1 + StorageClass: + - storage.k8s.io/v1 + - storage.k8s.io/v1beta1 + SubjectAccessReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + TokenReview: + - authentication.k8s.io/v1 + - authentication.k8s.io/v1beta1 + ValidatingWebhookConfiguration: + - admissionregistration.k8s.io/v1beta1 + - admissionregistration.k8s.io/v1 + VolumeAttachment: + - storage.k8s.io/v1 + - storage.k8s.io/v1beta1 diff --git a/assets/built-in/transformers/kubernetes/clusterselector/clusters/openshift.yaml b/assets/built-in/transformers/kubernetes/clusterselector/clusters/openshift.yaml new file mode 100644 index 0000000..1fbef70 --- /dev/null +++ b/assets/built-in/transformers/kubernetes/clusterselector/clusters/openshift.yaml @@ -0,0 +1,272 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: ClusterMetadata +metadata: + name: Openshift +spec: + storageClasses: + - default + apiKindVersionMap: + APIService: + - apiregistration.k8s.io/v1 + - apiregistration.k8s.io/v1beta1 + Alertmanager: + - monitoring.coreos.com/v1 + AppliedClusterResourceQuota: + - quota.openshift.io/v1 + BinaryBuildRequestOptions: + - build.openshift.io/v1 + Binding: + - v1 + BrokerTemplateInstance: + - template.openshift.io/v1 + Build: + - build.openshift.io/v1 + BuildConfig: + - build.openshift.io/v1 + BuildLog: + - build.openshift.io/v1 + BuildRequest: + - build.openshift.io/v1 + Bundle: + - automationbroker.io/v1alpha1 + BundleBinding: + - automationbroker.io/v1alpha1 + BundleInstance: + - automationbroker.io/v1alpha1 + CertificateSigningRequest: + - certificates.k8s.io/v1beta1 + ClusterNetwork: + - network.openshift.io/v1 + ClusterResourceQuota: + - quota.openshift.io/v1 + ClusterRole: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + - authorization.openshift.io/v1 + ClusterRoleBinding: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + - authorization.openshift.io/v1 + ClusterServiceBroker: + - servicecatalog.k8s.io/v1beta1 + ClusterServiceClass: + - servicecatalog.k8s.io/v1beta1 + ClusterServicePlan: + - servicecatalog.k8s.io/v1beta1 + ComponentStatus: + - v1 + ConfigMap: + - v1 + ControllerRevision: + - apps/v1 + - apps/v1beta1 + - apps/v1beta2 + CronJob: + - batch/v1beta1 + CustomResourceDefinition: + - apiextensions.k8s.io/v1beta1 + DaemonSet: + - apps/v1 + - apps/v1beta2 + - extensions/v1beta1 + Deployment: + - apps/v1 + - apps/v1beta1 + - apps/v1beta2 + - extensions/v1beta1 + DeploymentConfig: + - apps.openshift.io/v1 + DeploymentConfigRollback: + - apps.openshift.io/v1 + DeploymentLog: + - apps.openshift.io/v1 + DeploymentRequest: + - apps.openshift.io/v1 + DeploymentRollback: + - apps/v1beta1 + - extensions/v1beta1 + EgressNetworkPolicy: + - network.openshift.io/v1 + Endpoints: + - v1 + Event: + - events.k8s.io/v1beta1 + - v1 + Eviction: + - v1 + Group: + - user.openshift.io/v1 + HorizontalPodAutoscaler: + - autoscaling/v1 + - autoscaling/v2beta1 + HostSubnet: + - network.openshift.io/v1 + Identity: + - user.openshift.io/v1 + Image: + - image.openshift.io/v1 + ImageSignature: + - image.openshift.io/v1 + ImageStream: + - image.openshift.io/v1 + ImageStreamImage: + - image.openshift.io/v1 + ImageStreamImport: + - image.openshift.io/v1 + ImageStreamLayers: + - image.openshift.io/v1 + ImageStreamMapping: + - image.openshift.io/v1 + ImageStreamTag: + - image.openshift.io/v1 + Ingress: + - extensions/v1beta1 + Job: + - batch/v1 + LimitRange: + - v1 + LocalResourceAccessReview: + - authorization.openshift.io/v1 + LocalSubjectAccessReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + - authorization.openshift.io/v1 + MutatingWebhookConfiguration: + - admissionregistration.k8s.io/v1beta1 + Namespace: + - v1 + NetNamespace: + - network.openshift.io/v1 + NetworkPolicy: + - networking.k8s.io/v1 + - extensions/v1beta1 + Node: + - v1 + OAuthAccessToken: + - oauth.openshift.io/v1 + OAuthAuthorizeToken: + - oauth.openshift.io/v1 + OAuthClient: + - oauth.openshift.io/v1 + OAuthClientAuthorization: + - oauth.openshift.io/v1 + PersistentVolume: + - v1 + PersistentVolumeClaim: + - v1 + Pod: + - v1 + PodDisruptionBudget: + - policy/v1beta1 + PodSecurityPolicy: + - policy/v1beta1 + - extensions/v1beta1 + PodSecurityPolicyReview: + - security.openshift.io/v1 + PodSecurityPolicySelfSubjectReview: + - security.openshift.io/v1 + PodSecurityPolicySubjectReview: + - security.openshift.io/v1 + PodTemplate: + - v1 + PriorityClass: + - scheduling.k8s.io/v1beta1 + Project: + - project.openshift.io/v1 + ProjectRequest: + - project.openshift.io/v1 + Prometheus: + - monitoring.coreos.com/v1 + PrometheusRule: + - monitoring.coreos.com/v1 + RangeAllocation: + - security.openshift.io/v1 + ReplicaSet: + - apps/v1 + - apps/v1beta2 + - extensions/v1beta1 + ReplicationController: + - v1 + ReplicationControllerDummy: + - extensions/v1beta1 + ResourceAccessReview: + - authorization.openshift.io/v1 + ResourceQuota: + - v1 + Role: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + - authorization.openshift.io/v1 + RoleBinding: + - rbac.authorization.k8s.io/v1 + - rbac.authorization.k8s.io/v1beta1 + - authorization.openshift.io/v1 + RoleBindingRestriction: + - authorization.openshift.io/v1 + Route: + - route.openshift.io/v1 + Scale: + - apps/v1 + - apps/v1beta1 + - apps/v1beta2 + - extensions/v1beta1 + - v1 + - apps.openshift.io/v1 + Secret: + - v1 + SecretList: + - image.openshift.io/v1 + SecurityContextConstraints: + - security.openshift.io/v1 + - v1 + SelfSubjectAccessReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + SelfSubjectRulesReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + - authorization.openshift.io/v1 + Service: + - v1 + ServiceAccount: + - v1 + ServiceBinding: + - servicecatalog.k8s.io/v1beta1 + ServiceBroker: + - servicecatalog.k8s.io/v1beta1 + ServiceClass: + - servicecatalog.k8s.io/v1beta1 + ServiceInstance: + - servicecatalog.k8s.io/v1beta1 + ServiceMonitor: + - monitoring.coreos.com/v1 + ServicePlan: + - servicecatalog.k8s.io/v1beta1 + StatefulSet: + - apps/v1 + - apps/v1beta1 + - apps/v1beta2 + StorageClass: + - storage.k8s.io/v1 + - storage.k8s.io/v1beta1 + SubjectAccessReview: + - authorization.k8s.io/v1 + - authorization.k8s.io/v1beta1 + - authorization.openshift.io/v1 + SubjectRulesReview: + - authorization.openshift.io/v1 + Template: + - template.openshift.io/v1 + TemplateInstance: + - template.openshift.io/v1 + TokenReview: + - authentication.k8s.io/v1 + - authentication.k8s.io/v1beta1 + User: + - user.openshift.io/v1 + UserIdentityMapping: + - user.openshift.io/v1 + ValidatingWebhookConfiguration: + - admissionregistration.k8s.io/v1beta1 + VolumeAttachment: + - storage.k8s.io/v1beta1 diff --git a/assets/built-in/transformers/kubernetes/clusterselector/transformer.yaml b/assets/built-in/transformers/kubernetes/clusterselector/transformer.yaml new file mode 100644 index 0000000..7ba1b57 --- /dev/null +++ b/assets/built-in/transformers/kubernetes/clusterselector/transformer.yaml @@ -0,0 +1,23 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: ClusterSelector + labels: + move2kube.konveyor.io/built-in: true + move2kube.konveyor.io/kubernetesclusterselector: true +spec: + class: "ClusterSelectorTransformer" + directoryDetect: + levels: 0 + consumes: + IR: + merge: true + mode: OnDemandPassThrough + KubernetesOrgYamlsInSource: + merge: false + mode: OnDemandPassThrough + produces: + IR: + disabled: false + KubernetesOrgYamlsInSource: + disabled: false diff --git a/assets/built-in/transformers/kubernetes/knative/transformer.yaml b/assets/built-in/transformers/kubernetes/knative/transformer.yaml new file mode 100644 index 0000000..6ea0c61 --- /dev/null +++ b/assets/built-in/transformers/kubernetes/knative/transformer.yaml @@ -0,0 +1,22 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: Knative + labels: + move2kube.konveyor.io/built-in: true +spec: + class: "Knative" + directoryDetect: + levels: 0 + consumes: + IR: + merge: true + produces: + KubernetesYamls: + disabled: false + dependency: + matchLabels: + move2kube.konveyor.io/kubernetesclusterselector: "true" + config: + outputPath: "deploy/knative" + setDefaultValuesInYamls: false diff --git a/assets/built-in/transformers/kubernetes/kubernetes/transformer.yaml b/assets/built-in/transformers/kubernetes/kubernetes/transformer.yaml new file mode 100644 index 0000000..1a1b88c --- /dev/null +++ b/assets/built-in/transformers/kubernetes/kubernetes/transformer.yaml @@ -0,0 +1,23 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: Kubernetes + labels: + move2kube.konveyor.io/built-in: true +spec: + class: "Kubernetes" + directoryDetect: + levels: 0 + consumes: + IR: + merge: true + produces: + KubernetesYamls: + disabled: false + dependency: + matchLabels: + move2kube.konveyor.io/kubernetesclusterselector: "true" + config: + outputPath: "deploy/yamls" + ingressName: "{{ .ProjectName }}" + setDefaultValuesInYamls: false diff --git a/assets/built-in/transformers/kubernetes/kubernetesversionchanger/transformer.yaml b/assets/built-in/transformers/kubernetes/kubernetesversionchanger/transformer.yaml new file mode 100644 index 0000000..e8e5a71 --- /dev/null +++ b/assets/built-in/transformers/kubernetes/kubernetesversionchanger/transformer.yaml @@ -0,0 +1,23 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: KubernetesVersionChanger + labels: + move2kube.konveyor.io/built-in: true +spec: + class: "KubernetesVersionChanger" + directoryDetect: + levels: -1 + consumes: + # Also produced by detect + KubernetesOrgYamlsInSource: + merge: false + produces: + KubernetesYamlsInSource: + disabled: false + dependency: + matchLabels: + move2kube.konveyor.io/kubernetesclusterselector: "true" + config: + outputPath: "{{ $rel := Rel .YamlsPath }}source/{{ $rel }}{{ if ne $rel \".\" }}/..{{end}}/{{ FilePathBase .YamlsPath }}-versionchanged/" + setDefaultValuesInYamls: false diff --git a/assets/built-in/transformers/kubernetes/operator/templates/README.md b/assets/built-in/transformers/kubernetes/operator/templates/README.md new file mode 100644 index 0000000..37370ed --- /dev/null +++ b/assets/built-in/transformers/kubernetes/operator/templates/README.md @@ -0,0 +1,14 @@ +# Operators for various micro-services + +This directory contains optional operators you can install to start different services. +Example: A MongoDB operator can start and manage multiple MongoDB instances. + +## Prerequisites + +1. Install the `operator-sdk` CLI tool. See https://sdk.operatorframework.io/docs/installation/ + +## Steps + +1. `operator-sdk olm install` will install Operator Lifecycle Manager in your cluster (Make sure you are logged in first). +1. Run `kubectl apply -f .` from inside this directory. This will apply all the Kubernetes YAMLs that it finds. +1. `kubectl get csv --all-namespaces` to view the ClusterServiceVersions of all the operators that got installed on your cluster. diff --git a/assets/built-in/transformers/kubernetes/operator/templates/subscription.yaml b/assets/built-in/transformers/kubernetes/operator/templates/subscription.yaml new file mode 100644 index 0000000..0bc1ce8 --- /dev/null +++ b/assets/built-in/transformers/kubernetes/operator/templates/subscription.yaml @@ -0,0 +1,9 @@ +apiVersion: operators.coreos.com/v1alpha1 +kind: Subscription +metadata: + name: "sub-to-{{ .OperatorName }}" +spec: + channel: "{{ .CatalogChannel }}" + name: "{{ .OperatorName }}" + source: "{{ .CatalogSource }}" + installPlanApproval: "{{ .InstallPlanApproval }}" diff --git a/assets/built-in/transformers/kubernetes/operator/transformer.yaml b/assets/built-in/transformers/kubernetes/operator/transformer.yaml new file mode 100644 index 0000000..d518e67 --- /dev/null +++ b/assets/built-in/transformers/kubernetes/operator/transformer.yaml @@ -0,0 +1,13 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: OperatorTransformer + labels: + move2kube.konveyor.io/built-in: true +spec: + class: "OperatorTransformer" + directoryDetect: + levels: 0 + consumes: + OperatorsToInitialize: + merge: false diff --git a/assets/built-in/transformers/kubernetes/operatorsfromtca/Dockerfile b/assets/built-in/transformers/kubernetes/operatorsfromtca/Dockerfile new file mode 100644 index 0000000..a95dc01 --- /dev/null +++ b/assets/built-in/transformers/kubernetes/operatorsfromtca/Dockerfile @@ -0,0 +1,3 @@ +FROM quay.io/konveyor/tackle-container-advisor:v1.1.0 + +COPY detect.py transform.py preprocess.py cfservices.yaml ./ diff --git a/assets/built-in/transformers/kubernetes/operatorsfromtca/cfservices.yaml b/assets/built-in/transformers/kubernetes/operatorsfromtca/cfservices.yaml new file mode 100644 index 0000000..d8e5450 --- /dev/null +++ b/assets/built-in/transformers/kubernetes/operatorsfromtca/cfservices.yaml @@ -0,0 +1,739 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: CfServices +metadata: + name: ibm-cloud +spec: + services: + - description: IBM Cloudant is a fully managed JSON document database. Cloudant + is compatible with Apache CouchDB and accessible through a simple to use HTTPS + API for web, mobile, and IoT applications. See https://ibm.com/cloud/cloudant + for more details. + label: cloudantNoSQLDB + servicebrokername: cloudant + tags: + - data_management + - ibm_created + - lite + - ibm_dedicated_public + - description: This service is the hub of all things IBM IoT, it is where you can + set up and manage your connected devices so that your apps can access their + live and historical data. + label: iotf-service + servicebrokername: iotf-service + tags: + - internet_of_things + - Internet of Things + - ibm_created + - ibm_dedicated_public + - lite + - description: User Authentication and User Profiles for your apps. + label: AppID + servicebrokername: IMFAuthorizationBroker + tags: + - security + - mobile + - ibm_created + - lite + - description: Scalable and reliable Push Notifications service for mobile and web + applications + label: imfpush + servicebrokername: IMFPushBroker + tags: + - mobile + - ibm_created + - lite + - description: Db2 Warehouse on Cloud is a flexible and powerful data warehouse + for enterprise-level analytics. + label: dashDB + servicebrokername: dashDBRM + tags: + - big_data + - ibm_created + - ibm_dedicated_public + - db2 + - sqldb + - purescale + - apidocs_enabled + - sql + - dashdb + - database + - analytics + - flex + - dbaas + - smp + - mpp + - description: Synthesizes natural-sounding speech from text. + label: text_to_speech + servicebrokername: text-to-speech-us-south-broker + tags: [] + - description: Low-latency, streaming transcription + label: speech_to_text + servicebrokername: speech-to-text-us-south-broker + tags: [] + - description: 'Tone Analyzer uses linguistic analysis to detect three types of + tones from communications: emotion, social, and language. This insight can + then be used to drive high impact communications.' + label: tone_analyzer + servicebrokername: tone-analyzer-us-south-broker + tags: + - ibm_created + - ibm_dedicated_public + - lite + - watson + - description: IBM Watson Machine Learning - make smarter decisions, solve tough + problems, and improve user outcomes. + label: pm-20 + servicebrokername: spsspmbroker + tags: + - watson + - ibm_created + - ibm_dedicated_public + - lite + - description: The Watson Personality Insights derives insights from transactional + and social media data to identify psychological traits + label: personality_insights + servicebrokername: personality-insights-us-south-broker + tags: + - ibm_created + - ibm_dedicated_public + - lite + - watson + - description: Create Secure Tunnels to the IBM Cloud! + label: SecureGateway + servicebrokername: SecureGatewayBroker + tags: + - bluemix_extensions + - api + - integration + - ibm_created + - ibm_dedicated_public + - description: Allows you to quickly get up and running on a pre-configured WebSphere + Application Server installation in a hosted cloud environment in IBM Cloud. + label: WebSphereAppSvr + servicebrokername: wasaas-broker + tags: + - compute + - ibm_created + - ibm_release + - description: Natural Language Classifier performs natural language classification + on question texts. A user would be able to train their data and the predict + the appropriate class for a input question. + label: natural_language_classifier + servicebrokername: natural-language-classifier-us-south-broker + tags: + - ibm_created + - ibm_dedicated_public + - watson + - description: 'Db2 Hosted: Offers customers the rich features of an on-premise + Db2 deployment without the cost, complexity, and risk of managing their own + infrastructure.' + label: db2oncloud + servicebrokername: db2oncloud + tags: + - data_management + - ibm_created + - ibm_dedicated_public + - db2oncloud + - db2cloud + - db2hosted + - db2 + - relational + - database + - db + - hosted + - oracle + - dbaas + - purescale + - db2 on cloud + - db2 cloud + - description: Leverage IBM Streams to ingest, analyze, monitor, and correlate data + as it arrives from real-time data sources. View information and events as they + unfold. + label: streaming-analytics + servicebrokername: streaming-analytics + tags: + - big_data + - ibm_dedicated_public + - iam_compatible + - lite + - ibm_release + - ibm_created + - rc_compatible + - description: Event Streams vNext - Prod Code Level + label: messagehub + servicebrokername: messagehub + tags: [] + - description: Build secure, cognitive, engaging and personalized mobile apps faster + at scale + label: Mobile Foundation + servicebrokername: mobilefoundation-servicebroker + tags: + - mobile + - ibm_created + - description: Create, manage, enforce, and run APIs. + label: APIConnect + servicebrokername: api-connect + tags: + - ibm_created + - apis + - integration + - bluemix_extensions + - private + - lite + - description: "The IoT for Electronics service supports user and device registration\ + \ and notifications. As part of the IoT for Electronics Starter, it is preconfigured\ + \ with other services to help you connect your devices and get your IoT projects\ + \ to market significantly faster. You can also deploy it separately and use\ + \ it with an existing instance of IBM\xAE Watson\u2122 IoT Platform." + label: ibm-iot-for-electronics + servicebrokername: ibm-iot-for-electronics + tags: + - internet_of_things + - ibm_created + - 'ibm_release ' + - ibm_dedicated_public + - description: Add a cognitive search and content analytics engine to applications. + label: discovery + servicebrokername: discovery-us-south-broker + tags: [] + - description: Find meaning in visual content! Analyze images for scenes, objects, + faces, and other content. Choose a default model off the shelf, or create your + own custom classifier. Develop smart applications that analyze the visual content + of images or video frames to understand what is happening in a scene. + label: watson_vision_combined + servicebrokername: watson-vision-combined-us-south-broker + tags: + - watson + - ibm_created + - ibm_dedicated_public + - lite + - description: Add a natural language interface to your application to automate + interactions with your end users. Common applications include virtual agents + and chat bots that can integrate and communicate on any channel or device. + label: conversation + servicebrokername: conversation-us-south-broker + tags: + - eu_access + - ibm_created + - ibm_dedicated_public + - lite + - watson + - description: Manage the translation of your cloud and mobile applications using + IBM Globalization Pipeline. + label: g11n-pipeline + servicebrokername: g11n-pipeline + tags: + - ibm_release + - dev_ops + - ibm_created + - ibm_dedicated_public + - description: Redis is an open-source, blazingly fast, low maintenance key/value + store. + label: compose-for-redis + servicebrokername: composebroker-public + tags: + - database + - big_data + - data_management + - ibm_created + - ibm_dedicated_public + - eu_access + - description: MongoDB is a JSON document store with a rich query and aggregation + framework + label: compose-for-mongodb + servicebrokername: composebroker-public + tags: + - database + - big_data + - data_management + - ibm_created + - ibm_dedicated_public + - eu_access + - description: Postgres is a powerful, open source object-relational database that + is highly customizable. + label: compose-for-postgresql + servicebrokername: composebroker-public + tags: + - database + - big_data + - data_management + - ibm_created + - ibm_dedicated_public + - eu_access + - description: RabbitMQ asynchronously handles the messages between your applications + and databases + label: compose-for-rabbitmq + servicebrokername: composebroker-public + tags: + - database + - big_data + - data_management + - ibm_created + - ibm_dedicated_public + - eu_access + - description: etcd is a key/value store for distributed server configuration management. + label: compose-for-etcd + servicebrokername: composebroker-public + tags: + - database + - big_data + - data_management + - ibm_created + - ibm_beta + - ibm_dedicated_public + - eu_access + - description: RethinkDB is a JSON document based, distributed database with an + integrated administration and exploration console. + label: compose-for-rethinkdb + servicebrokername: composebroker-public + tags: + - database + - big_data + - data_management + - ibm_created + - ibm_dedicated_public + - eu_access + - description: Elasticsearch combines the power of a full text search engine with + the indexing strengths of a JSON document database + label: compose-for-elasticsearch + servicebrokername: composebroker-public + tags: + - database + - big_data + - data_management + - ibm_created + - ibm_dedicated_public + - eu_access + - description: An app-independent service for protecting, managing, and generating + keys. + label: kms + servicebrokername: IBMKeyProtect + tags: + - security + - ibm_release + - ibm_created + - rc_compatible + - description: Translate text from one language to another for specific domains. + label: language_translator + servicebrokername: language-translator-us-south-broker + tags: + - ibm_created + - ibm_dedicated_public + - lite + - watson + - description: A next generation SQL database. Formerly dashDB For Transactions. + label: dashDB For Transactions + servicebrokername: dashDBRM + tags: + - big_data + - ibm_created + - db2 + - sqldb + - purescale + - sql + - ibm_dedicated_public + - db2 on cloud + - db2oncloud + - dash + - dashdb + - oracle + - database + - transactions + - flex + - dbaas + - lite + - apidocs_enabled + - description: Connect your applications, automate tasks, and improve productivity + label: AppConnect + servicebrokername: AppConnectServiceBrokerProd + tags: + - integration + - lite + - ibm_release + - ibm_created + - description: ScyllaDB is a highly performant, in-place replacement for the Cassandra + wide-column distributed database. + label: compose-for-scylladb + servicebrokername: composebroker-public + tags: + - database + - big_data + - data_management + - ibm_created + - ibm_beta + - ibm_dedicated_public + - eu_access + - description: MySQL is a fast, easy-to-use, and flexible RDBMS. + label: compose-for-mysql + servicebrokername: composebroker-public + tags: + - database + - big_data + - data_management + - ibm_created + - ibm_beta + - ibm_dedicated_public + - eu_access + - description: Manage software deployments with this enterprise-scale release management + solution. + label: Continuous Release + servicebrokername: ContinuousReleaseBroker + tags: + - dev_ops + - ibm_created + - ibm_beta + - ibm_dedicated_public + - release + - continuous_release + - bluemix_extensions + - lite + - description: Analyze text to extract meta-data from content such as concepts, + entities, emotion, relations, sentiment and more. + label: natural-language-understanding + servicebrokername: natural-language-understanding-us-south-broker + tags: + - ibm_created + - ibm_dedicated_public + - lite + - watson + - description: Leverage sophisticated IBM Algorithmics financial models to price + and evaluate financial securities for historical dates. + label: fss-historical-instrument-analytics-service + servicebrokername: WatsonFintechBroker + tags: + - ibm_experimental + - finance + - ibm_created + - description: Leverage sophisticated IBM Algorithmics financial models to price + and compute analytics on financial securities. + label: fss-instrument-analytics-service + servicebrokername: WatsonFintechBroker + tags: + - ibm_experimental + - finance + - ibm_created + - description: Leverage sophisticated IBM Algorithmics financial models to price + and compute analytics on financial securities for a historical date, under a + scenario. + label: fss-historical-scenario-analytics-service + servicebrokername: WatsonFintechBroker + tags: + - ibm_experimental + - finance + - ibm_created + - description: Leverage sophisticated IBM Algorithmics financial models to price + and compute analytics on financial securities under a given scenario. + label: fss-scenario-analytics-service + servicebrokername: WatsonFintechBroker + tags: + - ibm_experimental + - finance + - ibm_created + - description: Maintain a record of your investment portfolios through time. + label: fss-portfolio-service + servicebrokername: investment-portfolio + tags: + - finance + - ibm_experimental + - ibm_created + - description: Create conditional scenarios to model how, given a change to a subset + of factors the broader set of market factors are expected to change. + label: fss-predictive-scenario-analytics-service + servicebrokername: WatsonFintechBroker + tags: + - ibm_experimental + - finance + - ibm_created + - description: Embed AI and machine learning into your business. Create custom models + using your own data. + label: data-science-experience + servicebrokername: Watson Studio + tags: + - lite + - ibm_created + - watson + - dsx + - data science experience + - description: IBM Compose Enterprise is a service which provides a private isolated + cluster for IBM Cloud users to optionally provision their Compose databases + into. + label: compose-enterprise + servicebrokername: composebroker-public + tags: + - database + - big_data + - data_management + - ibm_created + - ibm_dedicated_public + - eu_access + - description: IBM Informix on Cloud helps businesses gain a trusted view of data + in a hybrid computing environment. + label: informix_on_cloud + servicebrokername: servicebroker_informix_hosted + tags: + - big_data + - ibm_created + - description: JanusGraph is a scalable graph database optimized for storing and + querying highly-interconnected data + label: compose-for-janusgraph + servicebrokername: composebroker-public + tags: + - database + - big_data + - data_management + - ibm_created + - ibm_beta + - ibm_dedicated_public + - eu_access + - description: Flexible framework to deploy Hadoop and Spark analytics applications. + label: IBMAnalyticsEngine + servicebrokername: ibm-analytics-engine + tags: + - analytics + - big_data + - hadoop + - hbase + - hdfs + - hive + - ibm_created + - spark + - description: Construct or rebalance investment portfolios based on investor goals, + mandates, and preferences. + label: fss-financial-optimization-service + servicebrokername: WatsonFintechBroker + tags: + - ibm_experimental + - finance + - ibm_created + - description: Create a cognitive voice agent that uses Watson services to speak + directly with customers using natural language over the telephone + label: VoiceAgent + servicebrokername: VoiceAgent + tags: + - app_services + - ibm_created + - description: Discover, catalog, and securely share enterprise data. + label: datacatalog + servicebrokername: datacatalog-broker + tags: + - watson + - lite + - ibm_created + - apidocs_enabled + - description: Provides flexible, cost-effective, and scalable cloud storage for + unstructured data. + label: cloud-object-storage + servicebrokername: cos-service + tags: + - Lite + - storage + - ibm_release + - ibm_created + - rc_compatible + - description: Build custom models to teach Watson the language of your domain. + label: knowledge-studio + servicebrokername: knowledge-studio-us-south-broker + tags: + - eu_access + - ibm_created + - lite + - watson + - description: Manage participants, tokens and recipients, and initiate and receive + real time payments. + label: real-time-payments-service + servicebrokername: real-time-payments-service + tags: + - ibm_experimental + - finance + - ibm_created + - description: Enterprise-grade messaging hosted in the cloud + label: mqcloud + servicebrokername: svcbroker-mqoc-betaprod + tags: + - integration + - ibm_created + - lite + - description: Bring data to life directly from your application with this powerful + and easy-to-use visualization service. + label: dynamic-dashboard-embedded + servicebrokername: dynamic-dashboard-embedded + tags: + - business_analytics + - ibm_created + - rc_compatible + - description: SQL Query is a stateless service for using standard SQL to analyze + data in IBM Cloud Object Store. With SQL Query you query the data where it is + stored - there is no ETL, no databases, and no infrastructure to manage. + label: sql-query + servicebrokername: sql-query + tags: + - rc_compatible + - business_analytics + - data_management + - ibm_beta + - ibm_created + - description: Data protection with a dedicated key management service and hardware + security module (HSM) - using FIPS 140-2 Level 4 certified hardware. + label: hs-crypto + servicebrokername: zCryptoBroker + tags: + - apidocs_enabled + - public + - rc_compatible + - security + - ibm_created + - description: Migrate data quickly, easily and securely from your on-premises data + source to the IBM Cloud. + label: lift-cli + servicebrokername: LiftCLIBroker + tags: + - rc_compatible + - data_management + - ibm_release + - ibm_created + - description: Hyper Protect DBaaS is a highly secured enterprise service. It provides + capabilities to manage different database types like MongoDB or PostgreSQL through + standardized interfaces. + label: hypersecuredbaas + servicebrokername: hypersecuredbaas-ng + tags: + - big_data + - data_management + - ibm_experimental + - ibm_created + - rc_compatible + - lite + - description: An IBM provided service that enables aliasing to service instances + in the IBM Cloud. + label: ibmcloud-link + servicebrokername: ibmcloud-link-broker + tags: [] + - description: PostgreSQL is a powerful, open source object-relational database + that is highly customizable. + label: databases-for-postgresql + servicebrokername: ibm-cloud-databases-us-south + tags: + - data_management + - ibm_created + - rc_compatible + - description: etcd is a distributed reliable key-value store for the most critical + data of a distributed system + label: databases-for-etcd + servicebrokername: ibm-cloud-databases-us-south + tags: + - data_management + - ibm_created + - rc_compatible + - description: Redis is a blazingly fast, in-memory data structure store. + label: databases-for-redis + servicebrokername: ibm-cloud-databases-us-south + tags: + - data_management + - ibm_created + - rc_compatible + - description: Elasticsearch combines the power of a full text search engine with + the indexing strengths of a JSON document database. + label: databases-for-elasticsearch + servicebrokername: ibm-cloud-databases-us-south + tags: + - data_management + - ibm_created + - rc_compatible + - description: RabbitMQ is an open source multi-protocol messaging broker. + label: messages-for-rabbitmq + servicebrokername: ibm-cloud-databases-us-south + tags: + - data_management + - ibm_created + - rc_compatible + - description: MongoDB is a JSON document store with a rich query and aggregation + framework. + label: databases-for-mongodb + servicebrokername: ibm-cloud-databases-us-south + tags: + - data_management + - ibm_created + - rc_compatible + - description: Offers visibility into the performance and health of your infrastructure + and apps, with in-depth troubleshooting, and alerting. + label: sysdig-monitor + servicebrokername: bluemix-us-south + tags: + - ibmcloud-platform + - description: LogDNA provides log collection and log search for IBM Log Analysis. + Define alerts and design custom views to monitor application and system logs. + label: logdna + servicebrokername: bluemix-us-south + tags: + - ibmcloud-platform + - description: LogDNA provides collection and search of events that occur on IBM + Cloud Activity Tracker. Save searches, design alerts, and build graphs to monitor + user activities. + label: logdnaat + servicebrokername: bluemix-us-south + tags: + - ibmcloud-platform + - description: DataStax is a scale-out NoSQL database built on Apache Cassandra, + designed for high-availability and workload flexibility. + label: databases-for-cassandra + servicebrokername: ibm-cloud-databases-us-south + tags: + - data_management + - ibm_created + - rc_compatible + - description: EDB is a PostgreSQL-based database engine optimized for performance, + developer productivity, and compatibility with Oracle. + label: databases-for-enterprisedb + servicebrokername: ibm-cloud-databases-us-south + tags: + - data_management + - ibm_created + - rc_compatible + - description: Build mission critical web applications that offer high performance + with scalability and security. + label: databases-for-mysql + servicebrokername: ibm-cloud-databases-dev-yp-01-us-south + tags: + - data_management + - ibm_created + - rc_compatible + - description: Build mission critical web applications that offer high performance + with scalability and security. + label: databases-for-mysql + servicebrokername: ibm-cloud-databases-dev-yp-02-us-south + tags: + - data_management + - ibm_created + - rc_compatible + - description: Build mission critical web applications that offer high performance + with scalability and security. + label: databases-for-mysql + servicebrokername: ibm-cloud-databases-dev-yp-03-us-south + tags: + - data_management + - ibm_created + - rc_compatible + - description: Build mission critical web applications that offer high performance + with scalability and security. + label: databases-for-mysql + servicebrokername: ibm-cloud-databases-test-yp-01-us-south + tags: + - data_management + - ibm_created + - rc_compatible + - description: Build mission critical web applications that offer high performance + with scalability and security. + label: databases-for-mysql + servicebrokername: ibm-cloud-databases-preproduction-us-south + tags: + - data_management + - ibm_created + - rc_compatible + - description: Build mission critical web applications that offer high performance + with scalability and security. + label: databases-for-mysql + servicebrokername: ibm-cloud-databases-us-south + tags: + - data_management + - ibm_created + - rc_compatible diff --git a/assets/built-in/transformers/kubernetes/operatorsfromtca/detect.py b/assets/built-in/transformers/kubernetes/operatorsfromtca/detect.py new file mode 100644 index 0000000..a54e86c --- /dev/null +++ b/assets/built-in/transformers/kubernetes/operatorsfromtca/detect.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python + +# Copyright IBM Corporation 2022 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and + +import os +import json +import yaml +from pathlib import Path + +# Performs the detection of pom file and extracts service name +def detect(input_dir): + services = {} + print("input_dir", input_dir) + for rootDir, _, fileList in os.walk(input_dir): + for filePath in fileList: + print( + f"checking to see if the file {filePath} is a Move2Kube collect output" + ) + if not filePath.endswith(".yaml"): + continue + fullFilePath = os.path.join(rootDir, filePath) + with open(fullFilePath) as f: + collectFile = yaml.safe_load(f) + # print("collectFile:", collectFile) + if "apiVersion" not in collectFile: + print(f"apiVersion key missing in the file:{fullFilePath}") + continue + if collectFile["apiVersion"] != "move2kube.konveyor.io/v1alpha1": + print( + f"apiVersion does not match. Expected: 'move2kube.konveyor.io/v1alpha1' Actual: {collectFile['apiVersion']}" + ) + continue + if "kind" not in collectFile or ( + collectFile["kind"] != "CfApps" and collectFile["kind"] != "CfServices" + ): + print( + f"kind does not match. Expected: 'CfApps' or 'CfServices' Actual: {collectFile['kind']}" + ) + continue + print("found a CfApps or CfServices collect output YAML file") + # print(collectFile) + artifactName = os.path.basename(fullFilePath) + services[artifactName] = [ + { + "name": artifactName, + "type": "CollectOutput", + "paths": {"CollectOutput": [fullFilePath]}, + } + ] + return services + + +# Entry-point of detect script +def main(): + input_path = os.environ["M2K_DETECT_INPUT_PATH"] + with open(input_path) as f: + detectInput = json.load(f) + output = detect(detectInput["InputDirectory"]) + output_path = os.environ["M2K_DETECT_OUTPUT_PATH"] + output_dir = Path(output_path).parent.absolute() + os.makedirs(output_dir, mode=0o777, exist_ok=True) + with open(output_path, "w") as f: + json.dump(output, f) + + +if __name__ == "__main__": + main() diff --git a/assets/built-in/transformers/kubernetes/operatorsfromtca/preprocess.py b/assets/built-in/transformers/kubernetes/operatorsfromtca/preprocess.py new file mode 100644 index 0000000..2363faf --- /dev/null +++ b/assets/built-in/transformers/kubernetes/operatorsfromtca/preprocess.py @@ -0,0 +1,38 @@ +import yaml + + +def filter_obj(x): + return ( + x["label"], + { + "label": x["label"], + "description": x["description"], + "servicebrokername": x["servicebrokername"], + "tags": x["tags"], + # "extra": x["extra"], + }, + ) + + +def process_cf_services(input_path, output_path): + with open(input_path) as f: + cf_services = yaml.safe_load(f) + # print('cf_services', cf_services) + # print("cf_services", type(cf_services)) + # print(cf_services.keys()) + # print(cf_services["spec"].keys()) + # print(type(cf_services["spec"]["services"])) + # print(len(cf_services["spec"]["services"])) + catalogue = {} + for x in cf_services["spec"]["services"]: + # print(type(x)) + # print(x.keys()) + k, v = filter_obj(x) + # print(v) + catalogue[k] = v + # print("-" * 100) + with open(output_path, "w") as f: + yaml.dump(catalogue, f) + +if __name__ == "__main__": + process_cf_services("cfservices.yaml", "catalogue.yaml") diff --git a/assets/built-in/transformers/kubernetes/operatorsfromtca/transform.py b/assets/built-in/transformers/kubernetes/operatorsfromtca/transform.py new file mode 100644 index 0000000..1d29e95 --- /dev/null +++ b/assets/built-in/transformers/kubernetes/operatorsfromtca/transform.py @@ -0,0 +1,195 @@ +#!/usr/bin/env python + +# Copyright IBM Corporation 2022 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and + +import os +import json +import yaml +import requests +from preprocess import process_cf_services +from pathlib import Path + +catalogue = {} + + +def init_catalogue(cf_services_path="cfservices.yaml", catalogue_path="catalogue.yaml"): + global catalogue + if len(catalogue) != 0: + print("the catalogue has already been initialized") + return + process_cf_services(cf_services_path, catalogue_path) + with open(catalogue_path) as catalogue_file: + catalogue = yaml.safe_load(catalogue_file) + print("catalogue ------>", catalogue) + + +def find_cf_services(newArtifacts): + global catalogue + print("trying to find a cf services file among the collected artifacts") + for artifact in newArtifacts: + print("checking the artifact", artifact, "to see if it is CollectOutput") + if artifact["type"] != "CollectOutput": + continue + if "paths" not in artifact: + continue + if "CollectOutput" not in artifact["paths"]: + continue + for collectOutputPath in artifact["paths"]["CollectOutput"]: + print( + "parsing the file", + collectOutputPath, + "as a Move2Kube collect output YAML file", + ) + with open(collectOutputPath) as f: + collectOutput = yaml.safe_load(f) + if collectOutput["kind"] != "CfServices": + print(f"not a CfServices file. Actual kind is: {collectOutput['kind']}") + continue + print( + f'initializing the catalogue using the CfServices file at path "{collectOutputPath}"' + ) + init_catalogue(cf_services_path=collectOutputPath) + + +# Performs the detection of pom file and extracts service name +def transform(newArtifacts): + global catalogue + pathMappings = [] + artifacts = [] + + # print("artifactsData:", artifactsData) + print("Number of new artifacts: " + str(len(newArtifacts))) + + find_cf_services(newArtifacts) + init_catalogue() + + for artifact in newArtifacts: + print("checking the artifact", artifact, "to see if it is CollectOutput") + if artifact["type"] != "CollectOutput": + continue + if "paths" not in artifact: + continue + if "CollectOutput" not in artifact["paths"]: + continue + for collectOutputPath in artifact["paths"]["CollectOutput"]: + print( + "parsing the file", + collectOutputPath, + "as a Move2Kube collect output YAML file", + ) + with open(collectOutputPath) as f: + collectOutput = yaml.safe_load(f) + if collectOutput["kind"] != "CfApps": + print(f"not a CfApps file. Actual kind is: {collectOutput['kind']}") + continue + print(f'found a CfApps file at path "{collectOutputPath}"') + if "spec" not in collectOutput: + continue + if "applications" not in collectOutput["spec"]: + continue + for cloudFoundryApp in collectOutput["spec"]["applications"]: + try: + vcapServiceJSON = cloudFoundryApp["environment"]["systemenv"][ + "VCAP_SERVICES" + ] + vcapServices = json.loads(vcapServiceJSON) + except: + print( + 'failed to find and parse "environment.systemenv.VCAP_SERVICES" in this app, skipping' + ) + continue + for vcapServiceName in vcapServices: + if vcapServiceName not in catalogue: + print( + f'failed to find the cf vcap service "{vcapServiceName}" in the catalogue' + ) + continue + vcapService = catalogue[vcapServiceName] + vcapServiceStr = yaml.dump(vcapService) + cfServiceName, cfServiceStr = vcapServiceName, vcapServiceStr + print( + "cfServiceName:", + cfServiceName, + "cfServiceStr:", + cfServiceStr, + ) + try: + print("standardize with TCA") + t1 = requests.post( + "http://localhost:8000/standardize", + json=[ + { + "application_name": cfServiceName, # 'App1', + "application_description": cfServiceStr, # 'App1: rhel, db2, java, tomcat', + "technology_summary": cfServiceStr, # 'App1: rhel, db2, java, tomcat' + } + ], + ).json() + print(t1) + print("containerize with TCA") + t2 = requests.post( + "http://localhost:8000/containerize", + json=t1["standardized_apps"], + ).json() + print(t2) + # artifactName = cfService['label'] if 'label' in cfService else '' + t3 = t2["containerization"][0]["Ref Dockers"] + print(t3) + print("-" * 50) + except Exception as e: + print( + "failed to standardize and containerize. Error:", + e, + ) + continue + operators = {} + for op in t3: + op_name = op["name"] + op_url = op["url"] + operators[op_name] = { + "url": op_url, + "operatorName": op_name, + "installPlanApproval": "Manual", + "catalogSource": "operatorhubio-catalog", + "catalogChannel": "stable", + } + new_artifact = { + "name": cfServiceName, + "type": "OperatorsToInitialize", + "configs": { + "OperatorsToInitializeConfig": { + "operators": operators, + }, + }, + } + print("new artifact:", new_artifact) + artifacts.append(new_artifact) + return {"pathMappings": pathMappings, "artifacts": artifacts} + + +# Entry-point of transform script +def main(): + input_path = os.environ["M2K_TRANSFORM_INPUT_PATH"] + with open(input_path) as f: + artifactsData = json.load(f) + output = transform(artifactsData["newArtifacts"]) + output_path = os.environ["M2K_TRANSFORM_OUTPUT_PATH"] + output_dir = Path(output_path).parent.absolute() + os.makedirs(output_dir, mode=0o777, exist_ok=True) + with open(output_path, "w") as f: + json.dump(output, f) + + +if __name__ == "__main__": + main() diff --git a/assets/built-in/transformers/kubernetes/operatorsfromtca/transformer.yaml b/assets/built-in/transformers/kubernetes/operatorsfromtca/transformer.yaml new file mode 100644 index 0000000..66da19b --- /dev/null +++ b/assets/built-in/transformers/kubernetes/operatorsfromtca/transformer.yaml @@ -0,0 +1,30 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: OperatorsFromTCA + labels: + move2kube.konveyor.io/built-in: true + move2kube.konveyor.io/container-based: true +spec: + class: "Executable" + mode: "Container" + isolated: true + directoryDetect: + levels: 1 + consumes: + CollectOutput: + merge: false + produces: + OperatorsToInitialize: + merge: false + config: + platforms: + - "linux" + directoryDetectCMD: ["/opt/app-root/bin/python", "./detect.py"] + transformCMD: ["/opt/app-root/bin/python", "./transform.py"] + container: + image: quay.io/konveyor-move2kube-transformers/run-tca:latest + workingDir: "/app" + build: + dockerfile: "Dockerfile" + context: "." diff --git a/assets/built-in/transformers/kubernetes/parameterizer/parameterizers/replicas.yaml b/assets/built-in/transformers/kubernetes/parameterizer/parameterizers/replicas.yaml new file mode 100644 index 0000000..be29ff1 --- /dev/null +++ b/assets/built-in/transformers/kubernetes/parameterizer/parameterizers/replicas.yaml @@ -0,0 +1,12 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Parameterizer +metadata: + name: replicas-parameterizer +spec: + parameterizers: + - target: "spec.replicas" + template: "${common.replicas}" + keepOriginalValueIfPresent: true + default: 2 + filters: + - kind: Deployment \ No newline at end of file diff --git a/assets/built-in/transformers/kubernetes/parameterizer/transformer.yaml b/assets/built-in/transformers/kubernetes/parameterizer/transformer.yaml new file mode 100644 index 0000000..c45f885 --- /dev/null +++ b/assets/built-in/transformers/kubernetes/parameterizer/transformer.yaml @@ -0,0 +1,23 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: Parameterizer + labels: + move2kube.konveyor.io/built-in: true +spec: + class: "Parameterizer" + directoryDetect: + levels: -1 + consumes: + Service: + merge: false + KubernetesYamlsInSource: + merge: false + KubernetesYamls: + merge: true + config: + helmPath: "{{ $pathType := EnvPathType .YamlsPath}}{{ $rel := Rel .YamlsPath }}{{ if eq $pathType \"Source\" }}source/{{end}}{{ $rel }}{{ if ne $rel \".\" }}/..{{end}}/{{ FilePathBase .YamlsPath }}-parameterized/helm-chart" + ocTemplatePath: "{{ $pathType := EnvPathType .YamlsPath}}{{ $rel := Rel .YamlsPath }}{{ if eq $pathType \"Source\" }}source/{{end}}{{ $rel }}{{ if ne $rel \".\" }}/..{{end}}/{{ FilePathBase .YamlsPath }}-parameterized/openshift-template" + kustomizePath: "{{ $pathType := EnvPathType .YamlsPath}}{{ $rel := Rel .YamlsPath }}{{ if eq $pathType \"Source\" }}source/{{end}}{{ $rel }}{{ if ne $rel \".\" }}/..{{end}}/{{ FilePathBase .YamlsPath }}-parameterized/kustomize" + projectName: "{{ if eq .ArtifactType \"KubernetesYamls\" }}{{ .ProjectName }}{{ else }}{{ if eq .ArtifactType \"KubernetesYamlsInSource\" }}{{ .ArtifactName }}{{ else }}{{ .ServiceName }}{{end}}{{end}}" + envs: ["dev", "staging", "prod"] diff --git a/assets/built-in/transformers/kubernetes/tekton/transformer.yaml b/assets/built-in/transformers/kubernetes/tekton/transformer.yaml new file mode 100644 index 0000000..ce962e0 --- /dev/null +++ b/assets/built-in/transformers/kubernetes/tekton/transformer.yaml @@ -0,0 +1,22 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: Tekton + labels: + move2kube.konveyor.io/built-in: true +spec: + class: "Tekton" + directoryDetect: + levels: 0 + consumes: + IR: + merge: true + dependency: + matchLabels: + move2kube.konveyor.io/kubernetesclusterselector: "true" + produces: + KubernetesYamls: + disabled: false + config: + outputPath: "deploy/cicd/tekton" + setDefaultValuesInYamls: false diff --git a/assets/built-in/transformers/readmegenerator/templates/Readme.md b/assets/built-in/transformers/readmegenerator/templates/Readme.md new file mode 100644 index 0000000..4d49daa --- /dev/null +++ b/assets/built-in/transformers/readmegenerator/templates/Readme.md @@ -0,0 +1,15 @@ +# Move2Kube + +Congratulations! Move2Kube has generated the necessary build artfiacts for moving all your application components to Kubernetes. Using the artifacts in this directory you can deploy your application in a kubernetes cluster. + +## Next Steps + +If container build artifacts are detected/created by Move2Kube, scripts to build them locally are put in "./scripts" directory. For production image build, use the CI/CD pipelines in "./deploy/cicd" directory. + +For deployment, use the artifacts in "./deploy" directory. + +## Generated by + +``` +{{ .Version }} +``` diff --git a/assets/built-in/transformers/readmegenerator/transformer.yaml b/assets/built-in/transformers/readmegenerator/transformer.yaml new file mode 100644 index 0000000..262fbe9 --- /dev/null +++ b/assets/built-in/transformers/readmegenerator/transformer.yaml @@ -0,0 +1,17 @@ +apiVersion: move2kube.konveyor.io/v1alpha1 +kind: Transformer +metadata: + name: ReadMeGenerator + labels: + move2kube.konveyor.io/built-in: true +spec: + class: "ReadMeGenerator" + directoryDetect: + levels: 0 + consumes: + ContainerImagesPushScript: + merge: true + ContainerImagesBuildScript: + merge: true + KubernetesYamls: + merge: true diff --git a/assets/filepermissions.yaml b/assets/filepermissions.yaml new file mode 100644 index 0000000..69b18a3 --- /dev/null +++ b/assets/filepermissions.yaml @@ -0,0 +1,104 @@ +# Code generated by go generate; DO NOT EDIT. + +# Copyright IBM Corporation 2020, 2021 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"built-in/presets/analyze-docker-compose-only.yaml" : 0644 +"built-in/presets/containerize-only.yaml" : 0644 +"built-in/presets/docker-file-only.yaml" : 0644 +"built-in/presets/enable-containerized-transformers.yaml" : 0644 +"built-in/presets/use-podman-in-scripts.yaml" : 0644 +"built-in/transformers/cloudfoundry/transformer.yaml" : 0644 +"built-in/transformers/cnb/transformer.yaml" : 0644 +"built-in/transformers/compose/composeanalyser/transformer.yaml" : 0644 +"built-in/transformers/compose/composegenerator/transformer.yaml" : 0644 +"built-in/transformers/containerimagespushscript/templates/pushimages.bat" : 0755 +"built-in/transformers/containerimagespushscript/templates/pushimages.sh" : 0755 +"built-in/transformers/containerimagespushscript/transformer.yaml" : 0644 +"built-in/transformers/dockerfile/dockerfiledetector/transformer.yaml" : 0644 +"built-in/transformers/dockerfile/dockerfileparser/transformer.yaml" : 0644 +"built-in/transformers/dockerfile/dockerimagebuildscript/templates/buildandpushimages_multiarch.bat" : 0755 +"built-in/transformers/dockerfile/dockerimagebuildscript/templates/buildandpushimages_multiarch.sh" : 0755 +"built-in/transformers/dockerfile/dockerimagebuildscript/templates/buildimages.bat" : 0755 +"built-in/transformers/dockerfile/dockerimagebuildscript/templates/buildimages.sh" : 0755 +"built-in/transformers/dockerfile/dockerimagebuildscript/transformer.yaml" : 0644 +"built-in/transformers/dockerfilegenerator/common/Dockerfile.license" : 0644 +"built-in/transformers/dockerfilegenerator/dotnetcore/templates/Dockerfile" : 0644 +"built-in/transformers/dockerfilegenerator/dotnetcore/transformer.yaml" : 0644 +"built-in/transformers/dockerfilegenerator/golang/mappings/golangversions.yaml" : 0644 +"built-in/transformers/dockerfilegenerator/golang/templates/Dockerfile" : 0644 +"built-in/transformers/dockerfilegenerator/golang/transformer.yaml" : 0644 +"built-in/transformers/dockerfilegenerator/java/earanalyser/transformer.yaml" : 0644 +"built-in/transformers/dockerfilegenerator/java/earrouter/transformer.yaml" : 0644 +"built-in/transformers/dockerfilegenerator/java/gradle/templates/Dockerfile.gradle-build" : 0644 +"built-in/transformers/dockerfilegenerator/java/gradle/transformer.yaml" : 0644 +"built-in/transformers/dockerfilegenerator/java/jar/templates/Dockerfile.jar-run" : 0644 +"built-in/transformers/dockerfilegenerator/java/jar/transformer.yaml" : 0644 +"built-in/transformers/dockerfilegenerator/java/jboss/templates/Dockerfile.jboss" : 0644 +"built-in/transformers/dockerfilegenerator/java/jboss/transformer.yaml" : 0644 +"built-in/transformers/dockerfilegenerator/java/liberty/templates/Dockerfile.liberty" : 0644 +"built-in/transformers/dockerfilegenerator/java/liberty/transformer.yaml" : 0644 +"built-in/transformers/dockerfilegenerator/java/mappings/javapackageversions.yaml" : 0644 +"built-in/transformers/dockerfilegenerator/java/maven/templates/Dockerfile.maven-build" : 0644 +"built-in/transformers/dockerfilegenerator/java/maven/transformer.yaml" : 0644 +"built-in/transformers/dockerfilegenerator/java/tomcat/templates/Dockerfile.tomcat" : 0644 +"built-in/transformers/dockerfilegenerator/java/tomcat/transformer.yaml" : 0644 +"built-in/transformers/dockerfilegenerator/java/waranalyser/transformer.yaml" : 0644 +"built-in/transformers/dockerfilegenerator/java/warrouter/transformer.yaml" : 0644 +"built-in/transformers/dockerfilegenerator/java/zuul/transformer.yaml" : 0644 +"built-in/transformers/dockerfilegenerator/mappings/nodeversions.yaml" : 0644 +"built-in/transformers/dockerfilegenerator/nodejs/templates/Dockerfile" : 0644 +"built-in/transformers/dockerfilegenerator/nodejs/transformer.yaml" : 0644 +"built-in/transformers/dockerfilegenerator/php/templates/Dockerfile" : 0644 +"built-in/transformers/dockerfilegenerator/php/transformer.yaml" : 0644 +"built-in/transformers/dockerfilegenerator/python/templates/Dockerfile" : 0644 +"built-in/transformers/dockerfilegenerator/python/transformer.yaml" : 0644 +"built-in/transformers/dockerfilegenerator/ruby/templates/Dockerfile" : 0644 +"built-in/transformers/dockerfilegenerator/ruby/transformer.yaml" : 0644 +"built-in/transformers/dockerfilegenerator/rust/templates/Dockerfile" : 0644 +"built-in/transformers/dockerfilegenerator/rust/transformer.yaml" : 0644 +"built-in/transformers/dockerfilegenerator/windows/mappings/dotnetwindowsversionmapping.yaml" : 0644 +"built-in/transformers/dockerfilegenerator/windows/winconsole/templates/Dockerfile" : 0644 +"built-in/transformers/dockerfilegenerator/windows/winconsole/transformer.yaml" : 0644 +"built-in/transformers/dockerfilegenerator/windows/winsilverlightweb/templates/Dockerfile" : 0644 +"built-in/transformers/dockerfilegenerator/windows/winsilverlightweb/transformer.yaml" : 0644 +"built-in/transformers/dockerfilegenerator/windows/winweb/templates/Dockerfile" : 0644 +"built-in/transformers/dockerfilegenerator/windows/winweb/transformer.yaml" : 0644 +"built-in/transformers/kubernetes/argocd/transformer.yaml" : 0644 +"built-in/transformers/kubernetes/buildconfig/transformer.yaml" : 0644 +"built-in/transformers/kubernetes/clusterselector/clusters/aws-eks.yaml" : 0644 +"built-in/transformers/kubernetes/clusterselector/clusters/azure-aks.yaml" : 0644 +"built-in/transformers/kubernetes/clusterselector/clusters/gcp-gke.yaml" : 0644 +"built-in/transformers/kubernetes/clusterselector/clusters/ibm-iks.yaml" : 0644 +"built-in/transformers/kubernetes/clusterselector/clusters/ibm-openshift.yaml" : 0644 +"built-in/transformers/kubernetes/clusterselector/clusters/kubernetes.yaml" : 0644 +"built-in/transformers/kubernetes/clusterselector/clusters/openshift.yaml" : 0644 +"built-in/transformers/kubernetes/clusterselector/transformer.yaml" : 0644 +"built-in/transformers/kubernetes/knative/transformer.yaml" : 0644 +"built-in/transformers/kubernetes/kubernetes/transformer.yaml" : 0644 +"built-in/transformers/kubernetes/kubernetesversionchanger/transformer.yaml" : 0644 +"built-in/transformers/kubernetes/operator/templates/README.md" : 0644 +"built-in/transformers/kubernetes/operator/templates/subscription.yaml" : 0644 +"built-in/transformers/kubernetes/operator/transformer.yaml" : 0644 +"built-in/transformers/kubernetes/operatorsfromtca/Dockerfile" : 0644 +"built-in/transformers/kubernetes/operatorsfromtca/cfservices.yaml" : 0644 +"built-in/transformers/kubernetes/operatorsfromtca/detect.py" : 0644 +"built-in/transformers/kubernetes/operatorsfromtca/preprocess.py" : 0644 +"built-in/transformers/kubernetes/operatorsfromtca/transform.py" : 0644 +"built-in/transformers/kubernetes/operatorsfromtca/transformer.yaml" : 0644 +"built-in/transformers/kubernetes/parameterizer/parameterizers/replicas.yaml" : 0644 +"built-in/transformers/kubernetes/parameterizer/transformer.yaml" : 0644 +"built-in/transformers/kubernetes/tekton/transformer.yaml" : 0644 +"built-in/transformers/readmegenerator/templates/Readme.md" : 0644 +"built-in/transformers/readmegenerator/transformer.yaml" : 0644 diff --git a/common/utils.go b/common/utils.go index b4a47f0..6c1061f 100644 --- a/common/utils.go +++ b/common/utils.go @@ -19,6 +19,7 @@ package common import ( "bytes" "crypto/sha256" + "embed" "fmt" "github.com/konveyor/move2kube-wasm/types" "github.com/mitchellh/mapstructure" @@ -556,3 +557,103 @@ func Interrupt() error { } return nil } + +// CreateAssetsData creates an assets directory and dumps the assets data into it +func CreateAssetsData(assetsFS embed.FS, permissions map[string]int) (assetsPath string, tempPath string, remoteTempPath string, err error) { + // Return the absolute version of existing asset paths. + tempPath, err = filepath.Abs(TempPath) + if err != nil { + return "", "", "", fmt.Errorf("failed to make the temporary directory path '%s' absolute. Error: %w", TempPath, err) + } + remoteTempPath, err = filepath.Abs(RemoteTempPath) + if err != nil { + return "", "", "", fmt.Errorf("failed to make the remote temporary directory path '%s' absolute. Error: %w", RemoteTempPath, err) + } + assetsPath, err = filepath.Abs(AssetsPath) + if err != nil { + return "", "", "", fmt.Errorf("failed to make the assets path '%s' absolute. Error: %w", AssetsPath, err) + } + + // Try to create a new temporary directory for the assets. + if newTempPath, err := os.MkdirTemp("", types.AppName+"*"); err != nil { + logrus.Errorf("failed to create a temporary directory for the assets. Defaulting to the local path '%s' . Error: %q", tempPath, err) + } else { + tempPath = newTempPath + assetsPath = filepath.Join(newTempPath, AssetsDir) + } + + // Try to create a new temporary directory for the remote source folders. + if newTempPath, err := os.MkdirTemp("", types.AppName+"*"); err != nil { + logrus.Errorf("failed to create a temporary directory for the remote sources. Defaulting to the local path '%s' . Error: %q", remoteTempPath, err) + } else { + remoteTempPath = newTempPath + } + + // Either way create the subdirectory and untar the assets into it. + if err := os.MkdirAll(assetsPath, DefaultDirectoryPermission); err != nil { + return "", "", "", fmt.Errorf("failed to create the assets directory at path '%s' . Error: %w", assetsPath, err) + } + if err := CopyEmbedFSToDir(assetsFS, ".", assetsPath, permissions); err != nil { + return "", "", "", fmt.Errorf("failed to untar the assets into the assets directory at path '%s' . Error: %w", assetsPath, err) + } + return assetsPath, tempPath, remoteTempPath, nil +} + +// CopyEmbedFSToDir converts a string into a directory +func CopyEmbedFSToDir(embedFS embed.FS, source, dest string, permissions map[string]int) (err error) { + sourceUnixPath := GetUnixPath(source) + f, err := embedFS.Open(sourceUnixPath) + if err != nil { + return fmt.Errorf("failed to open the embedded source file '%s' . Error: %w", sourceUnixPath, err) + } + finfo, err := f.Stat() + if err != nil { + return fmt.Errorf("failed to stat the embedded source file '%s' . Error: %w", sourceUnixPath, err) + } + if finfo != nil && !finfo.Mode().IsDir() { + permission, ok := permissions[sourceUnixPath] + if !ok { + logrus.Errorf("permissions missing for the file '%s' . Do `make generate` to update permissions file.", dest) + } + df, err := os.OpenFile(dest, os.O_RDWR|os.O_CREATE|os.O_TRUNC, os.FileMode(permission)) + if err != nil { + return fmt.Errorf("failed to open the temporary dest assets file '%s' . Error: %w", dest, err) + } + defer df.Close() + size, err := io.Copy(df, f) + if err != nil { + return fmt.Errorf("failed to copy the embedded file. Error: %w", err) + } + if size != finfo.Size() { + return fmt.Errorf("size mismatch: Wrote %d, Expected %d", size, finfo.Size()) + } + return nil + } + if err := os.MkdirAll(dest, DefaultDirectoryPermission); err != nil { + return fmt.Errorf("failed to create the destination directory at '%s' . Error: %w", dest, err) + } + dirEntries, err := embedFS.ReadDir(sourceUnixPath) + if err != nil { + return fmt.Errorf("failed to read the destination directory at '%s' . Error: %w", dest, err) + } + for _, de := range dirEntries { + t1Src := filepath.Join(source, de.Name()) + t1Dest := filepath.Join(dest, removeDollarPrefixFromHiddenDir(de.Name())) + if err := CopyEmbedFSToDir(embedFS, t1Src, t1Dest, permissions); err != nil { + logrus.Errorf("failed to copy the embedded directory from '%s' to '%s' . Skipping. Error: %q", t1Src, t1Dest, err) + } + } + return nil +} + +// GetUnixPath return Unix Path for any path +func GetUnixPath(path string) string { + return strings.ReplaceAll(path, `\`, `/`) +} + +func removeDollarPrefixFromHiddenDir(name string) string { + if strings.HasPrefix(name, "$.") || strings.HasPrefix(name, "$_") { + name = name[1:] + } + return name +} diff --git a/main.go b/main.go index 6994028..fc94453 100644 --- a/main.go +++ b/main.go @@ -1,13 +1,31 @@ package main import ( + "github.com/konveyor/move2kube-wasm/assets" "github.com/konveyor/move2kube-wasm/cmd" + "github.com/konveyor/move2kube-wasm/common" "github.com/sirupsen/logrus" + "gopkg.in/yaml.v3" + "os" ) func main() { logrus.Infof("start") rootCmd := cmd.GetPlanCommand() + assetsFilePermissions := map[string]int{} + err := yaml.Unmarshal([]byte(assets.AssetFilePermissions), &assetsFilePermissions) + if err != nil { + logrus.Fatalf("failed to unmarshal the assets permissions file as YAML. Error: %q", err) + } + assetsPath, tempPath, remoteTempPath, err := common.CreateAssetsData(assets.AssetsDir, assetsFilePermissions) + if err != nil { + logrus.Fatalf("failed to create the assets directory. Error: %q", err) + } + common.TempPath = tempPath + common.AssetsPath = assetsPath + common.RemoteTempPath = remoteTempPath + defer os.RemoveAll(tempPath) + defer os.RemoveAll(remoteTempPath) if err := rootCmd.Execute(); err != nil { logrus.Fatalf("Error: %q", err) } diff --git a/scripts/generator/persistpermissions.go b/scripts/generator/persistpermissions.go new file mode 100644 index 0000000..bf9e393 --- /dev/null +++ b/scripts/generator/persistpermissions.go @@ -0,0 +1,113 @@ +//go:build ignore +// +build ignore + +/* + * Copyright IBM Corporation 2020, 2021 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// This program generates dockerfiles.go. It can be invoked by running +// go generate +package main + +import ( + "fmt" + "os" + "path/filepath" + "strings" + + "github.com/sirupsen/logrus" +) + +const ( + permissionsheader = `# Code generated by go generate; DO NOT EDIT. + +# Copyright IBM Corporation 2020, 2021 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +` +) + +var permissions = map[string]string{} + +func main() { + directory := os.Args[1] + permissionsFilePath := os.Args[2] + + permissionsString, err := getFilePermissions(directory) + if err != nil { + logrus.Errorf("Error while getting permissions : %s", err) + return + } + + err = os.WriteFile(permissionsFilePath, []byte(permissionsheader+permissionsString), 0644) + if err != nil { + logrus.Errorf("Error while getting permissions file : %s", err) + return + } + logrus.Infof("Persisted permissions file %s", permissionsFilePath) +} + +func getFilePermissions(path string) (permissions string, err error) { + f, err := os.Open(path) + if err != nil { + logrus.Errorf("Error while reading file : %s", err) + return "", err + } + finfo, err := f.Stat() + if err != nil { + logrus.Errorf("Unable to get stat of file : %s", err) + return "", err + } + if finfo != nil && !finfo.Mode().IsDir() { + return `"` + path + `" : ` + fmt.Sprintf("%04o", finfo.Mode().Perm()), nil + } + dirEntries, err := os.ReadDir(path) + if err != nil { + return "", err + } + for _, de := range dirEntries { + fp := filepath.Join(path, de.Name()) + if !isValidName(de.Name()) { + logrus.Warnf("Filename should not start with . or _ in assets directory. %s will be ignored. Prepend a $ if necessary to override.", fp) + } + dep, err := getFilePermissions(fp) + if err != nil { + logrus.Errorf("Error while getting file permissions as string : %s", err) + continue + } + if strings.TrimSpace(dep) != "" { + permissions += strings.TrimSpace(dep) + "\n" + } + } + return permissions, nil +} + +func isValidName(name string) bool { + if strings.HasPrefix(name, ".") || strings.HasPrefix(name, "_") { + return false + } + return true +}