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
+3 -7
View File
@@ -37,16 +37,12 @@ func Delete(input cli.Input) error {
}
func (opts *DeleteSubCommand) run(input cli.Input) (err error) {
_, namespace, err := util.GetResourceNamespace(input, flagkey.NamespaceCanary)
_, namespace, err := opts.GetResourceNamespace(input, flagkey.NamespaceCanary)
if err != nil {
return errors.Wrap(err, "error in deleting canaryConfig ")
}
m := &metav1.ObjectMeta{
Name: input.String(flagkey.CanaryName),
Namespace: namespace,
}
err = opts.Client().V1().CanaryConfig().Delete(m)
err = opts.Client().FissionClientSet.CoreV1().CanaryConfigs(namespace).Delete(input.Context(), input.String(flagkey.CanaryName), metav1.DeleteOptions{})
if err != nil {
if input.Bool(flagkey.IgnoreNotFound) && util.IsNotFound(err) {
return nil
@@ -54,6 +50,6 @@ func (opts *DeleteSubCommand) run(input cli.Input) (err error) {
return errors.Wrap(err, "error deleting canary config")
}
fmt.Printf("canaryconfig '%v.%v' deleted\n", m.Name, m.Namespace)
fmt.Printf("canaryconfig '%v.%v' deleted\n", input.String(flagkey.CanaryName), namespace)
return nil
}