Skip to content

Commit

Permalink
feat(keel): add yaml processing (#841)
Browse files Browse the repository at this point in the history
  • Loading branch information
emjburns committed Jul 1, 2019
1 parent 335791e commit c99ffee
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 23 deletions.
4 changes: 3 additions & 1 deletion gate-web/gate-web.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ run {
systemProperty('spring.config.additional-location', project.springConfigLocation)
systemProperty('spring.profiles.active', project.springProfiles)
}
mainClassName='com.netflix.spinnaker.gate.Main'
mainClassName = 'com.netflix.spinnaker.gate.Main'

repositories {
maven {
Expand All @@ -24,6 +24,8 @@ dependencies {

implementation "com.squareup.retrofit:retrofit"
implementation "com.squareup.retrofit:converter-jackson"
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml"

implementation "com.squareup.okhttp:okhttp"
implementation "com.squareup.okhttp:okhttp-urlconnection"
implementation "com.squareup.okhttp:okhttp-apache"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package com.netflix.spinnaker.gate.config

import com.fasterxml.jackson.databind.DeserializationFeature
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.dataformat.yaml.YAMLMapper
import com.netflix.hystrix.strategy.concurrency.HystrixRequestContext
import com.netflix.spectator.api.Registry
import com.netflix.spinnaker.config.OkHttpClientConfiguration
Expand All @@ -33,19 +34,8 @@ import com.netflix.spinnaker.gate.filters.OriginValidator
import com.netflix.spinnaker.gate.retrofit.EurekaOkClient
import com.netflix.spinnaker.gate.retrofit.Slf4jRetrofitLogger
import com.netflix.spinnaker.gate.services.EurekaLookupService
import com.netflix.spinnaker.gate.services.internal.ClouddriverService
import com.netflix.spinnaker.gate.services.internal.ClouddriverServiceSelector
import com.netflix.spinnaker.gate.services.internal.EchoService
import com.netflix.spinnaker.gate.services.internal.Front50Service
import com.netflix.spinnaker.gate.services.internal.IgorService
import com.netflix.spinnaker.gate.services.internal.KayentaService
import com.netflix.spinnaker.gate.services.internal.KeelService
import com.netflix.spinnaker.gate.services.internal.MineService
import com.netflix.spinnaker.gate.services.internal.OrcaService
import com.netflix.spinnaker.gate.services.internal.OrcaServiceSelector
import com.netflix.spinnaker.gate.services.internal.RoscoService
import com.netflix.spinnaker.gate.services.internal.RoscoServiceSelector
import com.netflix.spinnaker.gate.services.internal.SwabbieService
import com.netflix.spinnaker.gate.services.internal.*
import com.netflix.spinnaker.gate.yaml.YamlHttpMessageConverter
import com.netflix.spinnaker.kork.dynamicconfig.DynamicConfigService
import com.netflix.spinnaker.kork.web.selector.DefaultServiceSelector
import com.netflix.spinnaker.kork.web.selector.SelectableService
Expand All @@ -66,6 +56,8 @@ import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Primary
import org.springframework.core.Ordered
import org.springframework.http.MediaType
import org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter
import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer
import org.springframework.session.data.redis.config.ConfigureRedisAction
import org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration
Expand All @@ -78,12 +70,7 @@ import retrofit.RequestInterceptor
import retrofit.RestAdapter
import retrofit.converter.JacksonConverter

import javax.servlet.Filter
import javax.servlet.FilterChain
import javax.servlet.FilterConfig
import javax.servlet.ServletException
import javax.servlet.ServletRequest
import javax.servlet.ServletResponse
import javax.servlet.*
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors

Expand Down Expand Up @@ -154,6 +141,15 @@ class GateConfig extends RedisHttpSessionConfiguration {
@Autowired
ServiceConfiguration serviceConfiguration

@Bean
AbstractJackson2HttpMessageConverter yamlHttpMessageConverter() {
return new YamlHttpMessageConverter(
new YAMLMapper(),
MediaType.parseMediaType("application/x-yaml"),
MediaType.parseMediaType("application/x-yaml;charset=UTF-8")
)
}

@Bean
OrcaServiceSelector orcaServiceSelector(OkHttpClient okHttpClient) {
return new OrcaServiceSelector(createClientSelector("orca", OrcaService, okHttpClient))
Expand Down Expand Up @@ -235,8 +231,7 @@ class GateConfig extends RedisHttpSessionConfiguration {
KayentaService kayentaService(OkHttpClient defaultClient,
OkHttpClientConfigurationProperties props,
OkHttpMetricsInterceptor interceptor,
@Value('${services.kayenta.externalhttps:false}') boolean kayentaExternalHttps)
{
@Value('${services.kayenta.externalhttps:false}') boolean kayentaExternalHttps) {
if (kayentaExternalHttps) {
def noSslCustomizationProps = props.clone()
noSslCustomizationProps.keyStore = null
Expand Down
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.gate.yaml;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter;

public class YamlHttpMessageConverter extends AbstractJackson2HttpMessageConverter {

public YamlHttpMessageConverter(ObjectMapper objectMapper, MediaType... supportedMediaTypes) {
super(objectMapper, supportedMediaTypes);
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
fiatVersion=1.1.0
enablePublishing=false
spinnakerGradleVersion=6.5.0
korkVersion=5.7.1
korkVersion=5.8.0
includeProviders=basic,iap,ldap,oauth2,saml,x509
org.gradle.parallel=true

0 comments on commit c99ffee

Please sign in to comment.