@spinnaker/kubernetes 2025.0.5 → 2025.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +1178 -641
  3. package/dist/index.js.map +1 -1
  4. package/dist/interfaces/infrastructure.types.d.ts +4 -1
  5. package/dist/manifest/AnnotationCustomSections.d.ts +5 -0
  6. package/dist/manifest/annotationCustomSections.component.d.ts +2 -0
  7. package/dist/manifest/artifact/ManifestArtifact.d.ts +6 -0
  8. package/dist/manifest/index.d.ts +1 -1
  9. package/dist/manifest/manifest.service.d.ts +1 -1
  10. package/dist/manifest/rollout/RollingRestart.d.ts +9 -1
  11. package/dist/manifest/status/ManifestStatus.d.ts +8 -0
  12. package/dist/rawResource/controller/FiltersPubSub.d.ts +1 -1
  13. package/dist/reactShims/index.d.ts +1 -0
  14. package/dist/reactShims/kubernetes.react.injector.d.ts +11 -0
  15. package/dist/reactShims/kubernetes.react.module.d.ts +1 -0
  16. package/dist/serverGroup/details/KubernetesServerGroupActions.d.ts +7 -0
  17. package/dist/serverGroup/details/kubernetesServerGroupDetailsGetter.d.ts +4 -0
  18. package/dist/serverGroup/details/sections/IKubernetesServerGroupDetailsSectionProps.d.ts +5 -0
  19. package/dist/serverGroup/details/sections/ServerGroupAnnotationCustomSection.d.ts +3 -0
  20. package/dist/serverGroup/details/sections/ServerGroupEventsSection.d.ts +3 -0
  21. package/dist/serverGroup/details/sections/ServerGroupHealthSection.d.ts +3 -0
  22. package/dist/serverGroup/details/sections/ServerGroupImagesSection.d.ts +3 -0
  23. package/dist/serverGroup/details/sections/ServerGroupInformationSection.d.ts +3 -0
  24. package/dist/serverGroup/details/sections/ServerGroupLabelsSection.d.ts +3 -0
  25. package/dist/serverGroup/details/sections/ServerGroupManifestStatusSection.d.ts +3 -0
  26. package/dist/serverGroup/details/sections/ServerGroupSizeSection.d.ts +3 -0
  27. package/dist/serverGroup/details/sections/index.d.ts +9 -0
  28. package/dist/serverGroup/details/useManifest.d.ts +8 -0
  29. package/dist/serverGroup/index.d.ts +3 -4
  30. package/dist/serverGroup/{serverGroupCommandBuilder.service.d.ts → serverGroupCommandBuilder.d.ts} +0 -1
  31. package/dist/serverGroup/{serverGroupTransformer.service.d.ts → serverGroupTransformer.d.ts} +0 -1
  32. package/dist/serverGroupManager/details/ServerGroupManagerActions.d.ts +9 -0
  33. package/dist/serverGroupManager/details/ServerGroupManagerDetails.d.ts +7 -0
  34. package/dist/serverGroupManager/details/sections/IKubernetesServerGroupManagerDetailsSectionProps.d.ts +6 -0
  35. package/dist/serverGroupManager/details/sections/ServerGroupManagerAnnotationCustomSection.d.ts +3 -0
  36. package/dist/serverGroupManager/details/sections/ServerGroupManagerArtifactsSection.d.ts +3 -0
  37. package/dist/serverGroupManager/details/sections/ServerGroupManagerEventsSection.d.ts +3 -0
  38. package/dist/serverGroupManager/details/sections/ServerGroupManagerInformationSection.d.ts +3 -0
  39. package/dist/serverGroupManager/details/sections/ServerGroupManagerLabelsSection.d.ts +3 -0
  40. package/dist/serverGroupManager/details/sections/ServerGroupManagerManifestConditionSection.d.ts +3 -0
  41. package/dist/serverGroupManager/details/sections/ServerGroupManagerManifestStatusSection.d.ts +3 -0
  42. package/dist/serverGroupManager/details/sections/index.d.ts +8 -0
  43. package/dist/serverGroupManager/details/useKubernetesServerGroupManagerDetails.d.ts +4 -0
  44. package/dist/serverGroupManager/index.d.ts +1 -1
  45. package/package.json +3 -3
  46. package/src/index.ts +1 -0
  47. package/src/interfaces/infrastructure.types.ts +5 -0
  48. package/src/kubernetes.module.ts +32 -21
  49. package/src/manifest/AnnotationCustomSections.tsx +6 -0
  50. package/src/manifest/annotationCustomSections.component.ts +1 -1
  51. package/src/manifest/artifact/ManifestArtifact.tsx +16 -0
  52. package/src/manifest/index.ts +1 -1
  53. package/src/manifest/rollout/RollingRestart.tsx +2 -10
  54. package/src/manifest/status/ManifestStatus.tsx +39 -0
  55. package/src/manifest/status/status.component.ts +7 -32
  56. package/src/reactShims/index.ts +1 -0
  57. package/src/reactShims/kubernetes.react.injector.ts +30 -0
  58. package/src/reactShims/kubernetes.react.module.ts +12 -0
  59. package/src/serverGroup/details/KubernetesServerGroupActions.tsx +138 -0
  60. package/src/serverGroup/details/kubernetesServerGroupDetailsGetter.ts +63 -0
  61. package/src/serverGroup/details/sections/IKubernetesServerGroupDetailsSectionProps.ts +6 -0
  62. package/src/serverGroup/details/sections/ServerGroupAnnotationCustomSection.tsx +11 -0
  63. package/src/serverGroup/details/sections/ServerGroupEventsSection.tsx +14 -0
  64. package/src/serverGroup/details/sections/ServerGroupHealthSection.tsx +19 -0
  65. package/src/serverGroup/details/sections/ServerGroupImagesSection.tsx +14 -0
  66. package/src/serverGroup/details/sections/ServerGroupInformationSection.tsx +46 -0
  67. package/src/serverGroup/details/sections/ServerGroupLabelsSection.tsx +14 -0
  68. package/src/serverGroup/details/sections/ServerGroupManifestStatusSection.tsx +9 -0
  69. package/src/serverGroup/details/sections/ServerGroupSizeSection.tsx +35 -0
  70. package/src/serverGroup/details/sections/index.ts +9 -0
  71. package/src/serverGroup/details/useManifest.ts +42 -0
  72. package/src/serverGroup/index.ts +3 -4
  73. package/src/serverGroup/{serverGroupCommandBuilder.service.ts → serverGroupCommandBuilder.ts} +0 -9
  74. package/src/serverGroup/{serverGroupTransformer.service.spec.ts → serverGroupTransformer.spec.ts} +1 -1
  75. package/src/serverGroup/{serverGroupTransformer.service.ts → serverGroupTransformer.ts} +0 -7
  76. package/src/serverGroupManager/details/ServerGroupManagerActions.tsx +171 -0
  77. package/src/serverGroupManager/details/ServerGroupManagerDetails.tsx +72 -0
  78. package/src/serverGroupManager/details/sections/IKubernetesServerGroupManagerDetailsSectionProps.ts +7 -0
  79. package/src/serverGroupManager/details/sections/ServerGroupManagerAnnotationCustomSection.tsx +12 -0
  80. package/src/serverGroupManager/details/sections/ServerGroupManagerArtifactsSection.tsx +18 -0
  81. package/src/serverGroupManager/details/sections/ServerGroupManagerEventsSection.tsx +14 -0
  82. package/src/serverGroupManager/details/sections/ServerGroupManagerInformationSection.tsx +51 -0
  83. package/src/serverGroupManager/details/sections/ServerGroupManagerLabelsSection.tsx +14 -0
  84. package/src/serverGroupManager/details/sections/ServerGroupManagerManifestConditionSection.tsx +21 -0
  85. package/src/serverGroupManager/details/sections/ServerGroupManagerManifestStatusSection.tsx +10 -0
  86. package/src/serverGroupManager/details/sections/index.ts +8 -0
  87. package/src/serverGroupManager/details/useKubernetesServerGroupManagerDetails.tsx +53 -0
  88. package/src/serverGroupManager/index.ts +1 -1
  89. package/dist/manifest/artifact/artifact.component.d.ts +0 -1
  90. package/dist/serverGroup/details/details.controller.d.ts +0 -1
  91. package/dist/serverGroup/details/resize/resize.controller.d.ts +0 -1
  92. package/dist/serverGroupManager/details/details.controller.d.ts +0 -1
  93. package/src/manifest/artifact/artifact.component.ts +0 -23
  94. package/src/serverGroup/details/details.controller.ts +0 -207
  95. package/src/serverGroup/details/details.html +0 -153
  96. package/src/serverGroup/details/resize/resize.controller.ts +0 -73
  97. package/src/serverGroup/details/resize/resize.html +0 -57
  98. package/src/serverGroupManager/details/details.controller.ts +0 -191
  99. package/src/serverGroupManager/details/details.html +0 -136
