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:
co-authored by
Sanket Sudake
parent
261bf24974
commit
b71a36dc1c
@@ -48,14 +48,12 @@ func (opts *UpdateSubCommand) do(input cli.Input) error {
|
||||
}
|
||||
|
||||
func (opts *UpdateSubCommand) complete(input cli.Input) 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 ")
|
||||
}
|
||||
tt, err := opts.Client().V1().TimeTrigger().Get(&metav1.ObjectMeta{
|
||||
Name: input.String(flagkey.TtName),
|
||||
Namespace: namespace,
|
||||
})
|
||||
|
||||
tt, err := opts.Client().FissionClientSet.CoreV1().TimeTriggers(namespace).Get(input.Context(), input.String(flagkey.TtName), metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error getting time trigger")
|
||||
}
|
||||
@@ -70,7 +68,7 @@ func (opts *UpdateSubCommand) complete(input cli.Input) error {
|
||||
fnName := input.String("function")
|
||||
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())
|
||||
}
|
||||
@@ -88,14 +86,14 @@ func (opts *UpdateSubCommand) complete(input cli.Input) error {
|
||||
}
|
||||
|
||||
func (opts *UpdateSubCommand) run(input cli.Input) error {
|
||||
_, err := opts.Client().V1().TimeTrigger().Update(opts.trigger)
|
||||
_, err := opts.Client().FissionClientSet.CoreV1().TimeTriggers(opts.trigger.ObjectMeta.Namespace).Update(input.Context(), opts.trigger, metav1.UpdateOptions{})
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error updating Time trigger")
|
||||
}
|
||||
|
||||
fmt.Printf("trigger '%v' updated\n", opts.trigger.ObjectMeta.Name)
|
||||
|
||||
t, err := getAPITimeInfo(opts.Client())
|
||||
t := util.GetServerInfo(input, opts.Client()).ServerTime.CurrentTime.UTC()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user