Skip to content

Commit

Permalink
Merge pull request #1333 from SongGithub/master
Browse files Browse the repository at this point in the history
allow it to disable CRD creation
  • Loading branch information
ericchiang authored Nov 6, 2018
2 parents 65b0c91 + 5f0a03a commit 505aac7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions storage/kubernetes/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@ func (cli *client) registerCustomResources(useTPR bool) (ok bool) {
resourceName = r.ObjectMeta.Name
} else {
r := customResourceDefinitions[i]
var i interface{}
cli.logger.Infof("checking if custom resource %s has been created already...", r.ObjectMeta.Name)
if err := cli.list(r.Spec.Names.Plural, &i); err == nil {
cli.logger.Infof("The custom resource %s already available, skipping create", r.ObjectMeta.Name)
continue
} else {
cli.logger.Infof("failed to list custom resource %s, attempting to create: %v", r.ObjectMeta.Name, err)
}
err = cli.postResource("apiextensions.k8s.io/v1beta1", "", "customresourcedefinitions", r)
resourceName = r.ObjectMeta.Name
}
Expand Down

0 comments on commit 505aac7

Please sign in to comment.