-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don’t redeploy twice the same manifest in a dev loop #843
Conversation
0bb50ae
to
1c31238
Compare
// Only redeploy modified or new manifests | ||
// TODO(dgageot): should we delete a manifest that was deployed and is not anymore? | ||
updated := k.previousDeployment.diff(manifests) | ||
logrus.Debugln(len(manifests), "manifests to deploy.", len(manifests), "are updated or new") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add space after deploy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, Debugln will add a space between values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, TIL
@@ -79,12 +80,18 @@ func (k *KubectlDeployer) Deploy(ctx context.Context, out io.Writer, builds []bu | |||
return nil, errors.Wrap(err, "replacing images in manifests") | |||
} | |||
|
|||
err = kubectl(manifests.reader(), out, k.kubeContext, k.Flags.Global, "apply", k.Flags.Apply, "-f", "-") | |||
// Only redeploy modified or new manifests | |||
// TODO(dgageot): should we delete a manifest that was deployed and is not anymore? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My opinion here would be no, because
- I like the experience of having a deployment recreated by skaffold if I delete it manually (read: accidentally) through kubectl/cloud console, and
- this would mean you could get skaffold into a state where it's not consistent with the configuration in the skaffold.yaml, which is a weird UX
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand. This PR will not anymore recreate deployments that you accidentally deleted. In exchange, dev cycles are much faster. wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a tradeoff, but I guess if you do something silly like delete a deployment you could always just restart skaffold and have those deployments recreated. I could be convinced that speed is more important here.
3afc4eb
to
af58de1
Compare
Failing test looks like it could be a flake, try retriggering the test run |
Signed-off-by: David Gageot <david@gageot.net>
Signed-off-by: David Gageot david@gageot.net