Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
51fe9299
Commit
51fe9299
authored
Nov 20, 2017
by
stewart-yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
complish feature gate dependency in kubeadm
parent
3df3c580
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
0 deletions
+50
-0
features.go
cmd/kubeadm/app/features/features.go
+17
-0
features_test.go
cmd/kubeadm/app/features/features_test.go
+33
-0
No files found.
cmd/kubeadm/app/features/features.go
View file @
51fe9299
...
@@ -155,5 +155,22 @@ func NewFeatureGate(f *FeatureList, value string) (map[string]bool, error) {
...
@@ -155,5 +155,22 @@ func NewFeatureGate(f *FeatureList, value string) (map[string]bool, error) {
featureGate
[
k
]
=
boolValue
featureGate
[
k
]
=
boolValue
}
}
ResolveFeatureGateDependencies
(
featureGate
)
return
featureGate
,
nil
return
featureGate
,
nil
}
}
// ResolveFeatureGateDependencies resolve dependencies between feature gates
func
ResolveFeatureGateDependencies
(
featureGate
map
[
string
]
bool
)
{
// if StoreCertsInSecrets enabled, SelfHosting should enabled
if
Enabled
(
featureGate
,
StoreCertsInSecrets
)
{
featureGate
[
SelfHosting
]
=
true
}
// if HighAvailability enabled, both StoreCertsInSecrets and SelfHosting should enabled
if
Enabled
(
featureGate
,
HighAvailability
)
&&
!
Enabled
(
featureGate
,
StoreCertsInSecrets
)
{
featureGate
[
SelfHosting
]
=
true
featureGate
[
StoreCertsInSecrets
]
=
true
}
}
cmd/kubeadm/app/features/features_test.go
View file @
51fe9299
...
@@ -156,3 +156,36 @@ func TestValidateVersion(t *testing.T) {
...
@@ -156,3 +156,36 @@ func TestValidateVersion(t *testing.T) {
}
}
}
}
}
}
func
TestResolveFeatureGateDependencies
(
t
*
testing
.
T
)
{
var
tests
=
[]
struct
{
inputFeatures
map
[
string
]
bool
expectedFeatures
map
[
string
]
bool
}{
{
// no flags
inputFeatures
:
map
[
string
]
bool
{},
expectedFeatures
:
map
[
string
]
bool
{},
},
{
// others flags
inputFeatures
:
map
[
string
]
bool
{
"SupportIPVSProxyMode"
:
true
},
expectedFeatures
:
map
[
string
]
bool
{
"SupportIPVSProxyMode"
:
true
},
},
{
// just StoreCertsInSecrets flags
inputFeatures
:
map
[
string
]
bool
{
"StoreCertsInSecrets"
:
true
},
expectedFeatures
:
map
[
string
]
bool
{
"StoreCertsInSecrets"
:
true
,
"SelfHosting"
:
true
},
},
{
// just HighAvailability flags
inputFeatures
:
map
[
string
]
bool
{
"HighAvailability"
:
true
},
expectedFeatures
:
map
[
string
]
bool
{
"HighAvailability"
:
true
,
"StoreCertsInSecrets"
:
true
,
"SelfHosting"
:
true
},
},
}
for
_
,
test
:=
range
tests
{
ResolveFeatureGateDependencies
(
test
.
inputFeatures
)
if
!
reflect
.
DeepEqual
(
test
.
inputFeatures
,
test
.
expectedFeatures
)
{
t
.
Errorf
(
"ResolveFeatureGateDependencies failed, expected: %v, got: %v"
,
test
.
inputFeatures
,
test
.
expectedFeatures
)
}
}
}
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