Skip to content

Commit

Permalink
Merge pull request #18579 from juanvallejo/jvallejo/fix-standalone-de…
Browse files Browse the repository at this point in the history
…ployments

Automatic merge from submit-queue (batch tested with PRs 18437, 18546, 18550, 18579).

Deployment updates in status graph

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1544183

- Implements the `ExistenceChecker` interface for Deployments and ReplicaSets
which allows the HPA error marker to be set if it is trying to scale a deleted Deployment (or rs).

- Skips standalone resources that are not found

cc @soltysh @mfojtik @deads2k
  • Loading branch information
openshift-merge-robot authored Feb 13, 2018
2 parents b1dd578 + 6e1a34e commit 689dc7d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
16 changes: 16 additions & 0 deletions pkg/oc/cli/describe/projectstatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,20 @@ func (d *ProjectStatusDescriber) Describe(namespace, name string) (string, error
}

for _, standaloneDC := range standaloneDCs {
if !standaloneDC.DeploymentConfig.Found() {
continue
}

fmt.Fprintln(out)
printLines(out, indent, 0, describeDeploymentConfigInServiceGroup(f, standaloneDC, func(rc *kubegraph.ReplicationControllerNode) int32 {
return graphview.MaxRecentContainerRestartsForRC(g, rc)
})...)
}
for _, standaloneDeployment := range standaloneDeployments {
if !standaloneDeployment.Deployment.Found() {
continue
}

fmt.Fprintln(out)
printLines(out, indent, 0, describeDeploymentInServiceGroup(f, standaloneDeployment, func(rs *kubegraph.ReplicaSetNode) int32 {
return graphview.MaxRecentContainerRestartsForRS(g, rs)
Expand All @@ -318,11 +326,19 @@ func (d *ProjectStatusDescriber) Describe(namespace, name string) (string, error
}

for _, standaloneRC := range standaloneRCs {
if !standaloneRC.RC.Found() {
continue
}

fmt.Fprintln(out)
printLines(out, indent, 0, describeRCInServiceGroup(f, standaloneRC.RC)...)
}

for _, standaloneRS := range standaloneRSs {
if !standaloneRS.RS.Found() {
continue
}

fmt.Fprintln(out)
printLines(out, indent, 0, describeRSInServiceGroup(f, standaloneRS.RS)...)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/oc/graph/kubegraph/nodes/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ func EnsureStatefulSetNode(g osgraph.MutableUniqueGraph, statefulSet *kapps.Stat
node := osgraph.EnsureUnique(g,
nodeName,
func(node osgraph.Node) graph.Node {
return &StatefulSetNode{node, statefulSet}
return &StatefulSetNode{node, statefulSet, false}
},
).(*StatefulSetNode)

Expand Down
10 changes: 10 additions & 0 deletions pkg/oc/graph/kubegraph/nodes/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,10 @@ type DeploymentNode struct {
IsFound bool
}

func (n DeploymentNode) Found() bool {
return n.IsFound
}

func (n DeploymentNode) Object() interface{} {
return n.Deployment
}
Expand Down Expand Up @@ -430,6 +434,12 @@ func StatefulSetNodeName(o *kapps.StatefulSet) osgraph.UniqueName {
type StatefulSetNode struct {
osgraph.Node
StatefulSet *kapps.StatefulSet

IsFound bool
}

func (n StatefulSetNode) Found() bool {
return n.IsFound
}

func (n StatefulSetNode) Object() interface{} {
Expand Down

0 comments on commit 689dc7d

Please sign in to comment.