Migrate the ccrds package out of apiextensions/v1alpha1
The ccrd package is used to generate the underlying CRDs for XRDs. It's coupled to a specific version of the XRD types (e.g. v1alpha1) but in practice we would not replicate it if we supported many XRD types - we'd only implement it for the version that our controllers reconciled. Signed-off-by: Nic Cope <negz@rk0n.org>
This commit is contained in:
parent
84ddbb77a8
commit
963392d9e8
|
@ -55,7 +55,7 @@ func Configure(_ context.Context, cm resource.CompositeClaim, cp resource.Compos
|
|||
return errors.New("composite resource claim spec was not an object")
|
||||
}
|
||||
|
||||
// TODO(negz): Make these filtered keys constants in the ccrds package?
|
||||
// TODO(negz): Make these filtered keys constants in the xcrds package?
|
||||
_ = fieldpath.Pave(ucp.Object).SetValue("spec", filter(spec, "resourceRef", "writeConnectionSecretToRef"))
|
||||
meta.AddAnnotations(ucp, ucm.GetAnnotations())
|
||||
meta.AddLabels(ucp, ucm.GetLabels())
|
||||
|
|
|
@ -42,8 +42,8 @@ import (
|
|||
"github.com/crossplane/crossplane-runtime/pkg/resource/unstructured"
|
||||
|
||||
"github.com/crossplane/crossplane/apis/apiextensions/v1alpha1"
|
||||
"github.com/crossplane/crossplane/apis/apiextensions/v1alpha1/ccrd"
|
||||
"github.com/crossplane/crossplane/pkg/controller/apiextensions/composite"
|
||||
"github.com/crossplane/crossplane/pkg/xcrd"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -187,7 +187,7 @@ func NewReconciler(mgr manager.Manager, opts ...ReconcilerOption) *Reconciler {
|
|||
},
|
||||
|
||||
composite: definition{
|
||||
CRDRenderer: CRDRenderFn(ccrd.ForCompositeResource),
|
||||
CRDRenderer: CRDRenderFn(xcrd.ForCompositeResource),
|
||||
ControllerEngine: controller.NewEngine(mgr),
|
||||
Finalizer: resource.NewAPIFinalizer(kube, finalizer),
|
||||
},
|
||||
|
@ -351,7 +351,7 @@ func (r *Reconciler) Reconcile(req reconcile.Request) (reconcile.Result, error)
|
|||
}
|
||||
r.record.Event(d, event.Normal(reasonEstablishXR, "Applied composite resource CustomResourceDefinition"))
|
||||
|
||||
if !ccrd.IsEstablished(crd.Status) {
|
||||
if !xcrd.IsEstablished(crd.Status) {
|
||||
log.Debug(waitCRDEstablish)
|
||||
r.record.Event(d, event.Normal(reasonEstablishXR, waitCRDEstablish))
|
||||
return reconcile.Result{RequeueAfter: tinyWait}, nil
|
||||
|
|
|
@ -41,8 +41,8 @@ import (
|
|||
"github.com/crossplane/crossplane-runtime/pkg/resource/unstructured"
|
||||
|
||||
"github.com/crossplane/crossplane/apis/apiextensions/v1alpha1"
|
||||
"github.com/crossplane/crossplane/apis/apiextensions/v1alpha1/ccrd"
|
||||
"github.com/crossplane/crossplane/pkg/controller/apiextensions/claim"
|
||||
"github.com/crossplane/crossplane/pkg/xcrd"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -186,7 +186,7 @@ func NewReconciler(mgr manager.Manager, opts ...ReconcilerOption) *Reconciler {
|
|||
},
|
||||
|
||||
claim: definition{
|
||||
CRDRenderer: CRDRenderFn(ccrd.ForCompositeResourceClaim),
|
||||
CRDRenderer: CRDRenderFn(xcrd.ForCompositeResourceClaim),
|
||||
ControllerEngine: controller.NewEngine(mgr),
|
||||
Finalizer: resource.NewAPIFinalizer(kube, finalizer),
|
||||
},
|
||||
|
@ -355,7 +355,7 @@ func (r *Reconciler) Reconcile(req reconcile.Request) (reconcile.Result, error)
|
|||
}
|
||||
r.record.Event(d, event.Normal(reasonOfferXRC, "Applied composite resource claim CustomResourceDefinition"))
|
||||
|
||||
if !ccrd.IsEstablished(crd.Status) {
|
||||
if !xcrd.IsEstablished(crd.Status) {
|
||||
log.Debug(waitCRDEstablish)
|
||||
r.record.Event(d, event.Normal(reasonOfferXRC, waitCRDEstablish))
|
||||
return reconcile.Result{RequeueAfter: tinyWait}, nil
|
||||
|
|
|
@ -14,13 +14,13 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package ccrd generates CustomResourceDefinitions from Crossplane definitions.
|
||||
// Package xcrd generates CustomResourceDefinitions from Crossplane definitions.
|
||||
//
|
||||
// v1.JSONSchemaProps is incompatible with controller-tools (as of 0.2.4)
|
||||
// because it is missing JSON tags and uses float64, which is a disallowed type.
|
||||
// We thus copy the entire struct as CRDSpecTemplate. See the below issue:
|
||||
// https://github.com/kubernetes-sigs/controller-tools/issues/291
|
||||
package ccrd
|
||||
package xcrd
|
||||
|
||||
import (
|
||||
"encoding/json"
|
|
@ -14,13 +14,13 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package ccrd generates CustomResourceDefinitions from Crossplane definitions.
|
||||
// Package xcrd generates CustomResourceDefinitions from Crossplane definitions.
|
||||
//
|
||||
// v1.JSONSchemaProps is incompatible with controller-tools (as of 0.2.4)
|
||||
// because it is missing JSON tags and uses float64, which is a disallowed type.
|
||||
// We thus copy the entire struct as CRDSpecTemplate. See the below issue:
|
||||
// https://github.com/kubernetes-sigs/controller-tools/issues/291
|
||||
package ccrd
|
||||
package xcrd
|
||||
|
||||
import (
|
||||
"testing"
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package ccrd
|
||||
package xcrd
|
||||
|
||||
import extv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
|
Loading…
Reference in New Issue