Skip to content

Commit

Permalink
Merge 4a1104e into ecf47f9
Browse files Browse the repository at this point in the history
  • Loading branch information
jasperkamerling authored Nov 30, 2023
2 parents ecf47f9 + 4a1104e commit c6dc7a4
Show file tree
Hide file tree
Showing 9 changed files with 207 additions and 45 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# SPDX-FileCopyrightText: Contributors to the GXF project
#
# SPDX-License-Identifier: Apache-2.0

name: Build Pipeline

on:
push:
branches: [ "main" ]
tags: [ "v**" ]
pull_request:
branches: [ "main" ]

jobs:
build:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
# TODO remove after testing
# - name: Set up JDK 17
# uses: actions/setup-java@v3
# with:
# java-version: '17'
# distribution: 'temurin'
# - name: Setup Gradle to generate and submit dependency graphs
# uses: gradle/[email protected]
# with:
# dependency-graph: generate-and-submit
# - name: Build with Gradle
# run: ./gradlew build integrationTest bootBuildImage
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Run sonar analysis with Gradle
# run: ./gradlew sonar
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# - name: Publish Docker image
# if: github.ref == 'refs/heads/main' || github.ref_type == 'tag'
# run: ./gradlew bootBuildImage -PpublishImage
# env:
# GITHUB_ACTOR: ${{ github.actor }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: v3.12.0
# TODO install and publish cr without creating a new release
- name: Publish Helm chart
uses: helm/[email protected]
# if: github.ref == 'refs/heads/main' || github.ref_type == 'tag'
with:
charts_dir: ./
packages_with_index: true
env:
CR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45 changes: 0 additions & 45 deletions .github/workflows/gradle.yml

This file was deleted.

4 changes: 4 additions & 0 deletions chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v2
name: gxf-service-template
type: application
version: 0.1.0
6 changes: 6 additions & 0 deletions chart/templates/processor-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.name }}-config
data:
SPRING_APPLICATION_JSON: {{ .Values.springConfig | toJson | quote }}
80 changes: 80 additions & 0 deletions chart/templates/processor-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.name }}
labels:
app: {{ .Values.name }}
spec:
replicas: {{ .Values.deployment.replicas }}
selector:
matchLabels:
app: {{ .Values.name }}
template:
metadata:
name: {{ .Values.name }}
annotations:
prometheus.io/port: '8080'
prometheus.io/path: '/actuator/prometheus'
prometheus.io/scrape: 'true'
labels:
app: {{ .Values.name }}
{{- range $key, $value := .Values.deployment.labels }}
{{ $key }}: {{ $value }}
{{- end }}
spec:
serviceAccountName: {{ .Values.serviceAccount.name | default $.Values.name }}
restartPolicy: Always
{{- with .Values.deployment.secrets.imagePullSecret }}
imagePullSecrets:
- name: {{ . }}
{{- end }}
containers:
- name: processor
image: "{{ .Values.deployment.image }}:{{ required ".Values.deployment.imageTag is required" .Values.deployment.imageTag }}"
envFrom:
- configMapRef:
name: {{ .Values.name }}-config
env:
{{- range .Values.deployment.secrets.environment }}
- name: {{ .envVariable }}
valueFrom:
secretKeyRef:
name: {{ .secretName }}
key: {{ .secretKey }}
{{- end }}
{{- with .Values.deployment.resources }}
resources:
requests:
cpu: {{ .requests.cpu }}
{{/* For Java applications requests and limits should be equal */}}
memory: {{ .limits.memory }}
limits:
cpu: {{ .limits.cpu }}
memory: {{ .limits.memory }}
{{- end }}
ports:
- name: actuator
containerPort: 8080
startupProbe:
httpGet:
path: /actuator/health/liveness
port: actuator
failureThreshold: 30
periodSeconds: 5
livenessProbe:
httpGet:
path: /actuator/health/liveness
port: actuator
failureThreshold: 4
periodSeconds: 15
volumeMounts:
{{- range .Values.deployment.secrets.volumes }}
- name: {{ .secretName }}
mountPath: {{ .path }}
{{- end }}
volumes:
{{- range .Values.deployment.secrets.volumes }}
- name: {{ .secretName }}
secret:
secretName: {{ .secretName }}
{{- end }}
6 changes: 6 additions & 0 deletions chart/templates/service-account.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{{- with .Values.serviceAccount }}
apiVersion: {{ .apiVersion }}
kind: {{ .kind }}
metadata:
name: {{ .name | default $.Values.name }}
{{- end }}
48 changes: 48 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: gxf-service-template

serviceAccount:
apiVersion: v1
kind: ServiceAccount

deployment:
image: "ghcr.io/osgp/gxf-service-template"
replicas: 1
resources:
requests:
cpu: 200m
limits:
cpu: 2
memory: 1Gi

labels:
label-one: 'true'
label-two: 'false'

secrets:
imagePullSecret: "image-pull-secret"
volumes:
- secretName: "test-volume-one"
path: "/etc/secret/one"
- secretName: "test-volume-two"
path: "/etc/secret/two"
environment:
- envVariable: "SPRING_DATASOURCE_PASSWORD"
secretName: "database-secret"
secretKey: "password"
- envVariable: "MQTT_PASSWORD"
secretName: "mqtt-secret"
secretKey: "password"

springConfig:
spring:
profiles:
active: "kafka-oauth"
datasource:
url: "jdbc:postgresql://postgres_database:5432/gxf_service_template"
username: "gxf_service_template"
kafka:
bootstrap-servers: "kafka-server:9092"
logging:
level:
org:
gxf: "DEBUG"

0 comments on commit c6dc7a4

Please sign in to comment.