cloud-demo/apps/hello-app/deployment.yaml
CodeGit cd87435d8e fix: move Flux image-automation marker to a trailing comment
The $imagepolicy marker was on the line above image:, not a trailing
comment on that line. Flux's Setters strategy attaches YAML comments to
the node on their own line, so a marker on a preceding line never
associates with the field below it - the marker silently matched nothing,
which is why ImageUpdateAutomation logged "repository up-to-date" on
every reconcile regardless of what ImagePolicy resolved to, and never
once committed a tag update despite two successful image builds.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y4YNpuC2bgT224suQLLJ7B
2026-09-04 10:59:25 +01:00

67 lines
1.9 KiB
YAML

# This app's own Deployment/Service/Ingress, hand-written rather than a
# Helm chart (see README.md "Why it's structured this way") — there's no
# upstream chart to track since the image is built by this repo's own CI
# (.forgejo/workflows/build-hello-app.yml).
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-app
namespace: hello-app
spec:
replicas: 1
selector:
matchLabels:
app: hello-app
template:
metadata:
labels:
app: hello-app
spec:
# Uncomment if the hello-app package is set to private in Forgejo
# (see docs/03-flux.md step 6).
# imagePullSecrets:
# - name: forgejo-registry
containers:
- name: hello-app
# The trailing comment on the image line below (not this one) is
# how Flux's image-automation "Setters" strategy finds this field
# and knows to rewrite the tag in place, rather than needing it
# templated. It must be a trailing comment on the image: line
# itself - Flux's YAML parser attaches comments to the node on
# their own line, so a marker on a line above never associates
# with the field below it and silently never matches anything.
# "hello-app:hello-app" is "<namespace>:<ImagePolicy name>".
image: git.boglabob.com/codegit/hello-app:latest # {"$imagepolicy": "hello-app:hello-app"}
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: hello-app
namespace: hello-app
spec:
selector:
app: hello-app
ports:
- port: 80
targetPort: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: hello-app
namespace: hello-app
spec:
ingressClassName: traefik
rules:
- host: hello.boglabob.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: hello-app
port:
number: 80