File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -195,11 +195,20 @@ export function makeCustomResourceClass(
195195 static getBaseObject ( ) : Omit < KubeObjectInterface , 'metadata' > & {
196196 metadata : Partial < import ( './KubeMetadata' ) . KubeMetadata > ;
197197 } {
198- if ( ! crClassArgs . customResourceDefinition ) {
199- return super . getBaseObject ( ) ;
198+ // For custom resources - use the storage version from the CRD if available,
199+ // otherwise fall back to the first apiInfo entry
200+ let group : string ;
201+ let version : string ;
202+ if ( crClassArgs . customResourceDefinition ) {
203+ [ group , version ] = crClassArgs . customResourceDefinition . getMainAPIGroup ( ) ;
204+ } else {
205+ if ( ! apiInfoArgs . length ) {
206+ throw new Error (
207+ 'makeCustomResourceClass requires at least one apiInfo entry when customResourceDefinition is not provided'
208+ ) ;
209+ }
210+ [ group , version ] = apiInfoArgs [ 0 ] ;
200211 }
201-
202- const [ group , version ] = crClassArgs . customResourceDefinition . getMainAPIGroup ( ) ;
203212 const apiVersion = group ? `${ group } /${ version } ` : version ;
204213
205214 return {
You can’t perform that action at this time.
0 commit comments