Skip to content

Commit

Permalink
fix(vm): Improve KVVM Builder. Add method SetMetadata (#668)
Browse files Browse the repository at this point in the history
Improve KVVM Builder. Add method SetMetadata
---------
Signed-off-by: Yaroslav Borbat <[email protected]>
  • Loading branch information
yaroslavborbat authored Jan 27, 2025
1 parent c3e5c3a commit 9469bdc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
15 changes: 15 additions & 0 deletions images/virtualization-artifact/pkg/controller/kvbuilder/kvvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,3 +582,18 @@ func (b *KVVM) GetBootloaderSettings() map[string]interface{} {
},
}
}

func (b *KVVM) SetMetadata(metadata metav1.ObjectMeta) {
if b.ResourceExists {
// initialize only
return
}
if b.Resource.Spec.Template.ObjectMeta.Labels == nil {
b.Resource.Spec.Template.ObjectMeta.Labels = make(map[string]string, len(metadata.Labels))
}
if b.Resource.Spec.Template.ObjectMeta.Annotations == nil {
b.Resource.Spec.Template.ObjectMeta.Annotations = make(map[string]string, len(metadata.Annotations))
}
maps.Copy(b.Resource.Spec.Template.ObjectMeta.Labels, metadata.Labels)
maps.Copy(b.Resource.Spec.Template.ObjectMeta.Annotations, metadata.Annotations)
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func ApplyVirtualMachineSpec(
return err
}

kvvm.SetMetadata(vm.ObjectMeta)
kvvm.SetNetworkInterface(NetworkInterfaceName)
kvvm.SetTablet("default-0")
kvvm.SetNodeSelector(vm.Spec.NodeSelector, class.Spec.NodeSelector.MatchLabels)
Expand Down
2 changes: 0 additions & 2 deletions tests/e2e/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ tasks:
cmds:
- |
RESULT=$(ginkgo \
--skip-file affinity_toleration_test.go \
--no-color \
-v | tee /dev/stderr | grep --color=never -E 'FAIL!|SUCCESS!')
if [ "${PIPESTATUS[0]}" -ne "0" ]; then
Expand Down Expand Up @@ -106,7 +105,6 @@ tasks:
cmds:
- |
ginkgo -v \
--skip-file affinity_toleration_test.go \
{{if .FOCUS -}}
--focus "{{ .FOCUS }}"
{{end}}

0 comments on commit 9469bdc

Please sign in to comment.