From e7b3b1ee083d5f4c2be04422c8e59535bf873c06 Mon Sep 17 00:00:00 2001 From: leecalcote Date: Sun, 2 Oct 2022 23:09:31 -0500 Subject: [PATCH] MeshKit upgrade Signed-off-by: leecalcote Signed-off-by: Antonette Caldwell --- .github/workflows/build-and-release.yml | 2 +- .github/workflows/ci.yml | 26 ++++++++++++++--------- .github/workflows/e2etests.yaml | 2 +- .github/workflows/error-ref-publisher.yml | 2 +- .github/workflows/update-oam-defs.yml | 2 +- build/config.go | 4 ---- go.mod | 4 ++-- go.sum | 8 +++---- internal/config/operations.go | 1 - main.go | 2 -- nginx/error.go | 8 +++---- nginx/install.go | 3 +-- nginx/nginx.go | 2 +- nginx/sample_apps.go | 2 -- 14 files changed, 31 insertions(+), 37 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 8abe7dc..84e7eb5 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -1,4 +1,4 @@ -name: Meshery Adapter for NGINX Build and Releaser +name: Meshery-Nginx SM Build and Release on: push: branches: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4cb3c71..ac23898 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,11 +13,11 @@ jobs: name: Check & Review code runs-on: ubuntu-latest steps: - - name: Check out code - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 with: - fetch-depth: 1 - - name: Run golangci-lint + go-version: 1.19 + - uses: actions/checkout@v3 + - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. @@ -48,12 +48,18 @@ jobs: name: Static check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 1 - - uses: dominikh/staticcheck-action@v1.2.0 - with: - version: "2022.1.1" + - name: Check out code + uses: actions/checkout@v3 + with: + fetch-depth: 1 + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: 1.19 + - uses: dominikh/staticcheck-action@v1.2.0 + with: + install-go: false + version: "2022.1" vet: name: Vet runs-on: ubuntu-latest diff --git a/.github/workflows/e2etests.yaml b/.github/workflows/e2etests.yaml index 987b80f..959a554 100644 --- a/.github/workflows/e2etests.yaml +++ b/.github/workflows/e2etests.yaml @@ -1,4 +1,4 @@ -name: Test Nginx Adapter - control plane and addons +name: E2E Test Nginx SM Adapter - Control Plane and Addons on: push: diff --git a/.github/workflows/error-ref-publisher.yml b/.github/workflows/error-ref-publisher.yml index 988ca81..30f89ab 100644 --- a/.github/workflows/error-ref-publisher.yml +++ b/.github/workflows/error-ref-publisher.yml @@ -60,5 +60,5 @@ jobs: commit_user_email: ci@layer5.io commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> commit_options: '--signoff' - commit_message: '[Docs] Error Code Reference: Meshery Adapter for OSM updated' + commit_message: '[Docs] Error Code Reference: Meshery Adapter for NGINX Service Mesh updated' file_pattern: docs/ \ No newline at end of file diff --git a/.github/workflows/update-oam-defs.yml b/.github/workflows/update-oam-defs.yml index 57823b8..197b0a1 100644 --- a/.github/workflows/update-oam-defs.yml +++ b/.github/workflows/update-oam-defs.yml @@ -40,5 +40,5 @@ jobs: commit_user_email: ci@layer5.io commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> commit_options: "--signoff" - commit_message: "[Patterns] Pattern components generated from latest Kuma Helm chart" + commit_message: "[Patterns] Pattern components generated from latest Nginx Service Mesh Helm chart" branch: master \ No newline at end of file diff --git a/build/config.go b/build/config.go index 1b6dd47..afd7a70 100644 --- a/build/config.go +++ b/build/config.go @@ -37,10 +37,6 @@ func NewConfig(version string) manifests.Config { SpecPath: "spec.versions[0].schema.openAPIV3Schema.properties.spec"}, false), ExtractCrds: func(manifest string) []string { crds := strings.Split(manifest, "---") - // trim the spaces - for _, crd := range crds { - crd = strings.TrimSpace(crd) - } return crds }, } diff --git a/go.mod b/go.mod index 0e9d1da..ffcce0c 100644 --- a/go.mod +++ b/go.mod @@ -12,10 +12,10 @@ replace ( require ( github.com/google/uuid v1.3.0 github.com/layer5io/meshery-adapter-library v0.5.10 - github.com/layer5io/meshkit v0.6.0 + github.com/layer5io/meshkit v0.6.2 github.com/layer5io/service-mesh-performance v0.3.4 gopkg.in/yaml.v2 v2.4.0 - k8s.io/apimachinery v0.25.1 + k8s.io/apimachinery v0.25.2 ) require ( diff --git a/go.sum b/go.sum index ec8189d..2ab1691 100644 --- a/go.sum +++ b/go.sum @@ -577,8 +577,8 @@ github.com/layer5io/learn-layer5/smi-conformance v0.0.0-20210317075357-06b4f88b3 github.com/layer5io/learn-layer5/smi-conformance v0.0.0-20210317075357-06b4f88b3e34/go.mod h1:BQPLwdJt7v7y0fXIejI4whR9zMyX07Wjt5xrbgEmHLw= github.com/layer5io/meshery-adapter-library v0.5.10 h1:Qgr6vDx2s10mkhtk7Mnz5I73m/9yf2yyjCkPMeB4jmA= github.com/layer5io/meshery-adapter-library v0.5.10/go.mod h1:Sg6WNN82uRo2kiFDEMc/LM/AJ/Pu6ZmBZGbFxZuC7zc= -github.com/layer5io/meshkit v0.6.0 h1:gDMG5k43WpaM5YgVTZFCz0zH8tmtw27z5/eiuFx5jeo= -github.com/layer5io/meshkit v0.6.0/go.mod h1:1yyleAJTOzSzTA44u3cg764Yk0+pvCUwb/KikLkjea8= +github.com/layer5io/meshkit v0.6.2 h1:QUDIuem9XN8atTfoBokuHbHyRpfpycZs6+iwbccRDlE= +github.com/layer5io/meshkit v0.6.2/go.mod h1:RRrfwtykKlT6sbAnfoXq3Fib70YQpCCAxrc9/2dhnLw= github.com/layer5io/service-mesh-performance v0.3.2-0.20210122142912-a94e0658b021/go.mod h1:W153amv8aHAeIWxO7b7d7Vibt9RhaEVh4Uh+RG+BumQ= github.com/layer5io/service-mesh-performance v0.3.4 h1:aw/elsx0wkry7SyiQRIj31wW7TPCP4YfhINdNOLXVg8= github.com/layer5io/service-mesh-performance v0.3.4/go.mod h1:W153amv8aHAeIWxO7b7d7Vibt9RhaEVh4Uh+RG+BumQ= @@ -1478,8 +1478,8 @@ k8s.io/apiextensions-apiserver v0.25.1/go.mod h1:67sgnMs2yIO2iV4DpCdS91vlP+pdnVI k8s.io/apimachinery v0.17.0/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg= k8s.io/apimachinery v0.17.2/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg= k8s.io/apimachinery v0.17.3/go.mod h1:gxLnyZcGNdZTCLnq3fgzyg2A5BVCHTNDFrw8AmuJ+0g= -k8s.io/apimachinery v0.25.1 h1:t0XrnmCEHVgJlR2arwO8Awp9ylluDic706WePaYCBTI= -k8s.io/apimachinery v0.25.1/go.mod h1:hqqA1X0bsgsxI6dXsJ4HnNTBOmJNxyPp8dw3u2fSHwA= +k8s.io/apimachinery v0.25.2 h1:WbxfAjCx+AeN8Ilp9joWnyJ6xu9OMeS/fsfjK/5zaQs= +k8s.io/apimachinery v0.25.2/go.mod h1:hqqA1X0bsgsxI6dXsJ4HnNTBOmJNxyPp8dw3u2fSHwA= k8s.io/apiserver v0.17.0/go.mod h1:ABM+9x/prjINN6iiffRVNCBR2Wk7uY4z+EtEGZD48cg= k8s.io/apiserver v0.17.2/go.mod h1:lBmw/TtQdtxvrTk0e2cgtOxHizXI+d0mmGQURIHQZlo= k8s.io/apiserver v0.25.1 h1:A3gnoQL6lhqRiwWN6f2DGBGdCb+7brCSTrW3klR9Xwc= diff --git a/internal/config/operations.go b/internal/config/operations.go index 9924b9d..db77064 100644 --- a/internal/config/operations.go +++ b/internal/config/operations.go @@ -6,7 +6,6 @@ import ( ) func getOperations(dev adapter.Operations) adapter.Operations { - versions, _ := getLatestReleaseNames(3) dev[NginxOperation] = &adapter.Operation{ diff --git a/main.go b/main.go index 3e4ac70..6042a03 100644 --- a/main.go +++ b/main.go @@ -38,7 +38,6 @@ func init() { // main is the entrypoint of the adaptor func main() { - // Initialize Logger instance log, err := logger.New(serviceName, logger.Options{ Format: logger.SyslogLogFormat, @@ -153,7 +152,6 @@ func registerDynamicCapabilities(port string, log logger.Handler) { <-ticker.C registerWorkloads(port, log) } - } func registerWorkloads(port string, log logger.Handler) { diff --git a/nginx/error.go b/nginx/error.go index 49d77c2..051e6aa 100644 --- a/nginx/error.go +++ b/nginx/error.go @@ -52,13 +52,12 @@ var ( // ErrParseOAMConfig represents the error which is // generated during the OAM configuration parsing - ErrParseOAMConfig = errors.New(ErrParseOAMConfigCode, errors.Alert, []string{"error parsing the configuration"}, []string{"Error occured while parsing configuration in the request made by Meshery Server"}, []string{"Could not unmarshall OAM config recieved via ProcessOAM gRPC call into a valid Config struct"}, []string{"Check if Meshery Server is creating valid config for ProcessOAM gRPC call. This error should never happen and can be reported as a bug in Meshery Server. Also, confirm that Meshery Server and Adapters are referring to same config struct provided in MeshKit"}) + ErrParseOAMConfig = errors.New(ErrParseOAMConfigCode, errors.Alert, []string{"error parsing the configuration"}, []string{"Error occurred while parsing configuration in the request made by Meshery Server"}, []string{"Could not unmarshall OAM config received via ProcessOAM gRPC call into a valid Config struct"}, []string{"Check if Meshery Server is creating valid config for ProcessOAM gRPC call. This error should never happen and can be reported as a bug in Meshery Server. Also, confirm that Meshery Server and Adapters are referring to same config struct provided in MeshKit"}) ) // ErrInstallNginx is the error for install mesh func ErrInstallNginx(err error) error { return errors.New(ErrInstallNginxCode, errors.Alert, []string{"Error with Nginx installation"}, []string{err.Error()}, []string{}, []string{}) - } // ErrMeshConfig is the error for mesh config @@ -88,7 +87,7 @@ func ErrCustomOperation(err error) error { // ErrApplyHelmChart is the occurend while applying helm chart func ErrApplyHelmChart(err error) error { - return errors.New(ErrApplyHelmChartCode, errors.Alert, []string{"Error occured while applying Helm Chart"}, []string{err.Error()}, []string{}, []string{}) + return errors.New(ErrApplyHelmChartCode, errors.Alert, []string{"Error occurred while applying Helm Chart"}, []string{err.Error()}, []string{}, []string{}) } // ErrProcessOAM is a generic error which is thrown when an OAM operations fails @@ -108,6 +107,5 @@ func ErrParseNginxCoreComponent(err error) error { // ErrLoadNamespace is the occurend while applying namespace func ErrLoadNamespace(err error) error { - return errors.New(ErrLoadNamespaceCode, errors.Alert, []string{"Error occured while applying namespace "}, []string{err.Error()}, []string{"Trying to access a namespace which is not available"}, []string{"Verify presence of namespace. Confirm Meshery ServiceAccount permissions"}) - + return errors.New(ErrLoadNamespaceCode, errors.Alert, []string{"Error occurred while applying namespace "}, []string{err.Error()}, []string{"Trying to access a namespace which is not available"}, []string{"Verify presence of namespace. Confirm Meshery ServiceAccount permissions"}) } diff --git a/nginx/install.go b/nginx/install.go index c740df7..143bf7f 100644 --- a/nginx/install.go +++ b/nginx/install.go @@ -73,7 +73,7 @@ func (nginx *Nginx) applyHelmChart(del bool, version, namespace string, kubeconf } // Set deployment override flag to disable automatic sidecar injection in the meshery namespace. - // This is to prevent Meshery from having connectivy issues with other meshes or non-meshed services. + // This is to prevent Meshery from having connectivity issues with other meshes or non-meshed services. // This is equal to using the Helm flag: --set autoInjection.disabledNamespaces={"meshery"} overrideVal := map[string]interface{}{ "autoInjection": map[string]interface{}{ @@ -160,7 +160,6 @@ func (nginx *Nginx) applyManifest(manifest []byte, isDel bool, namespace string, errMx.Unlock() return } - }(config) } diff --git a/nginx/nginx.go b/nginx/nginx.go index dfa1d31..31063c1 100644 --- a/nginx/nginx.go +++ b/nginx/nginx.go @@ -79,7 +79,7 @@ func (nginx *Nginx) ApplyOperation(ctx context.Context, opReq adapter.OperationR operation = "removed" } if err != nil { - summary := fmt.Sprintf("Error while labelling %s", opReq.Namespace) + summary := fmt.Sprintf("Error while labeling %s", opReq.Namespace) hh.streamErr(summary, ee, err) return } diff --git a/nginx/sample_apps.go b/nginx/sample_apps.go index 4b0f83f..6ad8202 100644 --- a/nginx/sample_apps.go +++ b/nginx/sample_apps.go @@ -113,7 +113,6 @@ func (nginx *Nginx) LoadToMesh(namespace string, service string, remove bool, ku errMx.Unlock() return } - }(config) } @@ -168,7 +167,6 @@ func (nginx *Nginx) LoadNamespaceToMesh(namespace string, remove bool, kubeconfi errMx.Unlock() return } - }(config) }