@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,85 @@
|
|
|
1
|
+
import type { ShallowWrapper } from 'enzyme';
|
|
2
|
+
import { shallow } from 'enzyme';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
import { StageConfigField } from '@spinnaker/core';
|
|
6
|
+
|
|
7
|
+
import type { IDeleteManifestOptionsFormProps } from './DeleteManifestOptionsForm';
|
|
8
|
+
import DeleteManifestOptionsForm from './DeleteManifestOptionsForm';
|
|
9
|
+
|
|
10
|
+
describe('<DeleteManifestOptionsForm />', () => {
|
|
11
|
+
let onChangeSpy: jasmine.Spy;
|
|
12
|
+
let props: IDeleteManifestOptionsFormProps;
|
|
13
|
+
let component: ShallowWrapper<IDeleteManifestOptionsFormProps>;
|
|
14
|
+
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
onChangeSpy = jasmine.createSpy('onChangeSpy');
|
|
17
|
+
props = {
|
|
18
|
+
onOptionsChange: onChangeSpy,
|
|
19
|
+
options: {
|
|
20
|
+
cascading: true,
|
|
21
|
+
gracePeriodSeconds: 60,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
component = shallow(<DeleteManifestOptionsForm {...props} />);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe('view', () => {
|
|
28
|
+
it('renders a StageConfigField for Cascading and Grace Period options', () => {
|
|
29
|
+
expect(component.find(StageConfigField).length).toEqual(2);
|
|
30
|
+
expect(component.find(StageConfigField).at(0).prop('label')).toEqual('Cascading');
|
|
31
|
+
expect(component.find(StageConfigField).at(1).prop('label')).toEqual('Grace Period');
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
describe('functionality', () => {
|
|
35
|
+
it('calls `props.onOptionsChange` when cascading is toggled', () => {
|
|
36
|
+
component
|
|
37
|
+
.find(StageConfigField)
|
|
38
|
+
.at(0)
|
|
39
|
+
.find('input')
|
|
40
|
+
.simulate('change', { target: { checked: false } });
|
|
41
|
+
expect(onChangeSpy).toHaveBeenCalledWith({
|
|
42
|
+
cascading: false,
|
|
43
|
+
gracePeriodSeconds: 60,
|
|
44
|
+
});
|
|
45
|
+
component
|
|
46
|
+
.find(StageConfigField)
|
|
47
|
+
.at(0)
|
|
48
|
+
.find('input')
|
|
49
|
+
.simulate('change', { target: { checked: true } });
|
|
50
|
+
expect(onChangeSpy).toHaveBeenCalledWith({
|
|
51
|
+
cascading: true,
|
|
52
|
+
gracePeriodSeconds: 60,
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
it('calls `props.onOptionsChange` when grace period is changed', () => {
|
|
56
|
+
component
|
|
57
|
+
.find(StageConfigField)
|
|
58
|
+
.at(1)
|
|
59
|
+
.find('input')
|
|
60
|
+
.simulate('change', { target: { value: 0 } });
|
|
61
|
+
expect(onChangeSpy).toHaveBeenCalledWith({
|
|
62
|
+
cascading: true,
|
|
63
|
+
gracePeriodSeconds: 0,
|
|
64
|
+
});
|
|
65
|
+
component
|
|
66
|
+
.find(StageConfigField)
|
|
67
|
+
.at(1)
|
|
68
|
+
.find('input')
|
|
69
|
+
.simulate('change', { target: { value: 100 } });
|
|
70
|
+
expect(onChangeSpy).toHaveBeenCalledWith({
|
|
71
|
+
cascading: true,
|
|
72
|
+
gracePeriodSeconds: 100,
|
|
73
|
+
});
|
|
74
|
+
component
|
|
75
|
+
.find(StageConfigField)
|
|
76
|
+
.at(1)
|
|
77
|
+
.find('input')
|
|
78
|
+
.simulate('change', { target: { value: '' } });
|
|
79
|
+
expect(onChangeSpy).toHaveBeenCalledWith({
|
|
80
|
+
cascading: true,
|
|
81
|
+
gracePeriodSeconds: null,
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
});
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { noop, StageConfigField } from '@spinnaker/core';
|
|
4
|
+
|
|
5
|
+
import type { IDeleteOptions } from '../../../manifest/delete/delete.controller';
|
|
6
|
+
|
|
7
|
+
import './deleteManifestOptionsForm.less';
|
|
8
|
+
|
|
9
|
+
export interface IDeleteManifestOptionsFormProps {
|
|
10
|
+
onOptionsChange: (options: IDeleteOptions) => void;
|
|
11
|
+
options: IDeleteOptions;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface IDeleteManifestOptionsFormState {
|
|
15
|
+
options: IDeleteOptions;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default class DeleteManifestOptionsForm extends React.Component<
|
|
19
|
+
IDeleteManifestOptionsFormProps,
|
|
20
|
+
IDeleteManifestOptionsFormState
|
|
21
|
+
> {
|
|
22
|
+
public static defaultProps: Partial<IDeleteManifestOptionsFormProps> = {
|
|
23
|
+
onOptionsChange: noop,
|
|
24
|
+
options: {
|
|
25
|
+
cascading: true,
|
|
26
|
+
gracePeriodSeconds: null,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
public constructor(props: IDeleteManifestOptionsFormProps) {
|
|
31
|
+
super(props);
|
|
32
|
+
this.state = {
|
|
33
|
+
options: props.options,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private setStateAndUpdateStage = (options: IDeleteOptions) => {
|
|
38
|
+
this.props.onOptionsChange(options);
|
|
39
|
+
this.setState({ options });
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
private onCascadingChange = (e: any): void => {
|
|
43
|
+
this.setStateAndUpdateStage({
|
|
44
|
+
...this.state.options,
|
|
45
|
+
cascading: e.target.checked,
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
private onGracePeriodChange = (e: any): void => {
|
|
50
|
+
const integerValue = parseInt(e.target.value, 10);
|
|
51
|
+
const gracePeriodSeconds = !isNaN(integerValue) ? integerValue : null;
|
|
52
|
+
this.setStateAndUpdateStage({
|
|
53
|
+
...this.state.options,
|
|
54
|
+
gracePeriodSeconds,
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
public render() {
|
|
59
|
+
const {
|
|
60
|
+
options: { cascading, gracePeriodSeconds },
|
|
61
|
+
} = this.state;
|
|
62
|
+
return (
|
|
63
|
+
<>
|
|
64
|
+
<StageConfigField helpKey="kubernetes.manifest.delete.cascading" label="Cascading">
|
|
65
|
+
<div className="checkbox">
|
|
66
|
+
<input
|
|
67
|
+
checked={cascading}
|
|
68
|
+
className="delete-manifest-options-input-cascading"
|
|
69
|
+
onChange={this.onCascadingChange}
|
|
70
|
+
type="checkbox"
|
|
71
|
+
/>
|
|
72
|
+
</div>
|
|
73
|
+
</StageConfigField>
|
|
74
|
+
<StageConfigField helpKey="kubernetes.manifest.delete.gracePeriod" label="Grace Period">
|
|
75
|
+
<input
|
|
76
|
+
className="form-control input-sm delete-manifest-options-input-grace-period"
|
|
77
|
+
min="0"
|
|
78
|
+
onChange={this.onGracePeriodChange}
|
|
79
|
+
type="number"
|
|
80
|
+
value={Number.isInteger(gracePeriodSeconds) ? gracePeriodSeconds : ''}
|
|
81
|
+
/>
|
|
82
|
+
<span className="form-control-static">{gracePeriodSeconds === 1 ? 'second' : 'seconds'}</span>
|
|
83
|
+
</StageConfigField>
|
|
84
|
+
</>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { defaults } from 'lodash';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import type { Application, IStage, IStageConfigProps } from '@spinnaker/core';
|
|
5
|
+
|
|
6
|
+
import DeleteManifestOptionsForm from './DeleteManifestOptionsForm';
|
|
7
|
+
import type { IDeleteOptions } from '../../../manifest/delete/delete.controller';
|
|
8
|
+
import type { IManifestSelector } from '../../../manifest/selector/IManifestSelector';
|
|
9
|
+
import { SelectorMode } from '../../../manifest/selector/IManifestSelector';
|
|
10
|
+
import { ManifestSelector } from '../../../manifest/selector/ManifestSelector';
|
|
11
|
+
|
|
12
|
+
export interface IKubernetesManifestStageConfigProps extends IStageConfigProps {
|
|
13
|
+
application: Application;
|
|
14
|
+
stage: IManifestSelector & IStage;
|
|
15
|
+
stageFieldUpdated: () => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export class DeleteManifestStageConfig extends React.Component<IKubernetesManifestStageConfigProps> {
|
|
19
|
+
public componentDidMount = (): void => {
|
|
20
|
+
defaults(this.props.stage, {
|
|
21
|
+
app: this.props.application.name,
|
|
22
|
+
cloudProvider: 'kubernetes',
|
|
23
|
+
});
|
|
24
|
+
if (this.props.stage.isNew) {
|
|
25
|
+
this.props.stage.options = {
|
|
26
|
+
gracePeriodSeconds: null,
|
|
27
|
+
cascading: true,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
this.props.stageFieldUpdated();
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
private onChange = (stage: IManifestSelector): void => {
|
|
34
|
+
Object.assign(this.props.stage, stage);
|
|
35
|
+
this.props.stageFieldUpdated();
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
private onOptionsChange = (options: IDeleteOptions): void => {
|
|
39
|
+
this.props.stage.options = options;
|
|
40
|
+
this.props.stageFieldUpdated();
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
public render() {
|
|
44
|
+
const selector = { ...this.props.stage };
|
|
45
|
+
return (
|
|
46
|
+
<div className="form-horizontal">
|
|
47
|
+
<h4>Manifest</h4>
|
|
48
|
+
<div className="horizontal-rule" />
|
|
49
|
+
<ManifestSelector
|
|
50
|
+
application={this.props.application}
|
|
51
|
+
selector={selector}
|
|
52
|
+
modes={[SelectorMode.Static, SelectorMode.Dynamic, SelectorMode.Label]}
|
|
53
|
+
onChange={this.onChange}
|
|
54
|
+
includeSpinnakerKinds={null}
|
|
55
|
+
/>
|
|
56
|
+
<h4>Settings</h4>
|
|
57
|
+
<div className="horizontal-rule" />
|
|
58
|
+
<DeleteManifestOptionsForm onOptionsChange={this.onOptionsChange} options={this.props.stage.options} />
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { IStage } from '@spinnaker/core';
|
|
2
|
+
import { ExecutionDetailsTasks, Registry } from '@spinnaker/core';
|
|
3
|
+
|
|
4
|
+
import { DeleteManifestStageConfig } from './DeleteManifestStageConfig';
|
|
5
|
+
import { manifestExecutionDetails } from '../ManifestExecutionDetails';
|
|
6
|
+
import { manifestSelectorValidators } from '../validators/manifestSelectorValidators';
|
|
7
|
+
|
|
8
|
+
const STAGE_NAME = 'Delete (Manifest)';
|
|
9
|
+
const STAGE_KEY = 'deleteManifest';
|
|
10
|
+
|
|
11
|
+
Registry.pipeline.registerStage({
|
|
12
|
+
label: STAGE_NAME,
|
|
13
|
+
description: 'Destroy a Kubernetes object created from a manifest.',
|
|
14
|
+
key: STAGE_KEY,
|
|
15
|
+
cloudProvider: 'kubernetes',
|
|
16
|
+
component: DeleteManifestStageConfig,
|
|
17
|
+
executionDetailsSections: [manifestExecutionDetails(STAGE_KEY), ExecutionDetailsTasks],
|
|
18
|
+
accountExtractor: (stage: IStage): string[] => (stage.context.account ? [stage.context.account] : []),
|
|
19
|
+
configAccountExtractor: (stage: any): string[] => (stage.account ? [stage.account] : []),
|
|
20
|
+
validators: manifestSelectorValidators(STAGE_NAME),
|
|
21
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import type { Application, IManifest } from '@spinnaker/core';
|
|
4
|
+
|
|
5
|
+
import { ManifestCopier } from './ManifestCopier';
|
|
6
|
+
|
|
7
|
+
export interface ICopyFromTemplateProps {
|
|
8
|
+
application: Application;
|
|
9
|
+
handleCopy(manifest: IManifest): void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface ICopyFromTemplateState {
|
|
13
|
+
show: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class CopyFromTemplateButton extends React.Component<ICopyFromTemplateProps, ICopyFromTemplateState> {
|
|
17
|
+
constructor(props: ICopyFromTemplateProps) {
|
|
18
|
+
super(props);
|
|
19
|
+
this.state = { show: false };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
private toggle = () => this.setState({ show: !this.state.show });
|
|
23
|
+
|
|
24
|
+
private handleManifestSelected = (manifest: IManifest) => {
|
|
25
|
+
this.props.handleCopy(manifest);
|
|
26
|
+
this.toggle();
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
public render() {
|
|
30
|
+
return (
|
|
31
|
+
<>
|
|
32
|
+
<ManifestCopier
|
|
33
|
+
show={this.state.show}
|
|
34
|
+
application={this.props.application}
|
|
35
|
+
cloudProvider="kubernetes"
|
|
36
|
+
onDismiss={this.toggle}
|
|
37
|
+
onManifestSelected={this.handleManifestSelected}
|
|
38
|
+
/>
|
|
39
|
+
<button className="link" onClick={this.toggle} style={{ paddingLeft: 0 }}>
|
|
40
|
+
Copy from running infrastructure
|
|
41
|
+
</button>
|
|
42
|
+
</>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { cloneDeep } from 'lodash';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { from as observableFrom, Subject } from 'rxjs';
|
|
4
|
+
import { takeUntil } from 'rxjs/operators';
|
|
5
|
+
|
|
6
|
+
import type { IAccountDetails, IStage, IStageConfigProps } from '@spinnaker/core';
|
|
7
|
+
import { AccountService, FormikStageConfig } from '@spinnaker/core';
|
|
8
|
+
|
|
9
|
+
import { DeployManifestStageForm } from './DeployManifestStageForm';
|
|
10
|
+
import { defaultTrafficManagementConfig } from './ManifestDeploymentOptions';
|
|
11
|
+
import { ManifestSource } from '../../../manifest/ManifestSource';
|
|
12
|
+
|
|
13
|
+
interface IDeployManifestStageConfigState {
|
|
14
|
+
accounts: IAccountDetails[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export class DeployManifestStageConfig extends React.Component<IStageConfigProps, IDeployManifestStageConfigState> {
|
|
18
|
+
private stage: IStage;
|
|
19
|
+
private destroy$ = new Subject();
|
|
20
|
+
|
|
21
|
+
public constructor(props: IStageConfigProps) {
|
|
22
|
+
super(props);
|
|
23
|
+
this.state = {
|
|
24
|
+
accounts: [],
|
|
25
|
+
};
|
|
26
|
+
const { stage: initialStageConfig } = props;
|
|
27
|
+
const stage = cloneDeep(initialStageConfig);
|
|
28
|
+
if (!stage.source) {
|
|
29
|
+
stage.source = ManifestSource.TEXT;
|
|
30
|
+
}
|
|
31
|
+
if (!stage.skipExpressionEvaluation) {
|
|
32
|
+
stage.skipExpressionEvaluation = false;
|
|
33
|
+
}
|
|
34
|
+
if (!stage.trafficManagement) {
|
|
35
|
+
stage.trafficManagement = defaultTrafficManagementConfig;
|
|
36
|
+
}
|
|
37
|
+
if (!stage.cloudProvider) {
|
|
38
|
+
stage.cloudProvider = 'kubernetes';
|
|
39
|
+
}
|
|
40
|
+
if (!stage.moniker) {
|
|
41
|
+
stage.moniker = {};
|
|
42
|
+
}
|
|
43
|
+
if (!stage.moniker.app) {
|
|
44
|
+
stage.moniker.app = props.application.name;
|
|
45
|
+
}
|
|
46
|
+
// Intentionally initializing the stage config only once in the constructor
|
|
47
|
+
// The stage config is then completely owned within FormikStageConfig's Formik state
|
|
48
|
+
this.stage = stage;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public componentDidMount() {
|
|
52
|
+
this.fetchAccounts();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
private fetchAccounts = (): void => {
|
|
56
|
+
observableFrom(AccountService.getAllAccountDetailsForProvider('kubernetes'))
|
|
57
|
+
.pipe(takeUntil(this.destroy$))
|
|
58
|
+
.subscribe((accounts: IAccountDetails[]) => {
|
|
59
|
+
this.setState({ accounts });
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
public componentWillUnmount() {
|
|
64
|
+
this.destroy$.next();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public render() {
|
|
68
|
+
return (
|
|
69
|
+
<FormikStageConfig
|
|
70
|
+
{...this.props}
|
|
71
|
+
stage={this.stage}
|
|
72
|
+
onChange={this.props.updateStage}
|
|
73
|
+
render={(props) => <DeployManifestStageForm {...props} accounts={this.state.accounts} />}
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { capitalize, get, isEmpty, map } from 'lodash';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { Option } from 'react-select';
|
|
4
|
+
|
|
5
|
+
import type {
|
|
6
|
+
IAccountDetails,
|
|
7
|
+
IArtifact,
|
|
8
|
+
IExpectedArtifact,
|
|
9
|
+
IFormikStageConfigInjectedProps,
|
|
10
|
+
IManifest,
|
|
11
|
+
} from '@spinnaker/core';
|
|
12
|
+
import {
|
|
13
|
+
ArtifactTypePatterns,
|
|
14
|
+
CheckboxInput,
|
|
15
|
+
RadioButtonInput,
|
|
16
|
+
SETTINGS,
|
|
17
|
+
StageArtifactSelectorDelegate,
|
|
18
|
+
StageConfigField,
|
|
19
|
+
yamlDocumentsToString,
|
|
20
|
+
YamlEditor,
|
|
21
|
+
} from '@spinnaker/core';
|
|
22
|
+
|
|
23
|
+
import { CopyFromTemplateButton } from './CopyFromTemplateButton';
|
|
24
|
+
import type { IManifestBindArtifact } from './ManifestBindArtifactsSelector';
|
|
25
|
+
import { ManifestBindArtifactsSelector } from './ManifestBindArtifactsSelector';
|
|
26
|
+
import { ManifestDeploymentOptions } from './ManifestDeploymentOptions';
|
|
27
|
+
import { NamespaceSelector } from './NamespaceSelector';
|
|
28
|
+
import { ManifestSource } from '../../../manifest/ManifestSource';
|
|
29
|
+
import type { IManifestLabelSelector } from '../../../manifest/selector/IManifestLabelSelector';
|
|
30
|
+
import type { IManifestSelector } from '../../../manifest/selector/IManifestSelector';
|
|
31
|
+
import { SelectorMode } from '../../../manifest/selector/IManifestSelector';
|
|
32
|
+
import LabelEditor from '../../../manifest/selector/labelEditor/LabelEditor';
|
|
33
|
+
import { ManifestBasicSettings } from '../../../manifest/wizard/BasicSettings';
|
|
34
|
+
|
|
35
|
+
interface IDeployManifestStageConfigFormProps {
|
|
36
|
+
accounts: IAccountDetails[];
|
|
37
|
+
selector?: IManifestSelector;
|
|
38
|
+
modes?: SelectorMode.Label;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface IDeployManifestStageConfigFormState {
|
|
42
|
+
rawManifest: string;
|
|
43
|
+
overrideNamespace: boolean;
|
|
44
|
+
selector: IManifestSelector;
|
|
45
|
+
labelSelectors: IManifestLabelSelector[];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export class DeployManifestStageForm extends React.Component<
|
|
49
|
+
IDeployManifestStageConfigFormProps & IFormikStageConfigInjectedProps,
|
|
50
|
+
IDeployManifestStageConfigFormState
|
|
51
|
+
> {
|
|
52
|
+
private readonly excludedManifestArtifactTypes = [
|
|
53
|
+
ArtifactTypePatterns.DOCKER_IMAGE,
|
|
54
|
+
ArtifactTypePatterns.KUBERNETES,
|
|
55
|
+
ArtifactTypePatterns.FRONT50_PIPELINE_TEMPLATE,
|
|
56
|
+
ArtifactTypePatterns.MAVEN_FILE,
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
public constructor(props: IDeployManifestStageConfigFormProps & IFormikStageConfigInjectedProps) {
|
|
60
|
+
super(props);
|
|
61
|
+
const stage = this.props.formik.values;
|
|
62
|
+
const manifests: any[] = get(props.formik.values, 'manifests');
|
|
63
|
+
const isTextManifest: boolean = get(props.formik.values, 'source') === ManifestSource.TEXT;
|
|
64
|
+
this.state = {
|
|
65
|
+
rawManifest: !isEmpty(manifests) && isTextManifest ? yamlDocumentsToString(manifests) : '',
|
|
66
|
+
overrideNamespace: get(stage, 'namespaceOverride', '') !== '',
|
|
67
|
+
selector: {
|
|
68
|
+
account: '',
|
|
69
|
+
location: '',
|
|
70
|
+
mode: SelectorMode.Label,
|
|
71
|
+
labelSelectors: { selectors: [] },
|
|
72
|
+
},
|
|
73
|
+
labelSelectors: [],
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
private getSourceOptions = (): Array<Option<string>> => {
|
|
78
|
+
return map([ManifestSource.TEXT, ManifestSource.ARTIFACT], (option) => ({
|
|
79
|
+
label: capitalize(option),
|
|
80
|
+
value: option,
|
|
81
|
+
}));
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
private handleCopy = (manifest: IManifest): void => {
|
|
85
|
+
this.props.formik.setFieldValue('manifests', [manifest]);
|
|
86
|
+
this.setState({
|
|
87
|
+
rawManifest: yamlDocumentsToString([manifest]),
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
private handleRawManifestChange = (rawManifest: string, manifests: any): void => {
|
|
92
|
+
this.setState({
|
|
93
|
+
rawManifest,
|
|
94
|
+
});
|
|
95
|
+
this.props.formik.setFieldValue('manifests', manifests);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
private onManifestArtifactSelected = (expectedArtifactId: string): void => {
|
|
99
|
+
this.props.formik.setFieldValue('manifestArtifactId', expectedArtifactId);
|
|
100
|
+
this.props.formik.setFieldValue('manifestArtifact', null);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
private onManifestArtifactEdited = (artifact: IArtifact) => {
|
|
104
|
+
this.props.formik.setFieldValue('manifestArtifactId', null);
|
|
105
|
+
this.props.formik.setFieldValue('manifestArtifact', artifact);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
private getRequiredArtifacts = (): IManifestBindArtifact[] => {
|
|
109
|
+
const { requiredArtifactIds, requiredArtifacts } = this.props.formik.values;
|
|
110
|
+
return (requiredArtifactIds || [])
|
|
111
|
+
.map((id: string) => ({ expectedArtifactId: id }))
|
|
112
|
+
.concat(requiredArtifacts || []);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
private onRequiredArtifactsChanged = (bindings: IManifestBindArtifact[]): void => {
|
|
116
|
+
this.props.formik.setFieldValue(
|
|
117
|
+
'requiredArtifactIds',
|
|
118
|
+
bindings.filter((b) => b.expectedArtifactId).map((b) => b.expectedArtifactId),
|
|
119
|
+
);
|
|
120
|
+
this.props.formik.setFieldValue(
|
|
121
|
+
'requiredArtifacts',
|
|
122
|
+
bindings.filter((b) => b.artifact),
|
|
123
|
+
);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
private overrideNamespaceChange(checked: boolean) {
|
|
127
|
+
if (!checked) {
|
|
128
|
+
this.props.formik.setFieldValue('namespaceOverride', '');
|
|
129
|
+
}
|
|
130
|
+
this.setState({ overrideNamespace: checked });
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
public render() {
|
|
134
|
+
const stage = this.props.formik.values;
|
|
135
|
+
return (
|
|
136
|
+
<div className="form-horizontal">
|
|
137
|
+
<h4>Basic Settings</h4>
|
|
138
|
+
<ManifestBasicSettings
|
|
139
|
+
accounts={this.props.accounts}
|
|
140
|
+
onAccountSelect={(accountName) => this.props.formik.setFieldValue('account', accountName)}
|
|
141
|
+
selectedAccount={stage.account}
|
|
142
|
+
/>
|
|
143
|
+
<StageConfigField label="Override Namespace">
|
|
144
|
+
<CheckboxInput
|
|
145
|
+
checked={this.state.overrideNamespace}
|
|
146
|
+
onChange={(e: any) => this.overrideNamespaceChange(e.target.checked)}
|
|
147
|
+
/>
|
|
148
|
+
</StageConfigField>
|
|
149
|
+
{this.state.overrideNamespace && (
|
|
150
|
+
<StageConfigField label="Namespace">
|
|
151
|
+
<NamespaceSelector
|
|
152
|
+
createable={true}
|
|
153
|
+
accounts={this.props.accounts}
|
|
154
|
+
selectedAccount={stage.account}
|
|
155
|
+
selectedNamespace={stage.namespaceOverride || ''}
|
|
156
|
+
onChange={(namespace) => this.props.formik.setFieldValue('namespaceOverride', namespace)}
|
|
157
|
+
/>
|
|
158
|
+
</StageConfigField>
|
|
159
|
+
)}
|
|
160
|
+
<hr />
|
|
161
|
+
<h4>Manifest Configuration</h4>
|
|
162
|
+
<StageConfigField label="Manifest Source" helpKey="kubernetes.manifest.source">
|
|
163
|
+
<RadioButtonInput
|
|
164
|
+
options={this.getSourceOptions()}
|
|
165
|
+
onChange={(e: any) => this.props.formik.setFieldValue('source', e.target.value)}
|
|
166
|
+
value={stage.source}
|
|
167
|
+
/>
|
|
168
|
+
</StageConfigField>
|
|
169
|
+
{stage.source === ManifestSource.TEXT && (
|
|
170
|
+
<StageConfigField label="Manifest">
|
|
171
|
+
<CopyFromTemplateButton application={this.props.application} handleCopy={this.handleCopy} />
|
|
172
|
+
<YamlEditor onChange={this.handleRawManifestChange} value={this.state.rawManifest} />
|
|
173
|
+
</StageConfigField>
|
|
174
|
+
)}
|
|
175
|
+
{stage.source === ManifestSource.ARTIFACT && (
|
|
176
|
+
<>
|
|
177
|
+
<StageArtifactSelectorDelegate
|
|
178
|
+
artifact={stage.manifestArtifact}
|
|
179
|
+
excludedArtifactTypePatterns={this.excludedManifestArtifactTypes}
|
|
180
|
+
expectedArtifactId={stage.manifestArtifactId}
|
|
181
|
+
helpKey="kubernetes.manifest.expectedArtifact"
|
|
182
|
+
label="Manifest Artifact"
|
|
183
|
+
onArtifactEdited={this.onManifestArtifactEdited}
|
|
184
|
+
onExpectedArtifactSelected={(artifact: IExpectedArtifact) => this.onManifestArtifactSelected(artifact.id)}
|
|
185
|
+
pipeline={this.props.pipeline}
|
|
186
|
+
stage={stage}
|
|
187
|
+
/>
|
|
188
|
+
<StageConfigField label="Expression Evaluation" helpKey="kubernetes.manifest.skipExpressionEvaluation">
|
|
189
|
+
<CheckboxInput
|
|
190
|
+
checked={stage.skipExpressionEvaluation === true}
|
|
191
|
+
onChange={(e: any) => this.props.formik.setFieldValue('skipExpressionEvaluation', e.target.checked)}
|
|
192
|
+
text="Skip SpEL expression evaluation"
|
|
193
|
+
/>
|
|
194
|
+
</StageConfigField>
|
|
195
|
+
</>
|
|
196
|
+
)}
|
|
197
|
+
<StageConfigField label="Required Artifacts to Bind" helpKey="kubernetes.manifest.requiredArtifactsToBind">
|
|
198
|
+
<ManifestBindArtifactsSelector
|
|
199
|
+
bindings={this.getRequiredArtifacts()}
|
|
200
|
+
onChangeBindings={this.onRequiredArtifactsChanged}
|
|
201
|
+
pipeline={this.props.pipeline}
|
|
202
|
+
stage={stage}
|
|
203
|
+
/>
|
|
204
|
+
</StageConfigField>
|
|
205
|
+
{SETTINGS.feature.deployManifestStageAdvancedConfiguration && (
|
|
206
|
+
<>
|
|
207
|
+
<hr />
|
|
208
|
+
<h4>Deploy Configuration</h4>
|
|
209
|
+
<StageConfigField label="Skip Spec Template Labels" helpKey="kubernetes.manifest.skipSpecTemplateLabels">
|
|
210
|
+
<CheckboxInput
|
|
211
|
+
checked={stage.skipSpecTemplateLabels === true}
|
|
212
|
+
onChange={(e: any) => this.props.formik.setFieldValue('skipSpecTemplateLabels', e.target.checked)}
|
|
213
|
+
/>
|
|
214
|
+
</StageConfigField>
|
|
215
|
+
<StageConfigField label="Label Selectors" helpKey="kubernetes.manifest.deployLabelSelectors">
|
|
216
|
+
<CheckboxInput
|
|
217
|
+
checked={stage.labelSelectors != null}
|
|
218
|
+
onChange={(e: any) => {
|
|
219
|
+
if (e.target.checked) {
|
|
220
|
+
this.props.formik.setFieldValue('labelSelectors', { selectors: [] });
|
|
221
|
+
this.props.formik.setFieldValue('allowNothingSelected', false);
|
|
222
|
+
} else {
|
|
223
|
+
this.props.formik.setFieldValue('labelSelectors', null);
|
|
224
|
+
this.props.formik.setFieldValue('allowNothingSelected', null);
|
|
225
|
+
}
|
|
226
|
+
}}
|
|
227
|
+
/>
|
|
228
|
+
</StageConfigField>
|
|
229
|
+
{stage.labelSelectors && stage.labelSelectors.selectors && (
|
|
230
|
+
<>
|
|
231
|
+
<StageConfigField label="Labels">
|
|
232
|
+
<LabelEditor
|
|
233
|
+
labelSelectors={this.props.formik.values.labelSelectors.selectors}
|
|
234
|
+
onLabelSelectorsChange={this.handleLabelSelectorsChange}
|
|
235
|
+
/>
|
|
236
|
+
</StageConfigField>
|
|
237
|
+
<StageConfigField
|
|
238
|
+
label="Allow nothing selected"
|
|
239
|
+
helpKey="kubernetes.manifest.deployLabelSelectors.allowNothingSelected"
|
|
240
|
+
>
|
|
241
|
+
<CheckboxInput
|
|
242
|
+
checked={stage.allowNothingSelected === true}
|
|
243
|
+
onChange={(e: any) => this.props.formik.setFieldValue('allowNothingSelected', e.target.checked)}
|
|
244
|
+
/>
|
|
245
|
+
</StageConfigField>
|
|
246
|
+
</>
|
|
247
|
+
)}
|
|
248
|
+
</>
|
|
249
|
+
)}
|
|
250
|
+
<hr />
|
|
251
|
+
<ManifestDeploymentOptions
|
|
252
|
+
accounts={this.props.accounts}
|
|
253
|
+
config={stage.trafficManagement}
|
|
254
|
+
onConfigChange={(config) => this.props.formik.setFieldValue('trafficManagement', config)}
|
|
255
|
+
selectedAccount={stage.account}
|
|
256
|
+
/>
|
|
257
|
+
</div>
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
private handleLabelSelectorsChange = (labelSelectors: IManifestLabelSelector[]): void => {
|
|
262
|
+
this.setState({ labelSelectors });
|
|
263
|
+
this.props.formik.setFieldValue('labelSelectors.selectors', labelSelectors);
|
|
264
|
+
};
|
|
265
|
+
}
|