Skip to content

Add CEL test for ObservabilityPolicy CRD #3670

@shaun-nx

Description

@shaun-nx

Overview

As a user of NGF, I would like to add CEL tests for the ObservabilityPolicy CRD so that I can be confident that the CEL validation works as I expect

UACs

  • Add test for the targetRef CEL validation
  • Add test for the tracing CEL validation

targetRef validation:

x-kubernetes-validations:
    - message: 'TargetRef Kind must be: HTTPRoute or GRPCRoute'
      rule: (self.exists(t, t.kind=='HTTPRoute') || self.exists(t, t.kind=='GRPCRoute'))
    - message: TargetRef Group must be gateway.networking.k8s.io
      rule: self.all(t, t.group=='gateway.networking.k8s.io')
    - message: TargetRef Kind and Name combination must be unique
      rule: self.all(p1, self.exists_one(p2, (p1.name == p2.name) && (p1.kind
        == p2.kind)))

tracing validation:

x-kubernetes-validations:
    - message: ratio can only be specified if strategy is of type ratio
      rule: '!(has(self.ratio) && self.strategy != ''ratio'')'

Metadata

Metadata

Assignees

No one assigned

    Labels

    communitytestsPull requests that update tests

    Type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions