@RequestMapping( method=GET)
@ResponseBody
public String minion() throws UnknownHostException {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("Host: ").append(InetAddress.getLocalHost().getHostName()).append("
");
return stringBuilder.toString();
}
@Component
public class MinionsLibrary {
private Map map = new HashMap<>();
public MinionsLibrary(){
map.put("one-eyed-minion",);
map.put("two-eyed-minion",);
map.put("sad-minion",);
map.put("happy-minion",);
}
}
@RestController
public class Controller {
private final String version = "0.1";
private MinionsLibrary minionsLibrary;
@Value("${spring.application.name}")
private String appName;
public Controller(MinionsLibrary minionsLibrary){
this.minionsLibrary=minionsLibrary;
}
@RequestMapping( method=GET)
@ResponseBody
public String minion() throws UnknownHostException {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("Host: ").append(InetAddress.getLocalHost().getHostName()).append("
");
stringBuilder.append("Minion Type: ").append(appName).append("
");
stringBuilder.append("IP: ").append(InetAddress.getLocalHost().getHostAddress()).append("
");
stringBuilder.append("Version: ").append(version).append("
");
stringBuilder.append(minionsLibrary.getMinion(appName));
return stringBuilder.toString();
}
}
FROM maven:3.5-jdk-8 as BUILDMINION
COPY src /usr/src/myapp/src
COPY pom.xml /usr/src/myapp
RUN mvn -f /usr/src/myapp/pom.xml clean package -DskipTests
FROM openjdk:alpine
COPY --from=BUILDMINION /usr/src/myapp/target/*.jar /maven/
CMD java $JAVA_OPTS -jar maven/*.jar
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: one-eyed-minion
labels:
serviceType: one-eyed-minion
spec:
replicas: 2
template:
metadata:
name: one-eyed-minion
labels:
serviceType: one-eyed-minion
spec:
containers:
- name: one-eyed-minion
image: minion:latest
imagePullPolicy: Never
ports:
- containerPort: 8080
env:
- name: JAVA_OPTS
value: -Xmx64m -Xms64m
- name: SPRING_APPLICATION_NAME
value: "one-eyed-minion"
---
apiVersion: v1
kind: Service
metadata:
name: one-eyed-minion-entrypoint
namespace: default
spec:
selector:
serviceType: one-eyed-minion
ports:
- port: 8080
targetPort: 8080
nodePort: 30080
type: NodePort
minikube start --memory 4000 --cpus 3
eval $(minikube docker-env)
docker build . -t minion
kubectl create -f minion-army.yml
open http://$(minikube ip):30080
open http://$(minikube ip):30081
open http://$(minikube ip):30082
open http://$(minikube ip):30083
kubectl delete pod happy-minion-58c9c46d67-j84s9
minReadySeconds: 10
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
maxSurge: 1
docker build . -t minion:0.2
kubectl apply -f minion-army.yml --record
kubectl delete -f minion-army.yml
-
https://github.com/ryandawsonuk/minions/blob/master/minion-army.yml
-
http://textart4u.blogspot.co.uk/2013/08/minions-emoticons-text-art-for-facebook.html
-
https://dzone.com/articles/how-to-decrease-jvm-memory-consumption-in-docker-u