@spinnaker/kubernetes 0.6.1 → 2025.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/index.js +6023 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/manifest/scale/ScaleSettingsForm.d.ts +10 -0
  5. package/dist/manifest/scale/scale.controller.d.ts +7 -0
  6. package/dist/pipelines/stages/deployManifest/DeployManifestStageForm.d.ts +8 -0
  7. package/dist/pipelines/stages/findArtifactsFromResource/FindArtifactsFromResourceConfig.d.ts +3 -0
  8. package/dist/pipelines/stages/findArtifactsFromResource/FindArtifactsFromResourceStageForm.d.ts +7 -0
  9. package/dist/pipelines/stages/findArtifactsFromResource/findArtifactsFromResourceStage.d.ts +1 -1
  10. package/dist/pipelines/stages/index.d.ts +3 -0
  11. package/dist/pipelines/stages/scaleManifest/ScaleManifestConfig.d.ts +3 -0
  12. package/dist/pipelines/stages/scaleManifest/ScaleManifestStageForm.d.ts +7 -0
  13. package/dist/pipelines/stages/scaleManifest/scaleManifestStage.d.ts +1 -1
  14. package/dist/pipelines/stages/undoRolloutManifest/UndoRolloutManifestConfig.d.ts +3 -0
  15. package/dist/pipelines/stages/undoRolloutManifest/UndoRolloutManifestStageForm.d.ts +7 -0
  16. package/dist/pipelines/stages/undoRolloutManifest/undoRolloutManifestStage.d.ts +1 -1
  17. package/package.json +5 -4
  18. package/src/help/kubernetes.help.ts +6 -0
  19. package/src/kubernetes.module.ts +0 -6
  20. package/src/manifest/scale/ScaleSettingsForm.tsx +43 -0
  21. package/src/manifest/scale/scale.controller.ts +11 -6
  22. package/src/manifest/scale/scale.html +9 -4
  23. package/src/manifest/scale/scaleSettingsForm.component.ts +4 -22
  24. package/src/pipelines/stages/deleteManifest/deleteManifestStage.ts +1 -1
  25. package/src/pipelines/stages/deployManifest/DeployManifestStageForm.tsx +66 -0
  26. package/src/pipelines/stages/deployManifest/deployManifestStage.ts +1 -1
  27. package/src/pipelines/stages/findArtifactsFromResource/FindArtifactsFromResourceConfig.tsx +35 -0
  28. package/src/pipelines/stages/findArtifactsFromResource/FindArtifactsFromResourceStageForm.tsx +37 -0
  29. package/src/pipelines/stages/findArtifactsFromResource/findArtifactsFromResourceStage.ts +16 -23
  30. package/src/pipelines/stages/index.ts +3 -0
  31. package/src/pipelines/stages/scaleManifest/ScaleManifestConfig.tsx +38 -0
  32. package/src/pipelines/stages/scaleManifest/ScaleManifestStageForm.tsx +46 -0
  33. package/src/pipelines/stages/scaleManifest/scaleManifestStage.ts +17 -26
  34. package/src/pipelines/stages/undoRolloutManifest/UndoRolloutManifestConfig.tsx +37 -0
  35. package/src/pipelines/stages/undoRolloutManifest/UndoRolloutManifestStageForm.tsx +60 -0
  36. package/src/pipelines/stages/undoRolloutManifest/undoRolloutManifestStage.ts +18 -27
  37. package/dist/pipelines/stages/findArtifactsFromResource/findArtifactsFromResourceConfig.controller.d.ts +0 -9
  38. package/dist/pipelines/stages/scaleManifest/scaleManifestConfig.controller.d.ts +0 -9
  39. package/dist/pipelines/stages/undoRolloutManifest/undoRolloutManifestConfig.controller.d.ts +0 -7
  40. package/src/pipelines/stages/findArtifactsFromResource/findArtifactsFromResourceConfig.controller.ts +0 -28
  41. package/src/pipelines/stages/findArtifactsFromResource/findArtifactsFromResourceConfig.html +0 -10
  42. package/src/pipelines/stages/scaleManifest/scaleManifestConfig.controller.ts +0 -32
  43. package/src/pipelines/stages/scaleManifest/scaleManifestConfig.html +0 -13
  44. package/src/pipelines/stages/undoRolloutManifest/undoRolloutManifestConfig.controller.ts +0 -19
  45. package/src/pipelines/stages/undoRolloutManifest/undoRolloutManifestConfig.html +0 -28
