adding files 2
This commit is contained in:
14
k8s/broken/business-failure-configmap.yaml
Normal file
14
k8s/broken/business-failure-configmap.yaml
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: demo-config
|
||||
namespace: kagent-demo
|
||||
data:
|
||||
INVENTORY_FORCE_OUTAGE: "false"
|
||||
PAYMENT_FORCE_TIMEOUT: "false"
|
||||
PAYMENT_MANUAL_REVIEW_CARD_PREFIX: "9999"
|
||||
ORDER_STUCK_REVIEW_MODE: "true"
|
||||
ORDER_MANUAL_REVIEW_RATE_THRESHOLD: "40"
|
||||
ORDER_REVENUE_AT_RISK_THRESHOLD: "5000"
|
||||
INVENTORY_BASE_URL: "http://inventory-service:8081"
|
||||
PAYMENT_BASE_URL: "http://payment-service:8082"
|
||||
48
k8s/broken/imagepull-secret-failure-command-spec.yaml
Normal file
48
k8s/broken/imagepull-secret-failure-command-spec.yaml
Normal file
@@ -0,0 +1,48 @@
|
||||
version: 0.1
|
||||
component: command
|
||||
timeoutInSeconds: 600
|
||||
shell: bash
|
||||
failImmediatelyOnError: true
|
||||
|
||||
env:
|
||||
variables:
|
||||
APP_NAMESPACE: kagent-demo
|
||||
DEPLOYMENT_NAME: payment-service
|
||||
CONTAINER_NAME: payment-service
|
||||
BROKEN_IMAGE_PULL_SECRET: missing-ocir-secret
|
||||
|
||||
steps:
|
||||
- type: Command
|
||||
name: Simulate missing imagePullSecret
|
||||
command: |
|
||||
echo "Forcing ImagePullBackOff by replacing imagePullSecrets with ${BROKEN_IMAGE_PULL_SECRET}"
|
||||
|
||||
kubectl patch deployment "${DEPLOYMENT_NAME}" -n "${APP_NAMESPACE}" \
|
||||
--type merge \
|
||||
-p "{
|
||||
\"spec\": {
|
||||
\"template\": {
|
||||
\"spec\": {
|
||||
\"imagePullSecrets\": [
|
||||
{\"name\": \"${BROKEN_IMAGE_PULL_SECRET}\"}
|
||||
],
|
||||
\"containers\": [
|
||||
{
|
||||
\"name\": \"${CONTAINER_NAME}\",
|
||||
\"imagePullPolicy\": \"Always\"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}"
|
||||
|
||||
kubectl rollout restart deployment/"${DEPLOYMENT_NAME}" -n "${APP_NAMESPACE}"
|
||||
kubectl get pods -n "${APP_NAMESPACE}" -o wide
|
||||
|
||||
- type: Command
|
||||
name: Show image pull events
|
||||
command: |
|
||||
sleep 30
|
||||
kubectl get pods -n "${APP_NAMESPACE}" -o wide
|
||||
kubectl get events -n "${APP_NAMESPACE}" --sort-by=.lastTimestamp | tail -40
|
||||
22
k8s/broken/order-hpa-limited.yaml
Normal file
22
k8s/broken/order-hpa-limited.yaml
Normal file
@@ -0,0 +1,22 @@
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: order-service
|
||||
namespace: kagent-demo
|
||||
labels:
|
||||
app: order-service
|
||||
demo-scenario: hpa-limited-capacity
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: order-service
|
||||
minReplicas: 2
|
||||
maxReplicas: 3
|
||||
metrics:
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: 60
|
||||
41
k8s/broken/payment-error.yaml
Normal file
41
k8s/broken/payment-error.yaml
Normal file
@@ -0,0 +1,41 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: payment-service
|
||||
namespace: kagent-demo
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: payment-service
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: payment-service
|
||||
spec:
|
||||
imagePullSecrets:
|
||||
- name: ocir-secret-2
|
||||
containers:
|
||||
- name: payment-service
|
||||
image: mty.ocir.io/xxxxxxxx/kagent-demo/payment-service:latest
|
||||
ports:
|
||||
- containerPort: 8082
|
||||
env:
|
||||
- name: DEMO_PAYMENT_FORCE_TIMEOUT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: demo-config
|
||||
key: PAYMENT_FORCE_TIMEOUT
|
||||
- name: DEMO_PAYMENT_MANUAL_REVIEW_CARD_PREFIX
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: demo-config
|
||||
key: PAYMENT_MANUAL_REVIEW_CARD_PREFIX
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /actuator/health/readiness
|
||||
port: 8082
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /actuator/health/liveness
|
||||
port: 8082
|
||||
14
k8s/broken/revenue-risk-configmap.yaml
Normal file
14
k8s/broken/revenue-risk-configmap.yaml
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: demo-config
|
||||
namespace: kagent-demo
|
||||
data:
|
||||
INVENTORY_FORCE_OUTAGE: "false"
|
||||
PAYMENT_FORCE_TIMEOUT: "false"
|
||||
PAYMENT_MANUAL_REVIEW_CARD_PREFIX: "9999"
|
||||
ORDER_STUCK_REVIEW_MODE: "false"
|
||||
ORDER_MANUAL_REVIEW_RATE_THRESHOLD: "30"
|
||||
ORDER_REVENUE_AT_RISK_THRESHOLD: "5000"
|
||||
INVENTORY_BASE_URL: "http://inventory-service:8081"
|
||||
PAYMENT_BASE_URL: "http://payment-service:8082"
|
||||
58
k8s/broken/simulate-three-errors-command-spec.yaml
Normal file
58
k8s/broken/simulate-three-errors-command-spec.yaml
Normal file
@@ -0,0 +1,58 @@
|
||||
version: 0.1
|
||||
component: command
|
||||
timeoutInSeconds: 900
|
||||
shell: bash
|
||||
failImmediatelyOnError: true
|
||||
|
||||
env:
|
||||
variables:
|
||||
APP_NAMESPACE: kagent-demo
|
||||
PAYMENT_DEPLOYMENT: payment-service
|
||||
PAYMENT_CONTAINER: payment-service
|
||||
BROKEN_IMAGE_PULL_SECRET: missing-ocir-secret
|
||||
|
||||
steps:
|
||||
- type: Command
|
||||
name: Apply business degradation ConfigMap
|
||||
command: |
|
||||
kubectl apply -f k8s/broken/revenue-risk-configmap.yaml
|
||||
kubectl rollout restart deployment/order-service -n "${APP_NAMESPACE}"
|
||||
|
||||
- type: Command
|
||||
name: Apply limited HPA
|
||||
command: |
|
||||
kubectl apply -f k8s/broken/order-hpa-limited.yaml
|
||||
kubectl get hpa order-service -n "${APP_NAMESPACE}" -o wide
|
||||
|
||||
- type: Command
|
||||
name: Break payment image pull secret
|
||||
command: |
|
||||
kubectl patch deployment "${PAYMENT_DEPLOYMENT}" -n "${APP_NAMESPACE}" \
|
||||
--type merge \
|
||||
-p "{
|
||||
\"spec\": {
|
||||
\"template\": {
|
||||
\"spec\": {
|
||||
\"imagePullSecrets\": [
|
||||
{\"name\": \"${BROKEN_IMAGE_PULL_SECRET}\"}
|
||||
],
|
||||
\"containers\": [
|
||||
{
|
||||
\"name\": \"${PAYMENT_CONTAINER}\",
|
||||
\"imagePullPolicy\": \"Always\"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}"
|
||||
|
||||
kubectl rollout restart deployment/"${PAYMENT_DEPLOYMENT}" -n "${APP_NAMESPACE}"
|
||||
|
||||
- type: Command
|
||||
name: Show simulated failures
|
||||
command: |
|
||||
sleep 45
|
||||
kubectl get pods -n "${APP_NAMESPACE}" -o wide
|
||||
kubectl get hpa -n "${APP_NAMESPACE}" -o wide
|
||||
kubectl get events -n "${APP_NAMESPACE}" --sort-by=.lastTimestamp | tail -60
|
||||
Reference in New Issue
Block a user