Add staticcheck fixes (#3221)
* Add staticcheck fixes Signed-off-by: Sanket Sudake <sanketsudake@gmail.com> * update golangci-lint version Signed-off-by: Sanket Sudake <sanketsudake@gmail.com> --------- Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
@@ -75,7 +75,7 @@ func getLoadingRules() (loadingRules *clientcmd.ClientConfigLoadingRules, err er
|
||||
|
||||
if _, err := os.Stat(kubeConfigPath); os.IsNotExist(err) {
|
||||
return nil, errors.New("couldn't find kubeconfig file. " +
|
||||
"Set the KUBECONFIG environment variable to your kubeconfig's path.")
|
||||
"Set the KUBECONFIG environment variable to your kubeconfig's path")
|
||||
}
|
||||
loadingRules.ExplicitPath = kubeConfigPath
|
||||
console.Verbose(2, "Using kubeconfig from %q", kubeConfigPath)
|
||||
|
||||
@@ -49,13 +49,13 @@ func (opts *DeleteSubCommand) do(input cli.Input) (err error) {
|
||||
if !input.Bool(flagkey.EnvForce) {
|
||||
fns, err := opts.Client().FissionClientSet.CoreV1().Functions(metav1.NamespaceAll).List(input.Context(), metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error getting functions wrt environment.: %w", err)
|
||||
return fmt.Errorf("error getting functions wrt environment: %w", err)
|
||||
}
|
||||
|
||||
for _, fn := range fns.Items {
|
||||
if fn.Spec.Environment.Name == envName &&
|
||||
fn.Spec.Environment.Namespace == currentContextNS {
|
||||
return errors.New("Environment is used by at least one function.")
|
||||
return errors.New("environment is used by at least one function")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ func (opts *UpdateSubCommand) run(input cli.Input) error {
|
||||
return fmt.Errorf("error updating environment: %w", err)
|
||||
}
|
||||
|
||||
fmt.Printf("environment '%v' updated\n", enew.ObjectMeta.Name)
|
||||
fmt.Printf("environment '%v' updated\n", enew.Name)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ func updateExistingEnvironmentWithCmd(env *fv1.Environment, input cli.Input) (*f
|
||||
maxcpu := input.Int(flagkey.RuntimeMaxcpu)
|
||||
cpuLimit, err := resource.ParseQuantity(strconv.Itoa(maxcpu) + "m")
|
||||
if err != nil {
|
||||
e = multierror.Append(e, fmt.Errorf("Failed to parse maxcpu: %w", err))
|
||||
e = multierror.Append(e, fmt.Errorf("failed to parse maxcpu: %w", err))
|
||||
}
|
||||
env.Spec.Resources.Limits[v1.ResourceCPU] = cpuLimit
|
||||
}
|
||||
@@ -170,7 +170,7 @@ func updateExistingEnvironmentWithCmd(env *fv1.Environment, input cli.Input) (*f
|
||||
minmem := input.Int(flagkey.RuntimeMinmemory)
|
||||
memRequest, err := resource.ParseQuantity(strconv.Itoa(minmem) + "Mi")
|
||||
if err != nil {
|
||||
e = multierror.Append(e, fmt.Errorf("Failed to parse minmemory: %w", err))
|
||||
e = multierror.Append(e, fmt.Errorf("failed to parse minmemory: %w", err))
|
||||
}
|
||||
env.Spec.Resources.Requests[v1.ResourceMemory] = memRequest
|
||||
}
|
||||
@@ -179,7 +179,7 @@ func updateExistingEnvironmentWithCmd(env *fv1.Environment, input cli.Input) (*f
|
||||
maxmem := input.Int(flagkey.RuntimeMaxmemory)
|
||||
memLimit, err := resource.ParseQuantity(strconv.Itoa(maxmem) + "Mi")
|
||||
if err != nil {
|
||||
e = multierror.Append(e, fmt.Errorf("Failed to parse maxmemory: %w", err))
|
||||
e = multierror.Append(e, fmt.Errorf("failed to parse maxmemory: %w", err))
|
||||
}
|
||||
env.Spec.Resources.Limits[v1.ResourceMemory] = memLimit
|
||||
}
|
||||
@@ -196,7 +196,7 @@ func updateExistingEnvironmentWithCmd(env *fv1.Environment, input cli.Input) (*f
|
||||
if limitCPU.IsZero() && !requestCPU.IsZero() {
|
||||
env.Spec.Resources.Limits[v1.ResourceCPU] = requestCPU
|
||||
} else if limitCPU.Cmp(requestCPU) < 0 {
|
||||
e = multierror.Append(e, fmt.Errorf("MinCPU (%v) cannot be greater than MaxCPU (%v)", requestCPU.String(), limitCPU.String()))
|
||||
e = multierror.Append(e, fmt.Errorf("minCPU (%v) cannot be greater than MaxCPU (%v)", requestCPU.String(), limitCPU.String()))
|
||||
}
|
||||
|
||||
limitMem := env.Spec.Resources.Limits[v1.ResourceMemory]
|
||||
@@ -205,7 +205,7 @@ func updateExistingEnvironmentWithCmd(env *fv1.Environment, input cli.Input) (*f
|
||||
if limitMem.IsZero() && !requestMem.IsZero() {
|
||||
env.Spec.Resources.Limits[v1.ResourceMemory] = requestMem
|
||||
} else if limitMem.Cmp(requestMem) < 0 {
|
||||
e = multierror.Append(e, fmt.Errorf("MinMemory (%v) cannot be greater than MaxMemory (%v)", requestMem.String(), limitMem.String()))
|
||||
e = multierror.Append(e, fmt.Errorf("minMemory (%v) cannot be greater than MaxMemory (%v)", requestMem.String(), limitMem.String()))
|
||||
}
|
||||
|
||||
if e.ErrorOrNil() != nil {
|
||||
|
||||
@@ -342,8 +342,8 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
||||
// generatePackageName => will return package name by appending id in function name and will make sure that package name will never be more than length of 63 characters.
|
||||
func generatePackageName(fnName string, id string) string {
|
||||
var (
|
||||
lenFnName int = len(fnName)
|
||||
lenId int = len(id)
|
||||
lenFnName = len(fnName)
|
||||
lenId = len(id)
|
||||
lastIndexOfChar int
|
||||
)
|
||||
if lenFnName+lenId <= 62 {
|
||||
|
||||
@@ -130,7 +130,7 @@ func (opts *TestSubCommand) do(input cli.Input) error {
|
||||
if len(methods) == 0 {
|
||||
return errors.New("HTTP method not mentioned")
|
||||
} else if len(methods) > 1 {
|
||||
return errors.New("More than one HTTP method not supported")
|
||||
return errors.New("more than one HTTP method not supported")
|
||||
}
|
||||
method, err := httptrigger.GetMethod(methods[0])
|
||||
if err != nil {
|
||||
|
||||
@@ -207,7 +207,7 @@ func (opts *CreateSubCommand) run(input cli.Input) error {
|
||||
// Ensure we don't have a duplicate HTTP route defined (same URL and method)
|
||||
err := util.CheckHTTPTriggerDuplicates(input.Context(), opts.Client(), opts.trigger)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error while creating HTTP Trigger: %w", err)
|
||||
return fmt.Errorf("error while creating HTTP Trigger: %w", err)
|
||||
}
|
||||
|
||||
_, err = opts.Client().FissionClientSet.CoreV1().HTTPTriggers(opts.trigger.Namespace).Create(input.Context(), opts.trigger, metav1.CreateOptions{})
|
||||
|
||||
@@ -94,7 +94,7 @@ func printHtSummary(triggers []fv1.HTTPTrigger) {
|
||||
methods = trigger.Spec.Methods
|
||||
}
|
||||
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\n",
|
||||
trigger.ObjectMeta.Name, methods, trigger.Spec.RelativeURL, function, trigger.Spec.CreateIngress, host, path, trigger.Spec.IngressConfig.TLS, ann, trigger.ObjectMeta.Namespace)
|
||||
trigger.Name, methods, trigger.Spec.RelativeURL, function, trigger.Spec.CreateIngress, host, path, trigger.Spec.IngressConfig.TLS, ann, trigger.ObjectMeta.Namespace)
|
||||
}
|
||||
w.Flush()
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ func (opts *UpdateSubCommand) run(input cli.Input) error {
|
||||
}
|
||||
err := util.CheckHTTPTriggerDuplicates(input.Context(), opts.Client(), opts.trigger)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error while creating HTTP Trigger: %w", err)
|
||||
return fmt.Errorf("error while creating HTTP Trigger: %w", err)
|
||||
}
|
||||
|
||||
_, err = opts.Client().FissionClientSet.CoreV1().HTTPTriggers(opts.trigger.ObjectMeta.Namespace).Update(input.Context(), opts.trigger, metav1.UpdateOptions{})
|
||||
|
||||
@@ -68,7 +68,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
||||
|
||||
mqType := (fv1.MessageQueueType)(input.String(flagkey.MqtMQType))
|
||||
if !validator.IsValidMessageQueue((string)(mqType), mqtKind) {
|
||||
return errors.New("Unsupported message queue type")
|
||||
return errors.New("unsupported message queue type")
|
||||
}
|
||||
|
||||
topic := input.String(flagkey.MqtTopic)
|
||||
@@ -87,7 +87,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
||||
maxRetries := input.Int(flagkey.MqtMaxRetries)
|
||||
|
||||
if maxRetries < 0 {
|
||||
return errors.New("Maximum number of retries must be greater than or equal to 0")
|
||||
return errors.New("maximum number of retries must be greater than or equal to 0")
|
||||
}
|
||||
|
||||
contentType := input.String(flagkey.MqtMsgContentType)
|
||||
@@ -102,22 +102,22 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
||||
|
||||
pollingInterval := int32(input.Int(flagkey.MqtPollingInterval))
|
||||
if pollingInterval < 0 {
|
||||
return errors.New("Polling interval must be greater than or equal to 0")
|
||||
return errors.New("polling interval must be greater than or equal to 0")
|
||||
}
|
||||
|
||||
cooldownPeriod := int32(input.Int(flagkey.MqtCooldownPeriod))
|
||||
if cooldownPeriod < 0 {
|
||||
return errors.New("CooldownPeriod interval is the period to wait after the last trigger reported active before scaling the deployment back to 0, it must be greater than or equal to 0")
|
||||
return errors.New("cooldownPeriod interval is the period to wait after the last trigger reported active before scaling the deployment back to 0, it must be greater than or equal to 0")
|
||||
}
|
||||
|
||||
minReplicaCount := int32(input.Int(flagkey.MqtMinReplicaCount))
|
||||
if minReplicaCount < 0 {
|
||||
return errors.New("MinReplicaCount must be greater than or equal to 0")
|
||||
return errors.New("minReplicaCount must be greater than or equal to 0")
|
||||
}
|
||||
|
||||
maxReplicaCount := int32(input.Int(flagkey.MqtMaxReplicaCount))
|
||||
if maxReplicaCount < 0 {
|
||||
return errors.New("MaxReplicaCount must be greater than or equal to 0")
|
||||
return errors.New("maxReplicaCount must be greater than or equal to 0")
|
||||
}
|
||||
|
||||
metadata := make(map[string]string)
|
||||
|
||||
@@ -143,7 +143,7 @@ func (opts *UpdateSubCommand) complete(input cli.Input) (err error) {
|
||||
}
|
||||
|
||||
if !updated {
|
||||
return errors.New("Nothing changed, see 'help' for more details")
|
||||
return errors.New("nothing changed, see 'help' for more details")
|
||||
}
|
||||
opts.trigger = mqt
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ func (opts *DeleteSubCommand) run(input cli.Input) error {
|
||||
}
|
||||
|
||||
if !opts.force && len(fnList) > 0 {
|
||||
return errors.New("Package is used by at least one function, use -f to force delete")
|
||||
return errors.New("package is used by at least one function, use -f to force delete")
|
||||
}
|
||||
err = deletePackage(input.Context(), opts.Client(), opts.name, opts.namespace)
|
||||
if err != nil {
|
||||
|
||||
@@ -85,12 +85,10 @@ func (opts *GetSubCommand) run(input cli.Input) error {
|
||||
if archive.Type == fv1.ArchiveTypeLiteral {
|
||||
reader = bytes.NewReader(archive.Literal)
|
||||
} else if archive.Type == fv1.ArchiveTypeUrl {
|
||||
|
||||
readCloser, err := pkgutil.DownloadStrorageURL(input.Context(), opts.Client(), archive.URL)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error downloading from storage service url: %s: %w", archive.URL, err)
|
||||
}
|
||||
|
||||
defer readCloser.Close()
|
||||
reader = readCloser
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ func CreateArchive(client cmd.Client, input cli.Input, includeFiles []string, no
|
||||
}
|
||||
|
||||
if !strings.HasPrefix(absPath, rootDir) {
|
||||
errs = multierror.Append(errs, fmt.Errorf("The files (%v) should be put under the same parent directory (%v) of spec directory; otherwise, the archive will be empty when applying spec files", path, rootDir))
|
||||
errs = multierror.Append(errs, fmt.Errorf("the files (%v) should be put under the same parent directory (%v) of spec directory; otherwise, the archive will be empty when applying spec files", path, rootDir))
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ func CreateArchive(client cmd.Client, input cli.Input, includeFiles []string, no
|
||||
}
|
||||
|
||||
if len(files) == 0 {
|
||||
errs = multierror.Append(errs, fmt.Errorf("Error finding any files with path \"%v\"", path))
|
||||
errs = multierror.Append(errs, fmt.Errorf("error finding any files with path \"%v\"", path))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ func (opts *RebuildSubCommand) run(input cli.Input) error {
|
||||
}
|
||||
|
||||
if pkg.Status.BuildStatus != fv1.BuildStatusFailed {
|
||||
return fmt.Errorf("Package %v is not in %v state.",
|
||||
return fmt.Errorf("package %v is not in %v state",
|
||||
pkg.ObjectMeta.Name, fv1.BuildStatusFailed)
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ func (opts *RebuildSubCommand) run(input cli.Input) error {
|
||||
return fmt.Errorf("update package status: %w", err)
|
||||
}
|
||||
|
||||
fmt.Printf("Retrying build for pkg %v. Use \"fission pkg info --name %v\" to view status.\n", pkg.ObjectMeta.Name, pkg.ObjectMeta.Name)
|
||||
fmt.Printf("Retrying build for pkg %v. Use \"fission pkg info --name %v\" to view status\n", pkg.ObjectMeta.Name, pkg.ObjectMeta.Name)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -479,19 +479,19 @@ func applyResources(input cli.Input, fclient cmd.Client, specDir string, fr *Fis
|
||||
|
||||
_, ras, err = applyKubernetesWatchTriggers(input.Context(), fclient, fr, delete, specAllowConflicts)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("KubernetesWatchTrigger apply failed: %w", err)
|
||||
return nil, nil, fmt.Errorf("kubernetesWatchTrigger apply failed: %w", err)
|
||||
}
|
||||
applyStatus["KubernetesWatchTrigger"] = *ras
|
||||
|
||||
_, ras, err = applyTimeTriggers(input.Context(), fclient, fr, delete, specAllowConflicts)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("TimeTrigger apply failed: %w", err)
|
||||
return nil, nil, fmt.Errorf("timeTrigger apply failed: %w", err)
|
||||
}
|
||||
applyStatus["TimeTrigger"] = *ras
|
||||
|
||||
_, ras, err = applyMessageQueueTriggers(input.Context(), fclient, fr, delete, specAllowConflicts)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("MessageQueueTrigger apply failed: %w", err)
|
||||
return nil, nil, fmt.Errorf("messageQueueTrigger apply failed: %w", err)
|
||||
}
|
||||
applyStatus["MessageQueueTrigger"] = *ras
|
||||
|
||||
@@ -525,7 +525,7 @@ func localArchiveFromSpec(ctx context.Context, specDir string, aus *spectypes.Ar
|
||||
console.Verbose(2, "try to find globs in path '%v'", absGlob)
|
||||
fs, err := utils.FindAllGlobs(absGlob)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Invalid glob in archive %v: %v: %w", aus.Name, relativeGlob, err)
|
||||
return nil, fmt.Errorf("invalid glob in archive %v: %v: %w", aus.Name, relativeGlob, err)
|
||||
}
|
||||
files = append(files, fs...)
|
||||
}
|
||||
@@ -747,7 +747,7 @@ func applyPackages(ctx context.Context, fclient cmd.Client, fr *FissionResources
|
||||
return nil, nil, err
|
||||
}
|
||||
ras.Deleted = append(ras.Deleted, &o.ObjectMeta)
|
||||
fmt.Printf("Deleted %v %v\n", o.TypeMeta.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
fmt.Printf("Deleted %v %v\n", o.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -834,7 +834,7 @@ func applyFunctions(ctx context.Context, fclient cmd.Client, fr *FissionResource
|
||||
return nil, nil, err
|
||||
}
|
||||
ras.Deleted = append(ras.Deleted, &o.ObjectMeta)
|
||||
fmt.Printf("Deleted %v %v\n", o.TypeMeta.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
fmt.Printf("Deleted %v %v\n", o.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -921,7 +921,7 @@ func applyEnvironments(ctx context.Context, fclient cmd.Client, fr *FissionResou
|
||||
return nil, nil, err
|
||||
}
|
||||
ras.Deleted = append(ras.Deleted, &o.ObjectMeta)
|
||||
fmt.Printf("Deleted %v %v\n", o.TypeMeta.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
fmt.Printf("Deleted %v %v\n", o.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1018,7 +1018,7 @@ func applyHTTPTriggers(ctx context.Context, fclient cmd.Client, fr *FissionResou
|
||||
return nil, nil, err
|
||||
}
|
||||
ras.Deleted = append(ras.Deleted, &o.ObjectMeta)
|
||||
fmt.Printf("Deleted %v %v\n", o.TypeMeta.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
fmt.Printf("Deleted %v %v\n", o.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1105,7 +1105,7 @@ func applyKubernetesWatchTriggers(ctx context.Context, fclient cmd.Client, fr *F
|
||||
return nil, nil, err
|
||||
}
|
||||
ras.Deleted = append(ras.Deleted, &o.ObjectMeta)
|
||||
fmt.Printf("Deleted %v %v\n", o.TypeMeta.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
fmt.Printf("Deleted %v %v\n", o.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1192,7 +1192,7 @@ func applyTimeTriggers(ctx context.Context, fclient cmd.Client, fr *FissionResou
|
||||
return nil, nil, err
|
||||
}
|
||||
ras.Deleted = append(ras.Deleted, &o.ObjectMeta)
|
||||
fmt.Printf("Deleted %v %v\n", o.TypeMeta.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
fmt.Printf("Deleted %v %v\n", o.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1279,7 +1279,7 @@ func applyMessageQueueTriggers(ctx context.Context, fclient cmd.Client, fr *Fiss
|
||||
return nil, nil, err
|
||||
}
|
||||
ras.Deleted = append(ras.Deleted, &o.ObjectMeta)
|
||||
fmt.Printf("Deleted %v %v\n", o.TypeMeta.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
fmt.Printf("Deleted %v %v\n", o.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,17 +95,17 @@ func forceDeleteResources(ctx context.Context, fclient cmd.Client, fr *FissionRe
|
||||
|
||||
_, _, err = applyKubernetesWatchTriggers(ctx, fclient, fr, true, false)
|
||||
if err != nil {
|
||||
return fmt.Errorf("KubernetesWatchTrigger delete failed: %w", err)
|
||||
return fmt.Errorf("kubernetesWatchTrigger delete failed: %w", err)
|
||||
}
|
||||
|
||||
_, _, err = applyTimeTriggers(ctx, fclient, fr, true, false)
|
||||
if err != nil {
|
||||
return fmt.Errorf("TimeTrigger delete failed: %w", err)
|
||||
return fmt.Errorf("timeTrigger delete failed: %w", err)
|
||||
}
|
||||
|
||||
_, _, err = applyMessageQueueTriggers(ctx, fclient, fr, true, false)
|
||||
if err != nil {
|
||||
return fmt.Errorf("MessageQueueTrigger delete failed: %w", err)
|
||||
return fmt.Errorf("messageQueueTrigger delete failed: %w", err)
|
||||
}
|
||||
|
||||
_, _, err = applyFunctions(ctx, fclient, fr, true, false)
|
||||
@@ -187,17 +187,17 @@ func deleteResources(ctx context.Context, fclient cmd.Client, fr *FissionResourc
|
||||
|
||||
err = destroyKubernetesWatchTriggers(ctx, fclient, fr)
|
||||
if err != nil {
|
||||
return fmt.Errorf("KubernetesWatchTrigger delete failed: %w", err)
|
||||
return fmt.Errorf("kubernetesWatchTrigger delete failed: %w", err)
|
||||
}
|
||||
|
||||
err = destroyTimeTriggers(ctx, fclient, fr)
|
||||
if err != nil {
|
||||
return fmt.Errorf("TimeTrigger delete failed: %w", err)
|
||||
return fmt.Errorf("timeTrigger delete failed: %w", err)
|
||||
}
|
||||
|
||||
err = destroyMessageQueueTriggers(ctx, fclient, fr)
|
||||
if err != nil {
|
||||
return fmt.Errorf("MessageQueueTrigger delete failed: %w", err)
|
||||
return fmt.Errorf("messageQueueTrigger delete failed: %w", err)
|
||||
}
|
||||
|
||||
err = destroyFunctions(ctx, fclient, fr)
|
||||
@@ -229,7 +229,7 @@ func destroyHTTPTriggers(ctx context.Context, fclient cmd.Client, fr *FissionRes
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("Deleted %s %s\n", o.TypeMeta.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
fmt.Printf("Deleted %s %s\n", o.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -246,7 +246,7 @@ func destroyKubernetesWatchTriggers(ctx context.Context, fclient cmd.Client, fr
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("Deleted %s %s\n", o.TypeMeta.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
fmt.Printf("Deleted %s %s\n", o.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -264,7 +264,7 @@ func destroyTimeTriggers(ctx context.Context, fclient cmd.Client, fr *FissionRes
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("Deleted %s %s\n", o.TypeMeta.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
fmt.Printf("Deleted %s %s\n", o.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -282,7 +282,7 @@ func destroyMessageQueueTriggers(ctx context.Context, fclient cmd.Client, fr *Fi
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("Deleted %s %s\n", o.TypeMeta.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
fmt.Printf("Deleted %s %s\n", o.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -300,7 +300,7 @@ func destroyFunctions(ctx context.Context, fclient cmd.Client, fr *FissionResour
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("Deleted %s %s\n", o.TypeMeta.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
fmt.Printf("Deleted %s %s\n", o.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -318,7 +318,7 @@ func destroyPackages(ctx context.Context, fclient cmd.Client, fr *FissionResourc
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("Deleted %s %s\n", o.TypeMeta.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
fmt.Printf("Deleted %s %s\n", o.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -336,7 +336,7 @@ func destroyEnvironments(ctx context.Context, fclient cmd.Client, fr *FissionRes
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("Deleted %s %s\n", o.TypeMeta.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
fmt.Printf("Deleted %s %s\n", o.Kind, k8sCache.MetaObjectToName(&o.ObjectMeta).String())
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -100,7 +100,7 @@ func (opts *InitSubCommand) run(input cli.Input) error {
|
||||
config := filepath.Join(specDir, "fission-deployment-config.yaml")
|
||||
|
||||
if _, err := os.Stat(config); err == nil {
|
||||
return fmt.Errorf("Spec DeploymentConfig already exists in directory '%v'", specDir)
|
||||
return fmt.Errorf("spec DeploymentConfig already exists in directory '%v'", specDir)
|
||||
}
|
||||
|
||||
// Add a bit of documentation to the spec dir here
|
||||
|
||||
@@ -365,7 +365,7 @@ func ShowHTTPTriggers(hts []fv1.HTTPTrigger) {
|
||||
}
|
||||
|
||||
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\n",
|
||||
trigger.ObjectMeta.Name, methods, trigger.Spec.RelativeURL, function, trigger.Spec.CreateIngress, host, path, trigger.Spec.IngressConfig.TLS, ann)
|
||||
trigger.Name, methods, trigger.Spec.RelativeURL, function, trigger.Spec.CreateIngress, host, path, trigger.Spec.IngressConfig.TLS, ann)
|
||||
}
|
||||
fmt.Fprintf(w, "\n")
|
||||
w.Flush()
|
||||
@@ -396,7 +396,7 @@ func ShowTimeTriggers(tts []fv1.TimeTrigger) {
|
||||
for _, tt := range tts {
|
||||
|
||||
fmt.Fprintf(w, "%v\t%v\t%v\n",
|
||||
tt.ObjectMeta.Name, tt.Spec.Cron, tt.Spec.FunctionReference.Name)
|
||||
tt.ObjectMeta.Name, tt.Spec.Cron, tt.Spec.Name)
|
||||
}
|
||||
fmt.Fprintf(w, "\n")
|
||||
w.Flush()
|
||||
@@ -423,7 +423,7 @@ func ShowAppliedKubeWatchers(ws []fv1.KubernetesWatchTrigger) {
|
||||
func getAllFunctions(ctx context.Context, client cmd.Client, namespace string) ([]fv1.Function, error) {
|
||||
fns, err := client.FissionClientSet.CoreV1().Functions(namespace).List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Unable to get Functions %v", err.Error())
|
||||
return nil, fmt.Errorf("unable to get Functions %v", err.Error())
|
||||
}
|
||||
return fns.Items, nil
|
||||
}
|
||||
@@ -432,7 +432,7 @@ func getAllFunctions(ctx context.Context, client cmd.Client, namespace string) (
|
||||
func getAllEnvironments(ctx context.Context, client cmd.Client, namespace string) ([]fv1.Environment, error) {
|
||||
envs, err := client.FissionClientSet.CoreV1().Environments(namespace).List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Unable to get Environments %v", err.Error())
|
||||
return nil, fmt.Errorf("unable to get Environments %v", err.Error())
|
||||
}
|
||||
return envs.Items, nil
|
||||
}
|
||||
@@ -441,7 +441,7 @@ func getAllEnvironments(ctx context.Context, client cmd.Client, namespace string
|
||||
func getAllPackages(ctx context.Context, client cmd.Client, namespace string) ([]fv1.Package, error) {
|
||||
pkgList, err := client.FissionClientSet.CoreV1().Packages(namespace).List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Unable to get Packages %v", err.Error())
|
||||
return nil, fmt.Errorf("unable to get Packages %v", err.Error())
|
||||
}
|
||||
return pkgList.Items, nil
|
||||
}
|
||||
@@ -450,7 +450,7 @@ func getAllPackages(ctx context.Context, client cmd.Client, namespace string) ([
|
||||
func getAllCanaryConfigs(ctx context.Context, client cmd.Client, namespace string) ([]fv1.CanaryConfig, error) {
|
||||
canaryCfgs, err := client.FissionClientSet.CoreV1().CanaryConfigs(namespace).List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Unable to get Canary Configs %v", err.Error())
|
||||
return nil, fmt.Errorf("unable to get Canary Configs %v", err.Error())
|
||||
}
|
||||
return canaryCfgs.Items, nil
|
||||
}
|
||||
@@ -459,7 +459,7 @@ func getAllCanaryConfigs(ctx context.Context, client cmd.Client, namespace strin
|
||||
func getAllHTTPTriggers(ctx context.Context, client cmd.Client, namespace string) ([]fv1.HTTPTrigger, error) {
|
||||
hts, err := client.FissionClientSet.CoreV1().HTTPTriggers(namespace).List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Unable to get HTTP Triggers %v", err.Error())
|
||||
return nil, fmt.Errorf("unable to get HTTP Triggers %v", err.Error())
|
||||
}
|
||||
return hts.Items, nil
|
||||
}
|
||||
@@ -468,7 +468,7 @@ func getAllHTTPTriggers(ctx context.Context, client cmd.Client, namespace string
|
||||
func getAllMessageQueueTriggers(ctx context.Context, client cmd.Client, mqttype string, namespace string) ([]fv1.MessageQueueTrigger, error) {
|
||||
mqts, err := client.FissionClientSet.CoreV1().MessageQueueTriggers(namespace).List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Unable to get MessageQueue Triggers %v", err.Error())
|
||||
return nil, fmt.Errorf("unable to get MessageQueue Triggers %v", err.Error())
|
||||
}
|
||||
return mqts.Items, nil
|
||||
}
|
||||
@@ -477,7 +477,7 @@ func getAllMessageQueueTriggers(ctx context.Context, client cmd.Client, mqttype
|
||||
func getAllTimeTriggers(ctx context.Context, client cmd.Client, namespace string) ([]fv1.TimeTrigger, error) {
|
||||
tts, err := client.FissionClientSet.CoreV1().TimeTriggers(namespace).List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Unable to get Time Triggers %v", err.Error())
|
||||
return nil, fmt.Errorf("unable to get Time Triggers %v", err.Error())
|
||||
}
|
||||
return tts.Items, nil
|
||||
}
|
||||
@@ -486,7 +486,7 @@ func getAllTimeTriggers(ctx context.Context, client cmd.Client, namespace string
|
||||
func getAllKubeWatchTriggers(ctx context.Context, client cmd.Client, namespace string) ([]fv1.KubernetesWatchTrigger, error) {
|
||||
ws, err := client.FissionClientSet.CoreV1().KubernetesWatchTriggers(namespace).List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Unable to get Kube Watchers %v", err.Error())
|
||||
return nil, fmt.Errorf("unable to get Kube Watchers %v", err.Error())
|
||||
}
|
||||
return ws.Items, nil
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ type (
|
||||
func save(data []byte, specDir string, specFile string, truncate bool) error {
|
||||
// verify
|
||||
if _, err := os.Stat(filepath.Join(specDir, "fission-deployment-config.yaml")); os.IsNotExist(err) {
|
||||
return fmt.Errorf("Couldn't find specs, run `fission spec init` first: %w", err)
|
||||
return fmt.Errorf("couldn't find specs, run `fission spec init` first: %w", err)
|
||||
}
|
||||
|
||||
filename := filepath.Join(specDir, specFile)
|
||||
@@ -194,10 +194,7 @@ func SpecSave(resource interface{}, specFile string, update bool) error {
|
||||
return fmt.Errorf("same name resource (%v) already exists in namespace (%v)", meta.Name, meta.Namespace)
|
||||
}
|
||||
|
||||
truncate := false
|
||||
if update {
|
||||
truncate = true
|
||||
}
|
||||
truncate := update
|
||||
err = save(data, specDir, specFile, truncate)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -234,46 +231,46 @@ func crdToYaml(resource interface{}) (metav1.ObjectMeta, string, []byte, error)
|
||||
kind = typedres.Kind
|
||||
data, err = yaml.Marshal(typedres)
|
||||
case fv1.Package:
|
||||
typedres.TypeMeta.APIVersion = fv1.CRD_VERSION
|
||||
typedres.TypeMeta.Kind = "Package"
|
||||
typedres.APIVersion = fv1.CRD_VERSION
|
||||
typedres.Kind = "Package"
|
||||
meta = typedres.ObjectMeta
|
||||
kind = typedres.TypeMeta.Kind
|
||||
kind = typedres.Kind
|
||||
data, err = yaml.Marshal(typedres)
|
||||
case fv1.Function:
|
||||
typedres.TypeMeta.APIVersion = fv1.CRD_VERSION
|
||||
typedres.TypeMeta.Kind = "Function"
|
||||
typedres.APIVersion = fv1.CRD_VERSION
|
||||
typedres.Kind = "Function"
|
||||
meta = typedres.ObjectMeta
|
||||
kind = typedres.TypeMeta.Kind
|
||||
kind = typedres.Kind
|
||||
data, err = yaml.Marshal(typedres)
|
||||
case fv1.Environment:
|
||||
typedres.TypeMeta.APIVersion = fv1.CRD_VERSION
|
||||
typedres.TypeMeta.Kind = "Environment"
|
||||
typedres.APIVersion = fv1.CRD_VERSION
|
||||
typedres.Kind = "Environment"
|
||||
meta = typedres.ObjectMeta
|
||||
kind = typedres.TypeMeta.Kind
|
||||
kind = typedres.Kind
|
||||
data, err = yaml.Marshal(typedres)
|
||||
case fv1.HTTPTrigger:
|
||||
typedres.TypeMeta.APIVersion = fv1.CRD_VERSION
|
||||
typedres.TypeMeta.Kind = "HTTPTrigger"
|
||||
typedres.APIVersion = fv1.CRD_VERSION
|
||||
typedres.Kind = "HTTPTrigger"
|
||||
meta = typedres.ObjectMeta
|
||||
kind = typedres.TypeMeta.Kind
|
||||
kind = typedres.Kind
|
||||
data, err = yaml.Marshal(typedres)
|
||||
case fv1.KubernetesWatchTrigger:
|
||||
typedres.TypeMeta.APIVersion = fv1.CRD_VERSION
|
||||
typedres.TypeMeta.Kind = "KubernetesWatchTrigger"
|
||||
typedres.APIVersion = fv1.CRD_VERSION
|
||||
typedres.Kind = "KubernetesWatchTrigger"
|
||||
meta = typedres.ObjectMeta
|
||||
kind = typedres.TypeMeta.Kind
|
||||
kind = typedres.Kind
|
||||
data, err = yaml.Marshal(typedres)
|
||||
case fv1.MessageQueueTrigger:
|
||||
typedres.TypeMeta.APIVersion = fv1.CRD_VERSION
|
||||
typedres.TypeMeta.Kind = "MessageQueueTrigger"
|
||||
typedres.APIVersion = fv1.CRD_VERSION
|
||||
typedres.Kind = "MessageQueueTrigger"
|
||||
meta = typedres.ObjectMeta
|
||||
kind = typedres.TypeMeta.Kind
|
||||
kind = typedres.Kind
|
||||
data, err = yaml.Marshal(typedres)
|
||||
case fv1.TimeTrigger:
|
||||
typedres.TypeMeta.APIVersion = fv1.CRD_VERSION
|
||||
typedres.TypeMeta.Kind = "TimeTrigger"
|
||||
typedres.APIVersion = fv1.CRD_VERSION
|
||||
typedres.Kind = "TimeTrigger"
|
||||
meta = typedres.ObjectMeta
|
||||
kind = typedres.TypeMeta.Kind
|
||||
kind = typedres.Kind
|
||||
data, err = yaml.Marshal(typedres)
|
||||
default:
|
||||
err = fmt.Errorf("unknown object type '%v'", typedres)
|
||||
@@ -558,7 +555,7 @@ func (fr *FissionResources) ParseYaml(b []byte, loc *Location, commitLabelVal st
|
||||
var tm types.TypeMeta
|
||||
err := yaml.Unmarshal(b, &tm)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to decode yaml %s: %w", string(b), err)
|
||||
return fmt.Errorf("failed to decode yaml %s: %w", string(b), err)
|
||||
}
|
||||
|
||||
switch tm.Kind {
|
||||
@@ -566,7 +563,7 @@ func (fr *FissionResources) ParseYaml(b []byte, loc *Location, commitLabelVal st
|
||||
var v fv1.Package
|
||||
err = yaml.Unmarshal(b, &v)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to parse %v in %v: %w", tm.Kind, loc, err)
|
||||
return fmt.Errorf("failed to parse %v in %v: %w", tm.Kind, loc, err)
|
||||
}
|
||||
m = &v.ObjectMeta
|
||||
applyCommitLabel(commitLabelVal, m)
|
||||
@@ -575,7 +572,7 @@ func (fr *FissionResources) ParseYaml(b []byte, loc *Location, commitLabelVal st
|
||||
var v fv1.Function
|
||||
err = yaml.Unmarshal(b, &v)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to parse %v in %v: %w", tm.Kind, loc, err)
|
||||
return fmt.Errorf("failed to parse %v in %v: %w", tm.Kind, loc, err)
|
||||
}
|
||||
m = &v.ObjectMeta
|
||||
applyCommitLabel(commitLabelVal, m)
|
||||
@@ -584,7 +581,7 @@ func (fr *FissionResources) ParseYaml(b []byte, loc *Location, commitLabelVal st
|
||||
var v fv1.Environment
|
||||
err = yaml.Unmarshal(b, &v)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to parse %v in %v: %w", tm.Kind, loc, err)
|
||||
return fmt.Errorf("failed to parse %v in %v: %w", tm.Kind, loc, err)
|
||||
}
|
||||
m = &v.ObjectMeta
|
||||
applyCommitLabel(commitLabelVal, m)
|
||||
@@ -593,7 +590,7 @@ func (fr *FissionResources) ParseYaml(b []byte, loc *Location, commitLabelVal st
|
||||
var v fv1.HTTPTrigger
|
||||
err = yaml.Unmarshal(b, &v)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to parse %v in %v: %w", tm.Kind, loc, err)
|
||||
return fmt.Errorf("failed to parse %v in %v: %w", tm.Kind, loc, err)
|
||||
}
|
||||
m = &v.ObjectMeta
|
||||
applyCommitLabel(commitLabelVal, m)
|
||||
@@ -602,7 +599,7 @@ func (fr *FissionResources) ParseYaml(b []byte, loc *Location, commitLabelVal st
|
||||
var v fv1.KubernetesWatchTrigger
|
||||
err = yaml.Unmarshal(b, &v)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to parse %v in %v: %w", tm.Kind, loc, err)
|
||||
return fmt.Errorf("failed to parse %v in %v: %w", tm.Kind, loc, err)
|
||||
}
|
||||
m = &v.ObjectMeta
|
||||
applyCommitLabel(commitLabelVal, m)
|
||||
@@ -611,7 +608,7 @@ func (fr *FissionResources) ParseYaml(b []byte, loc *Location, commitLabelVal st
|
||||
var v fv1.TimeTrigger
|
||||
err = yaml.Unmarshal(b, &v)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to parse %v in %v: %w", tm.Kind, loc, err)
|
||||
return fmt.Errorf("failed to parse %v in %v: %w", tm.Kind, loc, err)
|
||||
}
|
||||
m = &v.ObjectMeta
|
||||
applyCommitLabel(commitLabelVal, m)
|
||||
@@ -620,7 +617,7 @@ func (fr *FissionResources) ParseYaml(b []byte, loc *Location, commitLabelVal st
|
||||
var v fv1.MessageQueueTrigger
|
||||
err = yaml.Unmarshal(b, &v)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to parse %v in %v: %w", tm.Kind, loc, err)
|
||||
return fmt.Errorf("failed to parse %v in %v: %w", tm.Kind, loc, err)
|
||||
}
|
||||
m = &v.ObjectMeta
|
||||
applyCommitLabel(commitLabelVal, m)
|
||||
@@ -632,7 +629,7 @@ func (fr *FissionResources) ParseYaml(b []byte, loc *Location, commitLabelVal st
|
||||
var v types.DeploymentConfig
|
||||
err = yaml.Unmarshal(b, &v)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to parse %v in %v: %w", tm.Kind, loc, err)
|
||||
return fmt.Errorf("failed to parse %v in %v: %w", tm.Kind, loc, err)
|
||||
}
|
||||
|
||||
fr.DeploymentConfig = v
|
||||
@@ -640,7 +637,7 @@ func (fr *FissionResources) ParseYaml(b []byte, loc *Location, commitLabelVal st
|
||||
var v types.ArchiveUploadSpec
|
||||
err = yaml.Unmarshal(b, &v)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to parse %v in %v: %w", tm.Kind, loc, err)
|
||||
return fmt.Errorf("failed to parse %v in %v: %w", tm.Kind, loc, err)
|
||||
}
|
||||
|
||||
m = &metav1.ObjectMeta{
|
||||
|
||||
@@ -109,7 +109,7 @@ func resourceConflictCheck(ctx context.Context, c cmd.Client, fr *FissionResourc
|
||||
|
||||
fnList, err := getAllFunctions(ctx, c, namespace)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Unable to get Functions %v", err.Error())
|
||||
return fmt.Errorf("unable to get Functions %v", err.Error())
|
||||
}
|
||||
for _, sObj := range fr.Functions {
|
||||
for _, cObj := range fnList {
|
||||
@@ -122,7 +122,7 @@ func resourceConflictCheck(ctx context.Context, c cmd.Client, fr *FissionResourc
|
||||
|
||||
envList, err := getAllEnvironments(ctx, c, namespace)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Unable to get Environments %v", err.Error())
|
||||
return fmt.Errorf("unable to get Environments %v", err.Error())
|
||||
}
|
||||
for _, sObj := range fr.Environments {
|
||||
for _, cObj := range envList {
|
||||
@@ -135,7 +135,7 @@ func resourceConflictCheck(ctx context.Context, c cmd.Client, fr *FissionResourc
|
||||
|
||||
pkgList, err := getAllPackages(ctx, c, namespace)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Unable to get Packages %v", err.Error())
|
||||
return fmt.Errorf("unable to get Packages %v", err.Error())
|
||||
}
|
||||
for _, sObj := range fr.Packages {
|
||||
for _, cObj := range pkgList {
|
||||
@@ -148,7 +148,7 @@ func resourceConflictCheck(ctx context.Context, c cmd.Client, fr *FissionResourc
|
||||
|
||||
httptriggerList, err := getAllHTTPTriggers(ctx, c, namespace)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Unable to get HTTPTrigger %v", err.Error())
|
||||
return fmt.Errorf("unable to get HTTPTrigger %v", err.Error())
|
||||
}
|
||||
for _, sObj := range fr.HttpTriggers {
|
||||
for _, cObj := range httptriggerList {
|
||||
@@ -161,7 +161,7 @@ func resourceConflictCheck(ctx context.Context, c cmd.Client, fr *FissionResourc
|
||||
|
||||
mqtriggerList, err := getAllMessageQueueTriggers(ctx, c, "", namespace)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Unable to get Message Queue Trigger %v", err.Error())
|
||||
return fmt.Errorf("unable to get Message Queue Trigger %v", err.Error())
|
||||
}
|
||||
for _, sObj := range fr.MessageQueueTriggers {
|
||||
for _, cObj := range mqtriggerList {
|
||||
@@ -174,7 +174,7 @@ func resourceConflictCheck(ctx context.Context, c cmd.Client, fr *FissionResourc
|
||||
|
||||
timetriggerList, err := getAllTimeTriggers(ctx, c, namespace)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Unable to get Time Trigger %v", err.Error())
|
||||
return fmt.Errorf("unable to get Time Trigger %v", err.Error())
|
||||
}
|
||||
for _, sObj := range fr.TimeTriggers {
|
||||
for _, cObj := range timetriggerList {
|
||||
@@ -187,7 +187,7 @@ func resourceConflictCheck(ctx context.Context, c cmd.Client, fr *FissionResourc
|
||||
|
||||
kubewatchtriggerList, err := getAllKubeWatchTriggers(ctx, c, namespace)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Unable to get Kubernetes Watch Trigger %v", err.Error())
|
||||
return fmt.Errorf("unable to get Kubernetes Watch Trigger %v", err.Error())
|
||||
}
|
||||
for _, sObj := range fr.KubernetesWatchTriggers {
|
||||
for _, cObj := range kubewatchtriggerList {
|
||||
@@ -225,8 +225,8 @@ func ReadSpecs(specDir, specIgnore string, applyCommitLabel bool) (*FissionResou
|
||||
|
||||
// make sure spec directory exists before continue
|
||||
if _, err := os.Stat(specDir); os.IsNotExist(err) {
|
||||
return nil, fmt.Errorf("Spec directory %v doesn't exist. "+
|
||||
"Please check directory path or run \"fission spec init\" to create it.", specDir)
|
||||
return nil, fmt.Errorf("spec directory %v doesn't exist. "+
|
||||
"Please check directory path or run \"fission spec init\" to create it", specDir)
|
||||
}
|
||||
|
||||
ignoreParser, err := util.GetSpecIgnoreParser(specDir, specIgnore)
|
||||
|
||||
@@ -56,12 +56,12 @@ func (opts *DumpSubCommand) do(input cli.Input) error {
|
||||
panic(err)
|
||||
}
|
||||
} else if err != nil {
|
||||
panic(fmt.Errorf("Error checking dump directory status: %w", err))
|
||||
panic(fmt.Errorf("error checking dump directory status: %w", err))
|
||||
}
|
||||
|
||||
outputDir, err = filepath.Abs(outputDir)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("Error creating dump directory for dumping files: %w", err))
|
||||
panic(fmt.Errorf("error creating dump directory for dumping files: %w", err))
|
||||
}
|
||||
|
||||
k8sClient := opts.Client().KubernetesClient
|
||||
|
||||
@@ -61,7 +61,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) (err error) {
|
||||
|
||||
fnName := input.String(flagkey.TtFnName)
|
||||
if len(fnName) == 0 {
|
||||
return errors.New("Need a function name to create a trigger, use --function")
|
||||
return errors.New("need a function name to create a trigger, use --function")
|
||||
}
|
||||
|
||||
userProvidedNS, fnNamespace, err := opts.GetResourceNamespace(input, flagkey.NamespaceFunction)
|
||||
@@ -71,7 +71,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) (err error) {
|
||||
|
||||
cronSpec := input.String(flagkey.TtCron)
|
||||
if len(cronSpec) == 0 {
|
||||
return errors.New("Need a cron spec like '30 * * * *', '@every 1h30m', or '@hourly'; use --cron")
|
||||
return errors.New("need a cron spec like '30 * * * *', '@every 1h30m', or '@hourly'; use --cron")
|
||||
}
|
||||
|
||||
if input.Bool(flagkey.SpecSave) {
|
||||
|
||||
@@ -56,7 +56,7 @@ func (opts *ListSubCommand) do(input cli.Input) (err error) {
|
||||
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\n", "NAME", "CRON", "FUNCTION_NAME", "METHOD", "SUBPATH")
|
||||
for _, tt := range tts.Items {
|
||||
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\n",
|
||||
tt.ObjectMeta.Name, tt.Spec.Cron, tt.Spec.FunctionReference.Name, tt.Spec.Method, tt.Spec.Subpath)
|
||||
tt.ObjectMeta.Name, tt.Spec.Cron, tt.Spec.Name, tt.Spec.Method, tt.Spec.Subpath)
|
||||
}
|
||||
w.Flush()
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ func (opts *UpdateSubCommand) complete(input cli.Input) error {
|
||||
if err != nil {
|
||||
console.Warn(err.Error())
|
||||
}
|
||||
tt.Spec.FunctionReference.Name = fnName
|
||||
tt.Spec.Name = fnName
|
||||
updated = true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user