diff --git a/.github/workflows/deploy_prod.yaml b/.github/workflows/deploy_prod.yaml index 23dc1f08..06c6c0ec 100644 --- a/.github/workflows/deploy_prod.yaml +++ b/.github/workflows/deploy_prod.yaml @@ -44,24 +44,6 @@ jobs: outputs: image: ${{ steps.build-image.outputs.image }} - deploy_prod_fss: - name: Deploy to prod-fss - needs: build - runs-on: ubuntu-latest - permissions: - contents: read - checks: write - packages: write - id-token: write - steps: - - uses: actions/checkout@v4 - - uses: nais/deploy/actions/deploy@v2 - name: Deploy to prod-fss - env: - CLUSTER: prod-fss - RESOURCE: .nais/nais-prod.yaml - IMAGE: ${{ needs.build.outputs.image }} - deploy_prod: name: Deploy to prod needs: build diff --git a/.github/workflows/manual_deploy_dev.yaml b/.github/workflows/manual_deploy_dev.yaml index 80759a2e..863409f2 100644 --- a/.github/workflows/manual_deploy_dev.yaml +++ b/.github/workflows/manual_deploy_dev.yaml @@ -43,23 +43,6 @@ jobs: outputs: image: ${{ steps.build-image.outputs.image }} - deploy_dev: - name: Deploy to dev-fss - needs: build - runs-on: ubuntu-latest - permissions: - contents: read - checks: write - packages: write - id-token: write - steps: - - uses: actions/checkout@v4 - - uses: nais/deploy/actions/deploy@v2 - env: - CLUSTER: dev-fss - RESOURCE: .nais/nais-dev.yaml - IMAGE: ${{ needs.build.outputs.image }} - deploy_dev-gcp: name: Deploy to dev-gcp needs: build diff --git a/.nais/nais-dev.yaml b/.nais/nais-dev.yaml deleted file mode 100644 index bda11e50..00000000 --- a/.nais/nais-dev.yaml +++ /dev/null @@ -1,122 +0,0 @@ -apiVersion: nais.io/v1alpha1 -kind: Application -metadata: - name: tjenestepensjon-simulering - namespace: pensjonskalkulator - labels: - team: pensjonskalkulator -spec: - image: {{ image }} - resources: - limits: - memory: 2048Mi - requests: - cpu: 50m - memory: 1024Mi - port: 8080 - webproxy: true - ingresses: - - https://tjenestepensjon-simulering.intern.dev.nav.no - accessPolicy: - inbound: - rules: - - application: pensjon-pen-q0 - namespace: pensjon-q0 - - application: pensjon-pen-q1 - namespace: pensjon-q1 - - application: pensjon-pen-q2 - namespace: pensjon-q2 - - application: pensjon-pen-q5 - namespace: pensjon-q5 - - application: penbatch-q0 - namespace: pensjon-batch - - application: penbatch-q1 - namespace: pensjon-batch - - application: penbatch-q2 - namespace: pensjon-batch - - application: penbatch-q5 - namespace: pensjon-batch - - application: pensjon-testdata-server-q2 - namespace: pensjontestdata - - application: pensjonskalkulator-backend - namespace: pensjonskalkulator - cluster: dev-gcp - outbound: - rules: - - application: tp-q2 - namespace: pensjonsamhandling - cluster: dev-fss - - application: pensjon-opptjening-afp-api - namespace: pensjonopptjening - cluster: dev-gcp - - application: pensjon-pen-q2 - namespace: pensjon-q2 - cluster: dev-fss - external: - - host: api-test.klp.no - - host: api.test.spk.no - azure: - application: - enabled: true - maskinporten: - enabled: true - scopes: - consumes: - - name: "klp:pensjonsimulering" - - name: "klp:oftp/simulering" - - name: "nav:pensjon/v1/tpregisteret" - - name: "spk:nav" - liveness: - path: actuator/health/liveness - initialDelay: 30 - readiness: - path: actuator/health/readiness - initialDelay: 30 - startup: - path: actuator/health/readiness - initialDelay: 30 - failureThreshold: 30 - periodSeconds: 5 - vault: - enabled: true - paths: - - kvPath: /kv/preprod/fss/tjenestepensjon-simulering/pensjonskalkulator - mountPath: /var/run/secrets/nais.io/vault - replicas: - min: 2 - max: 2 - env: - - name: SPRING_PROFILES_ACTIVE - value: preprod - - name: provider_uri - value: https://pep-gw-q1.oera-q.local:9443/ekstern-pensjon-tjeneste-tjenestepensjonSimuleringWeb/sca/TjenestepensjonSimuleringWSEXP - - name: sts_url - value: https://security-token-service.nais.preprod.local - - name: tp_url - value: https://tp-q2.dev.intern.nav.no - - name: tp_scope - value: api://dev-fss.pensjonsamhandling.tp-q2/.default - - name: afp_beholdning_url - value: https://pensjon-opptjening-afp-api.intern.dev.nav.no - - name: afp_beholdning_scope - value: api://dev-gcp.pensjonopptjening.pensjon-opptjening-afp-api/.default - - name: pen_url - value: https://pensjon-pen-q2.nais.preprod.local/pen/springapi - - name: pen_scope - value: api://dev-fss.pensjon-q2.pensjon-pen-q2/.default - - name: pen_fss_gateway_url - value: https://pensjon-selvbetjening-fss-gateway.dev-fss-pub.nais.io - - name: pen_fss_gateway_scope - value: api://dev-fss.pensjonselvbetjening.pensjon-selvbetjening-fss-gateway/.default - - name: OTEL_RESOURCE_ATTRIBUTES - value: deployment.environment.name=q2 - prometheus: - enabled: true - path: actuator/prometheus - observability: - autoInstrumentation: - enabled: true - runtime: java - destinations: - - id: "grafana-lgtm" - - id: "elastic-apm" \ No newline at end of file diff --git a/.nais/nais-prod.yaml b/.nais/nais-prod.yaml deleted file mode 100644 index 7f68ef33..00000000 --- a/.nais/nais-prod.yaml +++ /dev/null @@ -1,107 +0,0 @@ -apiVersion: nais.io/v1alpha1 -kind: Application -metadata: - name: tjenestepensjon-simulering - namespace: pensjonskalkulator - labels: - team: pensjonskalkulator -spec: - image: {{ image }} - resources: - limits: - memory: 2048Mi - requests: - cpu: 100m - memory: 1024Mi - port: 8080 - webproxy: true - ingresses: - - https://tjenestepensjon-simulering.intern.nav.no - accessPolicy: - inbound: - rules: - - application: pensjon-pen - namespace: pensjondeployer - - application: pensjonskalkulator-backend - namespace: pensjonskalkulator - cluster: prod-gcp - - application: penbatch - namespace: pensjon-batch - outbound: - rules: - - application: tp - namespace: pensjonsamhandling - cluster: prod-fss - - application: pensjon-opptjening-afp-api - namespace: pensjonopptjening - cluster: prod-gcp - - application: pensjon-pen - namespace: pensjondeployer - cluster: prod-fss - external: - - host: api.klp.no - azure: - application: - enabled: true - maskinporten: - enabled: true - scopes: - consumes: - - name: "klp:pensjonsimulering" - - name: "klp:oftp/simulering" - - name: "nav:pensjon/v1/tpregisteret" - - name: "spk:nav" - liveness: - path: actuator/health/liveness - initialDelay: 30 - readiness: - path: actuator/health/readiness - initialDelay: 30 - startup: - path: actuator/health/readiness - initialDelay: 30 - failureThreshold: 30 - periodSeconds: 5 - vault: - enabled: true - paths: - - kvPath: /kv/prod/fss/tjenestepensjon-simulering/pensjonskalkulator - mountPath: /var/run/secrets/nais.io/vault - replicas: - min: 2 - max: 2 - env: - - name: SPRING_PROFILES_ACTIVE - value: prod - - name: provider_uri - value: https://pep-gw.oera.no:9443/ekstern-pensjon-tjeneste-tjenestepensjonSimuleringWeb/sca/TjenestepensjonSimuleringWSEXP - - name: sts_url - value: https://security-token-service.nais.adeo.no - - name: tp_url - value: https://tp.nais.adeo.no - - name: tp_scope - value: api://prod-fss.pensjonsamhandling.tp/.default - - name: afp_beholdning_url - value: https://pensjon-opptjening-afp-api.intern.nav.no - - name: afp_beholdning_scope - value: api://prod-gcp.pensjonopptjening.pensjon-opptjening-afp-api/.default - - name: pen_url - value: https://pensjon-pen.nais.adeo.no/pen/springapi - - name: pen_scope - value: api://prod-fss.pensjondeployer.pensjon-pen/.default - - name: pen_fss_gateway_url - value: https://pensjon-selvbetjening-fss-gateway.prod-fss-pub.nais.io - - name: pen_fss_gateway_scope - value: api://prod-fss.pensjonselvbetjening.pensjon-selvbetjening-fss-gateway/.default - - name: OTEL_RESOURCE_ATTRIBUTES - value: deployment.environment.name=p - prometheus: - enabled: true - path: actuator/prometheus - observability: - autoInstrumentation: - enabled: true - runtime: java - destinations: - - id: "grafana-lgtm" - - id: "elastic-apm" \ No newline at end of file diff --git a/src/main/kotlin/no/nav/tjenestepensjon/simulering/config/WebClientConfig.kt b/src/main/kotlin/no/nav/tjenestepensjon/simulering/config/WebClientConfig.kt index c859a6aa..06525159 100644 --- a/src/main/kotlin/no/nav/tjenestepensjon/simulering/config/WebClientConfig.kt +++ b/src/main/kotlin/no/nav/tjenestepensjon/simulering/config/WebClientConfig.kt @@ -13,7 +13,6 @@ import org.slf4j.MDC import org.springframework.beans.factory.annotation.Value import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration -import org.springframework.context.annotation.Profile import org.springframework.http.HttpHeaders import org.springframework.http.MediaType import org.springframework.http.client.reactive.ReactorClientHttpConnector @@ -28,16 +27,10 @@ import reactor.netty.transport.logging.AdvancedByteBufFormat @Configuration class WebClientConfig { - @Profile(value = ["prod", "preprod", "test"]) - @Bean - fun httpClient(): HttpClient = - HttpClient.create().proxyWithSystemProperties().option(ChannelOption.CONNECT_TIMEOUT_MILLIS, CONNECT_TIMEOUT_MILLIS) - .doOnConnected { it.addHandlerLast(ReadTimeoutHandler(READ_TIMEOUT_MILLIS / 1000)) } - - @Profile(value = ["prod-gcp", "dev-gcp"]) @Bean fun client(): HttpClient = - HttpClient.create().option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10_000) + HttpClient.create().option(ChannelOption.CONNECT_TIMEOUT_MILLIS, CONNECT_TIMEOUT_MILLIS) + .doOnConnected { it.addHandlerLast(ReadTimeoutHandler(READ_TIMEOUT_MILLIS / 1000)) } .compress(true) .followRedirect(true) .doOnConnected { it.addHandlerLast(ReadTimeoutHandler(30)) } diff --git a/src/main/kotlin/no/nav/tjenestepensjon/simulering/v1/consumer/GatewayTokenClient.kt b/src/main/kotlin/no/nav/tjenestepensjon/simulering/v1/consumer/GatewayTokenClient.kt index 355f2bd6..7e52ac37 100644 --- a/src/main/kotlin/no/nav/tjenestepensjon/simulering/v1/consumer/GatewayTokenClient.kt +++ b/src/main/kotlin/no/nav/tjenestepensjon/simulering/v1/consumer/GatewayTokenClient.kt @@ -4,14 +4,12 @@ import io.github.oshai.kotlinlogging.KotlinLogging import no.nav.tjenestepensjon.simulering.domain.Token import no.nav.tjenestepensjon.simulering.domain.TokenImpl import no.nav.tjenestepensjon.simulering.service.TokenService -import org.springframework.context.annotation.Profile import org.springframework.stereotype.Service import org.springframework.web.reactive.function.BodyInserters import org.springframework.web.reactive.function.client.WebClient import org.springframework.web.reactive.function.client.WebClientRequestException import org.springframework.web.reactive.function.client.WebClientResponseException -@Profile(value = ["prod-gcp", "dev-gcp"]) @Service class GatewayTokenClient(private val soapGatewayAuthWebClient: WebClient, private val fssGatewayAuthService: FssGatewayAuthService, diff --git a/src/main/resources/application-preprod.yml b/src/main/resources/application-preprod.yml deleted file mode 100644 index e1b00756..00000000 --- a/src/main/resources/application-preprod.yml +++ /dev/null @@ -1,47 +0,0 @@ -logging.level: - no.nav.tjenestepensjon: DEBUG - org.springframework: - security.oauth2: DEBUG - ws: - web: DEBUG - client.MessageTracing: DEBUG - com.microsoft.aad: DEBUG - -simulering: - security: - issuers: ${azure.openid-config-issuer},https://security-token-service.nais.preprod.local,https://security-token-service-t4.nais.preprod.local,https://navtestb2c.b2clogin.com/d38f25aa-eab8-4c50-9f28-ebf92c1256f2/v2.0/ -klp: - name: KLP - implementation: REST - simuleringUrl: https://partner-gw-test2.klp.no/api/pensjonsimulering - stillingsprosentUrl: https://partner-gw-stage.klp.no/navs-ws-gateway/inbound/simuleretjenestepensjon -spk: - name: SPK - implementation: REST - simuleringUrl: https://api.preprod.spk.no/medlem/pensjon/prognose/v1 - stillingsprosentUrl: https://partner-gw-test.spk.no/nav/SimulereTjenestepensjon -storebrand: - name: STOREBRAND - implementation: SOAP - simuleringUrl: https://b2b-t.storebrand.no/nav/SimulerTP - stillingsprosentUrl: https://b2b-t.storebrand.no/nav/SimulerTP -gabler: - name: GABLER - implementation: SOAP - simuleringUrl: https://elsam.gabler.no/elsam.svc - stillingsprosentUrl: https://elsam.gabler.no/elsam.svc -opf: - name: OPF - implementation: SOAP - simuleringUrl: https://partner-gw.opf.no/Elsam.svc - stillingsprosentUrl: https://partner-gw.opf.no/Elsam.svc -oftp: - 2025: - klp: - endpoint: - url: https://api-test.klp.no - maskinportenscope: klp:oftp/simulering - spk: - endpoint: - url: https://api.test.spk.no - maskinportenscope: spk:nav diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml deleted file mode 100644 index 91b13a37..00000000 --- a/src/main/resources/application-prod.yml +++ /dev/null @@ -1,11 +0,0 @@ -logging.level: - no.nav.tjenestepensjon: INFO - -simulering: - security: - issuers: ${azure.openid-config-issuer},https://security-token-service.nais.adeo.no,https://navnob2c.b2clogin.com/8b7dfc8b-b52e-4741-bde4-d83ea366f94f/v2.0/ -spk: - name: SPK - implementation: REST - simuleringUrl: https://api.prod.spk.no/medlem/pensjon/prognose/v1 - stillingsprosentUrl: https://partner-gw.spk.no:443/nav/SimulereTjenestepensjon diff --git a/src/test/kotlin/no/nav/tjenestepensjon/simulering/config/WebClientConfigTest.kt b/src/test/kotlin/no/nav/tjenestepensjon/simulering/config/WebClientConfigTest.kt index c6b40332..32a3cdbd 100644 --- a/src/test/kotlin/no/nav/tjenestepensjon/simulering/config/WebClientConfigTest.kt +++ b/src/test/kotlin/no/nav/tjenestepensjon/simulering/config/WebClientConfigTest.kt @@ -7,32 +7,16 @@ import no.nav.tjenestepensjon.simulering.defaultLeveradorUrl import no.nav.tjenestepensjon.simulering.defaultTpid import no.nav.tjenestepensjon.simulering.defaultTssid import no.nav.tjenestepensjon.simulering.model.domain.TPOrdningIdDto -import no.nav.tjenestepensjon.simulering.service.AADClient import no.nav.tjenestepensjon.simulering.service.TpClient -import no.nav.tjenestepensjon.simulering.v1.consumer.FssGatewayAuthService -import no.nav.tjenestepensjon.simulering.v2.consumer.MaskinportenTokenClient -import org.junit.jupiter.api.AfterAll import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS import org.junit.jupiter.api.assertThrows import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest -import org.springframework.boot.test.mock.mockito.MockBean +import kotlin.test.AfterTest -@SpringBootTest(classes = [TpClient::class, WebClientConfig::class, ObjectMapperConfig::class, TestConfig::class]) -@TestInstance(PER_CLASS) +@SpringBootTest internal class WebClientConfigTest { - @MockBean - private lateinit var fssGatewayAuthService: FssGatewayAuthService - - @MockBean - private lateinit var aadClient: AADClient - - @MockBean - private lateinit var maskinportenTokenClient: MaskinportenTokenClient - @Autowired private lateinit var tpClient: TpClient @@ -42,13 +26,16 @@ internal class WebClientConfigTest { stubFor(get(urlPathEqualTo(defaultLeveradorUrl)).willReturn(aResponse())) } - @AfterAll + @AfterTest fun afterAll() { wireMockServer.stop() } @Test fun `Should throw exception if read timeout exceeded`() { - assertThrows { tpClient.findTpLeverandorName(TPOrdningIdDto(defaultTssid, defaultTpid)) } + assertThrows { + val findTpLeverandorName = tpClient.findTpLeverandorName(TPOrdningIdDto(defaultTssid, defaultTpid)) + print(findTpLeverandorName) + } } } diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml index 9f32a005..d96a3318 100644 --- a/src/test/resources/application.yml +++ b/src/test/resources/application.yml @@ -60,9 +60,6 @@ pen: gateway: url: http://localhost:8080 scope: api://bogus -spring: - profiles: - active: dev-gcp,test oftp: 2025: klp: