Commit initial
parent
d030c11711
commit
2333fe053d
|
|
@ -0,0 +1,33 @@
|
|||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
# Image de base
|
||||
FROM maven:3-eclipse-temurin-17-alpine as build_image
|
||||
|
||||
# Passage dans le repertoire de compilation
|
||||
WORKDIR /sources
|
||||
|
||||
# Copie des sources
|
||||
COPY src src
|
||||
COPY pom.xml pom.xml
|
||||
|
||||
# Lancement du package
|
||||
RUN mvn package
|
||||
|
||||
# Runtime Image
|
||||
FROM eclipse-temurin:17-jre-alpine
|
||||
|
||||
# Environment variables
|
||||
ENV UID=2000
|
||||
ENV GID=4000
|
||||
|
||||
# Changement d'utilisateur
|
||||
USER ${UID}:${GID}
|
||||
|
||||
# Copie du jar
|
||||
COPY --from=build_image --chown=${UID}:${GID} /sources/target/fbapp.jar .
|
||||
RUN ls -l
|
||||
|
||||
# Lancement de l'application
|
||||
CMD ["java", "-jar", "fbapp.jar"]
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.0.5</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.capgemini.fridaybooster.kubernetes</groupId>
|
||||
<artifactId>fb-app</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>Friday Booster Simple Application</name>
|
||||
<description>Simple application for simple Kubernetes testing</description>
|
||||
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.projectreactor</groupId>
|
||||
<artifactId>reactor-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>fbapp</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.capgemini.fridaybooster.kubernetes.fbapp;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class FBApp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(FBApp.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.capgemini.fridaybooster.kubernetes.fbapp.controller;
|
||||
|
||||
import java.net.Inet4Address;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.capgemini.fridaybooster.kubernetes.fbapp.model.HostNameInfo;
|
||||
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/")
|
||||
public class TestController {
|
||||
|
||||
private final HostNameInfo infos;
|
||||
|
||||
public TestController(@Value("${message}") String message) throws UnknownHostException {
|
||||
var ip = Inet4Address.getLocalHost().getHostAddress();
|
||||
var hostName = Inet4Address.getLocalHost().getHostName();
|
||||
|
||||
infos = new HostNameInfo(hostName, ip, message);
|
||||
}
|
||||
|
||||
@GetMapping("/")
|
||||
public Mono<HostNameInfo> getInfo() {
|
||||
return Mono.just(infos);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.capgemini.fridaybooster.kubernetes.fbapp.model;
|
||||
|
||||
public class HostNameInfo {
|
||||
|
||||
private final String hostname;
|
||||
|
||||
private final String ip;
|
||||
|
||||
private final String message;
|
||||
|
||||
public HostNameInfo(String hostname, String ip, String message) {
|
||||
super();
|
||||
this.hostname = hostname;
|
||||
this.ip = ip;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getHostname() {
|
||||
return hostname;
|
||||
}
|
||||
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
message: ${ENV_MESSAGE:La variable 'ENV_MESSAGE' n'est pas definie}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.capgemini.fridaybooster.kubernetes.fbapp;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class TestApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
# Image de base
|
||||
FROM registry.k8s.io/e2e-test-images/jessie-dnsutils:1.3
|
||||
|
||||
# Installation de CURL
|
||||
RUN apt install -y curl
|
||||
Loading…
Reference in New Issue