Skip to content

Commit

Permalink
mockkubeapiserver: /apis discovery does not include core group
Browse files Browse the repository at this point in the history
This avoids an error where clients try to request the /apis/v1
endpoint.
  • Loading branch information
justinsb committed Jun 10, 2024
1 parent 634c42a commit 0c31288
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion applylib/applyset/applyset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ data:
parentGVK := parent.GroupVersionKind()
restmapping, err := h.RESTMapper().RESTMapping(parentGVK.GroupKind(), parentGVK.Version)
if err != nil {
h.Fatalf("error building parent restmappaing: %v", err)
h.Fatalf("error building parent restmapping: %v", err)
}
s, err := New(Options{
Parent: NewParentRef(parent, "test", "default", restmapping),
Expand Down
4 changes: 4 additions & 0 deletions mockkubeapiserver/apigrouplist.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ type apiGroupList struct {
func (r *apiGroupList) Run(ctx context.Context, s *MockKubeAPIServer) error {
groupMap := make(map[string]*metav1.APIGroup)
for _, resource := range s.storage.AllResources() {
if resource.Group == "" {
// core API does not appear in this list
continue
}
group := groupMap[resource.Group]
if group == nil {
group = &metav1.APIGroup{Name: resource.Group}
Expand Down

0 comments on commit 0c31288

Please sign in to comment.