crossplane / upjet

A code generation framework and runtime for Crossplane providers
Apache License 2.0
298 stars 86 forks source link

Extend verbosity of migration framework #233

Open ytsarev opened 1 year ago

ytsarev commented 1 year ago

What problem are you facing?

Currently while working on migrator and having some bug in the source sample, I am getting

go run ./cmd/migrator/main.go -s ./source
Using filesystem source
main: error: Failed to generate the migration plan: failed to generate the migration plan: failed to migrate resource: failed to migrate resource: failed to convert from unstructured.Unstructured to the managed resource type: unrecognized type: string
exit status 1

It is not clear where it is happening

How could Upjet help solve your problem?

Increase error verbosity, provide some context and hints around the place of failure

ytsarev commented 1 year ago

For reproduction.

The problematic source sample was

⚠ apiVersion: cache.aws.crossplane.io/v1alpha1
  kind: CacheCluster
  metadata:
    name: test
  spec:
    forProvider:
      region: us-east-1
      applyImmediately: true
      engine: memcached
      cacheNodeType: cache.t2.micro
      numCacheNodes: 1
      engineVersion: 6.2
      cacheParameterGroupName: test
      port: 6379
      cacheSubnetGroupName: test
      preferredMaintenanceWindow: mon:02:20-mon:03:20
      securityGroupIDRefs:
        - name: test-memcached-security-group
    writeConnectionSecretToRef:
      name: test-memcached-creds
      namespace: test
    providerConfigRef:
      name: awsconfig

The 'fixed' source sample is

⚠ apiVersion: cache.aws.crossplane.io/v1alpha1
  kind: CacheCluster
  metadata:
    name: test
  spec:
    forProvider:
      region: us-east-1
      applyImmediately: true
      engine: memcached
      cacheNodeType: cache.t2.micro
      numCacheNodes: 1
      engineVersion: "6.2"
      cacheParameterGroupName: test
      port: 6379
      cacheSubnetGroupName: test
      preferredMaintenanceWindow: mon:02:20-mon:03:20
      securityGroupIDRefs:
        - name: test-memcached-security-group
    writeConnectionSecretToRef:
      name: test-memcached-creds
      namespace: test
    providerConfigRef:
      name: awsconfig

So it was engineVersion: 6.2 vs engineVersion: "6.2" that was introducing the failure