# Exercise 1: Config as env vars and files, and what reloads (easy)
#
# Run: kubectl apply -n lab -f this-file.yaml
#
#   TODO 1: ConfigMap `web-config` with keys GREETING=hello and a file key
#           `settings.json` containing {"theme":"dark","pageSize":20}
#   TODO 2: Secret `web-secret` (use stringData) with API_TOKEN=dev-token-123
#   TODO 3: in the Pod: GREETING as env var (configMapKeyRef), API_TOKEN as env var
#           (secretKeyRef), settings.json mounted at /config/settings.json via a volume
#           (NOT subPath), and the Secret also mounted as files under /secrets (mode 0400)
#   TODO 4: the container (busybox:1.36) loops every 10 s printing $GREETING and
#           the content of /config/settings.json
#
# Experiment: edit the ConfigMap (GREETING=hi, theme=light), wait ~60 s and watch logs.
#
# CHECKLIST:
# [ ] Logs show GREETING=hello and the settings JSON.
# [ ] After editing: the file content changes, GREETING stays "hello" until the Pod
#     is recreated. Explain why in a comment at the bottom.
# [ ] ls -l /secrets shows files with mode 0400; `mount | grep secrets` shows tmpfs.
apiVersion: v1
kind: ConfigMap
metadata:
  name: web-config
data: {}
  # TODO 1
---
apiVersion: v1
kind: Secret
metadata:
  name: web-secret
type: Opaque
# TODO 2
---
apiVersion: v1
kind: Pod
metadata:
  name: config-demo
spec:
  containers:
    - name: app
      image: busybox:1.36
      command: ["sh", "-c", "while true; do echo \"GREETING=$GREETING\"; cat /config/settings.json; echo; sleep 10; done"]
      # TODO 3: env, volumeMounts
  # TODO 3: volumes
# Explanation (TODO):
