Skip to content

fix(search): Reuse the existing org and project index policy names - #333

Closed
vvoytovych wants to merge 1 commit into
mainfrom
fix/search-index-policy-names
Closed

vvoytovych wants to merge 1 commit into
mainfrom
fix/search-index-policy-names

Conversation

@vvoytovych

Copy link
Copy Markdown

Summary

Since #331 merged, staging stops applying the datum bundle. Staging's search service already has an organization policy and a project policy under other names, and the search validator allows only one policy for each resource type.

This change gives the two policies from #331 the names staging already uses, so Flux takes over the existing objects in place and deletes nothing.

One search behaviour changes on staging, as #331 intends: the organization type (Personal or Standard) is no longer searchable.

Test plan

  • The search policies still render as ten policies, and only the two names change.
  • Each policy in the render that staging already indexes has the same name on staging. The check below exits 1 before this change and 0 with it.
  • A server-side dry run of the search policies against staging's control plane passes.
  • After merge, staging applies the datum bundle again.
kustomize build config/services/search.miloapis.com \
  | yq -r 'select(.kind=="ResourceIndexPolicy") | ([.spec.targetResource.group, .spec.targetResource.kind, .spec.targetResource.version] | join("/")) + " " + .metadata.name' \
  | sort > render.txt
# kubectl pointed at staging's Milo API
kubectl get resourceindexpolicies.search.miloapis.com \
  -o jsonpath='{range .items[*]}{.spec.targetResource.group}/{.spec.targetResource.kind}/{.spec.targetResource.version} {.metadata.name}{"\n"}{end}' \
  | sort > staging.txt
awk 'NR==FNR{live[$1]=$2; next} ($1 in live){n++; if (live[$1]!=$2) {print "COLLISION", $0, live[$1]; bad=1}} END{print n, "targets compared"; exit bad + !n}' staging.txt render.txt

Before this change it prints:

COLLISION resourcemanager.miloapis.com/Organization/v1alpha1 organization-resource-index-policy organization-index-policy
COLLISION resourcemanager.miloapis.com/Project/v1alpha1 project-resource-index-policy project-index-policy
9 targets compared

The last box has one read, in staging's metrics:

gotk_resource_info{customresource_kind="Kustomization", name=~"datum-milo-customization|datum-control-plane-system"}

Now neither Kustomization reports ready="True". After merge, both report ready="True", and datum-milo-customization reports a new v0.0.0-main revision.

Related to #331
Related to datum-cloud/staff-portal#840

Staging's Milo already has organization-index-policy and
project-index-policy for the Organization and Project resources. The
search validator allows one policy for each group, version and kind,
so it refuses the two policies of #331, and the datum bundle stops
applying on staging.

The validator skips a policy with the same name. With the names
staging uses, Flux applies over the two existing objects and takes
them over. Nothing is deleted, so the search cleanup finalizer does
not run and both indexes keep their names. On an environment with no
such policies, the two policies are created under these names.

On staging, the organization type stops being searchable, as #331
intends. The spec hash of both policies changes, so the search
controller re-publishes every organization and project once.

Related to: datum-cloud/staff-portal#840
@vvoytovych

Copy link
Copy Markdown
Author

Closing this without merging. The fault was not in #331: staging still had two search policies for organizations and projects, applied by hand in March under other names, and Milo allows one policy per kind. We removed those two from staging, so #331's organization-resource-index-policy and project-resource-index-policy now apply there as designed, with the same name pattern as the other eight policies.

@vvoytovych vvoytovych closed this Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant