@spinnaker/kubernetes 0.4.0 → 0.5.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.
@@ -16,12 +16,10 @@ export interface IManifestDeploymentOptionsProps {
16
16
  config: ITrafficManagementConfig;
17
17
  onConfigChange: (config: ITrafficManagementConfig) => void;
18
18
  selectedAccount: string;
19
- isDeploymentKind: boolean;
20
19
  }
21
20
  export interface IManifestDeploymentOptionsState {
22
21
  services: string[];
23
22
  showRedBlackWarningMessage: boolean;
24
- showBlueGreenDeploymentWarningMessage: boolean;
25
23
  }
26
24
  export declare class ManifestDeploymentOptions extends React.Component<IManifestDeploymentOptionsProps, IManifestDeploymentOptionsState> {
27
25
  state: IManifestDeploymentOptionsState;
@@ -1,4 +1,5 @@
1
1
  export * from './deleteManifest/deleteManifestStage';
2
2
  export * from './deployManifest/deployManifestStage';
3
3
  export * from './patchManifest/patchManifestStage';
4
+ export * from './rolloutRestartManifest/rolloutRestartManifestStage';
4
5
  export * from './runJob/runJobStage';
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import type { Application, IStage, IStageConfigProps } from '@spinnaker/core';
3
+ import type { IManifestSelector } from '../../../manifest/selector/IManifestSelector';
4
+ export interface IKubernetesManifestStageConfigProps extends IStageConfigProps {
5
+ application: Application;
6
+ stage: IManifestSelector & IStage;
7
+ stageFieldUpdated: () => void;
8
+ }
9
+ export declare class RolloutRestartManifestStageConfig extends React.Component<IKubernetesManifestStageConfigProps> {
10
+ componentDidMount: () => void;
11
+ private onChange;
12
+ render(): JSX.Element;
13
+ }
@@ -0,0 +1,4 @@
1
+ import { DeployStatus } from '../deployManifest/manifestStatus/DeployStatus';
2
+ export declare class RolloutRestartStatus extends DeployStatus {
3
+ static title: string;
4
+ }
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@spinnaker/kubernetes",
3
3
  "license": "Apache-2.0",
4
- "version": "0.4.0",
4
+ "version": "0.5.2",
5
5
  "module": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
7
10
  "scripts": {
8
11
  "clean": "shx rm -rf dist",
9
12
  "prepublishOnly": "npm run build",
@@ -13,7 +16,7 @@
13
16
  "lib": "npm run build"
14
17
  },
15
18
  "dependencies": {
16
- "@spinnaker/core": "^0.23.0",
19
+ "@spinnaker/core": "^0.27.0",
17
20
  "@uirouter/angularjs": "1.0.26",
18
21
  "@uirouter/react": "1.0.7",
19
22
  "angular": "1.6.10",
@@ -35,8 +38,8 @@
35
38
  "rxjs": "6.6.7"
36
39
  },
37
40
  "devDependencies": {
38
- "@spinnaker/eslint-plugin": "^3.0.1",
39
- "@spinnaker/scripts": "^0.3.0",
41
+ "@spinnaker/eslint-plugin": "^3.0.2",
42
+ "@spinnaker/scripts": "^0.3.1",
40
43
  "@types/angular": "1.6.26",
41
44
  "@types/angular-ui-bootstrap": "0.13.41",
42
45
  "@types/dompurify": "^2.3.3",
@@ -50,5 +53,5 @@
50
53
  "shx": "0.3.3",
51
54
  "typescript": "4.3.5"
52
55
  },
53
- "gitHead": "4d61e53884040e8cae45d29b398c88e3814c6aca"
56
+ "gitHead": "217b75396c5ec25d9b2019a849593b0b8d52e916"
54
57
  }
@@ -192,7 +192,6 @@ export class DeployManifestStageForm extends React.Component<
192
192
  config={stage.trafficManagement}
193
193
  onConfigChange={(config) => this.props.formik.setFieldValue('trafficManagement', config)}
194
194
  selectedAccount={stage.account}
195
- isDeploymentKind={this.state.rawManifest.includes('kind: Deployment')}
196
195
  />
197
196
  </div>
198
197
  );
