Skip to content

Commit ce0af7c

Browse files
Fix examples and print preview feature warnings (#927)
* Fix examples and print preview feature warnings Signed-off-by: Mukundan Sundararajan <[email protected]> * small changes to wordings Signed-off-by: Mukundan Sundararajan <[email protected]>
1 parent 9fa0cdf commit ce0af7c

File tree

7 files changed

+43
-48
lines changed

7 files changed

+43
-48
lines changed

README.md

+14-18
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,13 @@ This can be used when upgrading to a newer version of Dapr, as it's recommended
442442
To list all Dapr components on Kubernetes:
443443

444444
```bash
445-
dapr components --kubernetes
445+
dapr components --kubernetes --all-namespaces
446+
```
447+
448+
To list Dapr components in `target-namespace` namespace on Kubernetes:
449+
450+
```bash
451+
dapr components --kubernetes --namespace target-namespace
446452
```
447453

448454
### Use non-default Components Path
@@ -459,7 +465,13 @@ dapr run --components-path [custom path]
459465
To list all Dapr configurations on Kubernetes:
460466

461467
```bash
462-
dapr configurations --kubernetes
468+
dapr configurations --kubernetes --all-namespaces
469+
```
470+
471+
To list Dapr configurations in `target-namespace` namespace on Kubernetes:
472+
473+
```bash
474+
dapr configurations --kubernetes --namespace target-namespace
463475
```
464476

465477
### Stop
@@ -555,22 +567,6 @@ If you want to invoke your app, also use this flag:
555567
$ dapr invoke --app-id nodeapp --unix-domain-socket --method mymethod
556568
```
557569

558-
### Enable Unix domain socket
559-
560-
In order to enable Unix domain socket to connect Dapr API server, use the `--unix-domain-socket` flag:
561-
562-
```
563-
$ dapr run --app-id nodeapp --unix-domain-socket node app.js
564-
```
565-
566-
Dapr will automatically create a Unix domain socket to connect Dapr API server.
567-
568-
If you want to invoke your app, also use this flag:
569-
570-
```
571-
$ dapr invoke --app-id nodeapp --unix-domain-socket --method mymethod
572-
```
573-
574570
For more details, please run the command and check the examples to apply to your shell.
575571

576572
## Reference for the Dapr CLI

cmd/components.go

+5-9
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,11 @@ var ComponentsCmd = &cobra.Command{
3434
Short: "List all Dapr components. Supported platforms: Kubernetes",
3535
Run: func(cmd *cobra.Command, args []string) {
3636
if kubernetesMode {
37-
print.WarningStatusEvent(os.Stdout, "In future releases, this command will only query the \"default\" namespace by default. Please use the -n (namespace) flag, for specific namespace, or -A (all-namespaces) flag for all namespaces.")
37+
print.WarningStatusEvent(os.Stdout, "In future releases, this command will only query the \"default\" namespace by default. Please use the --namespace flag for a specific namespace, or the --all-namespaces (-A) flag for all namespaces.")
3838
if allNamespaces {
3939
resourceNamespace = meta_v1.NamespaceAll
4040
} else if resourceNamespace == "" {
4141
resourceNamespace = meta_v1.NamespaceAll
42-
print.WarningStatusEvent(os.Stdout, "From next release(or after 2 releases), behavior can be changed to query only \"default\" namespace.")
43-
}
44-
if componentsName != "" {
45-
print.WarningStatusEvent(os.Stdout, "From next release(or after 2 releases), behavior can be changed to treat it as \"namespace\".")
4642
}
4743
err := kubernetes.PrintComponents(componentsName, resourceNamespace, componentsOutputFormat)
4844
if err != nil {
@@ -55,16 +51,16 @@ var ComponentsCmd = &cobra.Command{
5551
kubernetes.CheckForCertExpiry()
5652
},
5753
Example: `
58-
# List all namespace Dapr components in Kubernetes mode
54+
# List Dapr components in all namespaces in Kubernetes mode
5955
dapr components -k
6056
61-
# List define namespace Dapr components in Kubernetes mode
57+
# List Dapr components in specific namespace in Kubernetes mode
6258
dapr components -k --namespace default
6359
64-
# Print define name Dapr components in Kubernetes mode
60+
# Print specific Dapr component in Kubernetes mode
6561
dapr components -k -n target
6662
67-
# List all namespaces Dapr components in Kubernetes mode
63+
# List Dapr components in all namespaces in Kubernetes mode
6864
dapr components -k --all-namespaces
6965
`,
7066
}

cmd/configurations.go

+5-9
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,11 @@ var ConfigurationsCmd = &cobra.Command{
3434
Short: "List all Dapr configurations. Supported platforms: Kubernetes",
3535
Run: func(cmd *cobra.Command, args []string) {
3636
if kubernetesMode {
37-
print.WarningStatusEvent(os.Stdout, "In future releases, this command will only query the \"default\" namespace by default. Please use the -n (namespace) flag, for specific namespace, or -A (all-namespaces) flag for all namespaces.")
37+
print.WarningStatusEvent(os.Stdout, "In future releases, this command will only query the \"default\" namespace by default. Please use the --namespace flag for a specific namespace, or the --all-namespaces (-A) flag for all namespaces.")
3838
if allNamespaces {
3939
resourceNamespace = meta_v1.NamespaceAll
4040
} else if resourceNamespace == "" {
4141
resourceNamespace = meta_v1.NamespaceAll
42-
print.WarningStatusEvent(os.Stdout, "From next release(or after 2 releases), behavior can be changed to query only \"default\" namespace.")
43-
}
44-
if configurationName != "" {
45-
print.WarningStatusEvent(os.Stdout, "From next release(or after 2 releases), behavior can be changed to treat it as \"namespace\".")
4642
}
4743
err := kubernetes.PrintConfigurations(configurationName, resourceNamespace, configurationOutputFormat)
4844
if err != nil {
@@ -55,16 +51,16 @@ var ConfigurationsCmd = &cobra.Command{
5551
kubernetes.CheckForCertExpiry()
5652
},
5753
Example: `
58-
# List all namespace Dapr configurations in Kubernetes mode
54+
# List Dapr configurations in all namespaces in Kubernetes mode
5955
dapr configurations -k
6056
61-
# List define namespace Dapr configurations in Kubernetes mode
57+
# List Dapr configurations in specific namespace in Kubernetes mode
6258
dapr configurations -k --namespace default
6359
64-
# Print define name Dapr configurations in Kubernetes mode
60+
# Print specific Dapr configuration in Kubernetes mode
6561
dapr configurations -k -n target
6662
67-
# List all namespaces Dapr configurations in Kubernetes mode
63+
# List Dapr configurations in all namespaces in Kubernetes mode
6864
dapr configurations -k --all-namespaces
6965
`,
7066
}

cmd/init.go

+6
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ dapr init -k --runtime-version 0.10.0
7070
# Initialize Dapr in slim self-hosted mode
7171
dapr init -s
7272
73+
# Initialize Dapr from a directory (installer-bundle installation) (Preview feature)
74+
dapr init --from-dir <path-to-directory>
75+
7376
# See more at: https://docs.dapr.io/getting-started/
7477
`,
7578
Run: func(cmd *cobra.Command, args []string) {
@@ -100,6 +103,9 @@ dapr init -s
100103
dockerNetwork = viper.GetString("network")
101104
imageRepositoryURL = viper.GetString("image-repository")
102105
}
106+
if fromDir != "" {
107+
print.WarningStatusEvent(os.Stdout, "Local bundle installation using from-dir flag is currently a preview feature.")
108+
}
103109
err := standalone.Init(runtimeVersion, dashboardVersion, dockerNetwork, slimMode, imageRepositoryURL, fromDir)
104110
if err != nil {
105111
print.FailureStatusEvent(os.Stderr, err.Error())

cmd/list.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ var ListCmd = &cobra.Command{
6161
# List Dapr instances in self-hosted mode
6262
dapr list
6363
64-
# List all namespace Dapr instances in Kubernetes mode
64+
# List Dapr instances in all namespaces in Kubernetes mode
6565
dapr list -k
6666
67-
# List define namespace Dapr instances in Kubernetes mode
67+
# List Dapr instances in a specific namespace in Kubernetes mode
6868
dapr list -k --namespace default
6969
70-
# List all namespaces Dapr instances in Kubernetes mode
70+
# List Dapr instances in all namespaces in Kubernetes mode
7171
dapr list -k --all-namespaces
7272
`,
7373
PreRun: func(cmd *cobra.Command, args []string) {
@@ -78,12 +78,11 @@ dapr list -k --all-namespaces
7878
},
7979
Run: func(cmd *cobra.Command, args []string) {
8080
if kubernetesMode {
81-
print.WarningStatusEvent(os.Stdout, "In future releases, this command will only query the \"default\" namespace by default. Please use the -n (namespace) flag, for specific namespace, or -A (all-namespaces) flag for all namespaces.")
81+
print.WarningStatusEvent(os.Stdout, "In future releases, this command will only query the \"default\" namespace by default. Please use the --namespace flag for a specific namespace, or the --all-namespaces (-A) flag for all namespaces.")
8282
if allNamespaces {
8383
resourceNamespace = meta_v1.NamespaceAll
8484
} else if resourceNamespace == "" {
8585
resourceNamespace = meta_v1.NamespaceAll
86-
print.WarningStatusEvent(os.Stdout, "From next release(or after 2 releases), behavior can be changed to query only \"default\" namespace.")
8786
}
8887

8988
list, err := kubernetes.List(resourceNamespace)

pkg/standalone/standalone.go

+2
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ func Init(runtimeVersion, dashboardVersion string, dockerNetwork string, slimMod
151151
v1, v2 := parseVersionFile(fromDir)
152152
if v1 != "" && v2 != "" {
153153
runtimeVersion, dashboardVersion = v1, v2
154+
} else {
155+
return fmt.Errorf("runtime and dashboard versions cannot be parsed from version file in directory")
154156
}
155157
}
156158

tests/e2e/common/common.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ func componentsTestOnUninstall(all bool) func(t *testing.T) {
533533
lines := strings.Split(output, "\n")
534534

535535
// An extra empty line is there in output.
536-
require.Equal(t, 4, len(lines), "expected header and warning message of the output to remain")
536+
require.Equal(t, 3, len(lines), "expected header and warning message of the output to remain")
537537
}
538538
}
539539

@@ -555,24 +555,24 @@ func componentOutputCheck(t *testing.T, output string, all bool) {
555555
}
556556

557557
if all {
558-
assert.Equal(t, len(lines), 3, "expected at 0 components and 3 message items")
558+
assert.Equal(t, 2, len(lines), "expected at 0 components and 2 output lines")
559559
return
560560
}
561561

562-
lines = strings.Split(output, "\n")[3:] // remove header and warning message.
562+
lines = strings.Split(output, "\n")[2:] // remove header and warning message.
563563

564-
assert.Equal(t, len(lines), 2, "expect at 2 componets") // default and test namespace components.
564+
assert.Equal(t, 2, len(lines), "expected 2 componets") // default and test namespace components.
565565

566566
// for fresh cluster only one component yaml has been applied.
567567
testNsFields := strings.Fields(lines[0])
568568
defaultNsFields := strings.Fields(lines[1])
569569

570570
// Fields splits on space, so Created time field might be split again.
571-
defineComponentOutputCheck(t, testNsFields, "test")
572-
defineComponentOutputCheck(t, defaultNsFields, "default")
571+
namespaceComponentOutputCheck(t, testNsFields, "test")
572+
namespaceComponentOutputCheck(t, defaultNsFields, "default")
573573
}
574574

575-
func defineComponentOutputCheck(t *testing.T, fields []string, namespace string) {
575+
func namespaceComponentOutputCheck(t *testing.T, fields []string, namespace string) {
576576
assert.GreaterOrEqual(t, len(fields), 6, "expected at least 6 fields in components output")
577577
assert.Equal(t, namespace, fields[0], "expected name to match")
578578
assert.Equal(t, "statestore", fields[1], "expected name to match")

0 commit comments

Comments
 (0)