-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Add a migration framework for mutable resources #9240
Conversation
d8358f6
to
a803f03
Compare
[test] |
7e16e64
to
b341d39
Compare
This is done barring tests. |
5e70e7e
to
cc5c962
Compare
@deads2k take a look at this On Sat, Jun 11, 2016 at 11:35 PM, OpenShift Bot notifications@github.com
|
7bf2697
to
c6c0e20
Compare
This is now effectively complete for review. Tests for migration of storage need more work - still debating what the best approach is, but probably going to be taking an old db data dump from v1.0 and running migration twice on it and verifying it boots. |
9ca93e6
to
326a588
Compare
/cc |
@@ -283,6 +284,13 @@ func New(c *restclient.Config) (*Client, error) { | |||
return &Client{client}, nil | |||
} | |||
|
|||
// DiscoveryClient returns a discovery client. | |||
func (c *Client) Discovery() discovery.DiscoveryInterface { | |||
d := discovery.NewDiscoveryClient(c.RESTClient) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're using this, want to remove the cruft from pkg/client/discovery.go
where we combine results from /api
and /oapi
"for the short-term/forever"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually... maybe I just want to use that.
Can you break out some of the prerequisite pulls to make this a little smaller to look at, I'm going cross eyed. Assuming this the approach we want instead of one that streams through, it looks plausible. |
326a588
to
9a06747
Compare
kcmdutil.CheckErr(options.Complete(f, cmd, args)) | ||
kcmdutil.CheckErr(options.Validate()) | ||
if err := options.Run(); err != nil { | ||
// TODO: move met to kcmdutil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's needed. With the current implementation kcmutil.CheckErr
should os.Exit(1)
with that error, printing nothing (from looking into StandardErrorMessage
from kcmdutil
package).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the rebase got my upstream fix.
On Thu, Jun 16, 2016 at 5:14 AM, Maciej Szulik notifications@github.com
wrote:
In pkg/cmd/admin/migrate/images/images.go
#9240 (comment):
In: in,
Out: out,
ErrOut: errout,
Include: []string{"imagestream", "image", "secrets"},
},
- }
- cmd := &cobra.Command{
Use: fmt.Sprintf("%s REGISTRY/NAME=REGISTRY/NAME [...]", name),
Short: "Update embedded Docker image references",
Long: internalMigrateImagesLong,
Example: fmt.Sprintf(internalMigrateImagesExample, fullName),
Run: func(cmd *cobra.Command, args []string) {
kcmdutil.CheckErr(options.Complete(f, cmd, args))
kcmdutil.CheckErr(options.Validate())
if err := options.Run(); err != nil {
// TODO: move met to kcmdutil
I don't think it's needed. With the current implementation
kcmutil.CheckErr should os.Exit(1) with that error, printing nothing
(from looking into StandardErrorMessage from kcmdutil package).—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/openshift/origin/pull/9240/files/eb1eb8a1f37fe62714438a3a805545a98b82daec..053e3598622ec47ce57195dacc03aedc08e4489f#r67312076,
or mute the thread
https://github.com/notifications/unsubscribe/ABG_p3zxxuIxre02vI8IzwzfJNmdGNccks5qMRPkgaJpZM4IxnZA
.
The flake in tests has been fixed (there was a bug in calling resource.Builder). |
Aaaany other comments? |
return nil | ||
} | ||
|
||
func (o *MigrateImageReferenceOptions) Validate() error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to our conventions both Validate
and Run
should non-pointer methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's strange, because it's not sufficient to defend against any problem
(mutation of sub resources or interfaces), so it's kind of arbitrary, and
goes against our general conventions of always passing pointers unless we
have a real reason not to.
On Wed, Jul 27, 2016 at 4:01 PM, Maciej Szulik notifications@github.com
wrote:
In pkg/cmd/admin/migrate/images/imagerefs.go
#9240 (comment):
- o.ResourceOptions.SaveFn = o.save
- if err := o.ResourceOptions.Complete(f, c); err != nil {
return err
- }
- osclient, _, err := f.Clients()
- if err != nil {
return err
- }
- o.Client = osclient
- return nil
+}
+func (o *MigrateImageReferenceOptions) Validate() error {
According to our conventions
https://github.com/kubernetes/kubernetes/blob/master/docs/devel/kubectl-conventions.md#command-implementation-conventions
both Validate and Run should non-pointer methods.—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/openshift/origin/pull/9240/files/1ddd7d050a21f14d07b8d4198df6e7eec9cf8475#r72512049,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABG_p2L_GGWc9FhgS5T9vXhxerrvLGOSks5qZ7ktgaJpZM4IxnZA
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reasoning was, only Complete
should modify the necessary options struct. The other two should only act upon it, without mutating it in any way. I've spoke with @Kargakis about it.
530d160
to
3278289
Compare
return changed | ||
} | ||
|
||
func updatePodTemplate(template *kapi.PodTemplateSpec, fn TransformImageFunc) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method looks like it's not used anywhere.
Nits, mostly LGTM. |
Implement a migration framework and an image reference migrator: oadm migrate image-references registry1.com/*=registry2.com/* --confirm Reuse resource builder to manage output
3278289
to
f8aa83f
Compare
nits fixed [merge] |
[test] #9959 On Wed, Jul 27, 2016 at 5:35 PM, OpenShift Bot notifications@github.com
|
[test] #9959 |
Flake from #9203. re-[merge] |
Flake from #10076. re-[merge] |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/7056/) (Image: devenv-rhel7_4695) |
Flake #10080, what on earth is wrong with this PR. re-[merge] |
Evaluated for origin merge up to f8aa83f |
[test]
|
Evaluated for origin test up to f8aa83f |
continuous-integration/openshift-jenkins/test FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/7041/) |
@smarterclayton I must admit you're the "luckiest" person when it comes to flakes with this PR, yet another: #9548 re-[merge] |
It's the flake detector. On Thu, Jul 28, 2016 at 10:15 AM, Maciej Szulik notifications@github.com
|
Implement a migration framework and an image reference migrator:
Reuse resource builder to manage output. Handles images, image streams, secrets, and all the pod template resources.
@liggitt