Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dex
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
dex
Commits
d2daa4e2
Commit
d2daa4e2
authored
Nov 02, 2018
by
Song.Jin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow it to disable CRD creation
parent
65b0c919
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
27 deletions
+29
-27
storage.go
storage/kubernetes/storage.go
+29
-27
No files found.
storage/kubernetes/storage.go
View file @
d2daa4e2
...
...
@@ -40,6 +40,7 @@ type Config struct {
InCluster
bool
`json:"inCluster"`
KubeConfigFile
string
`json:"kubeConfigFile"`
UseTPR
bool
`json:"useTPR"`
// Flag option to use TPRs instead of CRDs
NoCrdCreation
bool
`json:"noCrdCreation"`
// Flag to disable creation of CRDs at cluster level
}
// Open returns a storage using Kubernetes third party resource.
...
...
@@ -85,37 +86,38 @@ func (c *Config) open(logger logrus.FieldLogger, waitForResources bool) (*client
}
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
if
!
c
.
NoCrdCreation
{
logger
.
Info
(
"creating custom Kubernetes resources"
)
if
!
cli
.
registerCustomResources
(
c
.
UseTPR
)
{
if
waitForResources
{
cancel
()
return
nil
,
fmt
.
Errorf
(
"failed creating custom resources"
)
}
logger
.
Info
(
"creating custom Kubernetes resources"
)
if
!
cli
.
registerCustomResources
(
c
.
UseTPR
)
{
if
waitForResources
{
cancel
(
)
return
nil
,
fmt
.
Errorf
(
"failed creating custom resources"
)
}
// Try to synchronously create the custom resources once. This doesn't mea
n
// they'll immediately be available, but ensures that the client will actually try
// once.
logger
.
Errorf
(
"failed creating custom resources: %v"
,
err
)
go
func
()
{
for
{
if
cli
.
registerCustomResources
(
c
.
UseTPR
)
{
return
// Try to synchronously create the custom resources once. This doesn't mean
// they'll immediately be available, but ensures that the client will actually try
// once.
logger
.
Errorf
(
"failed creating custom resources: %v"
,
err
)
go
func
()
{
for
{
if
cli
.
registerCustomResources
(
c
.
UseTPR
)
{
retur
n
}
select
{
case
<-
ctx
.
Done
()
:
return
case
<-
time
.
After
(
30
*
time
.
Second
)
:
}
}
}()
}
select
{
case
<-
ctx
.
Done
()
:
return
case
<-
time
.
After
(
30
*
time
.
Second
)
:
}
if
waitForResources
{
if
err
:=
cli
.
waitForCRDs
(
ctx
);
err
!=
nil
{
cancel
()
return
nil
,
err
}
}()
}
if
waitForResources
{
if
err
:=
cli
.
waitForCRDs
(
ctx
);
err
!=
nil
{
cancel
()
return
nil
,
err
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment