Skip to content

Commit

Permalink
Merge branch 'main' into fix/document-pdf-rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Oct 18, 2024
2 parents bb1227c + de4f7a0 commit 5315d15
Show file tree
Hide file tree
Showing 266 changed files with 7,407 additions and 3,566 deletions.
5 changes: 0 additions & 5 deletions apps/air-discount-scheme/api/infra/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ export const serviceSetup = (services: {
staging: ['loftbru', 'loftbru-cf'],
prod: ['loftbru'],
},
extraAnnotations: {
dev: {},
staging: {},
prod: {},
},
paths: ['/api/graphql'],
public: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@ export const serviceSetup = (): ServiceBuilder<'air-discount-scheme-backend'> =>
prod: 'loftbru',
},
extraAnnotations: {
dev: {},
staging: {},
dev: {
'nginx.ingress.kubernetes.io/enable-global-auth': 'false',
},
staging: {
'nginx.ingress.kubernetes.io/enable-global-auth': 'false',
},
prod: {},
},
paths: ['/api/swagger', '/api/public'],
Expand Down
1 change: 1 addition & 0 deletions apps/air-discount-scheme/web/infra/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export const serviceSetup = (services: {
prod: {
'nginx.ingress.kubernetes.io/proxy-buffering': 'on',
'nginx.ingress.kubernetes.io/proxy-buffer-size': '8k',
'nginx.ingress.kubernetes.io/enable-global-auth': 'false',
'nginx.ingress.kubernetes.io/configuration-snippet':
'rewrite /$ https://island.is/loftbru; rewrite /en$ https://island.is/en/lower-airfares-for-residents-in-rural-areas;',
},
Expand Down
5 changes: 0 additions & 5 deletions apps/api/infra/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,11 +450,6 @@ export const serviceSetup = (services: {
prod: ['', 'www.island.is'],
},
paths: ['/api'],
extraAnnotations: {
dev: {},
staging: {},
prod: {},
},
public: true,
},
})
Expand Down
2 changes: 1 addition & 1 deletion apps/consultation-portal/screens/Case/Case.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"failure": "Ekki tókst á afskrá áskrift fyrir mál"
},
"loginCardSkeleton": {
"text": "Þú þarft að skrá þig inn á island.is til þess að geta skráð þig í eða úr áskrift.",
"text": "Þú þarft að skrá þig inn á Island.is til þess að geta skráð þig í eða úr áskrift.",
"button": "Skrá mig inn"
},
"setEmailCardSkeleton": {
Expand Down
5 changes: 0 additions & 5 deletions apps/contentful-apps/infra/contentful-apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ export const serviceSetup = (): ServiceBuilder<'contentful-apps'> =>
prod: 'contentful-apps',
},
paths: ['/'],
extraAnnotations: {
dev: {},
staging: {},
prod: {},
},
},
})
.replicaCount({
Expand Down
5 changes: 0 additions & 5 deletions apps/download-service/infra/download-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@ export const serviceSetup = (services: {
prod: ['api'],
},
paths: ['/download'],
extraAnnotations: {
dev: {},
staging: {},
prod: {},
},
public: true,
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const AidAmountModal = ({
onVisibilityChange,
calculations,
}: Props) => {
const closeModal = (): void => {
const closeModal = () => {
onVisibilityChange(false)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useMemo, useContext } from 'react'
import React, { useState, useMemo } from 'react'
import cn from 'classnames'
import format from 'date-fns/format'

Expand Down
2 changes: 0 additions & 2 deletions apps/github-actions-cache/infra/github-actions-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ export const serviceSetup = (): ServiceBuilder<'github-actions-cache'> => {
dev: {
'nginx.ingress.kubernetes.io/enable-global-auth': 'false',
},
staging: {},
prod: {},
},
public: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { getModelToken } from '@nestjs/sequelize'
import { faker } from '@island.is/shared/mocking'
import { TicketStatus, ZendeskService } from '@island.is/clients/zendesk'
import { NationalRegistryClientService } from '@island.is/clients/national-registry-v2'
import { ErrorCodes } from '@island.is/shared/utils'

const currentUser = createCurrentUser({
scope: [DelegationAdminScopes.read, DelegationAdminScopes.admin],
Expand Down Expand Up @@ -339,6 +340,85 @@ describe('DelegationAdmin - With authentication', () => {
expect(res.status).toEqual(400)
})

it('POST /delegation-admin should not create delegation since it already exists', async () => {
// Arrange
const { toNationalId, fromNationalId } = {
toNationalId: '0101302399',
fromNationalId: '0101307789',
}

mockZendeskService(toNationalId, fromNationalId)

const existingDelegation = await factory.createCustomDelegation({
fromNationalId,
toNationalId,
domainName: null,
scopes: [{ scopeName: 's1' }],
referenceId: 'ref1',
})

const delegation: CreatePaperDelegationDto = {
toNationalId: existingDelegation.toNationalId,
fromNationalId: existingDelegation.fromNationalId,
referenceId: 'ref2',
}

// Act
const res = await getRequestMethod(
server,
'POST',
)('/delegation-admin').send(delegation)

// Assert
expect(res.status).toEqual(400)
expect(res.body).toMatchObject({
status: 400,
type: 'https://httpstatuses.org/400',
title: ErrorCodes.COULD_NOT_CREATE_DELEGATION,
detail: 'Could not create delegation',
})
})

it('POST /delegation-admin should not create delegation since the delegation id already exists', async () => {
// Arrange
const { toNationalId, fromNationalId } = {
toNationalId: '0101302399',
fromNationalId: '0101307789',
}

mockZendeskService(fromNationalId, toNationalId)

const existingDelegation = await factory.createCustomDelegation({
fromNationalId,
toNationalId,
domainName: null,
scopes: [{ scopeName: 's1' }],
referenceId: 'ref1',
})

// Send in opposite national ids so they will not exist in db
const delegation: CreatePaperDelegationDto = {
toNationalId: existingDelegation.fromNationalId,
fromNationalId: existingDelegation.toNationalId,
referenceId: 'ref1',
}

// Act
const res = await getRequestMethod(
server,
'POST',
)('/delegation-admin').send(delegation)

// Assert
expect(res.status).toEqual(400)
expect(res.body).toMatchObject({
status: 400,
type: 'https://httpstatuses.org/400',
title: ErrorCodes.REFERENCE_ID_ALREADY_EXISTS,
detail: 'Delegation with the same reference id already exists',
})
})

it('POST /delegation-admin should not create delegation with incorrect zendesk ticket status', async () => {
// Arrange
mockZendeskService(toNationalId, fromNationalId, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ export const serviceSetup =
prod: 'contentful-entry-tagger-service.devland.is',
},
paths: ['/'],
extraAnnotations: {
dev: {},
staging: {},
prod: {},
},
},
})
.liveness('/liveness')
Expand Down
5 changes: 0 additions & 5 deletions apps/services/license-api/infra/license-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,6 @@ export const serviceSetup = (): ServiceBuilder<'license-api'> =>
},
paths: ['/'],
public: false,
extraAnnotations: {
dev: {},
staging: {},
prod: {},
},
},
})
.replicaCount({
Expand Down
8 changes: 6 additions & 2 deletions apps/services/search-indexer/infra/search-indexer-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,12 @@ export const serviceSetup = (): ServiceBuilder<'search-indexer-service'> =>
},
paths: ['/'],
extraAnnotations: {
dev: {},
staging: {},
dev: {
'nginx.ingress.kubernetes.io/enable-global-auth': 'false',
},
staging: {
'nginx.ingress.kubernetes.io/enable-global-auth': 'false',
},
prod: {},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,8 @@ PensionCalculatorResults.getProps = async ({
input: calculationInput,
},
}),
calculationInput.typeOfBasePension ===
SocialInsurancePensionCalculationBasePensionType.Disability &&
is2025PreviewActive(customPageData)
? apolloClient.query<Query, QueryGetPensionCalculationArgs>({
query: GET_PENSION_CALCULATION,
Expand All @@ -645,6 +647,8 @@ PensionCalculatorResults.getProps = async ({
...calculationInput,
startYear: 2025,
startMonth: 9,
typeOfBasePension:
SocialInsurancePensionCalculationBasePensionType.NewSystem,
},
},
})
Expand Down
2 changes: 2 additions & 0 deletions charts/islandis/values.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ air-discount-scheme-backend:
primary-alb:
annotations:
kubernetes.io/ingress.class: 'nginx-external-alb'
nginx.ingress.kubernetes.io/enable-global-auth: 'false'
nginx.ingress.kubernetes.io/service-upstream: 'true'
hosts:
- host: 'loftbru.dev01.devland.is'
Expand Down Expand Up @@ -1987,6 +1988,7 @@ search-indexer-service:
primary-alb:
annotations:
kubernetes.io/ingress.class: 'nginx-external-alb'
nginx.ingress.kubernetes.io/enable-global-auth: 'false'
nginx.ingress.kubernetes.io/service-upstream: 'true'
hosts:
- host: 'search-indexer-service.dev01.devland.is'
Expand Down
1 change: 1 addition & 0 deletions charts/islandis/values.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ air-discount-scheme-web:
annotations:
kubernetes.io/ingress.class: 'nginx-external-alb'
nginx.ingress.kubernetes.io/configuration-snippet: 'rewrite /$ https://island.is/loftbru; rewrite /en$ https://island.is/en/lower-airfares-for-residents-in-rural-areas;'
nginx.ingress.kubernetes.io/enable-global-auth: 'false'
nginx.ingress.kubernetes.io/proxy-buffer-size: '8k'
nginx.ingress.kubernetes.io/proxy-buffering: 'on'
nginx.ingress.kubernetes.io/service-upstream: 'true'
Expand Down
2 changes: 2 additions & 0 deletions charts/islandis/values.staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ air-discount-scheme-backend:
primary-alb:
annotations:
kubernetes.io/ingress.class: 'nginx-external-alb'
nginx.ingress.kubernetes.io/enable-global-auth: 'false'
nginx.ingress.kubernetes.io/service-upstream: 'true'
hosts:
- host: 'loftbru.staging01.devland.is'
Expand Down Expand Up @@ -1725,6 +1726,7 @@ search-indexer-service:
primary-alb:
annotations:
kubernetes.io/ingress.class: 'nginx-external-alb'
nginx.ingress.kubernetes.io/enable-global-auth: 'false'
nginx.ingress.kubernetes.io/service-upstream: 'true'
hosts:
- host: 'search-indexer-service.staging01.devland.is'
Expand Down
69 changes: 69 additions & 0 deletions infra/src/dsl/ingress.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,73 @@ describe('Ingress definitions', () => {
},
})
})
it('No annotations is permitted', async () => {
const sut = service('api').ingress({
primary: {
public: false,
host: { dev: 'a', staging: 'a', prod: 'a' },
paths: ['/api'],
extraAnnotations: {
staging: {
'nginx.ingress.kubernetes.io/foo': 'true',
},
},
},
})
const result = (await generateOutputOne({
outputFormat: renderers.helm,
service: sut,
runtime: new Kubernetes(Staging),
env: Staging,
})) as SerializeSuccess<HelmService>

expect(result.serviceDef[0].ingress).toEqual({
'primary-alb': {
annotations: {
'kubernetes.io/ingress.class': 'nginx-internal-alb',
'nginx.ingress.kubernetes.io/service-upstream': 'true',
'nginx.ingress.kubernetes.io/foo': 'true',
},
hosts: [
{
host: 'a.internal.staging01.devland.is',
paths: ['/api'],
},
],
},
})
})
it('Empty annotations are valid', async () => {
const sut = service('api').ingress({
primary: {
public: false,
host: { dev: 'a', staging: 'a', prod: 'a' },
paths: ['/api'],
extraAnnotations: {
staging: {},
},
},
})
const result = (await generateOutputOne({
outputFormat: renderers.helm,
service: sut,
runtime: new Kubernetes(Staging),
env: Staging,
})) as SerializeSuccess<HelmService>

expect(result.serviceDef[0].ingress).toEqual({
'primary-alb': {
annotations: {
'kubernetes.io/ingress.class': 'nginx-internal-alb',
'nginx.ingress.kubernetes.io/service-upstream': 'true',
},
hosts: [
{
host: 'a.internal.staging01.devland.is',
paths: ['/api'],
},
],
},
})
})
})
4 changes: 2 additions & 2 deletions infra/src/dsl/types/input-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ export interface Ingress {
}
paths: string[]
public?: boolean
extraAnnotations?: {
extraAnnotations?: Partial<{
[env in OpsEnv]: { [annotation: string]: string | null }
}
}>
}

export interface IngressForEnv {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export enum BasePensionType {
Disability = 'Disability',
Rehabilitation = 'Rehabilitation',
HalfRetirement = 'HalfRetirement',
NewSystem = 'NewSystem',
}

registerEnumType(BasePensionType, {
Expand Down
1 change: 1 addition & 0 deletions libs/api/domains/social-insurance/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const basePensionTypeMapping: Record<BasePensionType, number> = {
[BasePensionType.Disability]: 3, // Örorkulífeyrir
[BasePensionType.Rehabilitation]: 4, // Endurhæfingarlífeyrir
[BasePensionType.HalfRetirement]: 5, // Hálfur Ellilífeyrir
[BasePensionType.NewSystem]: 6, // Nýtt kerfi sem tekur gildi 1. september 2025
}

const livingConditionMapping: Record<LivingCondition, number> = {
Expand Down
Loading

0 comments on commit 5315d15

Please sign in to comment.