-
Notifications
You must be signed in to change notification settings - Fork 903
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(kubernetes): add rollout strategies to deploy manifest stage
- Loading branch information
1 parent
6072ee5
commit a69241b
Showing
9 changed files
with
95 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...pts/modules/kubernetes/src/v2/pipelines/stages/deployManifest/deployManifest.validator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { isEmpty } from 'lodash'; | ||
|
||
import { IPipeline, IStage, IValidatorConfig, ICustomValidator } from '@spinnaker/core'; | ||
|
||
export const deployManifestValidators = (): IValidatorConfig[] => { | ||
return [ | ||
{ | ||
type: 'custom', | ||
validate: (_pipeline: IPipeline, stage: IStage) => { | ||
const { enabled = false, options = {} } = stage.trafficManagement; | ||
if (enabled && isEmpty(options.services)) { | ||
return `Select at least one <strong>Service</strong> to enable Spinnaker-managed rollout strategy options.`; | ||
} | ||
return null; | ||
}, | ||
} as ICustomValidator, | ||
]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
app/scripts/modules/kubernetes/src/v2/rolloutStrategy/highlander.strategy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { IDeploymentStrategy } from 'core/deploymentStrategy'; | ||
|
||
export const strategyHighlander: IDeploymentStrategy = { | ||
label: 'Highlander', | ||
description: 'Destroys <i>all</i> previous ReplicaSets in the cluster as soon as the new ReplicaSet is ready', | ||
key: 'highlander', | ||
}; |
5 changes: 5 additions & 0 deletions
5
app/scripts/modules/kubernetes/src/v2/rolloutStrategy/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { strategyHighlander } from 'kubernetes/v2/rolloutStrategy/highlander.strategy'; | ||
import { strategyNone } from 'kubernetes/v2/rolloutStrategy/none.strategy'; | ||
import { strategyRedBlack } from 'kubernetes/v2/rolloutStrategy/redblack.strategy'; | ||
|
||
export const rolloutStrategies = [strategyNone, strategyRedBlack, strategyHighlander]; |
8 changes: 8 additions & 0 deletions
8
app/scripts/modules/kubernetes/src/v2/rolloutStrategy/none.strategy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { IDeploymentStrategy } from 'core/deploymentStrategy'; | ||
|
||
export const strategyNone: IDeploymentStrategy = { | ||
label: 'None', | ||
description: 'Creates the new ReplicaSet with no impact on existing ReplicaSets in the cluster', | ||
key: null, | ||
providerRestricted: false, | ||
}; |
7 changes: 7 additions & 0 deletions
7
app/scripts/modules/kubernetes/src/v2/rolloutStrategy/redblack.strategy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { IDeploymentStrategy } from 'core/deploymentStrategy'; | ||
|
||
export const strategyRedBlack: IDeploymentStrategy = { | ||
label: 'Red/Black', | ||
description: 'Disables <i>all</i> previous ReplicaSets in the cluster as soon as the new ReplicaSet is ready', | ||
key: 'redblack', | ||
}; |