diff --git a/Makefile b/Makefile index 3bcc674c1..298c35d2d 100644 --- a/Makefile +++ b/Makefile @@ -174,7 +174,7 @@ e2e-build-run-k8s: build test-e2e-k8s ################################################################################ .PHONY: test-e2e-upgrade test-e2e-upgrade: test-deps - gotestsum --jsonfile $(TEST_OUTPUT_FILE) --format standard-verbose -- -timeout 30m -count=1 -tags=e2e ./tests/e2e/upgrade/... + gotestsum --jsonfile $(TEST_OUTPUT_FILE) --format standard-verbose -- -timeout 40m -count=1 -tags=e2e ./tests/e2e/upgrade/... ################################################################################ # Build, E2E Tests for Kubernetes Upgrade # diff --git a/README.md b/README.md index 27edc7b88..b5670956c 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ Output should look like so: ℹ️ dapr_redis container is running. ℹ️ dapr_zipkin container is running. ℹ️ Use `docker ps` to check running containers. -✅ Success! Dapr is up and running. To get started, go here: https://aka.ms/dapr-getting-started +✅ Success! Dapr is up and running. To get started, go here: https://docs.dapr.io/getting-started ``` > Note: To see that Dapr has been installed successfully, from a command prompt run the `docker ps` command and check that the `daprio/dapr:latest`, `dapr_redis` and `dapr_zipkin` container images are all running. @@ -120,7 +120,7 @@ Output should look like so: ℹ️ daprd binary has been installed to $HOME/.dapr/bin. ℹ️ placement binary has been installed. ℹ️ scheduler binary has been installed. -✅ Success! Dapr is up and running. To get started, go here: https://aka.ms/dapr-getting-started +✅ Success! Dapr is up and running. To get started, go here: https://docs.dapr.io/getting-started ``` >Note: When initializing Dapr with the `--slim` flag only the Dapr runtime, placement, and scheduler service binaries are installed. An empty default components folder is created with no default configuration files. During `dapr run` user should use `--resources-path` (`--components-path` is deprecated and will be removed in future releases) to point to a components directory with custom configurations files or alternatively place these files in the default directory. For Linux/MacOS, the default components directory path is `$HOME/.dapr/components` and for Windows it is `%USERPROFILE%\.dapr\components`. @@ -289,7 +289,7 @@ Output should look like as follows: ℹ️ Note: To install Dapr using Helm, see here: https://docs.dapr.io/getting-started/install-dapr/#install-with-helm-advanced ✅ Deploying the Dapr control plane to your cluster... -✅ Success! Dapr has been installed to namespace dapr-system. To verify, run "dapr status -k" in your terminal. To get started, go here: https://aka.ms/dapr-getting-started +✅ Success! Dapr has been installed to namespace dapr-system. To verify, run "dapr status -k" in your terminal. To get started, go here: https://docs.dapr.io/getting-started ``` #### Supplying Helm values diff --git a/cmd/init.go b/cmd/init.go index 86f785c66..e3b5c0d6e 100644 --- a/cmd/init.go +++ b/cmd/init.go @@ -45,6 +45,7 @@ var ( fromDir string containerRuntime string imageVariant string + schedulerVolume string ) var InitCmd = &cobra.Command{ @@ -146,7 +147,7 @@ dapr init --runtime-path print.FailureStatusEvent(os.Stderr, err.Error()) os.Exit(1) } - print.SuccessStatusEvent(os.Stdout, fmt.Sprintf("Success! Dapr has been installed to namespace %s. To verify, run `dapr status -k' in your terminal. To get started, go here: https://aka.ms/dapr-getting-started", config.Namespace)) + print.SuccessStatusEvent(os.Stdout, fmt.Sprintf("Success! Dapr has been installed to namespace %s. To verify, run `dapr status -k' in your terminal. To get started, go here: https://docs.dapr.io/getting-started", config.Namespace)) } else { dockerNetwork := "" imageRegistryURI := "" @@ -170,12 +171,12 @@ dapr init --runtime-path print.FailureStatusEvent(os.Stdout, "Invalid container runtime. Supported values are docker and podman.") os.Exit(1) } - err := standalone.Init(runtimeVersion, dashboardVersion, dockerNetwork, slimMode, imageRegistryURI, fromDir, containerRuntime, imageVariant, daprRuntimePath) + err := standalone.Init(runtimeVersion, dashboardVersion, dockerNetwork, slimMode, imageRegistryURI, fromDir, containerRuntime, imageVariant, daprRuntimePath, &schedulerVolume) if err != nil { print.FailureStatusEvent(os.Stderr, err.Error()) os.Exit(1) } - print.SuccessStatusEvent(os.Stdout, "Success! Dapr is up and running. To get started, go here: https://aka.ms/dapr-getting-started") + print.SuccessStatusEvent(os.Stdout, "Success! Dapr is up and running. To get started, go here: https://docs.dapr.io/getting-started") } }, } @@ -219,6 +220,7 @@ func init() { InitCmd.Flags().String("network", "", "The Docker network on which to deploy the Dapr runtime") InitCmd.Flags().StringVarP(&fromDir, "from-dir", "", "", "Use Dapr artifacts from local directory for self-hosted installation") InitCmd.Flags().StringVarP(&imageVariant, "image-variant", "", "", "The image variant to use for the Dapr runtime, for example: mariner") + InitCmd.Flags().StringVarP(&schedulerVolume, "scheduler-volume", "", "dapr_scheduler", "Self-hosted only. Specify a volume for the scheduler service data directory.") InitCmd.Flags().BoolP("help", "h", false, "Print this help message") InitCmd.Flags().StringArrayVar(&values, "set", []string{}, "set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") InitCmd.Flags().String("image-registry", "", "Custom/private docker image repository URL") diff --git a/cmd/uninstall.go b/cmd/uninstall.go index b8b672a11..a2c91085b 100644 --- a/cmd/uninstall.go +++ b/cmd/uninstall.go @@ -99,7 +99,7 @@ func init() { UninstallCmd.Flags().BoolVarP(&uninstallKubernetes, "kubernetes", "k", false, "Uninstall Dapr from a Kubernetes cluster") UninstallCmd.Flags().BoolVarP(&uninstallDev, "dev", "", false, "Uninstall Dapr Redis and Zipking installations from Kubernetes cluster") UninstallCmd.Flags().UintVarP(&timeout, "timeout", "", 300, "The timeout for the Kubernetes uninstall") - UninstallCmd.Flags().BoolVar(&uninstallAll, "all", false, "Remove .dapr directory, Redis, Placement, Scheduler, and Zipkin containers on local machine, and CRDs on a Kubernetes cluster") + UninstallCmd.Flags().BoolVar(&uninstallAll, "all", false, "Remove .dapr directory, Redis, Placement, Scheduler (and default volume in self-hosted mode), and Zipkin containers on local machine, and CRDs on a Kubernetes cluster") UninstallCmd.Flags().String("network", "", "The Docker network from which to remove the Dapr runtime") UninstallCmd.Flags().StringVarP(&uninstallNamespace, "namespace", "n", "dapr-system", "The Kubernetes namespace to uninstall Dapr from") UninstallCmd.Flags().BoolP("help", "h", false, "Print this help message") diff --git a/pkg/standalone/common.go b/pkg/standalone/common.go index c47316ac0..5e2ee888e 100644 --- a/pkg/standalone/common.go +++ b/pkg/standalone/common.go @@ -17,7 +17,6 @@ import ( "os" path_filepath "path/filepath" "runtime" - "strconv" "strings" ) @@ -61,16 +60,6 @@ func getDaprBinPath(daprDir string) string { return path_filepath.Join(daprDir, defaultDaprBinDirName) } -// getSchedulerDataPath returns the data path of a given instance -// Receiving instanceID allows multiple instances of scheduler to run locally in the future. -func getSchedulerDataPath(daprDir string, instanceID int) string { - return path_filepath.Join( - daprDir, - defaultSchedulerDirName, - defaultSchedulerDataDirName, - strconv.Itoa(instanceID)) -} - func binaryFilePathWithDir(binaryDir string, binaryFilePrefix string) string { binaryPath := path_filepath.Join(binaryDir, binaryFilePrefix) if runtime.GOOS == daprWindowsOS { diff --git a/pkg/standalone/standalone.go b/pkg/standalone/standalone.go index 775420679..4e122d35b 100644 --- a/pkg/standalone/standalone.go +++ b/pkg/standalone/standalone.go @@ -143,6 +143,7 @@ type initInfo struct { imageRegistryURL string containerRuntime string imageVariant string + schedulerVolume *string } type daprImageInfo struct { @@ -184,7 +185,7 @@ func isSchedulerIncluded(runtimeVersion string) (bool, error) { } // Init installs Dapr on a local machine using the supplied runtimeVersion. -func Init(runtimeVersion, dashboardVersion string, dockerNetwork string, slimMode bool, imageRegistryURL string, fromDir string, containerRuntime string, imageVariant string, daprInstallPath string) error { +func Init(runtimeVersion, dashboardVersion string, dockerNetwork string, slimMode bool, imageRegistryURL string, fromDir string, containerRuntime string, imageVariant string, daprInstallPath string, schedulerVolume *string) error { var err error var bundleDet bundleDetails containerRuntime = strings.TrimSpace(containerRuntime) @@ -305,6 +306,7 @@ func Init(runtimeVersion, dashboardVersion string, dockerNetwork string, slimMod imageRegistryURL: imageRegistryURL, containerRuntime: containerRuntime, imageVariant: imageVariant, + schedulerVolume: schedulerVolume, } for _, step := range initSteps { // Run init on the configurations and containers. @@ -633,15 +635,15 @@ func runSchedulerService(wg *sync.WaitGroup, errorChan chan<- error, info initIn } } - // instanceID is 0 because we run one instance only for now. - schedulerDataDir := getSchedulerDataPath(info.installDir, 0) args := []string{ "run", "--name", schedulerContainerName, "--restart", "always", "-d", "--entrypoint", "./scheduler", - "--volume", fmt.Sprintf("%v:/data-default-dapr-scheduler-server-0", schedulerDataDir), + } + if info.schedulerVolume != nil { + args = append(args, "--volume", *info.schedulerVolume+":/data-default-dapr-scheduler-server-0") } if info.dockerNetwork != "" { diff --git a/pkg/standalone/standalone_test.go b/pkg/standalone/standalone_test.go index 777d42ce2..7f8ae5c0c 100644 --- a/pkg/standalone/standalone_test.go +++ b/pkg/standalone/standalone_test.go @@ -328,7 +328,7 @@ func TestInitLogActualContainerRuntimeName(t *testing.T) { t.Skip("Skipping test as container runtime is available") } - err := Init(latestVersion, latestVersion, "", false, "", "", test.containerRuntime, "", "") + err := Init(latestVersion, latestVersion, "", false, "", "", test.containerRuntime, "", "", nil) assert.NotNil(t, err) assert.Contains(t, err.Error(), test.containerRuntime) }) diff --git a/pkg/standalone/uninstall.go b/pkg/standalone/uninstall.go index 0162cbe43..7eb9fecbc 100644 --- a/pkg/standalone/uninstall.go +++ b/pkg/standalone/uninstall.go @@ -63,6 +63,20 @@ func removeDockerContainer(containerErrs []error, containerName, network, runtim return containerErrs } +func removeSchedulerVolume(containerErrs []error, runtimeCmd string) []error { + print.InfoStatusEvent(os.Stdout, "Removing volume if it exists: dapr_scheduler") + _, err := utils.RunCmdAndWait( + runtimeCmd, "volume", "rm", + "--force", + "dapr_scheduler") + if err != nil { + containerErrs = append( + containerErrs, + fmt.Errorf("could not remove dapr_scheduler volume: %w", err)) + } + return containerErrs +} + func removeDir(dirPath string) error { _, err := os.Stat(dirPath) if os.IsNotExist(err) { @@ -117,6 +131,10 @@ func Uninstall(uninstallAll bool, dockerNetwork string, containerRuntime string, if err != nil { print.WarningStatusEvent(os.Stdout, "WARNING: could not delete dapr dir %s: %s", installDir, err) } + + if containerRuntimeAvailable { + containerErrs = removeSchedulerVolume(containerErrs, runtimeCmd) + } } err = errors.New("uninstall failed")