mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
* Create auxialiary functions to find current deployment and pod name * Create auxialiary function for pushing Kubernetes components to cluster * Auxiliary function getPushDevfileCommands and remocve RunModeChanged flag as it is not possible anymore with long running dev command + move prelimiray tests at the beginning * Create auxiliary function updatePVCsOwnerReferences + move isMainStorageEphemeral inside aux. function * Watch for deployments in addition to watching for files during odo dev * - Check the Deployment Generation to return earlier when generation changed - Return earlier when pod is not ready * Push receives a Status that it can update, to indicate the status of the component when the function returns. This status is passed from Start to Watch * Use status to decide to sync files * Simplify getting pod * Status for PostStartEvents * - Touch .gitignore earlier so it is not synced - Add devstate.jso file to .gitignore * Fix the integration tests. * Make --no-watch work again * Get smaller volumes for tests * Quit when fail to exec port forwarding * Exponential delay after an error * Fix: get running pod * Remove testing odo dev stops when the build command fails. odo dev now gives a change to the user to fix the problem * Fix order or volumes and volume mounts in pod spec * Use server side apply for updating PVC when supported * Watch Devfile separately * Adapt tests for devfile handled separately * Update forwarded ports when necessary * Display kubernetes resources created only when created/updated * Do not set ResourceVersion when patching * TEMP: Add more logs on failing integrattests * Tests: select the *running* pod * Use forward slashes for .gitignore content, even on Windows * Rename GetOnePodFromSelector to GetRunningPodFromSelector * Cleanup logs * Fix 'odo log' integration test * Add log "Waiting for Kubernetes resources" * Fail if service bindings are not injected * Rename sources related watcher, timer * Fix delay after error * Display info about Pod * Disambiguate error messages * Display events related to components pod * Remove now unused functions used to wait for Deployment / Pod * Typos + function renaming * Do not watch devfile with --no-watch * Use type switch for Kubernertes watch event * Do not fail when watching Events is Forbidden * Do not fail when servicebinding resources are forbidden * Exit when build command fails on no-watch mode * Sync devfile.yaml by default, workaround when commands change on devfile * Rename to warningsWatcher * Fix comment
31 lines
451 B
Go
31 lines
451 B
Go
package watch
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/segmentio/backo-go"
|
|
"k8s.io/klog"
|
|
)
|
|
|
|
type ExpBackoff struct {
|
|
attempt int
|
|
backo *backo.Backo
|
|
}
|
|
|
|
func NewExpBackoff() *ExpBackoff {
|
|
return &ExpBackoff{
|
|
backo: backo.DefaultBacko(),
|
|
}
|
|
}
|
|
|
|
func (o *ExpBackoff) Delay() time.Duration {
|
|
duration := o.backo.Duration(o.attempt)
|
|
klog.V(4).Infof("wait for %v\n", duration)
|
|
o.attempt++
|
|
return duration
|
|
}
|
|
|
|
func (o *ExpBackoff) Reset() {
|
|
o.attempt = 0
|
|
}
|