initial commit
This commit is contained in:
204
app_template.yaml
Normal file
204
app_template.yaml
Normal file
@@ -0,0 +1,204 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/part-of: fakeworkload
|
||||
name: ${current_ns}
|
||||
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: fakeworkload
|
||||
namespace: ${current_ns}
|
||||
labels: &deploy_labels
|
||||
app.kubernetes.io/part-of: fakeworkload
|
||||
app.kubernetes.io/name: ${current_ns}
|
||||
spec:
|
||||
replicas: 2
|
||||
revisionHistoryLimit: 2
|
||||
progressDeadlineSeconds: 2000
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
maxUnavailable: 25%
|
||||
maxSurge: 25%
|
||||
selector:
|
||||
matchLabels: *deploy_labels
|
||||
template:
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
labels: *deploy_labels
|
||||
spec:
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
affinity:
|
||||
nodeAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: wkloadtype
|
||||
operator: In
|
||||
values:
|
||||
- fakeload
|
||||
podAntiAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
- weight: 100
|
||||
podAffinityTerm:
|
||||
labelSelector:
|
||||
matchExpressions:
|
||||
- key: app.kubernetes.io/name
|
||||
operator: In
|
||||
values:
|
||||
- ${current_ns}
|
||||
topologyKey: kubernetes.io/hostname
|
||||
tolerations:
|
||||
- key: wkloadtype
|
||||
operator: Equal
|
||||
value: fakeload
|
||||
effect: "NoSchedule"
|
||||
containers:
|
||||
- image: quay.io/simbelmas/nginx:stable
|
||||
resources:
|
||||
requests:
|
||||
memory: "1Mi"
|
||||
cpu: "1m"
|
||||
limits:
|
||||
memory: "20Mi"
|
||||
command:
|
||||
- bash
|
||||
- -e
|
||||
- -c
|
||||
- |-
|
||||
lc()
|
||||
{
|
||||
(
|
||||
pids=""
|
||||
cpus=\${1:-1}
|
||||
seconds=\${2:-60}
|
||||
echo loading \$cpus CPUs for \$seconds seconds
|
||||
trap 'for p in \$pids; do kill \$p; done' 0
|
||||
for ((i=0;i<cpus;i++)); do
|
||||
while : ; do
|
||||
:
|
||||
done &
|
||||
pids="\$pids $!"
|
||||
done
|
||||
sleep \$seconds
|
||||
) &
|
||||
}
|
||||
#lc \$((1 + \$RANDOM % 3)) \$((120 + \$RANDOM % 421))
|
||||
lc \$((1 + \$RANDOM % 3)) \$((120 + \$RANDOM % 600))
|
||||
wait
|
||||
echo Starting frontend
|
||||
exec nginx -g "daemon off;"
|
||||
imagePullPolicy: IfNotPresent
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop: ['ALL']
|
||||
name: front
|
||||
volumeMounts:
|
||||
- mountPath: /var/www/html
|
||||
name: web
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
protocol: TCP
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 8080
|
||||
initialDelaySeconds: 10
|
||||
timeoutSeconds: 1
|
||||
periodSeconds: 20
|
||||
successThreshold: 1
|
||||
failureThreshold: 3
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 8080
|
||||
initialDelaySeconds: 10
|
||||
timeoutSeconds: 1
|
||||
periodSeconds: 30
|
||||
successThreshold: 1
|
||||
failureThreshold: 3
|
||||
startupProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 8080
|
||||
periodSeconds: 10
|
||||
successThreshold: 1
|
||||
failureThreshold: 90
|
||||
initContainers:
|
||||
- command:
|
||||
- bash
|
||||
- -e
|
||||
- -c
|
||||
- |-
|
||||
cat >/var/www/index.html <<EOF
|
||||
<html>
|
||||
<head><title>${current_ns}</title>
|
||||
<body>
|
||||
<h1>${current_ns}</h1>
|
||||
</body>
|
||||
</html>
|
||||
EOF
|
||||
image: quay.io/simbelmas/nginx:stable
|
||||
imagePullPolicy: IfNotPresent
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop: ['ALL']
|
||||
name: generate-web
|
||||
volumeMounts:
|
||||
- mountPath: /var/www
|
||||
name: web
|
||||
volumes:
|
||||
- emptyDir: {}
|
||||
name: web
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels: &svc_labels
|
||||
app.kubernetes.io/part-of: fakeworkload
|
||||
app.kubernetes.io/name: ${current_ns}
|
||||
name: fakeworkload-${current_ns}
|
||||
namespace: ${current_ns}
|
||||
spec:
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
protocol: TCP
|
||||
targetPort: 8080
|
||||
selector: *svc_labels
|
||||
sessionAffinity: ClientIP
|
||||
type: ClusterIP
|
||||
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: fakeworkload-${current_ns}
|
||||
namespace: ${current_ns}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: fakeworkload
|
||||
app.kubernetes.io/name: ${current_ns}
|
||||
spec:
|
||||
ingressClassName: openshift-default
|
||||
rules:
|
||||
- host: ${current_ns}.${route_domain}
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: fakeworkload-${current_ns}
|
||||
port:
|
||||
number: 80
|
||||
|
||||
Reference in New Issue
Block a user