Merge pull request #1333 from SongGithub/master

allow it to disable CRD creation
This commit is contained in:
Eric Chiang 2018-11-05 18:40:53 -08:00 committed by GitHub
commit 505aac753d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}