Skip to content

Commit

Permalink
restore proper lowercase/plural CRD resource (vmware-tanzu#2949)
Browse files Browse the repository at this point in the history
* restore proper lowercase/plural CRD resource

This commit restores the proper resource string
"customresourcedefinitions" for CRD. The prior change to
"CustomResourceDefinition" was made because this was being used
in another place to populate the CRD "Kind" field in
remap_crd_version_action.go -- there, just use the correct Kind
string instead of pulling from Resource.

Signed-off-by: Scott Seago <sseago@redhat.com>

* add changelog

Signed-off-by: Scott Seago <sseago@redhat.com>
  • Loading branch information
sseago authored Oct 2, 2020
1 parent 3867d1f commit d820bc5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/2949-sseago
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Restore CRD Resource name to fix CRD wait functionality.
3 changes: 1 addition & 2 deletions pkg/backup/remap_crd_version_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
"k8s.io/apimachinery/pkg/runtime"

v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
"github.com/vmware-tanzu/velero/pkg/kuberesource"
"github.com/vmware-tanzu/velero/pkg/plugin/velero"
)

Expand Down Expand Up @@ -111,7 +110,7 @@ func fetchV1beta1CRD(name string, betaCRDClient apiextv1beta1client.CustomResour
// See https://github.com/kubernetes/kubernetes/issues/3030. Unsure why this is happening here and not in main Velero;
// probably has to do with List calls and Dynamic client vs typed client
// Set these all the time, since they shouldn't ever be different, anyway
betaCRD.Kind = kuberesource.CustomResourceDefinitions.Resource
betaCRD.Kind = "CustomResourceDefinition"
betaCRD.APIVersion = apiextv1beta1.SchemeGroupVersion.String()

m, err := runtime.DefaultUnstructuredConverter.ToUnstructured(&betaCRD)
Expand Down
2 changes: 1 addition & 1 deletion pkg/kuberesource/kuberesource.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
var (
ClusterRoleBindings = schema.GroupResource{Group: "rbac.authorization.k8s.io", Resource: "clusterrolebindings"}
ClusterRoles = schema.GroupResource{Group: "rbac.authorization.k8s.io", Resource: "clusterroles"}
CustomResourceDefinitions = schema.GroupResource{Group: "apiextensions.k8s.io", Resource: "CustomResourceDefinition"}
CustomResourceDefinitions = schema.GroupResource{Group: "apiextensions.k8s.io", Resource: "customresourcedefinitions"}
Jobs = schema.GroupResource{Group: "batch", Resource: "jobs"}
Namespaces = schema.GroupResource{Group: "", Resource: "namespaces"}
PersistentVolumeClaims = schema.GroupResource{Group: "", Resource: "persistentvolumeclaims"}
Expand Down

0 comments on commit d820bc5

Please sign in to comment.