diff --git a/.github/workflows/CD.yaml b/.github/workflows/CD.yaml index 2b3a8ca..35d3687 100644 --- a/.github/workflows/CD.yaml +++ b/.github/workflows/CD.yaml @@ -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: @@ -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 }} diff --git a/build.gradle b/build.gradle index f423af4..5ca5b8c 100644 --- a/build.gradle +++ b/build.gradle @@ -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' diff --git a/kustomize/base/application.yaml b/kustomize/base/application.yaml new file mode 100644 index 0000000..ca568df --- /dev/null +++ b/kustomize/base/application.yaml @@ -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" \ No newline at end of file diff --git a/kustomize/base/config-map.yaml b/kustomize/base/config-map.yaml deleted file mode 100644 index 0089b84..0000000 --- a/kustomize/base/config-map.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: fint-core-provider-gateway -data: - TZ: 'Europe/Oslo' - JAVA_TOOL_OPTIONS: '-XX:+ExitOnOutOfMemoryError -Xmx786m' - spring.webflux.base-path: '/provider' - spring.codec.max-in-memory-size: '200MB' - server.tomcat.max-threads: '400' - server.tomcat.max-connections: '30000' - server.netty.connection-timeout: '600000' - server.connection-timeout: '600000' diff --git a/kustomize/base/deployment.yaml b/kustomize/base/deployment.yaml deleted file mode 100644 index 218b0d2..0000000 --- a/kustomize/base/deployment.yaml +++ /dev/null @@ -1,35 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: fint-core-provider-gateway -spec: - replicas: 1 - strategy: - type: Recreate - template: - spec: - restartPolicy: Always - volumes: - - name: credentials - secret: - secretName: fint-core-provider-gateway-kafka-certificates - containers: - - image: ghcr.io/fintlabs/fint-core-provider-gateway:sha-0000000 - name: fint-core-provider-gateway - volumeMounts: - - name: credentials - mountPath: /credentials - resources: - limits: - memory: "1152Mi" - cpu: "1" - requests: - memory: "512Mi" - cpu: "100m" - ports: - - containerPort: 8080 - envFrom: - - secretRef: - name: fint-core-provider-gateway-kafka - - configMapRef: - name: fint-core-provider-gateway \ No newline at end of file diff --git a/kustomize/base/ingress-route.yaml b/kustomize/base/ingress-route.yaml deleted file mode 100644 index fec9655..0000000 --- a/kustomize/base/ingress-route.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: traefik.containo.us/v1alpha1 -kind: IngressRoute -metadata: - name: fint-core-provider-gateway -spec: - entryPoints: - - web - routes: - - match: Host(`hostname`) && PathPrefix(`path`) - kind: Rule - services: - - name: fint-core-provider-gateway - port: 8080 \ No newline at end of file diff --git a/kustomize/base/kafka-user-and-acl.yaml b/kustomize/base/kafka-user-and-acl.yaml deleted file mode 100644 index 69c571a..0000000 --- a/kustomize/base/kafka-user-and-acl.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: "fintlabs.no/v1alpha1" -kind: KafkaUserAndAcl -metadata: - name: fint-core-provider-gateway -spec: - acls: - - permission: admin - topic: 'no-permission' \ No newline at end of file diff --git a/kustomize/base/kustomization.yaml b/kustomize/base/kustomization.yaml index ebb4076..bab053e 100644 --- a/kustomize/base/kustomization.yaml +++ b/kustomize/base/kustomization.yaml @@ -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 diff --git a/kustomize/base/service.yaml b/kustomize/base/service.yaml deleted file mode 100644 index 1ce838d..0000000 --- a/kustomize/base/service.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: fint-core-provider-gateway -spec: - ports: - - port: 8080 - type: ClusterIP \ No newline at end of file diff --git a/kustomize/overlays/alpha/application.yaml b/kustomize/overlays/alpha/application.yaml new file mode 100644 index 0000000..c652c06 --- /dev/null +++ b/kustomize/overlays/alpha/application.yaml @@ -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" \ No newline at end of file diff --git a/kustomize/overlays/alpha/config-map.yaml b/kustomize/overlays/alpha/config-map.yaml deleted file mode 100644 index 97d4158..0000000 --- a/kustomize/overlays/alpha/config-map.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: fint-core-provider-gateway -data: - fint.org-id: 'fintlabs.no' - logging.level.no.fintlabs.event: 'debug' \ No newline at end of file diff --git a/kustomize/overlays/alpha/deployment.yaml b/kustomize/overlays/alpha/deployment.yaml deleted file mode 100644 index 89975e8..0000000 --- a/kustomize/overlays/alpha/deployment.yaml +++ /dev/null @@ -1,35 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: fint-core-provider-gateway -spec: - replicas: 1 - strategy: - type: Recreate - template: - spec: - restartPolicy: Always - volumes: - - name: credentials - secret: - secretName: fint-core-provider-gateway-kafka-certificates - containers: - - image: ghcr.io/fintlabs/fint-core-provider-gateway:sha-0000000 - name: fint-core-provider-gateway - volumeMounts: - - name: credentials - mountPath: /credentials - resources: - limits: - memory: "350Mi" - cpu: "250m" - requests: - memory: "250Mi" - cpu: "100m" - ports: - - containerPort: 8080 - envFrom: - - secretRef: - name: fint-core-provider-gateway-kafka - - configMapRef: - name: fint-core-provider-gateway \ No newline at end of file diff --git a/kustomize/overlays/alpha/ingress-route.yaml b/kustomize/overlays/alpha/ingress-route.yaml deleted file mode 100644 index 650bad5..0000000 --- a/kustomize/overlays/alpha/ingress-route.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: traefik.containo.us/v1alpha1 -kind: IngressRoute -metadata: - name: fint-core-provider-gateway -spec: - routes: - - match: "Host(`alpha.felleskomponent.no`) && PathPrefix(`/provider`)" - kind: Rule - services: - - name: fint-core-provider-gateway - port: 8080 \ No newline at end of file diff --git a/kustomize/overlays/alpha/kafka-user-and-acl.yaml b/kustomize/overlays/alpha/kafka-user-and-acl.yaml deleted file mode 100644 index 1bc7fab..0000000 --- a/kustomize/overlays/alpha/kafka-user-and-acl.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: "fintlabs.no/v1alpha1" -kind: KafkaUserAndAcl -metadata: - name: fint-core-provider-gateway -spec: - acls: - - permission: admin - topic: "*.fint-core.*" \ No newline at end of file diff --git a/kustomize/overlays/alpha/kustomization.yaml b/kustomize/overlays/alpha/kustomization.yaml index caf2bc3..f19fc74 100644 --- a/kustomize/overlays/alpha/kustomization.yaml +++ b/kustomize/overlays/alpha/kustomization.yaml @@ -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 \ No newline at end of file +patches: + - path: application.yaml \ No newline at end of file diff --git a/kustomize/overlays/api/application.yaml b/kustomize/overlays/api/application.yaml new file mode 100644 index 0000000..62956a5 --- /dev/null +++ b/kustomize/overlays/api/application.yaml @@ -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" \ No newline at end of file diff --git a/kustomize/overlays/api/config-map.yaml b/kustomize/overlays/api/config-map.yaml deleted file mode 100644 index 97d4158..0000000 --- a/kustomize/overlays/api/config-map.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: fint-core-provider-gateway -data: - fint.org-id: 'fintlabs.no' - logging.level.no.fintlabs.event: 'debug' \ No newline at end of file diff --git a/kustomize/overlays/api/deployment.yaml b/kustomize/overlays/api/deployment.yaml deleted file mode 100644 index e14085d..0000000 --- a/kustomize/overlays/api/deployment.yaml +++ /dev/null @@ -1,35 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: fint-core-provider-gateway -spec: - replicas: 1 - strategy: - type: Recreate - template: - spec: - restartPolicy: Always - volumes: - - name: credentials - secret: - secretName: fint-core-provider-gateway-kafka-certificates - containers: - - image: ghcr.io/fintlabs/fint-core-provider-gateway:sha-0000000 - name: fint-core-provider-gateway - volumeMounts: - - name: credentials - mountPath: /credentials - resources: - limits: - memory: "2Gi" - cpu: "2" - requests: - memory: "1Gi" - cpu: "500m" - ports: - - containerPort: 8080 - envFrom: - - secretRef: - name: fint-core-provider-gateway-kafka - - configMapRef: - name: fint-core-provider-gateway \ No newline at end of file diff --git a/kustomize/overlays/api/ingress-route.yaml b/kustomize/overlays/api/ingress-route.yaml deleted file mode 100644 index e7f7e62..0000000 --- a/kustomize/overlays/api/ingress-route.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: traefik.containo.us/v1alpha1 -kind: IngressRoute -metadata: - name: fint-core-provider-gateway -spec: - routes: - - match: "Host(`api.felleskomponent.no`) && PathPrefix(`/provider`)" - kind: Rule - services: - - name: fint-core-provider-gateway - port: 8080 \ No newline at end of file diff --git a/kustomize/overlays/api/kafka-user-and-acl.yaml b/kustomize/overlays/api/kafka-user-and-acl.yaml deleted file mode 100644 index 1bc7fab..0000000 --- a/kustomize/overlays/api/kafka-user-and-acl.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: "fintlabs.no/v1alpha1" -kind: KafkaUserAndAcl -metadata: - name: fint-core-provider-gateway -spec: - acls: - - permission: admin - topic: "*.fint-core.*" \ No newline at end of file diff --git a/kustomize/overlays/api/kustomization.yaml b/kustomize/overlays/api/kustomization.yaml index 377a5b2..b7801e6 100644 --- a/kustomize/overlays/api/kustomization.yaml +++ b/kustomize/overlays/api/kustomization.yaml @@ -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 diff --git a/kustomize/overlays/beta/application.yaml b/kustomize/overlays/beta/application.yaml new file mode 100644 index 0000000..65d258e --- /dev/null +++ b/kustomize/overlays/beta/application.yaml @@ -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: beta.felleskomponent.no + path: /provider + resources: + limits: + memory: "1024Mi" + cpu: "1" + requests: + memory: "128Mi" + cpu: "100m" \ No newline at end of file diff --git a/kustomize/overlays/beta/config-map.yaml b/kustomize/overlays/beta/config-map.yaml deleted file mode 100644 index 97d4158..0000000 --- a/kustomize/overlays/beta/config-map.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: fint-core-provider-gateway -data: - fint.org-id: 'fintlabs.no' - logging.level.no.fintlabs.event: 'debug' \ No newline at end of file diff --git a/kustomize/overlays/beta/deployment.yaml b/kustomize/overlays/beta/deployment.yaml deleted file mode 100644 index 8c2d1b5..0000000 --- a/kustomize/overlays/beta/deployment.yaml +++ /dev/null @@ -1,35 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: fint-core-provider-gateway -spec: - replicas: 1 - strategy: - type: Recreate - template: - spec: - restartPolicy: Always - volumes: - - name: credentials - secret: - secretName: fint-core-provider-gateway-kafka-certificates - containers: - - image: ghcr.io/fintlabs/fint-core-provider-gateway:sha-0000000 - name: fint-core-provider-gateway - volumeMounts: - - name: credentials - mountPath: /credentials - resources: - limits: - memory: "2Gi" - cpu: "1" - requests: - memory: "1Gi" - cpu: "500m" - ports: - - containerPort: 8080 - envFrom: - - secretRef: - name: fint-core-provider-gateway-kafka - - configMapRef: - name: fint-core-provider-gateway \ No newline at end of file diff --git a/kustomize/overlays/beta/ingress-route.yaml b/kustomize/overlays/beta/ingress-route.yaml deleted file mode 100644 index 94b9da4..0000000 --- a/kustomize/overlays/beta/ingress-route.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: traefik.containo.us/v1alpha1 -kind: IngressRoute -metadata: - name: fint-core-provider-gateway -spec: - routes: - - match: "Host(`beta.felleskomponent.no`) && PathPrefix(`/provider`)" - kind: Rule - services: - - name: fint-core-provider-gateway - port: 8080 \ No newline at end of file diff --git a/kustomize/overlays/beta/kafka-user-and-acl.yaml b/kustomize/overlays/beta/kafka-user-and-acl.yaml deleted file mode 100644 index 1bc7fab..0000000 --- a/kustomize/overlays/beta/kafka-user-and-acl.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: "fintlabs.no/v1alpha1" -kind: KafkaUserAndAcl -metadata: - name: fint-core-provider-gateway -spec: - acls: - - permission: admin - topic: "*.fint-core.*" \ No newline at end of file diff --git a/kustomize/overlays/beta/kustomization.yaml b/kustomize/overlays/beta/kustomization.yaml index 377a5b2..f19fc74 100644 --- a/kustomize/overlays/beta/kustomization.yaml +++ b/kustomize/overlays/beta/kustomization.yaml @@ -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 \ No newline at end of file diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index f584f7b..1eb2991 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -38,4 +38,11 @@ springdoc: logging: level: root: INFO - org.apache.kafka: WARN \ No newline at end of file + org.apache.kafka: WARN +server: + netty: + connection-timeout: 600000 + tomcat: + threads: + max: 400 + max-connections: 30000 \ No newline at end of file