knative-extensions/kperf

Error: no namespace found with prefix test

gyohuangxin opened this issue · 6 comments

If the specified namespaces does not exist, an error is reported as Error: no namespace found with prefix test.

$ kperf service generate -n 10 -b 2 -c 5 -i 5 --nsPrefix test --nsRange 1,3 --svcPrefix ktest --maxScale 1 --minScale 1
nsRangeMap: map[test-1:%!s(bool=true) test-2:%!s(bool=true) test-3:%!s(bool=true)]
DEBUG nsRangeMap: default
DEBUG nsRangeMap: ibm-cert-store
DEBUG nsRangeMap: ibm-operators
DEBUG nsRangeMap: ibm-system
DEBUG nsRangeMap: istio-system
DEBUG nsRangeMap: knative-eventing
DEBUG nsRangeMap: knative-serving
DEBUG nsRangeMap: ktest
DEBUG nsRangeMap: kube-node-lease
DEBUG nsRangeMap: kube-public
DEBUG nsRangeMap: kube-system
nsNameList: []

Error: no namespace found with prefix test

Could we make the namespaces created automatically if the specified namespaces don't exist? Does that make sense to you? @zhanggbj

@gyohuangxin Thanks for opening this!
Totally make sense to me. We used to have another step to create customized k8s namespaces internally. For kperf, we should create k8s namespace if not exist.

/assign @zhanggbj

aslom commented

What should be names of namespaces created? Also no verbise flag for kperf service generate?

I was not able to do it:

aslom@m:~/Documents/awsm/go/src/knative.dev/kperf|master⚡ ⇒  ./kperf service generate -n 30 -b 10 -c 5 -i 15 --nsPrefix test --nsRange 1,3 --svcPrefix ktest --maxScale 1 --minScale 1
Error: no namespace found with prefix test
Usage:
  kperf service generate [flags]

Flags:
  -b, --batch int          Number of ksvc each time to be created
  -c, --concurrency int    Number of multiple ksvcs to make at a time (default 10)
  -h, --help               help for generate
  -i, --interval int       Interval for each batch generation
      --maxScale int       For autoscaling.knative.dev/minScale
      --minScale int       For autoscaling.knative.dev/minScale
      --ns string          Namespace name. The ksvc will be created in the namespace
  -p, --nsPrefix string    Namespace prefix. The ksvc will be created in the namespaces with the prefix
      --nsRange string
  -n, --number int         Total number of ksvc to be created
      --svcPrefix string   ksvc name prefix. The ksvcs will be svcPrefix1,svcPrefix2,svcPrefix3...... (default "testksvc")
      --timeout duration   duration to wait for previous ksvc to be ready (default 10m0s)
      --wait               whether wait the previous ksvc to be ready

2020/11/17 09:21:37 failed to execute kperf command: no namespace found with prefix test

aslom@m:~/Documents/awsm/go/src/knative.dev/kperf|master⚡ ⇒ k create ns test
namespace/test created
aslom@m:~/Documents/awsm/go/src/knative.dev/kperf|master⚡ ⇒  ./kperf service generate -n 30 -b 10 -c 5 -i 15 --nsPrefix test --nsRange 1,3 --svcPrefix ktest --maxScale 1 --minScale 1
Error: no namespace found with prefix test
Usage:
  kperf service generate [flags]

Flags:
  -b, --batch int          Number of ksvc each time to be created
  -c, --concurrency int    Number of multiple ksvcs to make at a time (default 10)
  -h, --help               help for generate
  -i, --interval int       Interval for each batch generation
      --maxScale int       For autoscaling.knative.dev/minScale
      --minScale int       For autoscaling.knative.dev/minScale
      --ns string          Namespace name. The ksvc will be created in the namespace
  -p, --nsPrefix string    Namespace prefix. The ksvc will be created in the namespaces with the prefix
      --nsRange string
  -n, --number int         Total number of ksvc to be created
      --svcPrefix string   ksvc name prefix. The ksvcs will be svcPrefix1,svcPrefix2,svcPrefix3...... (default "testksvc")
      --timeout duration   duration to wait for previous ksvc to be ready (default 10m0s)
      --wait               whether wait the previous ksvc to be ready

