Fixed standalone config, small refactor (#589)

This commit is contained in:
RoyUP9
2022-01-06 12:04:58 +02:00
committed by GitHub
parent 833d08bb40
commit b88bdb90f6
7 changed files with 33 additions and 19 deletions

View File

@@ -1,7 +1,9 @@
package cmd
import (
"fmt"
"github.com/spf13/cobra"
"github.com/up9inc/mizu/cli/config"
"github.com/up9inc/mizu/cli/telemetry"
)
@@ -13,6 +15,13 @@ var installCmd = &cobra.Command{
runMizuInstall()
return nil
},
PreRunE: func(cmd *cobra.Command, args []string) error {
if config.Config.IsNsRestrictedMode() {
return fmt.Errorf("install is not supported in restricted namespace mode")
}
return nil
},
}
func init() {

View File

@@ -22,10 +22,6 @@ func runMizuInstall() {
return
}
if config.Config.IsNsRestrictedMode() {
logger.Log.Error("install is not supported in restricted namespace mode")
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel() // cancel will be called when this function exits

View File

@@ -125,7 +125,6 @@ func RunMizuTap() {
logger.Log.Infof("Waiting for Mizu Agent to start...")
if state.mizuServiceAccountExists, err = resources.CreateTapMizuResources(ctx, kubernetesProvider, serializedValidationRules, serializedContract, serializedMizuConfig, config.Config.IsNsRestrictedMode(), config.Config.MizuResourcesNamespace, config.Config.AgentImage, getSyncEntriesConfig(), config.Config.Tap.MaxEntriesDBSizeBytes(), config.Config.Tap.ApiServerResources, config.Config.ImagePullPolicy(), config.Config.LogLevel()); err != nil {
logger.Log.Errorf("error %v", err)
var statusError *k8serrors.StatusError
if errors.As(err, &statusError) {
if statusError.ErrStatus.Reason == metav1.StatusReasonAlreadyExists {