Skip to content

Commit 47a7399

Browse files
Merge pull request #18344 from juanvallejo/jvallejo/pick-origin-pr-18150
Automatic merge from submit-queue. Pick 18150: track deployment scaleRefs for hpas Picks #18150 Backport part of fix for https://bugzilla.redhat.com/show_bug.cgi?id=1539876 Manual pick [due to merge conflicts](#18150 (comment)) with cherry-picking from original PR onto 3.8 / 3.7 cc @soltysh
2 parents c15b800 + a9aa3e3 commit 47a7399

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

pkg/api/kubegraph/edges.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ import (
1111
"k8s.io/apimachinery/pkg/runtime"
1212
"k8s.io/apimachinery/pkg/runtime/schema"
1313
kapi "k8s.io/kubernetes/pkg/api"
14+
kapisext "k8s.io/kubernetes/pkg/apis/extensions"
1415

1516
osgraph "github.com/openshift/origin/pkg/api/graph"
1617
kubegraph "github.com/openshift/origin/pkg/api/kubegraph/nodes"
1718
deployapi "github.com/openshift/origin/pkg/apps/apis/apps"
19+
appsgraph "github.com/openshift/origin/pkg/apps/graph/nodes"
1820
deploygraph "github.com/openshift/origin/pkg/apps/graph/nodes"
1921
)
2022

@@ -241,6 +243,8 @@ func AddHPAScaleRefEdges(g osgraph.Graph) {
241243
syntheticNode = kubegraph.FindOrCreateSyntheticReplicationControllerNode(g, &kapi.ReplicationController{ObjectMeta: syntheticMeta})
242244
case deployapi.IsResourceOrLegacy("deploymentconfigs", r):
243245
syntheticNode = deploygraph.FindOrCreateSyntheticDeploymentConfigNode(g, &deployapi.DeploymentConfig{ObjectMeta: syntheticMeta})
246+
case r == kapisext.Resource("deployments"):
247+
syntheticNode = appsgraph.FindOrCreateSyntheticDeploymentNode(g, &kapisext.Deployment{ObjectMeta: syntheticMeta})
244248
default:
245249
continue
246250
}

pkg/oc/cli/describe/projectstatus.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ import (
1616
kapi "k8s.io/kubernetes/pkg/api"
1717
kapps "k8s.io/kubernetes/pkg/apis/apps"
1818
"k8s.io/kubernetes/pkg/apis/autoscaling"
19+
kapisext "k8s.io/kubernetes/pkg/apis/extensions"
1920
kclientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
2021
kappsclient "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/apps/internalversion"
2122
kautoscalingclient "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/autoscaling/internalversion"
2223
kcoreclient "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion"
24+
kapisextclient "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/extensions/internalversion"
2325

2426
osgraph "github.com/openshift/origin/pkg/api/graph"
2527
"github.com/openshift/origin/pkg/api/graph/graphview"
@@ -30,6 +32,7 @@ import (
3032
appsclient "github.com/openshift/origin/pkg/apps/generated/internalclientset/typed/apps/internalversion"
3133
deployedges "github.com/openshift/origin/pkg/apps/graph"
3234
deployanalysis "github.com/openshift/origin/pkg/apps/graph/analysis"
35+
appsgraph "github.com/openshift/origin/pkg/apps/graph/nodes"
3336
deploygraph "github.com/openshift/origin/pkg/apps/graph/nodes"
3437
deployutil "github.com/openshift/origin/pkg/apps/util"
3538
buildapi "github.com/openshift/origin/pkg/build/apis/build"
@@ -93,6 +96,7 @@ func (d *ProjectStatusDescriber) MakeGraph(namespace string) (osgraph.Graph, set
9396
&podLoader{namespace: namespace, lister: d.K.Core()},
9497
&statefulSetLoader{namespace: namespace, lister: d.K.Apps()},
9598
&horizontalPodAutoscalerLoader{namespace: namespace, lister: d.K.Autoscaling()},
99+
&deploymentLoader{namespace: namespace, lister: d.K.Extensions()},
96100
// TODO check swagger for feature enablement and selectively add bcLoader and buildLoader
97101
// then remove errors.TolerateNotFoundError method.
98102
&bcLoader{namespace: namespace, lister: d.BuildClient},
@@ -1381,6 +1385,30 @@ func (l *horizontalPodAutoscalerLoader) AddToGraph(g osgraph.Graph) error {
13811385
return nil
13821386
}
13831387

1388+
type deploymentLoader struct {
1389+
namespace string
1390+
lister kapisextclient.DeploymentsGetter
1391+
items []kapisext.Deployment
1392+
}
1393+
1394+
func (l *deploymentLoader) Load() error {
1395+
list, err := l.lister.Deployments(l.namespace).List(metav1.ListOptions{})
1396+
if err != nil {
1397+
return err
1398+
}
1399+
1400+
l.items = list.Items
1401+
return nil
1402+
}
1403+
1404+
func (l *deploymentLoader) AddToGraph(g osgraph.Graph) error {
1405+
for i := range l.items {
1406+
appsgraph.EnsureDeploymentNode(g, &l.items[i])
1407+
}
1408+
1409+
return nil
1410+
}
1411+
13841412
type serviceAccountLoader struct {
13851413
namespace string
13861414
lister kcoreclient.ServiceAccountsGetter

0 commit comments

Comments
 (0)