Skip to content

Commit 8a38144

Browse files
authored
Merge pull request #10353 from stevenctl/logs
fix CRDExists check
2 parents fef8641 + 7a053e0 commit 8a38144

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
changelog:
2+
- type: NON_USER_FACING
3+
description: >-
4+
Fix CRD check to allow the group/kind to be missing.

pkg/schemes/extended_scheme.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55

66
"github.com/solo-io/gloo/projects/gateway2/wellknown"
7+
"k8s.io/apimachinery/pkg/api/errors"
78
"k8s.io/apimachinery/pkg/api/meta"
89
"k8s.io/apimachinery/pkg/runtime"
910
"k8s.io/client-go/discovery"
@@ -38,7 +39,7 @@ func CRDExists(restConfig *rest.Config, group, version, kind string) (bool, erro
3839
groupVersion := fmt.Sprintf("%s/%s", group, version)
3940
apiResourceList, err := discoveryClient.ServerResourcesForGroupVersion(groupVersion)
4041
if err != nil {
41-
if discovery.IsGroupDiscoveryFailedError(err) || meta.IsNoMatchError(err) {
42+
if errors.IsNotFound(err) || discovery.IsGroupDiscoveryFailedError(err) || meta.IsNoMatchError(err) {
4243
return false, nil
4344
}
4445
return false, err

projects/gateway2/controller/start.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ func NewControllerBuilder(ctx context.Context, cfg StartConfig) (*ControllerBuil
151151
krt.WithName("AuthConfig"))
152152

153153
inputChannels := proxy_syncer.NewGatewayInputChannels()
154+
155+
setupLog.Info("initializing k8sgateway extensions")
154156
k8sGwExtensions, err := cfg.ExtensionsFactory(ctx, ext.K8sGatewayExtensionsFactoryParameters{
155157
Mgr: mgr,
156158
IstioClient: cfg.Client,
@@ -169,6 +171,7 @@ func NewControllerBuilder(ctx context.Context, cfg StartConfig) (*ControllerBuil
169171
}
170172

171173
// Create the proxy syncer for the Gateway API resources
174+
setupLog.Info("initializing proxy syncer")
172175
proxySyncer := proxy_syncer.NewProxySyncer(
173176
ctx,
174177
cfg.InitialSettings,
@@ -188,7 +191,6 @@ func NewControllerBuilder(ctx context.Context, cfg StartConfig) (*ControllerBuil
188191
cfg.SetupOpts.ProxyReconcileQueue,
189192
)
190193
proxySyncer.Init(ctx, cfg.Debugger)
191-
192194
if err := mgr.Add(proxySyncer); err != nil {
193195
setupLog.Error(err, "unable to add proxySyncer runnable")
194196
return nil, err

projects/gateway2/setup/ggv2setup.go

+5-8
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ package setup
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"sort"
78
"strings"
89

9-
"errors"
10-
1110
"github.com/solo-io/gloo/pkg/utils/envutils"
1211
"github.com/solo-io/gloo/pkg/utils/setuputils"
1312
gloostatusutils "github.com/solo-io/gloo/pkg/utils/statusutils"
@@ -43,9 +42,7 @@ import (
4342
ctrl "sigs.k8s.io/controller-runtime"
4443
)
4544

46-
var (
47-
settingsGVR = glookubev1.SchemeGroupVersion.WithResource("settings")
48-
)
45+
var settingsGVR = glookubev1.SchemeGroupVersion.WithResource("settings")
4946

5047
func createKubeClient(restConfig *rest.Config) (istiokube.Client, error) {
5148
restCfg := istiokube.NewClientConfigForRestConfig(restConfig)
@@ -77,15 +74,14 @@ func getInitialSettings(ctx context.Context, c istiokube.Client, nns types.Names
7774
return nil
7875
}
7976
return out
80-
8177
}
8278

8379
func StartGGv2(ctx context.Context,
8480
setupOpts *bootstrap.SetupOpts,
8581
uccBuilder krtcollections.UniquelyConnectedClientsBulider,
8682
extensionsFactory extensions.K8sGatewayExtensionsFactory,
87-
pluginRegistryFactory func(opts registry.PluginOpts) plugins.PluginRegistryFactory) error {
88-
83+
pluginRegistryFactory func(opts registry.PluginOpts) plugins.PluginRegistryFactory,
84+
) error {
8985
restConfig := ctrl.GetConfigOrDie()
9086

9187
return StartGGv2WithConfig(ctx, setupOpts, restConfig, uccBuilder, extensionsFactory, pluginRegistryFactory, setuputils.SetupNamespaceName())
@@ -164,6 +160,7 @@ func StartGGv2WithConfig(ctx context.Context,
164160
Debugger: setupOpts.KrtDebugger,
165161
})
166162
if err != nil {
163+
logger.Error("failed initializing controller: ", err)
167164
return err
168165
}
169166
/// no collections after this point

0 commit comments

Comments
 (0)