@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,40 @@
|
|
|
1
|
+
import { find, get, map } from 'lodash';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { Option } from 'react-select';
|
|
4
|
+
import Select, { Creatable } from 'react-select';
|
|
5
|
+
|
|
6
|
+
import type { IAccountDetails } from '@spinnaker/core';
|
|
7
|
+
|
|
8
|
+
export interface INamespaceSelectorProps {
|
|
9
|
+
onChange: (namespace: string) => void;
|
|
10
|
+
accounts: IAccountDetails[];
|
|
11
|
+
selectedAccount: string;
|
|
12
|
+
selectedNamespace: string;
|
|
13
|
+
createable?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class NamespaceSelector extends React.Component<INamespaceSelectorProps> {
|
|
17
|
+
public defaultProps = { createable: false };
|
|
18
|
+
|
|
19
|
+
private getNamespaceOptions(): Array<Option<string>> {
|
|
20
|
+
const { accounts, selectedAccount, selectedNamespace } = this.props;
|
|
21
|
+
const selectedAccountDetails = find(accounts, (a) => a.name === selectedAccount);
|
|
22
|
+
const namespaces = get(selectedAccountDetails, 'namespaces', []);
|
|
23
|
+
const options = map(namespaces, (n) => ({ label: n, value: n }));
|
|
24
|
+
// only create a value for selectedNamespace if it contains a SPeL expression
|
|
25
|
+
if (this.props.createable && selectedNamespace.includes('${')) {
|
|
26
|
+
options.push({ label: selectedNamespace, value: selectedNamespace });
|
|
27
|
+
}
|
|
28
|
+
return options;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public render() {
|
|
32
|
+
const componentProps = {
|
|
33
|
+
clearable: false,
|
|
34
|
+
options: this.getNamespaceOptions(),
|
|
35
|
+
value: this.props.selectedNamespace,
|
|
36
|
+
onChange: (option: Option) => this.props.onChange(option.value.toString()),
|
|
37
|
+
};
|
|
38
|
+
return this.props.createable ? <Creatable {...componentProps} /> : <Select {...componentProps} />;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { get, isEmpty } from 'lodash';
|
|
2
|
+
|
|
3
|
+
import type { ICustomValidator, IPipeline, IStage, IValidatorConfig } from '@spinnaker/core';
|
|
4
|
+
|
|
5
|
+
import { ManifestSource } from '../../../manifest/ManifestSource';
|
|
6
|
+
import { strategyRedBlack } from '../../../rolloutStrategy/redblack.strategy';
|
|
7
|
+
|
|
8
|
+
const MAX_VERSION_HISTORY_ANNOTATION = 'strategy.spinnaker.io/max-version-history';
|
|
9
|
+
|
|
10
|
+
export const deployManifestValidators = (): IValidatorConfig[] => {
|
|
11
|
+
return [
|
|
12
|
+
{ type: 'requiredField', fieldName: 'account', fieldLabel: 'Account' },
|
|
13
|
+
{ type: 'requiredField', fieldName: 'source', fieldLabel: 'Source' },
|
|
14
|
+
{
|
|
15
|
+
type: 'custom',
|
|
16
|
+
validate: (_pipeline: IPipeline, stage: IStage) => {
|
|
17
|
+
const enabled = get(stage, 'trafficManagement.enabled', false);
|
|
18
|
+
const services = get(stage, 'trafficManagement.options.services', []);
|
|
19
|
+
if (enabled && isEmpty(services)) {
|
|
20
|
+
return `Select at least one <strong>Service</strong> to enable Spinnaker-managed rollout strategy options.`;
|
|
21
|
+
}
|
|
22
|
+
if (enabled && stage.source === ManifestSource.TEXT) {
|
|
23
|
+
const manifests = get(stage, 'manifests', []);
|
|
24
|
+
const replicaSetManifests = manifests.filter((m) => m.kind === 'ReplicaSet');
|
|
25
|
+
const strategy = get(stage, 'trafficManagement.options.strategy');
|
|
26
|
+
const maxVersionHistory = parseInt(
|
|
27
|
+
get(replicaSetManifests, [0, 'metadata', 'annotations', MAX_VERSION_HISTORY_ANNOTATION]),
|
|
28
|
+
10,
|
|
29
|
+
);
|
|
30
|
+
if (strategy === strategyRedBlack.key && maxVersionHistory < 2) {
|
|
31
|
+
return `The max version history specified in your manifest conflicts with the behavior of the Red/Black rollout strategy. Please update your <strong>${MAX_VERSION_HISTORY_ANNOTATION}</strong> annotation to a value greater than or equal to 2.`;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
},
|
|
36
|
+
} as ICustomValidator,
|
|
37
|
+
];
|
|
38
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { IStage } from '@spinnaker/core';
|
|
2
|
+
import {
|
|
3
|
+
ArtifactReferenceService,
|
|
4
|
+
ExecutionArtifactTab,
|
|
5
|
+
ExecutionDetailsTasks,
|
|
6
|
+
ExpectedArtifactService,
|
|
7
|
+
Registry,
|
|
8
|
+
} from '@spinnaker/core';
|
|
9
|
+
|
|
10
|
+
import { DeployManifestStageConfig } from './DeployManifestStageConfig';
|
|
11
|
+
import { deployManifestValidators } from './deployManifest.validator';
|
|
12
|
+
import { DeployStatus } from './manifestStatus/DeployStatus';
|
|
13
|
+
|
|
14
|
+
Registry.pipeline.registerStage({
|
|
15
|
+
label: 'Deploy (Manifest)',
|
|
16
|
+
description: 'Deploy a Kubernetes manifest yaml/json file.',
|
|
17
|
+
key: 'deployManifest',
|
|
18
|
+
cloudProvider: 'kubernetes',
|
|
19
|
+
component: DeployManifestStageConfig,
|
|
20
|
+
executionDetailsSections: [DeployStatus, ExecutionDetailsTasks, ExecutionArtifactTab],
|
|
21
|
+
producesArtifacts: true,
|
|
22
|
+
supportsCustomTimeout: true,
|
|
23
|
+
validators: deployManifestValidators(),
|
|
24
|
+
accountExtractor: (stage: IStage): string[] => (stage.context.account ? [stage.context.account] : []),
|
|
25
|
+
configAccountExtractor: (stage: any): string[] => (stage.account ? [stage.account] : []),
|
|
26
|
+
artifactExtractor: ExpectedArtifactService.accumulateArtifacts(['manifestArtifactId', 'requiredArtifactIds']),
|
|
27
|
+
artifactRemover: ArtifactReferenceService.removeArtifactFromFields(['manifestArtifactId', 'requiredArtifactIds']),
|
|
28
|
+
});
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { get } from 'lodash';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import type { IExecutionDetailsSectionProps, IManifest } from '@spinnaker/core';
|
|
5
|
+
import { CollapsibleElement, ExecutionDetailsSection, SETTINGS, StageFailureMessage } from '@spinnaker/core';
|
|
6
|
+
|
|
7
|
+
import { ManifestStatus } from './ManifestStatus';
|
|
8
|
+
import type { IStageManifest } from '../../../../manifest/manifest.service';
|
|
9
|
+
import { KubernetesManifestService } from '../../../../manifest/manifest.service';
|
|
10
|
+
|
|
11
|
+
import './DeployStatus.less';
|
|
12
|
+
|
|
13
|
+
export interface IManifestSubscription {
|
|
14
|
+
id: string;
|
|
15
|
+
unsubscribe: () => void;
|
|
16
|
+
manifest: IManifest;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface IDeployStatusState {
|
|
20
|
+
subscriptions: IManifestSubscription[];
|
|
21
|
+
manifestIds: string[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export class DeployStatus extends React.Component<IExecutionDetailsSectionProps, IDeployStatusState> {
|
|
25
|
+
public static title = 'deployStatus';
|
|
26
|
+
|
|
27
|
+
constructor(props: IExecutionDetailsSectionProps) {
|
|
28
|
+
super(props);
|
|
29
|
+
this.state = { subscriptions: [], manifestIds: [] };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public componentDidMount() {
|
|
33
|
+
this.componentDidUpdate(this.props, this.state);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public componentWillUnmount() {
|
|
37
|
+
this.unsubscribeAll();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public componentDidUpdate(_prevProps: IExecutionDetailsSectionProps, prevState: IDeployStatusState) {
|
|
41
|
+
const manifests: IStageManifest[] = get(this.props.stage, ['context', 'outputs.manifests'], []).filter((m) => !!m);
|
|
42
|
+
const manifestIds = manifests.map((m) => KubernetesManifestService.manifestIdentifier(m)).sort();
|
|
43
|
+
if (prevState.manifestIds.join('') !== manifestIds.join('')) {
|
|
44
|
+
this.unsubscribeAll();
|
|
45
|
+
const subscriptions = manifests.map((manifest) => {
|
|
46
|
+
const id = KubernetesManifestService.manifestIdentifier(manifest);
|
|
47
|
+
return {
|
|
48
|
+
id,
|
|
49
|
+
unsubscribe: this.subscribeToManifestUpdates(id, manifest),
|
|
50
|
+
manifest: this.stageManifestToIManifest(manifest, this.props.stage.context.account),
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
this.setState({ subscriptions, manifestIds });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
private subscribeToManifestUpdates(id: string, manifest: IStageManifest): () => void {
|
|
58
|
+
const params = KubernetesManifestService.stageManifestToManifestParams(manifest, this.props.stage.context.account);
|
|
59
|
+
return KubernetesManifestService.subscribe(this.props.application, params, (updated: IManifest) => {
|
|
60
|
+
const idx = this.state.subscriptions.findIndex((sub) => sub.id === id);
|
|
61
|
+
if (idx !== -1) {
|
|
62
|
+
const subscription = { ...this.state.subscriptions[idx], manifest: updated };
|
|
63
|
+
const subscriptions = [...this.state.subscriptions];
|
|
64
|
+
subscriptions[idx] = subscription;
|
|
65
|
+
this.setState({ subscriptions });
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
private unsubscribeAll() {
|
|
71
|
+
this.state.subscriptions.forEach(({ unsubscribe }) => unsubscribe());
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
private stageManifestToIManifest(manifest: IStageManifest, account: string): IManifest {
|
|
75
|
+
return {
|
|
76
|
+
name: get(manifest, 'metadata.name', ''),
|
|
77
|
+
moniker: null,
|
|
78
|
+
account,
|
|
79
|
+
cloudProvider: 'kubernetes',
|
|
80
|
+
location: get(manifest, 'metadata.namespace', ''),
|
|
81
|
+
manifest: manifest,
|
|
82
|
+
status: {},
|
|
83
|
+
artifacts: [],
|
|
84
|
+
events: [],
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
public render() {
|
|
89
|
+
const { name: sectionName, current: currentSection, stage } = this.props;
|
|
90
|
+
const manifests: IManifest[] = this.state.subscriptions.filter((sub) => !!sub.manifest).map((sub) => sub.manifest);
|
|
91
|
+
return (
|
|
92
|
+
<div className="deploy-status">
|
|
93
|
+
<ExecutionDetailsSection name={sectionName} current={currentSection}>
|
|
94
|
+
{SETTINGS.feature.multiBlockFailureMessages ? (
|
|
95
|
+
stage.failureMessages.map((failureMessage) => (
|
|
96
|
+
<CollapsibleElement key={failureMessage} maxHeight={150}>
|
|
97
|
+
<StageFailureMessage stage={stage} message={failureMessage} />
|
|
98
|
+
</CollapsibleElement>
|
|
99
|
+
))
|
|
100
|
+
) : (
|
|
101
|
+
<StageFailureMessage stage={stage} message={stage.failureMessage} />
|
|
102
|
+
)}
|
|
103
|
+
{!!manifests?.length && (
|
|
104
|
+
<div className="row">
|
|
105
|
+
<div className="col-md-12">
|
|
106
|
+
<div className="well alert alert-info">
|
|
107
|
+
{manifests.map((manifest) => {
|
|
108
|
+
const uid =
|
|
109
|
+
manifest.manifest.metadata.uid || KubernetesManifestService.manifestIdentifier(manifest.manifest);
|
|
110
|
+
return <ManifestStatus key={uid} manifest={manifest} account={stage.context.account} />;
|
|
111
|
+
})}
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
)}
|
|
116
|
+
</ExecutionDetailsSection>
|
|
117
|
+
</div>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IManifest } from '@spinnaker/core';
|
|
3
|
+
|
|
4
|
+
interface IStatusClasses {
|
|
5
|
+
[key: string]: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const STATUS_PILLS: IStatusClasses = {
|
|
9
|
+
available: 'success',
|
|
10
|
+
stable: 'success',
|
|
11
|
+
paused: 'warn',
|
|
12
|
+
failed: 'danger',
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export interface IDeployManifestStatusProps {
|
|
16
|
+
manifest: IManifest;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class DeployManifestStatusPills extends React.Component<IDeployManifestStatusProps> {
|
|
20
|
+
public render() {
|
|
21
|
+
const { manifest } = this.props;
|
|
22
|
+
if (manifest == null || manifest.status == null) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
return Object.keys(manifest.status).map((statusKey, i) => {
|
|
26
|
+
const statusDescription = manifest.status[statusKey];
|
|
27
|
+
const statusClass = STATUS_PILLS[statusKey] || '';
|
|
28
|
+
const isStable = statusDescription.state;
|
|
29
|
+
const isUnstableWithMessage = !isStable && statusDescription.message;
|
|
30
|
+
return (
|
|
31
|
+
<span key={i}>
|
|
32
|
+
{isStable && (
|
|
33
|
+
<span title={statusDescription.message} className={`pill ${statusClass}`}>
|
|
34
|
+
{statusKey}
|
|
35
|
+
</span>
|
|
36
|
+
)}
|
|
37
|
+
{isUnstableWithMessage && (
|
|
38
|
+
<span title={statusDescription.message} className="pill warn">
|
|
39
|
+
{statusKey}
|
|
40
|
+
</span>
|
|
41
|
+
)}
|
|
42
|
+
{(isStable || isUnstableWithMessage) && <span> </span>}
|
|
43
|
+
</span>
|
|
44
|
+
);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { get, trim } from 'lodash';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import type { IManifest } from '@spinnaker/core';
|
|
5
|
+
import { AccountService, ReactInjector } from '@spinnaker/core';
|
|
6
|
+
|
|
7
|
+
const UNMAPPED_K8S_RESOURCE_STATE_KEY = 'kubernetesResource';
|
|
8
|
+
|
|
9
|
+
export interface IManifestDetailsProps {
|
|
10
|
+
manifest: IManifest;
|
|
11
|
+
linkName: string;
|
|
12
|
+
accountId: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface IManifestDetailsState {
|
|
16
|
+
url: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class ManifestDetailsLink extends React.Component<IManifestDetailsProps, IManifestDetailsState> {
|
|
20
|
+
private spinnakerKindStateMap: { [k: string]: string } = {
|
|
21
|
+
// keys from clouddriver's KubernetesSpinnakerKindMap
|
|
22
|
+
serverGroupManagers: 'serverGroupManager',
|
|
23
|
+
serverGroups: 'serverGroup',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
constructor(props: IManifestDetailsProps) {
|
|
27
|
+
super(props);
|
|
28
|
+
this.state = {
|
|
29
|
+
url: '',
|
|
30
|
+
};
|
|
31
|
+
this.loadUrl();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
private canOpen(): boolean {
|
|
35
|
+
return !!this.props.manifest.manifest && !!this.state.url;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
private spinnakerKindFromKubernetesKind(kind: string, kindMap: { [k: string]: string }) {
|
|
39
|
+
const foundKind = Object.keys(kindMap).find((k) => k.toLowerCase() === kind.toLowerCase());
|
|
40
|
+
return kindMap[foundKind];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
private resourceRegion(): string {
|
|
44
|
+
return trim(
|
|
45
|
+
get(this.props, ['manifest', 'manifest', 'metadata', 'annotations', 'artifact.spinnaker.io/location'], ''),
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
private getStateParams(stateKey: string): any {
|
|
50
|
+
const kind = this.props.manifest.manifest.kind.toLowerCase();
|
|
51
|
+
const name = this.props.manifest.manifest.metadata.name;
|
|
52
|
+
const region = this.resourceRegion();
|
|
53
|
+
const params: { [k: string]: string } = {
|
|
54
|
+
accountId: this.props.accountId,
|
|
55
|
+
provider: 'kubernetes',
|
|
56
|
+
region,
|
|
57
|
+
reg: region, // Filters the list of clusters on the Clusters screen to those in the same namespace
|
|
58
|
+
[stateKey]: `${kind} ${name}`,
|
|
59
|
+
};
|
|
60
|
+
if (!params.region && kind === 'namespace' && stateKey === UNMAPPED_K8S_RESOURCE_STATE_KEY) {
|
|
61
|
+
params.region = name;
|
|
62
|
+
}
|
|
63
|
+
if (!params.region || params.region === '') {
|
|
64
|
+
params.region = '_';
|
|
65
|
+
}
|
|
66
|
+
return params;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
private loadUrl() {
|
|
70
|
+
const kind: string = get(this.props, ['manifest', 'manifest', 'kind'], '');
|
|
71
|
+
const { accountId } = this.props;
|
|
72
|
+
AccountService.getAccountDetails(accountId).then((account) => {
|
|
73
|
+
const spinnakerKind = this.spinnakerKindFromKubernetesKind(kind, account.spinnakerKindMap);
|
|
74
|
+
const stateKey = this.spinnakerKindStateMap[spinnakerKind] || UNMAPPED_K8S_RESOURCE_STATE_KEY;
|
|
75
|
+
const params = this.getStateParams(stateKey);
|
|
76
|
+
const url = ReactInjector.$state.href(`home.applications.application.insight.clusters.${stateKey}`, params);
|
|
77
|
+
this.setState({ url });
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public render() {
|
|
82
|
+
if (this.canOpen()) {
|
|
83
|
+
return (
|
|
84
|
+
<a href={this.state.url} className="clickable">
|
|
85
|
+
{this.props.linkName}
|
|
86
|
+
</a>
|
|
87
|
+
);
|
|
88
|
+
} else {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { get, trim } from 'lodash';
|
|
2
|
+
import { DateTime } from 'luxon';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
import type { IManifest, IManifestEvent } from '@spinnaker/core';
|
|
6
|
+
import { JobEventBasedPodNameProvider, JobManifestPodLogs, relativeTime } from '@spinnaker/core';
|
|
7
|
+
|
|
8
|
+
export interface IManifestEventsProps {
|
|
9
|
+
manifest: IManifest;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export class ManifestEvents extends React.Component<IManifestEventsProps> {
|
|
13
|
+
private pillStyle(e: IManifestEvent): string {
|
|
14
|
+
if (e.type === 'Warning') {
|
|
15
|
+
return 'alert';
|
|
16
|
+
} else if (e.type === 'Normal') {
|
|
17
|
+
return 'success';
|
|
18
|
+
} else {
|
|
19
|
+
return '';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public render() {
|
|
24
|
+
if (!this.props.manifest) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
if (this.props.manifest && (!this.props.manifest.events || this.props.manifest.events.length === 0)) {
|
|
28
|
+
return <div>No recent events found - Kubernetes does not store events for long.</div>;
|
|
29
|
+
}
|
|
30
|
+
const { events } = this.props.manifest;
|
|
31
|
+
const namespace = trim(
|
|
32
|
+
get(this.props.manifest, ['manifest', 'metadata', 'annotations', 'artifact.spinnaker.io/location'], ''),
|
|
33
|
+
);
|
|
34
|
+
return events.map((e, i) => {
|
|
35
|
+
const firstTimestamp = get(e, 'firstTimestamp', '');
|
|
36
|
+
const lastTimestamp = get(e, 'lastTimestamp', '');
|
|
37
|
+
let firstEpochMilliseconds = 0;
|
|
38
|
+
let lastEpochMilliseconds = 0;
|
|
39
|
+
if (firstTimestamp) {
|
|
40
|
+
firstEpochMilliseconds = DateTime.fromISO(firstTimestamp).toMillis();
|
|
41
|
+
}
|
|
42
|
+
if (lastTimestamp) {
|
|
43
|
+
lastEpochMilliseconds = DateTime.fromISO(lastTimestamp).toMillis();
|
|
44
|
+
}
|
|
45
|
+
return (
|
|
46
|
+
<div key={get(e, ['metadata', 'uid'], String(i))} className="info">
|
|
47
|
+
<div className="horizontal">
|
|
48
|
+
{e.count && (
|
|
49
|
+
<div className={`pill ${this.pillStyle(e)}`}>
|
|
50
|
+
{e.count} × <b>{e.reason}</b>
|
|
51
|
+
</div>
|
|
52
|
+
)}
|
|
53
|
+
</div>
|
|
54
|
+
{(e.firstTimestamp || e.lastTimestamp) && (
|
|
55
|
+
<div>
|
|
56
|
+
{e.firstTimestamp === e.lastTimestamp && (
|
|
57
|
+
<div>
|
|
58
|
+
<i>{relativeTime(firstEpochMilliseconds)}</i>
|
|
59
|
+
</div>
|
|
60
|
+
)}
|
|
61
|
+
{e.firstTimestamp !== e.lastTimestamp && (
|
|
62
|
+
<div>
|
|
63
|
+
<div>
|
|
64
|
+
First Occurrence: <i>{relativeTime(firstEpochMilliseconds)}</i>
|
|
65
|
+
</div>
|
|
66
|
+
<div>
|
|
67
|
+
Last Occurrence: <i>{relativeTime(lastEpochMilliseconds)}</i>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
)}
|
|
71
|
+
</div>
|
|
72
|
+
)}
|
|
73
|
+
<div>{e.message}</div>
|
|
74
|
+
<div>
|
|
75
|
+
<JobManifestPodLogs
|
|
76
|
+
account={this.props.manifest.account}
|
|
77
|
+
location={namespace}
|
|
78
|
+
podNamesProviders={[new JobEventBasedPodNameProvider(this.props.manifest, e)]}
|
|
79
|
+
linkName="Console Output (Raw)"
|
|
80
|
+
/>
|
|
81
|
+
</div>
|
|
82
|
+
{i !== events.length - 1 && <br />}
|
|
83
|
+
</div>
|
|
84
|
+
);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
dl.manifest-status {
|
|
2
|
+
display: block;
|
|
3
|
+
margin: 0;
|
|
4
|
+
|
|
5
|
+
dt,
|
|
6
|
+
dd {
|
|
7
|
+
display: inline-block;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
dt {
|
|
11
|
+
margin-right: 4px;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.manifest-support-links {
|
|
16
|
+
margin: 0 0 1em;
|
|
17
|
+
a {
|
|
18
|
+
margin-right: 2em;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.manifest-events {
|
|
23
|
+
margin: 0 0 2em;
|
|
24
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { dump } from 'js-yaml';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import type { IManifest } from '@spinnaker/core';
|
|
5
|
+
import { CopyToClipboard, ManifestYaml } from '@spinnaker/core';
|
|
6
|
+
|
|
7
|
+
import { DeployManifestStatusPills } from './DeployStatusPills';
|
|
8
|
+
import { ManifestDetailsLink } from './ManifestDetailsLink';
|
|
9
|
+
import { ManifestEvents } from './ManifestEvents';
|
|
10
|
+
|
|
11
|
+
import './ManifestStatus.less';
|
|
12
|
+
|
|
13
|
+
export interface IManifestStatusProps {
|
|
14
|
+
account: string;
|
|
15
|
+
manifest: IManifest;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function ManifestStatus({ account, manifest }: IManifestStatusProps) {
|
|
19
|
+
return (
|
|
20
|
+
<>
|
|
21
|
+
<dl className="manifest-status" key="manifest-status">
|
|
22
|
+
<dt>{manifest.manifest.kind}</dt>
|
|
23
|
+
<dd>
|
|
24
|
+
<CopyToClipboard
|
|
25
|
+
displayText={true}
|
|
26
|
+
text={manifest.manifest.metadata.name}
|
|
27
|
+
toolTip={`Copy ${manifest.manifest.metadata.name}`}
|
|
28
|
+
/>
|
|
29
|
+
|
|
30
|
+
<DeployManifestStatusPills manifest={manifest} />
|
|
31
|
+
</dd>
|
|
32
|
+
</dl>
|
|
33
|
+
<div className="manifest-support-links" key="manifest-support-links">
|
|
34
|
+
<ManifestYaml
|
|
35
|
+
linkName="YAML"
|
|
36
|
+
manifestText={dump(manifest.manifest)}
|
|
37
|
+
modalTitle={manifest.manifest.metadata.name}
|
|
38
|
+
/>
|
|
39
|
+
<ManifestDetailsLink linkName="Details" manifest={manifest} accountId={account} />
|
|
40
|
+
</div>
|
|
41
|
+
<div className="manifest-events pad-left" key="manifest-events">
|
|
42
|
+
<ManifestEvents manifest={manifest} />
|
|
43
|
+
</div>
|
|
44
|
+
</>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { defaults } from 'lodash';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
import type { IFormikStageConfigInjectedProps, IStageConfigProps } from '@spinnaker/core';
|
|
6
|
+
import { FormikStageConfig } from '@spinnaker/core';
|
|
7
|
+
|
|
8
|
+
import { FindArtifactsFromResourceStageForm } from './FindArtifactsFromResourceStageForm';
|
|
9
|
+
|
|
10
|
+
export function FindArtifactsFromResourceConfig({
|
|
11
|
+
application,
|
|
12
|
+
pipeline,
|
|
13
|
+
stage,
|
|
14
|
+
updateStage,
|
|
15
|
+
stageFieldUpdated,
|
|
16
|
+
}: IStageConfigProps) {
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
defaults(stage, {
|
|
19
|
+
app: application.name,
|
|
20
|
+
cloudProvider: 'kubernetes',
|
|
21
|
+
});
|
|
22
|
+
}, []);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<FormikStageConfig
|
|
26
|
+
application={application}
|
|
27
|
+
pipeline={pipeline}
|
|
28
|
+
stage={stage}
|
|
29
|
+
onChange={updateStage}
|
|
30
|
+
render={(props: IFormikStageConfigInjectedProps) => (
|
|
31
|
+
<FindArtifactsFromResourceStageForm {...props} stageFieldUpdated={stageFieldUpdated} />
|
|
32
|
+
)}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import type { IFormikStageConfigInjectedProps } from '@spinnaker/core';
|
|
4
|
+
|
|
5
|
+
import type { IManifestSelector } from '../../../manifest/selector/IManifestSelector';
|
|
6
|
+
import { SelectorMode } from '../../../manifest/selector/IManifestSelector';
|
|
7
|
+
import { ManifestSelector } from '../../../manifest/selector/ManifestSelector';
|
|
8
|
+
|
|
9
|
+
interface IFindArtifactsFromResourceStageConfigFormProps {
|
|
10
|
+
stageFieldUpdated: () => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function FindArtifactsFromResourceStageForm({
|
|
14
|
+
application,
|
|
15
|
+
formik,
|
|
16
|
+
stageFieldUpdated,
|
|
17
|
+
}: IFindArtifactsFromResourceStageConfigFormProps & IFormikStageConfigInjectedProps) {
|
|
18
|
+
const stage = formik.values;
|
|
19
|
+
|
|
20
|
+
const onManifestSelectorChange = () => {
|
|
21
|
+
stageFieldUpdated();
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div className="form-horizontal">
|
|
26
|
+
<h4>Manifest</h4>
|
|
27
|
+
<div className="horizontal-rule" />
|
|
28
|
+
<ManifestSelector
|
|
29
|
+
application={application}
|
|
30
|
+
selector={(stage as unknown) as IManifestSelector}
|
|
31
|
+
modes={[SelectorMode.Static, SelectorMode.Dynamic]}
|
|
32
|
+
onChange={onManifestSelectorChange}
|
|
33
|
+
includeSpinnakerKinds={null}
|
|
34
|
+
/>
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { IStage } from '@spinnaker/core';
|
|
2
|
+
import { ExecutionArtifactTab, ExecutionDetailsTasks, Registry } from '@spinnaker/core';
|
|
3
|
+
|
|
4
|
+
import { FindArtifactsFromResourceConfig } from './FindArtifactsFromResourceConfig';
|
|
5
|
+
import { manifestSelectorValidators } from '../validators/manifestSelectorValidators';
|
|
6
|
+
|
|
7
|
+
const STAGE_NAME = 'Find Artifacts From Resource (Manifest)';
|
|
8
|
+
const STAGE_KEY = 'findArtifactsFromResource';
|
|
9
|
+
|
|
10
|
+
Registry.pipeline.registerStage({
|
|
11
|
+
label: STAGE_NAME,
|
|
12
|
+
description: 'Finds artifacts from a Kubernetes resource.',
|
|
13
|
+
key: STAGE_KEY,
|
|
14
|
+
cloudProvider: 'kubernetes',
|
|
15
|
+
component: FindArtifactsFromResourceConfig,
|
|
16
|
+
executionDetailsSections: [ExecutionDetailsTasks, ExecutionArtifactTab],
|
|
17
|
+
producesArtifacts: true,
|
|
18
|
+
validators: manifestSelectorValidators(STAGE_NAME),
|
|
19
|
+
accountExtractor: (stage: IStage): string[] => (stage.context.account ? [stage.context.account] : []),
|
|
20
|
+
configAccountExtractor: (stage: any): string[] => (stage.account ? [stage.account] : []),
|
|
21
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './deleteManifest/deleteManifestStage';
|
|
2
|
+
export * from './deployManifest/deployManifestStage';
|
|
3
|
+
export * from './findArtifactsFromResource/findArtifactsFromResourceStage';
|
|
4
|
+
export * from './patchManifest/patchManifestStage';
|
|
5
|
+
export * from './rolloutRestartManifest/rolloutRestartManifestStage';
|
|
6
|
+
export * from './runJob/runJobStage';
|
|
7
|
+
export * from './undoRolloutManifest/undoRolloutManifestStage';
|
|
8
|
+
export * from './scaleManifest/scaleManifestStage';
|