Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Local Path Provisioner
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
Local Path Provisioner
Commits
154a153c
Commit
154a153c
authored
Oct 3, 2018
by
Sheng Yang
Browse files
Options
Downloads
Patches
Plain Diff
Add keyword DEFAULT_PATH_FOR_NON_LISTED_NODES
In order to setup default config.
parent
d913e48f
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
deploy/config-default.yaml
+16
-0
16 additions, 0 deletions
deploy/config-default.yaml
deploy/config-example.yaml
+4
-4
4 additions, 4 deletions
deploy/config-example.yaml
deploy/provisioner.yaml
+1
-1
1 addition, 1 deletion
deploy/provisioner.yaml
provisioner.go
+7
-1
7 additions, 1 deletion
provisioner.go
with
28 additions
and
6 deletions
deploy/config-default.yaml
0 → 100644
+
16
−
0
View file @
154a153c
kind
:
ConfigMap
apiVersion
:
v1
metadata
:
name
:
local-path-config
namespace
:
default
data
:
config.json
:
|-
{
"nodePathMap":[
{
"node":"DEFAULT_PATH_FOR_NON_LISTED_NODES",
"paths":["/opt/local-path-provisioner"]
}
]
}
This diff is collapsed.
Click to expand it.
deploy/example
-configmap
.yaml
→
deploy/
config-
example.yaml
+
4
−
4
View file @
154a153c
...
@@ -8,12 +8,12 @@ data:
...
@@ -8,12 +8,12 @@ data:
{
{
"nodePathMap":[
"nodePathMap":[
{
{
"node":"
yasker-lp-dev1
",
"node":"
DEFAULT_PATH_FOR_NON_LISTED_NODES
",
"paths":["/opt"
, "/data1"
]
"paths":["/opt"]
},
},
{
{
"node":"yasker-lp-dev
2
",
"node":"yasker-lp-dev
1
",
"paths":["/opt"]
"paths":["/opt"
, "/data1"
]
},
},
{
{
"node":"yasker-lp-dev3",
"node":"yasker-lp-dev3",
...
...
This diff is collapsed.
Click to expand it.
deploy/provisioner.yaml
+
1
−
1
View file @
154a153c
...
@@ -55,7 +55,7 @@ spec:
...
@@ -55,7 +55,7 @@ spec:
serviceAccountName
:
local-path-provisioner-service-account
serviceAccountName
:
local-path-provisioner-service-account
containers
:
containers
:
-
name
:
local-path-provisioner
-
name
:
local-path-provisioner
image
:
yasker/local-path-provisioner:
63df7c1
image
:
yasker/local-path-provisioner:
e862e16
imagePullPolicy
:
Always
imagePullPolicy
:
Always
command
:
command
:
-
local-path-provisioner
-
local-path-provisioner
...
...
This diff is collapsed.
Click to expand it.
provisioner.go
+
7
−
1
View file @
154a153c
...
@@ -19,6 +19,8 @@ import (
...
@@ -19,6 +19,8 @@ import (
const
(
const
(
KeyNode
=
"kubernetes.io/hostname"
KeyNode
=
"kubernetes.io/hostname"
NodeDefaultNonListedNodes
=
"DEFAULT_PATH_FOR_NON_LISTED_NODES"
)
)
var
(
var
(
...
@@ -50,7 +52,11 @@ type Config struct {
...
@@ -50,7 +52,11 @@ type Config struct {
func
(
c
*
Config
)
getRandomPathOnNode
(
node
string
)
(
string
,
error
)
{
func
(
c
*
Config
)
getRandomPathOnNode
(
node
string
)
(
string
,
error
)
{
npMap
:=
c
.
NodePathMap
[
node
]
npMap
:=
c
.
NodePathMap
[
node
]
if
npMap
==
nil
{
if
npMap
==
nil
{
return
""
,
fmt
.
Errorf
(
"config doesn't contain node %v"
,
node
)
npMap
=
c
.
NodePathMap
[
NodeDefaultNonListedNodes
]
if
npMap
==
nil
{
return
""
,
fmt
.
Errorf
(
"config doesn't contain node %v, and no %v available"
,
node
,
NodeDefaultNonListedNodes
)
}
logrus
.
Debugf
(
"config doesn't contain node %v, use %v instead"
,
node
,
NodeDefaultNonListedNodes
)
}
}
paths
:=
npMap
.
Paths
paths
:=
npMap
.
Paths
if
len
(
paths
)
==
0
{
if
len
(
paths
)
==
0
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment