Skip to content
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

switch process to produce groupified openshift api resources #19458

Merged
merged 2 commits into from
Apr 24, 2018

Conversation

deads2k
Copy link
Contributor

@deads2k deads2k commented Apr 20, 2018

This updates the process api endpoint (and command) to groupify the openshift api resources before responding. I also found single-use helpers in a non-leaf package with shared helpers. I separated the two and made a leaf package for the shared bits.

@bparees @spadgett you both asked about this
@liggitt @smarterclayton we've spoken about this. I think it's a good idea.
@openshift/sig-master

@openshift-ci-robot openshift-ci-robot added sig/master approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Apr 20, 2018
@openshift-ci-robot openshift-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 20, 2018
@bparees
Copy link
Contributor

bparees commented Apr 20, 2018

lgtm i guess?

@deads2k
Copy link
Contributor Author

deads2k commented Apr 20, 2018

lgtm i guess?

A ringing endorsement

@liggitt
Copy link
Contributor

liggitt commented Apr 20, 2018

Shockingly small and an essential part of bounding inputs to transition to groupified APIs. Will take a look on Monday. Seems like we might want more tests around this.

@bparees
Copy link
Contributor

bparees commented Apr 20, 2018

It's more a lack of endorsement of my ability to review it meaningfully.

@deads2k
Copy link
Contributor Author

deads2k commented Apr 21, 2018

Seems like we might want more tests around this.

In defense of the existing test I had to update, there is a fair amount of variety in the template itself.

@@ -182,3 +181,41 @@ func (r *TemplateFileSearcher) Search(precise bool, terms ...string) (ComponentM

return matches, errs
}

// TemplateReference points to a stored template
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: lowercase

@@ -192,3 +191,24 @@ func (statusStrategy) Canonicalize(obj runtime.Object) {
func (statusStrategy) ValidateUpdate(ctx apirequest.Context, obj, old runtime.Object) field.ErrorList {
return validation.ValidateTemplateInstanceUpdate(obj.(*templateapi.TemplateInstance), old.(*templateapi.TemplateInstance))
}

// ConvertUserToTemplateInstanceRequester copies analogous fields from user.Info to TemplateInstanceRequester
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: lowercase


import (
"fmt"
"regexp"
"strings"

"github.com/openshift/origin/pkg/api/legacygroupification"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: move this to openshift imports

@@ -84,6 +85,10 @@ func (p *Processor) Process(template *templateapi.Template) field.ErrorList {
// referenced namespace.
stripNamespace(item)

gvk := item.GetObjectKind().GroupVersionKind()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably worth a comment about transformation from non-grouped to grouped?

@@ -84,6 +85,10 @@ func (p *Processor) Process(template *templateapi.Template) field.ErrorList {
// referenced namespace.
stripNamespace(item)

gvk := item.GetObjectKind().GroupVersionKind()
legacygroupification.OAPIToGroupifiedGVK(&gvk)
item.GetObjectKind().SetGroupVersionKind(gvk)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to do this only when we detect the non-groupified items?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to do this only when we detect the non-groupified items?

It's a no-op otherwise. I don't like branches.

@deads2k
Copy link
Contributor Author

deads2k commented Apr 23, 2018

nits addressed

@deads2k
Copy link
Contributor Author

deads2k commented Apr 23, 2018

/retest

2 similar comments
@deads2k
Copy link
Contributor Author

deads2k commented Apr 23, 2018

/retest

@deads2k
Copy link
Contributor Author

deads2k commented Apr 23, 2018

/retest

@bparees
Copy link
Contributor

bparees commented Apr 23, 2018

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 23, 2018
@liggitt
Copy link
Contributor

liggitt commented Apr 23, 2018

/lgtm

do we have a place to enumerate remaining oapi references we need to deal with? (ownerReferences, HPA scaleRef, etc)

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bparees, deads2k, liggitt

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:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deads2k
Copy link
Contributor Author

deads2k commented Apr 23, 2018

do we have a place to enumerate remaining oapi references we need to deal with? (ownerReferences, HPA scaleRef, etc)

No, we don't. Suggestions? There's no place in code people will remember.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

2 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 86f9b36 into openshift:master Apr 24, 2018
@deads2k deads2k deleted the server-26-process branch July 3, 2018 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. sig/master size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants