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
4a660163
Unverified
Commit
4a660163
authored
Jun 25, 2018
by
Joel Speed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check client_ca configmap needs update
parent
c1ad6e96
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
2 deletions
+29
-2
client_ca_hook.go
pkg/master/client_ca_hook.go
+5
-2
client_ca_hook_test.go
pkg/master/client_ca_hook_test.go
+24
-0
No files found.
pkg/master/client_ca_hook.go
View file @
4a660163
...
@@ -19,6 +19,7 @@ package master
...
@@ -19,6 +19,7 @@ package master
import
(
import
(
"encoding/json"
"encoding/json"
"fmt"
"fmt"
"reflect"
"time"
"time"
apierrors
"k8s.io/apimachinery/pkg/api/errors"
apierrors
"k8s.io/apimachinery/pkg/api/errors"
...
@@ -131,7 +132,9 @@ func writeConfigMap(client coreclient.ConfigMapsGetter, name string, data map[st
...
@@ -131,7 +132,9 @@ func writeConfigMap(client coreclient.ConfigMapsGetter, name string, data map[st
return
err
return
err
}
}
existing
.
Data
=
data
if
!
reflect
.
DeepEqual
(
existing
.
Data
,
data
)
{
_
,
err
=
client
.
ConfigMaps
(
metav1
.
NamespaceSystem
)
.
Update
(
existing
)
existing
.
Data
=
data
_
,
err
=
client
.
ConfigMaps
(
metav1
.
NamespaceSystem
)
.
Update
(
existing
)
}
return
err
return
err
}
}
pkg/master/client_ca_hook_test.go
View file @
4a660163
...
@@ -186,6 +186,30 @@ func TestWriteClientCAs(t *testing.T) {
...
@@ -186,6 +186,30 @@ func TestWriteClientCAs(t *testing.T) {
},
},
},
},
},
},
{
name
:
"skip on no change"
,
hook
:
ClientCARegistrationHook
{
RequestHeaderUsernameHeaders
:
[]
string
{},
RequestHeaderGroupHeaders
:
[]
string
{},
RequestHeaderExtraHeaderPrefixes
:
[]
string
{},
RequestHeaderCA
:
[]
byte
(
"bar"
),
RequestHeaderAllowedNames
:
[]
string
{},
},
preexistingObjs
:
[]
runtime
.
Object
{
&
api
.
ConfigMap
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Namespace
:
metav1
.
NamespaceSystem
,
Name
:
"extension-apiserver-authentication"
},
Data
:
map
[
string
]
string
{
"requestheader-username-headers"
:
`[]`
,
"requestheader-group-headers"
:
`[]`
,
"requestheader-extra-headers-prefix"
:
`[]`
,
"requestheader-client-ca-file"
:
"bar"
,
"requestheader-allowed-names"
:
`[]`
,
},
},
},
expectedConfigMaps
:
map
[
string
]
*
api
.
ConfigMap
{},
expectUpdate
:
false
,
},
}
}
for
_
,
test
:=
range
tests
{
for
_
,
test
:=
range
tests
{
...
...
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