-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Init * Oppdater yamls * kobling mellom brev kafka og brev vanlig * Tmp commit muligens noen forbedringer rundt BrevDataRedigerbarRequest i opprettjournalfoerogdistribuer først * Implementere ruter mot brev-api og bytte til client credentials * Legg til ny avsender req obj * Oppdater vedtaksbrevjournalføring route * EY-4499 Hente grunnlag i brev-kafka * Fjern kommer i brev model * Ta i mot brevid rest * EY-4499 Håndtere om brev er distribuert * Vi forventer suksess så bruk default exceptionhandler for ktor og logg riktig feilkode * Glemte return * Ta inn distribusjonstype * Map avdøde * EY-4499 Bruk brev-api sin offsett * Legg inn access i egen per * Skru av rivers initielt * For safety delete prod yaml * Legg til deploy fil * Rette workflow fil * Riktig name på workflowen * Fjern unødvendig tilgangsting i dev yaml * Eksplisitt håndtering av nullresponse * Døpe om brev distribusjon dto * Legg inn tilgang mot grunnlag igjen..... * Legg til topic for dev og fjern deploy ved main for å kunne styre dette selv * Kommentar
- Loading branch information
1 parent
c1cc69e
commit 04a81c0
Showing
23 changed files
with
886 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: etterlatte-brev-kafka | ||
|
||
on: | ||
workflow_dispatch: # Allow manually triggered workflow run | ||
inputs: | ||
deploy-prod: | ||
description: 'Deploy til produksjon' | ||
required: false | ||
default: 'false' | ||
type: choice | ||
options: | ||
- true | ||
- false | ||
pull_request: # TODO: her mangler vi push som vanligvis deployer ved merge til main | ||
branches: | ||
- main | ||
paths: | ||
- apps/etterlatte-brev-kafka/** | ||
- "!apps/etterlatte-brev-kafka/.nais/*" | ||
- libs/saksbehandling-common/** | ||
- libs/etterlatte-ktor/** | ||
- libs/etterlatte-behandling-model/** | ||
- libs/etterlatte-beregning-model/** | ||
- libs/etterlatte-database/** | ||
- libs/etterlatte-migrering-model/** | ||
- libs/etterlatte-trygdetid-model/** | ||
- libs/etterlatte-vedtaksvurdering-model/** | ||
- libs/etterlatte-vilkaarsvurdering-model/** | ||
- libs/etterlatte-brev-model/** | ||
- libs/etterlatte-oppgave-model/** | ||
- libs/etterlatte-tilbakekreving-model/** | ||
- gradle/libs.versions.toml | ||
|
||
permissions: | ||
contents: write | ||
id-token: write | ||
|
||
jobs: | ||
test: | ||
if: github.event_name == 'pull_request' | ||
uses: ./.github/workflows/.test.yaml | ||
secrets: inherit | ||
|
||
build-and-deploy: | ||
if: github.event_name != 'pull_request' | ||
uses: ./.github/workflows/.build-and-deploy.yaml | ||
secrets: inherit |
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
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
apiVersion: "nais.io/v1alpha1" | ||
kind: "Application" | ||
metadata: | ||
name: etterlatte-brev-kafka | ||
namespace: etterlatte | ||
labels: | ||
team: etterlatte | ||
annotations: | ||
reloader.stakater.com/match: "true" | ||
spec: | ||
image: "{{image}}" | ||
port: 8080 | ||
liveness: | ||
initialDelay: 5 | ||
path: /health/isalive | ||
readiness: | ||
initialDelay: 5 | ||
path: /health/isready | ||
prometheus: | ||
enabled: true | ||
path: /metrics | ||
observability: | ||
autoInstrumentation: | ||
enabled: true | ||
runtime: java | ||
logging: | ||
destinations: | ||
- id: elastic | ||
- id: loki | ||
secureLogs: | ||
enabled: true | ||
azure: | ||
application: | ||
enabled: true | ||
kafka: | ||
pool: nav-dev | ||
resources: | ||
limits: | ||
memory: 640Mi | ||
requests: | ||
cpu: 20m | ||
memory: 512Mi | ||
replicas: | ||
scalingStrategy: | ||
cpu: | ||
thresholdPercentage: 90 | ||
max: 1 | ||
min: 1 | ||
env: | ||
- name: KAFKA_RAPID_TOPIC | ||
value: etterlatte.dodsmelding | ||
- name: BREV_API_URL | ||
value: http://etterlatte-brev-api | ||
- name: BREV_API_AZURE_SCOPE | ||
value: api://dev-gcp.etterlatte.etterlatte-brev-api/.default | ||
- name: GRUNNLAG_URL | ||
value: http://etterlatte-grunnlag | ||
- name: GRUNNLAG_AZURE_SCOPE | ||
value: api://dev-gcp.etterlatte.etterlatte-grunnlag/.default | ||
envFrom: | ||
- secret: my-application-unleash-api-token | ||
accessPolicy: | ||
outbound: | ||
rules: | ||
- application: etterlatte-brev-api | ||
- application: etterlatte-grunnlag | ||
external: | ||
- host: etterlatte-unleash-api.nav.cloud.nais.io | ||
inbound: | ||
rules: | ||
- application: etterlatte-testdata-behandler | ||
- application: azure-token-generator # https://docs.nais.io/auth/entra-id/how-to/generate/?h=token+azure | ||
namespace: aura | ||
cluster: dev-gcp |
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,11 @@ | ||
plugins { | ||
id("etterlatte.common") | ||
} | ||
|
||
dependencies { | ||
implementation(project(":libs:saksbehandling-common")) | ||
implementation(project(":libs:rapidsandrivers-extras")) | ||
implementation(project(":libs:etterlatte-ktor")) | ||
implementation(project(":libs:etterlatte-vedtaksvurdering-model")) | ||
implementation(project(":libs:etterlatte-brev-model")) | ||
} |
72 changes: 72 additions & 0 deletions
72
apps/etterlatte-brev-kafka/src/main/kotlin/no/nav/etterlatte/Applicaton.kt
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 @@ | ||
package no.nav.etterlatte | ||
|
||
import com.fasterxml.jackson.databind.SerializationFeature | ||
import com.typesafe.config.ConfigFactory | ||
import io.ktor.client.HttpClient | ||
import no.nav.etterlatte.klienter.BrevapiKlient | ||
import no.nav.etterlatte.klienter.GrunnlagKlient | ||
import no.nav.etterlatte.libs.common.appIsInGCP | ||
import no.nav.etterlatte.libs.ktor.httpClientClientCredentials | ||
import no.nav.etterlatte.rapidsandrivers.configFromEnvironment | ||
import no.nav.etterlatte.rivers.DistribuerBrevRiver | ||
import no.nav.etterlatte.rivers.JournalfoerVedtaksbrevRiver | ||
import no.nav.etterlatte.rivers.OpprettJournalfoerOgDistribuerRiver | ||
import no.nav.etterlatte.rivers.SamordningsnotatRiver | ||
import no.nav.etterlatte.rivers.VedtaksbrevUnderkjentRiver | ||
import no.nav.helse.rapids_rivers.RapidsConnection | ||
import rapidsandrivers.initRogR | ||
|
||
fun main() { | ||
ApplicationBuilder() | ||
} | ||
|
||
class ApplicationBuilder { | ||
private val config = ConfigFactory.load() | ||
private val brevhttpKlient: HttpClient by lazy { | ||
httpClientClientCredentials( | ||
azureAppClientId = config.getString("azure.app.client.id"), | ||
azureAppJwk = config.getString("azure.app.jwk"), | ||
azureAppWellKnownUrl = config.getString("azure.app.well.known.url"), | ||
azureAppScope = config.getString("brevapi.azure.scope"), | ||
ekstraJacksoninnstillinger = { it.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) }, | ||
) | ||
} | ||
|
||
private val grunnlagHttpKlient: HttpClient by lazy { | ||
httpClientClientCredentials( | ||
azureAppClientId = config.getString("azure.app.client.id"), | ||
azureAppJwk = config.getString("azure.app.jwk"), | ||
azureAppWellKnownUrl = config.getString("azure.app.well.known.url"), | ||
azureAppScope = config.getString("grunnlag.azure.scope"), | ||
ekstraJacksoninnstillinger = { it.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) }, | ||
) | ||
} | ||
private val brevapiKlient = BrevapiKlient(config, brevhttpKlient) | ||
private val grunnlagKlient = GrunnlagKlient(config, grunnlagHttpKlient) | ||
private val connection = | ||
initRogR( | ||
applikasjonsnavn = "brev-kafka", | ||
kafkaConsumerGroupName = "etterlattebrevapi", // TODO; bruke samme offset som brev-api appen | ||
configFromEnvironment = { configFromEnvironment(it) }, | ||
) { rapidsConnection, _ -> | ||
|
||
rapidsConnection.register( | ||
object : RapidsConnection.StatusListener { | ||
override fun onStartup(rapidsConnection: RapidsConnection) { | ||
} | ||
}, | ||
) | ||
// TODO: start med å merge inn uten å aktivere rivers | ||
if (!appIsInGCP()) { | ||
OpprettJournalfoerOgDistribuerRiver( | ||
brevapiKlient, | ||
grunnlagKlient, | ||
rapidsConnection, | ||
) | ||
JournalfoerVedtaksbrevRiver(rapidsConnection, brevapiKlient) | ||
VedtaksbrevUnderkjentRiver(rapidsConnection, brevapiKlient) | ||
DistribuerBrevRiver(rapidsConnection, brevapiKlient) | ||
SamordningsnotatRiver(rapidsConnection, brevapiKlient) | ||
} | ||
} | ||
} |
Oops, something went wrong.