Skip to content

Generation of KRI does not use default fallbacks #15544

@schogges

Description

@schogges

Kuma Version

2.13 (kuma-0.0.0-preview.v00714b786)

Describe the bug

When applying a resource, in my case MeshTrafficPermission and I don't add all information such as a namespace the generated KRI does not contain any fallbacks or defaults, which leads to a KRI that can't be used to retrieve the resource again.

Without a namespace

apiVersion: kuma.io/v1alpha1
kind: MeshTrafficPermission
metadata:
  name: without-namespace
  labels:
    kuma.io/mesh: default
spec:
  targetRef:
    kind: Mesh
  rules:
    - default:
        allow:
          - spiffeID:
              type: Prefix
              value: spiffe://default.local.mesh.local/ns/kuma-demo
          - spiffeID:
              type: Prefix
              value: spiffe://default.local.mesh.local/ns/another/sa/foo

The resulting KRI is: kri_mtp_default___without-namespace_
This does not work as expected as the KRI is missing any defaults/fallbacks. Fetching the KRI API with /_kri/kri_mtp_default___without-namespace_ returns 404. Instead when manually adding the defaults it returns the expected resource /_kri/kri_mtp_default_default_default_without-namespace_.

With a namespace

apiVersion: kuma.io/v1alpha1
kind: MeshTrafficPermission
metadata:
  name: with-namespace
  namespace: kuma-demo
  labels:
    kuma.io/mesh: default
spec:
  targetRef:
    kind: Mesh
  rules:
    - default:
        allow:
          - spiffeID:
              type: Prefix
              value: spiffe://default.local.mesh.local/ns/kuma-demo
          - spiffeID:
              type: Prefix
              value: spiffe://default.local.mesh.local/ns/another/sa/foo

The resulting KRI is: kri_mtp_default_default_kuma-demo_with-namespace_
This works as expected and I'm able to retrieve the resource via KRI API /_kri/kri_mtp_default_default_kuma-demo_with-namespace_

To Reproduce

Deploy latest kuma (I used preview kuma-0.0.0-preview.v00714b786), demo-app and apply the MTPs from above.

Expected behavior

The generated KRI should include all the necessary fallbacks/defaults such that a user is able to use that KRI to retrieve the respective resource.

Additional context (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugA bugtriage/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