Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add custom QA mappings sample and readme #57

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions enable-disable-qa-categories/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# How to enable/disable the QA categories using custom QA mappings file

By default, Move2Kube uses the QA categories from the built-in [QA mappings](https://github.com/konveyor/move2kube/blob/main/assets/built-in/qa/qamappings.yaml) file. All the categories in the built-in QA Mappings file are enabled by default.

There are multiple ways in which the QA categories can be enabled or disabled. It can be done through a custom QA mappings file that can be uploaded to the Move2Kube UI. It can be also done through `--qa-disable` or `--qa-enable` flags with the Move2Kube CLI/API.

In the custom QA mappings file, the user can also move the questions from one category to the other category, or even define new categories and add questions to them and enable/disable the categories as per the requirements. This is the additional feature that the custom QA mappings file offer, because the `--qa-disable` and `--qa-enable` flags can only be used to enable or disable the categories amongst the existing set of categories.

## Disabling QA category using the mappings file

- To disable the `network` QA category, we will use a custom QA mappings file in which the `enabled` flag is set to `false` for the `network` category. And then we will have to pass this QA mappings file as a customization in the UI before running the planning and transform phases.

```yaml
- name: network
enabled: false
questions:
- move2kube.services.*.*.servicetype
- move2kube.target.*.ingress.ingressclassname
- move2kube.target.*.ingress.host
- move2kube.target.*.ingress.tls
```

```console
$ docker pull quay.io/konveyor/move2kube-ui:latest
```

```console
$ docker run --rm -it -p 8080:8080 quay.io/konveyor/move2kube-ui:latest
```

- Upload the source zip file and the customizations zipped folder containing the custom QA mappings file with network categories disabled. Run the plan phase and then start the transformation. During the transformation, Move2Kube will not ask any questions from the network category (servicetype, ingress host, tls, etc.).

## Using a config file along with the QA mappings file

- We have also provided a sample `config.yaml` file, with some dummy values, that can be used for answering some of the questions automatically to further reduce the number of questions that the user is required to answer during the transform phase.

- To use the config file and the customized qa mappings file, upload the source zip file, the config file and the customizations zipped folder containing the custom QA mappings file with network categories disabled. And then run the plan phase followed by the transform phase.

- It should only ask questions related to the service ports, because the config.yaml file contains the answer for all the categories other than the `ports` and `network` categories, and the custom QA mappings file disables the `network` category. So, the user will have to answer only the questions related to ports.

## Enabling/Disabling QA categories with Move2Kube CLI

- When using the Move2Kube CLI, to disable the QA categories `network` the below command can be used. Let's assume that the `src` folder contains the source artifacts.

```console
$ move2kube transform -s src --qa-disable network
```

To use the config file with `--qa-disable` flag

```console
$ move2kube transform -s src --qa-disable network -f config.yaml
```
73 changes: 73 additions & 0 deletions enable-disable-qa-categories/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
move2kube:
minreplicas: "2"
services:
"*":
deployment: Deployment
enable: true
dockerfileType: build stage in base image
wartransformer: Tomcat
spawncontainers: false
target:
cicd:
tekton:
gitrepobasicauthsecret: ""
gitreposshsecret: ""
registrypushsecret: ""
default:
clustertype: Openshift
ingress:
host: myproject.com
imageregistry:
namespace: myproject
quay.io:
logintype: no authentication
url: quay.io
transformers:
kubernetes:
argocd:
namespace: ""
types:
- ArgoCD
- Buildconfig
- CNBContainerizer
- CloudFoundry
- ClusterSelector
- ComposeAnalyser
- ComposeGenerator
- ContainerImagesPushScriptGenerator
- DockerfileDetector
- DockerfileImageBuildScript
- DockerfileParser
- DotNetCore-Dockerfile
- EarAnalyser
- EarRouter
- Golang-Dockerfile
- Gradle
- Jar
- Jboss
- Knative
- Kubernetes
- KubernetesVersionChanger
- Liberty
- Maven
- Nodejs-Dockerfile
- OperatorTransformer
- OperatorsFromTCA
- PHP-Dockerfile
- Parameterizer
- Python-Dockerfile
- ReadMeGenerator
- Ruby-Dockerfile
- Rust-Dockerfile
- Tekton
- Tomcat
- WarAnalyser
- WarRouter
- WinWebApp-Dockerfile
- ZuulAnalyser
transformerselector: ""
route:
tls:
certificate: ""
key: ""
terminationpolicy: edge
80 changes: 80 additions & 0 deletions enable-disable-qa-categories/custom-qa-mapping/qamappings.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
apiVersion: move2kube.konveyor.io/v1alpha1
kind: QAMappings
metadata:
name: Custom-QA-Mappings
spec:
categories:
- name: imageregistry
# or use the flags --enable imageregistry/--disable imageregistry
enabled: true
questions:
- move2kube.target.imageregistry.url
- move2kube.target.imageregistry.namespace
- move2kube.target.imageregistry.*.logintype
- move2kube.target.imageregistry.*.password
- name: sshkeys
enabled: true
questions:
- move2kube.repo.keys.*.key
- move2kube.repo.keys.pub.domain.*.pubkey
- move2kube.repo.keys.pub.load
- move2kube.repo.keys.load
- move2kube.repo.keys.paths
- move2kube.repo.keys.priv.*.password
- name: storage
enabled: true
questions:
- move2kube.storage.type.*.options
- name: sourceanalyzer
enabled: true
questions:
- move2kube.services.*.enable
- move2kube.services.*.statefulset
- move2kube.services.*.containerizationoption
- move2kube.services.*.childProjects.*.publishprofile
- move2kube.services.*.apacheconfig
- move2kube.services.*.pythonmainfile
- move2kube.services.*.pythonstartingfile
- move2kube.services.*.dockerfileType
- move2kube.services.*.childModules.*.enable
- move2kube.services.*.childProjects.*.enable
- move2kube.services.*.childModules.*.springBootProfiles
- move2kube.services.*.mavenProfiles
- name: cluster
enabled: true
questions:
- move2kube.target.*.clustertype
- move2kube.minreplicas
- name: network
enabled: false
questions:
- move2kube.services.*.*.servicetype
- move2kube.target.*.ingress.ingressclassname
- move2kube.target.*.ingress.host
- move2kube.target.*.ingress.tls
- name: new-category
enabled: true
questions:
- move2kube.services.*.*.urlpath
- move2kube.services.*.ports
- move2kube.services.*.port
- name: git
enabled: true
questions:
- move2kube.vcs.git.name
- move2kube.vcs.git.username
- move2kube.vcs.git.email
- move2kube.vcs.git.pass
- name: cicd
enabled: true
questions:
- move2kube.target.cicd.tekton.gitreposshsecret
- move2kube.target.cicd.tekton.gitrepobasicauthsecret
- move2kube.target.cicd.tekton.registrypushsecret
- move2kube.transformers.kubernetes.argocd.namespace
- name: transformers
enabled: true
questions:
- move2kube.transformerselector
- move2kube.spawncontainers
- move2kube.transformers.types
Loading