Fix fission check command doesnt work for namespace other than fission (#2932)

* Fix `fission check` command which does not work outside of `fission` namespace

If user provide namespace then use it for running `fission check` command.
If user does not provide namespace then use `fission` as default namespace.

* Update go version to 1.22.2

---------

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
This commit is contained in:
soharab-ic
2024-05-07 11:18:22 +05:30
committed by GitHub
parent 63864a91f2
commit 241983d2f7
5 changed files with 26 additions and 9 deletions
+8 -1
View File
@@ -14,6 +14,8 @@ limitations under the License.
package check
import (
"fmt"
"github.com/fission/fission/pkg/fission-cli/cliwrapper/cli"
"github.com/fission/fission/pkg/fission-cli/cmd"
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
@@ -32,13 +34,18 @@ func (opts *CheckSubCommand) do(input cli.Input) error {
checks := []healthcheck.CategoryID{}
userProvidedNS, _, err := opts.GetResourceNamespace(input, flagkey.Namespace)
if err != nil {
return fmt.Errorf("error retrieving user provided namespace information: %w", err)
}
if input.IsSet(flagkey.PreCheckOnly) {
checks = append(checks, healthcheck.Kubernetes)
} else {
checks = append(checks, healthcheck.FissionServices, healthcheck.FissionVersion)
}
hc := healthcheck.NewHealthChecker(opts.Client(), checks)
hc := healthcheck.NewHealthChecker(opts.Client(), checks, userProvidedNS)
healthcheck.RunChecks(input.Context(), input, opts.Client(), hc)
return nil
+6 -5
View File
@@ -18,11 +18,12 @@ package util
// fission-cli options
const (
SPEC_IGNORE_FILE = ".specignore"
COMMIT_LABEL = "commit"
FISSION_AUTH_URI = "/auth/login"
FISSION_AUTH_TOKEN = "FISSION_AUTH_TOKEN"
FISSION_STORAGE_URI = "/v1/archive"
SPEC_IGNORE_FILE = ".specignore"
COMMIT_LABEL = "commit"
FISSION_AUTH_URI = "/auth/login"
FISSION_AUTH_TOKEN = "FISSION_AUTH_TOKEN"
FISSION_STORAGE_URI = "/v1/archive"
FISSION_DEFAULT_NAMESPACE = "fission"
)
const (