Skip to content

Commit 731c46b

Browse files
authored
Merge pull request #374 from meshery/leecalcote-aabidsofi19/bug/crd-config
Refactor discovery error handling, update CRD group, and clean up Makefile
2 parents 442cea3 + b458d01 commit 731c46b

File tree

7 files changed

+20
-14248
lines changed

7 files changed

+20
-14248
lines changed

install/Makefile.core.mk

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,6 @@ GOBIN = $(GOPATH)/bin
2626

2727
SHELL :=/bin/bash -o pipefail
2828

29-
#-----------------------------------------------------------------------------
30-
# Components
31-
#-----------------------------------------------------------------------------
32-
ADAPTER_URLS := "localhost:10000 localhost:10001 localhost:10002 localhost:10004 localhost:10005 localhost:10006 localhost:10007 localhost:10009 localhost:10010 localhost:10012"
33-
34-
#-----------------------------------------------------------------------------
35-
# Providers
36-
#-----------------------------------------------------------------------------
37-
REMOTE_PROVIDER_LOCAL="http://localhost:9876"
38-
MESHERY_CLOUD_DEV="http://localhost:9876"
39-
MESHERY_CLOUD_PROD="https://meshery.layer5.io"
40-
MESHERY_CLOUD_STAGING="https://staging-meshery.layer5.io"
41-
4229
#-----------------------------------------------------------------------------
4330
# Server
4431
#-----------------------------------------------------------------------------

internal/config/crd_config.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ import (
1717
)
1818

1919
var (
20-
namespace = "meshery" // Namespace for the Custom Resource
21-
crName = "meshery-meshsync" // Name of the custom resource
22-
version = "v1alpha1" // Version of the Custom Resource
23-
group = "meshery.layer5.io" //Group for the Custom Resource
24-
resource = "meshsyncs" //Name of the Resource
20+
namespace = "meshery" // Namespace for the Custom Resource
21+
crName = "meshery-meshsync" // Name of the custom resource
22+
version = "v1alpha1" // Version of the Custom Resource
23+
group = "meshery.io" //Group for the Custom Resource
24+
resource = "meshsyncs" //Name of the Resource
2525
)
2626

2727
func GetMeshsyncCRDConfigs(dyClient dynamic.Interface) (*MeshsyncConfig, error) {

internal/config/crd_config_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import (
1313

1414
var (
1515
Kind string = "MeshSync"
16-
APIVersion string = "meshery.layer5.io/v1alpha1"
17-
URL string = "https://layer5.io"
16+
APIVersion string = "meshery.io/v1alpha1"
17+
URL string = "https://meshery.io"
1818
fakeDyClient *fake.FakeDynamicClient
1919
ctx = context.Background()
2020
)
@@ -107,8 +107,8 @@ func TestBlackListResources(t *testing.T) {
107107
// excempted local pipelines: pods, replicasets
108108

109109
// counting expected pipelines after blacklist
110-
expectedGlobalCount := len(meshsyncConfig.Pipelines["global"]) - 1 //excluding namespaces
111-
expectedLocalCount := len(meshsyncConfig.Pipelines["local"]) - 2 //excluding pods, replicasets
110+
expectedGlobalCount := len(meshsyncConfig.Pipelines["global"]) - 1 //excluding namespaces
111+
expectedLocalCount := len(meshsyncConfig.Pipelines["local"]) - 2 //excluding pods, replicasets
112112

113113
if len(meshsyncConfig.Pipelines["global"]) != expectedGlobalCount {
114114
t.Errorf("global pipelines not well configured expected %d", expectedGlobalCount)

internal/config/error.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ const (
99
)
1010

1111
func ErrInitConfig(err error) error {
12-
return errors.New(ErrInitConfigCode, errors.Alert, []string{"Error while config init", err.Error()}, []string{}, []string{}, []string{})
12+
return errors.New(ErrInitConfigCode, errors.Alert, []string{"Error while initializing MeshSync configuration. ", err.Error()}, []string{"Missing or outdated CRD. "}, []string{"Missing or outdated CRD."}, []string{"Confirm that meshsyncs custom resource is present in the cluster."})
1313
}

internal/pipeline/step.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package pipeline
22

33
import (
4+
"fmt"
5+
46
broker "github.com/layer5io/meshkit/broker"
57
"github.com/layer5io/meshkit/logger"
68
internalconfig "github.com/layer5io/meshsync/internal/config"
@@ -32,6 +34,13 @@ func newRegisterInformerStep(log logger.Handler, informer dynamicinformer.Dynami
3234
// Exec - step interface
3335
func (ri *RegisterInformer) Exec(request *pipeline.Request) *pipeline.Result {
3436
gvr, _ := schema.ParseResourceArg(ri.config.Name)
37+
if gvr == nil {
38+
return &pipeline.Result{
39+
Error: internalconfig.ErrInitConfig(fmt.Errorf("error parsing resource arg, gvr not found")),
40+
Data: nil,
41+
}
42+
}
43+
3544
iclient := ri.informer.ForResource(*gvr)
3645

3746
ri.registerHandlers(iclient.Informer())

0 commit comments

Comments
 (0)