initial commit: adding app
This commit is contained in:
@@ -1,2 +1,10 @@
|
|||||||
# html-kube-tester
|
# html-kube-tester
|
||||||
|
|
||||||
|
Workload to test application behavior while making changes on infrastructure.
|
||||||
|
|
||||||
|
Ingress is not included and have to be added on top.
|
||||||
|
Feel free to customize *replicas* and *content-git-repo* in *config* folder.
|
||||||
|
|
||||||
|
Git will be displayed in an iframe with node name on top.
|
||||||
|
|
||||||
|
Thanks to https://github.com/amoldalwai/RoadFighter.git for having something fun to display.
|
||||||
|
|||||||
1
config/content-git-repo
Normal file
1
config/content-git-repo
Normal file
@@ -0,0 +1 @@
|
|||||||
|
https://github.com/amoldalwai/RoadFighter.git
|
||||||
35
config/init.sh
Normal file
35
config/init.sh
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
git_retries=20
|
||||||
|
try=0
|
||||||
|
export GIT_SSH_COMMAND='ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"'
|
||||||
|
until timeout 10 git clone --recurse-submodules ${CONTENT_GIT_REPO} /app ; do
|
||||||
|
echo "Retry git pull after error ($try / $git_retries)"
|
||||||
|
try=$((try+1))
|
||||||
|
if [ $try -eq $git_retries ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
cd /app
|
||||||
|
if [ -e index.html ] ; then
|
||||||
|
mv index.html index-embedded.html
|
||||||
|
fi
|
||||||
|
cat <<EOF >index.html
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Html-Kube-Tester fron ${KUBE_NODE_NAME}</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p align="center">
|
||||||
|
From node ${KUBE_NODE_NAME}
|
||||||
|
</p>
|
||||||
|
<iframe
|
||||||
|
id="embeddedcontent"
|
||||||
|
title="embeddedcontent"
|
||||||
|
width="100%"
|
||||||
|
height="90%"
|
||||||
|
src="./index-embedded.html" />
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
|
|
||||||
1
config/replicas
Normal file
1
config/replicas
Normal file
@@ -0,0 +1 @@
|
|||||||
|
2
|
||||||
90
deployment.yaml
Normal file
90
deployment.yaml
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: html-kube-tester
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
affinity:
|
||||||
|
podAntiAffinity:
|
||||||
|
preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- weight: 100
|
||||||
|
podAffinityTerm:
|
||||||
|
labelSelector:
|
||||||
|
matchExpressions:
|
||||||
|
- key: app.kubernetes.io/instance
|
||||||
|
operator: In
|
||||||
|
values:
|
||||||
|
- html-kube-tester
|
||||||
|
topologyKey: kubernetes.io/hostname
|
||||||
|
securityContext:
|
||||||
|
runAsUser: 82
|
||||||
|
runAsGroup: 82
|
||||||
|
fsGroup: 82
|
||||||
|
runAsNonRoot: true
|
||||||
|
seccompProfile:
|
||||||
|
type: RuntimeDefault
|
||||||
|
initContainers:
|
||||||
|
- name: content-generator
|
||||||
|
image: quay.io/simbelmas/alpine-tools:stable
|
||||||
|
command: ["html-kube-tester-init.sh"]
|
||||||
|
securityContext:
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
capabilities:
|
||||||
|
drop: ['ALL']
|
||||||
|
env:
|
||||||
|
- name: KUBE_NODE_NAME
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: spec.nodeName
|
||||||
|
- name: CONTENT_GIT_REPO
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: html-kube-tester-config
|
||||||
|
key: content-git-repo
|
||||||
|
volumeMounts:
|
||||||
|
- name: init
|
||||||
|
mountPath: /usr/local/bin
|
||||||
|
- name: app-data
|
||||||
|
mountPath: /app
|
||||||
|
containers:
|
||||||
|
- name: html-kube-tester
|
||||||
|
image: quay.io/simbelmas/nginx:stable
|
||||||
|
securityContext:
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
capabilities:
|
||||||
|
drop: ['ALL']
|
||||||
|
volumeMounts:
|
||||||
|
- name: app-data
|
||||||
|
mountPath: /var/www/html
|
||||||
|
ports:
|
||||||
|
- containerPort: 8080
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 2m
|
||||||
|
memory: 10Mi
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 25Mi
|
||||||
|
livenessProbe: &html-kube-tester-probe
|
||||||
|
httpGet:
|
||||||
|
path: /
|
||||||
|
port: 8080
|
||||||
|
timeoutSeconds: 5
|
||||||
|
periodSeconds: 15
|
||||||
|
failureThreshold: 10
|
||||||
|
readinessProbe:
|
||||||
|
<<: *html-kube-tester-probe
|
||||||
|
periodSeconds: 2
|
||||||
|
volumes:
|
||||||
|
- name: init
|
||||||
|
configMap:
|
||||||
|
defaultMode: 0755
|
||||||
|
name: &html-kube-test-cm html-kube-tester-config
|
||||||
|
items:
|
||||||
|
- key: init.sh
|
||||||
|
path: html-kube-tester-init.sh
|
||||||
|
- name: app-data
|
||||||
|
emptyDir: {}
|
||||||
34
kustomization.yaml
Normal file
34
kustomization.yaml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
namespace: html-kube-tester
|
||||||
|
|
||||||
|
commonLabels:
|
||||||
|
app.kubernetes.io/instance: html-kube-tester
|
||||||
|
app.kubernetes.io/part-of: html-kube-tester
|
||||||
|
pod-security.kubernetes.io/enforce: restricted
|
||||||
|
pod-security.kubernetes.io/audit: restricted
|
||||||
|
pod-security.kubernetes.io/warn: restricted
|
||||||
|
|
||||||
|
configMapGenerator:
|
||||||
|
- name: html-kube-tester-config
|
||||||
|
files:
|
||||||
|
- config/init.sh
|
||||||
|
- config/content-git-repo
|
||||||
|
- config/replicas
|
||||||
|
|
||||||
|
resources:
|
||||||
|
- namespace.yaml
|
||||||
|
- deployment.yaml
|
||||||
|
- service.yaml
|
||||||
|
|
||||||
|
replacements:
|
||||||
|
- source:
|
||||||
|
kind: ConfigMap
|
||||||
|
name: html-kube-tester-config
|
||||||
|
fieldPath: data.replicas
|
||||||
|
targets:
|
||||||
|
- select:
|
||||||
|
kind: Deployment
|
||||||
|
name: html-kube-tester
|
||||||
|
fieldPaths:
|
||||||
|
- spec.replicas
|
||||||
4
namespace.yaml
Normal file
4
namespace.yaml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: html-kube-tester
|
||||||
13
service.yaml
Normal file
13
service.yaml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: html-kube-tester
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
port: 8080
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: 8080
|
||||||
|
sessionAffinity: None
|
||||||
|
type: ClusterIP
|
||||||
|
selector: {}
|
||||||
Reference in New Issue
Block a user