diff --git a/cmd/up.go b/cmd/up.go index d15d95c54341..96fcacb50514 100644 --- a/cmd/up.go +++ b/cmd/up.go @@ -780,6 +780,7 @@ func (up *UpContext) synchronizeFiles() error { } go up.Sy.Monitor(up.Context, up.Disconnect) + log.Infof("restarting syncthing to update sync mode to sendreceive") return up.Sy.Restart(up.Context) } @@ -807,7 +808,6 @@ func (up *UpContext) cleanCommand() { log.Infof("failed to clean session: %s", err) } - log.Infof("watches: %s", out.String()) if utils.IsWatchesConfigurationTooLow(out.String()) { log.Yellow("\nThe value of /proc/sys/fs/inotify/max_user_watches in your cluster nodes is too low.") log.Yellow("This can affect Okteto's file synchronization performance.") diff --git a/images/bin/Dockerfile b/images/bin/Dockerfile index 8129a7a7569d..865aee9e61ae 100644 --- a/images/bin/Dockerfile +++ b/images/bin/Dockerfile @@ -1,6 +1,6 @@ # syntax = docker/dockerfile:experimental -FROM syncthing/syncthing:1.5.0 AS syncthing +FROM syncthing/syncthing:1.6.1 AS syncthing FROM okteto/remote:0.2.5 AS remote FROM okteto/supervisor:0.1.0 AS supervisor FROM okteto/clean:0.1.0 AS clean diff --git a/main.go b/main.go index 7619fafb5864..a63889af9a62 100644 --- a/main.go +++ b/main.go @@ -43,7 +43,7 @@ func init() { func(e error) { // Error when there's no service on the other side: an error occurred forwarding 8080 -> 8080: error forwarding port 8080 to pod df05e7e1c85d6b256df779c0b2deb417eb53a299c8581fc0945264301d8fa4b3, uid : exit status 1: 2020/03/16 02:11:09 socat[42490] E connect(5, AF=2 127.0.0.1:8080, 16): Connection refused\n - log.Debugf("unhandled error: %s", e) + log.Debugf("port-forward: %s", e) }, } diff --git a/pkg/k8s/deployments/crud.go b/pkg/k8s/deployments/crud.go index 12866a1a1413..1fc446d1dcbd 100644 --- a/pkg/k8s/deployments/crud.go +++ b/pkg/k8s/deployments/crud.go @@ -310,7 +310,7 @@ func deleteUserAnnotations(annotations map[string]string, tr *model.Translation) //Destroy destroys a k8s service func Destroy(dev *model.Dev, c *kubernetes.Clientset) error { - log.Infof("deleting deployment '%s'...", dev.Name) + log.Infof("deleting deployment '%s'", dev.Name) dClient := c.AppsV1().Deployments(dev.Namespace) err := dClient.Delete(dev.Name, &metav1.DeleteOptions{GracePeriodSeconds: &devTerminationGracePeriodSeconds}) if err != nil { diff --git a/pkg/k8s/deployments/translate.go b/pkg/k8s/deployments/translate.go index 7ce4f4b09682..9b72f80ef4fa 100644 --- a/pkg/k8s/deployments/translate.go +++ b/pkg/k8s/deployments/translate.go @@ -37,12 +37,10 @@ const ( oktetoBinName = "okteto-bin" //syncthing - oktetoBinImageTag = "okteto/bin:1.1.18" + oktetoBinImageTag = "okteto/bin:1.1.19" oktetoSyncSecretVolume = "okteto-sync-secret" // skipcq GSC-G101 not a secret oktetoDevSecretVolume = "okteto-dev-secret" // skipcq GSC-G101 not a secret oktetoSecretTemplate = "okteto-%s" - - maxRetriesUpdateRevision = 150 ) var ( diff --git a/pkg/k8s/pods/pod.go b/pkg/k8s/pods/pod.go index 3e10d072899d..de22e31736b3 100644 --- a/pkg/k8s/pods/pod.go +++ b/pkg/k8s/pods/pod.go @@ -126,7 +126,11 @@ func GetDevPod(ctx context.Context, dev *model.Dev, c *kubernetes.Clientset, wai rs, err := replicasets.GetReplicaSetByDeployment(dev, d, c) if rs == nil { - log.Infof("failed to get replicaset with revision %v: %s ", d.Annotations[deploymentRevisionAnnotation], err) + if err == nil { + log.Infof("didn't find replicaset with revision %v", d.Annotations[deploymentRevisionAnnotation]) + } else { + log.Infof("failed to get replicaset with revision %v: %s ", d.Annotations[deploymentRevisionAnnotation], err) + } return nil, err } @@ -198,7 +202,7 @@ func MonitorDevPod(ctx context.Context, dev *model.Dev, pod *apiv1.Pod, c *kuber if strings.Contains(e.Message, "pod has unbound immediate PersistentVolumeClaims") { continue } - + return nil, fmt.Errorf(e.Message) case "FailedAttachVolume", "FailedMount": reporter <- fmt.Sprintf("%s: retrying", e.Message) diff --git a/pkg/k8s/secrets/configXML.go b/pkg/k8s/secrets/configXML.go index fe39b9cd45fb..aec40dab1289 100644 --- a/pkg/k8s/secrets/configXML.go +++ b/pkg/k8s/secrets/configXML.go @@ -20,7 +20,7 @@ import ( "github.com/okteto/okteto/pkg/syncthing" ) -const configXML = ` +const configXML = ` basic @@ -48,6 +48,7 @@ const configXML = ` false 0 0 + 0
dynamic
@@ -55,6 +56,7 @@ const configXML = ` false 0 0 + 0
{{ .RemoteGUIAddress }}
diff --git a/pkg/k8s/services/crud.go b/pkg/k8s/services/crud.go index 3f8a862a19b5..7908a1db1bcf 100644 --- a/pkg/k8s/services/crud.go +++ b/pkg/k8s/services/crud.go @@ -35,14 +35,14 @@ func CreateDev(dev *model.Dev, c *kubernetes.Clientset) error { sClient := c.CoreV1().Services(dev.Namespace) if old.Name == "" { - log.Infof("creating service '%s'...", s.Name) + log.Infof("creating service '%s'", s.Name) _, err = sClient.Create(s) if err != nil { return fmt.Errorf("error creating kubernetes service: %s", err) } - log.Infof("created service '%s'.", s.Name) + log.Infof("created service '%s'", s.Name) } else { - log.Infof("updating service '%s'...", s.Name) + log.Infof("updating service '%s'", s.Name) old.Spec.Ports = s.Spec.Ports _, err = sClient.Update(old) if err != nil { @@ -55,7 +55,7 @@ func CreateDev(dev *model.Dev, c *kubernetes.Clientset) error { //DestroyDev destroys the default service for a dev environment func DestroyDev(dev *model.Dev, c *kubernetes.Clientset) error { - log.Infof("deleting service '%s'...", dev.Name) + log.Infof("deleting service '%s'", dev.Name) sClient := c.CoreV1().Services(dev.Namespace) err := sClient.Delete(dev.Name, &metav1.DeleteOptions{}) if err != nil { diff --git a/pkg/k8s/volumes/crud.go b/pkg/k8s/volumes/crud.go index 1bd0e4f44d65..a8a0e021e5ce 100644 --- a/pkg/k8s/volumes/crud.go +++ b/pkg/k8s/volumes/crud.go @@ -41,7 +41,7 @@ func Create(ctx context.Context, dev *model.Dev, c *kubernetes.Clientset) error if k8Volume.Name != "" { return checkPVCValues(k8Volume, dev) } - log.Infof("creating volume claim '%s'...", pvc.Name) + log.Infof("creating volume claim '%s'", pvc.Name) _, err = vClient.Create(pvc) if err != nil { return fmt.Errorf("error creating kubernetes volume claim: %s", err) @@ -84,7 +84,7 @@ func checkPVCValues(pvc *apiv1.PersistentVolumeClaim, dev *model.Dev) error { //Destroy destroys the volume claim for a given dev environment func Destroy(ctx context.Context, dev *model.Dev, c *kubernetes.Clientset) error { vClient := c.CoreV1().PersistentVolumeClaims(dev.Namespace) - log.Infof("destroying volume claim '%s'...", dev.GetVolumeName()) + log.Infof("destroying volume claim '%s'", dev.GetVolumeName()) ticker := time.NewTicker(1 * time.Second) to := 3 * config.GetTimeout() // 90 seconds @@ -110,7 +110,7 @@ func Destroy(ctx context.Context, dev *model.Dev, c *kubernetes.Clientset) error } if i%10 == 5 { - log.Infof("waiting for volume claim '%s' to be destroyed...", dev.GetVolumeName()) + log.Infof("waiting for volume claim '%s' to be destroyed", dev.GetVolumeName()) } select { diff --git a/pkg/syncthing/api.go b/pkg/syncthing/api.go index 5563eacbb86d..a54a877c48db 100644 --- a/pkg/syncthing/api.go +++ b/pkg/syncthing/api.go @@ -21,8 +21,6 @@ import ( "net/http" "path" "time" - - "github.com/okteto/okteto/pkg/log" ) type addAPIKeyTransport struct { @@ -69,15 +67,13 @@ func (s *Syncthing) APICall(ctx context.Context, url, method string, code int, p resp, err := s.Client.Do(req) if err != nil { - log.Infof("fail to call syncthing API at %s: %s", url, err) - return nil, fmt.Errorf("failed to call syncthing API: %w", err) + return nil, fmt.Errorf("failed to call syncthing [%s]: %w", url, err) } defer resp.Body.Close() if resp.StatusCode != code { - log.Infof("unexpected response from syncthing API %s %d: %s", req.URL.String(), resp.StatusCode, string(body)) - return nil, fmt.Errorf("unexpected response from syncthing API %s %d: %s", req.URL.String(), resp.StatusCode, string(body)) + return nil, fmt.Errorf("unexpected response from syncthing [%s | %d]: %s", req.URL.String(), resp.StatusCode, string(body)) } if !readBody { @@ -86,8 +82,7 @@ func (s *Syncthing) APICall(ctx context.Context, url, method string, code int, p body, err = ioutil.ReadAll(resp.Body) if err != nil { - log.Infof("failed to read response from syncthing API at %s: %s", url, err) - return nil, fmt.Errorf("failed to read response from syncthing API") + return nil, fmt.Errorf("failed to read response from syncthing [%s]: %w", url, err) } return body, nil diff --git a/pkg/syncthing/configXML.go b/pkg/syncthing/configXML.go index 5124baaaa4c8..9935d28191ac 100644 --- a/pkg/syncthing/configXML.go +++ b/pkg/syncthing/configXML.go @@ -13,7 +13,7 @@ package syncthing -const configXML = ` +const configXML = ` basic @@ -41,6 +41,7 @@ const configXML = ` false 0 0 + 0
{{.RemoteAddress}}
@@ -48,6 +49,7 @@ const configXML = ` false 0 0 + 0
{{.GUIAddress}}
@@ -58,7 +60,7 @@ const configXML = `
- {{.ListenAddress}} + tcp://{{.ListenAddress}} default false false diff --git a/pkg/syncthing/install.go b/pkg/syncthing/install.go index a1fa976884e2..b9c5f6186011 100644 --- a/pkg/syncthing/install.go +++ b/pkg/syncthing/install.go @@ -29,15 +29,17 @@ import ( "github.com/okteto/okteto/pkg/model" ) +const syncthingVersion = "1.6.1" + var ( downloadURLs = map[string]string{ - "linux": "https://github.com/syncthing/syncthing/releases/download/v1.5.0/syncthing-linux-amd64-v1.5.0.tar.gz", - "arm64": "https://github.com/syncthing/syncthing/releases/download/v1.5.0/syncthing-linux-arm64-v1.5.0.tar.gz", - "darwin": "https://github.com/syncthing/syncthing/releases/download/v1.5.0/syncthing-macos-amd64-v1.5.0.tar.gz", - "windows": "https://github.com/syncthing/syncthing/releases/download/v1.5.0/syncthing-windows-amd64-v1.5.0.zip", + "linux": fmt.Sprintf("https://github.com/syncthing/syncthing/releases/download/v%[1]s/syncthing-linux-amd64-v%[1]s.tar.gz", syncthingVersion), + "arm64": fmt.Sprintf("https://github.com/syncthing/syncthing/releases/download/v%[1]s/syncthing-linux-arm64-v%[1]s.tar.gz", syncthingVersion), + "darwin": fmt.Sprintf("https://github.com/syncthing/syncthing/releases/download/v%[1]s/syncthing-macos-amd64-v%[1]s.zip", syncthingVersion), + "windows": fmt.Sprintf("https://github.com/syncthing/syncthing/releases/download/v%[1]s/syncthing-windows-amd64-v%[1]s.zip", syncthingVersion), } - minimumVersion = semver.MustParse("1.5.0") + minimumVersion = semver.MustParse(syncthingVersion) versionRegex = regexp.MustCompile(`syncthing v(\d+\.\d+\.\d+) .*`) ) @@ -73,7 +75,6 @@ func Install(p getter.ProgressTracker) error { return fmt.Errorf("failed to download syncthing from %s: %s", client.Src, err) } - log.Infof("downloaded syncthing from %s to %s", client.Src, dir) i := getInstallPath() b := getBinaryPathInDownload(dir, downloadURL) @@ -96,7 +97,7 @@ func Install(p getter.ProgressTracker) error { return fmt.Errorf("failed to write %s: %s", i, err) } - log.Infof("downloaded syncthing %s to %s", versionRegex, i) + log.Infof("downloaded syncthing %s to %s", syncthingVersion, i) return nil } diff --git a/pkg/syncthing/syncthing.go b/pkg/syncthing/syncthing.go index 142174ffdafe..5fd52c64fc33 100644 --- a/pkg/syncthing/syncthing.go +++ b/pkg/syncthing/syncthing.go @@ -287,18 +287,18 @@ func (s *Syncthing) Run(ctx context.Context) error { //WaitForPing waits for synthing to be ready func (s *Syncthing) WaitForPing(ctx context.Context, local bool) error { - ticker := time.NewTicker(100 * time.Millisecond) + ticker := time.NewTicker(300 * time.Millisecond) to := config.GetTimeout() // 30 seconds timeout := time.Now().Add(to) - log.Infof("waiting for syncthing local=%t to be ready...", local) + log.Infof("waiting for syncthing local=%t to be ready", local) for i := 0; ; i++ { _, err := s.APICall(ctx, "rest/system/ping", "GET", 200, nil, local, nil, false) if err == nil { return nil } - log.Debugf("error calling 'rest/system/ping' syncthing local=%t API: %s", local, err) + log.Debugf("syncthing local=%t is not ready yet: %s", local, err) if time.Now().After(timeout) { return fmt.Errorf("syncthing local=%t not responding after 15s", local) @@ -316,7 +316,7 @@ func (s *Syncthing) WaitForPing(ctx context.Context, local bool) error { //SendStignoreFile sends .stignore from local to remote func (s *Syncthing) SendStignoreFile(ctx context.Context, dev *model.Dev) { - log.Infof("sending '.stignore' file to the remote syncthing...") + log.Infof("sending '.stignore' file to the remote syncthing") params := getFolderParameter(dev) ignores := &Ignores{} body, err := s.APICall(ctx, "rest/db/ignores", "GET", 200, params, true, nil, true) @@ -352,7 +352,7 @@ func (s *Syncthing) SendStignoreFile(ctx context.Context, dev *model.Dev) { //ResetDatabase resets the syncthing database func (s *Syncthing) ResetDatabase(ctx context.Context, dev *model.Dev, local bool) error { - log.Infof("reseting syncthing database local=%t...", local) + log.Infof("reseting syncthing database local=%t", local) params := getFolderParameter(dev) _, err := s.APICall(ctx, "rest/system/reset", "POST", 200, params, local, nil, false) if err != nil { @@ -364,7 +364,7 @@ func (s *Syncthing) ResetDatabase(ctx context.Context, dev *model.Dev, local boo //Overwrite overwrites local changes to the remote syncthing func (s *Syncthing) Overwrite(ctx context.Context, dev *model.Dev) error { - log.Infof("overriding local changes to the remote syncthing...") + log.Infof("overriding local changes to the remote syncthing") params := getFolderParameter(dev) _, err := s.APICall(ctx, "rest/db/override", "POST", 200, params, true, nil, false) if err != nil { @@ -379,7 +379,7 @@ func (s *Syncthing) WaitForScanning(ctx context.Context, dev *model.Dev, local b ticker := time.NewTicker(100 * time.Millisecond) params := getFolderParameter(dev) status := &Status{} - log.Infof("waiting for initial scan to complete local=%t...", local) + log.Infof("waiting for initial scan to complete local=%t", local) to := config.GetTimeout() * 10 // 5 minutes timeout := time.Now().Add(to) @@ -424,7 +424,7 @@ func (s *Syncthing) WaitForScanning(ctx context.Context, dev *model.Dev, local b func (s *Syncthing) WaitForCompletion(ctx context.Context, dev *model.Dev, reporter chan float64) error { defer close(reporter) ticker := time.NewTicker(500 * time.Millisecond) - log.Infof("waiting for synchronization to complete...") + log.Infof("waiting for synchronization to complete") retries := 0 for { select { @@ -569,7 +569,6 @@ func (s *Syncthing) GetFolderErrors(ctx context.Context, dev *model.Dev, local b // Restart restarts the syncthing process func (s *Syncthing) Restart(ctx context.Context) error { - log.Infof("restarting syncthing...") _, err := s.APICall(ctx, "rest/system/restart", "POST", 200, nil, true, nil, false) return err }