k8 added
Some checks are pending
ci / build (push) Waiting to run

This commit is contained in:
miwr 2025-04-14 12:58:22 +02:00
parent 6e80b13015
commit d25e82c42a
6 changed files with 88 additions and 3 deletions

17
k8/configmap.yaml Normal file
View file

@ -0,0 +1,17 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: silly-game-config
namespace: silly-game
data:
game-config.properties: |
spring.application.name=silly-game
spring.mail.host=mailhog.mailhog.svc.cluster.local
spring.mail.port=1025
spring.mail.username=
spring.mail.password=
spring.mail.properties.mail.smtp.auth=false
spring.mail.properties.mail.smtp.starttls.enable=false
cors.allowed-origin=http://silly-game-service.silly-game.svc.cluster.local

48
k8/deployment.yaml Normal file
View file

@ -0,0 +1,48 @@
apiVersion: v1
kind: Namespace
metadata:
name: silly-game
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: silly-game-deployment
namespace: silly-game
spec:
replicas: 1
selector:
matchLabels:
app: silly-game
template:
metadata:
labels:
app: silly-game
spec:
containers:
- name: silly-game
image: mygit-silly-game-backend:main
ports:
- containerPort: 8080
volumeMounts:
- name: config-volume
mountPath: /config
volumes:
- name: config-volume
configMap:
name: silly-game-config
---
apiVersion: v1
kind: Service
metadata:
name: silly-game-service
namespace: silly-game
spec:
selector:
app: silly-game
ports:
- port: 80
targetPort: 8080

View file

@ -7,7 +7,6 @@ import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
@RestController
@CrossOrigin(origins = "http://localhost:4200")
@RequestMapping("/game")
public class GameController {

View file

@ -11,7 +11,6 @@ import java.util.Map;
@RestController
@RequestMapping("/api")
@CrossOrigin(origins = "http://localhost:4200")
public class InviteController {
@PostMapping("/invite")

View file

@ -0,0 +1,20 @@
package de.telekom.silly_game;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Value("${cors.allowed-origin}")
private String allowedOrigin;
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins(allowedOrigin)
.allowedMethods("*");
}
}

View file

@ -5,4 +5,6 @@ spring.mail.port=1025
spring.mail.username=
spring.mail.password=
spring.mail.properties.mail.smtp.auth=false
spring.mail.properties.mail.smtp.starttls.enable=false
spring.mail.properties.mail.smtp.starttls.enable=false
cors.allowed-origin=http://localhost:4200