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
+4 -4
View File
@@ -20,12 +20,12 @@ import (
"fmt"
"github.com/pkg/errors"
kerrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"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"
"github.com/fission/fission/pkg/fission-cli/util"
)
type DeleteSubCommand struct {
@@ -47,7 +47,7 @@ func (opts *DeleteSubCommand) do(input cli.Input) error {
func (opts *DeleteSubCommand) complete(input cli.Input) (err error) {
_, namespace, err := util.GetResourceNamespace(input, flagkey.NamespaceTrigger)
_, namespace, err := opts.GetResourceNamespace(input, flagkey.NamespaceTrigger)
if err != nil {
return errors.Wrap(err, "error in deleting function ")
}
@@ -60,9 +60,9 @@ func (opts *DeleteSubCommand) complete(input cli.Input) (err error) {
}
func (opts *DeleteSubCommand) run(input cli.Input) error {
err := opts.Client().V1().MessageQueueTrigger().Delete(opts.metadata)
err := opts.Client().FissionClientSet.CoreV1().MessageQueueTriggers(opts.metadata.Namespace).Delete(input.Context(), opts.metadata.Name, metav1.DeleteOptions{})
if err != nil {
if input.Bool(flagkey.IgnoreNotFound) && util.IsNotFound(err) {
if input.Bool(flagkey.IgnoreNotFound) && kerrors.IsNotFound(err) {
return nil
}
return errors.Wrap(err, "error deleting message queue trigger")