-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(clouddriver): Plugin support for clouddriver to override clouddr…
…iver code (#140) * feat(clouddriver): Enable overrides of clouddriver core beans * feat(clouddriver): Add in some more missing classes to recreate the provider * chore(lambda): Expose the correct bean to clouddriver * chore(deps): Fix aws deps * chore(version): Update release version * chore(docs): Update version number and docs around this release * fix(tests): Fixes test compile path * chore(readme): Update README.md to order the versions better Co-authored-by: Fernando Freire <[email protected]> * chore(docs): Update the plugin yaml sample Co-authored-by: Fernando Freire <[email protected]> --------- Co-authored-by: Fernando Freire <[email protected]>
- Loading branch information
1 parent
f3f8b66
commit 1bf01ee
Showing
13 changed files
with
1,437 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
version=1.1.3 | ||
version=1.2.0 | ||
org.gradle.parallel=true | ||
spinnakerGradleVersion=8.10.0 | ||
orcaVersion=8.31.4 | ||
clouddriverVersion=5.69.0 | ||
clouddriverVersion=5.80.0 | ||
org.gradle.jvmarg=-Xmx2048m |
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,6 @@ | ||
spinnaker: | ||
extensibility: | ||
plugins: | ||
Aws.LambdaDeploymentPlugin: | ||
enabled: true | ||
version: 1.2.0 |
72 changes: 72 additions & 0 deletions
72
lambda-deployment-clouddriver/lambda-deployment-clouddriver.gradle
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 @@ | ||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
} | ||
} | ||
|
||
apply plugin: "io.spinnaker.plugin.service-extension" | ||
apply plugin: "maven-publish" | ||
apply plugin: "java" | ||
|
||
sourceCompatibility = 11 | ||
targetCompatibility = 11 | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
spinnakerPlugin { | ||
serviceName = "clouddriver" | ||
pluginClass = "com.amazon.aws.spinnaker.plugin.lambda.LambdaClouddriverPlugin" | ||
requires="clouddriver>=0.0.0" | ||
} | ||
|
||
dependencies { | ||
implementation(enforcedPlatform("io.spinnaker.clouddriver:clouddriver-bom:${clouddriverVersion}")) | ||
compileOnly("com.amazonaws:aws-java-sdk") | ||
compileOnly("com.netflix.awsobjectmapper:awsobjectmapper") | ||
compileOnly("org.apache.commons:commons-lang3") | ||
compileOnly("com.squareup.okhttp3:okhttp") | ||
|
||
compileOnly(group: 'org.pf4j', name: 'pf4j') | ||
compileOnly (group: 'io.spinnaker.clouddriver', name: 'clouddriver-api') | ||
compileOnly (group: 'io.spinnaker.clouddriver', name: 'cats-core') | ||
compileOnly(group: 'com.google.guava', name: 'guava') | ||
compileOnly (group: 'io.spinnaker.clouddriver', name: 'clouddriver-lambda') | ||
compileOnly (group: 'io.spinnaker.clouddriver', name: 'clouddriver-security') | ||
compileOnly (group: 'io.spinnaker.clouddriver', name: 'clouddriver-core') | ||
compileOnly (group: 'io.spinnaker.clouddriver', name: 'clouddriver-aws') | ||
|
||
compileOnly "com.netflix.spectator:spectator-api" | ||
compileOnly "com.netflix.frigga:frigga" | ||
|
||
compileOnly ("org.projectlombok:lombok") | ||
compileOnly (group: 'io.spinnaker.kork', name: 'kork-plugins-spring-api') | ||
compileOnly(group: 'io.spinnaker.kork', name: 'kork-exceptions') | ||
|
||
annotationProcessor platform("io.spinnaker.clouddriver:clouddriver-bom:${clouddriverVersion}") | ||
annotationProcessor ("org.projectlombok:lombok") | ||
annotationProcessor("org.pf4j:pf4j") | ||
testAnnotationProcessor platform("io.spinnaker.clouddriver:clouddriver-bom:${clouddriverVersion}") | ||
testAnnotationProcessor ("org.projectlombok:lombok") | ||
|
||
testImplementation group: 'io.spinnaker.clouddriver', name: 'clouddriver-api' | ||
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api' | ||
testCompile("com.netflix.awsobjectmapper:awsobjectmapper") | ||
testCompile group: 'com.github.tomakehurst', name: 'wiremock-jre8', version: '2.29.1' | ||
testCompile group: 'org.mockito', name: 'mockito-core' | ||
testCompile (group: 'io.spinnaker.clouddriver', name: 'clouddriver-lambda') | ||
testCompile (group: 'io.spinnaker.clouddriver', name: 'clouddriver-aws') | ||
testCompile (group: 'io.spinnaker.clouddriver', name: 'clouddriver-core') | ||
testCompile (group: 'io.spinnaker.clouddriver', name: 'clouddriver-security') | ||
testCompile group: 'org.mockito', name: 'mockito-junit-jupiter' | ||
testCompile group: 'org.projectlombok', name: 'lombok' | ||
|
||
testRuntime "org.junit.jupiter:junit-jupiter-engine" | ||
testRuntime "org.junit.platform:junit-platform-launcher" | ||
testRuntime "org.junit.platform:junit-platform-commons" | ||
} | ||
|
||
tasks.withType(Test) { | ||
useJUnitPlatform() | ||
} |
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 @@ | ||
lombok.anyConstructor.addConstructorProperties=true |
61 changes: 61 additions & 0 deletions
61
...ddriver/src/main/java/com/amazon/aws/spinnaker/plugin/lambda/LambdaClouddriverPlugin.java
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,61 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.amazon.aws.spinnaker.plugin.lambda; | ||
|
||
import com.amazon.aws.spinnaker.plugin.lambda.agent.LambdaAgentProvider; | ||
import com.netflix.spinnaker.kork.plugins.api.spring.SpringLoaderPlugin; | ||
import lombok.extern.log4j.Log4j2; | ||
import org.apache.commons.lang3.tuple.Pair; | ||
import org.pf4j.PluginWrapper; | ||
import org.springframework.beans.factory.BeanDefinitionStoreException; | ||
import org.springframework.beans.factory.config.BeanDefinition; | ||
import org.springframework.beans.factory.support.BeanDefinitionRegistry; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
@Log4j2 | ||
public class LambdaClouddriverPlugin extends SpringLoaderPlugin { | ||
public LambdaClouddriverPlugin(PluginWrapper wrapper) { | ||
super(wrapper); | ||
} | ||
|
||
@Override | ||
public void registerBeanDefinitions(BeanDefinitionRegistry registry) { | ||
List<Pair<String, Class>> beanList = Arrays.asList( | ||
Pair.of("lambdaAgentProvider", LambdaAgentProvider.class) | ||
); | ||
beanList.forEach( curr -> { | ||
BeanDefinition lazyLoadCredentialsRepositoryDefinition = primaryBeanDefinitionFor(curr.getRight()); | ||
try { | ||
registry.registerBeanDefinition(curr.getLeft(), lazyLoadCredentialsRepositoryDefinition); | ||
} catch (BeanDefinitionStoreException e) { | ||
log.error("Could not register bean {}", lazyLoadCredentialsRepositoryDefinition.getBeanClassName()); | ||
throw new RuntimeException(e); | ||
} | ||
}); | ||
super.registerBeanDefinitions(registry); | ||
} | ||
|
||
/** | ||
* Specify plugin packages to scan for beans. | ||
*/ | ||
public List<String> getPackagesToScan() { | ||
return Arrays.asList("com.amazon.aws.spinnaker.plugin.lambda"); | ||
} | ||
} |
Oops, something went wrong.