External graph library and company#20532
External graph library and company#20532openshift-merge-robot merged 9 commits intoopenshift:masterfrom
Conversation
|
/retest |
ae911b5 to
ea2ce08
Compare
ea2ce08 to
c56f5c0
Compare
|
OK, this is ready for review, although I still have some prunning unit tests to fix. /assign @bparees @dmage /assign @juanvallejo /assign @deads2k |
| dockerStrategy: | ||
| from: | ||
| kind: DockerReference | ||
| kind: DockerImage |
There was a problem hiding this comment.
@bparees that was weird change, do we somehow convert DockerReference to DockerImage during conversion from external to internal, I coulnd't find anything like that. If not, how this could ever work?
There was a problem hiding this comment.
I can only speculate that this object was never being passed through build api validation?
because i don't think "DockerReference" would have ever been correct.
There was a problem hiding this comment.
Yeah, that what I imagined as well, that's why this is now fixed :)
There was a problem hiding this comment.
@soltysh would be nice if we can call the validation in test to ensure the objects are actually valid :-) (follow up issue?)
| legacy.InstallExternalLegacyAll(scheme) | ||
| codecs := serializer.NewCodecFactory(scheme) | ||
| decoder := codecs.UniversalDeserializer() | ||
| obj, err := runtime.Decode(decoder, data) |
There was a problem hiding this comment.
@deads2k for the tests that rely on scheme I've decided to create a standalone scheme installing only the APIs I cared about, wdyt?
There was a problem hiding this comment.
@deads2k for the tests that rely on scheme I've decided to create a standalone scheme installing only the APIs I cared about, wdyt?
That's a good idea. You may wan to to use k8s.io/apimachinery/pkg/api/testing.SchemeForOrDie which allows you to just list the various install methods.
| install.InstallInternalOpenShift(scheme) | ||
| codecs := serializer.NewCodecFactory(scheme) | ||
| decoder := codecs.UniversalDecoder() | ||
| obj, err := runtime.Decode(decoder, data) |
There was a problem hiding this comment.
@deads2k I had to leave this decode as it was before instead of deserializer b/c I needed defaulting to kick in.
There was a problem hiding this comment.
It's fine as a stepping stone. We'll need to sort it out before we can snip oc entirely.
| // This only returns pod specs for v1 compatible objects. | ||
| func GetPodSpecV1(obj runtime.Object) (*kapiv1.PodSpec, *field.Path, error) { | ||
| switch r := obj.(type) { | ||
|
|
There was a problem hiding this comment.
Hm, since we have cli commands that depend on this, couldn't we snip this link between oc and api helpers by creating a PodSpecGetter or similar under polymorphic helpers?
There was a problem hiding this comment.
Yeah, worth discussing, but definitely not in this PR ;-)
| if cast.ReplicaSet.Spec.Selector != nil { | ||
| selector = cast.ReplicaSet.Spec.Selector.MatchLabels | ||
| } | ||
| AddManagedByControllerPodEdges(g, cast, cast.ReplicaSet.Namespace, selector) |
There was a problem hiding this comment.
:/ we will eventually do this in a more generic way (rather than an ever-increasing switch) right?
There was a problem hiding this comment.
Hehe, we'll need to figure something out, for sure.
| } | ||
| // image.DockerImageMetadata = imagev1.DockerImage{ | ||
| // ID: *configName, | ||
| // } |
There was a problem hiding this comment.
Is this a TODO? Do we still need to find a way to modify the contents of imagev1.DockerImage metadata?
There was a problem hiding this comment.
Yeah, that was that failing unit tests that I fixed already.
| } | ||
|
|
||
| // getClients returns a OpenShift client and Kube client. | ||
| func getClients(f kcmdutil.Factory) (appsclient.DeploymentConfigsGetter, buildclient.BuildInterface, imageclient.ImageInterface, kclientset.Interface, error) { |
There was a problem hiding this comment.
glad to see old pieces of the cmdutil factory gone
|
A few comments, otherwise cli pieces lgtm |
| } | ||
|
|
||
| func GetValueFromIntOrPercent(intOrPercent *IntOrString, total int, roundUp bool) (int, error) { | ||
| if intOrPercent == nil { |
There was a problem hiding this comment.
per my comment upstream. I think we need to avoid value compression. You can have a defaulttozeroifnil function that you wrap the call to this with, but this method needs the distinction.
c56f5c0 to
8536d76
Compare
| @@ -1,17 +1,17 @@ | |||
| package graphview | |||
There was a problem hiding this comment.
the file itself probably deserves a rename :-)
| for _, uncastNode := range graph.NodesByKind(kubenodes.HorizontalPodAutoscalerNodeKind) { | ||
| node := uncastNode.(*kubenodes.HorizontalPodAutoscalerNode) | ||
|
|
||
| cpuFound := false |
There was a problem hiding this comment.
Difference in internal vs external API.
| } | ||
| if query.Matches(labels.Set(target.Labels)) { | ||
| g.AddEdge(target, to, ManagedByControllerEdgeKind) | ||
| g.AddEdge(target, to, appsgraph.ManagedByControllerEdgeKind) |
There was a problem hiding this comment.
does not sound right :-) you importing this just to get a const...
There was a problem hiding this comment.
I had to move that constant, otherwise I was getting import cycles.
There was a problem hiding this comment.
@soltysh maybe create some common package for const, we can handle that as follow up
| history := imageStream.Status.Tags[tag] | ||
| newHistory := imageapi.TagEventList{} | ||
| var history imagev1.NamedTagEventList | ||
| for _, t := range imageStream.Status.Tags { |
There was a problem hiding this comment.
@soltysh this pattern repeats over and over in code... I would make this a helper, something like:
func IfHasTag(imageStream, tagName, func(t Tag) error) bool, error
There was a problem hiding this comment.
I'll open a followup for these helpers.
| } | ||
|
|
||
| if stateMatch && !buildutil.IsTerminalPhase(build.Phase) { | ||
| if stateMatch && !buildutil.IsTerminalPhase(build.Status.Phase) { |
There was a problem hiding this comment.
Not sneaky, but that's how the external API differs from internal.
005272b to
33efe28
Compare
|
Switched the build commit to use internal helpers. |
33efe28 to
b763576
Compare
|
/retest |
|
/lgtm let the race begin! |
…m appsapi entirely
b763576 to
d14912b
Compare
|
New changes are detected. LGTM label has been removed. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mfojtik, soltysh The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Rebased - tagging back. |
No description provided.