Skaffold deploy should respect existing `replica` count
Expected behavior
skaffold deploy and skaffold run are safe to use. Assuming one has a HorizontalPodAutoscaler, the replicas count of a Deployment may not match what's contained in the local YAML definition. Skaffold deploy should always use the upstream replica count, possibly printing an info message if the replica count is lower than what's defined locally.
Actual behavior
Skaffold will set the replica count to what's set in the local YAML. Without a PodDisruptionBudget, this can result in unexpected dramatic scale-down events.
Information
- Skaffold version: v2.10.0
- Operating system: Debian 11
- Installed via: skaffold.dev
- Contents of skaffold.yaml: Any skaffold.yaml containing a kustomization which contains a Deployment will see this behavior
I will create a reproduction repo when I get a chance! This seems like a reasonable change to make skaffold a bit safer to use. I'm not opposed to make this under an option as well, since technically it's a breaking change to behavior, although I'd also suggest the default behavior is somewhat dangerous. skaffold deploy --respect-replica-counts?