-
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
restapi: implement export for origin resources #8570
Conversation
[test] |
@@ -52,3 +54,19 @@ func GetFieldLabelConversionFunc(supportedLabels map[string]string, overrideLabe | |||
return "", "", fmt.Errorf("field label not supported: %s", label) | |||
} | |||
} | |||
|
|||
// TODO: Move this upstream | |||
func ExportObjectMeta(objMeta *kapi.ObjectMeta, exact 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.
I don't like this method modifies object in place. I'd rather prefer this returns modified object.
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.
Generally if exact
is passed I'd leave the Name
or GenerateName
where applicable and Namespace
. All other fields are not important. At least that's what I usually do when doing oc get -o yaml and modifying by hand.
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 like this method modifies object in place. I'd rather prefer this returns modified object.
Modifying in place is the whole pattern of RESTExportStrategy
. It would be a little strange to not do it here.
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 see you've just copied the method from export.go
as is, still since this will be part of public API I'd make it return the modified object.
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.
@deads2k convinced me ;)
LGTM |
@@ -39,6 +40,7 @@ func (strategy) AllowUnconditionalUpdate() bool { | |||
// PrepareForCreate clears fields that are not allowed to be set by end users on creation. | |||
func (strategy) PrepareForCreate(obj runtime.Object) { | |||
bc := obj.(*api.BuildConfig) | |||
bc.Status.LastVersion = 0 |
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.
Should normalize the status object and not just latestVersion
We may want to sync between dc.status.latestVersion and bc.status.lastVersion |
@Kargakis sync what about them exactly? are you suggesting a name change? |
Yes, I assumed that they had the same name and run a negative test for |
i don't really like the bc.lastVersion field name anyway, but what i'd like to change it to is more like buildNumber or something. |
Upstream they are using revision (albeit, as an annotation) for deployments and we also recently changed LATEST (which stands for latestVersion) to REVISION for |
if len(build.Status.Phase) == 0 { | ||
build.Status.Phase = api.BuildPhaseNew | ||
} | ||
build.Status.Duration = 0 |
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.
Why aren't you clearing the status the same way here as elsewhere (assigning BuildStatus{})?
A few comments |
if exact { | ||
return nil | ||
} | ||
if build.Status.Config != nil { |
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.
Now I am wondering if this can ever be non-nil
Let's hold onto this until kubernetes/kubernetes#24855 is resolved upstream. |
Evaluated for origin test up to e5e3e2f |
continuous-integration/openshift-jenkins/test FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/4478/) |
Origin Action Required: Pull request cannot be automatically merged, please rebase your branch from latest HEAD and push again |
Blocked on kubernetes/kubernetes#24855
Ref issue: #8459
@deads2k @smarterclayton PTAL