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
2e52d5c3
Unverified
Commit
2e52d5c3
authored
Jan 06, 2019
by
Lucas Käldström
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move k8s.io/{apiserver,apimachinery}/pkg/apis/config to…
Move k8s.io/{apiserver,apimachinery}/pkg/apis/config to k8s.io/component-base/config. Co-authored-by @Klaven
parent
ec68839a
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
257 additions
and
538 deletions
+257
-538
BUILD
...ng/src/k8s.io/apimachinery/pkg/apis/config/v1alpha1/BUILD
+0
-36
conversion.go
...8s.io/apimachinery/pkg/apis/config/v1alpha1/conversion.go
+0
-37
defaults.go
.../k8s.io/apimachinery/pkg/apis/config/v1alpha1/defaults.go
+0
-38
types.go
...src/k8s.io/apimachinery/pkg/apis/config/v1alpha1/types.go
+0
-33
zz_generated.conversion.go
...inery/pkg/apis/config/v1alpha1/zz_generated.conversion.go
+0
-75
zz_generated.deepcopy.go
...chinery/pkg/apis/config/v1alpha1/zz_generated.deepcopy.go
+0
-37
BUILD
.../src/k8s.io/apimachinery/pkg/apis/config/validation/BUILD
+0
-37
validation.go
....io/apimachinery/pkg/apis/config/validation/validation.go
+0
-31
validation_test.go
...pimachinery/pkg/apis/config/validation/validation_test.go
+0
-66
BUILD
staging/src/k8s.io/apiserver/pkg/apis/config/BUILD
+0
-2
types.go
staging/src/k8s.io/apiserver/pkg/apis/config/types.go
+0
-37
doc.go
staging/src/k8s.io/apiserver/pkg/apis/config/v1alpha1/doc.go
+0
-20
register.go
...src/k8s.io/apiserver/pkg/apis/config/v1alpha1/register.go
+0
-31
zz_generated.deepcopy.go
...k8s.io/apiserver/pkg/apis/config/zz_generated.deepcopy.go
+0
-35
BUILD
staging/src/k8s.io/component-base/config/BUILD
+5
-4
OWNERS
staging/src/k8s.io/component-base/config/OWNERS
+8
-3
doc.go
staging/src/k8s.io/component-base/config/doc.go
+1
-1
types.go
staging/src/k8s.io/component-base/config/types.go
+41
-0
BUILD
staging/src/k8s.io/component-base/config/v1alpha1/BUILD
+3
-3
conversion.go
...g/src/k8s.io/component-base/config/v1alpha1/conversion.go
+9
-1
defaults.go
...ing/src/k8s.io/component-base/config/v1alpha1/defaults.go
+21
-0
doc.go
staging/src/k8s.io/component-base/config/v1alpha1/doc.go
+2
-2
register.go
...ing/src/k8s.io/component-base/config/v1alpha1/register.go
+0
-0
types.go
staging/src/k8s.io/component-base/config/v1alpha1/types.go
+16
-0
zz_generated.conversion.go
...component-base/config/v1alpha1/zz_generated.conversion.go
+39
-1
zz_generated.deepcopy.go
...o/component-base/config/v1alpha1/zz_generated.deepcopy.go
+16
-0
BUILD
staging/src/k8s.io/component-base/config/validation/BUILD
+4
-4
validation.go
...src/k8s.io/component-base/config/validation/validation.go
+10
-1
validation_test.go
...8s.io/component-base/config/validation/validation_test.go
+47
-3
zz_generated.deepcopy.go
...src/k8s.io/component-base/config/zz_generated.deepcopy.go
+35
-0
No files found.
staging/src/k8s.io/apimachinery/pkg/apis/config/v1alpha1/BUILD
deleted
100644 → 0
View file @
ec68839a
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"conversion.go",
"defaults.go",
"doc.go",
"register.go",
"types.go",
"zz_generated.conversion.go",
"zz_generated.deepcopy.go",
],
importmap = "k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/config/v1alpha1",
importpath = "k8s.io/apimachinery/pkg/apis/config/v1alpha1",
visibility = ["//visibility:public"],
deps = [
"//staging/src/k8s.io/apimachinery/pkg/apis/config:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)
staging/src/k8s.io/apimachinery/pkg/apis/config/v1alpha1/conversion.go
deleted
100644 → 0
View file @
ec68839a
/*
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
v1alpha1
import
(
"k8s.io/apimachinery/pkg/apis/config"
"k8s.io/apimachinery/pkg/conversion"
)
// Important! The public back-and-forth conversion functions for the types in this generic
// package with ComponentConfig types need to be manually exposed like this in order for
// other packages that reference this package to be able to call these conversion functions
// in an autogenerated manner.
// TODO: Fix the bug in conversion-gen so it automatically discovers these Convert_* functions
// in autogenerated code as well.
func
Convert_v1alpha1_ClientConnectionConfiguration_To_config_ClientConnectionConfiguration
(
in
*
ClientConnectionConfiguration
,
out
*
config
.
ClientConnectionConfiguration
,
s
conversion
.
Scope
)
error
{
return
autoConvert_v1alpha1_ClientConnectionConfiguration_To_config_ClientConnectionConfiguration
(
in
,
out
,
s
)
}
func
Convert_config_ClientConnectionConfiguration_To_v1alpha1_ClientConnectionConfiguration
(
in
*
config
.
ClientConnectionConfiguration
,
out
*
ClientConnectionConfiguration
,
s
conversion
.
Scope
)
error
{
return
autoConvert_config_ClientConnectionConfiguration_To_v1alpha1_ClientConnectionConfiguration
(
in
,
out
,
s
)
}
staging/src/k8s.io/apimachinery/pkg/apis/config/v1alpha1/defaults.go
deleted
100644 → 0
View file @
ec68839a
/*
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
v1alpha1
// RecommendedDefaultClientConnectionConfiguration defaults a pointer to a
// ClientConnectionConfiguration struct. This will set the recommended default
// values, but they may be subject to change between API versions. This function
// is intentionally not registered in the scheme as a "normal" `SetDefaults_Foo`
// function to allow consumers of this type to set whatever defaults for their
// embedded configs. Forcing consumers to use these defaults would be problematic
// as defaulting in the scheme is done as part of the conversion, and there would
// be no easy way to opt-out. Instead, if you want to use this defaulting method
// run it in your wrapper struct of this type in its `SetDefaults_` method.
func
RecommendedDefaultClientConnectionConfiguration
(
obj
*
ClientConnectionConfiguration
)
{
if
len
(
obj
.
ContentType
)
==
0
{
obj
.
ContentType
=
"application/vnd.kubernetes.protobuf"
}
if
obj
.
QPS
==
0.0
{
obj
.
QPS
=
50.0
}
if
obj
.
Burst
==
0
{
obj
.
Burst
=
100
}
}
staging/src/k8s.io/apimachinery/pkg/apis/config/v1alpha1/types.go
deleted
100644 → 0
View file @
ec68839a
/*
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
v1alpha1
// ClientConnectionConfiguration contains details for constructing a client.
type
ClientConnectionConfiguration
struct
{
// kubeconfig is the path to a KubeConfig file.
Kubeconfig
string
`json:"kubeconfig"`
// acceptContentTypes defines the Accept header sent by clients when connecting to a server, overriding the
// default value of 'application/json'. This field will control all connections to the server used by a particular
// client.
AcceptContentTypes
string
`json:"acceptContentTypes"`
// contentType is the content type used when sending data to the server from this client.
ContentType
string
`json:"contentType"`
// qps controls the number of queries per second allowed for this connection.
QPS
float32
`json:"qps"`
// burst allows extra queries to accumulate when a client is exceeding its rate.
Burst
int32
`json:"burst"`
}
staging/src/k8s.io/apimachinery/pkg/apis/config/v1alpha1/zz_generated.conversion.go
deleted
100644 → 0
View file @
ec68839a
// +build !ignore_autogenerated
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by conversion-gen. DO NOT EDIT.
package
v1alpha1
import
(
config
"k8s.io/apimachinery/pkg/apis/config"
conversion
"k8s.io/apimachinery/pkg/conversion"
runtime
"k8s.io/apimachinery/pkg/runtime"
)
func
init
()
{
localSchemeBuilder
.
Register
(
RegisterConversions
)
}
// RegisterConversions adds conversion functions to the given scheme.
// Public to allow building arbitrary schemes.
func
RegisterConversions
(
s
*
runtime
.
Scheme
)
error
{
if
err
:=
s
.
AddGeneratedConversionFunc
((
*
ClientConnectionConfiguration
)(
nil
),
(
*
config
.
ClientConnectionConfiguration
)(
nil
),
func
(
a
,
b
interface
{},
scope
conversion
.
Scope
)
error
{
return
Convert_v1alpha1_ClientConnectionConfiguration_To_config_ClientConnectionConfiguration
(
a
.
(
*
ClientConnectionConfiguration
),
b
.
(
*
config
.
ClientConnectionConfiguration
),
scope
)
});
err
!=
nil
{
return
err
}
if
err
:=
s
.
AddGeneratedConversionFunc
((
*
config
.
ClientConnectionConfiguration
)(
nil
),
(
*
ClientConnectionConfiguration
)(
nil
),
func
(
a
,
b
interface
{},
scope
conversion
.
Scope
)
error
{
return
Convert_config_ClientConnectionConfiguration_To_v1alpha1_ClientConnectionConfiguration
(
a
.
(
*
config
.
ClientConnectionConfiguration
),
b
.
(
*
ClientConnectionConfiguration
),
scope
)
});
err
!=
nil
{
return
err
}
if
err
:=
s
.
AddConversionFunc
((
*
config
.
ClientConnectionConfiguration
)(
nil
),
(
*
ClientConnectionConfiguration
)(
nil
),
func
(
a
,
b
interface
{},
scope
conversion
.
Scope
)
error
{
return
Convert_config_ClientConnectionConfiguration_To_v1alpha1_ClientConnectionConfiguration
(
a
.
(
*
config
.
ClientConnectionConfiguration
),
b
.
(
*
ClientConnectionConfiguration
),
scope
)
});
err
!=
nil
{
return
err
}
if
err
:=
s
.
AddConversionFunc
((
*
ClientConnectionConfiguration
)(
nil
),
(
*
config
.
ClientConnectionConfiguration
)(
nil
),
func
(
a
,
b
interface
{},
scope
conversion
.
Scope
)
error
{
return
Convert_v1alpha1_ClientConnectionConfiguration_To_config_ClientConnectionConfiguration
(
a
.
(
*
ClientConnectionConfiguration
),
b
.
(
*
config
.
ClientConnectionConfiguration
),
scope
)
});
err
!=
nil
{
return
err
}
return
nil
}
func
autoConvert_v1alpha1_ClientConnectionConfiguration_To_config_ClientConnectionConfiguration
(
in
*
ClientConnectionConfiguration
,
out
*
config
.
ClientConnectionConfiguration
,
s
conversion
.
Scope
)
error
{
out
.
Kubeconfig
=
in
.
Kubeconfig
out
.
AcceptContentTypes
=
in
.
AcceptContentTypes
out
.
ContentType
=
in
.
ContentType
out
.
QPS
=
in
.
QPS
out
.
Burst
=
in
.
Burst
return
nil
}
func
autoConvert_config_ClientConnectionConfiguration_To_v1alpha1_ClientConnectionConfiguration
(
in
*
config
.
ClientConnectionConfiguration
,
out
*
ClientConnectionConfiguration
,
s
conversion
.
Scope
)
error
{
out
.
Kubeconfig
=
in
.
Kubeconfig
out
.
AcceptContentTypes
=
in
.
AcceptContentTypes
out
.
ContentType
=
in
.
ContentType
out
.
QPS
=
in
.
QPS
out
.
Burst
=
in
.
Burst
return
nil
}
staging/src/k8s.io/apimachinery/pkg/apis/config/v1alpha1/zz_generated.deepcopy.go
deleted
100644 → 0
View file @
ec68839a
// +build !ignore_autogenerated
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by deepcopy-gen. DO NOT EDIT.
package
v1alpha1
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func
(
in
*
ClientConnectionConfiguration
)
DeepCopyInto
(
out
*
ClientConnectionConfiguration
)
{
*
out
=
*
in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientConnectionConfiguration.
func
(
in
*
ClientConnectionConfiguration
)
DeepCopy
()
*
ClientConnectionConfiguration
{
if
in
==
nil
{
return
nil
}
out
:=
new
(
ClientConnectionConfiguration
)
in
.
DeepCopyInto
(
out
)
return
out
}
staging/src/k8s.io/apimachinery/pkg/apis/config/validation/BUILD
deleted
100644 → 0
View file @
ec68839a
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = ["validation.go"],
importmap = "k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/config/validation",
importpath = "k8s.io/apimachinery/pkg/apis/config/validation",
visibility = ["//visibility:public"],
deps = [
"//staging/src/k8s.io/apimachinery/pkg/apis/config:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/validation/field:go_default_library",
],
)
go_test(
name = "go_default_test",
srcs = ["validation_test.go"],
embed = [":go_default_library"],
deps = [
"//staging/src/k8s.io/apimachinery/pkg/apis/config:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/validation/field:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)
staging/src/k8s.io/apimachinery/pkg/apis/config/validation/validation.go
deleted
100644 → 0
View file @
ec68839a
/*
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
validation
import
(
"k8s.io/apimachinery/pkg/apis/config"
"k8s.io/apimachinery/pkg/util/validation/field"
)
// ValidateClientConnectionConfiguration ensures validation of the ClientConnectionConfiguration struct
func
ValidateClientConnectionConfiguration
(
cc
*
config
.
ClientConnectionConfiguration
,
fldPath
*
field
.
Path
)
field
.
ErrorList
{
allErrs
:=
field
.
ErrorList
{}
if
cc
.
Burst
<
0
{
allErrs
=
append
(
allErrs
,
field
.
Invalid
(
fldPath
.
Child
(
"burst"
),
cc
.
Burst
,
"must be non-negative"
))
}
return
allErrs
}
staging/src/k8s.io/apimachinery/pkg/apis/config/validation/validation_test.go
deleted
100644 → 0
View file @
ec68839a
/*
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
validation
import
(
"k8s.io/apimachinery/pkg/apis/config"
"k8s.io/apimachinery/pkg/util/validation/field"
"testing"
)
func
TestValidateClientConnectionConfiguration
(
t
*
testing
.
T
)
{
validConfig
:=
&
config
.
ClientConnectionConfiguration
{
AcceptContentTypes
:
"application/json"
,
ContentType
:
"application/json"
,
QPS
:
10
,
Burst
:
10
,
}
qpsLessThanZero
:=
validConfig
.
DeepCopy
()
qpsLessThanZero
.
QPS
=
-
1
burstLessThanZero
:=
validConfig
.
DeepCopy
()
burstLessThanZero
.
Burst
=
-
1
scenarios
:=
map
[
string
]
struct
{
expectedToFail
bool
config
*
config
.
ClientConnectionConfiguration
}{
"good"
:
{
expectedToFail
:
false
,
config
:
validConfig
,
},
"good-qps-less-than-zero"
:
{
expectedToFail
:
false
,
config
:
qpsLessThanZero
,
},
"bad-burst-less-then-zero"
:
{
expectedToFail
:
true
,
config
:
burstLessThanZero
,
},
}
for
name
,
scenario
:=
range
scenarios
{
errs
:=
ValidateClientConnectionConfiguration
(
scenario
.
config
,
field
.
NewPath
(
"clientConnectionConfiguration"
))
if
len
(
errs
)
==
0
&&
scenario
.
expectedToFail
{
t
.
Errorf
(
"Unexpected success for scenario: %s"
,
name
)
}
if
len
(
errs
)
>
0
&&
!
scenario
.
expectedToFail
{
t
.
Errorf
(
"Unexpected failure for scenario: %s - %+v"
,
name
,
errs
)
}
}
}
staging/src/k8s.io/apiserver/pkg/apis/config/BUILD
View file @
2e52d5c3
...
@@ -30,8 +30,6 @@ filegroup(
...
@@ -30,8 +30,6 @@ filegroup(
srcs = [
srcs = [
":package-srcs",
":package-srcs",
"//staging/src/k8s.io/apiserver/pkg/apis/config/v1:all-srcs",
"//staging/src/k8s.io/apiserver/pkg/apis/config/v1:all-srcs",
"//staging/src/k8s.io/apiserver/pkg/apis/config/v1alpha1:all-srcs",
"//staging/src/k8s.io/apiserver/pkg/apis/config/validation:all-srcs",
],
],
tags = ["automanaged"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
visibility = ["//visibility:public"],
...
...
staging/src/k8s.io/apiserver/pkg/apis/config/types.go
View file @
2e52d5c3
...
@@ -20,43 +20,6 @@ import (
...
@@ -20,43 +20,6 @@ import (
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
)
)
// LeaderElectionConfiguration defines the configuration of leader election
// clients for components that can run with leader election enabled.
type
LeaderElectionConfiguration
struct
{
// leaderElect enables a leader election client to gain leadership
// before executing the main loop. Enable this when running replicated
// components for high availability.
LeaderElect
bool
// leaseDuration is the duration that non-leader candidates will wait
// after observing a leadership renewal until attempting to acquire
// leadership of a led but unrenewed leader slot. This is effectively the
// maximum duration that a leader can be stopped before it is replaced
// by another candidate. This is only applicable if leader election is
// enabled.
LeaseDuration
metav1
.
Duration
// renewDeadline is the interval between attempts by the acting master to
// renew a leadership slot before it stops leading. This must be less
// than or equal to the lease duration. This is only applicable if leader
// election is enabled.
RenewDeadline
metav1
.
Duration
// retryPeriod is the duration the clients should wait between attempting
// acquisition and renewal of a leadership. This is only applicable if
// leader election is enabled.
RetryPeriod
metav1
.
Duration
// resourceLock indicates the resource object type that will be used to lock
// during leader election cycles.
ResourceLock
string
}
// DebuggingConfiguration holds configuration for Debugging related features.
type
DebuggingConfiguration
struct
{
// enableProfiling enables profiling via web interface host:port/debug/pprof/
EnableProfiling
bool
// enableContentionProfiling enables lock contention profiling, if
// enableProfiling is true.
EnableContentionProfiling
bool
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// EncryptionConfiguration stores the complete configuration for encryption providers.
// EncryptionConfiguration stores the complete configuration for encryption providers.
...
...
staging/src/k8s.io/apiserver/pkg/apis/config/v1alpha1/doc.go
deleted
100644 → 0
View file @
ec68839a
/*
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// +k8s:deepcopy-gen=package
// +k8s:conversion-gen=k8s.io/apiserver/pkg/apis/config
package
v1alpha1
// import "k8s.io/apiserver/pkg/apis/config/v1alpha1"
staging/src/k8s.io/apiserver/pkg/apis/config/v1alpha1/register.go
deleted
100644 → 0
View file @
ec68839a
/*
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
v1alpha1
import
(
"k8s.io/apimachinery/pkg/runtime"
)
var
(
// SchemeBuilder is the scheme builder with scheme init functions to run for this API package
SchemeBuilder
runtime
.
SchemeBuilder
// localSchemeBuilder extends the SchemeBuilder instance with the external types. In this package,
// defaulting and conversion init funcs are registered as well.
localSchemeBuilder
=
&
SchemeBuilder
// AddToScheme is a global function that registers this API group & version to a scheme
AddToScheme
=
localSchemeBuilder
.
AddToScheme
)
staging/src/k8s.io/apiserver/pkg/apis/config/zz_generated.deepcopy.go
View file @
2e52d5c3
...
@@ -46,22 +46,6 @@ func (in *AESConfiguration) DeepCopy() *AESConfiguration {
...
@@ -46,22 +46,6 @@ func (in *AESConfiguration) DeepCopy() *AESConfiguration {
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func
(
in
*
DebuggingConfiguration
)
DeepCopyInto
(
out
*
DebuggingConfiguration
)
{
*
out
=
*
in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DebuggingConfiguration.
func
(
in
*
DebuggingConfiguration
)
DeepCopy
()
*
DebuggingConfiguration
{
if
in
==
nil
{
return
nil
}
out
:=
new
(
DebuggingConfiguration
)
in
.
DeepCopyInto
(
out
)
return
out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func
(
in
*
EncryptionConfiguration
)
DeepCopyInto
(
out
*
EncryptionConfiguration
)
{
func
(
in
*
EncryptionConfiguration
)
DeepCopyInto
(
out
*
EncryptionConfiguration
)
{
*
out
=
*
in
*
out
=
*
in
out
.
TypeMeta
=
in
.
TypeMeta
out
.
TypeMeta
=
in
.
TypeMeta
...
@@ -142,25 +126,6 @@ func (in *Key) DeepCopy() *Key {
...
@@ -142,25 +126,6 @@ func (in *Key) DeepCopy() *Key {
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func
(
in
*
LeaderElectionConfiguration
)
DeepCopyInto
(
out
*
LeaderElectionConfiguration
)
{
*
out
=
*
in
out
.
LeaseDuration
=
in
.
LeaseDuration
out
.
RenewDeadline
=
in
.
RenewDeadline
out
.
RetryPeriod
=
in
.
RetryPeriod
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LeaderElectionConfiguration.
func
(
in
*
LeaderElectionConfiguration
)
DeepCopy
()
*
LeaderElectionConfiguration
{
if
in
==
nil
{
return
nil
}
out
:=
new
(
LeaderElectionConfiguration
)
in
.
DeepCopyInto
(
out
)
return
out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func
(
in
*
ProviderConfiguration
)
DeepCopyInto
(
out
*
ProviderConfiguration
)
{
func
(
in
*
ProviderConfiguration
)
DeepCopyInto
(
out
*
ProviderConfiguration
)
{
*
out
=
*
in
*
out
=
*
in
if
in
.
AESGCM
!=
nil
{
if
in
.
AESGCM
!=
nil
{
...
...
staging/src/k8s.io/
apimachinery/pkg/apis
/config/BUILD
→
staging/src/k8s.io/
component-base
/config/BUILD
View file @
2e52d5c3
...
@@ -7,9 +7,10 @@ go_library(
...
@@ -7,9 +7,10 @@ go_library(
"types.go",
"types.go",
"zz_generated.deepcopy.go",
"zz_generated.deepcopy.go",
],
],
importmap = "k8s.io/kubernetes/vendor/k8s.io/
apimachinery/pkg/apis
/config",
importmap = "k8s.io/kubernetes/vendor/k8s.io/
component-base
/config",
importpath = "k8s.io/
apimachinery/pkg/apis
/config",
importpath = "k8s.io/
component-base
/config",
visibility = ["//visibility:public"],
visibility = ["//visibility:public"],
deps = ["//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library"],
)
)
filegroup(
filegroup(
...
@@ -23,8 +24,8 @@ filegroup(
...
@@ -23,8 +24,8 @@ filegroup(
name = "all-srcs",
name = "all-srcs",
srcs = [
srcs = [
":package-srcs",
":package-srcs",
"//staging/src/k8s.io/
apimachinery/pkg/apis
/config/v1alpha1:all-srcs",
"//staging/src/k8s.io/
component-base
/config/v1alpha1:all-srcs",
"//staging/src/k8s.io/
apimachinery/pkg/apis
/config/validation:all-srcs",
"//staging/src/k8s.io/
component-base
/config/validation:all-srcs",
],
],
tags = ["automanaged"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
visibility = ["//visibility:public"],
...
...
staging/src/k8s.io/
apimachinery/pkg/apis
/config/OWNERS
→
staging/src/k8s.io/
component-base
/config/OWNERS
View file @
2e52d5c3
# Disable inheritance as this is an api owners file
options:
no_parent_owners: true
approvers:
approvers:
- api-approvers
- api-approvers
- sttts
- luxas
reviewers:
reviewers:
- api-reviewers
- api-reviewers
- hanxiaoshuai
- luxas
- mtaufen
- sttts
labels:
- kind/api-change
staging/src/k8s.io/
apimachinery/pkg/apis
/config/doc.go
→
staging/src/k8s.io/
component-base
/config/doc.go
View file @
2e52d5c3
...
@@ -16,4 +16,4 @@ limitations under the License.
...
@@ -16,4 +16,4 @@ limitations under the License.
// +k8s:deepcopy-gen=package
// +k8s:deepcopy-gen=package
package
config
// import "k8s.io/
apimachinery/pkg/apis
/config"
package
config
// import "k8s.io/
component-base
/config"
staging/src/k8s.io/
apimachinery/pkg/apis
/config/types.go
→
staging/src/k8s.io/
component-base
/config/types.go
View file @
2e52d5c3
...
@@ -16,6 +16,10 @@ limitations under the License.
...
@@ -16,6 +16,10 @@ limitations under the License.
package
config
package
config
import
(
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
)
// ClientConnectionConfiguration contains details for constructing a client.
// ClientConnectionConfiguration contains details for constructing a client.
type
ClientConnectionConfiguration
struct
{
type
ClientConnectionConfiguration
struct
{
// kubeconfig is the path to a KubeConfig file.
// kubeconfig is the path to a KubeConfig file.
...
@@ -31,3 +35,40 @@ type ClientConnectionConfiguration struct {
...
@@ -31,3 +35,40 @@ type ClientConnectionConfiguration struct {
// burst allows extra queries to accumulate when a client is exceeding its rate.
// burst allows extra queries to accumulate when a client is exceeding its rate.
Burst
int32
Burst
int32
}
}
// LeaderElectionConfiguration defines the configuration of leader election
// clients for components that can run with leader election enabled.
type
LeaderElectionConfiguration
struct
{
// leaderElect enables a leader election client to gain leadership
// before executing the main loop. Enable this when running replicated
// components for high availability.
LeaderElect
bool
// leaseDuration is the duration that non-leader candidates will wait
// after observing a leadership renewal until attempting to acquire
// leadership of a led but unrenewed leader slot. This is effectively the
// maximum duration that a leader can be stopped before it is replaced
// by another candidate. This is only applicable if leader election is
// enabled.
LeaseDuration
metav1
.
Duration
// renewDeadline is the interval between attempts by the acting master to
// renew a leadership slot before it stops leading. This must be less
// than or equal to the lease duration. This is only applicable if leader
// election is enabled.
RenewDeadline
metav1
.
Duration
// retryPeriod is the duration the clients should wait between attempting
// acquisition and renewal of a leadership. This is only applicable if
// leader election is enabled.
RetryPeriod
metav1
.
Duration
// resourceLock indicates the resource object type that will be used to lock
// during leader election cycles.
ResourceLock
string
}
// DebuggingConfiguration holds configuration for Debugging related features.
type
DebuggingConfiguration
struct
{
// enableProfiling enables profiling via web interface host:port/debug/pprof/
EnableProfiling
bool
// enableContentionProfiling enables lock contention profiling, if
// enableProfiling is true.
EnableContentionProfiling
bool
}
staging/src/k8s.io/
apiserver/pkg/apis
/config/v1alpha1/BUILD
→
staging/src/k8s.io/
component-base
/config/v1alpha1/BUILD
View file @
2e52d5c3
...
@@ -11,14 +11,14 @@ go_library(
...
@@ -11,14 +11,14 @@ go_library(
"zz_generated.conversion.go",
"zz_generated.conversion.go",
"zz_generated.deepcopy.go",
"zz_generated.deepcopy.go",
],
],
importmap = "k8s.io/kubernetes/vendor/k8s.io/
apiserver/pkg/apis
/config/v1alpha1",
importmap = "k8s.io/kubernetes/vendor/k8s.io/
component-base
/config/v1alpha1",
importpath = "k8s.io/
apiserver/pkg/apis
/config/v1alpha1",
importpath = "k8s.io/
component-base
/config/v1alpha1",
visibility = ["//visibility:public"],
visibility = ["//visibility:public"],
deps = [
deps = [
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/
apiserver/pkg/apis
/config:go_default_library",
"//staging/src/k8s.io/
component-base
/config:go_default_library",
"//vendor/k8s.io/utils/pointer:go_default_library",
"//vendor/k8s.io/utils/pointer:go_default_library",
],
],
)
)
...
...
staging/src/k8s.io/
apiserver/pkg/apis
/config/v1alpha1/conversion.go
→
staging/src/k8s.io/
component-base
/config/v1alpha1/conversion.go
View file @
2e52d5c3
...
@@ -18,7 +18,7 @@ package v1alpha1
...
@@ -18,7 +18,7 @@ package v1alpha1
import
(
import
(
"k8s.io/apimachinery/pkg/conversion"
"k8s.io/apimachinery/pkg/conversion"
"k8s.io/
apiserver/pkg/apis
/config"
"k8s.io/
component-base
/config"
)
)
// Important! The public back-and-forth conversion functions for the types in this generic
// Important! The public back-and-forth conversion functions for the types in this generic
...
@@ -28,6 +28,14 @@ import (
...
@@ -28,6 +28,14 @@ import (
// TODO: Fix the bug in conversion-gen so it automatically discovers these Convert_* functions
// TODO: Fix the bug in conversion-gen so it automatically discovers these Convert_* functions
// in autogenerated code as well.
// in autogenerated code as well.
func
Convert_v1alpha1_ClientConnectionConfiguration_To_config_ClientConnectionConfiguration
(
in
*
ClientConnectionConfiguration
,
out
*
config
.
ClientConnectionConfiguration
,
s
conversion
.
Scope
)
error
{
return
autoConvert_v1alpha1_ClientConnectionConfiguration_To_config_ClientConnectionConfiguration
(
in
,
out
,
s
)
}
func
Convert_config_ClientConnectionConfiguration_To_v1alpha1_ClientConnectionConfiguration
(
in
*
config
.
ClientConnectionConfiguration
,
out
*
ClientConnectionConfiguration
,
s
conversion
.
Scope
)
error
{
return
autoConvert_config_ClientConnectionConfiguration_To_v1alpha1_ClientConnectionConfiguration
(
in
,
out
,
s
)
}
func
Convert_v1alpha1_DebuggingConfiguration_To_config_DebuggingConfiguration
(
in
*
DebuggingConfiguration
,
out
*
config
.
DebuggingConfiguration
,
s
conversion
.
Scope
)
error
{
func
Convert_v1alpha1_DebuggingConfiguration_To_config_DebuggingConfiguration
(
in
*
DebuggingConfiguration
,
out
*
config
.
DebuggingConfiguration
,
s
conversion
.
Scope
)
error
{
return
autoConvert_v1alpha1_DebuggingConfiguration_To_config_DebuggingConfiguration
(
in
,
out
,
s
)
return
autoConvert_v1alpha1_DebuggingConfiguration_To_config_DebuggingConfiguration
(
in
,
out
,
s
)
}
}
...
...
staging/src/k8s.io/
apiserver/pkg/apis
/config/v1alpha1/defaults.go
→
staging/src/k8s.io/
component-base
/config/v1alpha1/defaults.go
View file @
2e52d5c3
...
@@ -50,3 +50,24 @@ func RecommendedDefaultLeaderElectionConfiguration(obj *LeaderElectionConfigurat
...
@@ -50,3 +50,24 @@ func RecommendedDefaultLeaderElectionConfiguration(obj *LeaderElectionConfigurat
obj
.
LeaderElect
=
utilpointer
.
BoolPtr
(
true
)
obj
.
LeaderElect
=
utilpointer
.
BoolPtr
(
true
)
}
}
}
}
// RecommendedDefaultClientConnectionConfiguration defaults a pointer to a
// ClientConnectionConfiguration struct. This will set the recommended default
// values, but they may be subject to change between API versions. This function
// is intentionally not registered in the scheme as a "normal" `SetDefaults_Foo`
// function to allow consumers of this type to set whatever defaults for their
// embedded configs. Forcing consumers to use these defaults would be problematic
// as defaulting in the scheme is done as part of the conversion, and there would
// be no easy way to opt-out. Instead, if you want to use this defaulting method
// run it in your wrapper struct of this type in its `SetDefaults_` method.
func
RecommendedDefaultClientConnectionConfiguration
(
obj
*
ClientConnectionConfiguration
)
{
if
len
(
obj
.
ContentType
)
==
0
{
obj
.
ContentType
=
"application/vnd.kubernetes.protobuf"
}
if
obj
.
QPS
==
0.0
{
obj
.
QPS
=
50.0
}
if
obj
.
Burst
==
0
{
obj
.
Burst
=
100
}
}
staging/src/k8s.io/
apimachinery/pkg/apis
/config/v1alpha1/doc.go
→
staging/src/k8s.io/
component-base
/config/v1alpha1/doc.go
View file @
2e52d5c3
...
@@ -15,6 +15,6 @@ limitations under the License.
...
@@ -15,6 +15,6 @@ limitations under the License.
*/
*/
// +k8s:deepcopy-gen=package
// +k8s:deepcopy-gen=package
// +k8s:conversion-gen=k8s.io/
apimachinery/pkg/apis
/config
// +k8s:conversion-gen=k8s.io/
component-base
/config
package
v1alpha1
// import "k8s.io/
apimachinery/pkg/apis
/config/v1alpha1"
package
v1alpha1
// import "k8s.io/
component-base
/config/v1alpha1"
staging/src/k8s.io/
apimachinery/pkg/apis
/config/v1alpha1/register.go
→
staging/src/k8s.io/
component-base
/config/v1alpha1/register.go
View file @
2e52d5c3
File moved
staging/src/k8s.io/
apiserver/pkg/apis
/config/v1alpha1/types.go
→
staging/src/k8s.io/
component-base
/config/v1alpha1/types.go
View file @
2e52d5c3
...
@@ -58,3 +58,19 @@ type DebuggingConfiguration struct {
...
@@ -58,3 +58,19 @@ type DebuggingConfiguration struct {
// enableProfiling is true.
// enableProfiling is true.
EnableContentionProfiling
bool
`json:"enableContentionProfiling"`
EnableContentionProfiling
bool
`json:"enableContentionProfiling"`
}
}
// ClientConnectionConfiguration contains details for constructing a client.
type
ClientConnectionConfiguration
struct
{
// kubeconfig is the path to a KubeConfig file.
Kubeconfig
string
`json:"kubeconfig"`
// acceptContentTypes defines the Accept header sent by clients when connecting to a server, overriding the
// default value of 'application/json'. This field will control all connections to the server used by a particular
// client.
AcceptContentTypes
string
`json:"acceptContentTypes"`
// contentType is the content type used when sending data to the server from this client.
ContentType
string
`json:"contentType"`
// qps controls the number of queries per second allowed for this connection.
QPS
float32
`json:"qps"`
// burst allows extra queries to accumulate when a client is exceeding its rate.
Burst
int32
`json:"burst"`
}
staging/src/k8s.io/
apiserver/pkg/apis
/config/v1alpha1/zz_generated.conversion.go
→
staging/src/k8s.io/
component-base
/config/v1alpha1/zz_generated.conversion.go
View file @
2e52d5c3
...
@@ -24,7 +24,7 @@ import (
...
@@ -24,7 +24,7 @@ import (
v1
"k8s.io/apimachinery/pkg/apis/meta/v1"
v1
"k8s.io/apimachinery/pkg/apis/meta/v1"
conversion
"k8s.io/apimachinery/pkg/conversion"
conversion
"k8s.io/apimachinery/pkg/conversion"
runtime
"k8s.io/apimachinery/pkg/runtime"
runtime
"k8s.io/apimachinery/pkg/runtime"
config
"k8s.io/
apiserver/pkg/apis
/config"
config
"k8s.io/
component-base
/config"
)
)
func
init
()
{
func
init
()
{
...
@@ -34,6 +34,16 @@ func init() {
...
@@ -34,6 +34,16 @@ func init() {
// RegisterConversions adds conversion functions to the given scheme.
// RegisterConversions adds conversion functions to the given scheme.
// Public to allow building arbitrary schemes.
// Public to allow building arbitrary schemes.
func
RegisterConversions
(
s
*
runtime
.
Scheme
)
error
{
func
RegisterConversions
(
s
*
runtime
.
Scheme
)
error
{
if
err
:=
s
.
AddGeneratedConversionFunc
((
*
ClientConnectionConfiguration
)(
nil
),
(
*
config
.
ClientConnectionConfiguration
)(
nil
),
func
(
a
,
b
interface
{},
scope
conversion
.
Scope
)
error
{
return
Convert_v1alpha1_ClientConnectionConfiguration_To_config_ClientConnectionConfiguration
(
a
.
(
*
ClientConnectionConfiguration
),
b
.
(
*
config
.
ClientConnectionConfiguration
),
scope
)
});
err
!=
nil
{
return
err
}
if
err
:=
s
.
AddGeneratedConversionFunc
((
*
config
.
ClientConnectionConfiguration
)(
nil
),
(
*
ClientConnectionConfiguration
)(
nil
),
func
(
a
,
b
interface
{},
scope
conversion
.
Scope
)
error
{
return
Convert_config_ClientConnectionConfiguration_To_v1alpha1_ClientConnectionConfiguration
(
a
.
(
*
config
.
ClientConnectionConfiguration
),
b
.
(
*
ClientConnectionConfiguration
),
scope
)
});
err
!=
nil
{
return
err
}
if
err
:=
s
.
AddGeneratedConversionFunc
((
*
DebuggingConfiguration
)(
nil
),
(
*
config
.
DebuggingConfiguration
)(
nil
),
func
(
a
,
b
interface
{},
scope
conversion
.
Scope
)
error
{
if
err
:=
s
.
AddGeneratedConversionFunc
((
*
DebuggingConfiguration
)(
nil
),
(
*
config
.
DebuggingConfiguration
)(
nil
),
func
(
a
,
b
interface
{},
scope
conversion
.
Scope
)
error
{
return
Convert_v1alpha1_DebuggingConfiguration_To_config_DebuggingConfiguration
(
a
.
(
*
DebuggingConfiguration
),
b
.
(
*
config
.
DebuggingConfiguration
),
scope
)
return
Convert_v1alpha1_DebuggingConfiguration_To_config_DebuggingConfiguration
(
a
.
(
*
DebuggingConfiguration
),
b
.
(
*
config
.
DebuggingConfiguration
),
scope
)
});
err
!=
nil
{
});
err
!=
nil
{
...
@@ -54,6 +64,11 @@ func RegisterConversions(s *runtime.Scheme) error {
...
@@ -54,6 +64,11 @@ func RegisterConversions(s *runtime.Scheme) error {
});
err
!=
nil
{
});
err
!=
nil
{
return
err
return
err
}
}
if
err
:=
s
.
AddConversionFunc
((
*
config
.
ClientConnectionConfiguration
)(
nil
),
(
*
ClientConnectionConfiguration
)(
nil
),
func
(
a
,
b
interface
{},
scope
conversion
.
Scope
)
error
{
return
Convert_config_ClientConnectionConfiguration_To_v1alpha1_ClientConnectionConfiguration
(
a
.
(
*
config
.
ClientConnectionConfiguration
),
b
.
(
*
ClientConnectionConfiguration
),
scope
)
});
err
!=
nil
{
return
err
}
if
err
:=
s
.
AddConversionFunc
((
*
config
.
DebuggingConfiguration
)(
nil
),
(
*
DebuggingConfiguration
)(
nil
),
func
(
a
,
b
interface
{},
scope
conversion
.
Scope
)
error
{
if
err
:=
s
.
AddConversionFunc
((
*
config
.
DebuggingConfiguration
)(
nil
),
(
*
DebuggingConfiguration
)(
nil
),
func
(
a
,
b
interface
{},
scope
conversion
.
Scope
)
error
{
return
Convert_config_DebuggingConfiguration_To_v1alpha1_DebuggingConfiguration
(
a
.
(
*
config
.
DebuggingConfiguration
),
b
.
(
*
DebuggingConfiguration
),
scope
)
return
Convert_config_DebuggingConfiguration_To_v1alpha1_DebuggingConfiguration
(
a
.
(
*
config
.
DebuggingConfiguration
),
b
.
(
*
DebuggingConfiguration
),
scope
)
});
err
!=
nil
{
});
err
!=
nil
{
...
@@ -64,6 +79,11 @@ func RegisterConversions(s *runtime.Scheme) error {
...
@@ -64,6 +79,11 @@ func RegisterConversions(s *runtime.Scheme) error {
});
err
!=
nil
{
});
err
!=
nil
{
return
err
return
err
}
}
if
err
:=
s
.
AddConversionFunc
((
*
ClientConnectionConfiguration
)(
nil
),
(
*
config
.
ClientConnectionConfiguration
)(
nil
),
func
(
a
,
b
interface
{},
scope
conversion
.
Scope
)
error
{
return
Convert_v1alpha1_ClientConnectionConfiguration_To_config_ClientConnectionConfiguration
(
a
.
(
*
ClientConnectionConfiguration
),
b
.
(
*
config
.
ClientConnectionConfiguration
),
scope
)
});
err
!=
nil
{
return
err
}
if
err
:=
s
.
AddConversionFunc
((
*
DebuggingConfiguration
)(
nil
),
(
*
config
.
DebuggingConfiguration
)(
nil
),
func
(
a
,
b
interface
{},
scope
conversion
.
Scope
)
error
{
if
err
:=
s
.
AddConversionFunc
((
*
DebuggingConfiguration
)(
nil
),
(
*
config
.
DebuggingConfiguration
)(
nil
),
func
(
a
,
b
interface
{},
scope
conversion
.
Scope
)
error
{
return
Convert_v1alpha1_DebuggingConfiguration_To_config_DebuggingConfiguration
(
a
.
(
*
DebuggingConfiguration
),
b
.
(
*
config
.
DebuggingConfiguration
),
scope
)
return
Convert_v1alpha1_DebuggingConfiguration_To_config_DebuggingConfiguration
(
a
.
(
*
DebuggingConfiguration
),
b
.
(
*
config
.
DebuggingConfiguration
),
scope
)
});
err
!=
nil
{
});
err
!=
nil
{
...
@@ -77,6 +97,24 @@ func RegisterConversions(s *runtime.Scheme) error {
...
@@ -77,6 +97,24 @@ func RegisterConversions(s *runtime.Scheme) error {
return
nil
return
nil
}
}
func
autoConvert_v1alpha1_ClientConnectionConfiguration_To_config_ClientConnectionConfiguration
(
in
*
ClientConnectionConfiguration
,
out
*
config
.
ClientConnectionConfiguration
,
s
conversion
.
Scope
)
error
{
out
.
Kubeconfig
=
in
.
Kubeconfig
out
.
AcceptContentTypes
=
in
.
AcceptContentTypes
out
.
ContentType
=
in
.
ContentType
out
.
QPS
=
in
.
QPS
out
.
Burst
=
in
.
Burst
return
nil
}
func
autoConvert_config_ClientConnectionConfiguration_To_v1alpha1_ClientConnectionConfiguration
(
in
*
config
.
ClientConnectionConfiguration
,
out
*
ClientConnectionConfiguration
,
s
conversion
.
Scope
)
error
{
out
.
Kubeconfig
=
in
.
Kubeconfig
out
.
AcceptContentTypes
=
in
.
AcceptContentTypes
out
.
ContentType
=
in
.
ContentType
out
.
QPS
=
in
.
QPS
out
.
Burst
=
in
.
Burst
return
nil
}
func
autoConvert_v1alpha1_DebuggingConfiguration_To_config_DebuggingConfiguration
(
in
*
DebuggingConfiguration
,
out
*
config
.
DebuggingConfiguration
,
s
conversion
.
Scope
)
error
{
func
autoConvert_v1alpha1_DebuggingConfiguration_To_config_DebuggingConfiguration
(
in
*
DebuggingConfiguration
,
out
*
config
.
DebuggingConfiguration
,
s
conversion
.
Scope
)
error
{
out
.
EnableProfiling
=
in
.
EnableProfiling
out
.
EnableProfiling
=
in
.
EnableProfiling
out
.
EnableContentionProfiling
=
in
.
EnableContentionProfiling
out
.
EnableContentionProfiling
=
in
.
EnableContentionProfiling
...
...
staging/src/k8s.io/
apiserver/pkg/apis
/config/v1alpha1/zz_generated.deepcopy.go
→
staging/src/k8s.io/
component-base
/config/v1alpha1/zz_generated.deepcopy.go
View file @
2e52d5c3
...
@@ -21,6 +21,22 @@ limitations under the License.
...
@@ -21,6 +21,22 @@ limitations under the License.
package
v1alpha1
package
v1alpha1
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func
(
in
*
ClientConnectionConfiguration
)
DeepCopyInto
(
out
*
ClientConnectionConfiguration
)
{
*
out
=
*
in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientConnectionConfiguration.
func
(
in
*
ClientConnectionConfiguration
)
DeepCopy
()
*
ClientConnectionConfiguration
{
if
in
==
nil
{
return
nil
}
out
:=
new
(
ClientConnectionConfiguration
)
in
.
DeepCopyInto
(
out
)
return
out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func
(
in
*
DebuggingConfiguration
)
DeepCopyInto
(
out
*
DebuggingConfiguration
)
{
func
(
in
*
DebuggingConfiguration
)
DeepCopyInto
(
out
*
DebuggingConfiguration
)
{
*
out
=
*
in
*
out
=
*
in
return
return
...
...
staging/src/k8s.io/
apiserver/pkg/apis
/config/validation/BUILD
→
staging/src/k8s.io/
component-base
/config/validation/BUILD
View file @
2e52d5c3
...
@@ -3,12 +3,12 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
...
@@ -3,12 +3,12 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
go_library(
name = "go_default_library",
name = "go_default_library",
srcs = ["validation.go"],
srcs = ["validation.go"],
importmap = "k8s.io/kubernetes/vendor/k8s.io/
apiserver/pkg/apis
/config/validation",
importmap = "k8s.io/kubernetes/vendor/k8s.io/
component-base
/config/validation",
importpath = "k8s.io/
apiserver/pkg/apis
/config/validation",
importpath = "k8s.io/
component-base
/config/validation",
visibility = ["//visibility:public"],
visibility = ["//visibility:public"],
deps = [
deps = [
"//staging/src/k8s.io/apimachinery/pkg/util/validation/field:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/validation/field:go_default_library",
"//staging/src/k8s.io/
apiserver/pkg/apis
/config:go_default_library",
"//staging/src/k8s.io/
component-base
/config:go_default_library",
],
],
)
)
...
@@ -19,7 +19,7 @@ go_test(
...
@@ -19,7 +19,7 @@ go_test(
deps = [
deps = [
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/validation/field:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/validation/field:go_default_library",
"//staging/src/k8s.io/
apiserver/pkg/apis
/config:go_default_library",
"//staging/src/k8s.io/
component-base
/config:go_default_library",
],
],
)
)
...
...
staging/src/k8s.io/
apiserver/pkg/apis
/config/validation/validation.go
→
staging/src/k8s.io/
component-base
/config/validation/validation.go
View file @
2e52d5c3
...
@@ -18,9 +18,18 @@ package validation
...
@@ -18,9 +18,18 @@ package validation
import
(
import
(
"k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/
apiserver/pkg/apis
/config"
"k8s.io/
component-base
/config"
)
)
// ValidateClientConnectionConfiguration ensures validation of the ClientConnectionConfiguration struct
func
ValidateClientConnectionConfiguration
(
cc
*
config
.
ClientConnectionConfiguration
,
fldPath
*
field
.
Path
)
field
.
ErrorList
{
allErrs
:=
field
.
ErrorList
{}
if
cc
.
Burst
<
0
{
allErrs
=
append
(
allErrs
,
field
.
Invalid
(
fldPath
.
Child
(
"burst"
),
cc
.
Burst
,
"must be non-negative"
))
}
return
allErrs
}
// ValidateLeaderElectionConfiguration ensures validation of the LeaderElectionConfiguration struct
// ValidateLeaderElectionConfiguration ensures validation of the LeaderElectionConfiguration struct
func
ValidateLeaderElectionConfiguration
(
cc
*
config
.
LeaderElectionConfiguration
,
fldPath
*
field
.
Path
)
field
.
ErrorList
{
func
ValidateLeaderElectionConfiguration
(
cc
*
config
.
LeaderElectionConfiguration
,
fldPath
*
field
.
Path
)
field
.
ErrorList
{
allErrs
:=
field
.
ErrorList
{}
allErrs
:=
field
.
ErrorList
{}
...
...
staging/src/k8s.io/
apiserver/pkg/apis
/config/validation/validation_test.go
→
staging/src/k8s.io/
component-base
/config/validation/validation_test.go
View file @
2e52d5c3
...
@@ -17,13 +17,57 @@ limitations under the License.
...
@@ -17,13 +17,57 @@ limitations under the License.
package
validation
package
validation
import
(
import
(
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/apiserver/pkg/apis/config"
"testing"
"testing"
"time"
"time"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/component-base/config"
)
)
func
TestValidateClientConnectionConfiguration
(
t
*
testing
.
T
)
{
validConfig
:=
&
config
.
ClientConnectionConfiguration
{
AcceptContentTypes
:
"application/json"
,
ContentType
:
"application/json"
,
QPS
:
10
,
Burst
:
10
,
}
qpsLessThanZero
:=
validConfig
.
DeepCopy
()
qpsLessThanZero
.
QPS
=
-
1
burstLessThanZero
:=
validConfig
.
DeepCopy
()
burstLessThanZero
.
Burst
=
-
1
scenarios
:=
map
[
string
]
struct
{
expectedToFail
bool
config
*
config
.
ClientConnectionConfiguration
}{
"good"
:
{
expectedToFail
:
false
,
config
:
validConfig
,
},
"good-qps-less-than-zero"
:
{
expectedToFail
:
false
,
config
:
qpsLessThanZero
,
},
"bad-burst-less-then-zero"
:
{
expectedToFail
:
true
,
config
:
burstLessThanZero
,
},
}
for
name
,
scenario
:=
range
scenarios
{
errs
:=
ValidateClientConnectionConfiguration
(
scenario
.
config
,
field
.
NewPath
(
"clientConnectionConfiguration"
))
if
len
(
errs
)
==
0
&&
scenario
.
expectedToFail
{
t
.
Errorf
(
"Unexpected success for scenario: %s"
,
name
)
}
if
len
(
errs
)
>
0
&&
!
scenario
.
expectedToFail
{
t
.
Errorf
(
"Unexpected failure for scenario: %s - %+v"
,
name
,
errs
)
}
}
}
func
TestValidateLeaderElectionConfiguration
(
t
*
testing
.
T
)
{
func
TestValidateLeaderElectionConfiguration
(
t
*
testing
.
T
)
{
validConfig
:=
&
config
.
LeaderElectionConfiguration
{
validConfig
:=
&
config
.
LeaderElectionConfiguration
{
ResourceLock
:
"configmap"
,
ResourceLock
:
"configmap"
,
...
...
staging/src/k8s.io/
apimachinery/pkg/apis
/config/zz_generated.deepcopy.go
→
staging/src/k8s.io/
component-base
/config/zz_generated.deepcopy.go
View file @
2e52d5c3
...
@@ -35,3 +35,38 @@ func (in *ClientConnectionConfiguration) DeepCopy() *ClientConnectionConfigurati
...
@@ -35,3 +35,38 @@ func (in *ClientConnectionConfiguration) DeepCopy() *ClientConnectionConfigurati
in
.
DeepCopyInto
(
out
)
in
.
DeepCopyInto
(
out
)
return
out
return
out
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func
(
in
*
DebuggingConfiguration
)
DeepCopyInto
(
out
*
DebuggingConfiguration
)
{
*
out
=
*
in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DebuggingConfiguration.
func
(
in
*
DebuggingConfiguration
)
DeepCopy
()
*
DebuggingConfiguration
{
if
in
==
nil
{
return
nil
}
out
:=
new
(
DebuggingConfiguration
)
in
.
DeepCopyInto
(
out
)
return
out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func
(
in
*
LeaderElectionConfiguration
)
DeepCopyInto
(
out
*
LeaderElectionConfiguration
)
{
*
out
=
*
in
out
.
LeaseDuration
=
in
.
LeaseDuration
out
.
RenewDeadline
=
in
.
RenewDeadline
out
.
RetryPeriod
=
in
.
RetryPeriod
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LeaderElectionConfiguration.
func
(
in
*
LeaderElectionConfiguration
)
DeepCopy
()
*
LeaderElectionConfiguration
{
if
in
==
nil
{
return
nil
}
out
:=
new
(
LeaderElectionConfiguration
)
in
.
DeepCopyInto
(
out
)
return
out
}
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