Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CRDs printcolumns #353

Merged
merged 2 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions api/v1beta1/kuadrant_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ func (r *KuadrantStatus) Equals(other *KuadrantStatus, logger logr.Logger) bool

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[0].reason`,priority=2
//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"

// Kuadrant configures installations of Kuadrant Service Protection components
type Kuadrant struct {
Expand Down
4 changes: 4 additions & 0 deletions api/v1beta2/authpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ func (s *AuthPolicyStatus) Equals(other *AuthPolicyStatus, logger logr.Logger) b
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:metadata:labels="gateway.networking.k8s.io/policy=direct"
// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[0].reason`,description="AuthPolicy Status",priority=2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This relies on the fact the we currently only set one condition per status stanza, which is fine for now.

Soon, it will have to differentiate Accepted and Enforced. E.g.:

// +kubebuilder:printcolumn:name="Accepted",type=string,JSONPath=`.status.conditions[?(@.type=="Accepted")].status`,description="AuthPolicy Accepted",priority=2
// +kubebuilder:printcolumn:name="Enforced",type=string,JSONPath=`.status.conditions[?(@.type=="Enforced")].status`,description="AuthPolicy Enforced",priority=2

See https://docs.kuadrant.io/architecture/rfcs/0004-policy-status.

// +kubebuilder:printcolumn:name="TargetRefKind",type="string",JSONPath=".spec.targetRef.kind",description="Type of the referenced Gateway API resource",priority=2
// +kubebuilder:printcolumn:name="TargetRefName",type="string",JSONPath=".spec.targetRef.name",description="Name of the referenced Gateway API resource",priority=2
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"

// AuthPolicy enables authentication and authorization for service workloads in a Gateway API network
type AuthPolicy struct {
Expand Down
4 changes: 4 additions & 0 deletions api/v1beta2/ratelimitpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ func (s *RateLimitPolicyStatus) Equals(other *RateLimitPolicyStatus, logger logr
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:metadata:labels="gateway.networking.k8s.io/policy=direct"
// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[0].reason`,description="RateLimitPolicy Status",priority=2
// +kubebuilder:printcolumn:name="TargetRefKind",type="string",JSONPath=".spec.targetRef.kind",description="Type of the referenced Gateway API resource",priority=2
// +kubebuilder:printcolumn:name="TargetRefName",type="string",JSONPath=".spec.targetRef.name",description="Name of the referenced Gateway API resource",priority=2
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"

// RateLimitPolicy enables rate limiting for service workloads in a Gateway API network
type RateLimitPolicy struct {
Expand Down
21 changes: 20 additions & 1 deletion bundle/manifests/kuadrant.io_authpolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,26 @@ spec:
singular: authpolicy
scope: Namespaced
versions:
- name: v1beta2
- additionalPrinterColumns:
- description: AuthPolicy Status
jsonPath: .status.conditions[0].reason
name: Status
priority: 2
type: string
- description: Type of the referenced Gateway API resource
jsonPath: .spec.targetRef.kind
name: TargetRefKind
priority: 2
type: string
- description: Name of the referenced Gateway API resource
jsonPath: .spec.targetRef.name
name: TargetRefName
priority: 2
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1beta2
schema:
openAPIV3Schema:
description: AuthPolicy enables authentication and authorization for service
Expand Down
10 changes: 9 additions & 1 deletion bundle/manifests/kuadrant.io_kuadrants.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ spec:
singular: kuadrant
scope: Namespaced
versions:
- name: v1beta1
- additionalPrinterColumns:
- jsonPath: .status.conditions[0].reason
name: Status
priority: 2
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1beta1
schema:
openAPIV3Schema:
description: Kuadrant configures installations of Kuadrant Service Protection
Expand Down
21 changes: 20 additions & 1 deletion bundle/manifests/kuadrant.io_ratelimitpolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,26 @@ spec:
singular: ratelimitpolicy
scope: Namespaced
versions:
- name: v1beta2
- additionalPrinterColumns:
- description: RateLimitPolicy Status
jsonPath: .status.conditions[0].reason
name: Status
priority: 2
type: string
- description: Type of the referenced Gateway API resource
jsonPath: .spec.targetRef.kind
name: TargetRefKind
priority: 2
type: string
- description: Name of the referenced Gateway API resource
jsonPath: .spec.targetRef.name
name: TargetRefName
priority: 2
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1beta2
schema:
openAPIV3Schema:
description: RateLimitPolicy enables rate limiting for service workloads in
Expand Down
21 changes: 20 additions & 1 deletion config/crd/bases/kuadrant.io_authpolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,26 @@ spec:
singular: authpolicy
scope: Namespaced
versions:
- name: v1beta2
- additionalPrinterColumns:
- description: AuthPolicy Status
jsonPath: .status.conditions[0].reason
name: Status
priority: 2
type: string
- description: Type of the referenced Gateway API resource
jsonPath: .spec.targetRef.kind
name: TargetRefKind
priority: 2
type: string
- description: Name of the referenced Gateway API resource
jsonPath: .spec.targetRef.name
name: TargetRefName
priority: 2
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1beta2
schema:
openAPIV3Schema:
description: AuthPolicy enables authentication and authorization for service
Expand Down
10 changes: 9 additions & 1 deletion config/crd/bases/kuadrant.io_kuadrants.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ spec:
singular: kuadrant
scope: Namespaced
versions:
- name: v1beta1
- additionalPrinterColumns:
- jsonPath: .status.conditions[0].reason
name: Status
priority: 2
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1beta1
schema:
openAPIV3Schema:
description: Kuadrant configures installations of Kuadrant Service Protection
Expand Down
21 changes: 20 additions & 1 deletion config/crd/bases/kuadrant.io_ratelimitpolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,26 @@ spec:
singular: ratelimitpolicy
scope: Namespaced
versions:
- name: v1beta2
- additionalPrinterColumns:
- description: RateLimitPolicy Status
jsonPath: .status.conditions[0].reason
name: Status
priority: 2
type: string
- description: Type of the referenced Gateway API resource
jsonPath: .spec.targetRef.kind
name: TargetRefKind
priority: 2
type: string
- description: Name of the referenced Gateway API resource
jsonPath: .spec.targetRef.name
name: TargetRefName
priority: 2
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1beta2
schema:
openAPIV3Schema:
description: RateLimitPolicy enables rate limiting for service workloads in
Expand Down
Loading