-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Yaroslav Borbat <[email protected]>
- Loading branch information
1 parent
415bdfb
commit 15fae64
Showing
11 changed files
with
47 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
images/virtualization-artifact/api/operations/v1alpha1/register.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 13 additions & 20 deletions
33
images/virtualization-artifact/pkg/apiserver/storage/util.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,15 @@ | ||
package storage | ||
|
||
import ( | ||
"fmt" | ||
virtv2 "github.com/deckhouse/virtualization-controller/api/core/v1alpha2" | ||
"k8s.io/apimachinery/pkg/api/errors" | ||
"k8s.io/client-go/tools/cache" | ||
) | ||
|
||
func FetchVirtualMachine(vmLister cache.GenericLister, name, namespace string) (*virtv2.VirtualMachine, *errors.StatusError) { | ||
obj, err := vmLister.ByNamespace(namespace).Get(name) | ||
if err != nil { | ||
if errors.IsNotFound(err) { | ||
return nil, errors.NewNotFound(virtv2.Resource("virtualmachine"), name) | ||
} | ||
return nil, errors.NewInternalError(fmt.Errorf("unable to retrieve vm [%s]: %v", name, err)) | ||
} | ||
if vm, ok := obj.(*virtv2.VirtualMachine); ok { | ||
return vm, nil | ||
} | ||
return nil, errors.NewInternalError(fmt.Errorf("unable to retrieve vm [%s]: %v", name, err)) | ||
} | ||
// func FetchVirtualMachine(vmLister cache.GenericLister, name, namespace string) (*virtv2.VirtualMachine, *errors.StatusError) { | ||
// obj, err := vmLister.ByNamespace(namespace).Get(name) | ||
// if err != nil { | ||
// if errors.IsNotFound(err) { | ||
// return nil, errors.NewNotFound(virtv2.Resource("virtualmachine"), name) | ||
// } | ||
// return nil, errors.NewInternalError(fmt.Errorf("unable to retrieve vm [%s]: %w", name, err)) | ||
// } | ||
// if vm, ok := obj.(*virtv2.VirtualMachine); ok { | ||
// return vm, nil | ||
// } | ||
// return nil, errors.NewInternalError(fmt.Errorf("unable to retrieve vm [%s]: %w", name, err)) | ||
//} |
2 changes: 1 addition & 1 deletion
2
images/virtualization-artifact/pkg/config/load_kubevirt_apiserver_settings.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters