-
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
External graph library and company #20532
External graph library and company #20532
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 |
@@ -55,7 +55,7 @@ items: | |||
strategy: | |||
dockerStrategy: | |||
from: | |||
kind: DockerReference | |||
kind: DockerImage |
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.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that what I imagined as well, that's why this is now fixed :)
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.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.InstallInternalKube(scheme) | ||
install.InstallInternalOpenShift(scheme) | ||
codecs := serializer.NewCodecFactory(scheme) | ||
decoder := codecs.UniversalDecoder() | ||
obj, err := runtime.Decode(decoder, data) |
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 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine as a stepping stone. We'll need to sort it out before we can snip oc
entirely.
@@ -94,36 +96,66 @@ func GetPodSpec(obj runtime.Object) (*kapi.PodSpec, *field.Path, error) { | |||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:/ we will eventually do this in a more generic way (rather than an ever-increasing switch) right?
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.
Hehe, we'll need to figure something out, for sure.
} | ||
// image.DockerImageMetadata = imagev1.DockerImage{ | ||
// ID: *configName, | ||
// } |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that was that failing unit tests that I fixed already.
@@ -728,44 +744,14 @@ func (p *describingManifestDeleter) DeleteManifest(registryClient *http.Client, | |||
return err | |||
} | |||
|
|||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
glad to see old pieces of the cmdutil factory gone
A few comments, otherwise cli pieces lgtm |
@@ -143,6 +143,9 @@ func (intstr *IntOrString) Fuzz(c fuzz.Continue) { | |||
} | |||
|
|||
func GetValueFromIntOrPercent(intOrPercent *IntOrString, total int, roundUp bool) (int, error) { | |||
if intOrPercent == 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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the file itself probably deserves a rename :-)
@@ -38,15 +35,7 @@ func FindHPASpecsMissingCPUTargets(graph osgraph.Graph, namer osgraph.Namer) []o | |||
for _, uncastNode := range graph.NodesByKind(kubenodes.HorizontalPodAutoscalerNodeKind) { | |||
node := uncastNode.(*kubenodes.HorizontalPodAutoscalerNode) | |||
|
|||
cpuFound := false |
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.
what happened 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.
Difference in internal vs external API.
@@ -120,7 +119,7 @@ func AddManagedByControllerPodEdges(g osgraph.MutableUniqueGraph, to graph.Node, | |||
continue | |||
} | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does not sound right :-) you importing this just to get a const...
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 had to move that constant, otherwise I was getting import cycles.
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.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll open a followup for these helpers.
@@ -210,7 +210,7 @@ func (o *CancelBuildOptions) RunCancelBuild() error { | |||
} | |||
} | |||
|
|||
if stateMatch && !buildutil.IsTerminalPhase(build.Phase) { | |||
if stateMatch && !buildutil.IsTerminalPhase(build.Status.Phase) { |
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.
sneaky :-)
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.
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
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Rebased - tagging back. |
No description provided.