Skip to content

Commit 6e26edd

Browse files
committed
Support namespaces for ready command
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
1 parent 531ba82 commit 6e26edd

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

commands/ready.go

+13-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
func init() {
2020
// Setup flags that are used by multiple commands (variables defined in faas.go)
2121
readyCmd.Flags().StringVarP(&gateway, "gateway", "g", defaultGateway, "Gateway URL starting with http(s)://")
22-
22+
readyCmd.Flags().StringVarP(&functionNamespace, "namespace", "n", "", "Namespace of the function")
2323
readyCmd.Flags().BoolVar(&tlsInsecure, "tls-no-verify", false, "Disable TLS validation")
2424

2525
readyCmd.Flags().Int("attempts", 60, "Number of attempts to check the gateway")
@@ -36,7 +36,12 @@ var readyCmd = &cobra.Command{
3636
3737
# Block until the env function is ready
3838
faas-cli store deploy env && \
39-
faas-cli ready env`,
39+
faas-cli ready env
40+
41+
# Block until the env function is ready in staging-fn namespace
42+
faas-cli store deploy env --namespace staging-fn && \
43+
faas-cli ready env --namespace staging-fn
44+
`,
4045
RunE: runReadyCmd,
4146
}
4247

@@ -125,7 +130,12 @@ func runReadyCmd(cmd *cobra.Command, args []string) error {
125130
ctx := context.Background()
126131

127132
for i := 0; i < attempts; i++ {
128-
fmt.Printf("[%d/%d] Waiting for function %s\n", i+1, attempts, functionName)
133+
suffix := ""
134+
if len(functionNamespace) > 0 {
135+
suffix = "." + functionNamespace
136+
}
137+
138+
fmt.Printf("[%d/%d] Waiting for function %s%s\n", i+1, attempts, functionName, suffix)
129139

130140
function, err := cliClient.GetFunctionInfo(ctx, functionName, functionNamespace)
131141
if err != nil {

0 commit comments

Comments
 (0)