Skip to content

Commit

Permalink
feat(discovery): add method to list resources based on kind (#185)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
sai chaithanya authored Dec 6, 2020
1 parent 2bbc367 commit 6206cd1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ require (
k8s.io/apimachinery v0.17.3
k8s.io/client-go v0.17.3
k8s.io/klog/v2 v2.0.0
openebs.io/metac v0.4.0
openebs.io/metac v0.5.0
)

replace (
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.17.3
k8s.io/apimachinery => k8s.io/apimachinery v0.17.3
k8s.io/client-go => k8s.io/client-go v0.17.3
openebs.io/metac => github.com/AmitKumarDas/metac v0.4.0
openebs.io/metac => github.com/AmitKumarDas/metac v0.5.0
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
contrib.go.opencensus.io/exporter/prometheus v0.1.0 h1:SByaIoWwNgMdPSgl5sMqM2KDE5H/ukPWBRo314xiDvg=
contrib.go.opencensus.io/exporter/prometheus v0.1.0/go.mod h1:cGFniUXGZlKRjzOyuZJ6mgB+PgBcCIa79kEKR8YCW+A=
github.com/AmitKumarDas/metac v0.4.0 h1:DicLgezoHVoYrC0wtatCecfZoR93Vb++yTsT6zXQAQM=
github.com/AmitKumarDas/metac v0.4.0/go.mod h1:OdHjrNt6jJ6e723kuQB5Bou2noiU4l3FfzEgzVNWJtk=
github.com/AmitKumarDas/metac v0.5.0 h1:eYqtX19FTq+je3sXp3yvw0o4WjobE5WhRxTGag0Vr3s=
github.com/AmitKumarDas/metac v0.5.0/go.mod h1:OdHjrNt6jJ6e723kuQB5Bou2noiU4l3FfzEgzVNWJtk=
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8=
github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=
github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0=
Expand Down
7 changes: 7 additions & 0 deletions pkg/recipe/fixture.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/pkg/errors"
apiextnv1 "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1"
apiextnv1beta1 "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/klog/v2"
Expand Down Expand Up @@ -232,3 +233,9 @@ func (f *Fixture) GetAPIForAPIVersionAndResource(
resource,
)
}

// GetAPIResourcesForKind returns the list of discoverd api resources
// based on the provided kind
func (f *Fixture) GetAPIResourcesForKind(kind string) []*metav1.APIResource {
return f.apiDiscovery.GetAPIResourcesForKind(kind)
}

0 comments on commit 6206cd1

Please sign in to comment.