Skip to content

Support warnings in webhook utils #1788

@fabxc

Description

@fabxc

The admission package supports returning warnings on webhook requests through Response.WithWarnings.
It seems one cannot make use of the utility interfaces and constructors if one wants to respond warnings. So one would end up re-implementing a bunch of the logic.

To not break the existing API, a specific error type could be used which is introspected by the existing utility logic. For an only-warnings error, an Allowed response would be returned.

This could be surfaced through 2 simple functions:

// Triggers an Allowed response with warnings.
func Warnings(...string) error

// Triggers a Denied response with the given error and additional warnings.
func ErrorAndWarnings(error, ...string) error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions