Skip to content

Commit

Permalink
Unleash next
Browse files Browse the repository at this point in the history
  • Loading branch information
andersrognstad committed Sep 8, 2023
1 parent 8d9db7b commit 650e3e8
Show file tree
Hide file tree
Showing 20 changed files with 516 additions and 450 deletions.
2 changes: 2 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ SYFOPERSON_AAD_APP_CLIENT_ID=dev-gcp.teamsykefravr.syfoperson
SYFOVEILEDER_HOST=syfoveileder.intern.nav.no
SYFOVEILEDER_AAD_APP_CLIENT_ID=dev-fss.teamsykefravr.syfoveileder
MODIACONTEXTHOLDER_AAD_APP_CLIENT_ID="dev-fss.personoversikt.modiacontextholder-q1"
UNLEASH_SERVER_API_URL=https://teamsykefravr-unleash-api.nav.cloud.nais.io/api
UNLEASH_SERVER_API_TOKEN=kjempesikkert-token

LOG_LEVEL=debug
28 changes: 28 additions & 0 deletions .github/workflows/unleash-apitoken.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Deploy unleash api-tokens
on:
push:
branches:
- master
paths:
- '.github/workflows/unleash-apitokens.yaml'
- '.nais/unleash/unleash-apitoken-dev.yaml'
- '.nais/unleash/unleash-apitoken-prod.yaml'
jobs:
apply-apitoken-unleash:
name: Apply ApiToken for Unleash to cluster
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Deploy to dev
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: .nais/unleash/unleash-apitoken-dev.yaml
- name: Deploy to prod
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: prod-gcp
RESOURCE: .nais/unleash/unleash-apitoken-prod.yaml
2 changes: 2 additions & 0 deletions .nais/naiserator-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@ spec:
envFrom:
- secret: syfooversikt-session-key
- secret: syfooversikt-redis-password
- secret: syfooversikt-unleash-api-token
accessPolicy:
outbound:
external:
- host: "login.microsoftonline.com"
- host: "internarbeidsflatedecorator-q1.dev-fss-pub.nais.io"
- host: "modiacontextholder-q1.dev-fss-pub.nais.io"
- host: "ereg-services-q1.dev-fss-pub.nais.io"
- host: "teamsykefravr-unleash-api.nav.cloud.nais.io"
rules:
- application: syfooversiktsrv
- application: syfoperson
Expand Down
2 changes: 2 additions & 0 deletions .nais/naiserator-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@ spec:
envFrom:
- secret: syfooversikt-session-key
- secret: syfooversikt-redis-password
- secret: syfooversikt-unleash-api-token
accessPolicy:
outbound:
external:
- host: "login.microsoftonline.com"
- host: "internarbeidsflatedecorator.prod-fss-pub.nais.io"
- host: "modiacontextholder.prod-fss-pub.nais.io"
- host: "ereg-services.prod-fss-pub.nais.io"
- host: "teamsykefravr-unleash-api.nav.cloud.nais.io"
rules:
- application: syfooversiktsrv
- application: syfoperson
Expand Down
14 changes: 14 additions & 0 deletions .nais/unleash/unleash-apitoken-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: unleash.nais.io/v1
kind: ApiToken
metadata:
name: syfooversikt
namespace: teamsykefravr
labels:
team: teamsykefravr
spec:
unleashInstance:
apiVersion: unleash.nais.io/v1
kind: RemoteUnleash
name: teamsykefravr
secretName: syfooversikt-unleash-api-token
environment: development
14 changes: 14 additions & 0 deletions .nais/unleash/unleash-apitoken-prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: unleash.nais.io/v1
kind: ApiToken
metadata:
name: syfooversikt
namespace: teamsykefravr
labels:
team: teamsykefravr
spec:
unleashInstance:
apiVersion: unleash.nais.io/v1
kind: RemoteUnleash
name: teamsykefravr
secretName: syfooversikt-unleash-api-token
environment: production
2 changes: 1 addition & 1 deletion mock/mockEndepunkter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { mockSyfoveileder } from './syfoveileder/mockSyfoveileder';
import { mockPersonoversikt } from './personoversikt/mockPersonoversikt';
import { mockPersontildeling } from './persontildeling/mockPersontildeling';
import { mockChangelogs } from './changelogs/mockChangelogs';
import { mockUnleash } from './unleash/mockUnleash';
import { mockUnleash } from './mockUnleash';
import { mockEreg } from './ereg/mockEreg';
import { generatePersons } from './mockUtils';

Expand Down
20 changes: 20 additions & 0 deletions mock/mockUnleash.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { ToggleNames } from '../src/data/unleash/types/unleash_types';
import express from 'express';
import { UNLEASH_ROOT } from '../src/apiConstants';

export const mockUnleash = (server: express.Application) => {
server.get(
`${UNLEASH_ROOT}/toggles`,
(req: express.Request, res: express.Response) => {
res.setHeader('Content-Type', 'application/json');
res.send(JSON.stringify(unleashMock));
}
);
};

export const unleashMock = Object.values(ToggleNames).reduce(
(accumulator, toggleName) => {
return { ...accumulator, [toggleName]: true };
},
{}
);
14 changes: 0 additions & 14 deletions mock/unleash/mockUnleash.ts

This file was deleted.

8 changes: 0 additions & 8 deletions mock/unleash/unleashMock.ts

This file was deleted.

Loading

0 comments on commit 650e3e8

Please sign in to comment.