Skip to content

Commit

Permalink
Merge pull request #51 from meshery/DelusionalOptimist/feat/base-install
Browse files Browse the repository at this point in the history
[lifecycle] add appmesh-inject and gateway
  • Loading branch information
leecalcote authored Oct 20, 2021
2 parents 173381f + da6f187 commit 60a9864
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
9 changes: 9 additions & 0 deletions appmesh/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ var (
// components
ErrProcessOAMCode = "replace"

// ErrAddonFromTemplateCode represents the errors which are generated
// during addon deployment process
ErrAddonFromTemplateCode = "replace"

// ErrOpInvalid is an error when an invalid operation is requested
ErrOpInvalid = errors.New(ErrOpInvalidCode, errors.Alert, []string{"Invalid operation"}, []string{}, []string{}, []string{})

Expand Down Expand Up @@ -104,3 +108,8 @@ func ErrAppMeshCoreComponentFail(err error) error {
func ErrProcessOAM(err error) error {
return errors.New(ErrProcessOAMCode, errors.Alert, []string{"error performing OAM operations"}, []string{err.Error()}, []string{}, []string{})
}

// ErrAddonFromTemplate is the error for streaming event
func ErrAddonFromTemplate(err error) error {
return errors.New(ErrAddonFromTemplateCode, errors.Alert, []string{"Error with addon install operation"}, []string{err.Error()}, []string{}, []string{})
}
30 changes: 27 additions & 3 deletions appmesh/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package appmesh

import (
"fmt"
"strconv"
"strings"

"github.com/layer5io/meshery-adapter-library/adapter"
"github.com/layer5io/meshery-adapter-library/status"
Expand All @@ -11,7 +13,9 @@ import (

const (
repo = "https://aws.github.io/eks-charts"
chart = "appmesh-controller"
appMeshController = "appmesh-controller"
appMeshInject = "appmesh-inject"
appMeshGateway = "appmesh-gateway"
)

// Installs APP-MESH service mesh using helm charts.
Expand Down Expand Up @@ -56,10 +60,12 @@ func (appMesh *AppMesh) applyHelmChart(del bool, version, namespace string) erro
} else {
act = mesherykube.INSTALL
}

// Install the controller
err := kClient.ApplyHelmChart(mesherykube.ApplyHelmChartConfig{
ChartLocation: mesherykube.HelmChartLocation{
Repository: repo,
Chart: chart,
Chart: appMeshController,
AppVersion: version,
},
Namespace: namespace,
Expand All @@ -70,7 +76,25 @@ func (appMesh *AppMesh) applyHelmChart(del bool, version, namespace string) erro
return ErrApplyHelmChart(err)
}

return nil
// Install appmesh-injector. Only needed for controller versions older
// than 1.0.0
if controlPlaneVersion, err := strconv.Atoi(strings.TrimPrefix(version, "v")); controlPlaneVersion < 1 && err != nil {
err = kClient.ApplyHelmChart(mesherykube.ApplyHelmChartConfig{
ChartLocation: mesherykube.HelmChartLocation{
Repository: repo,
Chart: appMeshInject,
AppVersion: version,
},
Namespace: namespace,
Action: act,
CreateNamespace: true,
})
if err != nil {
return ErrApplyHelmChart(err)
}
}

return err
}

func (appMesh *AppMesh) applyManifest(manifest []byte, isDel bool, namespace string) error {
Expand Down

0 comments on commit 60a9864

Please sign in to comment.