Skip to content

Commit

Permalink
Add additional information to new kube resource tables (#4825)
Browse files Browse the repository at this point in the history
* Allow k8s namespaces to be added as favourites

* k8s: Add support for more resource types in a generic way

* Improve the home page

* Fix lint issue

* Tweaks and refactoring

* Add separator to layout menu

* Improve incremental loading

* Various tidyups and improvements

* Tidy ups and improvemts to async loading

* Fix progress spinner alignment

* Unscubribe

* Minor bug fixes and a few tidy ups

* Further tidy ups

* Fix front end unit tests

* Unit test fix

* Further unit tests fixes

* Endpoint card unit test fixes

* Fix unit tests

* Tidy up favorite card

* Further refinement to the UI

* Fix missing dates from recents on CF view

* Get app deploy from home screen working

* Add message for when no connected endpoints

* Unit test fixes

* Kubernetes Home Card unit test fixes

* Fix unit test error

* Move components to remove dependency on large shared module

* Fix unit test and add deploy tiles to CF Home Card

* Fix word wrap on favorite name

* Add tool tip

* Style tidy ups

* Minor tidy ups

* Check favorites exists before navigating to them

* Fix test imports

* First round of tidy ups of the user favorites code

* Further refactor to reduce the complexity of user favorites

* Fix unit tests

* Allow Kubernetes namespaces to be favorited

* Fix duplicate import

* Tidy ups

* e2e Debugging

* Fix for org delete e2e test

* E2e Test fix

* Refactor out common entity operator

* Slight refactor

* Fix frontend unit tests

* Unit test fix

* Address PR feedback so far

* Address PR feedback

* Fix connected endpoint state check on home screen

* Address PR feedback

* Restore apps link

* Improve typing

* Fix undefined error

* Fix unit test

* Fix ordering issue

* Add a default home card

* Fix frong end lint issues

* Merge fixes

* Fix unit tests

* WIP

* Fixes for pods view

* Tidy ups

* Add more resource types

* Fix lint issue

* Fix lint issue

* Fix unit test

* Fix lint issues

* Fix build issue

* Fix unit test

* Unit test fix

* Fix unit tests

* More improvements

* Numerous improvements

* Fix lint issue

* RE-arrange kube entity creation
- now assign directly to kube entity catalog
- to access custom kube generator resources have to do some funnies in
  kubernetes-tab-base.component.ts

* Fix services in namespace view
- kube guid and namespace was mixed up
- now follow standard pattern of kube guid then namespace in ctor

* Fix merge issues

* Changes following review

* Fix unit tests

* Fix merge issue

* Fix merge issues

* Changes following merge

* Changes following merge

* Add additional information to new kube resource tables

* Fix merge conflicts

* Only show analysis link when enabled

* Fix issue favoriting from side panel

* Fix expression changed error

* Fix expression changed errors

* Fix a few minor issues and unit test

* Remove old namespace components

* Remvoe TODO

* Fix merge issue

* Fix PR issues

* Delete fixes
- fixes to delete action param
- added to delete pods
- successEntityHandler doesn't run, so have to manually clear pagination sections

* Fix delete ns
- ensure delete action has correct guid
- ensure response has kube guid

* Don't use generic url validation for kube endpoints (#4826)

- this was recently added
- false negative for minikube url (https://192.168.39.159:8443)

* Improvement and fix for no-content component (#4827)

* Improvements and fixes for no-content component
- add colour to improve monotone views on first load
- fix issue where no-content header arrow failed to show in production
  (see angular/angular-cli#17440)

* Fix another opacity percentage
- seen in import kube table edit endpoint name cell

* Bump github.com/mattn/go-sqlite3 from 1.13.0 to 1.14.5 in /src/jetstream (#4816)

Bumps [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3) from 1.13.0 to 1.14.5.
- [Release notes](https://github.com/mattn/go-sqlite3/releases)
- [Commits](mattn/go-sqlite3@v1.13.0...v1.14.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* Document deployment with an ingress; make ingress host optional (#4793)

* Minor Kube Fixes (#4829)

* Fix home screen kube card pod link

* Ensure reset list filter button also resets helm chart repo filter

* Ensure we handle the case where the versions info is unable

* Fix link for namespaces

Co-authored-by: Neil MacDougall <nwmac@users.noreply.github.com>

* Fix expanding pod row

* Fix show of analysis in namespace resource viewer

* Fix fav namespace link

Co-authored-by: Neil MacDougall <neil.macdougall@suse.com>
Co-authored-by: Neil MacDougall <neil_macdougall@hotmail.com>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Ivan Kapelyukhin <ikapelyukhin@suse.com>
Co-authored-by: Neil MacDougall <nwmac@users.noreply.github.com>
  • Loading branch information
6 people committed Dec 9, 2020
1 parent 418371c commit e4a2245
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Compiler, Injector } from '@angular/core';
import { Validators } from '@angular/forms';
import moment from 'moment';

import { BaseEndpointAuth } from '../../../core/src/core/endpoint-auth';
import {
Expand Down Expand Up @@ -71,6 +72,7 @@ import {
import { getGuidFromKubePodObj } from './store/kube.getIds';
import {
AnalysisReport,
BasicKubeAPIResource,
KubeAPIResource,
KubeResourceEntityDefinition,
KubernetesConfigMap,
Expand All @@ -80,6 +82,7 @@ import {
KubernetesPod,
KubernetesStatefulSet,
KubeService,
KubeServiceAccount,
} from './store/kube.types';
import { KubeDashboardStatus } from './store/kubernetes.effects';
import { generateWorkloadsEntities } from './workloads/store/workloads-entity-generator';
Expand Down Expand Up @@ -237,9 +240,9 @@ export class KubeEntityCatalog {
public pv: StratosCatalogEntity<IFavoriteMetadata, KubeAPIResource, KubeResourceActionBuilders>;
public replicaSet: StratosCatalogEntity<IFavoriteMetadata, KubeAPIResource, KubeResourceActionBuilders>;
public clusterRole: StratosCatalogEntity<IFavoriteMetadata, KubeAPIResource, KubeResourceActionBuilders>;
public serviceAccount: StratosCatalogEntity<IFavoriteMetadata, KubeAPIResource, KubeResourceActionBuilders>;
public serviceAccount: StratosCatalogEntity<IFavoriteMetadata, KubeServiceAccount, KubeResourceActionBuilders>;
public role: StratosCatalogEntity<IFavoriteMetadata, KubeAPIResource, KubeResourceActionBuilders>;
public job: StratosCatalogEntity<IFavoriteMetadata, KubeAPIResource, KubeResourceActionBuilders>;
public job: StratosCatalogEntity<IFavoriteMetadata, BasicKubeAPIResource, KubeResourceActionBuilders>;

constructor() {
const endpointDef: StratosEndpointExtensionDefinition = {
Expand Down Expand Up @@ -393,6 +396,11 @@ export class KubeEntityCatalog {
apiName: 'secrets',
apiWorkspaced: true,
listColumns: [
{
header: 'Type',
field: 'type',
sort: true
},
{
header: 'Data Keys',
field: (row: KubernetesConfigMap) => `${Object.keys(row.data).length}`
Expand Down Expand Up @@ -467,10 +475,20 @@ export class KubeEntityCatalog {
apiWorkspaced: true,
listColumns: [
{
header: 'Replicas',
header: 'Desired',
field: 'spec.replicas',
sort: true
},
{
header: 'Current',
field: 'status.replicas',
sort: true
},
{
header: 'Ready',
field: 'status.readyReplicas',
sort: true
},
]
});
this.clusterRole = KubeResourceEntityHelper.generate<KubeAPIResource, KubeResourceActionBuilders>(endpointDef, {
Expand All @@ -481,13 +499,17 @@ export class KubeEntityCatalog {
apiName: 'clusterroles',
apiNamespaced: false,
});
this.serviceAccount = KubeResourceEntityHelper.generate<KubeAPIResource, KubeResourceActionBuilders>(endpointDef, {
this.serviceAccount = KubeResourceEntityHelper.generate<KubeServiceAccount, KubeResourceActionBuilders>(endpointDef, {
type: 'serviceAccount',
icon: 'replica_set',
label: 'Service Account',
apiVersion: '/api/v1',
apiName: 'serviceaccounts',
apiWorkspaced: true,
listColumns: [{
header: 'Secrets',
field: (row: KubeServiceAccount) => row.secrets?.length.toString()
}]
});
this.role = KubeResourceEntityHelper.generate<KubeAPIResource, KubeResourceActionBuilders>(endpointDef, {
type: 'role',
Expand All @@ -497,13 +519,21 @@ export class KubeEntityCatalog {
apiName: 'roles',
apiWorkspaced: true,
});
this.job = KubeResourceEntityHelper.generate<KubeAPIResource, KubeResourceActionBuilders>(endpointDef, {
this.job = KubeResourceEntityHelper.generate<BasicKubeAPIResource, KubeResourceActionBuilders>(endpointDef, {
type: 'job',
icon: 'job',
label: 'Job',
apiVersion: '/apis/batch/v1',
apiName: 'jobs',
apiWorkspaced: true,
listColumns: [{
header: 'Completions',
field: (row: BasicKubeAPIResource) => this.jobToCompletion(row.spec, row.status)
},
{
header: 'Duration',
field: (row: BasicKubeAPIResource) => this.jobToDuration(row.status)
}]
});
}

Expand Down Expand Up @@ -575,6 +605,34 @@ export class KubeEntityCatalog {
endpoint: endpointDefinition,
});
}

private jobToCompletion(spec: any, status: any): string {
if (!!spec.completions) {
return status.succeeded + '/' + spec.completions;
}

if (!spec.parallelism) {
return status.succeeded + '/1';
}

if (spec.parallelism > 1) {
return status.Succeeded + '/1 of ' + spec.parallelism;
}

return status.succeeded + '/1';
}

private jobToDuration(status: any): string {
if (!status.startTime) {
return '';
}

if (!!status.CompletionTime) {
return moment.duration(moment(status.startTime).diff(moment())).humanize();
}

return moment.duration(moment(status.startTime).diff(moment(status.completionTime))).humanize();
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -577,3 +577,8 @@ export interface SimpleKubeListColumn<T = any> {
flex?: string;
sort?: boolean;
}

export interface KubeServiceAccount {
metadata: Metadata;
secrets: { [name: string]: string; }[];
}

0 comments on commit e4a2245

Please sign in to comment.