-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
592a5d1
commit 44def24
Showing
46 changed files
with
1,555 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: build | ||
|
||
on: | ||
workflow_dispatch: | ||
branches: [ main ] | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- '**' | ||
- '!docs/**' | ||
- '!README.md' | ||
pull_request: | ||
branches: [ main ] | ||
|
||
permissions: | ||
packages: write | ||
|
||
env: | ||
REPO: "ghcr.io/${{ github.repository }}" | ||
|
||
jobs: | ||
version: | ||
name: Calculate Version | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.version.outputs.VERSION }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Calculate version | ||
id: version | ||
run: curl -Ls https://solugo.github.io/gitversion/run.sh | GITVERSION=v1.1.0 bash | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
needs: | ||
- version | ||
env: | ||
VERSION: ${{ needs.version.outputs.version }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '21' | ||
- name: Build | ||
run: | | ||
./gradlew test jib \ | ||
-Djib.to.image=$REPO \ | ||
-Djib.to.tags=$VERSION \ | ||
-Djib.to.auth.username=${{ github.actor }} \ | ||
-Djib.to.auth.password=${{ secrets.GITHUB_TOKEN }} \ | ||
--console=plain \ | ||
--no-daemon \ | ||
; | ||
publish: | ||
name: Publish to Titan01 | ||
runs-on: ubuntu-latest | ||
needs: | ||
- version | ||
- build | ||
env: | ||
VERSION: ${{ needs.version.outputs.version }} | ||
steps: | ||
- name: Configure Kubernetes | ||
run: mkdir ~/.kube && echo '${{ secrets.KUBE_CONFIG_TITAN_01 }}' > ~/.kube/config | ||
- name: Deploy to Kubernetes | ||
run: | | ||
helm upgrade -i oauth-mock ./chart \ | ||
--set ingress.enabled=true \ | ||
--set ingress.domain=oauth-mock.solugo.de \ | ||
--set ingress.annotations."kubernetes\.io/ingress\.class"=public \ | ||
--set ingress.annotations."cert-manager\.io/cluster-issuer"=letsencrypt \ | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.gradle/** | ||
.idea/** | ||
build/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
plugins { | ||
id("org.jetbrains.kotlin.jvm") version "1.9.24" | ||
id("org.jetbrains.kotlin.plugin.spring") version "1.9.24" | ||
id("org.springframework.boot") version "3.2.4" | ||
id("com.google.cloud.tools.jib") version "3.4.2" | ||
} | ||
|
||
group = "de.solugo" | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation(platform("org.springframework.boot:spring-boot-dependencies:3.2.4")) | ||
implementation(platform("org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.8.0")) | ||
|
||
implementation("org.springframework.boot:spring-boot-starter-webflux") | ||
implementation("org.jetbrains.kotlin:kotlin-reflect") | ||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor") | ||
implementation("org.bitbucket.b_c:jose4j:0.9.6") | ||
|
||
testImplementation(platform("org.junit:junit-bom:5.10.1")) | ||
testImplementation(platform("org.testcontainers:testcontainers-bom:1.19.3")) | ||
testImplementation(platform("io.kotest:kotest-bom:5.8.0")) | ||
testImplementation(platform("io.ktor:ktor-bom:2.3.7")) | ||
|
||
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test") | ||
testImplementation("org.springframework.boot:spring-boot-starter-test") | ||
testImplementation("org.junit.jupiter:junit-jupiter-api") | ||
testImplementation("io.ktor:ktor-client-java") | ||
testImplementation("io.ktor:ktor-client-content-negotiation") | ||
testImplementation("io.ktor:ktor-serialization-jackson") | ||
testImplementation("io.kotest:kotest-assertions-core") | ||
testImplementation("io.kotest:kotest-assertions-json") | ||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") | ||
|
||
} | ||
|
||
kotlin { | ||
jvmToolchain(21) | ||
} | ||
|
||
springBoot { | ||
buildInfo() | ||
} | ||
|
||
jib { | ||
from { | ||
image = "openjdk:23-slim-bullseye" | ||
} | ||
container { | ||
mainClass = "OidcServer" | ||
} | ||
to { | ||
image = "oidc-server" | ||
} | ||
} | ||
|
||
tasks.withType<Test> { | ||
useJUnitPlatform() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ | ||
|
||
#--- Ignore env-specific templates used not during packaging (build) but during deployment | ||
*.njk | ||
nj.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: v2 | ||
name: oauth-mock | ||
description: Service for persistence of session information. | ||
version: 1.0.0 | ||
appVersion: 0.0.0 | ||
type: application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "chart.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "chart.fullname" -}} | ||
{{- if .Values.fullnameOverride }} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- $name := default .Chart.Name .Values.nameOverride }} | ||
{{- if contains $name .Release.Name }} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "chart.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "chart.labels" -}} | ||
helm.sh/chart: {{ include "chart.chart" . }} | ||
{{ include "chart.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "chart.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "chart.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Get the secret name. | ||
*/}} | ||
{{- define "chart.auth.secretName" -}} | ||
{{- printf "%s-ingress-basic-auth" .Release.Name -}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{{- $fullName := include "chart.fullname" . -}} | ||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ $fullName }} | ||
labels: | ||
{{- include "chart.labels" . | nindent 4 }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
{{- include "chart.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
annotations: | ||
{{- with .Values.podAnnotations }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "chart.selectorLabels" . | nindent 8 }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
ports: | ||
- name: http | ||
containerPort: 8080 | ||
protocol: TCP | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{{- if .Values.ingress.enabled -}} | ||
{{- $fullName := include "chart.fullname" . -}} | ||
{{- $svcPort := .Values.service.port -}} | ||
{{- $domain := tpl .Values.ingress.domain $ -}} | ||
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} | ||
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} | ||
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} | ||
{{- end }} | ||
{{- end }} | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: {{ $fullName }} | ||
labels: | ||
{{- include "chart.labels" . | nindent 4 }} | ||
{{- with .Values.ingress.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
ingressClassName: {{ .Values.ingress.className }} | ||
tls: | ||
- hosts: | ||
- "{{ $domain }}" | ||
secretName: {{ .Release.Name }}-tls-secret | ||
rules: | ||
- host: "{{ $domain }}" | ||
http: | ||
paths: | ||
- path: / | ||
pathType: ImplementationSpecific | ||
backend: | ||
service: | ||
name: {{ $fullName }} | ||
port: | ||
number: {{ $svcPort }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{{- $fullName := include "chart.fullname" . -}} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "chart.fullname" . }} | ||
labels: {{- include "chart.labels" . | nindent 4}} | ||
spec: | ||
type: {{ .Values.service.type }} | ||
ports: | ||
- port: {{ .Values.service.port }} | ||
targetPort: 8080 | ||
protocol: TCP | ||
name: http | ||
selector: {{- include "chart.selectorLabels" . | nindent 4}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
replicaCount: 1 | ||
|
||
resources: | ||
requests: | ||
cpu: 250m | ||
memory: 250Mi | ||
limits: | ||
cpu: 500m | ||
memory: 500Mi | ||
|
||
image: | ||
repository: 'ghcr.io/solugo/oauth-mock' | ||
|
||
service: | ||
port: 80 | ||
|
||
ingress: | ||
enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
kotlin.code.style=official | ||
version=99-SNAPSHOT |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Wed Apr 03 20:25:46 CEST 2024 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.