Skip to content

Commit

Permalink
Dynamisk Konsumer oppgradering (#25)
Browse files Browse the repository at this point in the history
* trigger on dispatch & only deploy to alpha

* upgrade infra-models library

* trigger on push in this branch

* add default server config

* convert to flais application

* add latest tag to image

* upgrade infra models library

* increase cpu to 1 & change to new ingress

* ensure capabilities on registration (#24)

* update CD on release
  • Loading branch information
hknots authored Nov 5, 2024
1 parent db818e1 commit a8e9567
Show file tree
Hide file tree
Showing 28 changed files with 121 additions and 381 deletions.
87 changes: 12 additions & 75 deletions .github/workflows/CD.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
name: CD

on:
repository_dispatch:
types: [trigger-cd]
workflow_dispatch:

push:
tags:
- 'v*'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
NAMESPACE: fint-core

jobs:
build-and-push:
Expand All @@ -18,93 +16,32 @@ jobs:
permissions:
contents: read
packages: write
outputs:
tags: ${{ steps.meta.outputs.tags }}
steps:
- name: Checkout repository
uses: actions/checkout@v4.0.0

- name: Login to Docker Hub
uses: docker/login-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2.2.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
uses: docker/metadata-action@v4.6.0
id: meta
uses: docker/metadata-action@v4.6.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: type=sha,enable=true,priority=100,prefix=shaF-,suffix=,format=short
tags: |
type=ref,event=branch,enable=false
type=ref,event=tag,enable=true,format=short,priority=10
type=sha,enable=true,priority=100,prefix=sha-,suffix=,format=short
latest
- name: Build and push Docker image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

deploy-to-aks:
name: deploy to ${{ matrix.cluster }}
runs-on: ubuntu-latest
needs: build-and-push
permissions:
contents: read
packages: write
strategy:
matrix:
cluster:
- aks-alpha-fint-2021-11-18
- aks-beta-fint-2021-11-23
- aks-api-fint-2022-02-08
# - aks-pwf-fint-2021-10-20

steps:
- name: Checkout repository
uses: actions/checkout@v4.0.0

- name: Get environment
uses: actions/github-script@v6
id: environment
with:
script: return '${{ matrix.cluster }}'.split('-')[1]
result-encoding: string

- name: Get resource group name
uses: actions/github-script@v6
id: resource-group
with:
script: return 'rg-aks-${{ steps.environment.outputs.result }}'
result-encoding: string

- name: Bake manifests with Kustomize
uses: azure/k8s-bake@v2.4
id: bake
with:
renderEngine: 'kustomize'
kustomizationPath: 'kustomize/overlays/${{ steps.environment.outputs.result }}'

- uses: azure/login@v1
with:
creds: "${{ secrets[format('AKS_{0}_FINT_GITHUB', steps.environment.outputs.result)] }}"

- uses: azure/use-kubelogin@v1.1
with:
kubelogin-version: 'v0.0.26'

- uses: azure/aks-set-context@v3
with:
resource-group: '${{ steps.resource-group.outputs.result }}'
cluster-name: '${{ matrix.cluster }}'
admin: 'true'
use-kubelogin: 'true'

- name: Deploy to cluster
uses: azure/k8s-deploy@v4.9
with:
action: deploy
manifests: ${{ steps.bake.outputs.manifestsBundle }}
images: ${{ needs.build-and-push.outputs.tags }}
namespace: ${{ env.NAMESPACE }}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies {
implementation 'org.springdoc:springdoc-openapi-starter-webflux-ui:2.4.0'

implementation 'no.fint:fint-event-model:3.0.2'
implementation 'no.fintlabs:fint-core-infra-models:2.0.0-rc-2'
implementation 'no.fintlabs:fint-core-infra-models:2.0.0-rc-12'
implementation 'no.fintlabs:fint-kafka:3.2.0-rc-1'
implementation 'no.fintlabs:fint-core-resource-server-security:2.1.0'

Expand Down
24 changes: 24 additions & 0 deletions kustomize/base/application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: fintlabs.no/v1alpha1
kind: Application
metadata:
name: fint-core-provider-gateway
namespace: fint-core
spec:
port: 8080
orgId: fintlabs.no
image: ghcr.io/fintlabs/fint-core-provider-gateway-test:latest
env:
- name: JAVA_TOOL_OPTIONS
value: '-XX:+ExitOnOutOfMemoryError -Xmx786m'
kafka:
enabled: true
acls:
- topic: '*.fint-core.*'
permission: admin
resources:
limits:
memory: "1024Mi"
cpu: "100m"
requests:
memory: "128Mi"
cpu: "100m"
13 changes: 0 additions & 13 deletions kustomize/base/config-map.yaml

This file was deleted.

35 changes: 0 additions & 35 deletions kustomize/base/deployment.yaml

This file was deleted.

13 changes: 0 additions & 13 deletions kustomize/base/ingress-route.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions kustomize/base/kafka-user-and-acl.yaml

This file was deleted.

15 changes: 10 additions & 5 deletions kustomize/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: fint-core
resources:
- kafka-user-and-acl.yaml
- deployment.yaml
- service.yaml
- ingress-route.yaml
- config-map.yaml
- application.yaml
labels:
- pairs:
app.kubernetes.io/name: fint-core-provider-gateway
app.kubernetes.io/instance: fint-core-provider-gateway_fintlabs_no
app.kubernetes.io/version: latest
app.kubernetes.io/component: provider
app.kubernetes.io/part-of: fint-core
fintlabs.no/team: core
fintlabs.no/org-id: fintlabs.no
8 changes: 0 additions & 8 deletions kustomize/base/service.yaml

This file was deleted.

20 changes: 20 additions & 0 deletions kustomize/overlays/alpha/application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: fintlabs.no/v1alpha1
kind: Application
metadata:
name: fint-core-provider-gateway
namespace: fint-core
spec:
env:
- name: JAVA_TOOL_OPTIONS
value: '-XX:+ExitOnOutOfMemoryError -Xmx786m'
ingress:
routes:
- host: alpha.felleskomponent.no
path: /provider
resources:
limits:
memory: "1024Mi"
cpu: "1"
requests:
memory: "128Mi"
cpu: "100m"
7 changes: 0 additions & 7 deletions kustomize/overlays/alpha/config-map.yaml

This file was deleted.

35 changes: 0 additions & 35 deletions kustomize/overlays/alpha/deployment.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions kustomize/overlays/alpha/ingress-route.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions kustomize/overlays/alpha/kafka-user-and-acl.yaml

This file was deleted.

15 changes: 2 additions & 13 deletions kustomize/overlays/alpha/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../base
patchesStrategicMerge:
- config-map.yaml
- ingress-route.yaml
- kafka-user-and-acl.yaml
- deployment.yaml
commonLabels:
app.kubernetes.io/name: fint-core-provider-gateway
app.kubernetes.io/instance: fint-core-provider-gateway_fintlabs-no
app.kubernetes.io/version: latest
app.kubernetes.io/component: backend
app.kubernetes.io/part-of: fint-core
fintlabs.no/team: core
fintlabs.no/org-id: fintlabs.no
patches:
- path: application.yaml
20 changes: 20 additions & 0 deletions kustomize/overlays/api/application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: fintlabs.no/v1alpha1
kind: Application
metadata:
name: fint-core-provider-gateway
namespace: fint-core
spec:
env:
- name: JAVA_TOOL_OPTIONS
value: '-XX:+ExitOnOutOfMemoryError -Xmx786m'
ingress:
routes:
- host: api.felleskomponent.no
path: /provider
resources:
limits:
memory: "1024Mi"
cpu: "1"
requests:
memory: "128Mi"
cpu: "100m"
Loading

0 comments on commit a8e9567

Please sign in to comment.