fix: Show add/delete for hostname edits in activity - #73
Merged
Conversation
Portal keeps one DNSRecordSet per zone per type, so adding or removing a hostname is a Kubernetes update. Stamp activity-* annotations from the admission OldObject diff and prefer them in ActivityPolicy so the timeline matches the UI (issue #72).
failurePolicy Ignore lets writes succeed without activity annotations and those audits never self-heal. Fail is safe now that the MWC ships with the same OCI tag as the manager (follow-up to #70).
mattdjenkinson
requested review from
JoseSzycho,
ecv,
kevwilliams,
savme and
scotwells
July 29, 2026 13:50
ecv
approved these changes
Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When someone adds or removes a hostname in the DNS UI, Activity often says "updated" and names whatever is left on the object. That happens because the portal keeps one
DNSRecordSetper zone per type (for exampledodik-me-…-a) and puts hostnames inspec.records[]. Only the first hostname creates the object; later adds and removes are patches.ActivityPolicy cannot see the previous object on updates, so this change has the mutating webhook compare against admission
OldObjectand stamp:activity-change:added/removed/updatedactivity-name: the FQDN that changedactivity-value: the value for that changeUpdate rules prefer those annotations when present, and still fall back to
display-name/display-valuefor older images. Pure add or remove of a hostname reads as added/deleted; value-only edits stay updated. Mixed add+remove in one write is summarized as updated.Also switches the DNSRecordSet mutating webhook back to
failurePolicy: Fail. Ignore lets admits succeed without annotations, and those activity lines never recover. Fail is appropriate now that the MWC is co-versioned with the manager image (#70); apply both from the same OCI tag.Test plan
go test ./internal/display/ ./internal/webhook/ ./internal/activitypolicy/kustomize build config/components/admission-webhooksshowsfailurePolicy: FailFixes #72
Related to #62
Related to #70