Skip to content

Commit f6bfb2e

Browse files
committed
found the first bug thanks to the e2e tests: the remaining version in the CRD must be served/stored
On-behalf-of: @SAP [email protected]
1 parent c45b414 commit f6bfb2e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

internal/controller/apiresourceschema/controller.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,14 @@ func (r *Reconciler) createAPIResourceSchema(ctx context.Context, log *zap.Sugar
181181
return v.Name != selectedVersion
182182
})
183183

184+
if len(projectedCRD.Spec.Versions) != 1 {
185+
// This should never happen because of checks earlier in the reconciler.
186+
return fmt.Errorf("invalid CRD: cannot find selected version %q", selectedVersion)
187+
}
188+
189+
projectedCRD.Spec.Versions[0].Served = true
190+
projectedCRD.Spec.Versions[0].Storage = true
191+
184192
// prefix is irrelevant as the reconciling framework will use arsName anyway
185193
converted, err := kcpdevv1alpha1.CRDToAPIResourceSchema(projectedCRD, "irrelevant")
186194
if err != nil {

0 commit comments

Comments
 (0)