-
Notifications
You must be signed in to change notification settings - Fork 382
Add custom columns to OpenAPI schema #1597
Add custom columns to OpenAPI schema #1597
Conversation
d888b71
to
5954926
Compare
5954926
to
00e11fe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the direction this moves us in a lot, thanks for doing this.
I do have some concerns about how status is handled (suggest we punt status to another PR), and a couple suggestions for columns to add.
@@ -427,6 +430,7 @@ type ExtraValue []string | |||
// In the future, this will be allowed and will represent the intention that | |||
// the ServiceInstance should have the plan and/or parameters updated at the | |||
// ClusterServiceBroker. | |||
// +k8s:openapi-gen=x-kubernetes-print-columns:custom-columns=NAME:.metadata.name,CLASS:.spec.clusterServiceClassExternalName,PLAN:.spec.clusterServicePlanExternalName,STATUS:.status.conditions[*].reason |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder how flexible we can be here with status. I'm not sure the current formulation of status is going to be useful - how about remove the STATUS
bits and deal with status in a subsequent PR?
@@ -320,6 +322,7 @@ type ClusterServicePlanList struct { | |||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | |||
|
|||
// ClusterServicePlan represents a tier of a ServiceClass. | |||
// +k8s:openapi-gen=x-kubernetes-print-columns:custom-columns=NAME:.metadata.name,EXTERNAL NAME:.spec.externalName,BROKER:.spec.clusterServiceBrokerName,CLASS:.spec.clusterServiceClassRef.name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the CLASS
column as it is defined here is probably useful and an improvement over nothing.
With that said I think this is an area where a kubectl plugin could help immensely.
cc @jberkhahn
@@ -225,6 +226,7 @@ type ClusterServiceClassList struct { | |||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | |||
|
|||
// ClusterServiceClass represents an offering in the service catalog. | |||
// +k8s:openapi-gen=x-kubernetes-print-columns:custom-columns=NAME:.metadata.name,EXTERNAL NAME:.spec.externalName,BROKER:.spec.clusterServiceBrokerName,BINDABLE:.spec.bindable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The columns proposed here are good - how able adding plan_updateable
?
@@ -27,6 +27,7 @@ import ( | |||
|
|||
// ClusterServiceBroker represents an entity that provides | |||
// ClusterServiceClasses for use in the service catalog. | |||
// +k8s:openapi-gen=x-kubernetes-print-columns:custom-columns=NAME:.metadata.name,URL:.spec.url,STATUS:.status.conditions[*].reason |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure on the formulation of STATUS
here, how about remove it and we'll do it in another PR?
@@ -691,6 +695,7 @@ type ServiceBindingList struct { | |||
|
|||
// ServiceBinding represents a "used by" relationship between an application and an | |||
// ServiceInstance. | |||
// +k8s:openapi-gen=x-kubernetes-print-columns:custom-columns=NAME:.metadata.name,INSTANCE:.spec.instanceRef.name,SECRET:.spec.secretName,STATUS:.status.conditions[*].reason |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same concerns about STATUS
here.
This makes kubectl show the proper columns for ServiceCatalog resources.
9dfe7d9
to
6b729bb
Compare
@pmorie Addressed all your comments & rebased to current master |
/retest |
This can be merged immediately, as it has no effect until you enable the serving of the OpenAPI schema in the svc cat API server through the |
LGTM |
I'm happy with this going in. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I don't think this could break anything.
Fixes #1361
This adds the required
x-kubernetes-print-columns
extensions to the OpenAPI schema, which allow kubectl to show sensible columns when listing service catalog resources:I've also added the AGE column (like the one displayed for core k8s resources), but that requires changes to kubectl, so I'll put that into a different PR.
Note:
--experimental-use-openapi-print-columns
option