konveyor / move2kube

Move2Kube is a command-line tool for automating creation of Infrastructure as code (IaC) artifacts. It has inbuilt support for creating IaC artifacts for replatforming to Kubernetes/Openshift.
https://move2kube.konveyor.io/
Apache License 2.0
383 stars 118 forks source link

Duplicate entires v1 for Node, Pod, NetworkPolicy, etc. when collecting cluster metadata. #178

Open HarikrishnanBalagopal opened 3 years ago

HarikrishnanBalagopal commented 3 years ago

Steps to reproduce

Note: This bug only occurs when collecting use the CLI. By default it will use the CLI only if the API fails.

  1. move2kube collect -a k8s

Expected behaviour

Cluster metadata yaml should have:

Node:
  - v1

Actual behaviour

Cluster metadata yaml has:

Node:
  - v1
  - v1

This also happens with Pod and NetworkPolicy.

This is an old bug that was never fixed.

Proposed Fix

The code that parses the CLI output needs to be looked at closely. kubectl returns human readable output, so the parsing code is fragile.

HarikrishnanBalagopal commented 3 years ago

This might be helpful: https://kubernetes.io/docs/reference/kubectl/overview/#operations https://www.mankier.com/1/kubectl-cluster-info-dump It outputs a lot of information and the format can be chosen (json, yaml, etc.).