-
Notifications
You must be signed in to change notification settings - Fork 902
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(provider/cloudrun): Added cloudrun functionality to deck (#9931)
* feat(provider/cloudrun): Added cloudrun functionality to deck * feat(provider/cloudrun): Incorporated Suggested Changes * feat(provider/cloudRun): Fixed build issue --------- Co-authored-by: rsinghsidhu <[email protected]>
- Loading branch information
1 parent
306c5f9
commit 3611e95
Showing
59 changed files
with
2,707 additions
and
1 deletion.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
yalc.* | ||
.* | ||
tsconfig.json | ||
webpack.config.js |
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,53 @@ | ||
{ | ||
"name": "@spinnaker/cloudrun", | ||
"license": "Apache-2.0", | ||
"version": "0.0.1", | ||
"module": "dist/index.js", | ||
"typings": "dist/index.d.ts", | ||
"scripts": { | ||
"clean": "shx rm -rf dist", | ||
"prepublishOnly": "npm run build", | ||
"build": "npm run clean && spinnaker-scripts build", | ||
"dev": "spinnaker-scripts start", | ||
"dev:push": "spinnaker-scripts start --push", | ||
"lib": "npm run build" | ||
}, | ||
"dependencies": { | ||
"@spinnaker/core": "^0.23.0", | ||
"@uirouter/angularjs": "1.0.26", | ||
"@uirouter/react": "1.0.7", | ||
"angular": "1.6.10", | ||
"angular-ui-bootstrap": "2.5.0", | ||
"brace": "0.11.1", | ||
"dompurify": "^2.3.10", | ||
"enzyme": "3.11.0", | ||
"formik": "1.5.1", | ||
"js-yaml": "3.13.1", | ||
"lodash": "4.17.21", | ||
"luxon": "1.23.0", | ||
"ngimport": "0.6.1", | ||
"react": "16.14.0", | ||
"react-ace": "6.4.0", | ||
"react-bootstrap": "0.32.1", | ||
"react-ga": "2.4.1", | ||
"react-select": "1.2.1", | ||
"react2angular": "3.2.1", | ||
"rxjs": "6.6.7" | ||
}, | ||
"devDependencies": { | ||
"@spinnaker/eslint-plugin": "^3.0.1", | ||
"@spinnaker/scripts": "^0.3.0", | ||
"@types/angular": "1.6.26", | ||
"@types/angular-ui-bootstrap": "0.13.41", | ||
"@types/dompurify": "^2.3.3", | ||
"@types/enzyme": "3.10.3", | ||
"@types/js-yaml": "3.5.30", | ||
"@types/lodash": "4.14.64", | ||
"@types/luxon": "1.11.1", | ||
"@types/react": "16.14.10", | ||
"@types/react-bootstrap": "0.32.5", | ||
"@types/react-select": "1.3.4", | ||
"shx": "0.3.3", | ||
"typescript": "4.3.5" | ||
} | ||
} |
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,72 @@ | ||
import { module } from 'angular'; | ||
|
||
import { CloudProviderRegistry, DeploymentStrategyRegistry } from '@spinnaker/core'; | ||
|
||
import { CLOUDRUN_COMPONENT_URL_DETAILS } from './common/componentUrlDetails.component'; | ||
import { CLOUDRUN_LOAD_BALANCER_CREATE_MESSAGE } from './common/loadBalancerMessage.component'; | ||
import './help/cloudrun.help'; | ||
import { CLOUDRUN_INSTANCE_DETAILS_CTRL } from './instance/details/details.controller'; | ||
import { CLOUDRUN_ALLOCATION_CONFIGURATION_ROW } from './loadBalancer/configure/wizard/allocationConfigurationRow.component'; | ||
import { CLOUDRUN_LOAD_BALANCER_BASIC_SETTINGS } from './loadBalancer/configure/wizard/basicSettings.component'; | ||
import { CLOUDRUN_STAGE_ALLOCATION_CONFIGURATION_ROW } from './loadBalancer/configure/wizard/stageAllocationConfigurationRow.component'; | ||
import { CLOUDRUN_LOAD_BALANCER_WIZARD_CTRL } from './loadBalancer/configure/wizard/wizard.controller'; | ||
import { CLOUDRUN_LOAD_BALANCER_DETAILS_CTRL } from './loadBalancer/details/details.controller'; | ||
import { CLOUDRUN_LOAD_BALANCER_TRANSFORMER } from './loadBalancer/loadBalancerTransformer'; | ||
import logo from './logo/cloudrun.logo.png'; | ||
import { CLOUDRUN_PIPELINE_MODULE } from './pipeline/pipeline.module'; | ||
import { CLOUDRUN_SERVER_GROUP_COMMAND_BUILDER } from './serverGroup/configure/serverGroupCommandBuilder.service'; | ||
import { ServerGroupWizard } from './serverGroup/configure/wizard/serverGroupWizard'; | ||
import { CLOUDRUN_SERVER_GROUP_DETAILS_CTRL } from './serverGroup/details/details.controller'; | ||
import { CLOUDRUN_SERVER_GROUP_TRANSFORMER } from './serverGroup/serverGroupTransformer.service'; | ||
|
||
import './logo/cloudrun.logo.less'; | ||
|
||
export const CLOUDRUN_MODULE = 'spinnaker.cloudrun'; | ||
|
||
const requires = [ | ||
CLOUDRUN_COMPONENT_URL_DETAILS, | ||
CLOUDRUN_SERVER_GROUP_COMMAND_BUILDER, | ||
CLOUDRUN_SERVER_GROUP_DETAILS_CTRL, | ||
CLOUDRUN_SERVER_GROUP_TRANSFORMER, | ||
CLOUDRUN_LOAD_BALANCER_TRANSFORMER, | ||
CLOUDRUN_LOAD_BALANCER_DETAILS_CTRL, | ||
CLOUDRUN_LOAD_BALANCER_WIZARD_CTRL, | ||
CLOUDRUN_LOAD_BALANCER_CREATE_MESSAGE, | ||
CLOUDRUN_ALLOCATION_CONFIGURATION_ROW, | ||
CLOUDRUN_LOAD_BALANCER_BASIC_SETTINGS, | ||
CLOUDRUN_STAGE_ALLOCATION_CONFIGURATION_ROW, | ||
CLOUDRUN_PIPELINE_MODULE, | ||
CLOUDRUN_INSTANCE_DETAILS_CTRL, | ||
]; | ||
|
||
module(CLOUDRUN_MODULE, requires).config(() => { | ||
CloudProviderRegistry.registerProvider('cloudrun', { | ||
name: 'cloudrun', | ||
logo: { | ||
path: logo, | ||
}, | ||
|
||
instance: { | ||
detailsTemplateUrl: require('./instance/details/details.html'), | ||
detailsController: 'cloudrunInstanceDetailsCtrl', | ||
}, | ||
serverGroup: { | ||
CloneServerGroupModal: ServerGroupWizard, | ||
commandBuilder: 'cloudrunV2ServerGroupCommandBuilder', | ||
detailsController: 'cloudrunV2ServerGroupDetailsCtrl', | ||
detailsTemplateUrl: require('./serverGroup/details/details.html'), | ||
transformer: 'cloudrunV2ServerGroupTransformer', | ||
skipUpstreamStageCheck: true, | ||
}, | ||
|
||
loadBalancer: { | ||
transformer: 'cloudrunLoadBalancerTransformer', | ||
createLoadBalancerTemplateUrl: require('./loadBalancer/configure/wizard/wizard.html'), | ||
createLoadBalancerController: 'cloudrunLoadBalancerWizardCtrl', | ||
detailsTemplateUrl: require('./loadBalancer/details/details.html'), | ||
detailsController: 'cloudrunLoadBalancerDetailsCtrl', | ||
}, | ||
}); | ||
}); | ||
|
||
DeploymentStrategyRegistry.registerProvider('cloudrun', ['custom', 'redblack', 'rollingpush', 'rollingredblack']); |
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,14 @@ | ||
import type { IProviderSettings } from '@spinnaker/core'; | ||
import { SETTINGS } from '@spinnaker/core'; | ||
|
||
export interface ICloudrunProviderSettings extends IProviderSettings { | ||
defaults: { | ||
account?: string; | ||
}; | ||
} | ||
|
||
export const CloudrunProviderSettings: ICloudrunProviderSettings = (SETTINGS.providers | ||
.cloudrun as ICloudrunProviderSettings) || { defaults: {} }; | ||
if (CloudrunProviderSettings) { | ||
CloudrunProviderSettings.resetToOriginal = SETTINGS.resetProvider('cloudrun'); | ||
} |
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,3 @@ | ||
export class CloudrunHealth { | ||
public static PLATFORM = 'Cloud Run Service'; | ||
} |
22 changes: 22 additions & 0 deletions
22
packages/cloudrun/src/common/componentUrlDetails.component.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,22 @@ | ||
import type { IComponentOptions } from 'angular'; | ||
import { module } from 'angular'; | ||
|
||
const cloudrunComponentUrlDetailsComponent: IComponentOptions = { | ||
bindings: { component: '<' }, | ||
template: ` | ||
<dt>HTTPS</dt> | ||
<dl class="small"> | ||
<a href="{{$ctrl.component.url}}" target="_blank">{{$ctrl.component.url}}</a> | ||
<copy-to-clipboard class="copy-to-clipboard copy-to-clipboard-sm" | ||
tool-tip="'Copy URL to clipboard'" | ||
text="$ctrl.component.httpsUrl"></copy-to-clipboard> | ||
</dl> | ||
`, | ||
}; | ||
|
||
export const CLOUDRUN_COMPONENT_URL_DETAILS = 'spinnaker.cloudrun.componentUrlDetails.component'; | ||
|
||
module(CLOUDRUN_COMPONENT_URL_DETAILS, []).component( | ||
'cloudrunComponentUrlDetails', | ||
cloudrunComponentUrlDetailsComponent, | ||
); |
37 changes: 37 additions & 0 deletions
37
packages/cloudrun/src/common/conditionalDescriptionListItem.component.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,37 @@ | ||
import type { IComponentOptions, IController, IFilterService } from 'angular'; | ||
import { module } from 'angular'; | ||
|
||
class CloudrunConditionalDescriptionListItemCtrl implements IController { | ||
public label: string; | ||
public key: string; | ||
public component: any; | ||
|
||
public static $inject = ['$filter']; | ||
constructor(private $filter: IFilterService) {} | ||
|
||
public $onInit(): void { | ||
if (!this.label) { | ||
this.label = this.$filter<Function>('robotToHuman')(this.key); | ||
} | ||
} | ||
} | ||
|
||
const cloudrunConditionalDescriptionListItem: IComponentOptions = { | ||
bindings: { label: '@', key: '@', component: '<' }, | ||
transclude: { | ||
keyLabel: '?keyText', | ||
valueLabel: '?valueLabel', | ||
}, | ||
template: ` | ||
<dt ng-if="$ctrl.component[$ctrl.key]">{{$ctrl.label}}<span ng-transclude="keyLabel"></span></dt> | ||
<dd ng-if="$ctrl.component[$ctrl.key]">{{$ctrl.component[$ctrl.key]}}<span ng-transclude="valueLabel"></span></dd> | ||
`, | ||
controller: CloudrunConditionalDescriptionListItemCtrl, | ||
}; | ||
|
||
export const CLOUDRUN_CONDITIONAL_DESCRIPTION_LIST_ITEM = 'spinnaker.cloudrun.conditionalDescriptionListItem'; | ||
|
||
module(CLOUDRUN_CONDITIONAL_DESCRIPTION_LIST_ITEM, []).component( | ||
'cloudrunConditionalDtDd', | ||
cloudrunConditionalDescriptionListItem, | ||
); |
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,21 @@ | ||
import type { IInstance } from '@spinnaker/core'; | ||
|
||
export interface ICloudrunInstance extends IInstance { | ||
name: string; | ||
id: string; | ||
account?: string; | ||
region?: string; | ||
instanceStatus: 'DYNAMIC' | 'RESIDENT' | 'UNKNOWN'; | ||
launchTime: number; | ||
loadBalancers: string[]; | ||
serverGroup: string; | ||
vmDebugEnabled: boolean; | ||
vmName: string; | ||
vmStatus: string; | ||
vmZoneName: string; | ||
qps: number; | ||
healthState: string; | ||
cloudProvider: string; | ||
errors: number; | ||
averageLatency: number; | ||
} |
18 changes: 18 additions & 0 deletions
18
packages/cloudrun/src/common/domain/ICloudrunLoadBalancer.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 type { ILoadBalancer } from '@spinnaker/core'; | ||
|
||
export interface ICloudrunLoadBalancer extends ILoadBalancer { | ||
credentials?: string; | ||
split?: ICloudrunTrafficSplit; | ||
migrateTraffic: boolean; | ||
dispatchRules?: ICloudrunDispatchRule[]; | ||
} | ||
|
||
export interface ICloudrunTrafficSplit { | ||
trafficTargets: [{ revisionName: string; percent: number }]; | ||
} | ||
|
||
export interface ICloudrunDispatchRule { | ||
domain: string; | ||
path: string; | ||
service: string; | ||
} |
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,2 @@ | ||
export * from './ICloudrunLoadBalancer'; | ||
export * from './ICloudrunInstance'; |
11 changes: 11 additions & 0 deletions
11
packages/cloudrun/src/common/loadBalancerMessage.component.html
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,11 @@ | ||
<div class="row"> | ||
<div class="col-md-offset-{{ $ctrl.columnOffset || 0 }} col-md-{{ $ctrl.columns || 12 }}"> | ||
<div class="well"> | ||
<p> | ||
<span ng-if="$ctrl.showCreateMessage">Spinnaker cannot create a load balancer for Cloud Run.</span> | ||
A Spinnaker load balancer maps to an Cloud Run Service, which will be created automatically alongside a | ||
Revision. Once created, the Service can be edited as a Load Balancer. | ||
</p> | ||
</div> | ||
</div> | ||
</div> |
13 changes: 13 additions & 0 deletions
13
packages/cloudrun/src/common/loadBalancerMessage.component.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,13 @@ | ||
import { module } from 'angular'; | ||
|
||
const cloudRunLoadBalancerMessageComponent: ng.IComponentOptions = { | ||
bindings: { showCreateMessage: '<', columnOffset: '@', columns: '@' }, | ||
templateUrl: require('./loadBalancerMessage.component.html'), | ||
}; | ||
|
||
export const CLOUDRUN_LOAD_BALANCER_CREATE_MESSAGE = 'spinnaker.cloudrun.loadBalancer.createMessage.component'; | ||
|
||
module(CLOUDRUN_LOAD_BALANCER_CREATE_MESSAGE, []).component( | ||
'cloudrunLoadBalancerMessage', | ||
cloudRunLoadBalancerMessageComponent, | ||
); |
Oops, something went wrong.