2020/11/17 09:22:03 failed to execute kperf command: no namespace found with prefix test
aslom@m:~/Documents/awsm/go/src/knative.dev/kperf|master⚡ ⇒  k create ns test1
namespace/test1 created
aslom@m:~/Documents/awsm/go/src/knative.dev/kperf|master⚡ ⇒  k create ns test2
namespace/test2 created
aslom@m:~/Documents/awsm/go/src/knative.dev/kperf|master⚡ ⇒  k create ns test3
namespace/test3 created
aslom@m:~/Documents/awsm/go/src/knative.dev/kperf|master⚡ ⇒  ./kperf service generate -n 30 -b 10 -c 5 -i 15 --nsPrefix test --nsRange 1,3 --svcPrefix ktest --maxScale 1 --minScale 1
Error: no namespace found with prefix test
Usage:
  kperf service generate [flags]

Flags:
  -b, --batch int          Number of ksvc each time to be created
  -c, --concurrency int    Number of multiple ksvcs to make at a time (default 10)
  -h, --help               help for generate
  -i, --interval int       Interval for each batch generation
      --maxScale int       For autoscaling.knative.dev/minScale
      --minScale int       For autoscaling.knative.dev/minScale
      --ns string          Namespace name. The ksvc will be created in the namespace
  -p, --nsPrefix string    Namespace prefix. The ksvc will be created in the namespaces with the prefix
      --nsRange string
  -n, --number int         Total number of ksvc to be created
      --svcPrefix string   ksvc name prefix. The ksvcs will be svcPrefix1,svcPrefix2,svcPrefix3...... (default "testksvc")
      --timeout duration   duration to wait for previous ksvc to be ready (default 10m0s)
      --wait               whether wait the previous ksvc to be ready

2020/11/17 09:22:17 failed to execute kperf command: no namespace found with prefix test
aslom@m:~/Documents/awsm/go/src/knative.dev/kperf|master⚡ ⇒  ./kperf service generate -n 30 -b 10 -c 5 -i 15 --nsPrefix test --nsRange 1,3 --svcPrefix ktest --maxScale 1 --minScale 1 --verbose
Error: unknown flag: --verbose
Usage:
  kperf service generate [flags]

Flags:
  -b, --batch int          Number of ksvc each time to be created
  -c, --concurrency int    Number of multiple ksvcs to make at a time (default 10)
  -h, --help               help for generate
  -i, --interval int       Interval for each batch generation
      --maxScale int       For autoscaling.knative.dev/minScale
      --minScale int       For autoscaling.knative.dev/minScale
      --ns string          Namespace name. The ksvc will be created in the namespace
  -p, --nsPrefix string    Namespace prefix. The ksvc will be created in the namespaces with the prefix
      --nsRange string
  -n, --number int         Total number of ksvc to be created
      --svcPrefix string   ksvc name prefix. The ksvcs will be svcPrefix1,svcPrefix2,svcPrefix3...... (default "testksvc")
      --timeout duration   duration to wait for previous ksvc to be ready (default 10m0s)
      --wait               whether wait the previous ksvc to be ready

2020/11/17 09:22:36 failed to execute kperf command: unknown flag: --verbose
aslom commented

The root cause the error I was getting seems to be that KUBECONFIG is not set - better error diagnostic and add verbose?

Hi @aslom, thanks for your feedback, here're more details from our side to resolve the issues as above.

  • Adding --verbose flag to expose more info, tracking by #17 , this will be a saperate PR to cover all not only namespace staff

  • About namespace, perf support two scenarios

  1. generate all knative services in 1 namespace, specified by --ns
    2.generate all knative services in distributed namespace, specified by --nsPrefix & nsRange

After a second thought, I think it's better for users to handle the k8s namespace lifecycle and kperf will only use it and report error if namespace doesn't exit.

In addition, for OpenShift users or IBM Code Engine users, they only have limited authentication for K8s namespace, so in this case, kperf will use the current namespace in context if no --ns or --nsPrefix & nsRange is specified.

aslom commented

Sounds good.