@@ -0,0 +1,46 @@
1
+ import React from 'react';
2
+
3
+ import type { IFormikStageConfigInjectedProps } from '@spinnaker/core';
4
+
5
+ import type { IScaleCommand } from '../../../manifest';
6
+ import { ScaleSettingsForm } from '../../../manifest/scale/ScaleSettingsForm';
7
+ import type { IManifestSelector } from '../../../manifest/selector/IManifestSelector';
8
+ import { SelectorMode } from '../../../manifest/selector/IManifestSelector';
9
+ import { ManifestSelector } from '../../../manifest/selector/ManifestSelector';
10
+
11
+ interface IScaleManifestStageConfigFormProps {
12
+ stageFieldUpdated: () => void;
13
+ }
14
+
15
+ export function ScaleManifestStageForm({
16
+ application,
17
+ formik,
18
+ stageFieldUpdated,
19
+ }: IScaleManifestStageConfigFormProps & IFormikStageConfigInjectedProps) {
20
+ const stage = formik.values;
21
+
22
+ const onManifestSelectorChange = () => {
23
+ stageFieldUpdated();
24
+ };
25
+
26
+ const onScaleSettingsFormChange = () => {
27
+ stageFieldUpdated();
28
+ };
29
+
30
+ return (
31
+ <div className="form-horizontal">
32
+ <h4>Manifest</h4>
33
+ <div className="horizontal-rule" />
34
+ <ManifestSelector
35
+ application={application}
36
+ selector={(stage as unknown) as IManifestSelector}
37
+ modes={[SelectorMode.Static, SelectorMode.Dynamic]}
38
+ onChange={onManifestSelectorChange}
39
+ includeSpinnakerKinds={null}
40
+ />
41
+ <h4>Settings</h4>
42
+ <div className="horizontal-rule" />
43
+ <ScaleSettingsForm options={(stage as unknown) as IScaleCommand} onChange={onScaleSettingsFormChange} />
44
+ </div>
45
+ );
46
+ }
@@ -1,33 +1,24 @@
1
- import { module } from 'angular';
2
-
3
1
  import type { IStage } from '@spinnaker/core';
4
2
  import { ExecutionDetailsTasks, Registry } from '@spinnaker/core';
5
3
 
6
4
  import { manifestExecutionDetails } from '../ManifestExecutionDetails';
7
- import { KUBERNETES_SCALE_MANIFEST_SETTINGS_FORM } from '../../../manifest/scale/scaleSettingsForm.component';
8
- import { KubernetesV2ScaleManifestConfigCtrl } from './scaleManifestConfig.controller';
5
+ import { ScaleManifestStageConfig } from './ScaleManifestConfig';
6
+ import { manifestSelectorValidators } from '../validators/manifestSelectorValidators';
9
7
 
10
- export const KUBERNETES_SCALE_MANIFEST_STAGE = 'spinnaker.kubernetes.v2.pipeline.stage.scaleManifestStage';
8
+ const STAGE_NAME = 'Scale (Manifest)';
11
9
  const STAGE_KEY = 'scaleManifest';
12
10
 
13
- module(KUBERNETES_SCALE_MANIFEST_STAGE, [KUBERNETES_SCALE_MANIFEST_SETTINGS_FORM])
14
- .config(() => {
15
- Registry.pipeline.registerStage({
16
- label: 'Scale (Manifest)',
17
- description: 'Scale a Kubernetes object created from a manifest.',
18
- key: STAGE_KEY,
19
- cloudProvider: 'kubernetes',
20
- templateUrl: require('./scaleManifestConfig.html'),
21
- controller: 'KubernetesV2ScaleManifestConfigCtrl',
22
- controllerAs: 'ctrl',
23
- executionDetailsSections: [manifestExecutionDetails(STAGE_KEY), ExecutionDetailsTasks],
24
- accountExtractor: (stage: IStage): string[] => (stage.account ? [stage.account] : []),
25
- configAccountExtractor: (stage: any): string[] => (stage.account ? [stage.account] : []),
26
- validators: [
27
- { type: 'requiredField', fieldName: 'location', fieldLabel: 'Namespace' },
28
- { type: 'requiredField', fieldName: 'account', fieldLabel: 'Account' },
29
- { type: 'requiredField', fieldName: 'replicas', fieldLabel: 'Replicas' },
30
- ],
31
- });
32
- })
33
- .controller('KubernetesV2ScaleManifestConfigCtrl', KubernetesV2ScaleManifestConfigCtrl);
11
+ Registry.pipeline.registerStage({
12
+ label: STAGE_NAME,
13
+ description: 'Scale a Kubernetes object created from a manifest.',
14
+ key: STAGE_KEY,
15
+ cloudProvider: 'kubernetes',
16
+ component: ScaleManifestStageConfig,
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: [
21
+ ...manifestSelectorValidators(STAGE_NAME),
22
+ { type: 'requiredField', fieldName: 'replicas', fieldLabel: 'Replicas' },
23
+ ],
24
+ });
@@ -0,0 +1,37 @@
1
+ import { defaults } from 'lodash';
2
+ import React, { useEffect } from 'react';
3
+
4
+ import type { IFormikStageConfigInjectedProps, IStageConfigProps } from '@spinnaker/core';
5
+ import { FormikStageConfig } from '@spinnaker/core';
6
+
7
+ import { UndoRolloutManifestStageForm } from './UndoRolloutManifestStageForm';
8
+
9
+ export function UndoRolloutManifestConfig({
10
+ application,
11
+ pipeline,
12
+ stage,
13
+ updateStage,
14
+ stageFieldUpdated,
15
+ }: IStageConfigProps) {
16
+ useEffect(() => {
17
+ defaults(stage, {
18
+ cloudProvider: 'kubernetes',
19
+ });
20
+
21
+ if (stage.isNew) {
22
+ stage.numRevisionsBack = 1;
23
+ }
24
+ }, []);
25
+
26
+ return (
27
+ <FormikStageConfig
28
+ application={application}
29
+ pipeline={pipeline}
30
+ stage={stage}
31
+ onChange={updateStage}
32
+ render={(props: IFormikStageConfigInjectedProps) => (
33
+ <UndoRolloutManifestStageForm {...props} stageFieldUpdated={stageFieldUpdated} />
34
+ )}
35
+ />
36
+ );
37
+ }
@@ -0,0 +1,60 @@
1
+ import React from 'react';
2
+
3
+ import type { IFormikStageConfigInjectedProps } from '@spinnaker/core';
4
+ import { NumberInput, StageConfigField } from '@spinnaker/core';
5
+
6
+ import type { IManifestSelector } from '../../../manifest/selector/IManifestSelector';
7
+ import { SelectorMode } from '../../../manifest/selector/IManifestSelector';
8
+ import { ManifestSelector } from '../../../manifest/selector/ManifestSelector';
9
+
10
+ interface IUndoRolloutManifestStageConfigFormProps {
11
+ stageFieldUpdated: () => void;
12
+ }
13
+
14
+ export function UndoRolloutManifestStageForm({
15
+ application,
16
+ formik,
17
+ stageFieldUpdated,
18
+ }: IUndoRolloutManifestStageConfigFormProps & IFormikStageConfigInjectedProps) {
19
+ const stage = formik.values;
20
+
21
+ const onManifestSelectorChange = () => {
22
+ stageFieldUpdated();
23
+ };
24
+
25
+ const onRevisionsChange = (e: React.ChangeEvent<any>) => {
26
+ formik.setFieldValue('numRevisionsBack', e.target.value);
27
+ };
28
+
29
+ return (
30
+ <div className="form-horizontal">
31
+ <h4>Manifest</h4>
32
+ <div className="horizontal-rule" />
33
+ <ManifestSelector
34
+ application={application}
35
+ selector={(stage as unknown) as IManifestSelector}
36
+ modes={[SelectorMode.Static, SelectorMode.Dynamic]}
37
+ onChange={onManifestSelectorChange}
38
+ includeSpinnakerKinds={null}
39
+ />
40
+ <h4>Settings</h4>
41
+ <div className="horizontal-rule" />
42
+ <StageConfigField
43
+ label="Revisions Back"
44
+ helpKey="kubernetes.manifest.undoRollout.revisionsBack"
45
+ fieldColumns={4}
46
+ groupClassName="form-group form-inline"
47
+ >
48
+ <div className="input-group">
49
+ <NumberInput
50
+ inputClassName="input-sm highlight-pristine"
51
+ onChange={onRevisionsChange}
52
+ value={stage.numRevisionsBack}
53
+ min={1}
54
+ />
55
+ <span className="input-group-addon">{stage.numRevisionsBack === '1' ? 'revision' : 'revisions'}</span>
56
+ </div>
57
+ </StageConfigField>
58
+ </div>
59
+ );
60
+ }
@@ -1,30 +1,21 @@
1
- import { module } from 'angular';
1
+ import { ExecutionDetailsTasks, Registry } from '@spinnaker/core';
2
2
 
3
- import type { IStage } from '@spinnaker/core';
4
- import { Registry } from '@spinnaker/core';
3
+ import { manifestExecutionDetails } from '../ManifestExecutionDetails';
4
+ import { UndoRolloutManifestConfig } from './UndoRolloutManifestConfig';
5
+ import { manifestSelectorValidators } from '../validators/manifestSelectorValidators';
5
6
 
6
- import { KubernetesV2UndoRolloutManifestConfigCtrl } from './undoRolloutManifestConfig.controller';
7
+ const STAGE_NAME = 'Undo Rollout (Manifest)';
8
+ const STAGE_KEY = 'undoRolloutManifest';
7
9
 
8
- export const KUBERNETES_UNDO_ROLLOUT_MANIFEST_STAGE = 'spinnaker.kubernetes.v2.pipeline.stage.undoRolloutManifestStage';
9
-
10
- module(KUBERNETES_UNDO_ROLLOUT_MANIFEST_STAGE, [])
11
- .config(() => {
12
- Registry.pipeline.registerStage({
13
- label: 'Undo Rollout (Manifest)',
14
- description: 'Rollback a manifest a target number of revisions.',
15
- key: 'undoRolloutManifest',
16
- cloudProvider: 'kubernetes',
17
- templateUrl: require('./undoRolloutManifestConfig.html'),
18
- controller: 'KubernetesV2UndoRolloutManifestConfigCtrl',
19
- controllerAs: 'ctrl',
20
- accountExtractor: (stage: IStage): string[] => (stage.account ? [stage.account] : []),
21
- configAccountExtractor: (stage: any): string[] => (stage.account ? [stage.account] : []),
22
- validators: [
23
- { type: 'requiredField', fieldName: 'location', fieldLabel: 'Namespace' },
24
- { type: 'requiredField', fieldName: 'account', fieldLabel: 'Account' },
25
- { type: 'requiredField', fieldName: 'numRevisionsBack', fieldLabel: 'Number of Revisions' },
26
- { type: 'manifestSelector' },
27
- ],
28
- });
29
- })
30
- .controller('KubernetesV2UndoRolloutManifestConfigCtrl', KubernetesV2UndoRolloutManifestConfigCtrl);
10
+ Registry.pipeline.registerStage({
11
+ label: STAGE_NAME,
12
+ description: 'Rollback a manifest a target number of revisions.',
13
+ key: STAGE_KEY,
14
+ cloudProvider: 'kubernetes',
15
+ component: UndoRolloutManifestConfig,
16
+ executionDetailsSections: [manifestExecutionDetails(STAGE_KEY), ExecutionDetailsTasks],
17
+ validators: [
18
+ ...manifestSelectorValidators(STAGE_NAME),
19
+ { type: 'requiredField', fieldName: 'numRevisionsBack', fieldLabel: 'Number of Revisions' },
20
+ ],
21
+ });
@@ -1,9 +0,0 @@
1
- import type { IController, IScope } from 'angular';
2
- import type { Application } from '@spinnaker/core';
3
- export declare class KubernetesV2FindArtifactsFromResourceConfigCtrl implements IController {
4
- private $scope;
5
- application: Application;
6
- static $inject: string[];
7
- constructor($scope: IScope);
8
- handleManifestSelectorChange: () => void;
9
- }
@@ -1,9 +0,0 @@
1
- import type { IController, IScope } from 'angular';
2
- import type { Application } from '@spinnaker/core';
3
- export declare class KubernetesV2ScaleManifestConfigCtrl implements IController {
4
- private $scope;
5
- application: Application;
6
- static $inject: string[];
7
- constructor($scope: IScope);
8
- handleManifestSelectorChange: () => void;
9
- }
@@ -1,7 +0,0 @@
1
- import type { IController, IScope } from 'angular';
2
- export declare class KubernetesV2UndoRolloutManifestConfigCtrl implements IController {
3
- private $scope;
4
- static $inject: string[];
5
- constructor($scope: IScope);
6
- handleManifestSelectorChange: () => void;
7
- }
@@ -1,28 +0,0 @@
1
- import type { IController, IScope } from 'angular';
2
-
3
- import type { Application } from '@spinnaker/core';
4
-
5
- import type { IManifestSelector } from '../../../manifest/selector/IManifestSelector';
6
-
7
- export class KubernetesV2FindArtifactsFromResourceConfigCtrl implements IController {
8
- public application: Application;
9
-
10
- public static $inject = ['$scope'];
11
- constructor(private $scope: IScope) {
12
- this.application = this.$scope.$parent.application;
13
- if (this.$scope.stage.isNew) {
14
- const defaultSelection: IManifestSelector = {
15
- location: '',
16
- account: '',
17
- manifestName: '',
18
- app: this.application.name,
19
- };
20
- Object.assign(this.$scope.stage, defaultSelection);
21
- this.$scope.stage.cloudProvider = 'kubernetes';
22
- }
23
- }
24
-
25
- public handleManifestSelectorChange = (): void => {
26
- this.$scope.$applyAsync();
27
- };
28
- }
@@ -1,10 +0,0 @@
1
- <div class="form-horizontal">
2
- <h4>Manifest</h4>
3
- <div class="horizontal-rule"></div>
4
- <kubernetes-manifest-selector
5
- modes="['static', 'dynamic']"
6
- application="ctrl.application"
7
- on-change="ctrl.handleManifestSelectorChange"
8
- selector="ctrl.$scope.stage"
9
- ></kubernetes-manifest-selector>
10
- </div>
@@ -1,32 +0,0 @@
1
- import type { IController, IScope } from 'angular';
2
- import { defaults } from 'lodash';
3
-
4
- import type { Application } from '@spinnaker/core';
5
-
6
- import type { IManifestSelector } from '../../../manifest/selector/IManifestSelector';
7
-
8
- export class KubernetesV2ScaleManifestConfigCtrl implements IController {
9
- public application: Application;
10
-
11
- public static $inject = ['$scope'];
12
- constructor(private $scope: IScope) {
13
- if (this.$scope.stage.isNew) {
14
- this.application = this.$scope.$parent.application;
15
- const defaultSelection: IManifestSelector = {
16
- location: '',
17
- account: '',
18
- };
19
- defaults(this.$scope.stage, defaultSelection);
20
- const defaultOptions: any = {
21
- replicas: null,
22
- app: this.application.name,
23
- };
24
- defaults(this.$scope.stage, defaultOptions);
25
- this.$scope.stage.cloudProvider = 'kubernetes';
26
- }
27
- }
28
-
29
- public handleManifestSelectorChange = (): void => {
30
- this.$scope.$applyAsync();
31
- };
32
- }
@@ -1,13 +0,0 @@
1
- <div class="form-horizontal">
2
- <h4>Manifest</h4>
3
- <div class="horizontal-rule"></div>
4
- <kubernetes-manifest-selector
5
- modes='["static", "dynamic"]'
6
- application="ctrl.application"
7
- on-change="ctrl.handleManifestSelectorChange"
8
- selector="ctrl.$scope.stage"
9
- ></kubernetes-manifest-selector>
10
- <h4>Settings</h4>
11
- <div class="horizontal-rule"></div>
12
- <kubernetes-scale-manifest-settings-form settings="ctrl.$scope.stage"></kubernetes-scale-manifest-settings-form>
13
- </div>
@@ -1,19 +0,0 @@
1
- import type { IController, IScope } from 'angular';
2
-
3
- export class KubernetesV2UndoRolloutManifestConfigCtrl implements IController {
4
- public static $inject = ['$scope'];
5
- constructor(private $scope: IScope) {
6
- if (this.$scope.stage.isNew) {
7
- Object.assign(this.$scope.stage, {
8
- location: '',
9
- account: '',
10
- cloudProvider: 'kubernetes',
11
- numRevisionsBack: 1,
12
- });
13
- }
14
- }
15
-
16
- public handleManifestSelectorChange = (): void => {
17
- this.$scope.$applyAsync();
18
- };
19
- }
@@ -1,28 +0,0 @@
1
- <div class="form-horizontal">
2
- <h4>Manifest</h4>
3
- <div class="horizontal-rule"></div>
4
- <kubernetes-manifest-selector
5
- on-change="ctrl.handleManifestSelectorChange"
6
- selector="stage"
7
- ></kubernetes-manifest-selector>
8
- <h4>Settings</h4>
9
- <div class="form-horizontal">
10
- <div class="form-group form-inline">
11
- <div class="col-md-3 sm-label-right">
12
- Revisions Back
13
- <help-field key="kubernetes.manifest.undoRollout.revisionsBack"></help-field>
14
- </div>
15
- <div class="col-md-4">
16
- <div class="input-group">
17
- <input
18
- type="number"
19
- class="form-control input-sm highlight-pristine"
20
- ng-model="stage.numRevisionsBack"
21
- min="1"
22
- />
23
- <span class="input-group-addon">revision<span ng-if="ctrl.$scope.stage.numRevisionsBack !== 1">s</span></span>
24
- </div>
25
- </div>
26
- </div>
27
- </div>
28
- </div>