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
k8s.io/apiserver: remove skewed completion from EtcdOptions #118416
Merged
k8s-ci-robot
merged 2 commits into
kubernetes:master
from
sttts:sttts-etcd-options-complete
Jun 6, 2023
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,8 @@ import ( | |
serveroptions "k8s.io/apiextensions-apiserver/pkg/cmd/server/options" | ||
servertesting "k8s.io/apiextensions-apiserver/pkg/cmd/server/testing" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
genericapiserver "k8s.io/apiserver/pkg/server" | ||
storagevalue "k8s.io/apiserver/pkg/storage/value" | ||
"k8s.io/client-go/dynamic" | ||
"k8s.io/client-go/rest" | ||
) | ||
|
@@ -145,10 +147,15 @@ func StartDefaultServerWithClientsAndEtcd(t servertesting.Logger, extraFlags ... | |
return nil, nil, nil, nil, "", err | ||
} | ||
|
||
RESTOptionsGetter, err := serveroptions.NewCRDRESTOptionsGetter(*options.RecommendedOptions.Etcd) | ||
if err != nil { | ||
return nil, nil, nil, nil, "", err | ||
var resourceTransformers storagevalue.ResourceTransformers | ||
if len(options.RecommendedOptions.Etcd.EncryptionProviderConfigFilepath) != 0 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This condition looks redundant to me given the behavior of ApplyTo. |
||
// be clever in tests to reconstruct the transformers, for encryption integration tests | ||
config := genericapiserver.Config{} | ||
options.RecommendedOptions.Etcd.ApplyTo(&config) | ||
resourceTransformers = config.ResourceTransformers | ||
} | ||
|
||
RESTOptionsGetter := serveroptions.NewCRDRESTOptionsGetter(*options.RecommendedOptions.Etcd, resourceTransformers, nil) | ||
restOptions, err := RESTOptionsGetter.GetRESTOptions(schema.GroupResource{Group: "hopefully-ignored-group", Resource: "hopefully-ignored-resources"}) | ||
if err != nil { | ||
return nil, nil, nil, nil, "", err | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this code isn't pretty but you could easily re-use it as-is by just setting
resourceTransformers
on thegenericapiserver.Config
. It would force the code paths to stay in sync with each other, which was one of the reasons we chose to useApplyTo
here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I can follow. This path is explicitly non-standard for CRs, and it is simple, calling the options package. So no risk to diverge.
What is still a little strange IMO is that the tracker is not set on the StorageConfig persistently. But that's another skew for another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the
Apply
funcs add further logic beyond what is covered by the tracker/transformer/etc, then CRs would diverge from standard resources again (in the same way they did for transformers which broke encryption for them). This is a slow moving part of the codebase so maybe it is fine.