Skip to content

Commit

Permalink
Merge pull request kubevirt#7139 from davidvossel/vm-pool-revisions
Browse files Browse the repository at this point in the history
Fix VM pool updates with revision tracking
  • Loading branch information
kubevirt-bot authored Feb 21, 2022
2 parents 1a55864 + 7b1aeb7 commit 3bc1b62
Show file tree
Hide file tree
Showing 13 changed files with 702 additions and 146 deletions.
37 changes: 37 additions & 0 deletions examples/vm-pool-cirros.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
apiVersion: pool.kubevirt.io/v1alpha1
kind: VirtualMachinePool
metadata:
name: vm-pool-cirros
spec:
replicas: 3
selector:
matchLabels:
kubevirt.io/vmpool: vm-pool-cirros
virtualMachineTemplate:
metadata:
creationTimestamp: null
labels:
kubevirt.io/vmpool: vm-pool-cirros
spec:
running: true
template:
metadata:
creationTimestamp: null
labels:
kubevirt.io/vmpool: vm-pool-cirros
spec:
domain:
devices:
disks:
- disk:
bus: virtio
name: containerdisk
resources:
requests:
memory: 128Mi
terminationGracePeriodSeconds: 0
volumes:
- containerDisk:
image: registry:5000/kubevirt/cirros-container-disk-demo:devel
name: containerdisk
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ require (
github.com/coreos/go-iptables v0.5.0
github.com/coreos/go-semver v0.3.0
github.com/coreos/prometheus-operator v0.38.1-0.20200424145508-7e176fda06cc
github.com/davecgh/go-spew v1.1.1
github.com/emicklei/go-restful v2.10.0+incompatible
github.com/emicklei/go-restful-openapi v1.2.0
github.com/evanphx/json-patch v4.12.0+incompatible
Expand Down Expand Up @@ -98,6 +97,7 @@ require (
github.com/cilium/ebpf v0.6.2 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/cyphar/filepath-securejoin v0.2.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect
github.com/go-logfmt/logfmt v0.5.0 // indirect
github.com/go-logr/logr v1.2.0 // indirect
Expand Down
14 changes: 14 additions & 0 deletions pkg/controller/virtinformers.go
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,20 @@ func GetControllerRevisionInformerIndexers() cache.Indexers {
}
}

return nil, nil
},
"vmpool": func(obj interface{}) ([]string, error) {
cr, ok := obj.(*appsv1.ControllerRevision)
if !ok {
return nil, unexpectedObjectError
}

for _, ref := range cr.OwnerReferences {
if ref.Kind == "VirtualMachinePool" {
return []string{string(ref.UID)}, nil
}
}

return nil, nil
},
}
Expand Down
2 changes: 0 additions & 2 deletions pkg/virt-controller/watch/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ go_library(
"//staging/src/kubevirt.io/client-go/kubecli:go_default_library",
"//staging/src/kubevirt.io/client-go/log:go_default_library",
"//staging/src/kubevirt.io/client-go/util:go_default_library",
"//vendor/github.com/davecgh/go-spew/spew:go_default_library",
"//vendor/github.com/emicklei/go-restful:go_default_library",
"//vendor/github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis/volumesnapshot/v1beta1:go_default_library",
"//vendor/github.com/pborman/uuid:go_default_library",
Expand All @@ -68,7 +67,6 @@ go_library(
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/rand:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/validation/field:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/scheme:go_default_library",
Expand Down
1 change: 1 addition & 0 deletions pkg/virt-controller/watch/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ func (vca *VirtControllerApp) initPool() {
vca.vmiInformer,
vca.vmInformer,
vca.poolInformer,
vca.controllerRevisionInformer,
recorder,
controller.BurstReplicas)
}
Expand Down
Loading

0 comments on commit 3bc1b62

Please sign in to comment.