Skip to content

Commit

Permalink
Add events on Ingress detail view (kubernetes#6592)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreadecorte authored Jan 27, 2022
1 parent 4ab436f commit 70c6d5a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/app/backend/handler/apihandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,10 @@ func CreateHTTPAPIHandler(iManager integration.IntegrationManager, cManager clie
apiV1Ws.GET("/ingress/{namespace}/{name}").
To(apiHandler.handleGetIngressDetail).
Writes(ingress.IngressDetail{}))
apiV1Ws.Route(
apiV1Ws.GET("/ingress/{namespace}/{ingress}/event").
To(apiHandler.handleGetIngressEvent).
Writes(common.EventList{}))

apiV1Ws.Route(
apiV1Ws.GET("/networkpolicy").
Expand Down Expand Up @@ -1053,6 +1057,25 @@ func (apiHandler *APIHandler) handleGetIngressDetail(request *restful.Request, r
response.WriteHeaderAndEntity(http.StatusOK, result)
}

func (apiHandler *APIHandler) handleGetIngressEvent(request *restful.Request, response *restful.Response) {
k8sClient, err := apiHandler.cManager.Client(request)
if err != nil {
errors.HandleInternalError(response, err)
return
}

namespace := request.PathParameter("namespace")
name := request.PathParameter("ingress")
dataSelect := parser.ParseDataSelectPathParameter(request)
dataSelect.MetricQuery = dataselect.NoMetrics
result, err := event.GetResourceEvents(k8sClient, dataSelect, namespace, name)
if err != nil {
errors.HandleInternalError(response, err)
return
}
response.WriteHeaderAndEntity(http.StatusOK, result)
}

func (apiHandler *APIHandler) handleGetIngressList(request *restful.Request, response *restful.Response) {
k8sClient, err := apiHandler.cManager.Client(request)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {takeUntil} from 'rxjs/operators';
export class IngressDetailComponent implements OnInit, OnDestroy {
ingress: IngressDetail;
isInitialized = false;
eventListEndpoint: string;
private readonly endpoint_ = EndpointManager.resource(Resource.ingress, true);
private readonly unsubscribe_ = new Subject<void>();

Expand All @@ -44,6 +45,8 @@ export class IngressDetailComponent implements OnInit, OnDestroy {
const resourceName = this.activatedRoute_.snapshot.params.resourceName;
const resourceNamespace = this.activatedRoute_.snapshot.params.resourceNamespace;

this.eventListEndpoint = this.endpoint_.child(resourceName, Resource.event, resourceNamespace);

this.ingress_
.get(this.endpoint_.detail(), resourceName, resourceNamespace)
.pipe(takeUntil(this.unsubscribe_))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,5 @@
[namespace]="ingress?.objectMeta.namespace"
[initialized]="isInitialized">
</kd-ingressruleflat-card-list>

<kd-event-list [endpoint]="eventListEndpoint"></kd-event-list>

0 comments on commit 70c6d5a

Please sign in to comment.