GoogleContainerTools / GoogleContainerTools/skaffold
Support for pruning of removed Kubernetes objects
- Dominant language
- Go
- Stars
- 15.9k
- Forks
- 1.7k
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 10
Description
Is there any thinking around whether Skaffold can or should support tracking of objects deployed to k8s, with a view of being able to delete those which no longer exist in the manifests?
### Expected behavior
If I deploy 2 Kubernetes objects from my manifest, then remove 1 object in my manifest and deploy again, the removed object should be deleted from the Kubernetes server.
### Actual behavior
The removed object is not deleted from Kubernetes.
### Information
- Contents of skaffold.yaml:
```yaml
apiVersion: skaffold/v4beta4
kind: Config
metadata:
name: skaffold-deploy
deploy:
kubectl:
manifests:
- nginx.yaml
```
- Contents of nginx.yaml:
```yaml
---
apiVersion: v1
kind: Service
metadata:
name: nginx-1
spec:
type: NodePort
ports:
- port: 80
targetPort: 80
nodePort: 30001
selector:
app: nginx
---
apiVersion: v1
kind: Service
metadata:
name: nginx-2
spec:
type: NodePort
ports:
- port: 80
targetPort: 80
nodePort: 30001
selector:
app: nginx
```
### Steps to reproduce the behavior
1. `skaffold deploy`
2. `yq eval-all 'select(.metadata.name == "nginx-1")' nginx.yaml > nginx-pruned.yaml && mv nginx-pruned.yaml nginx.yaml`
3. `skaffold deploy`
Contributor guide
Assessment
This issue has not been assessed yet.