diff --git a/changelog/v1.18.0-beta35/crdcheck.yaml b/changelog/v1.18.0-beta35/crdcheck.yaml new file mode 100644 index 00000000000..c50b01d981f --- /dev/null +++ b/changelog/v1.18.0-beta35/crdcheck.yaml @@ -0,0 +1,4 @@ +changelog: + - type: NON_USER_FACING + description: >- + Fix CRD check to allow the group/kind to be missing. diff --git a/pkg/schemes/extended_scheme.go b/pkg/schemes/extended_scheme.go index 0e4cc557d98..69aaf372b86 100644 --- a/pkg/schemes/extended_scheme.go +++ b/pkg/schemes/extended_scheme.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/solo-io/gloo/projects/gateway2/wellknown" + "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/discovery" @@ -38,7 +39,7 @@ func CRDExists(restConfig *rest.Config, group, version, kind string) (bool, erro groupVersion := fmt.Sprintf("%s/%s", group, version) apiResourceList, err := discoveryClient.ServerResourcesForGroupVersion(groupVersion) if err != nil { - if discovery.IsGroupDiscoveryFailedError(err) || meta.IsNoMatchError(err) { + if errors.IsNotFound(err) || discovery.IsGroupDiscoveryFailedError(err) || meta.IsNoMatchError(err) { return false, nil } return false, err diff --git a/projects/gateway2/controller/start.go b/projects/gateway2/controller/start.go index 787ee182c07..e9f7efd63ab 100644 --- a/projects/gateway2/controller/start.go +++ b/projects/gateway2/controller/start.go @@ -151,6 +151,8 @@ func NewControllerBuilder(ctx context.Context, cfg StartConfig) (*ControllerBuil krt.WithName("AuthConfig")) inputChannels := proxy_syncer.NewGatewayInputChannels() + + setupLog.Info("initializing k8sgateway extensions") k8sGwExtensions, err := cfg.ExtensionsFactory(ctx, ext.K8sGatewayExtensionsFactoryParameters{ Mgr: mgr, IstioClient: cfg.Client, @@ -169,6 +171,7 @@ func NewControllerBuilder(ctx context.Context, cfg StartConfig) (*ControllerBuil } // Create the proxy syncer for the Gateway API resources + setupLog.Info("initializing proxy syncer") proxySyncer := proxy_syncer.NewProxySyncer( ctx, cfg.InitialSettings, @@ -188,7 +191,6 @@ func NewControllerBuilder(ctx context.Context, cfg StartConfig) (*ControllerBuil cfg.SetupOpts.ProxyReconcileQueue, ) proxySyncer.Init(ctx, cfg.Debugger) - if err := mgr.Add(proxySyncer); err != nil { setupLog.Error(err, "unable to add proxySyncer runnable") return nil, err diff --git a/projects/gateway2/setup/ggv2setup.go b/projects/gateway2/setup/ggv2setup.go index 8f2f1300244..e0bea7e7661 100644 --- a/projects/gateway2/setup/ggv2setup.go +++ b/projects/gateway2/setup/ggv2setup.go @@ -2,12 +2,11 @@ package setup import ( "context" + "errors" "fmt" "sort" "strings" - "errors" - "github.com/solo-io/gloo/pkg/utils/envutils" "github.com/solo-io/gloo/pkg/utils/setuputils" gloostatusutils "github.com/solo-io/gloo/pkg/utils/statusutils" @@ -43,9 +42,7 @@ import ( ctrl "sigs.k8s.io/controller-runtime" ) -var ( - settingsGVR = glookubev1.SchemeGroupVersion.WithResource("settings") -) +var settingsGVR = glookubev1.SchemeGroupVersion.WithResource("settings") func createKubeClient(restConfig *rest.Config) (istiokube.Client, error) { restCfg := istiokube.NewClientConfigForRestConfig(restConfig) @@ -77,15 +74,14 @@ func getInitialSettings(ctx context.Context, c istiokube.Client, nns types.Names return nil } return out - } func StartGGv2(ctx context.Context, setupOpts *bootstrap.SetupOpts, uccBuilder krtcollections.UniquelyConnectedClientsBulider, extensionsFactory extensions.K8sGatewayExtensionsFactory, - pluginRegistryFactory func(opts registry.PluginOpts) plugins.PluginRegistryFactory) error { - + pluginRegistryFactory func(opts registry.PluginOpts) plugins.PluginRegistryFactory, +) error { restConfig := ctrl.GetConfigOrDie() return StartGGv2WithConfig(ctx, setupOpts, restConfig, uccBuilder, extensionsFactory, pluginRegistryFactory, setuputils.SetupNamespaceName()) @@ -164,6 +160,7 @@ func StartGGv2WithConfig(ctx context.Context, Debugger: setupOpts.KrtDebugger, }) if err != nil { + logger.Error("failed initializing controller: ", err) return err } /// no collections after this point