-
Notifications
You must be signed in to change notification settings - Fork 389
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 to built-in types #3018
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,6 @@ limitations under the License. | |
package informer | ||
|
||
import ( | ||
"reflect" | ||
"strings" | ||
"testing" | ||
|
||
|
@@ -84,6 +83,7 @@ func TestBuiltInInformableTypes(t *testing.T) { | |
{Group: "authorization.k8s.io", Version: "v1", Kind: "SelfSubjectAccessReview"}: {}, | ||
{Group: "authorization.k8s.io", Version: "v1", Kind: "SelfSubjectRulesReview"}: {}, | ||
{Group: "authorization.k8s.io", Version: "v1", Kind: "SubjectAccessReview"}: {}, | ||
{Group: "apiextensions.k8s.io", Version: "v1", Kind: "ConversionReview"}: {}, | ||
} | ||
|
||
gvsToIgnore := map[schema.GroupVersion]struct{}{ | ||
|
@@ -92,6 +92,7 @@ func TestBuiltInInformableTypes(t *testing.T) { | |
|
||
// These are alpha/beta versions that are not preferred (they all have v1) | ||
{Group: "admissionregistration.k8s.io", Version: "v1beta1"}: {}, | ||
{Group: "apiextensions.k8s.io", Version: "v1beta1"}: {}, | ||
{Group: "authentication.k8s.io", Version: "v1beta1"}: {}, | ||
{Group: "authorization.k8s.io", Version: "v1beta1"}: {}, | ||
{Group: "certificates.k8s.io", Version: "v1alpha1"}: {}, | ||
|
@@ -103,11 +104,6 @@ func TestBuiltInInformableTypes(t *testing.T) { | |
} | ||
|
||
allKnownTypes := kcpscheme.Scheme.AllKnownTypes() | ||
|
||
// CRDs are not included in the genericcontrolplane scheme (because they're part of the apiextensions apiserver), | ||
// so we have to manually add them | ||
allKnownTypes[schema.GroupVersionKind{Group: "apiextensions.k8s.io", Version: "v1", Kind: "CustomResourceDefinition"}] = reflect.TypeOf(struct{}{}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isn't that still the case? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think so. We add this to schema bellow? No? |
||
|
||
for gvk := range allKnownTypes { | ||
if kindsToIgnore.Has(gvk.Kind) { | ||
continue | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ limitations under the License. | |
package scheme | ||
|
||
import ( | ||
apiextensionsinstall "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/install" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/runtime/serializer" | ||
admissionregistrationinstall "k8s.io/kubernetes/pkg/apis/admissionregistration/install" | ||
|
@@ -33,6 +34,7 @@ func init() { | |
install.Install(Scheme) | ||
authenticationinstall.Install(Scheme) | ||
authorizationinstall.Install(Scheme) | ||
apiextensionsinstall.Install(Scheme) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is the line I missed. |
||
certificatesinstall.Install(Scheme) | ||
coordinationinstall.Install(Scheme) | ||
rbacinstall.Install(Scheme) | ||
|
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.
what's the consequence of this? Who wants to crdpull CRDs?
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.
need to test crd pulling case :/ tbh this was very quick PR. Needs more testing. And this feedback kelps to identify the areas for testing :)
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.
Note that pulling the CRD type, not CRDs (= instances), is very meta 😄
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 this does not impact CRD pulling. We already converts APIS into CRDs
Tested crd-puller and it just worked. Might be some edge cases but not sure how to identify those without knowing what I'm looking for ;)