mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-19 14:34:17 +00:00
@@ -20,6 +20,7 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
)
|
||||
|
||||
// Resource gets a Velero GroupResource for a specified resource
|
||||
@@ -59,6 +60,18 @@ func CustomResources() map[string]typeInfo {
|
||||
}
|
||||
}
|
||||
|
||||
// CustomResourceKinds returns a list of all custom resources kinds within the Velero
|
||||
func CustomResourceKinds() sets.String {
|
||||
kinds := sets.NewString()
|
||||
|
||||
resources := CustomResources()
|
||||
for kind := range resources {
|
||||
kinds.Insert(kind)
|
||||
}
|
||||
|
||||
return kinds
|
||||
}
|
||||
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
for _, typeInfo := range CustomResources() {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion, typeInfo.ItemType, typeInfo.ItemListType)
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
)
|
||||
|
||||
// Resource gets a Velero GroupResource for a specified resource
|
||||
@@ -50,6 +51,18 @@ func CustomResources() map[string]typeInfo {
|
||||
}
|
||||
}
|
||||
|
||||
// CustomResourceKinds returns a list of all custom resources kinds within the Velero
|
||||
func CustomResourceKinds() sets.String {
|
||||
kinds := sets.NewString()
|
||||
|
||||
resources := CustomResources()
|
||||
for kind := range resources {
|
||||
kinds.Insert(kind)
|
||||
}
|
||||
|
||||
return kinds
|
||||
}
|
||||
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
for _, typeInfo := range CustomResources() {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion, typeInfo.ItemType, typeInfo.ItemListType)
|
||||
|
||||
Reference in New Issue
Block a user