Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

split serving options into substructs #36507

Closed

Conversation

deads2k
Copy link
Contributor

@deads2k deads2k commented Nov 9, 2016

This continues the work of splitting the options struct into workable pieces by splitting out the secure and insecure serving options.

@sttts @ncdc @kubernetes/sig-api-machinery


This change is Reviewable

@@ -80,7 +80,9 @@ cluster's shared state through which all other components interact.`,

// Run runs the specified APIServer. This should never exit.
func Run(s *options.ServerRunOptions) error {
genericvalidation.VerifyEtcdServersList(s.GenericServerRunOptions)
if errs := s.GenericServerRunOptions.EtcdOptions.Validate(); len(errs) > 0 {
glog.Fatal(errs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run is of type error. Why not return?

s.ServiceAccountKeyFiles = []string{s.GenericServerRunOptions.TLSPrivateKeyFile}
if len(s.ServiceAccountKeyFiles) == 0 && s.GenericServerRunOptions.SecureServingOptions.ServerCert.CertKey.KeyFile != "" {
if authenticator.IsValidServiceAccountKeyFile(s.GenericServerRunOptions.SecureServingOptions.ServerCert.CertKey.KeyFile) {
s.ServiceAccountKeyFiles = []string{s.GenericServerRunOptions.SecureServingOptions.ServerCert.CertKey.KeyFile}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need the ...Options postfix?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need the ...Options postfix?

Removing from instance. I think I want it on the type.

@@ -55,18 +55,20 @@ func newStorageFactory() genericapiserver.StorageFactory {
}

func NewServerRunOptions() *genericoptions.ServerRunOptions {
serverOptions := genericoptions.NewServerRunOptions().WithEtcdOptions()
serverOptions.InsecurePort = InsecurePort
serverOptions := genericoptions.NewServerRunOptions().WithEtcdOptions().WithSecureServingOptions().WithInsecureServingOptions()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With...().With...

Do we really want this pattern?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want this pattern?

We might. It could actually work for some of our downstream projects. Like I said in the etcd pull. I see that as getting all the pieces ready and then making a choice.

genericvalidation.ValidateRunOptions(serverOptions)
genericvalidation.VerifyEtcdServersList(serverOptions)
if errs := serverOptions.EtcdOptions.Validate(); len(errs) > 0 {
panic(errs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return NewAggreate(errs)?

@k8s-github-robot k8s-github-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. release-note-label-needed labels Nov 9, 2016
@@ -0,0 +1,231 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git mv serving_options.go serving.go

@sttts
Copy link
Contributor

sttts commented Nov 9, 2016

overall direction 👍 👍

@k8s-ci-robot
Copy link
Contributor

Jenkins GCE Node e2e failed for commit 84bf5cf. Full PR test history.

The magic incantation to run this job again is @k8s-bot node e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@deads2k
Copy link
Contributor Author

deads2k commented Nov 9, 2016

When you're right, you're right. I'm splitting them out of the main struct to be able manage them separately for the next set of pulls in authentication and authorization.

@@ -157,6 +148,10 @@ func (o *ServerRunOptions) WithEtcdOptions() *ServerRunOptions {
o.Etcd = NewDefaultEtcdOptions()
return o
}
func (o *ServerRunOptions) WithSecureServingOptions() *ServerRunOptions {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expected a call to this in NewServerRunOptions. Alternatively, rename this to WithSecureServing**Defaults**.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expected a call to this in NewServerRunOptions. Alternatively, rename this to WithSecureServingDefaults.

Gets removed later in this pull.

@dims
Copy link
Member

dims commented Nov 10, 2016

@k8s-bot unit test this

@deads2k
Copy link
Contributor Author

deads2k commented Nov 10, 2016

@k8s-bot unit test this: issue #36473

@k8s-ci-robot
Copy link
Contributor

Jenkins unit/integration failed for commit b231cdc. Full PR test history.

The magic incantation to run this job again is @k8s-bot unit test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@ncdc ncdc added this to the 1.6 milestone Nov 10, 2016
@deads2k
Copy link
Contributor Author

deads2k commented Nov 10, 2016

closing in favor of #36604

@deads2k deads2k closed this Nov 10, 2016
@saad-ali saad-ali modified the milestones: v1.6, 1.6 Nov 12, 2016
@deads2k deads2k deleted the api-39-split-secure-serving branch February 1, 2017 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants