Skip to content

Commit

Permalink
Add warning when no groupMeta exists for verison
Browse files Browse the repository at this point in the history
Reference: kubernetes/kubernetes#44771

Fixes kubernetes#1252

TPRs are incorrectly coupled with the RestMapper right now.  The real
solution is for TPRs to not register themselves with the RestMapper.
This is a short term patch for minikube until the work is done
upstream.  On start/stop, the namespace controller and the garbage
collector controller both call this code and panic since TPRs have
registered themselves with enabled versions but have no group metadata.
  • Loading branch information
r2d4 committed May 1, 2017
1 parent fa118e1 commit 03c3f7f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 2 additions & 0 deletions hack/godeps/godep-save.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ godep save ./...

godep::remove_staging_from_json
git checkout -- ${MINIKUBE_ROOT}/vendor/golang.org/x/sys/windows

git apply ${MINIKUBE_ROOT}/hack/tpr-patch.diff
17 changes: 17 additions & 0 deletions hack/tpr-patch.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/vendor/k8s.io/apimachinery/pkg/apimachinery/registered/registered.go b/vendor/k8s.io/apimachinery/pkg/apimachinery/registered/registered.go
index f2e32c88c..f1c96c43d 100644
--- a/vendor/k8s.io/apimachinery/pkg/apimachinery/registered/registered.go
+++ b/vendor/k8s.io/apimachinery/pkg/apimachinery/registered/registered.go
@@ -282,7 +282,11 @@ func (m *APIRegistrationManager) RESTMapper(versionPatterns ...schema.GroupVersi
for enabledVersion := range m.enabledVersions {
if !unionedGroups.Has(enabledVersion.Group) {
unionedGroups.Insert(enabledVersion.Group)
- groupMeta := m.groupMetaMap[enabledVersion.Group]
+ groupMeta, found := m.groupMetaMap[enabledVersion.Group]
+ // TODO(r2d4): hack until tprs are decoupled from restMapper
+ if !found {
+ glog.Warningf("Could not find groupMeta for %s", enabledVersion.Group)
+ }
unionMapper = append(unionMapper, groupMeta.RESTMapper)
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 03c3f7f

Please sign in to comment.