Skip to content

Commit 6206cd1

Browse files
author
sai chaithanya
authored
feat(discovery): add method to list resources based on kind (#185)
This PR adds the method to discover list of resources based on provided kind. This functionality will help consumers to get resource details based on K8s Kind. Signed-off-by: mittachaitu <[email protected]>
1 parent 2bbc367 commit 6206cd1

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ require (
1010
k8s.io/apimachinery v0.17.3
1111
k8s.io/client-go v0.17.3
1212
k8s.io/klog/v2 v2.0.0
13-
openebs.io/metac v0.4.0
13+
openebs.io/metac v0.5.0
1414
)
1515

1616
replace (
1717
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.17.3
1818
k8s.io/apimachinery => k8s.io/apimachinery v0.17.3
1919
k8s.io/client-go => k8s.io/client-go v0.17.3
20-
openebs.io/metac => github.com/AmitKumarDas/metac v0.4.0
20+
openebs.io/metac => github.com/AmitKumarDas/metac v0.5.0
2121
)

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
33
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
44
contrib.go.opencensus.io/exporter/prometheus v0.1.0 h1:SByaIoWwNgMdPSgl5sMqM2KDE5H/ukPWBRo314xiDvg=
55
contrib.go.opencensus.io/exporter/prometheus v0.1.0/go.mod h1:cGFniUXGZlKRjzOyuZJ6mgB+PgBcCIa79kEKR8YCW+A=
6-
github.com/AmitKumarDas/metac v0.4.0 h1:DicLgezoHVoYrC0wtatCecfZoR93Vb++yTsT6zXQAQM=
7-
github.com/AmitKumarDas/metac v0.4.0/go.mod h1:OdHjrNt6jJ6e723kuQB5Bou2noiU4l3FfzEgzVNWJtk=
6+
github.com/AmitKumarDas/metac v0.5.0 h1:eYqtX19FTq+je3sXp3yvw0o4WjobE5WhRxTGag0Vr3s=
7+
github.com/AmitKumarDas/metac v0.5.0/go.mod h1:OdHjrNt6jJ6e723kuQB5Bou2noiU4l3FfzEgzVNWJtk=
88
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8=
99
github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=
1010
github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0=

pkg/recipe/fixture.go

+7
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"github.com/pkg/errors"
2121
apiextnv1 "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1"
2222
apiextnv1beta1 "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1"
23+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2324
"k8s.io/client-go/kubernetes"
2425
"k8s.io/client-go/rest"
2526
"k8s.io/klog/v2"
@@ -232,3 +233,9 @@ func (f *Fixture) GetAPIForAPIVersionAndResource(
232233
resource,
233234
)
234235
}
236+
237+
// GetAPIResourcesForKind returns the list of discoverd api resources
238+
// based on the provided kind
239+
func (f *Fixture) GetAPIResourcesForKind(kind string) []*metav1.APIResource {
240+
return f.apiDiscovery.GetAPIResourcesForKind(kind)
241+
}

0 commit comments

Comments
 (0)