Skip to content

Commit 08d51c0

Browse files
Legg til deploy og nais filer (#1)
Init
1 parent bcb767c commit 08d51c0

File tree

13 files changed

+723
-0
lines changed

13 files changed

+723
-0
lines changed

.deploy/nais/nais-preprod.yaml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
apiVersion: "nais.io/v1alpha1"
2+
kind: "Application"
3+
metadata:
4+
name: familie-ks-barnehagelister
5+
namespace: teamfamilie
6+
labels:
7+
team: teamfamilie
8+
annotations:
9+
nais.io/restricted: "true"
10+
11+
spec:
12+
image: {{ image }}
13+
port: 8096
14+
liveness:
15+
path: /internal/health/liveness
16+
initialDelay: 30
17+
failureThreshold: 10
18+
readiness:
19+
path: /internal/health/readiness
20+
initialDelay: 30
21+
failureThreshold: 10
22+
prometheus:
23+
enabled: true
24+
path: /internal/prometheus
25+
vault:
26+
enabled: false
27+
replicas:
28+
min: 1
29+
max: 2
30+
resources:
31+
limits:
32+
memory: 2048Mi
33+
requests:
34+
memory: 1024Mi
35+
cpu: 200m
36+
secureLogs:
37+
enabled: true
38+
ingresses: # Optional. List of ingress URLs that will route HTTP traffic to the application.
39+
- https://familie-ks-barnehagelister.intern.dev.nav.no
40+
- https://familie-ks-barnehagelister.ekstern.dev.nav.no
41+
maskinporten:
42+
enabled: true
43+
scopes:
44+
exposes:
45+
- name: "v1/kontantstotte/barnehagelister"
46+
enabled: true
47+
product: "familie"
48+
allowedIntegrations:
49+
- maskinporten
50+
atMaxAge: 680
51+
consumers:
52+
- name: "NAV"
53+
orgno: "889640782"
54+
consumes:
55+
- name: "nav:familie/v1/kontantstotte/barnehagelister"
56+
accessPolicy:
57+
outbound:
58+
rules:
59+
- application: familie-ks-sak
60+
cluster: dev-gcp
61+
observability:
62+
logging:
63+
destinations:
64+
- id: loki
65+
- id: elastic
66+
autoInstrumentation:
67+
enabled: true
68+
runtime: java
69+
env:
70+
- name: SPRING_PROFILES_ACTIVE
71+
value: preprod
72+
- name: JAVA_OPTS
73+
value: "-Xmx1g"

.deploy/nais/nais-prod.yaml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
apiVersion: "nais.io/v1alpha1"
2+
kind: "Application"
3+
metadata:
4+
name: familie-ks-barnehagelister
5+
namespace: teamfamilie
6+
labels:
7+
team: teamfamilie
8+
annotations:
9+
nais.io/restricted: "true"
10+
11+
spec:
12+
image: {{ image }}
13+
port: 8096
14+
liveness:
15+
path: /internal/health/liveness
16+
initialDelay: 30
17+
failureThreshold: 10
18+
readiness:
19+
path: /internal/health/readiness
20+
initialDelay: 30
21+
failureThreshold: 10
22+
prometheus:
23+
enabled: true
24+
path: /internal/prometheus
25+
vault:
26+
enabled: false
27+
replicas:
28+
min: 1
29+
max: 2
30+
resources:
31+
limits:
32+
memory: 2048Mi
33+
requests:
34+
memory: 1024Mi
35+
cpu: 200m
36+
secureLogs:
37+
enabled: true
38+
ingresses: # Optional. List of ingress URLs that will route HTTP traffic to the application.
39+
- https://familie-ks-barnehagelister.intern.nav.no
40+
- https://familie-ks-barnehagelister.nav.no
41+
maskinporten:
42+
enabled: true
43+
scopes:
44+
exposes:
45+
- name: "v1/kontantstotte/barnehagelister"
46+
enabled: true
47+
product: "familie"
48+
allowedIntegrations:
49+
- maskinporten
50+
atMaxAge: 680
51+
consumers:
52+
- name: "NAV"
53+
orgno: "889640782"
54+
consumes:
55+
- name: "nav:familie/v1/kontantstotte/barnehagelister"
56+
accessPolicy:
57+
outbound:
58+
rules:
59+
- application: familie-ks-sak
60+
cluster: prod-gcp
61+
observability:
62+
logging:
63+
destinations:
64+
- id: loki
65+
- id: elastic
66+
autoInstrumentation:
67+
enabled: true
68+
runtime: java
69+
env:
70+
- name: SPRING_PROFILES_ACTIVE
71+
value: prod
72+
- name: JAVA_OPTS
73+
value: "-Xmx1g"

.github/workflows/CodeQl.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ "main"]
6+
pull_request:
7+
# The branches below must be a subset of the branches above
8+
branches: [ "main" ]
9+
10+
jobs:
11+
analyze:
12+
name: Analyze
13+
runs-on: ubuntu-latest
14+
permissions:
15+
actions: read
16+
contents: read
17+
security-events: write
18+
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
language: [ 'java' ]
23+
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
# Initializes the CodeQL tools for scanning.
30+
- name: Initialize CodeQL
31+
uses: github/codeql-action/init@v3
32+
with:
33+
languages: ${{ matrix.language }}
34+
35+
- uses: actions/setup-java@v4
36+
with:
37+
java-version: 21
38+
distribution: 'temurin'
39+
cache: 'maven'
40+
41+
- name: Bygg med maven
42+
env:
43+
GITHUB_USERNAME: x-access-token
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
run: |
46+
mvn -B --no-transfer-progress package --settings .m2/maven-settings.xml --file pom.xml
47+
48+
- name: Perform CodeQL Analysis
49+
uses: github/codeql-action/analyze@v3
50+
with:
51+
category: "/language:${{matrix.language}}"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Build-Deploy-Prod
2+
on:
3+
push:
4+
branches:
5+
- 'main'
6+
env:
7+
IMAGE: ghcr.io/navikt/familie-ks-barnehagelister:${{ github.sha }}
8+
IMAGE_LATEST: ghcr.io/navikt/familie-ks-barnehagelister:latest
9+
jobs:
10+
deploy:
11+
name: Bygg app/image, push til github, deploy til dev-fss/prod-fss
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
id-token: write
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-java@v4
19+
with:
20+
java-version: 21
21+
distribution: 'temurin'
22+
cache: 'maven'
23+
- name: Bygg med maven
24+
env:
25+
GITHUB_USERNAME: x-access-token
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
run: |
28+
mvn -B --no-transfer-progress package --settings .m2/maven-settings.xml --file pom.xml
29+
30+
- uses: nais/docker-build-push@v0
31+
id: docker-push
32+
with:
33+
team: teamfamilie
34+
push_image: true
35+
dockerfile: Dockerfile
36+
docker_context: .
37+
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
38+
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
39+
byosbom: target/classes/META-INF/sbom/application.cdx.json
40+
41+
- name: Deploy til prod-gcp
42+
uses: nais/deploy/actions/deploy@v2
43+
env:
44+
CLUSTER: prod-gcp
45+
RESOURCE: .deploy/nais/nais-prod.yaml
46+
IMAGE: ${{ steps.docker-push.outputs.image }}
+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Build-Deploy-Preprod
2+
on:
3+
pull_request:
4+
types: [ opened, synchronize, reopened, ready_for_review ]
5+
workflow_dispatch:
6+
env:
7+
IMAGE: ghcr.io/navikt/familie-ks-barnehagelister:${{ github.sha }}
8+
jobs:
9+
ktlint:
10+
name: Ktlint
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
- uses: actions/setup-java@v4
19+
with:
20+
java-version: 21
21+
distribution: 'temurin'
22+
cache: 'maven'
23+
- name: Kjør ktlint
24+
env:
25+
GITHUB_USERNAME: x-access-token
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
run: |
28+
mvn antrun:run@ktlint
29+
deploy:
30+
name: Bygg app/image, push til github, deploy til dev-fss/prod-fss
31+
runs-on: ubuntu-latest
32+
permissions:
33+
packages: write
34+
pull-requests: write
35+
contents: read
36+
id-token: write
37+
steps:
38+
- uses: actions/checkout@v4
39+
- uses: actions/setup-java@v4
40+
with:
41+
java-version: 21
42+
distribution: 'temurin'
43+
cache: 'maven'
44+
- name: Bygg med maven
45+
env:
46+
GITHUB_USERNAME: x-access-token
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
run: |
49+
mvn -B --no-transfer-progress package --settings .m2/maven-settings.xml --file pom.xml
50+
51+
- uses: nais/docker-build-push@v0
52+
id: docker-push
53+
if: github.event.pull_request.user.login != 'dependabot[bot]'
54+
with:
55+
team: teamfamilie
56+
push_image: true
57+
dockerfile: Dockerfile
58+
docker_context: .
59+
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
60+
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
61+
byosbom: target/classes/META-INF/sbom/application.cdx.json
62+
63+
- name: Deploy til dev-gcp
64+
if: github.event.pull_request.user.login != 'dependabot[bot]'
65+
uses: nais/deploy/actions/deploy@v2
66+
env:
67+
CLUSTER: dev-gcp
68+
RESOURCE: .deploy/nais/nais-preprod.yaml
69+
IMAGE: ${{ steps.docker-push.outputs.image }}
70+
71+
- name: Dependabot metadata
72+
if: github.event.pull_request.user.login == 'dependabot[bot]'
73+
id: metadata
74+
uses: dependabot/fetch-metadata@v2
75+
with:
76+
github-token: "${{ secrets.GITHUB_TOKEN }}"
77+
78+
- name: Approve a PR
79+
if: github.event.pull_request.user.login == 'dependabot[bot]'
80+
run: gh pr review --approve "$PR_URL"
81+
env:
82+
PR_URL: ${{github.event.pull_request.html_url}}
83+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@
2222
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
2323
hs_err_pid*
2424
replay_pid*
25+
26+
.idea
27+
target

.m2/maven-settings.xml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
4+
http://maven.apache.org/xsd/settings-1.0.0.xsd">
5+
6+
<servers>
7+
<server>
8+
<id>github</id>
9+
<username>${GITHUB_USERNAME}</username>
10+
<password>${GITHUB_TOKEN}</password>
11+
</server>
12+
</servers>
13+
14+
</settings>

Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM busybox:1.36.1-uclibc as busybox
2+
3+
# Final image
4+
FROM gcr.io/distroless/java21:nonroot
5+
COPY --from=busybox /bin/printenv /bin/printenv
6+
COPY --chown=nonroot:nonroot ./target/familie-ks-barnehagelister.jar /app/app.jar
7+
WORKDIR /app
8+
9+
ENV APP_NAME=familie-ks-barnehagelister
10+
ENV TZ="Europe/Oslo"
11+
# TLS Config works around an issue in OpenJDK... See: https://github.com/kubernetes-client/java/issues/854
12+
ENTRYPOINT [ "java", "-Djdk.tls.client.protocols=TLSv1.2", "-jar", "/app/app.jar" ]
13+

0 commit comments

Comments
 (0)