@@ -0,0 +1,30 @@
1
+ import { angular2react } from 'angular2react';
2
+ import type React from 'react';
3
+
4
+ import { ReactInject } from '@spinnaker/core';
5
+
6
+ import type { IAnnotationCustomSectionsProps } from '../manifest/AnnotationCustomSections';
7
+ import { kubernetesAnnotationCustomSectionsComponent } from '../manifest/annotationCustomSections.component';
8
+
9
+ import IInjectorService = angular.auto.IInjectorService;
10
+
11
+ export class KubernetesReactInject extends ReactInject {
12
+ private $injectorProxy = {} as IInjectorService;
13
+
14
+ public KubernetesAnnotationCustomSections: React.ComponentClass<IAnnotationCustomSectionsProps> = angular2react(
15
+ 'kubernetesAnnotationCustomSections',
16
+ kubernetesAnnotationCustomSectionsComponent,
17
+ this.$injectorProxy,
18
+ ) as any;
19
+
20
+ public initialize($injector: IInjectorService) {
21
+ const realInjector: { [key: string]: Function } = $injector as any;
22
+ const proxyInjector: { [key: string]: Function } = this.$injectorProxy as any;
23
+
24
+ Object.keys($injector)
25
+ .filter((key) => typeof realInjector[key] === 'function')
26
+ .forEach((key) => (proxyInjector[key] = realInjector[key].bind(realInjector)));
27
+ }
28
+ }
29
+
30
+ export const KubernetesReactInjector: KubernetesReactInject = new KubernetesReactInject();
@@ -0,0 +1,12 @@
1
+ import { module } from 'angular';
2
+
3
+ import { KubernetesReactInjector } from './kubernetes.react.injector';
4
+
5
+ export const KUBERNETES_REACT_MODULE = 'spinnaker.kubernetes.react';
6
+ module(KUBERNETES_REACT_MODULE, []).run([
7
+ '$injector',
8
+ function ($injector: any) {
9
+ // Make angular services importable and (TODO when relevant) convert angular components to react
10
+ KubernetesReactInjector.initialize($injector);
11
+ },
12
+ ]);
@@ -0,0 +1,138 @@
1
+ import React from 'react';
2
+ import { Dropdown, MenuItem } from 'react-bootstrap';
3
+
4
+ import type { IOwnerOption, IServerGroupActionsProps } from '@spinnaker/core';
5
+ import {
6
+ AddEntityTagLinks,
7
+ ClusterTargetBuilder,
8
+ ConfirmationModalService,
9
+ ModalInjector,
10
+ robotToHuman,
11
+ SETTINGS,
12
+ } from '@spinnaker/core';
13
+
14
+ import type { IKubernetesServerGroupView } from '../../interfaces';
15
+ import { KubernetesManifestCommandBuilder } from '../../manifest';
16
+ import { ManifestTrafficService } from '../../manifest/traffic/ManifestTrafficService';
17
+ import { ManifestWizard } from '../../manifest/wizard/ManifestWizard';
18
+ import { useManifest } from './useManifest';
19
+
20
+ export interface IKubernetesServerGroupActionsProps extends IServerGroupActionsProps {
21
+ serverGroup: IKubernetesServerGroupView;
22
+ }
23
+
24
+ export function KubernetesServerGroupActions({ app, serverGroup }: IKubernetesServerGroupActionsProps) {
25
+ const showEntityTags = SETTINGS.feature && SETTINGS.feature.entityTags;
26
+ const entityTagTargets: IOwnerOption[] = ClusterTargetBuilder.buildClusterTargets(serverGroup);
27
+ const { manifest } = serverGroup;
28
+ const { manifestController } = useManifest({ manifest });
29
+
30
+ const canScaleServerGroup = (): boolean => {
31
+ return serverGroup.kind !== 'daemonSet' && manifestController === null;
32
+ };
33
+
34
+ const scaleServerGroup = () => {
35
+ ModalInjector.modalService.open({
36
+ templateUrl: require('../../manifest/scale/scale.html'),
37
+ controller: 'kubernetesV2ManifestScaleCtrl as ctrl',
38
+ resolve: {
39
+ coordinates: {
40
+ name: serverGroup.name,
41
+ namespace: serverGroup.namespace,
42
+ account: serverGroup.account,
43
+ },
44
+ currentReplicas: manifest.manifest.spec.replicas,
45
+ application: app,
46
+ },
47
+ });
48
+ };
49
+
50
+ const canEditServerGroup = (): boolean => {
51
+ return manifestController === null;
52
+ };
53
+
54
+ const editServerGroup = (): void => {
55
+ KubernetesManifestCommandBuilder.buildNewManifestCommand(
56
+ app,
57
+ manifest.manifest,
58
+ serverGroup.moniker,
59
+ serverGroup.account,
60
+ ).then((builtCommand) => {
61
+ ManifestWizard.show({ title: 'Edit Manifest', application: app, command: builtCommand });
62
+ });
63
+ };
64
+
65
+ const deleteServerGroup = () => {
66
+ ModalInjector.modalService.open({
67
+ templateUrl: require('../../manifest/delete/delete.html'),
68
+ controller: 'kubernetesV2ManifestDeleteCtrl as ctrl',
69
+ resolve: {
70
+ coordinates: {
71
+ name: serverGroup.name,
72
+ namespace: serverGroup.namespace,
73
+ account: serverGroup.account,
74
+ },
75
+ manifestController: () => manifestController,
76
+ application: app,
77
+ },
78
+ });
79
+ };
80
+
81
+ const canDisable = () => ManifestTrafficService.canDisableServerGroup(serverGroup);
82
+
83
+ const disableServerGroup = (): void => {
84
+ ConfirmationModalService.confirm({
85
+ header: `Really disable ${manifest.name}?`,
86
+ buttonText: 'Disable',
87
+ askForReason: true,
88
+ submitJustWithReason: true,
89
+ submitMethod: ({ reason }: { reason: string }) => ManifestTrafficService.disable(manifest, app, reason),
90
+ taskMonitorConfig: {
91
+ application: app,
92
+ title: `Disabling ${manifest.name}`,
93
+ onTaskComplete: () => app.getDataSource('serverGroups').refresh(),
94
+ },
95
+ });
96
+ };
97
+
98
+ const canEnable = () => ManifestTrafficService.canEnableServerGroup(serverGroup);
99
+
100
+ const enableServerGroup = (): void => {
101
+ ConfirmationModalService.confirm({
102
+ header: `Really enable ${manifest.name}?`,
103
+ buttonText: 'Enable',
104
+ askForReason: true,
105
+ submitJustWithReason: true,
106
+ submitMethod: ({ reason }: { reason: string }) => ManifestTrafficService.enable(manifest, app, reason),
107
+ taskMonitorConfig: {
108
+ application: app,
109
+ title: `Enabling ${manifest.name}`,
110
+ onTaskComplete: () => app.getDataSource('serverGroups').refresh(),
111
+ },
112
+ });
113
+ };
114
+
115
+ return (
116
+ <Dropdown className="dropdown" id="server-group-actions-dropdown">
117
+ <Dropdown.Toggle className="btn btn-sm btn-primary dropdown-toggle">
118
+ {robotToHuman(serverGroup.kind)} Actions
119
+ </Dropdown.Toggle>
120
+ <Dropdown.Menu>
121
+ {canEditServerGroup() && <MenuItem onClick={editServerGroup}>Edit</MenuItem>}
122
+ {canScaleServerGroup() && <MenuItem onClick={scaleServerGroup}>Scale</MenuItem>}
123
+ {canEnable() && <MenuItem onClick={enableServerGroup}>Enable</MenuItem>}
124
+ {canDisable() && <MenuItem onClick={disableServerGroup}>Disable</MenuItem>}
125
+ <MenuItem onClick={deleteServerGroup}>Delete</MenuItem>
126
+ {showEntityTags && (
127
+ <AddEntityTagLinks
128
+ component={serverGroup}
129
+ application={app}
130
+ entityType="serverGroup"
131
+ ownerOptions={entityTagTargets}
132
+ onUpdate={() => app.serverGroups.refresh()}
133
+ />
134
+ )}
135
+ </Dropdown.Menu>
136
+ </Dropdown>
137
+ );
138
+ }
@@ -0,0 +1,63 @@
1
+ import { isEmpty } from 'lodash';
2
+ import { Observable } from 'rxjs';
3
+
4
+ import type { IManifest, IServerGroupDetailsProps } from '@spinnaker/core';
5
+ import { ManifestReader, ServerGroupReader } from '@spinnaker/core';
6
+ import type { IKubernetesLoadBalancer, IKubernetesServerGroup, IKubernetesServerGroupView } from '../../interfaces';
7
+
8
+ function extractServerGroupSummary(props: IServerGroupDetailsProps): PromiseLike<IKubernetesServerGroup> {
9
+ const { app, serverGroup } = props;
10
+ return app.ready().then(() => {
11
+ let summary: IKubernetesServerGroup = app.serverGroups.data.find((toCheck: IKubernetesServerGroup) => {
12
+ return (
13
+ toCheck.name === serverGroup.name &&
14
+ toCheck.account === serverGroup.accountId &&
15
+ toCheck.region === serverGroup.region
16
+ );
17
+ });
18
+ if (!summary) {
19
+ app.loadBalancers.data.some((loadBalancer: IKubernetesLoadBalancer) => {
20
+ if (loadBalancer.account === serverGroup.accountId && loadBalancer.region === serverGroup.region) {
21
+ return loadBalancer.serverGroups.some((possibleServerGroup: IKubernetesServerGroup) => {
22
+ if (possibleServerGroup.name === serverGroup.name) {
23
+ summary = possibleServerGroup;
24
+ return true;
25
+ }
26
+ return false;
27
+ });
28
+ }
29
+ return false;
30
+ });
31
+ }
32
+ return summary;
33
+ });
34
+ }
35
+
36
+ export function kubernetesServerGroupDetailsGetter(
37
+ props: IServerGroupDetailsProps,
38
+ autoClose: () => void,
39
+ ): Observable<IKubernetesServerGroupView> {
40
+ const { app, serverGroup: serverGroupInfo } = props;
41
+ return new Observable<IKubernetesServerGroupView>((observer) => {
42
+ extractServerGroupSummary(props).then((summary) => {
43
+ Promise.all([
44
+ ServerGroupReader.getServerGroup(
45
+ app.name,
46
+ serverGroupInfo.accountId,
47
+ serverGroupInfo.region,
48
+ serverGroupInfo.name,
49
+ ),
50
+ ManifestReader.getManifest(serverGroupInfo.accountId, serverGroupInfo.region, serverGroupInfo.name),
51
+ ]).then(([serverGroup, manifest]: [IKubernetesServerGroupView, IManifest]) => {
52
+ // it's possible the summary was not found because the clusters are still loading
53
+ Object.assign(serverGroup, summary, { account: serverGroupInfo.accountId });
54
+ serverGroup.manifest = manifest;
55
+ if (!isEmpty(serverGroup)) {
56
+ observer.next(serverGroup);
57
+ } else {
58
+ autoClose();
59
+ }
60
+ }, autoClose);
61
+ }, autoClose);
62
+ });
63
+ }
@@ -0,0 +1,6 @@
1
+ import type { IServerGroupDetailsSectionProps } from '@spinnaker/core';
2
+ import type { IKubernetesServerGroupView } from '../../../interfaces';
3
+
4
+ export interface IKubernetesServerGroupDetailsSectionProps extends IServerGroupDetailsSectionProps {
5
+ serverGroup: IKubernetesServerGroupView;
6
+ }
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+
3
+ import type { IKubernetesServerGroupDetailsSectionProps } from './IKubernetesServerGroupDetailsSectionProps';
4
+ import { KubernetesReactInjector } from '../../../reactShims';
5
+
6
+ export function ServerGroupAnnotationCustomSection({ serverGroup }: IKubernetesServerGroupDetailsSectionProps) {
7
+ const { manifest } = serverGroup;
8
+ const { KubernetesAnnotationCustomSections } = KubernetesReactInjector;
9
+
10
+ return <KubernetesAnnotationCustomSections manifest={manifest.manifest} resource={serverGroup} />;
11
+ }
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+
3
+ import { CollapsibleSection } from '@spinnaker/core';
4
+ import type { IKubernetesServerGroupDetailsSectionProps } from './IKubernetesServerGroupDetailsSectionProps';
5
+ import { ManifestEvents } from '../../../pipelines/stages/deployManifest/manifestStatus/ManifestEvents';
6
+
7
+ export function ServerGroupEventsSection({ serverGroup }: IKubernetesServerGroupDetailsSectionProps) {
8
+ const { manifest } = serverGroup;
9
+ return (
10
+ <CollapsibleSection heading="Events" defaultExpanded={true}>
11
+ <ManifestEvents manifest={manifest} />
12
+ </CollapsibleSection>
13
+ );
14
+ }
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+
3
+ import { CollapsibleSection, HealthCounts } from '@spinnaker/core';
4
+ import type { IKubernetesServerGroupDetailsSectionProps } from './IKubernetesServerGroupDetailsSectionProps';
5
+
6
+ export function ServerGroupHealthSection({ serverGroup }: IKubernetesServerGroupDetailsSectionProps) {
7
+ return (
8
+ <CollapsibleSection heading="Health" defaultExpanded={true}>
9
+ {serverGroup && (
10
+ <dl className="dl-horizontal dl-narrow">
11
+ <dt>Instances</dt>
12
+ <dd>
13
+ <HealthCounts container={serverGroup.instanceCounts} className="pull-left" />
14
+ </dd>
15
+ </dl>
16
+ )}
17
+ </CollapsibleSection>
18
+ );
19
+ }
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+
3
+ import { CollapsibleSection } from '@spinnaker/core';
4
+ import type { IKubernetesServerGroupDetailsSectionProps } from './IKubernetesServerGroupDetailsSectionProps';
5
+ import { ManifestImageDetails } from '../../../manifest/ManifestImageDetails';
6
+
7
+ export function ServerGroupImagesSection({ serverGroup }: IKubernetesServerGroupDetailsSectionProps) {
8
+ const { manifest } = serverGroup;
9
+ return (
10
+ <CollapsibleSection heading="Images" defaultExpanded={true}>
11
+ <ManifestImageDetails manifest={manifest.manifest} />
12
+ </CollapsibleSection>
13
+ );
14
+ }
@@ -0,0 +1,46 @@
1
+ import { UISref } from '@uirouter/react';
2
+
3
+ import React from 'react';
4
+ import { AccountTag, CollapsibleSection, robotToHuman, timestamp } from '@spinnaker/core';
5
+ import type { IKubernetesServerGroupDetailsSectionProps } from './IKubernetesServerGroupDetailsSectionProps';
6
+ import { useManifest } from '../useManifest';
7
+
8
+ export function ServerGroupInformationSection({ serverGroup }: IKubernetesServerGroupDetailsSectionProps) {
9
+ const { manifest } = serverGroup;
10
+ const { manifestController } = useManifest({ manifest });
11
+
12
+ return (
13
+ <CollapsibleSection heading="Information" defaultExpanded={true}>
14
+ <dl className="dl-horizontal dl-narrow">
15
+ <dt>Created</dt>
16
+ <dd>{timestamp(serverGroup.createdTime)}</dd>
17
+ <dt>Account</dt>
18
+ <dd>
19
+ <AccountTag account={serverGroup.account} />
20
+ </dd>
21
+ <dt>Namespace</dt>
22
+ <dd>{serverGroup.namespace}</dd>
23
+ <dt>Kind</dt>
24
+ <dd>{serverGroup.kind}</dd>
25
+ {manifestController && (
26
+ <>
27
+ <dt>Controller</dt>
28
+ <UISref
29
+ to="^.serverGroupManager"
30
+ params={{
31
+ accountId: serverGroup.account,
32
+ region: serverGroup.region,
33
+ serverGroupManager: manifestController,
34
+ provider: 'kubernetes',
35
+ }}
36
+ >
37
+ <a>
38
+ <dd>{robotToHuman(manifestController)}</dd>
39
+ </a>
40
+ </UISref>
41
+ </>
42
+ )}
43
+ </dl>
44
+ </CollapsibleSection>
45
+ );
46
+ }
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+
3
+ import { CollapsibleSection } from '@spinnaker/core';
4
+ import type { IKubernetesServerGroupDetailsSectionProps } from './IKubernetesServerGroupDetailsSectionProps';
5
+ import { ManifestLabels } from '../../../manifest/ManifestLabels';
6
+
7
+ export function ServerGroupLabelsSection({ serverGroup }: IKubernetesServerGroupDetailsSectionProps) {
8
+ const { manifest } = serverGroup;
9
+ return (
10
+ <CollapsibleSection heading="Labels" defaultExpanded={true}>
11
+ <ManifestLabels manifest={manifest.manifest} />
12
+ </CollapsibleSection>
13
+ );
14
+ }
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+
3
+ import type { IKubernetesServerGroupDetailsSectionProps } from './IKubernetesServerGroupDetailsSectionProps';
4
+ import { ManifestStatus } from '../../../manifest/status/ManifestStatus';
5
+
6
+ export function ServerGroupManifestStatusSection({ serverGroup }: IKubernetesServerGroupDetailsSectionProps) {
7
+ const { manifest } = serverGroup;
8
+ return <ManifestStatus status={manifest.status} />;
9
+ }
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+
3
+ import { CollapsibleSection } from '@spinnaker/core';
4
+ import type { IKubernetesServerGroupDetailsSectionProps } from './IKubernetesServerGroupDetailsSectionProps';
5
+
6
+ export function ServerGroupSizeSection({ serverGroup }: IKubernetesServerGroupDetailsSectionProps) {
7
+ return (
8
+ <CollapsibleSection heading="Size" defaultExpanded={true}>
9
+ {serverGroup.capacity.min == null && (
10
+ <dl className="dl-horizontal dl-narrow">
11
+ <dt>Current</dt>
12
+ <dd>{serverGroup.instances.length}</dd>
13
+ </dl>
14
+ )}
15
+ {serverGroup.capacity.min != null && serverGroup.capacity.min === serverGroup.capacity.max && (
16
+ <dl className="dl-horizontal dl-narrow">
17
+ <dt>Min/Max</dt>
18
+ <dd>{serverGroup.capacity.min}</dd>
19
+ <dt>Current</dt>
20
+ <dd>{serverGroup.instances.length}</dd>
21
+ </dl>
22
+ )}
23
+ {serverGroup.capacity.min !== serverGroup.capacity.max && (
24
+ <dl className="dl-horizontal dl-narrow">
25
+ <dt>Min</dt>
26
+ <dd>{serverGroup.capacity.min}</dd>
27
+ <dt>Max</dt>
28
+ <dd>{serverGroup.capacity.max}</dd>
29
+ <dt>Current</dt>
30
+ <dd>{serverGroup.instances.length}</dd>
31
+ </dl>
32
+ )}
33
+ </CollapsibleSection>
34
+ );
35
+ }
@@ -0,0 +1,9 @@
1
+ export * from './IKubernetesServerGroupDetailsSectionProps';
2
+ export * from './ServerGroupAnnotationCustomSection';
3
+ export * from './ServerGroupEventsSection';
4
+ export * from './ServerGroupHealthSection';
5
+ export * from './ServerGroupImagesSection';
6
+ export * from './ServerGroupInformationSection';
7
+ export * from './ServerGroupLabelsSection';
8
+ export * from './ServerGroupManifestStatusSection';
9
+ export * from './ServerGroupSizeSection';
@@ -0,0 +1,42 @@
1
+ import type { IManifest } from '@spinnaker/core';
2
+
3
+ interface IUseManifestProps {
4
+ manifest: IManifest;
5
+ }
6
+
7
+ export function useManifest({ manifest }: IUseManifestProps) {
8
+ const ownerReferences = (): any[] => {
9
+ const manifestRaw = manifest.manifest;
10
+ if (
11
+ manifestRaw != null &&
12
+ manifestRaw.hasOwnProperty('metadata') &&
13
+ manifestRaw.metadata.hasOwnProperty('ownerReferences') &&
14
+ Array.isArray(manifestRaw.metadata.ownerReferences)
15
+ ) {
16
+ return manifestRaw.metadata.ownerReferences;
17
+ } else {
18
+ return [] as any[];
19
+ }
20
+ };
21
+
22
+ const ownerIsController = (ownerReference: any): boolean => {
23
+ return ownerReference.hasOwnProperty('controller') && ownerReference.controller === true;
24
+ };
25
+
26
+ const lowerCaseFirstLetter = (s: string): string => {
27
+ return s.charAt(0).toLowerCase() + s.slice(1);
28
+ };
29
+
30
+ const manifestController = (): string | null => {
31
+ const controller = ownerReferences().find(ownerIsController);
32
+ if (typeof controller === 'undefined') {
33
+ return null;
34
+ } else {
35
+ return lowerCaseFirstLetter(controller.kind) + ' ' + controller.name;
36
+ }
37
+ };
38
+
39
+ return {
40
+ manifestController: manifestController(),
41
+ };
42
+ }
@@ -1,4 +1,3 @@
1
- export * from './serverGroupCommandBuilder.service';
2
- export * from './serverGroupTransformer.service';
3
- export * from './details/details.controller';
4
- export * from './details/resize/resize.controller';
1
+ export * from './details/sections';
2
+ export * from './serverGroupCommandBuilder';
3
+ export * from './serverGroupTransformer';
@@ -1,5 +1,3 @@
1
- import { module } from 'angular';
2
-
3
1
  import type { Application } from '@spinnaker/core';
4
2
  import type { IKubernetesManifestCommandData } from '../manifest/manifestCommandBuilder.service';
5
3
  import { KubernetesManifestCommandBuilder } from '../manifest/manifestCommandBuilder.service';
@@ -9,10 +7,3 @@ export class KubernetesV2ServerGroupCommandBuilder {
9
7
  return KubernetesManifestCommandBuilder.buildNewManifestCommand(app);
10
8
  }
11
9
  }
12
-
13
- export const KUBERNETES_SERVER_GROUP_COMMAND_BUILDER = 'spinnaker.kubernetes.serverGroup.commandBuilder.service';
14
-
15
- module(KUBERNETES_SERVER_GROUP_COMMAND_BUILDER, []).service(
16
- 'kubernetesV2ServerGroupCommandBuilder',
17
- KubernetesV2ServerGroupCommandBuilder,
18
- );
@@ -1,7 +1,7 @@
1
1
  import { Application } from '@spinnaker/core';
2
2
 
3
3
  import type { IKubernetesServerGroup } from '../interfaces';
4
- import { KubernetesV2ServerGroupTransformer } from './serverGroupTransformer.service';
4
+ import { KubernetesV2ServerGroupTransformer } from './serverGroupTransformer';
5
5
 
6
6
  describe('KubernetesV2ServerGroupTransformer', function () {
7
7
  it('normalizes server group name', async () => {
@@ -1,4 +1,3 @@
1
- import { module } from 'angular';
2
1
  import type { Application } from '@spinnaker/core';
3
2
  import type { IKubernetesServerGroup, IKubernetesServerGroupManager } from '../interfaces';
4
3
 
@@ -26,9 +25,3 @@ export class KubernetesV2ServerGroupTransformer {
26
25
  });
27
26
  }
28
27
  }
29
-
30
- export const KUBERNETES_SERVER_GROUP_TRANSFORMER = 'spinnaker.kubernetes.serverGroup.transformer.service';
31
- module(KUBERNETES_SERVER_GROUP_TRANSFORMER, []).service(
32
- 'kubernetesV2ServerGroupTransformer',
33
- KubernetesV2ServerGroupTransformer,
34
- );