Skip to content

Stop reading removed PolicyDescription fields from GET /_resources #5309

Description

@lobkovilya

Context

Since the 3.0 cleanup in kumahq/kuma, every policy is targetRef based and the from-style targetRef is gone. The policy object returned by GET /_resources reflects that:

  • policy.hasFromTargetRef and policy.isFromAsRules were hardcoded to false and are now removed from the response (kumahq/kuma PR linked below).
  • policy.isTargetRef is now true for every policy. It is kept on the wire for now only because the GUI still reads it, and will be removed in a follow-up once the GUI no longer depends on it.
  • policy.hasToTargetRef and policy.hasRulesTargetRef are the real signals for "applies to outbound" and "applies to inbound".

What the GUI does today

  • packages/kuma-gui/src/app/resources/views/ResourceListView.vue shows the Inbound badge from type.policy?.hasFromTargetRef. That badge has never rendered against a 3.0 control plane because the value was always false.
  • ResourceListView.vue and packages/kuma-gui/src/app/data-planes/views/DataPlanePolicySummaryView.vue read policy.isTargetRef to decide whether to show the zone column / search key and whether to render a policy as legacy. Once the field is removed from the response, undefined is falsy and every policy would be treated as legacy.
  • packages/kuma-http-api/mocks/src/_resources.ts and mocks/src/policies.ts still generate the removed fields.

Requested changes

  1. Show the Inbound badge from policy.hasRulesTargetRef instead of policy.hasFromTargetRef.
  2. Stop reading policy.isTargetRef. Every policy is targetRef based, so the legacy rendering path and the isTargetRef conditions on the zone column and search keys can go.
  3. Drop hasFromTargetRef, isFromAsRules and isTargetRef from the _resources and policies mocks.

After this lands and the GUI is bumped in kuma, policy.isTargetRef will be removed from the control plane response as well.

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/cleanupCleanup/refactor an existing component/codetriage/acceptedThe issue was reviewed and is complete enough to start working on it

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions