-
Notifications
You must be signed in to change notification settings - Fork 657
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(keel): send keel docker events if enabled (#535)
- Loading branch information
Showing
7 changed files
with
154 additions
and
3 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
29 changes: 29 additions & 0 deletions
29
igor-web/src/main/java/com/netflix/spinnaker/igor/config/IgorRetrofitConfig.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,29 @@ | ||
/* | ||
* Copyright 2019 Netflix, Inc. | ||
* | ||
* 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.netflix.spinnaker.igor.config; | ||
|
||
import com.jakewharton.retrofit.Ok3Client; | ||
import com.netflix.spinnaker.config.OkHttp3ClientConfiguration; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class IgorRetrofitConfig { | ||
@Bean | ||
public Ok3Client ok3Client(OkHttp3ClientConfiguration okHttpClientConfig) { | ||
return new Ok3Client(okHttpClientConfig.create().build()); | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
igor-web/src/main/java/com/netflix/spinnaker/igor/config/KeelConfig.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,57 @@ | ||
/* | ||
* Copyright 2019 Netflix, Inc. | ||
* | ||
* 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.netflix.spinnaker.igor.config; | ||
|
||
import com.jakewharton.retrofit.Ok3Client; | ||
import com.netflix.spinnaker.igor.keel.KeelService; | ||
import com.netflix.spinnaker.retrofit.Slf4jRetrofitLogger; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import retrofit.Endpoint; | ||
import retrofit.Endpoints; | ||
import retrofit.RestAdapter; | ||
import retrofit.converter.JacksonConverter; | ||
|
||
@ConditionalOnProperty("services.keel.base-url") | ||
@Configuration | ||
public class KeelConfig { | ||
|
||
@Bean | ||
public RestAdapter.LogLevel retrofitLogLevel( | ||
@Value("${retrofit.log-level:BASIC}") String retrofitLogLevel) { | ||
return RestAdapter.LogLevel.valueOf(retrofitLogLevel); | ||
} | ||
|
||
@Bean | ||
public Endpoint keelEndpoint(@Value("${services.keel.base-url}") String keelBaseUrl) { | ||
return Endpoints.newFixedEndpoint(keelBaseUrl); | ||
} | ||
|
||
@Bean | ||
public KeelService keelService( | ||
Endpoint keelEndpoint, Ok3Client ok3Client, RestAdapter.LogLevel retrofitLogLevel) { | ||
return new RestAdapter.Builder() | ||
.setEndpoint(keelEndpoint) | ||
.setConverter(new JacksonConverter()) | ||
.setClient(ok3Client) | ||
.setLogLevel(retrofitLogLevel) | ||
.setLog(new Slf4jRetrofitLogger(KeelService.class)) | ||
.build() | ||
.create(KeelService.class); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
igor-web/src/main/java/com/netflix/spinnaker/igor/keel/KeelService.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,29 @@ | ||
/* | ||
* Copyright 2019 Netflix, Inc. | ||
* | ||
* 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.netflix.spinnaker.igor.keel; | ||
|
||
import java.util.Map; | ||
import retrofit.http.Body; | ||
import retrofit.http.POST; | ||
|
||
public interface KeelService { | ||
/** | ||
* Events should be sent with this format (inherited from echo events): [ payload: [artifacts: | ||
* List<Artifact>, details: Map], eventName: String ] | ||
*/ | ||
@POST("/artifacts/events") | ||
Void sendArtifactEvent(@Body Map event); | ||
} |
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