Use Kubernetes Client instead of Controller APIs from CLI (#2605)

Use the Kubernetes and Fission Client from CLI instead of Controller API.
This removes port-forwarding for the controller across Fission CLI mostly.

* Use configurable client in CLI
* Move resource namespace under cmd client
* use server to get fission version
* get archive with URL

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
neha_gupta
2022-11-07 21:42:39 +05:30
committed by GitHub
co-authored by Sanket Sudake
parent 261bf24974
commit b71a36dc1c
86 changed files with 1115 additions and 978 deletions
+6 -6
View File
@@ -27,7 +27,6 @@ import (
"github.com/fission/fission/pkg/fission-cli/cmd"
pkgutil "github.com/fission/fission/pkg/fission-cli/cmd/package/util"
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
"github.com/fission/fission/pkg/fission-cli/util"
)
type InfoSubCommand struct {
@@ -51,7 +50,7 @@ func (opts *InfoSubCommand) do(input cli.Input) error {
func (opts *InfoSubCommand) complete(input cli.Input) (err error) {
opts.name = input.String(flagkey.PkgName)
_, opts.namespace, err = util.GetResourceNamespace(input, flagkey.NamespacePackage)
_, opts.namespace, err = opts.GetResourceNamespace(input, flagkey.NamespacePackage)
if err != nil {
return fv1.AggregateValidationErrors("Environment", err)
}
@@ -59,10 +58,11 @@ func (opts *InfoSubCommand) complete(input cli.Input) (err error) {
}
func (opts *InfoSubCommand) run(input cli.Input) error {
pkg, err := opts.Client().V1().Package().Get(&metav1.ObjectMeta{
Namespace: opts.namespace,
Name: opts.name,
})
pkg, err := opts.Client().FissionClientSet.CoreV1().Packages(opts.namespace).Get(input.Context(), opts.name, metav1.GetOptions{})
if err != nil {
return err
}
if err != nil {
return errors.Wrapf(err, "error finding package %s", opts.name)
}