Skip to content

Inconsistent Default Reason for GatewayClass Status Condition Accepted #3225

@snorwin

Description

@snorwin

What happened:
According to the API reference, Pending is the default Reason for the status condition Accepted of a new GatewayClass. However, in the actual code, the default reason is inconsistently set to two different values:

	// +kubebuilder:default={conditions: {{type: "Accepted", status: "Unknown", message: "Waiting for controller", reason: "Waiting", lastTransitionTime: "1970-01-01T00:00:00Z"}}}
	// +kubebuilder:default={{type: "Accepted", status: "Unknown", message: "Waiting for controller", reason: "Pending", lastTransitionTime: "1970-01-01T00:00:00Z"}}

During the creation of a resource, the status is typically absent. As a result, the reason for the status condition Accepted is still set to the deprecated value Waiting.

What you expected to happen:
Regardless of how a GatewayClass is created, the reason for the status condition Accepted should always be set to Pending.

How to reproduce it (as minimally and precisely as possible):
Apply the following manifest and verify its status:

apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
  name: foo
spec:
  controllerName: foo.com/bar

Anything else we need to know?:
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions