@spinnaker/kubernetes 2026.2.2 → 2026.3.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.
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/instance/details/KubernetesInstanceDetails.d.ts +54 -0
- package/dist/instance/details/kubernetesInstanceDetails.utils.d.ts +13 -0
- package/dist/instance/index.d.ts +1 -1
- package/dist/kubernetes.module.d.ts +5 -1
- package/dist/loadBalancer/transformer.d.ts +1 -1
- package/dist/manifest/AnnotationCustomSections.d.ts +3 -2
- package/dist/manifest/ManifestKindSearch.d.ts +1 -1
- package/dist/manifest/delete/Delete.d.ts +0 -1
- package/dist/manifest/delete/DeleteModal.d.ts +1 -1
- package/dist/manifest/delete/delete.types.d.ts +4 -0
- package/dist/manifest/index.d.ts +3 -6
- package/dist/manifest/manifest.service.d.ts +5 -0
- package/dist/manifest/manifestCommandBuilder.service.d.ts +1 -1
- package/dist/manifest/rollout/PauseRollout.d.ts +0 -1
- package/dist/manifest/rollout/ResumeRollout.d.ts +0 -1
- package/dist/manifest/rollout/RollingRestart.d.ts +4 -4
- package/dist/manifest/rollout/UndoRollout.d.ts +0 -1
- package/dist/manifest/scale/Scale.d.ts +1 -2
- package/dist/manifest/scale/ScaleModal.d.ts +3 -3
- package/dist/manifest/scale/ScaleSettingsForm.d.ts +7 -1
- package/dist/manifest/selector/ManifestSelector.d.ts +1 -1
- package/dist/manifest/traffic/ManifestTrafficService.d.ts +2 -2
- package/dist/pipelines/stages/deleteManifest/DeleteManifestOptionsForm.d.ts +1 -1
- package/dist/pipelines/stages/deployManifest/manifestStatus/DeployStatus.d.ts +1 -0
- package/dist/pipelines/stages/deployManifest/manifestStatus/ManifestDetailsLink.d.ts +6 -3
- package/dist/pipelines/stages/traffic/disableManifest.stage.d.ts +2 -1
- package/dist/pipelines/stages/traffic/enableManifest.stage.d.ts +2 -1
- package/dist/rawResource/index.d.ts +3 -1
- package/dist/rawResource/rawResource.dataSource.d.ts +1 -1
- package/dist/rawResource/rawResource.states.d.ts +4 -1
- package/dist/resources/resources.state.d.ts +2 -1
- package/dist/securityGroup/details/KubernetesSecurityGroupDetails.d.ts +49 -0
- package/dist/securityGroup/index.d.ts +3 -1
- package/dist/securityGroup/transformer.d.ts +4 -1
- package/dist/serverGroup/serverGroupCommandBuilder.d.ts +1 -1
- package/dist/serverGroup/serverGroupTransformer.d.ts +1 -1
- package/dist/serverGroupManager/details/ServerGroupManagerDetails.d.ts +7 -3
- package/package.json +3 -12
- package/src/help/kubernetes.help.ts +2 -0
- package/src/index.ts +2 -2
- package/src/instance/details/KubernetesInstanceDetails.spec.tsx +451 -0
- package/src/instance/details/KubernetesInstanceDetails.tsx +342 -0
- package/src/instance/details/kubernetesInstanceDetails.utils.ts +77 -0
- package/src/instance/index.ts +1 -1
- package/src/kubernetes.module.spec.ts +25 -0
- package/src/kubernetes.module.ts +23 -87
- package/src/loadBalancer/details/KubernetesLoadBalancerActions.tsx +30 -35
- package/src/loadBalancer/details/sections/LoadBalancerAnnotationCustomSection.tsx +2 -3
- package/src/loadBalancer/transformer.ts +1 -1
- package/src/manifest/AnnotationCustomSections.spec.tsx +178 -0
- package/src/manifest/AnnotationCustomSections.tsx +179 -2
- package/src/manifest/ManifestKindSearch.tsx +1 -1
- package/src/manifest/delete/Delete.tsx +0 -9
- package/src/manifest/delete/DeleteModal.tsx +69 -72
- package/src/manifest/delete/delete.types.ts +4 -0
- package/src/manifest/index.ts +3 -6
- package/src/manifest/manifest.service.ts +18 -1
- package/src/manifest/manifestCommandBuilder.service.spec.ts +41 -0
- package/src/manifest/manifestCommandBuilder.service.ts +45 -59
- package/src/manifest/rollout/PauseRollout.tsx +1 -9
- package/src/manifest/rollout/ResumeRollout.tsx +2 -10
- package/src/manifest/rollout/RollingRestart.tsx +16 -22
- package/src/manifest/rollout/UndoRollout.tsx +1 -10
- package/src/manifest/rollout/UndoRolloutModal.tsx +5 -1
- package/src/manifest/scale/Scale.tsx +12 -11
- package/src/manifest/scale/ScaleModal.tsx +43 -31
- package/src/manifest/scale/ScaleSettingsForm.tsx +8 -1
- package/src/manifest/selector/ManifestSelector.spec.tsx +89 -46
- package/src/manifest/selector/ManifestSelector.tsx +4 -5
- package/src/manifest/traffic/ManifestTrafficService.ts +2 -2
- package/src/manifest/wizard/ManifestWizard.tsx +1 -1
- package/src/pipelines/stages/deleteManifest/DeleteManifestOptionsForm.tsx +1 -1
- package/src/pipelines/stages/deleteManifest/DeleteManifestStageConfig.tsx +1 -1
- package/src/pipelines/stages/deployManifest/DeployManifestStageForm.tsx +16 -0
- package/src/pipelines/stages/deployManifest/ManifestCopier.spec.ts +52 -77
- package/src/pipelines/stages/deployManifest/ManifestDeploymentOptions.spec.tsx +2 -0
- package/src/pipelines/stages/deployManifest/manifestStatus/DeployStatus.tsx +39 -4
- package/src/pipelines/stages/deployManifest/manifestStatus/ManifestDetailsLink.spec.tsx +35 -0
- package/src/pipelines/stages/deployManifest/manifestStatus/ManifestDetailsLink.tsx +10 -5
- package/src/pipelines/stages/traffic/ManifestTrafficStageRegistration.spec.ts +34 -0
- package/src/pipelines/stages/traffic/disableManifest.stage.ts +17 -19
- package/src/pipelines/stages/traffic/enableManifest.stage.ts +17 -19
- package/src/rawResource/index.ts +18 -1
- package/src/rawResource/rawResource.dataSource.ts +5 -8
- package/src/rawResource/rawResource.states.ts +50 -51
- package/src/resources/resources.state.spec.ts +138 -0
- package/src/resources/resources.state.ts +30 -35
- package/src/securityGroup/details/KubernetesSecurityGroupDetails.spec.tsx +292 -0
- package/src/securityGroup/details/KubernetesSecurityGroupDetails.tsx +304 -0
- package/src/securityGroup/index.ts +3 -1
- package/src/securityGroup/transformer.ts +2 -10
- package/src/serverGroup/details/KubernetesServerGroupActions.tsx +31 -61
- package/src/serverGroup/details/kubernetesServerGroupDetailsGetter.ts +1 -1
- package/src/serverGroup/details/sections/ServerGroupAnnotationCustomSection.tsx +2 -3
- package/src/serverGroup/serverGroupCommandBuilder.ts +1 -1
- package/src/serverGroup/serverGroupTransformer.ts +1 -1
- package/src/serverGroupManager/details/ServerGroupManagerActions.tsx +48 -128
- package/src/serverGroupManager/details/ServerGroupManagerDetails.spec.ts +12 -0
- package/src/serverGroupManager/details/ServerGroupManagerDetails.tsx +19 -8
- package/src/serverGroupManager/details/sections/ServerGroupManagerAnnotationCustomSection.tsx +2 -3
- package/src/serverGroupManager/details/useKubernetesServerGroupManagerDetails.spec.tsx +112 -0
- package/src/serverGroupManager/details/useKubernetesServerGroupManagerDetails.tsx +50 -29
- package/dist/instance/details/details.controller.d.ts +0 -1
- package/dist/manifest/annotationCustomSections.component.d.ts +0 -3
- package/dist/manifest/delete/delete.controller.d.ts +0 -12
- package/dist/manifest/delete/deleteOptionsForm.component.d.ts +0 -1
- package/dist/manifest/editor/json/jsonEditor.component.d.ts +0 -1
- package/dist/manifest/manifestEvents.component.d.ts +0 -1
- package/dist/manifest/manifestImageDetails.component.d.ts +0 -1
- package/dist/manifest/manifestLabels.component.d.ts +0 -1
- package/dist/manifest/manifestQos.component.d.ts +0 -1
- package/dist/manifest/manifestResources.component.d.ts +0 -1
- package/dist/manifest/rollout/pause.controller.d.ts +0 -1
- package/dist/manifest/rollout/resume.controller.d.ts +0 -1
- package/dist/manifest/rollout/undo.controller.d.ts +0 -5
- package/dist/manifest/scale/scale.controller.d.ts +0 -8
- package/dist/manifest/scale/scaleSettingsForm.component.d.ts +0 -1
- package/dist/manifest/selector/selector.component.d.ts +0 -1
- package/dist/manifest/status/condition.component.d.ts +0 -1
- package/dist/manifest/status/status.component.d.ts +0 -1
- package/dist/rawResource/rawResource.module.d.ts +0 -1
- package/dist/reactShims/index.d.ts +0 -1
- package/dist/reactShims/kubernetes.react.injector.d.ts +0 -11
- package/dist/reactShims/kubernetes.react.module.d.ts +0 -1
- package/dist/securityGroup/details/details.controller.d.ts +0 -1
- package/src/instance/details/details.controller.ts +0 -186
- package/src/instance/details/details.html +0 -80
- package/src/manifest/annotationCustomSections.component.ts +0 -114
- package/src/manifest/delete/delete.controller.ts +0 -80
- package/src/manifest/delete/delete.html +0 -42
- package/src/manifest/delete/deleteOptionsForm.component.ts +0 -52
- package/src/manifest/editor/json/jsonEditor.component.ts +0 -12
- package/src/manifest/manifestEvents.component.ts +0 -12
- package/src/manifest/manifestImageDetails.component.ts +0 -12
- package/src/manifest/manifestLabels.component.ts +0 -12
- package/src/manifest/manifestQos.component.ts +0 -12
- package/src/manifest/manifestResources.component.ts +0 -12
- package/src/manifest/rollout/pause.controller.ts +0 -66
- package/src/manifest/rollout/pause.html +0 -28
- package/src/manifest/rollout/resume.controller.ts +0 -66
- package/src/manifest/rollout/resume.html +0 -28
- package/src/manifest/rollout/undo.controller.ts +0 -74
- package/src/manifest/rollout/undo.html +0 -44
- package/src/manifest/scale/scale.controller.ts +0 -75
- package/src/manifest/scale/scale.html +0 -32
- package/src/manifest/scale/scaleSettingsForm.component.ts +0 -11
- package/src/manifest/selector/selector.component.ts +0 -17
- package/src/manifest/status/condition.component.ts +0 -12
- package/src/manifest/status/status.component.ts +0 -11
- package/src/rawResource/rawResource.module.ts +0 -8
- package/src/reactShims/index.ts +0 -1
- package/src/reactShims/kubernetes.react.injector.ts +0 -30
- package/src/reactShims/kubernetes.react.module.ts +0 -12
- package/src/securityGroup/details/details.controller.ts +0 -118
- package/src/securityGroup/details/details.html +0 -91
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { load } from 'js-yaml';
|
|
2
2
|
import { cloneDeep, has } from 'lodash';
|
|
3
|
-
import { $q } from 'ngimport';
|
|
4
3
|
|
|
5
4
|
import type { Application, IAccountDetails, IArtifactAccount, IMoniker } from '@spinnaker/core';
|
|
6
5
|
import { AccountService } from '@spinnaker/core';
|
|
@@ -60,67 +59,54 @@ export class KubernetesManifestCommandBuilder {
|
|
|
60
59
|
sourceManifest?: any,
|
|
61
60
|
sourceMoniker?: IMoniker,
|
|
62
61
|
sourceAccount?: string,
|
|
63
|
-
):
|
|
62
|
+
): Promise<IKubernetesManifestCommandData> {
|
|
64
63
|
if (sourceManifest != null && has(sourceManifest, ['metadata', 'annotations', LAST_APPLIED_CONFIGURATION])) {
|
|
65
64
|
sourceManifest = load(sourceManifest.metadata.annotations[LAST_APPLIED_CONFIGURATION]);
|
|
66
65
|
}
|
|
67
66
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
: null,
|
|
113
|
-
relationships,
|
|
114
|
-
moniker,
|
|
115
|
-
account,
|
|
116
|
-
versioned,
|
|
117
|
-
manifestArtifactAccount,
|
|
118
|
-
source: ManifestSource.TEXT,
|
|
119
|
-
},
|
|
120
|
-
metadata: {
|
|
121
|
-
backingData,
|
|
122
|
-
},
|
|
123
|
-
} as IKubernetesManifestCommandData;
|
|
124
|
-
});
|
|
67
|
+
return Promise.all([
|
|
68
|
+
AccountService.getAllAccountDetailsForProvider('kubernetes'),
|
|
69
|
+
AccountService.getArtifactAccounts(),
|
|
70
|
+
]).then(([accounts, artifactAccounts]: [IAccountDetails[], IArtifactAccount[]]) => {
|
|
71
|
+
const backingData = { accounts, artifactAccounts };
|
|
72
|
+
|
|
73
|
+
const sourceAccountDetails = accounts.find((a) => a.name === sourceAccount);
|
|
74
|
+
const account = sourceAccountDetails ? sourceAccountDetails.name : accounts.length ? accounts[0].name : null;
|
|
75
|
+
|
|
76
|
+
let manifestArtifactAccount: string = null;
|
|
77
|
+
const [artifactAccountData] = artifactAccounts;
|
|
78
|
+
if (artifactAccountData) {
|
|
79
|
+
manifestArtifactAccount = artifactAccountData.name;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const cloudProvider = 'kubernetes';
|
|
83
|
+
const moniker = sourceMoniker || {
|
|
84
|
+
app: app.name,
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const relationships = {
|
|
88
|
+
loadBalancers: [] as string[],
|
|
89
|
+
securityGroups: [] as string[],
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const versioned: any = null;
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
command: {
|
|
96
|
+
cloudProvider,
|
|
97
|
+
manifest: null,
|
|
98
|
+
manifests: Array.isArray(sourceManifest) ? sourceManifest : sourceManifest != null ? [sourceManifest] : null,
|
|
99
|
+
relationships,
|
|
100
|
+
moniker,
|
|
101
|
+
account,
|
|
102
|
+
versioned,
|
|
103
|
+
manifestArtifactAccount,
|
|
104
|
+
source: ManifestSource.TEXT,
|
|
105
|
+
},
|
|
106
|
+
metadata: {
|
|
107
|
+
backingData,
|
|
108
|
+
},
|
|
109
|
+
} as IKubernetesManifestCommandData;
|
|
110
|
+
});
|
|
125
111
|
}
|
|
126
112
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { module } from 'angular';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { MenuItem } from 'react-bootstrap';
|
|
4
|
-
import { react2angular } from 'react2angular';
|
|
5
3
|
|
|
6
4
|
import type { Application } from '@spinnaker/core';
|
|
7
|
-
import { ConfirmationModalService, ManifestWriter, robotToHuman
|
|
5
|
+
import { ConfirmationModalService, ManifestWriter, robotToHuman } from '@spinnaker/core';
|
|
8
6
|
|
|
9
7
|
import type { IAnyKubernetesResource } from '../../interfaces';
|
|
10
8
|
|
|
@@ -38,9 +36,3 @@ export function PauseRollout({ application, resource }: IPauseRolloutProps) {
|
|
|
38
36
|
};
|
|
39
37
|
return <MenuItem onClick={handleClick}>Pause Rollout</MenuItem>;
|
|
40
38
|
}
|
|
41
|
-
|
|
42
|
-
export const KUBERNETES_PAUSE_ROLLOUT = 'spinnaker.kubernetes.pause.rollout';
|
|
43
|
-
module(KUBERNETES_PAUSE_ROLLOUT, []).component(
|
|
44
|
-
'kubernetesPauseRollout',
|
|
45
|
-
react2angular(withErrorBoundary(PauseRollout, 'kubernetesPauseRollout'), ['application', 'resource']),
|
|
46
|
-
);
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { module } from 'angular';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { MenuItem } from 'react-bootstrap';
|
|
4
|
-
import { react2angular } from 'react2angular';
|
|
5
3
|
|
|
6
4
|
import type { Application } from '@spinnaker/core';
|
|
7
|
-
import { ConfirmationModalService, ManifestWriter, robotToHuman
|
|
5
|
+
import { ConfirmationModalService, ManifestWriter, robotToHuman } from '@spinnaker/core';
|
|
8
6
|
|
|
9
7
|
import type { IAnyKubernetesResource } from '../../interfaces';
|
|
10
8
|
|
|
@@ -27,7 +25,7 @@ export function ResumeRollout({ application, resource }: IResumeRolloutProps) {
|
|
|
27
25
|
account: resource.account,
|
|
28
26
|
reason: params.reason,
|
|
29
27
|
};
|
|
30
|
-
return ManifestWriter.
|
|
28
|
+
return ManifestWriter.resumeRolloutManifest(payload, application);
|
|
31
29
|
},
|
|
32
30
|
taskMonitorConfig: {
|
|
33
31
|
application,
|
|
@@ -38,9 +36,3 @@ export function ResumeRollout({ application, resource }: IResumeRolloutProps) {
|
|
|
38
36
|
};
|
|
39
37
|
return <MenuItem onClick={handleClick}>Resume Rollout</MenuItem>;
|
|
40
38
|
}
|
|
41
|
-
|
|
42
|
-
export const KUBERNETES_RESUME_ROLLOUT = 'spinnaker.kubernetes.resume.rollout';
|
|
43
|
-
module(KUBERNETES_RESUME_ROLLOUT, []).component(
|
|
44
|
-
'kubernetesResumeRollout',
|
|
45
|
-
react2angular(withErrorBoundary(ResumeRollout, 'kubernetesResumeRollout'), ['application', 'resource']),
|
|
46
|
-
);
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { module } from 'angular';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { MenuItem } from 'react-bootstrap';
|
|
4
|
-
import { react2angular } from 'react2angular';
|
|
5
3
|
|
|
6
4
|
import type { Application } from '@spinnaker/core';
|
|
7
|
-
import { ConfirmationModalService, ManifestWriter
|
|
5
|
+
import { ConfirmationModalService, ManifestWriter } from '@spinnaker/core';
|
|
8
6
|
|
|
9
|
-
import type { IKubernetesServerGroupManager } from '../../interfaces';
|
|
7
|
+
import type { IKubernetesServerGroup, IKubernetesServerGroupManager } from '../../interfaces';
|
|
10
8
|
|
|
11
9
|
interface IRollingRestartProps {
|
|
12
10
|
application: Application;
|
|
13
|
-
serverGroupManager
|
|
11
|
+
serverGroupManager?: IKubernetesServerGroupManager;
|
|
12
|
+
serverGroup?: IKubernetesServerGroup;
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
interface IRollingRestartParameters {
|
|
@@ -21,34 +20,29 @@ interface IRollingRestartParameters {
|
|
|
21
20
|
reason?: string;
|
|
22
21
|
}
|
|
23
22
|
|
|
24
|
-
export function RollingRestart({ application, serverGroupManager }: IRollingRestartProps) {
|
|
23
|
+
export function RollingRestart({ application, serverGroupManager, serverGroup }: IRollingRestartProps) {
|
|
25
24
|
function rollingRestart() {
|
|
25
|
+
const rollingRestartParameters: IRollingRestartParameters = {
|
|
26
|
+
account: serverGroupManager?.account || serverGroup?.account,
|
|
27
|
+
cloudProvider: 'kubernetes',
|
|
28
|
+
location: serverGroupManager?.namespace || serverGroup?.namespace,
|
|
29
|
+
manifestName: serverGroupManager?.name || serverGroup?.name,
|
|
30
|
+
};
|
|
31
|
+
|
|
26
32
|
ConfirmationModalService.confirm({
|
|
27
|
-
account:
|
|
33
|
+
account: rollingRestartParameters.account,
|
|
28
34
|
askForReason: true,
|
|
29
|
-
header: `Initiate rolling restart of ${
|
|
35
|
+
header: `Initiate rolling restart of ${rollingRestartParameters.manifestName}`,
|
|
30
36
|
submitMethod: (params: { reason?: string }) => {
|
|
31
|
-
|
|
32
|
-
account: serverGroupManager.account,
|
|
33
|
-
cloudProvider: 'kubernetes',
|
|
34
|
-
location: serverGroupManager.namespace,
|
|
35
|
-
manifestName: serverGroupManager.name,
|
|
36
|
-
reason: params.reason,
|
|
37
|
-
};
|
|
37
|
+
rollingRestartParameters.reason = params.reason;
|
|
38
38
|
return ManifestWriter.rollingRestartManifest(rollingRestartParameters, application);
|
|
39
39
|
},
|
|
40
40
|
taskMonitorConfig: {
|
|
41
41
|
application,
|
|
42
|
-
title: `Rolling restart of ${
|
|
42
|
+
title: `Rolling restart of ${rollingRestartParameters.manifestName} in ${rollingRestartParameters.account}`,
|
|
43
43
|
onTaskComplete: () => application.serverGroups.refresh(true),
|
|
44
44
|
},
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
return <MenuItem onClick={rollingRestart}>Rolling Restart</MenuItem>;
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
export const KUBERNETES_ROLLING_RESTART = 'spinnaker.kubernetes.v2.rolling.restart';
|
|
51
|
-
module(KUBERNETES_ROLLING_RESTART, []).component(
|
|
52
|
-
'kubernetesRollingRestart',
|
|
53
|
-
react2angular(withErrorBoundary(RollingRestart, 'kubernetesRollingRestart'), ['application', 'serverGroupManager']),
|
|
54
|
-
);
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { module } from 'angular';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { MenuItem } from 'react-bootstrap';
|
|
4
|
-
import { react2angular } from 'react2angular';
|
|
5
3
|
|
|
6
4
|
import type { Application } from '@spinnaker/core';
|
|
7
|
-
import { withErrorBoundary } from '@spinnaker/core';
|
|
8
5
|
import { useModal } from '@spinnaker/core';
|
|
9
6
|
|
|
10
7
|
import { UndoRolloutModal } from './UndoRolloutModal';
|
|
@@ -20,14 +17,8 @@ export function UndoRollout(props: IUndoRolloutProps) {
|
|
|
20
17
|
const handleClick = () => show();
|
|
21
18
|
return (
|
|
22
19
|
<>
|
|
23
|
-
<MenuItem onClick={handleClick}>Undo
|
|
20
|
+
<MenuItem onClick={handleClick}>Undo Rollout</MenuItem>
|
|
24
21
|
<UndoRolloutModal isOpen={open} dismissModal={close} {...props} />
|
|
25
22
|
</>
|
|
26
23
|
);
|
|
27
24
|
}
|
|
28
|
-
|
|
29
|
-
export const KUBERNETES_UNDO_ROLLOUT = 'spinnaker.kubernetes.undo.rollout';
|
|
30
|
-
module(KUBERNETES_UNDO_ROLLOUT, []).component(
|
|
31
|
-
'kubernetesUndoRollout',
|
|
32
|
-
react2angular(withErrorBoundary(UndoRollout, 'kubernetesUndoRollout'), ['application', 'resource']),
|
|
33
|
-
);
|
|
@@ -20,7 +20,11 @@ import {
|
|
|
20
20
|
} from '@spinnaker/core';
|
|
21
21
|
|
|
22
22
|
import type { IAnyKubernetesResource } from '../../interfaces';
|
|
23
|
-
|
|
23
|
+
|
|
24
|
+
interface IRolloutRevision {
|
|
25
|
+
label: string;
|
|
26
|
+
revision: number;
|
|
27
|
+
}
|
|
24
28
|
|
|
25
29
|
export interface IKubernetesUndoRolloutModalProps
|
|
26
30
|
extends Pick<IModalProps, 'isOpen'>,
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { module } from 'angular';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { MenuItem } from 'react-bootstrap';
|
|
4
|
-
import { react2angular } from 'react2angular';
|
|
5
3
|
|
|
6
4
|
import type { Application } from '@spinnaker/core';
|
|
7
|
-
import { withErrorBoundary } from '@spinnaker/core';
|
|
8
5
|
import { useModal } from '@spinnaker/core';
|
|
9
6
|
|
|
10
7
|
import { ScaleModal } from './ScaleModal';
|
|
@@ -16,19 +13,23 @@ export interface IScaleProps {
|
|
|
16
13
|
currentReplicas: number;
|
|
17
14
|
}
|
|
18
15
|
|
|
19
|
-
export function Scale(
|
|
16
|
+
export function Scale({ application, resource, currentReplicas }: IScaleProps) {
|
|
20
17
|
const { open, show, close } = useModal();
|
|
21
18
|
const handleClick = () => show();
|
|
22
19
|
return (
|
|
23
20
|
<>
|
|
24
21
|
<MenuItem onClick={handleClick}>Scale</MenuItem>
|
|
25
|
-
<ScaleModal
|
|
22
|
+
<ScaleModal
|
|
23
|
+
isOpen={open}
|
|
24
|
+
dismissModal={close}
|
|
25
|
+
application={application}
|
|
26
|
+
coordinates={{
|
|
27
|
+
name: resource.name,
|
|
28
|
+
namespace: resource.namespace,
|
|
29
|
+
account: resource.account,
|
|
30
|
+
}}
|
|
31
|
+
currentReplicas={currentReplicas}
|
|
32
|
+
/>
|
|
26
33
|
</>
|
|
27
34
|
);
|
|
28
35
|
}
|
|
29
|
-
|
|
30
|
-
export const KUBERNETES_SCALE = 'spinnaker.kubernetes.scale';
|
|
31
|
-
module(KUBERNETES_SCALE, []).component(
|
|
32
|
-
'kubernetesScale',
|
|
33
|
-
react2angular(withErrorBoundary(Scale, 'kubernetesScale'), ['application', 'resource', 'currentReplicas']),
|
|
34
|
-
);
|
|
@@ -1,30 +1,28 @@
|
|
|
1
1
|
import type { FormikProps } from 'formik';
|
|
2
2
|
import { Form } from 'formik';
|
|
3
|
-
import React
|
|
3
|
+
import React from 'react';
|
|
4
4
|
import { Button, Modal } from 'react-bootstrap';
|
|
5
5
|
|
|
6
6
|
import type { Application, IModalComponentProps, IModalProps } from '@spinnaker/core';
|
|
7
7
|
import {
|
|
8
|
+
ConfirmationModalService,
|
|
8
9
|
ManifestWriter,
|
|
9
10
|
ModalClose,
|
|
10
11
|
robotToHuman,
|
|
11
12
|
SpinFormik,
|
|
12
13
|
SubmitButton,
|
|
13
|
-
TaskMonitorWrapper,
|
|
14
14
|
TaskReason,
|
|
15
|
-
UserVerification,
|
|
16
|
-
useTaskMonitor,
|
|
17
15
|
} from '@spinnaker/core';
|
|
18
16
|
|
|
17
|
+
import type { IManifestCoordinates } from '../IManifestCoordinates';
|
|
18
|
+
import type { IScaleCommand } from './ScaleSettingsForm';
|
|
19
19
|
import { ScaleSettingsForm } from './ScaleSettingsForm';
|
|
20
|
-
import type { IAnyKubernetesResource } from '../../interfaces';
|
|
21
|
-
import type { IScaleCommand } from './scale.controller';
|
|
22
20
|
|
|
23
21
|
export interface IKubernetesScaleModalProps
|
|
24
22
|
extends Pick<IModalProps, 'isOpen'>,
|
|
25
23
|
Pick<IModalComponentProps, 'dismissModal'> {
|
|
26
24
|
application: Application;
|
|
27
|
-
|
|
25
|
+
coordinates: IManifestCoordinates;
|
|
28
26
|
currentReplicas: number;
|
|
29
27
|
}
|
|
30
28
|
|
|
@@ -33,9 +31,11 @@ export interface IKubernetesScaleValues {
|
|
|
33
31
|
replicas: number;
|
|
34
32
|
}
|
|
35
33
|
|
|
34
|
+
const REPLICA_SCALE_FACTOR_WARNING = 5;
|
|
35
|
+
|
|
36
36
|
export function ScaleModal({
|
|
37
37
|
application,
|
|
38
|
-
|
|
38
|
+
coordinates,
|
|
39
39
|
currentReplicas,
|
|
40
40
|
isOpen,
|
|
41
41
|
dismissModal,
|
|
@@ -43,26 +43,40 @@ export function ScaleModal({
|
|
|
43
43
|
const initialValues: IKubernetesScaleValues = {
|
|
44
44
|
replicas: currentReplicas,
|
|
45
45
|
};
|
|
46
|
-
const [verified, setVerified] = useState<boolean>(false);
|
|
47
|
-
const taskMonitor = useTaskMonitor(
|
|
48
|
-
{
|
|
49
|
-
application,
|
|
50
|
-
title: `Scaling ${resource.name} in ${resource.namespace}`,
|
|
51
|
-
onTaskComplete: () => application.serverGroups.refresh(true),
|
|
52
|
-
},
|
|
53
|
-
dismissModal,
|
|
54
|
-
);
|
|
55
46
|
|
|
56
47
|
const submit = (values: IKubernetesScaleValues): void => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
48
|
+
dismissModal();
|
|
49
|
+
|
|
50
|
+
let body = `Are you <i>really</i> sure you want to scale ${coordinates.name} in ${coordinates.account} to ${values.replicas} replicas?`;
|
|
51
|
+
if (values.replicas === 0) {
|
|
52
|
+
body +=
|
|
53
|
+
' <br><br><span style="color:red"><b>If this service does not have replicas in another cluster, this WILL cause an outage.</b></span>';
|
|
54
|
+
} else if (currentReplicas > 0 && values.replicas >= currentReplicas * REPLICA_SCALE_FACTOR_WARNING) {
|
|
55
|
+
body += ` <br><br><span style="color:red"><b>This will create more than ${REPLICA_SCALE_FACTOR_WARNING} times the current number of replicas.</b></span>`;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
ConfirmationModalService.confirm({
|
|
59
|
+
header: `Really scale ${coordinates.name} in ${coordinates.account}?`,
|
|
60
|
+
body,
|
|
61
|
+
taskMonitorConfig: {
|
|
62
|
+
application,
|
|
63
|
+
title: `Scaling ${coordinates.name} in ${coordinates.account}`,
|
|
64
|
+
onTaskComplete: () => application.serverGroups.refresh(true),
|
|
65
|
+
},
|
|
66
|
+
verificationLabel: 'Enter the name of the service to confirm',
|
|
67
|
+
textToVerify: application.name,
|
|
68
|
+
submitMethod: () => {
|
|
69
|
+
const payload = {
|
|
70
|
+
cloudProvider: 'kubernetes',
|
|
71
|
+
manifestName: coordinates.name,
|
|
72
|
+
location: coordinates.namespace,
|
|
73
|
+
account: coordinates.account,
|
|
74
|
+
reason: values.reason,
|
|
75
|
+
replicas: values.replicas,
|
|
76
|
+
};
|
|
77
|
+
return ManifestWriter.scaleManifest(payload, application);
|
|
78
|
+
},
|
|
79
|
+
});
|
|
66
80
|
};
|
|
67
81
|
|
|
68
82
|
const onOptionChange = (formik: FormikProps<IKubernetesScaleValues>, values: IScaleCommand): void => {
|
|
@@ -71,7 +85,6 @@ export function ScaleModal({
|
|
|
71
85
|
|
|
72
86
|
return (
|
|
73
87
|
<Modal show={isOpen} onHide={dismissModal}>
|
|
74
|
-
<TaskMonitorWrapper monitor={taskMonitor} />
|
|
75
88
|
<SpinFormik<IKubernetesScaleValues>
|
|
76
89
|
initialValues={initialValues}
|
|
77
90
|
onSubmit={submit}
|
|
@@ -80,7 +93,7 @@ export function ScaleModal({
|
|
|
80
93
|
<ModalClose dismiss={dismissModal} />
|
|
81
94
|
<Modal.Header>
|
|
82
95
|
<Modal.Title>
|
|
83
|
-
Scale {robotToHuman(
|
|
96
|
+
Scale {robotToHuman(coordinates.name)} in {coordinates.namespace}
|
|
84
97
|
</Modal.Title>
|
|
85
98
|
</Modal.Header>
|
|
86
99
|
<Modal.Body>
|
|
@@ -97,14 +110,13 @@ export function ScaleModal({
|
|
|
97
110
|
</Form>
|
|
98
111
|
</Modal.Body>
|
|
99
112
|
<Modal.Footer>
|
|
100
|
-
<UserVerification account={resource.account} onValidChange={setVerified} />
|
|
101
113
|
<Button onClick={dismissModal}>Cancel</Button>
|
|
102
114
|
<SubmitButton
|
|
103
115
|
onClick={() => submit(formik.values)}
|
|
104
|
-
isDisabled={
|
|
116
|
+
isDisabled={formik.isSubmitting}
|
|
105
117
|
isFormSubmit={true}
|
|
106
118
|
submitting={formik.isSubmitting}
|
|
107
|
-
label=
|
|
119
|
+
label="Submit"
|
|
108
120
|
/>
|
|
109
121
|
</Modal.Footer>
|
|
110
122
|
</>
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { NumberInput, StageConfigField } from '@spinnaker/core';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
export interface IScaleCommand {
|
|
5
|
+
manifestName: string;
|
|
6
|
+
location: string;
|
|
7
|
+
account: string;
|
|
8
|
+
reason: string;
|
|
9
|
+
replicas: number;
|
|
10
|
+
}
|
|
4
11
|
|
|
5
12
|
export interface IScaleSettingsFormProps {
|
|
6
13
|
options: IScaleCommand;
|