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
2b19a4db
Commit
2b19a4db
authored
Apr 28, 2019
by
xiaojingchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix cmd/kube-controller-manager's golint failures
parent
f01c1401
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
5 deletions
+15
-5
controllermanager.go
cmd/kube-controller-manager/app/controllermanager.go
+11
-2
import_known_versions.go
cmd/kube-controller-manager/app/import_known_versions.go
+2
-1
plugins.go
cmd/kube-controller-manager/app/plugins.go
+1
-0
.golint_failures
hack/.golint_failures
+0
-1
broken_webhook_test.go
...gration/apiserver/admissionwebhook/broken_webhook_test.go
+1
-1
No files found.
cmd/kube-controller-manager/app/controllermanager.go
View file @
2b19a4db
...
@@ -72,16 +72,19 @@ import (
...
@@ -72,16 +72,19 @@ import (
)
)
const
(
const
(
// Jitter used when starting controller managers
//
ControllerStartJitter is the
Jitter used when starting controller managers
ControllerStartJitter
=
1.0
ControllerStartJitter
=
1.0
// ConfigzName is the name used for register kube-controller manager /configz, same with GroupName.
// ConfigzName is the name used for register kube-controller manager /configz, same with GroupName.
ConfigzName
=
"kubecontrollermanager.config.k8s.io"
ConfigzName
=
"kubecontrollermanager.config.k8s.io"
)
)
// ControllerLoopMode is the kube-controller-manager's mode of running controller loops that are cloud provider dependent
type
ControllerLoopMode
int
type
ControllerLoopMode
int
const
(
const
(
// IncludeCloudLoops means the kube-controller-manager include the controller loops that are cloud provider dependent
IncludeCloudLoops
ControllerLoopMode
=
iota
IncludeCloudLoops
ControllerLoopMode
=
iota
// ExternalLoops means the kube-controller-manager exclude the controller loops that are cloud provider dependent
ExternalLoops
ExternalLoops
)
)
...
@@ -284,6 +287,7 @@ func Run(c *config.CompletedConfig, stopCh <-chan struct{}) error {
...
@@ -284,6 +287,7 @@ func Run(c *config.CompletedConfig, stopCh <-chan struct{}) error {
panic
(
"unreachable"
)
panic
(
"unreachable"
)
}
}
// ControllerContext defines the context object for controller
type
ControllerContext
struct
{
type
ControllerContext
struct
{
// ClientBuilder will provide a client for this controller to use
// ClientBuilder will provide a client for this controller to use
ClientBuilder
controller
.
ControllerClientBuilder
ClientBuilder
controller
.
ControllerClientBuilder
...
@@ -328,6 +332,7 @@ type ControllerContext struct {
...
@@ -328,6 +332,7 @@ type ControllerContext struct {
ResyncPeriod
func
()
time
.
Duration
ResyncPeriod
func
()
time
.
Duration
}
}
// IsControllerEnabled checks if the context's controllers enabled or not
func
(
c
ControllerContext
)
IsControllerEnabled
(
name
string
)
bool
{
func
(
c
ControllerContext
)
IsControllerEnabled
(
name
string
)
bool
{
return
genericcontrollermanager
.
IsControllerEnabled
(
name
,
ControllersDisabledByDefault
,
c
.
ComponentConfig
.
Generic
.
Controllers
)
return
genericcontrollermanager
.
IsControllerEnabled
(
name
,
ControllersDisabledByDefault
,
c
.
ComponentConfig
.
Generic
.
Controllers
)
}
}
...
@@ -337,6 +342,7 @@ func (c ControllerContext) IsControllerEnabled(name string) bool {
...
@@ -337,6 +342,7 @@ func (c ControllerContext) IsControllerEnabled(name string) bool {
// The bool indicates whether the controller was enabled.
// The bool indicates whether the controller was enabled.
type
InitFunc
func
(
ctx
ControllerContext
)
(
debuggingHandler
http
.
Handler
,
enabled
bool
,
err
error
)
type
InitFunc
func
(
ctx
ControllerContext
)
(
debuggingHandler
http
.
Handler
,
enabled
bool
,
err
error
)
// KnownControllers returns all known controllers's name
func
KnownControllers
()
[]
string
{
func
KnownControllers
()
[]
string
{
ret
:=
sets
.
StringKeySet
(
NewControllerInitializers
(
IncludeCloudLoops
))
ret
:=
sets
.
StringKeySet
(
NewControllerInitializers
(
IncludeCloudLoops
))
...
@@ -351,6 +357,7 @@ func KnownControllers() []string {
...
@@ -351,6 +357,7 @@ func KnownControllers() []string {
return
ret
.
List
()
return
ret
.
List
()
}
}
// ControllersDisabledByDefault is the set of controllers which is disabled by default
var
ControllersDisabledByDefault
=
sets
.
NewString
(
var
ControllersDisabledByDefault
=
sets
.
NewString
(
"bootstrapsigner"
,
"bootstrapsigner"
,
"tokencleaner"
,
"tokencleaner"
,
...
@@ -405,8 +412,9 @@ func NewControllerInitializers(loopMode ControllerLoopMode) map[string]InitFunc
...
@@ -405,8 +412,9 @@ func NewControllerInitializers(loopMode ControllerLoopMode) map[string]InitFunc
return
controllers
return
controllers
}
}
// GetAvailableResources gets the map which contains all available resources of the apiserver
// TODO: In general, any controller checking this needs to be dynamic so
// TODO: In general, any controller checking this needs to be dynamic so
//
users don't have to restart their controller manager if they change the apiserver.
// users don't have to restart their controller manager if they change the apiserver.
// Until we get there, the structure here needs to be exposed for the construction of a proper ControllerContext.
// Until we get there, the structure here needs to be exposed for the construction of a proper ControllerContext.
func
GetAvailableResources
(
clientBuilder
controller
.
ControllerClientBuilder
)
(
map
[
schema
.
GroupVersionResource
]
bool
,
error
)
{
func
GetAvailableResources
(
clientBuilder
controller
.
ControllerClientBuilder
)
(
map
[
schema
.
GroupVersionResource
]
bool
,
error
)
{
client
:=
clientBuilder
.
ClientOrDie
(
"controller-discovery"
)
client
:=
clientBuilder
.
ClientOrDie
(
"controller-discovery"
)
...
@@ -484,6 +492,7 @@ func CreateControllerContext(s *config.CompletedConfig, rootClientBuilder, clien
...
@@ -484,6 +492,7 @@ func CreateControllerContext(s *config.CompletedConfig, rootClientBuilder, clien
return
ctx
,
nil
return
ctx
,
nil
}
}
// StartControllers starts a set of controllers with a specified ControllerContext
func
StartControllers
(
ctx
ControllerContext
,
startSATokenController
InitFunc
,
controllers
map
[
string
]
InitFunc
,
unsecuredMux
*
mux
.
PathRecorderMux
)
error
{
func
StartControllers
(
ctx
ControllerContext
,
startSATokenController
InitFunc
,
controllers
map
[
string
]
InitFunc
,
unsecuredMux
*
mux
.
PathRecorderMux
)
error
{
// Always start the SA token controller first using a full-power client, since it needs to mint tokens for the rest
// Always start the SA token controller first using a full-power client, since it needs to mint tokens for the rest
// If this fails, just return here and fail since other controllers won't be able to get credentials.
// If this fails, just return here and fail since other controllers won't be able to get credentials.
...
...
cmd/kube-controller-manager/app/import_known_versions.go
View file @
2b19a4db
...
@@ -14,12 +14,13 @@ See the License for the specific language governing permissions and
...
@@ -14,12 +14,13 @@ See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
*/
*/
// Package app imports the API groups that the client will support
// TODO: Remove this file when namespace controller and garbage collector
// TODO: Remove this file when namespace controller and garbage collector
// stops using legacyscheme.Registry.RESTMapper()
// stops using legacyscheme.Registry.RESTMapper()
package
app
package
app
// These imports are the API groups the client will support.
import
(
import
(
// These imports are the API groups the client will support.
_
"k8s.io/kubernetes/pkg/apis/apps/install"
_
"k8s.io/kubernetes/pkg/apis/apps/install"
_
"k8s.io/kubernetes/pkg/apis/authentication/install"
_
"k8s.io/kubernetes/pkg/apis/authentication/install"
_
"k8s.io/kubernetes/pkg/apis/authorization/install"
_
"k8s.io/kubernetes/pkg/apis/authorization/install"
...
...
cmd/kube-controller-manager/app/plugins.go
View file @
2b19a4db
...
@@ -27,6 +27,7 @@ import (
...
@@ -27,6 +27,7 @@ import (
// Cloud providers
// Cloud providers
cloudprovider
"k8s.io/cloud-provider"
cloudprovider
"k8s.io/cloud-provider"
// ensure the cloud providers are installed
_
"k8s.io/kubernetes/pkg/cloudprovider/providers"
_
"k8s.io/kubernetes/pkg/cloudprovider/providers"
// Volume plugins
// Volume plugins
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume"
...
...
hack/.golint_failures
View file @
2b19a4db
cmd/cloud-controller-manager/app/apis/config/v1alpha1
cmd/cloud-controller-manager/app/apis/config/v1alpha1
cmd/kube-apiserver/app
cmd/kube-apiserver/app
cmd/kube-controller-manager/app
cmd/kubeadm/app/apis/kubeadm/v1beta1
cmd/kubeadm/app/apis/kubeadm/v1beta1
cmd/kubeadm/app/apis/kubeadm/v1beta2
cmd/kubeadm/app/apis/kubeadm/v1beta2
pkg/apis/abac/latest
pkg/apis/abac/latest
...
...
test/integration/apiserver/admissionwebhook/broken_webhook_test.go
View file @
2b19a4db
...
@@ -150,7 +150,7 @@ func exampleDeployment(name string) *appsv1.Deployment {
...
@@ -150,7 +150,7 @@ func exampleDeployment(name string) *appsv1.Deployment {
func
brokenWebhookConfig
(
name
string
)
*
admissionregistrationv1beta1
.
ValidatingWebhookConfiguration
{
func
brokenWebhookConfig
(
name
string
)
*
admissionregistrationv1beta1
.
ValidatingWebhookConfiguration
{
var
path
string
var
path
string
var
failurePolicy
=
admissionregistrationv1beta1
.
Fail
failurePolicy
:
=
admissionregistrationv1beta1
.
Fail
return
&
admissionregistrationv1beta1
.
ValidatingWebhookConfiguration
{
return
&
admissionregistrationv1beta1
.
ValidatingWebhookConfiguration
{
ObjectMeta
:
metav1
.
ObjectMeta
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
name
,
Name
:
name
,
...
...
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