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
7c17beb6
Unverified
Commit
7c17beb6
authored
Oct 17, 2018
by
k8s-ci-robot
Committed by
GitHub
Oct 17, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #65477 from pusher/fix-client-ca-hook
Minimize writes to the client CA ConfigMap during API server start up
parents
688550b2
4a660163
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 @
7c17beb6
...
...
@@ -19,6 +19,7 @@ package master
import
(
"encoding/json"
"fmt"
"reflect"
"time"
apierrors
"k8s.io/apimachinery/pkg/api/errors"
...
...
@@ -131,7 +132,9 @@ func writeConfigMap(client coreclient.ConfigMapsGetter, name string, data map[st
return
err
}
existing
.
Data
=
data
_
,
err
=
client
.
ConfigMaps
(
metav1
.
NamespaceSystem
)
.
Update
(
existing
)
if
!
reflect
.
DeepEqual
(
existing
.
Data
,
data
)
{
existing
.
Data
=
data
_
,
err
=
client
.
ConfigMaps
(
metav1
.
NamespaceSystem
)
.
Update
(
existing
)
}
return
err
}
pkg/master/client_ca_hook_test.go
View file @
7c17beb6
...
...
@@ -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
{
...
...
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