migtools / crane

Tool for migrating Kubernetes workloads, and their data, between clusters.
https://www.konveyor.io/tools/crane/
Apache License 2.0
40 stars 23 forks source link

feat: add new subcommand skopeo-sync-gen #140

Closed djzager closed 2 years ago

djzager commented 2 years ago

This new subcommand will parse imagestreams, looking for a local image and add it to the "source" list that can be passed to skopeo sync for syncing the images to a new cluter.

openshift-ci[bot] commented 2 years ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: djzager

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/konveyor/crane/blob/main/OWNERS)~~ [djzager] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
djzager commented 2 years ago

Testing manually:

$ tree export
export
├── failures
│   └── test-source
└── resources
    └── test-source
        ├── ConfigMap_test-source_kube-root-ca.crt.yaml
        ├── ConfigMap_test-source_openshift-service-ca.crt.yaml
        ├── ImageStreamTag_test-source_alpine:latest.yaml
        ├── ...
        ├── ImageStream_test-source_alpine.yaml
        ├── ImageStream_test-source_busybox.yaml
        ├── ImageStream_test-source_golang.yaml
        ├── ImageStream_test-source_httpd.yaml
        ├── ImageStream_test-source_internal-alpine.yaml
        ├── ImageStream_test-source_internal-bar.yaml
        ├── ImageStream_test-source_internal-baz.yaml
        ├── ImageStream_test-source_internal-busybox.yaml
        ├── ImageStream_test-source_internal-corge.yaml
        ├── ImageStream_test-source_internal-foo.yaml
        ├── ImageStream_test-source_internal-fred.yaml
        ├── ImageStream_test-source_internal-garply.yaml
        ├── ImageStream_test-source_internal-grault.yaml
        ├── ImageStream_test-source_internal-plugh.yaml
        ├── ImageStream_test-source_internal-quux.yaml
        ├── ImageStream_test-source_internal-quuz.yaml
        ├── ImageStream_test-source_internal-qux.yaml
        ├── ImageStream_test-source_internal-waldo.yaml
        ├── ImageStream_test-source_mongo.yaml
        ├── ImageStream_test-source_nextcloud.yaml
        ├── ImageStream_test-source_ruby.yaml
        ├── ImageStream_test-source_tomcat.yaml
        ├── ...

4 directories, 84 files

$ ./crane skopeo-sync-gen --export-dir ./export --registry-url $registry
default-route-openshift-image-registry.djzager-vpc1-3626522b15eedb880d7b99992e225c1b-0000.us-east.containers.appdomain.cloud:
  images:
    test-source/internal-alpine: []
    test-source/internal-bar: []
    test-source/internal-baz: []
    test-source/internal-busybox: []
    test-source/internal-corge: []
    test-source/internal-foo: []
    test-source/internal-fred: []
    test-source/internal-garply: []
    test-source/internal-grault: []
    test-source/internal-plugh: []
    test-source/internal-quux: []
    test-source/internal-quuz: []
    test-source/internal-qux: []
    test-source/internal-waldo: []

Was able to confirm this working with skopeo sync --src yaml ${output_from_skopeo-sync-gen}.

jmontleon commented 2 years ago

/lgtm