@spinnaker/kubernetes 0.0.0-main-2
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/CHANGELOG.md +1663 -0
- package/LICENSE.txt +203 -0
- package/dist/help/kubernetes.help.d.ts +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +6024 -0
- package/dist/index.js.map +1 -0
- package/dist/instance/details/details.controller.d.ts +1 -0
- package/dist/instance/index.d.ts +1 -0
- package/dist/interfaces/index.d.ts +1 -0
- package/dist/interfaces/infrastructure.types.d.ts +24 -0
- package/dist/kubernetes.module.d.ts +6 -0
- package/dist/loadBalancer/details/details.controller.d.ts +1 -0
- package/dist/loadBalancer/index.d.ts +1 -0
- package/dist/loadBalancer/transformer.d.ts +1 -0
- package/dist/manifest/IManifestCoordinates.d.ts +5 -0
- package/dist/manifest/ManifestImageDetails.d.ts +18 -0
- package/dist/manifest/ManifestKindSearch.d.ts +13 -0
- package/dist/manifest/ManifestLabels.d.ts +15 -0
- package/dist/manifest/ManifestQos.d.ts +15 -0
- package/dist/manifest/ManifestResources.d.ts +35 -0
- package/dist/manifest/ManifestSource.d.ts +4 -0
- package/dist/manifest/annotationCustomSections.component.d.ts +1 -0
- package/dist/manifest/artifact/artifact.component.d.ts +1 -0
- package/dist/manifest/delete/delete.controller.d.ts +12 -0
- package/dist/manifest/delete/deleteOptionsForm.component.d.ts +1 -0
- package/dist/manifest/editor/json/JsonEditor.d.ts +12 -0
- package/dist/manifest/editor/json/jsonEditor.component.d.ts +1 -0
- package/dist/manifest/index.d.ts +10 -0
- package/dist/manifest/manifest.service.d.ts +25 -0
- package/dist/manifest/manifestCommandBuilder.service.d.ts +30 -0
- package/dist/manifest/manifestEvents.component.d.ts +1 -0
- package/dist/manifest/manifestImageDetails.component.d.ts +1 -0
- package/dist/manifest/manifestLabels.component.d.ts +1 -0
- package/dist/manifest/manifestQos.component.d.ts +1 -0
- package/dist/manifest/manifestResources.component.d.ts +1 -0
- package/dist/manifest/rollout/RollingRestart.d.ts +1 -0
- package/dist/manifest/rollout/pause.controller.d.ts +1 -0
- package/dist/manifest/rollout/resume.controller.d.ts +1 -0
- package/dist/manifest/rollout/undo.controller.d.ts +1 -0
- package/dist/manifest/scale/ScaleSettingsForm.d.ts +10 -0
- package/dist/manifest/scale/scale.controller.d.ts +8 -0
- package/dist/manifest/scale/scaleSettingsForm.component.d.ts +1 -0
- package/dist/manifest/selector/IManifestLabelSelector.d.ts +9 -0
- package/dist/manifest/selector/IManifestSelector.d.ts +30 -0
- package/dist/manifest/selector/ManifestSelector.d.ts +46 -0
- package/dist/manifest/selector/labelEditor/LabelEditor.d.ts +15 -0
- package/dist/manifest/selector/selector.component.d.ts +1 -0
- package/dist/manifest/status/ManifestCondition.d.ts +13 -0
- package/dist/manifest/status/condition.component.d.ts +1 -0
- package/dist/manifest/status/status.component.d.ts +1 -0
- package/dist/manifest/traffic/ManifestTrafficService.d.ts +12 -0
- package/dist/manifest/wizard/BasicSettings.d.ts +17 -0
- package/dist/manifest/wizard/ManifestEntry.d.ts +16 -0
- package/dist/manifest/wizard/ManifestWizard.d.ts +22 -0
- package/dist/pipelines/stages/ManifestCoordinates.d.ts +31 -0
- package/dist/pipelines/stages/ManifestExecutionDetails.d.ts +69 -0
- package/dist/pipelines/stages/deleteManifest/DeleteManifestOptionsForm.d.ts +18 -0
- package/dist/pipelines/stages/deleteManifest/DeleteManifestStageConfig.d.ts +14 -0
- package/dist/pipelines/stages/deleteManifest/deleteManifestStage.d.ts +1 -0
- package/dist/pipelines/stages/deployManifest/CopyFromTemplateButton.d.ts +15 -0
- package/dist/pipelines/stages/deployManifest/DeployManifestStageConfig.d.ts +15 -0
- package/dist/pipelines/stages/deployManifest/DeployManifestStageForm.d.ts +31 -0
- package/dist/pipelines/stages/deployManifest/ManifestBindArtifactsSelector.d.ts +17 -0
- package/dist/pipelines/stages/deployManifest/ManifestCopier.d.ts +36 -0
- package/dist/pipelines/stages/deployManifest/ManifestDeploymentOptions.d.ts +34 -0
- package/dist/pipelines/stages/deployManifest/NamespaceSelector.d.ts +16 -0
- package/dist/pipelines/stages/deployManifest/deployManifest.validator.d.ts +2 -0
- package/dist/pipelines/stages/deployManifest/deployManifestStage.d.ts +1 -0
- package/dist/pipelines/stages/deployManifest/manifestStatus/DeployStatus.d.ts +23 -0
- package/dist/pipelines/stages/deployManifest/manifestStatus/DeployStatusPills.d.ts +8 -0
- package/dist/pipelines/stages/deployManifest/manifestStatus/ManifestDetailsLink.d.ts +20 -0
- package/dist/pipelines/stages/deployManifest/manifestStatus/ManifestEvents.d.ts +9 -0
- package/dist/pipelines/stages/deployManifest/manifestStatus/ManifestStatus.d.ts +8 -0
- package/dist/pipelines/stages/findArtifactsFromResource/FindArtifactsFromResourceConfig.d.ts +3 -0
- package/dist/pipelines/stages/findArtifactsFromResource/FindArtifactsFromResourceStageForm.d.ts +7 -0
- package/dist/pipelines/stages/findArtifactsFromResource/findArtifactsFromResourceStage.d.ts +1 -0
- package/dist/pipelines/stages/index.d.ts +8 -0
- package/dist/pipelines/stages/patchManifest/PatchManifestOptionsForm.d.ts +8 -0
- package/dist/pipelines/stages/patchManifest/PatchManifestStageConfig.d.ts +7 -0
- package/dist/pipelines/stages/patchManifest/PatchManifestStageForm.d.ts +21 -0
- package/dist/pipelines/stages/patchManifest/patchManifestStage.d.ts +4 -0
- package/dist/pipelines/stages/rolloutRestartManifest/RolloutRestartManifestStageConfig.d.ts +13 -0
- package/dist/pipelines/stages/rolloutRestartManifest/rolloutRestartManifestStage.d.ts +4 -0
- package/dist/pipelines/stages/runJob/KubernetesV2RunJobStageConfig.d.ts +31 -0
- package/dist/pipelines/stages/runJob/RunJobExecutionDetails.d.ts +7 -0
- package/dist/pipelines/stages/runJob/runJobStage.d.ts +1 -0
- package/dist/pipelines/stages/scaleManifest/ScaleManifestConfig.d.ts +3 -0
- package/dist/pipelines/stages/scaleManifest/ScaleManifestStageForm.d.ts +7 -0
- package/dist/pipelines/stages/scaleManifest/scaleManifestStage.d.ts +1 -0
- package/dist/pipelines/stages/traffic/ManifestTrafficStageConfig.d.ts +11 -0
- package/dist/pipelines/stages/traffic/disableManifest.stage.d.ts +1 -0
- package/dist/pipelines/stages/traffic/enableManifest.stage.d.ts +1 -0
- package/dist/pipelines/stages/undoRolloutManifest/UndoRolloutManifestConfig.d.ts +3 -0
- package/dist/pipelines/stages/undoRolloutManifest/UndoRolloutManifestStageForm.d.ts +7 -0
- package/dist/pipelines/stages/undoRolloutManifest/undoRolloutManifestStage.d.ts +1 -0
- package/dist/pipelines/stages/validators/manifestSelectorValidators.d.ts +2 -0
- package/dist/pipelines/validation/manifestSelector.validator.d.ts +8 -0
- package/dist/rawResource/component/K8sResources.d.ts +25 -0
- package/dist/rawResource/component/K8sResourcesFilters.d.ts +20 -0
- package/dist/rawResource/component/RawResourceUtils.d.ts +5 -0
- package/dist/rawResource/component/group/RawResouceGroup.d.ts +15 -0
- package/dist/rawResource/component/group/RawResource.d.ts +12 -0
- package/dist/rawResource/component/group/RawResourceDetails.d.ts +32 -0
- package/dist/rawResource/component/group/RawResourceGroups.d.ts +14 -0
- package/dist/rawResource/controller/FiltersPubSub.d.ts +12 -0
- package/dist/rawResource/index.d.ts +1 -0
- package/dist/rawResource/model/resource.d.ts +17 -0
- package/dist/rawResource/rawResource.dataSource.d.ts +2 -0
- package/dist/rawResource/rawResource.module.d.ts +1 -0
- package/dist/rawResource/rawResource.states.d.ts +6 -0
- package/dist/resources/ResourceDetails.d.ts +17 -0
- package/dist/resources/resources.state.d.ts +7 -0
- package/dist/rolloutStrategy/bluegreen.strategy.d.ts +2 -0
- package/dist/rolloutStrategy/highlander.strategy.d.ts +2 -0
- package/dist/rolloutStrategy/index.d.ts +1 -0
- package/dist/rolloutStrategy/none.strategy.d.ts +2 -0
- package/dist/rolloutStrategy/redblack.strategy.d.ts +2 -0
- package/dist/securityGroup/details/details.controller.d.ts +1 -0
- package/dist/securityGroup/index.d.ts +1 -0
- package/dist/securityGroup/securityGroup.reader.d.ts +4 -0
- package/dist/securityGroup/transformer.d.ts +1 -0
- package/dist/serverGroup/details/details.controller.d.ts +1 -0
- package/dist/serverGroup/details/resize/resize.controller.d.ts +1 -0
- package/dist/serverGroup/index.d.ts +4 -0
- package/dist/serverGroup/serverGroupCommandBuilder.service.d.ts +6 -0
- package/dist/serverGroup/serverGroupTransformer.service.d.ts +6 -0
- package/dist/serverGroupManager/details/details.controller.d.ts +1 -0
- package/dist/serverGroupManager/index.d.ts +1 -0
- package/dist/validation/applicationName.validator.d.ts +9 -0
- package/package.json +58 -0
- package/src/help/kubernetes.help.ts +236 -0
- package/src/index.ts +7 -0
- package/src/instance/details/details.controller.ts +186 -0
- package/src/instance/details/details.html +80 -0
- package/src/instance/index.ts +1 -0
- package/src/interfaces/index.ts +1 -0
- package/src/interfaces/infrastructure.types.ts +35 -0
- package/src/kubernetes.module.ts +144 -0
- package/src/loadBalancer/details/details.controller.ts +101 -0
- package/src/loadBalancer/details/details.html +187 -0
- package/src/loadBalancer/index.ts +1 -0
- package/src/loadBalancer/transformer.ts +60 -0
- package/src/logo/kubernetes.icon.svg +102 -0
- package/src/logo/kubernetes.logo.less +6 -0
- package/src/logo/kubernetes.logo.svg +1 -0
- package/src/manifest/IManifestCoordinates.ts +5 -0
- package/src/manifest/ManifestImageDetails.spec.tsx +76 -0
- package/src/manifest/ManifestImageDetails.tsx +64 -0
- package/src/manifest/ManifestKindSearch.tsx +31 -0
- package/src/manifest/ManifestLabels.tsx +31 -0
- package/src/manifest/ManifestQos.tsx +68 -0
- package/src/manifest/ManifestResources.tsx +69 -0
- package/src/manifest/ManifestSource.ts +4 -0
- package/src/manifest/annotationCustomSections.component.ts +114 -0
- package/src/manifest/artifact/artifact.component.ts +23 -0
- package/src/manifest/delete/delete.controller.ts +80 -0
- package/src/manifest/delete/delete.html +42 -0
- package/src/manifest/delete/deleteOptionsForm.component.ts +52 -0
- package/src/manifest/editor/json/JsonEditor.tsx +56 -0
- package/src/manifest/editor/json/jsonEditor.component.ts +12 -0
- package/src/manifest/index.ts +10 -0
- package/src/manifest/manifest.service.ts +90 -0
- package/src/manifest/manifestCommandBuilder.service.ts +126 -0
- package/src/manifest/manifestEvents.component.ts +12 -0
- package/src/manifest/manifestImageDetails.component.ts +12 -0
- package/src/manifest/manifestLabels.component.ts +12 -0
- package/src/manifest/manifestLabels.less +3 -0
- package/src/manifest/manifestQos.component.ts +12 -0
- package/src/manifest/manifestResources.component.ts +12 -0
- package/src/manifest/rollout/RollingRestart.tsx +54 -0
- package/src/manifest/rollout/pause.controller.ts +66 -0
- package/src/manifest/rollout/pause.html +28 -0
- package/src/manifest/rollout/resume.controller.ts +66 -0
- package/src/manifest/rollout/resume.html +28 -0
- package/src/manifest/rollout/undo.controller.ts +74 -0
- package/src/manifest/rollout/undo.html +44 -0
- package/src/manifest/scale/ScaleSettingsForm.tsx +43 -0
- package/src/manifest/scale/scale.controller.ts +75 -0
- package/src/manifest/scale/scale.html +32 -0
- package/src/manifest/scale/scaleSettingsForm.component.ts +11 -0
- package/src/manifest/selector/IManifestLabelSelector.ts +19 -0
- package/src/manifest/selector/IManifestSelector.ts +64 -0
- package/src/manifest/selector/ManifestSelector.spec.tsx +414 -0
- package/src/manifest/selector/ManifestSelector.tsx +424 -0
- package/src/manifest/selector/labelEditor/LabelEditor.spec.tsx +81 -0
- package/src/manifest/selector/labelEditor/LabelEditor.tsx +126 -0
- package/src/manifest/selector/labelEditor/labelEditor.less +3 -0
- package/src/manifest/selector/selector.component.ts +17 -0
- package/src/manifest/status/ManifestCondition.tsx +32 -0
- package/src/manifest/status/condition.component.ts +12 -0
- package/src/manifest/status/status.component.ts +36 -0
- package/src/manifest/traffic/ManifestTrafficService.spec.ts +30 -0
- package/src/manifest/traffic/ManifestTrafficService.ts +67 -0
- package/src/manifest/wizard/BasicSettings.tsx +57 -0
- package/src/manifest/wizard/ManifestEntry.tsx +46 -0
- package/src/manifest/wizard/ManifestWizard.tsx +94 -0
- package/src/pipelines/stages/ManifestCoordinates.spec.tsx +90 -0
- package/src/pipelines/stages/ManifestCoordinates.tsx +128 -0
- package/src/pipelines/stages/ManifestExecutionDetails.tsx +58 -0
- package/src/pipelines/stages/deleteManifest/DeleteManifestOptionsForm.spec.tsx +85 -0
- package/src/pipelines/stages/deleteManifest/DeleteManifestOptionsForm.tsx +87 -0
- package/src/pipelines/stages/deleteManifest/DeleteManifestStageConfig.tsx +62 -0
- package/src/pipelines/stages/deleteManifest/deleteManifestOptionsForm.less +9 -0
- package/src/pipelines/stages/deleteManifest/deleteManifestStage.ts +21 -0
- package/src/pipelines/stages/deployManifest/CopyFromTemplateButton.tsx +45 -0
- package/src/pipelines/stages/deployManifest/DeployManifestStageConfig.tsx +77 -0
- package/src/pipelines/stages/deployManifest/DeployManifestStageForm.tsx +265 -0
- package/src/pipelines/stages/deployManifest/ManifestBindArtifactsSelector.tsx +69 -0
- package/src/pipelines/stages/deployManifest/ManifestCopier.spec.ts +110 -0
- package/src/pipelines/stages/deployManifest/ManifestCopier.tsx +222 -0
- package/src/pipelines/stages/deployManifest/ManifestDeploymentOptions.spec.tsx +75 -0
- package/src/pipelines/stages/deployManifest/ManifestDeploymentOptions.tsx +203 -0
- package/src/pipelines/stages/deployManifest/NamespaceSelector.tsx +40 -0
- package/src/pipelines/stages/deployManifest/deployManifest.validator.ts +38 -0
- package/src/pipelines/stages/deployManifest/deployManifestStage.ts +28 -0
- package/src/pipelines/stages/deployManifest/manifestStatus/DeployStatus.less +11 -0
- package/src/pipelines/stages/deployManifest/manifestStatus/DeployStatus.tsx +120 -0
- package/src/pipelines/stages/deployManifest/manifestStatus/DeployStatusPills.tsx +47 -0
- package/src/pipelines/stages/deployManifest/manifestStatus/ManifestDetailsLink.tsx +92 -0
- package/src/pipelines/stages/deployManifest/manifestStatus/ManifestEvents.tsx +87 -0
- package/src/pipelines/stages/deployManifest/manifestStatus/ManifestStatus.less +24 -0
- package/src/pipelines/stages/deployManifest/manifestStatus/ManifestStatus.tsx +46 -0
- package/src/pipelines/stages/findArtifactsFromResource/FindArtifactsFromResourceConfig.tsx +35 -0
- package/src/pipelines/stages/findArtifactsFromResource/FindArtifactsFromResourceStageForm.tsx +37 -0
- package/src/pipelines/stages/findArtifactsFromResource/findArtifactsFromResourceStage.ts +21 -0
- package/src/pipelines/stages/index.ts +8 -0
- package/src/pipelines/stages/patchManifest/PatchManifestOptionsForm.tsx +35 -0
- package/src/pipelines/stages/patchManifest/PatchManifestStageConfig.tsx +57 -0
- package/src/pipelines/stages/patchManifest/PatchManifestStageForm.tsx +157 -0
- package/src/pipelines/stages/patchManifest/patchManifestStage.ts +30 -0
- package/src/pipelines/stages/rolloutRestartManifest/RolloutRestartManifestStageConfig.tsx +46 -0
- package/src/pipelines/stages/rolloutRestartManifest/rolloutRestartManifestStage.ts +20 -0
- package/src/pipelines/stages/runJob/KubernetesV2RunJobStageConfig.tsx +242 -0
- package/src/pipelines/stages/runJob/RunJobExecutionDetails.tsx +67 -0
- package/src/pipelines/stages/runJob/runJobStage.ts +39 -0
- package/src/pipelines/stages/scaleManifest/ScaleManifestConfig.tsx +38 -0
- package/src/pipelines/stages/scaleManifest/ScaleManifestStageForm.tsx +46 -0
- package/src/pipelines/stages/scaleManifest/scaleManifestStage.ts +24 -0
- package/src/pipelines/stages/traffic/ManifestTrafficStageConfig.tsx +44 -0
- package/src/pipelines/stages/traffic/disableManifest.stage.ts +26 -0
- package/src/pipelines/stages/traffic/enableManifest.stage.ts +26 -0
- package/src/pipelines/stages/undoRolloutManifest/UndoRolloutManifestConfig.tsx +37 -0
- package/src/pipelines/stages/undoRolloutManifest/UndoRolloutManifestStageForm.tsx +60 -0
- package/src/pipelines/stages/undoRolloutManifest/undoRolloutManifestStage.ts +21 -0
- package/src/pipelines/stages/validators/manifestSelectorValidators.ts +43 -0
- package/src/pipelines/validation/manifestSelector.validator.ts +36 -0
- package/src/rawResource/component/K8sResources.less +9 -0
- package/src/rawResource/component/K8sResources.tsx +112 -0
- package/src/rawResource/component/K8sResourcesFilters.tsx +112 -0
- package/src/rawResource/component/RawResourceUtils.ts +19 -0
- package/src/rawResource/component/group/RawResouceGroup.tsx +41 -0
- package/src/rawResource/component/group/RawResource.less +79 -0
- package/src/rawResource/component/group/RawResource.tsx +51 -0
- package/src/rawResource/component/group/RawResourceDetails.tsx +236 -0
- package/src/rawResource/component/group/RawResourceGroups.tsx +53 -0
- package/src/rawResource/controller/FiltersPubSub.ts +35 -0
- package/src/rawResource/index.ts +1 -0
- package/src/rawResource/model/resource.ts +18 -0
- package/src/rawResource/rawResource.dataSource.ts +39 -0
- package/src/rawResource/rawResource.module.ts +8 -0
- package/src/rawResource/rawResource.states.ts +64 -0
- package/src/resources/ResourceDetails.tsx +121 -0
- package/src/resources/resources.state.ts +45 -0
- package/src/rolloutStrategy/bluegreen.strategy.ts +7 -0
- package/src/rolloutStrategy/highlander.strategy.ts +7 -0
- package/src/rolloutStrategy/index.ts +6 -0
- package/src/rolloutStrategy/none.strategy.ts +8 -0
- package/src/rolloutStrategy/redblack.strategy.ts +7 -0
- package/src/securityGroup/details/details.controller.ts +118 -0
- package/src/securityGroup/details/details.html +91 -0
- package/src/securityGroup/index.ts +1 -0
- package/src/securityGroup/securityGroup.reader.ts +11 -0
- package/src/securityGroup/transformer.ts +19 -0
- package/src/serverGroup/details/details.controller.ts +207 -0
- package/src/serverGroup/details/details.html +153 -0
- package/src/serverGroup/details/resize/resize.controller.ts +73 -0
- package/src/serverGroup/details/resize/resize.html +57 -0
- package/src/serverGroup/index.ts +4 -0
- package/src/serverGroup/serverGroupCommandBuilder.service.ts +18 -0
- package/src/serverGroup/serverGroupTransformer.service.spec.ts +67 -0
- package/src/serverGroup/serverGroupTransformer.service.ts +34 -0
- package/src/serverGroupManager/details/details.controller.ts +191 -0
- package/src/serverGroupManager/details/details.html +136 -0
- package/src/serverGroupManager/index.ts +1 -0
- package/src/validation/applicationName.validator.spec.ts +19 -0
- package/src/validation/applicationName.validator.ts +44 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { load } from 'js-yaml';
|
|
2
|
+
import { cloneDeep, has } from 'lodash';
|
|
3
|
+
import { $q } from 'ngimport';
|
|
4
|
+
|
|
5
|
+
import type { Application, IAccountDetails, IArtifactAccount, IMoniker } from '@spinnaker/core';
|
|
6
|
+
import { AccountService } from '@spinnaker/core';
|
|
7
|
+
|
|
8
|
+
import { ManifestSource } from './ManifestSource';
|
|
9
|
+
|
|
10
|
+
const LAST_APPLIED_CONFIGURATION = 'kubectl.kubernetes.io/last-applied-configuration';
|
|
11
|
+
|
|
12
|
+
export interface IKubernetesManifestCommandData {
|
|
13
|
+
command: IKubernetesManifestCommand;
|
|
14
|
+
metadata: IKubernetesManifestCommandMetadata;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface IKubernetesManifestCommand {
|
|
18
|
+
account: string;
|
|
19
|
+
cloudProvider: string;
|
|
20
|
+
manifest: any; // deprecated
|
|
21
|
+
manifests: any[];
|
|
22
|
+
relationships: IKubernetesManifestSpinnakerRelationships;
|
|
23
|
+
moniker: IMoniker;
|
|
24
|
+
manifestArtifactId?: string;
|
|
25
|
+
manifestArtifactAccount?: string;
|
|
26
|
+
source: ManifestSource;
|
|
27
|
+
versioned?: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface IKubernetesManifestCommandMetadata {
|
|
31
|
+
backingData: any;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface IKubernetesManifestSpinnakerRelationships {
|
|
35
|
+
loadBalancers?: string[];
|
|
36
|
+
securityGroups?: string[];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export class KubernetesManifestCommandBuilder {
|
|
40
|
+
// TODO(lwander) add explanatory error messages
|
|
41
|
+
public static manifestCommandIsValid(command: IKubernetesManifestCommand): boolean {
|
|
42
|
+
if (!command.moniker) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (!command.moniker.app) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public static copyAndCleanCommand(input: IKubernetesManifestCommand): IKubernetesManifestCommand {
|
|
54
|
+
const command = cloneDeep(input);
|
|
55
|
+
return command;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public static buildNewManifestCommand(
|
|
59
|
+
app: Application,
|
|
60
|
+
sourceManifest?: any,
|
|
61
|
+
sourceMoniker?: IMoniker,
|
|
62
|
+
sourceAccount?: string,
|
|
63
|
+
): PromiseLike<IKubernetesManifestCommandData> {
|
|
64
|
+
if (sourceManifest != null && has(sourceManifest, ['metadata', 'annotations', LAST_APPLIED_CONFIGURATION])) {
|
|
65
|
+
sourceManifest = load(sourceManifest.metadata.annotations[LAST_APPLIED_CONFIGURATION]);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const dataToFetch = {
|
|
69
|
+
accounts: AccountService.getAllAccountDetailsForProvider('kubernetes'),
|
|
70
|
+
artifactAccounts: AccountService.getArtifactAccounts(),
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// TODO(dpeach): if no callers of this method are Angular controllers,
|
|
74
|
+
// $q.all may be safely replaced with Promise.all.
|
|
75
|
+
return $q
|
|
76
|
+
.all(dataToFetch)
|
|
77
|
+
.then((backingData: { accounts: IAccountDetails[]; artifactAccounts: IArtifactAccount[] }) => {
|
|
78
|
+
const { accounts, artifactAccounts } = backingData;
|
|
79
|
+
|
|
80
|
+
const account = accounts.some((a) => a.name === sourceAccount)
|
|
81
|
+
? accounts.find((a) => a.name === sourceAccount).name
|
|
82
|
+
: accounts.length
|
|
83
|
+
? accounts[0].name
|
|
84
|
+
: null;
|
|
85
|
+
|
|
86
|
+
let manifestArtifactAccount: string = null;
|
|
87
|
+
const [artifactAccountData] = artifactAccounts;
|
|
88
|
+
if (artifactAccountData) {
|
|
89
|
+
manifestArtifactAccount = artifactAccountData.name;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const cloudProvider = 'kubernetes';
|
|
93
|
+
const moniker = sourceMoniker || {
|
|
94
|
+
app: app.name,
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const relationships = {
|
|
98
|
+
loadBalancers: [] as string[],
|
|
99
|
+
securityGroups: [] as string[],
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const versioned: any = null;
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
command: {
|
|
106
|
+
cloudProvider,
|
|
107
|
+
manifest: null,
|
|
108
|
+
manifests: Array.isArray(sourceManifest)
|
|
109
|
+
? sourceManifest
|
|
110
|
+
: sourceManifest != null
|
|
111
|
+
? [sourceManifest]
|
|
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
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { module } from 'angular';
|
|
2
|
+
import { react2angular } from 'react2angular';
|
|
3
|
+
|
|
4
|
+
import { withErrorBoundary } from '@spinnaker/core';
|
|
5
|
+
|
|
6
|
+
import { ManifestEvents } from '../pipelines/stages/deployManifest/manifestStatus/ManifestEvents';
|
|
7
|
+
|
|
8
|
+
export const KUBERNETES_MANIFEST_EVENTS = 'spinnaker.kubernetes.v2.manifest.events';
|
|
9
|
+
module(KUBERNETES_MANIFEST_EVENTS, []).component(
|
|
10
|
+
'kubernetesManifestEvents',
|
|
11
|
+
react2angular(withErrorBoundary(ManifestEvents, 'kubernetesManifestEvents'), ['manifest']),
|
|
12
|
+
);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { module } from 'angular';
|
|
2
|
+
import { react2angular } from 'react2angular';
|
|
3
|
+
|
|
4
|
+
import { withErrorBoundary } from '@spinnaker/core';
|
|
5
|
+
|
|
6
|
+
import { ManifestImageDetails } from './ManifestImageDetails';
|
|
7
|
+
|
|
8
|
+
export const KUBERNETES_MANIFEST_IMAGE_DETAILS = 'spinnaker.kubernetes.v2.manifestImageDetails.component';
|
|
9
|
+
module(KUBERNETES_MANIFEST_IMAGE_DETAILS, []).component(
|
|
10
|
+
'kubernetesManifestImageDetails',
|
|
11
|
+
react2angular(withErrorBoundary(ManifestImageDetails, 'kubernetesManifestImageDetails'), ['manifest']),
|
|
12
|
+
);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { module } from 'angular';
|
|
2
|
+
import { react2angular } from 'react2angular';
|
|
3
|
+
|
|
4
|
+
import { withErrorBoundary } from '@spinnaker/core';
|
|
5
|
+
|
|
6
|
+
import { ManifestLabels } from './ManifestLabels';
|
|
7
|
+
|
|
8
|
+
export const KUBERNETES_MANIFEST_LABELS = 'spinnaker.kubernetes.v2.manifest.labels';
|
|
9
|
+
module(KUBERNETES_MANIFEST_LABELS, []).component(
|
|
10
|
+
'kubernetesManifestLabels',
|
|
11
|
+
react2angular(withErrorBoundary(ManifestLabels, 'kubernetesManifestLabels'), ['manifest']),
|
|
12
|
+
);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { module } from 'angular';
|
|
2
|
+
import { react2angular } from 'react2angular';
|
|
3
|
+
|
|
4
|
+
import { withErrorBoundary } from '@spinnaker/core';
|
|
5
|
+
|
|
6
|
+
import { ManifestQos } from './ManifestQos';
|
|
7
|
+
|
|
8
|
+
export const KUBERNETES_MANIFEST_QOS = 'spinnaker.kubernetes.v2.manifest.qos';
|
|
9
|
+
module(KUBERNETES_MANIFEST_QOS, []).component(
|
|
10
|
+
'kubernetesManifestQos',
|
|
11
|
+
react2angular(withErrorBoundary(ManifestQos, 'kubernetesManifestQos'), ['manifest']),
|
|
12
|
+
);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { module } from 'angular';
|
|
2
|
+
import { react2angular } from 'react2angular';
|
|
3
|
+
|
|
4
|
+
import { withErrorBoundary } from '@spinnaker/core';
|
|
5
|
+
|
|
6
|
+
import { ManifestResources } from './ManifestResources';
|
|
7
|
+
|
|
8
|
+
export const KUBERNETES_MANIFEST_RESOURCES = 'spinnaker.kubernetes.v2.manifest.resources';
|
|
9
|
+
module(KUBERNETES_MANIFEST_RESOURCES, []).component(
|
|
10
|
+
'kubernetesManifestResources',
|
|
11
|
+
react2angular(withErrorBoundary(ManifestResources, 'kubernetesManifestResources'), ['manifest', 'metrics']),
|
|
12
|
+
);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { module } from 'angular';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { react2angular } from 'react2angular';
|
|
4
|
+
|
|
5
|
+
import type { Application } from '@spinnaker/core';
|
|
6
|
+
import { ConfirmationModalService, ManifestWriter, withErrorBoundary } from '@spinnaker/core';
|
|
7
|
+
|
|
8
|
+
import type { IKubernetesServerGroupManager } from '../../interfaces';
|
|
9
|
+
|
|
10
|
+
interface IRollingRestartProps {
|
|
11
|
+
application: Application;
|
|
12
|
+
serverGroupManager: IKubernetesServerGroupManager;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface IRollingRestartParameters {
|
|
16
|
+
account: string;
|
|
17
|
+
cloudProvider: string;
|
|
18
|
+
location: string;
|
|
19
|
+
manifestName: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function RollingRestart({ application, serverGroupManager }: IRollingRestartProps) {
|
|
23
|
+
function rollingRestart() {
|
|
24
|
+
const rollingRestartParameters: IRollingRestartParameters = {
|
|
25
|
+
account: serverGroupManager.account,
|
|
26
|
+
cloudProvider: 'kubernetes',
|
|
27
|
+
location: serverGroupManager.namespace,
|
|
28
|
+
manifestName: serverGroupManager.name,
|
|
29
|
+
};
|
|
30
|
+
ConfirmationModalService.confirm({
|
|
31
|
+
account: serverGroupManager.account,
|
|
32
|
+
askForReason: true,
|
|
33
|
+
header: `Initiate rolling restart of ${serverGroupManager.name}`,
|
|
34
|
+
submitMethod: () => {
|
|
35
|
+
return ManifestWriter.rollingRestartManifest(rollingRestartParameters, application);
|
|
36
|
+
},
|
|
37
|
+
taskMonitorConfig: {
|
|
38
|
+
application,
|
|
39
|
+
title: `Rolling restart of ${serverGroupManager.name}`,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return (
|
|
44
|
+
<li>
|
|
45
|
+
<a onClick={rollingRestart}>Rolling Restart</a>
|
|
46
|
+
</li>
|
|
47
|
+
);
|
|
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
|
+
);
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { IController } from 'angular';
|
|
2
|
+
import { copy, module } from 'angular';
|
|
3
|
+
import type { IModalServiceInstance } from 'angular-ui-bootstrap';
|
|
4
|
+
|
|
5
|
+
import type { Application } from '@spinnaker/core';
|
|
6
|
+
import { ManifestWriter, TaskMonitor } from '@spinnaker/core';
|
|
7
|
+
import type { IManifestCoordinates } from '../IManifestCoordinates';
|
|
8
|
+
|
|
9
|
+
interface IPauseRolloutCommand {
|
|
10
|
+
manifestName: string;
|
|
11
|
+
location: string;
|
|
12
|
+
account: string;
|
|
13
|
+
reason: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
class KubernetesManifestPauseRolloutController implements IController {
|
|
17
|
+
public taskMonitor: TaskMonitor;
|
|
18
|
+
public command: IPauseRolloutCommand;
|
|
19
|
+
public verification = {
|
|
20
|
+
verified: false,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
public static $inject = ['coordinates', '$uibModalInstance', 'application'];
|
|
24
|
+
constructor(
|
|
25
|
+
coordinates: IManifestCoordinates,
|
|
26
|
+
private $uibModalInstance: IModalServiceInstance,
|
|
27
|
+
private application: Application,
|
|
28
|
+
) {
|
|
29
|
+
this.taskMonitor = new TaskMonitor({
|
|
30
|
+
title: `Pause rollout of ${coordinates.name} in ${coordinates.namespace}`,
|
|
31
|
+
application,
|
|
32
|
+
modalInstance: $uibModalInstance,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
this.command = {
|
|
36
|
+
manifestName: coordinates.name,
|
|
37
|
+
location: coordinates.namespace,
|
|
38
|
+
account: coordinates.account,
|
|
39
|
+
reason: null,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public isValid(): boolean {
|
|
44
|
+
return this.verification.verified;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public cancel(): void {
|
|
48
|
+
this.$uibModalInstance.dismiss();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public pauseRollout(): void {
|
|
52
|
+
this.taskMonitor.submit(() => {
|
|
53
|
+
const payload = copy(this.command) as any;
|
|
54
|
+
payload.cloudProvider = 'kubernetes';
|
|
55
|
+
|
|
56
|
+
return ManifestWriter.pauseRolloutManifest(payload, this.application);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const KUBERNETES_MANIFEST_PAUSE_ROLLOUT_CTRL = 'spinnaker.kubernetes.v2.manifest.pauseRollout.controller';
|
|
62
|
+
|
|
63
|
+
module(KUBERNETES_MANIFEST_PAUSE_ROLLOUT_CTRL, []).controller(
|
|
64
|
+
'kubernetesV2ManifestPauseRolloutCtrl',
|
|
65
|
+
KubernetesManifestPauseRolloutController,
|
|
66
|
+
);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<div modal-page class="confirmation-modal">
|
|
2
|
+
<task-monitor monitor="ctrl.taskMonitor"></task-monitor>
|
|
3
|
+
<form role="form" name="pauseRolloutForm">
|
|
4
|
+
<modal-close dismiss="$dismiss()"></modal-close>
|
|
5
|
+
<div class="modal-header">
|
|
6
|
+
<h4 class="modal-title">
|
|
7
|
+
Pause rollout of {{ctrl.command.manifestName | robotToHuman}} in {{ctrl.command.location}}
|
|
8
|
+
</h4>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="modal-body confirmation-modal">
|
|
11
|
+
<task-reason command="ctrl.command"></task-reason>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="modal-footer">
|
|
14
|
+
<user-verification account="ctrl.command.account" verification="ctrl.verification"></user-verification>
|
|
15
|
+
<button type="submit" ng-click="ctrl.pauseRollout()" style="display: none"></button>
|
|
16
|
+
<!-- Allows form submission via enter keypress-->
|
|
17
|
+
<button class="btn btn-default" ng-click="ctrl.cancel()">Cancel</button>
|
|
18
|
+
<button
|
|
19
|
+
type="submit"
|
|
20
|
+
class="btn btn-primary"
|
|
21
|
+
ng-click="ctrl.pauseRollout()"
|
|
22
|
+
ng-disabled="!ctrl.isValid() || !pauseRolloutForm.$valid"
|
|
23
|
+
>
|
|
24
|
+
Submit
|
|
25
|
+
</button>
|
|
26
|
+
</div>
|
|
27
|
+
</form>
|
|
28
|
+
</div>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { IController } from 'angular';
|
|
2
|
+
import { copy, module } from 'angular';
|
|
3
|
+
import type { IModalServiceInstance } from 'angular-ui-bootstrap';
|
|
4
|
+
|
|
5
|
+
import type { Application } from '@spinnaker/core';
|
|
6
|
+
import { ManifestWriter, TaskMonitor } from '@spinnaker/core';
|
|
7
|
+
import type { IManifestCoordinates } from '../IManifestCoordinates';
|
|
8
|
+
|
|
9
|
+
interface IResumeRolloutCommand {
|
|
10
|
+
manifestName: string;
|
|
11
|
+
location: string;
|
|
12
|
+
account: string;
|
|
13
|
+
reason: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
class KubernetesManifestResumeRolloutController implements IController {
|
|
17
|
+
public taskMonitor: TaskMonitor;
|
|
18
|
+
public command: IResumeRolloutCommand;
|
|
19
|
+
public verification = {
|
|
20
|
+
verified: false,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
public static $inject = ['coordinates', '$uibModalInstance', 'application'];
|
|
24
|
+
constructor(
|
|
25
|
+
coordinates: IManifestCoordinates,
|
|
26
|
+
private $uibModalInstance: IModalServiceInstance,
|
|
27
|
+
private application: Application,
|
|
28
|
+
) {
|
|
29
|
+
this.taskMonitor = new TaskMonitor({
|
|
30
|
+
title: `Resume rollout of ${coordinates.name} in ${coordinates.namespace}`,
|
|
31
|
+
application,
|
|
32
|
+
modalInstance: $uibModalInstance,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
this.command = {
|
|
36
|
+
manifestName: coordinates.name,
|
|
37
|
+
location: coordinates.namespace,
|
|
38
|
+
account: coordinates.account,
|
|
39
|
+
reason: null,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public isValid(): boolean {
|
|
44
|
+
return this.verification.verified;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public cancel(): void {
|
|
48
|
+
this.$uibModalInstance.dismiss();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public resumeRollout(): void {
|
|
52
|
+
this.taskMonitor.submit(() => {
|
|
53
|
+
const payload = copy(this.command) as any;
|
|
54
|
+
payload.cloudProvider = 'kubernetes';
|
|
55
|
+
|
|
56
|
+
return ManifestWriter.resumeRolloutManifest(payload, this.application);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const KUBERNETES_MANIFEST_RESUME_ROLLOUT_CTRL = 'spinnaker.kubernetes.v2.manifest.resumeRollout.controller';
|
|
62
|
+
|
|
63
|
+
module(KUBERNETES_MANIFEST_RESUME_ROLLOUT_CTRL, []).controller(
|
|
64
|
+
'kubernetesV2ManifestResumeRolloutCtrl',
|
|
65
|
+
KubernetesManifestResumeRolloutController,
|
|
66
|
+
);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<div modal-page class="confirmation-modal">
|
|
2
|
+
<task-monitor monitor="ctrl.taskMonitor"></task-monitor>
|
|
3
|
+
<form role="form" name="resumeRolloutForm">
|
|
4
|
+
<modal-close dismiss="$dismiss()"></modal-close>
|
|
5
|
+
<div class="modal-header">
|
|
6
|
+
<h4 class="modal-title">
|
|
7
|
+
Resume rollout of {{ctrl.command.manifestName | robotToHuman}} in {{ctrl.command.location}}
|
|
8
|
+
</h4>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="modal-body confirmation-modal">
|
|
11
|
+
<task-reason command="ctrl.command"></task-reason>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="modal-footer">
|
|
14
|
+
<user-verification account="ctrl.command.account" verification="ctrl.verification"></user-verification>
|
|
15
|
+
<button type="submit" ng-click="ctrl.resumeRollout()" style="display: none"></button>
|
|
16
|
+
<!-- Allows form submission via enter keypress-->
|
|
17
|
+
<button class="btn btn-default" ng-click="ctrl.cancel()">Cancel</button>
|
|
18
|
+
<button
|
|
19
|
+
type="submit"
|
|
20
|
+
class="btn btn-primary"
|
|
21
|
+
ng-click="ctrl.resumeRollout()"
|
|
22
|
+
ng-disabled="!ctrl.isValid() || !resumeRolloutForm.$valid"
|
|
23
|
+
>
|
|
24
|
+
Submit
|
|
25
|
+
</button>
|
|
26
|
+
</div>
|
|
27
|
+
</form>
|
|
28
|
+
</div>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { IController } from 'angular';
|
|
2
|
+
import { copy, module } from 'angular';
|
|
3
|
+
import type { IModalServiceInstance } from 'angular-ui-bootstrap';
|
|
4
|
+
|
|
5
|
+
import type { Application } from '@spinnaker/core';
|
|
6
|
+
import { ManifestWriter, TaskMonitor } from '@spinnaker/core';
|
|
7
|
+
import type { IManifestCoordinates } from '../IManifestCoordinates';
|
|
8
|
+
|
|
9
|
+
interface IUndoRolloutCommand {
|
|
10
|
+
manifestName: string;
|
|
11
|
+
location: string;
|
|
12
|
+
account: string;
|
|
13
|
+
reason: string;
|
|
14
|
+
revision: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface IRolloutRevision {
|
|
18
|
+
label: string;
|
|
19
|
+
revision: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
class KubernetesManifestUndoRolloutController implements IController {
|
|
23
|
+
public taskMonitor: TaskMonitor;
|
|
24
|
+
public command: IUndoRolloutCommand;
|
|
25
|
+
public verification = {
|
|
26
|
+
verified: false,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
public static $inject = ['coordinates', 'revisions', '$uibModalInstance', 'application'];
|
|
30
|
+
constructor(
|
|
31
|
+
coordinates: IManifestCoordinates,
|
|
32
|
+
public revisions: IRolloutRevision[],
|
|
33
|
+
private $uibModalInstance: IModalServiceInstance,
|
|
34
|
+
private application: Application,
|
|
35
|
+
) {
|
|
36
|
+
this.taskMonitor = new TaskMonitor({
|
|
37
|
+
title: `Undo rollout of ${coordinates.name} in ${coordinates.namespace}`,
|
|
38
|
+
application,
|
|
39
|
+
modalInstance: $uibModalInstance,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
this.command = {
|
|
43
|
+
manifestName: coordinates.name,
|
|
44
|
+
location: coordinates.namespace,
|
|
45
|
+
account: coordinates.account,
|
|
46
|
+
reason: null,
|
|
47
|
+
revision: null,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public isValid(): boolean {
|
|
52
|
+
return this.verification.verified;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public cancel(): void {
|
|
56
|
+
this.$uibModalInstance.dismiss();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public undoRollout(): void {
|
|
60
|
+
this.taskMonitor.submit(() => {
|
|
61
|
+
const payload = copy(this.command) as any;
|
|
62
|
+
payload.cloudProvider = 'kubernetes';
|
|
63
|
+
|
|
64
|
+
return ManifestWriter.undoRolloutManifest(payload, this.application);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const KUBERNETES_MANIFEST_UNDO_ROLLOUT_CTRL = 'spinnaker.kubernetes.v2.manifest.undoRollout.controller';
|
|
70
|
+
|
|
71
|
+
module(KUBERNETES_MANIFEST_UNDO_ROLLOUT_CTRL, []).controller(
|
|
72
|
+
'kubernetesV2ManifestUndoRolloutCtrl',
|
|
73
|
+
KubernetesManifestUndoRolloutController,
|
|
74
|
+
);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<div modal-page class="confirmation-modal">
|
|
2
|
+
<task-monitor monitor="ctrl.taskMonitor"></task-monitor>
|
|
3
|
+
<form role="form" name="undoRolloutForm">
|
|
4
|
+
<modal-close dismiss="$dismiss()"></modal-close>
|
|
5
|
+
<div class="modal-header">
|
|
6
|
+
<h4 class="modal-title">
|
|
7
|
+
Undo rollout of {{ctrl.command.manifestName | robotToHuman}} in {{ctrl.command.location}}
|
|
8
|
+
</h4>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="modal-body confirmation-modal">
|
|
11
|
+
<div class="form-horizontal">
|
|
12
|
+
<div class="form-group form-inline">
|
|
13
|
+
<div class="col-md-3 sm-label-right">Revision</div>
|
|
14
|
+
<div class="col-md-7">
|
|
15
|
+
<select style="width: 100%" class="form-control input-sm" ng-model="ctrl.command.revision">
|
|
16
|
+
<option
|
|
17
|
+
ng-repeat="revision in ctrl.revisions"
|
|
18
|
+
value="{{revision.revision}}"
|
|
19
|
+
ng-selected="ctrl.command.revisions === revision.revision"
|
|
20
|
+
>
|
|
21
|
+
{{revision.label}}
|
|
22
|
+
</option>
|
|
23
|
+
</select>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
<task-reason command="ctrl.command"></task-reason>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="modal-footer">
|
|
30
|
+
<user-verification account="ctrl.command.account" verification="ctrl.verification"></user-verification>
|
|
31
|
+
<button type="submit" ng-click="ctrl.undoRollout()" style="display: none"></button>
|
|
32
|
+
<!-- Allows form submission via enter keypress-->
|
|
33
|
+
<button class="btn btn-default" ng-click="ctrl.cancel()">Cancel</button>
|
|
34
|
+
<button
|
|
35
|
+
type="submit"
|
|
36
|
+
class="btn btn-primary"
|
|
37
|
+
ng-click="ctrl.undoRollout()"
|
|
38
|
+
ng-disabled="!ctrl.isValid() || !undoRolloutForm.$valid"
|
|
39
|
+
>
|
|
40
|
+
Submit
|
|
41
|
+
</button>
|
|
42
|
+
</div>
|
|
43
|
+
</form>
|
|
44
|
+
</div>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { NumberInput, StageConfigField } from '@spinnaker/core';
|
|
3
|
+
import type { IScaleCommand } from './scale.controller';
|
|
4
|
+
|
|
5
|
+
export interface IScaleSettingsFormProps {
|
|
6
|
+
options: IScaleCommand;
|
|
7
|
+
onChange(options: IScaleCommand): void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface IScaleSettingsFormState {
|
|
11
|
+
options: IScaleCommand;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function ScaleSettingsForm({ options, onChange }: IScaleSettingsFormProps) {
|
|
15
|
+
const [state, setState] = useState<IScaleSettingsFormState>({
|
|
16
|
+
options: options,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const updateReplicas = (newReplicas: number) => {
|
|
20
|
+
state.options.replicas = newReplicas;
|
|
21
|
+
if (onChange) {
|
|
22
|
+
onChange(state.options);
|
|
23
|
+
}
|
|
24
|
+
setState({ options: state.options });
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<div className="form-horizontal">
|
|
29
|
+
<StageConfigField label="Replicas" fieldColumns={4} groupClassName="form-group form-inline">
|
|
30
|
+
<div className="input-group">
|
|
31
|
+
<NumberInput
|
|
32
|
+
inputClassName="input-sm highlight-pristine"
|
|
33
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
34
|
+
updateReplicas(e.target.valueAsNumber);
|
|
35
|
+
}}
|
|
36
|
+
value={options.replicas}
|
|
37
|
+
min={0}
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
</StageConfigField>
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { IController, IScope } from 'angular';
|
|
2
|
+
import { copy, module } from 'angular';
|
|
3
|
+
import type { IModalServiceInstance } from 'angular-ui-bootstrap';
|
|
4
|
+
|
|
5
|
+
import type { Application } from '@spinnaker/core';
|
|
6
|
+
import { ManifestWriter, TaskMonitor } from '@spinnaker/core';
|
|
7
|
+
import type { IManifestCoordinates } from '../IManifestCoordinates';
|
|
8
|
+
import { KUBERNETES_SCALE_MANIFEST_SETTINGS_FORM } from './scaleSettingsForm.component';
|
|
9
|
+
|
|
10
|
+
export interface IScaleCommand {
|
|
11
|
+
manifestName: string;
|
|
12
|
+
location: string;
|
|
13
|
+
account: string;
|
|
14
|
+
reason: string;
|
|
15
|
+
replicas: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
class KubernetesManifestScaleController implements IController {
|
|
19
|
+
public taskMonitor: TaskMonitor;
|
|
20
|
+
public verification = {
|
|
21
|
+
verified: false,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
public static $inject = ['$scope', 'coordinates', 'currentReplicas', '$uibModalInstance', 'application'];
|
|
25
|
+
constructor(
|
|
26
|
+
private $scope: IScope,
|
|
27
|
+
coordinates: IManifestCoordinates,
|
|
28
|
+
currentReplicas: number,
|
|
29
|
+
private $uibModalInstance: IModalServiceInstance,
|
|
30
|
+
private application: Application,
|
|
31
|
+
) {
|
|
32
|
+
this.taskMonitor = new TaskMonitor({
|
|
33
|
+
title: `Scaling ${coordinates.name} in ${coordinates.namespace}`,
|
|
34
|
+
application,
|
|
35
|
+
modalInstance: $uibModalInstance,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
this.$scope.command = {
|
|
39
|
+
manifestName: coordinates.name,
|
|
40
|
+
location: coordinates.namespace,
|
|
41
|
+
account: coordinates.account,
|
|
42
|
+
reason: null,
|
|
43
|
+
replicas: currentReplicas,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// used by react components to update command fields in parent (angular) scope
|
|
47
|
+
this.$scope.onChange = () => {
|
|
48
|
+
this.$scope.$applyAsync();
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public isValid(): boolean {
|
|
53
|
+
return this.verification.verified;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public cancel(): void {
|
|
57
|
+
this.$uibModalInstance.dismiss();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public scale(): void {
|
|
61
|
+
this.taskMonitor.submit(() => {
|
|
62
|
+
const payload = copy(this.$scope.command) as any;
|
|
63
|
+
payload.cloudProvider = 'kubernetes';
|
|
64
|
+
|
|
65
|
+
return ManifestWriter.scaleManifest(payload, this.application);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const KUBERNETES_MANIFEST_SCALE_CTRL = 'spinnaker.kubernetes.v2.manifest.scale.controller';
|
|
71
|
+
|
|
72
|
+
module(KUBERNETES_MANIFEST_SCALE_CTRL, [KUBERNETES_SCALE_MANIFEST_SETTINGS_FORM]).controller(
|
|
73
|
+
'kubernetesV2ManifestScaleCtrl',
|
|
74
|
+
KubernetesManifestScaleController,
|
|
75
|
+
);
|