Skip to content

Commit e683936

Browse files
committed
add vmclass labels
Signed-off-by: Pavel Tishkov <[email protected]>
1 parent 357a0bd commit e683936

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

images/hooks/pkg/hooks/create-generic-vmclass/hook.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import (
3333
)
3434

3535
const (
36-
createGenericVMClassHookName = "Create generic VirtualMachineClass"
36+
createGenericVMClassHookName = "Create module steate secret"
3737
moduleStateSecretSnapshot = "module-state-secret"
3838
vmClassSnapshot = "vmclass-generic"
3939

@@ -71,6 +71,12 @@ var config = &pkg.HookConfig{
7171
NameSelector: &pkg.NameSelector{
7272
MatchNames: []string{genericVMClassName},
7373
},
74+
LabelSelector: &metav1.LabelSelector{
75+
MatchLabels: map[string]string{
76+
"app": "virtualization-controller",
77+
"module": settings.ModuleName,
78+
},
79+
},
7480
ExecuteHookOnSynchronization: ptr.To(false),
7581
},
7682
},
@@ -112,6 +118,7 @@ func Reconcile(_ context.Context, input *pkg.HookInput) error {
112118
ObjectMeta: metav1.ObjectMeta{
113119
Name: genericVMClassName,
114120
Labels: map[string]string{
121+
"app": "virtualization-controller",
115122
"module": settings.ModuleName,
116123
},
117124
},

images/hooks/pkg/hooks/create-generic-vmclass/hook_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ var _ = Describe("Create Generic VMClass hook", func() {
8282
vmClass, ok := obj.(*v1alpha2.VirtualMachineClass)
8383
Expect(ok).To(BeTrue())
8484
Expect(vmClass.Name).To(Equal("generic"))
85+
Expect(vmClass.Labels).To(Equal(map[string]string{
86+
"app": "virtualization-controller",
87+
"module": "virtualization",
88+
}))
8589
})
8690

8791
Expect(Reconcile(context.Background(), newInput())).To(Succeed())

images/hooks/pkg/hooks/update-module-state/hook.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ var config = &pkg.HookConfig{
6060
NameSelector: &pkg.NameSelector{
6161
MatchNames: []string{genericVMClassName},
6262
},
63+
LabelSelector: &metav1.LabelSelector{
64+
MatchLabels: map[string]string{
65+
"app": "virtualization-controller",
66+
"module": settings.ModuleName,
67+
},
68+
},
6369
ExecuteHookOnSynchronization: ptr.To(false),
6470
},
6571
{

0 commit comments

Comments
 (0)