Files
kagent-oci-devops-demo/k8s/broken/imagepull-secret-failure-command-spec.yaml
Oracle Public Cloud User 8b3cc8dd10 adding files 2
2026-09-04 13:54:16 +00:00

49 lines
1.3 KiB
YAML

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