Kuadrant / kuadrant-controller

Apache License 2.0
12 stars 7 forks source link

RateLimitPolicy add Gateway API policy attachment (target ref) #121

Closed maleck13 closed 2 years ago

maleck13 commented 2 years ago

To bring the Rate Limit Policy API in line with the policy attachment concept from Gateway API, we need to add a target ref We also need to consider support default and override along with the inheritance model.

// PolicyTargetReference identifies an API object to apply policy to.
type PolicyTargetReference struct {
    // Group is the group of the target resource.
    //
    // +kubebuilder:validation:MinLength=1
    // +kubebuilder:validation:MaxLength=253
    Group string `json:"group"`

    // Kind is kind of the target resource.
    //
    // +kubebuilder:validation:MinLength=1
    // +kubebuilder:validation:MaxLength=253
    Kind string `json:"kind"`

    // Name is the name of the target resource.
    //
    // +kubebuilder:validation:MinLength=1
    // +kubebuilder:validation:MaxLength=253
    Name string `json:"name"`

    // Namespace is the namespace of the referent. When unspecified, the local
    // namespace is inferred. Even when policy targets a resource in a different
    // namespace, it may only apply to traffic originating from the same
    // namespace as the policy.
    //
    // +kubebuilder:validation:MinLength=1
    // +kubebuilder:validation:MaxLength=253
    // +optional
    Namespace string `json:"namespace,omitempty"`
}
maleck13 commented 2 years ago

Initially we may want to skip the Namespace option here as I don't think it is relevant

rahulanand16nov commented 2 years ago

It's recommended in the doc to use the same structs so, even if Namespace is present, we can ignore its usage in the controller.

maleck13 commented 2 years ago

👍

maleck13 commented 2 years ago

Lets target the Gateway API HTTPRoute first

eguzki commented 2 years ago

Added Support targeting a TLSRoute with the target ref task to the epic