@@ -17,7 +17,6 @@ describe('<ManifestDeploymentOptions />', () => {
17
17
  config: defaultTrafficManagementConfig,
18
18
  onConfigChange: onConfigChangeSpy,
19
19
  selectedAccount: null,
20
- isDeploymentKind: null,
21
20
  };
22
21
  wrapper = shallow(<ManifestDeploymentOptions {...props} />);
23
22
  });
@@ -72,19 +71,5 @@ describe('<ManifestDeploymentOptions />', () => {
72
71
  wrapper = shallow(<ManifestDeploymentOptions {...props} />);
73
72
  expect(wrapper.find('p[id="redBlackWarning"]').exists()).toEqual(true);
74
73
  });
75
-
76
- it('strategy bluegreen with deployment kind should display warning label', () => {
77
- props.config.options.strategy = 'bluegreen';
78
- props.isDeploymentKind = true;
79
- wrapper = shallow(<ManifestDeploymentOptions {...props} />);
80
- expect(wrapper.find('p[id="blueGreenWarning"]').exists()).toEqual(true);
81
- });
82
-
83
- it('strategy bluegreen with replicaSet kind should not display warning label', () => {
84
- props.config.options.strategy = 'bluegreen';
85
- props.isDeploymentKind = false;
86
- wrapper = shallow(<ManifestDeploymentOptions {...props} />);
87
- expect(wrapper.find('p[id="blueGreenWarning"]').exists()).toEqual(false);
88
- });
89
74
  });
90
75
  });
@@ -37,24 +37,18 @@ export interface IManifestDeploymentOptionsProps {
37
37
  config: ITrafficManagementConfig;
38
38
  onConfigChange: (config: ITrafficManagementConfig) => void;
39
39
  selectedAccount: string;
40
- isDeploymentKind: boolean;
41
40
  }
42
41
 
43
42
  export interface IManifestDeploymentOptionsState {
44
43
  services: string[];
45
44
  showRedBlackWarningMessage: boolean;
46
- showBlueGreenDeploymentWarningMessage: boolean;
47
45
  }
48
46
 
49
47
  export class ManifestDeploymentOptions extends React.Component<
50
48
  IManifestDeploymentOptionsProps,
51
49
  IManifestDeploymentOptionsState
52
50
  > {
53
- public state: IManifestDeploymentOptionsState = {
54
- services: [],
55
- showRedBlackWarningMessage: false,
56
- showBlueGreenDeploymentWarningMessage: false,
57
- };
51
+ public state: IManifestDeploymentOptionsState = { services: [], showRedBlackWarningMessage: false };
58
52
 
59
53
  private onConfigChange = (key: string, value: any): void => {
60
54
  this.setState({ showRedBlackWarningMessage: false });
@@ -62,9 +56,6 @@ export class ManifestDeploymentOptions extends React.Component<
62
56
  value = 'bluegreen';
63
57
  this.setState({ showRedBlackWarningMessage: true });
64
58
  }
65
- if (value === 'bluegreen' && this.props.isDeploymentKind) {
66
- this.setState({ showBlueGreenDeploymentWarningMessage: true });
67
- }
68
59
  this.updateProps(key, value);
69
60
  };
70
61
 
@@ -113,14 +104,10 @@ export class ManifestDeploymentOptions extends React.Component<
113
104
  public componentDidMount() {
114
105
  this.fetchServices();
115
106
  this.setState({ showRedBlackWarningMessage: false });
116
- this.setState({ showBlueGreenDeploymentWarningMessage: false });
117
107
  if (this.props.config.options.strategy === 'redblack') {
118
108
  this.setState({ showRedBlackWarningMessage: true });
119
109
  this.updateProps('options.strategy', 'bluegreen');
120
110
  }
121
- if (this.props.config.options.strategy === 'bluegreen' && this.props.isDeploymentKind) {
122
- this.setState({ showBlueGreenDeploymentWarningMessage: true });
123
- }
124
111
  }
125
112
 
126
113
  public componentDidUpdate(prevProps: IManifestDeploymentOptionsProps) {
@@ -141,7 +128,6 @@ export class ManifestDeploymentOptions extends React.Component<
141
128
  public render() {
142
129
  const { config } = this.props;
143
130
  const { showRedBlackWarningMessage } = this.state;
144
- const { showBlueGreenDeploymentWarningMessage } = this.state;
145
131
  return (
146
132
  <>
147
133
  <h4>Rollout Strategy Options</h4>
@@ -208,11 +194,6 @@ export class ManifestDeploymentOptions extends React.Component<
208
194
  blue/green instead!
209
195
  </p>
210
196
  )}
211
- {showBlueGreenDeploymentWarningMessage && (
212
- <p id={'blueGreenWarning'} style={{ color: 'orange' }}>
213
- Warning: Blue/Green strategy may cause downtime for Deployment kind!
214
- </p>
215
- )}
216
197
  </StageConfigField>
217
198
  </>
218
199
  )}
@@ -1,4 +1,5 @@
1
1
  export * from './deleteManifest/deleteManifestStage';
2
2
  export * from './deployManifest/deployManifestStage';
3
3
  export * from './patchManifest/patchManifestStage';
4
+ export * from './rolloutRestartManifest/rolloutRestartManifestStage';
4
5
  export * from './runJob/runJobStage';
@@ -0,0 +1,46 @@
1
+ import { defaults } from 'lodash';
2
+ import React from 'react';
3
+
4
+ import type { Application, IStage, IStageConfigProps } 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
+ export interface IKubernetesManifestStageConfigProps extends IStageConfigProps {
11
+ application: Application;
12
+ stage: IManifestSelector & IStage;
13
+ stageFieldUpdated: () => void;
14
+ }
15
+
16
+ export class RolloutRestartManifestStageConfig extends React.Component<IKubernetesManifestStageConfigProps> {
17
+ public componentDidMount = (): void => {
18
+ defaults(this.props.stage, {
19
+ app: this.props.application.name,
20
+ cloudProvider: 'kubernetes',
21
+ });
22
+ this.props.stageFieldUpdated();
23
+ };
24
+
25
+ private onChange = (stage: IManifestSelector): void => {
26
+ Object.assign(this.props.stage, stage);
27
+ this.props.stageFieldUpdated();
28
+ };
29
+
30
+ public render() {
31
+ const selector = { ...this.props.stage };
32
+ return (
33
+ <div className="form-horizontal">
34
+ <h4>Manifest</h4>
35
+ <div className="horizontal-rule" />
36
+ <ManifestSelector
37
+ application={this.props.application}
38
+ selector={selector}
39
+ modes={[SelectorMode.Static, SelectorMode.Dynamic, SelectorMode.Label]}
40
+ onChange={this.onChange}
41
+ includeSpinnakerKinds={null}
42
+ />
43
+ </div>
44
+ );
45
+ }
46
+ }
@@ -0,0 +1,20 @@
1
+ import { ExecutionDetailsTasks, Registry } from '@spinnaker/core';
2
+
3
+ import { RolloutRestartManifestStageConfig } from './RolloutRestartManifestStageConfig';
4
+ import { DeployStatus } from '../deployManifest/manifestStatus/DeployStatus';
5
+ import { manifestSelectorValidators } from '../validators/manifestSelectorValidators';
6
+
7
+ export class RolloutRestartStatus extends DeployStatus {
8
+ public static title = 'RolloutRestartStatus';
9
+ }
10
+
11
+ const STAGE_NAME = 'Rollout Restart (Manifest)';
12
+ Registry.pipeline.registerStage({
13
+ label: STAGE_NAME,
14
+ description: 'Perform a rolling restart of a manifest.',
15
+ key: 'rollingRestartManifest',
16
+ cloudProvider: 'kubernetes',
17
+ component: RolloutRestartManifestStageConfig,
18
+ executionDetailsSections: [RolloutRestartStatus, ExecutionDetailsTasks],
19
+ validators: manifestSelectorValidators(STAGE_NAME),
20
+ });
@@ -36,7 +36,7 @@ export class ManifestTrafficStageConfig extends React.Component<IKubernetesManif
36
36
  selector={selector}
37
37
  modes={[SelectorMode.Static, SelectorMode.Dynamic]}
38
38
  onChange={this.onChange}
39
- includeSpinnakerKinds={['serverGroups', 'serverGroupManagers']}
39
+ includeSpinnakerKinds={['serverGroups']}
40
40
  />
41
41
  </div>
42
42
  );