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 -7
View File
@@ -48,15 +48,12 @@ func (opts *UpdateSubCommand) do(input cli.Input) error {
}
func (opts *UpdateSubCommand) 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 ")
}
mqt, err := opts.Client().V1().MessageQueueTrigger().Get(&metav1.ObjectMeta{
Name: input.String(flagkey.MqtName),
Namespace: namespace,
})
mqt, err := opts.Client().FissionClientSet.CoreV1().MessageQueueTriggers(namespace).Get(input.Context(), input.String(flagkey.MqtName), metav1.GetOptions{})
if err != nil {
return errors.Wrap(err, "error getting message queue trigger")
}
@@ -100,7 +97,7 @@ func (opts *UpdateSubCommand) complete(input cli.Input) (err error) {
}
if len(fnName) > 0 {
functionList := []string{fnName}
err := util.CheckFunctionExistence(opts.Client(), functionList, namespace)
err := util.CheckFunctionExistence(input.Context(), opts.Client(), functionList, namespace)
if err != nil {
console.Warn(err.Error())
}
@@ -151,7 +148,7 @@ func (opts *UpdateSubCommand) complete(input cli.Input) (err error) {
}
func (opts *UpdateSubCommand) run(input cli.Input) error {
_, err := opts.Client().V1().MessageQueueTrigger().Update(opts.trigger)
_, err := opts.Client().FissionClientSet.CoreV1().MessageQueueTriggers(opts.trigger.ObjectMeta.Namespace).Update(input.Context(), opts.trigger, metav1.UpdateOptions{})
if err != nil {
return errors.Wrap(err, "error updating message queue trigger")
}