Skip to content

feat(aws/cloudformation): Add cloudformation controller #3279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jan 28, 2019

Conversation

xavileon
Copy link
Contributor

This API will be used by Orca to query the status of a cloudformation
deploy operation asynchronously. It uses the cloud formation provider
to access the cached value by the cloudformation caching agent.

This PR partly addresses spinnaker/spinnaker#736 and depends on #3278

Signed-off-by: Xavi León xavi.leon@schibsted.com

This API will be used by Orca to query the status of a cloudformation
deploy operation asynchronously. It uses the cloud formation provider
to access the cached value by the cloudformation caching agent.

Signed-off-by: Xavi León <xavi.leon@schibsted.com>
@xavileon xavileon changed the title feature(aws/cloudformation): Add cloudformation controller DNMY feature(aws/cloudformation): Add cloudformation controller Jan 16, 2019
@spinnakerbot
Copy link
Contributor

We prefer that non-test backend code be written in Java or Kotlin, rather than Groovy. The following files have been added and written in Groovy:

  • clouddriver-web/src/main/groovy/com/netflix/spinnaker/clouddriver/controllers/CloudFormationController.groovy

See our server-side commit conventions here.

Signed-off-by: Xavi León <xavi.leon@schibsted.com>
@xavileon xavileon force-pushed the cloudformation_controller branch from c76d468 to 04c20e9 Compare January 17, 2019 12:19
} catch (NoSuchElementException e) {
throw new ResourceNotFoundException("Cloud Formation stackId $stackId not found.")
}
log.debug("Cloud formation get stack with id $stackId");
Copy link
Contributor

@jervi jervi Jan 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log.debug("Cloud formation get stack with id {}", stackId);

it.list(accountId, region)
}.flatten()
@RequestParam(required = false, defaultValue = "*") String region) {
log.debug("Cloud formation list stacks for account $accountId");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log.debug("Cloud formation list stacks for account {}", accountId);

.filter(Optional::isPresent)
.map(Optional<CloudFormation>::get)
.findFirst()
.<ResourceNotFoundException>orElseThrow(() -> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need the generic stuff here, just do .orElseThrow(() -> {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or never mind, I'm wrong :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just do this? orElseThrow(() -> new ResourceNotFoundException("..."));

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Done in 1e91224

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.rest.webmvc.ResourceNotFoundException;
import org.springframework.web.bind.annotation.*;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd split this into separate imports

Signed-off-by: Xavi León <xavi.leon@schibsted.com>
@xavileon
Copy link
Contributor Author

thanks @jervi addressed your comments in 85db382

xavileon pushed a commit to xavileon/orca that referenced this pull request Jan 17, 2019
This patch introduces the CloudFormation stage to deploy CloudFormation
templates. The stage basically consists of two main tasks:
1. an async task sent through `kato service` to clouddriver to deploy the
cloud formation template.
2. an task that waits for the completion of the deploy task by asking
cloud driver via its CloudFormation API.

The stage can be configured right now by specifying a json with the
following spec:
{
  stackName: name of the stack to be deployed
  region: region where the stack is to be deployed
  template: cloud formation template json
  parameters: json with the parameters that will be used by the template.
}

Related issue:
spinnaker/spinnaker#736

Related PRs:
spinnaker/clouddriver#3278
spinnaker/clouddriver#3279
spinnaker/clouddriver#3280

Signed-off-by: Xavi León <xavi.leon@schibsted.com>
xavileon pushed a commit to xavileon/orca that referenced this pull request Jan 17, 2019
This patch introduces the CloudFormation stage to deploy CloudFormation
templates. The stage basically consists of two main tasks:
1. an async task sent through `kato service` to clouddriver to deploy the
cloud formation template.
2. an task that waits for the completion of the deploy task by asking
cloud driver via its CloudFormation API.

The stage can be configured right now by specifying a json with the
following spec:
```
{
  stackName: name of the stack to be deployed
  region: region where the stack is to be deployed
  template: cloud formation template json
  parameters: json with the parameters that will be used by the template.
}
```

Related issue:
spinnaker/spinnaker#736

Related PRs:
spinnaker/clouddriver#3278
spinnaker/clouddriver#3279
spinnaker/clouddriver#3280

Signed-off-by: Xavi León <xavi.leon@schibsted.com>
@xavileon xavileon changed the title DNMY feature(aws/cloudformation): Add cloudformation controller DNMY feat(aws/cloudformation): Add cloudformation controller Jan 17, 2019
xavileon pushed a commit to xavileon/orca that referenced this pull request Jan 17, 2019
This patch introduces the CloudFormation stage to deploy CloudFormation
templates. The stage basically consists of two main tasks:
1. an async task sent through `kato service` to clouddriver to deploy the
cloud formation template.
2. an task that waits for the completion of the deploy task by asking
cloud driver via its CloudFormation API.

The stage can be configured right now by specifying a json with the
following spec:
```
{
  stackName: name of the stack to be deployed
  region: region where the stack is to be deployed
  template: cloud formation template json
  parameters: json with the parameters that will be used by the template.
}
```

Related issue:
spinnaker/spinnaker#736

Related PRs:
spinnaker/clouddriver#3278
spinnaker/clouddriver#3279
spinnaker/clouddriver#3280

Signed-off-by: Xavi León <xavi.leon@schibsted.com>
@xavileon xavileon changed the title DNMY feat(aws/cloudformation): Add cloudformation controller feat(aws/cloudformation): Add cloudformation controller Jan 18, 2019
Signed-off-by: Xavi León <xavi.leon@schibsted.com>
@gardleopard gardleopard merged commit 3c9daf1 into spinnaker:master Jan 28, 2019
xavileon pushed a commit to xavileon/orca that referenced this pull request Feb 11, 2019
This patch introduces the CloudFormation stage to deploy CloudFormation
templates. The stage basically consists of two main tasks:
1. an async task sent through `kato service` to clouddriver to deploy the
cloud formation template.
2. an task that waits for the completion of the deploy task by asking
cloud driver via its CloudFormation API.

The stage can be configured right now by specifying a json with the
following spec:
```
{
  stackName: name of the stack to be deployed
  region: region where the stack is to be deployed
  template: cloud formation template json
  parameters: json with the parameters that will be used by the template.
}
```

Related issue:
spinnaker/spinnaker#736

Related PRs:
spinnaker/clouddriver#3278
spinnaker/clouddriver#3279
spinnaker/clouddriver#3280

Signed-off-by: Xavi León <xavi.leon@schibsted.com>
ajordens pushed a commit to spinnaker/orca that referenced this pull request Feb 15, 2019
This patch introduces the CloudFormation stage to deploy CloudFormation
templates. The stage basically consists of two main tasks:
1. an async task sent through `kato service` to clouddriver to deploy the
cloud formation template.
2. an task that waits for the completion of the deploy task by asking
cloud driver via its CloudFormation API.

The stage can be configured right now by specifying a json with the
following spec:
```
{
  stackName: name of the stack to be deployed
  region: region where the stack is to be deployed
  template: cloud formation template json
  parameters: json with the parameters that will be used by the template.
}
```

Related issue:
spinnaker/spinnaker#736

Related PRs:
spinnaker/clouddriver#3278
spinnaker/clouddriver#3279
spinnaker/clouddriver#3280

Signed-off-by: Xavi León <xavi.leon@schibsted.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants