Merge pull request #77751 from baasbank/fix-lint-errors-staging/src/k8s.io

Fix lint errors staging/src/k8s.io
This commit is contained in:
Kubernetes Prow Robot 2019-05-15 07:06:26 -07:00 committed by GitHub
commit 6a40ed1005
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 6 deletions

View File

@ -592,12 +592,8 @@ staging/src/k8s.io/sample-apiserver/pkg/admission/plugin/banflunder
staging/src/k8s.io/sample-apiserver/pkg/admission/wardleinitializer
staging/src/k8s.io/sample-apiserver/pkg/apis/wardle
staging/src/k8s.io/sample-apiserver/pkg/apis/wardle/v1alpha1
staging/src/k8s.io/sample-apiserver/pkg/apiserver
staging/src/k8s.io/sample-apiserver/pkg/cmd/server
staging/src/k8s.io/sample-apiserver/pkg/registry/wardle/fischer
staging/src/k8s.io/sample-apiserver/pkg/registry/wardle/flunder
staging/src/k8s.io/sample-controller/pkg/apis/samplecontroller
staging/src/k8s.io/sample-controller/pkg/apis/samplecontroller/v1alpha1
test/e2e
test/e2e/autoscaling
test/e2e/chaosmonkey

View File

@ -33,7 +33,10 @@ import (
)
var (
// Scheme defines methods for serializing and deserializing API objects.
Scheme = runtime.NewScheme()
// Codecs provides methods for retrieving codecs and serializers for specific
// versions and content types.
Codecs = serializer.NewCodecFactory(Scheme)
)
@ -55,10 +58,12 @@ func init() {
)
}
// ExtraConfig holds custom apiserver config
type ExtraConfig struct {
// Place you custom config here.
}
// Config defines the config for the apiserver
type Config struct {
GenericConfig *genericapiserver.RecommendedConfig
ExtraConfig ExtraConfig
@ -74,8 +79,8 @@ type completedConfig struct {
ExtraConfig *ExtraConfig
}
// CompletedConfig embeds a private pointer that cannot be instantiated outside of this package.
type CompletedConfig struct {
// Embed a private pointer that cannot be instantiated outside of this package.
*completedConfig
}

View File

@ -41,6 +41,7 @@ import (
const defaultEtcdPathPrefix = "/registry/wardle.kubernetes.io"
// WardleServerOptions contains state for master/api server
type WardleServerOptions struct {
RecommendedOptions *genericoptions.RecommendedOptions
@ -49,6 +50,7 @@ type WardleServerOptions struct {
StdErr io.Writer
}
// NewWardleServerOptions returns a new WardleServerOptions
func NewWardleServerOptions(out, errOut io.Writer) *WardleServerOptions {
o := &WardleServerOptions{
RecommendedOptions: genericoptions.NewRecommendedOptions(
@ -92,12 +94,14 @@ func NewCommandStartWardleServer(defaults *WardleServerOptions, stopCh <-chan st
return cmd
}
// Validate validates WardleServerOptions
func (o WardleServerOptions) Validate(args []string) error {
errors := []error{}
errors = append(errors, o.RecommendedOptions.Validate()...)
return utilerrors.NewAggregate(errors)
}
// Complete fills in fields required to have valid data
func (o *WardleServerOptions) Complete() error {
// register admission plugins
banflunder.Register(o.RecommendedOptions.Admission.Plugins)
@ -108,6 +112,7 @@ func (o *WardleServerOptions) Complete() error {
return nil
}
// Config returns config for the api server given WardleServerOptions
func (o *WardleServerOptions) Config() (*apiserver.Config, error) {
// TODO have a "real" external address
if err := o.RecommendedOptions.SecureServing.MaybeDefaultWithSelfSignedCerts("localhost", nil, []net.IP{net.ParseIP("127.0.0.1")}); err != nil {
@ -138,6 +143,7 @@ func (o *WardleServerOptions) Config() (*apiserver.Config, error) {
return config, nil
}
// RunWardleServer starts a new WardleServer given WardleServerOptions
func (o WardleServerOptions) RunWardleServer(stopCh <-chan struct{}) error {
config, err := o.Config()
if err != nil {

View File

@ -16,6 +16,7 @@ limitations under the License.
package samplecontroller
// GroupName is the group name used in this package
const (
GroupName = "samplecontroller.k8s.io"
)

View File

@ -38,8 +38,10 @@ func Resource(resource string) schema.GroupResource {
}
var (
// SchemeBuilder initializes a scheme builder
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
AddToScheme = SchemeBuilder.AddToScheme
// AddToScheme is a global function that registers this API group & version to a scheme
AddToScheme = SchemeBuilder.AddToScheme
)
// Adds the list of known types to Scheme.