Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing operator lifecycle in system stop #2877

Merged
merged 1 commit into from May 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 0 additions & 13 deletions mesheryctl/internal/cli/root/system/stop.go
Expand Up @@ -29,7 +29,6 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"

meshkitutils "github.com/layer5io/meshkit/utils"
meshkitkube "github.com/layer5io/meshkit/utils/kubernetes"
)

Expand Down Expand Up @@ -141,18 +140,6 @@ func stop() error {
return err
}

operatorURL := utils.OperatorURL

operatorManifest, err := meshkitutils.ReadFileSource(operatorURL)
if err != nil {
return err
}

err = utils.ApplyManifest([]byte(operatorManifest), client, false, true)
if err != nil {
return err
}

// check if the manifest folder exists on the machine
if _, err := os.Stat(filepath.Join(utils.MesheryFolder, utils.ManifestsFolder)); os.IsNotExist(err) {
log.Errorf("%s folder does not exist.", utils.ManifestsFolder)
Expand Down
2 changes: 0 additions & 2 deletions mesheryctl/pkg/utils/helpers.go
Expand Up @@ -49,8 +49,6 @@ const (
meshUsageURL = docsBaseURL + "guides/mesheryctl/#service-mesh-lifecycle-management"
baseConfigURL = "https://raw.githubusercontent.com/layer5io/meshery-operator/master/config/"
OperatorURL = baseConfigURL + "manifests/default.yaml"
BrokerURL = baseConfigURL + "samples/meshery_v1alpha1_broker.yaml"
MeshsyncURL = baseConfigURL + "samples/meshery_v1alpha1_meshsync.yaml"
)

const (
Expand Down
32 changes: 1 addition & 31 deletions mesheryctl/pkg/utils/platform.go
Expand Up @@ -103,18 +103,6 @@ func DownloadManifests(manifestArr []Manifest, rawManifestsURL string) error {
return errors.Wrapf(err, SystemError(fmt.Sprintf("failed to download %s file from %s operator file", operatorFilepath, MesheryOperator)))
}

brokerFilepath := filepath.Join(MesheryFolder, ManifestsFolder, MesheryOperatorBroker)
err = DownloadFile(brokerFilepath, BrokerURL)
if err != nil {
return errors.Wrapf(err, SystemError(fmt.Sprintf("failed to download %s file from %s operator file", brokerFilepath, MesheryOperatorBroker)))
}

meshsyncFilepath := filepath.Join(MesheryFolder, ManifestsFolder, MesheryOperatorMeshsync)
err = DownloadFile(meshsyncFilepath, MeshsyncURL)
if err != nil {
return errors.Wrapf(err, SystemError(fmt.Sprintf("failed to download %s file from %s operator file", meshsyncFilepath, MesheryOperatorMeshsync)))
}

return nil
}

Expand Down Expand Up @@ -300,7 +288,7 @@ func ApplyManifestFiles(manifestArr []Manifest, requestedAdapters []string, clie
}
}

//applying meshery operator files
//applying meshery operator file
MesheryOperatorManifest, err := meshkitutils.ReadLocalFile(filepath.Join(manifestFiles, MesheryOperator))
if err != nil {
return errors.Wrap(err, "failed to read operator manifest files")
Expand All @@ -310,24 +298,6 @@ func ApplyManifestFiles(manifestArr []Manifest, requestedAdapters []string, clie
return err
}

MesheryBrokerManifest, err := meshkitutils.ReadLocalFile(filepath.Join(manifestFiles, MesheryOperatorBroker))
if err != nil {
return errors.Wrap(err, "failed to read operator manifest files")
}

if err = ApplyManifest([]byte(MesheryBrokerManifest), client, update, delete); err != nil {
return err
}

MesheryMeshsyncManifest, err := meshkitutils.ReadLocalFile(filepath.Join(manifestFiles, MesheryOperatorMeshsync))
if err != nil {
return errors.Wrap(err, "failed to read operator manifest files")
}

if err = ApplyManifest([]byte(MesheryMeshsyncManifest), client, update, delete); err != nil {
return err
}

log.Debug("applied manifests to the Kubernetes cluster.")

return nil
Expand Down