-
Notifications
You must be signed in to change notification settings - Fork 161
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
add support for minimumKubeletVersion #1754
base: master
Are you sure you want to change the base?
Conversation
5aa38d0
to
0b6e63b
Compare
0b6e63b
to
2f76862
Compare
/retest |
2f76862
to
ba2bc46
Compare
ba2bc46
to
0481182
Compare
How are we planning to test this observer? Are we going to have an integration test? At the very least, we could check if the configuration contains the current node version, right? I think we could have a more end-to-end test in origin. |
I was planning on doing an e2e test in origin. I'm not seeing integration tests in this repository, do you have a pointer @p0lyn0mial ? |
0481182
to
e019d98
Compare
var minimumKubeletVersionConfigPath = "minimumKubeletVersion" | ||
|
||
// ObserveKubeletMinimumVersion watches the node configuration and generates the minimumKubeletVersion | ||
func ObserveMinimumKubeletVersion(genericListers configobserver.Listers, _ events.Recorder, existingConfig map[string]interface{}) (ret map[string]interface{}, errs []error) { |
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.
This should be feature gated too (and will now need to be aware of the new authorization-mode in the carry patch).
2c99747
to
5f87e9b
Compare
I decided to take config observation from library-go as iterating is tricky and AFAIU this code won't be used elsewhere |
5f87e9b
to
6d45957
Compare
ed2d94b
to
07665c1
Compare
/retest |
1 similar comment
/retest |
07665c1
to
c509f79
Compare
pkg/operator/configobservation/node/observe_minimum_kubelet_version.go
Outdated
Show resolved
Hide resolved
pkg/operator/configobservation/node/observe_minimum_kubelet_version.go
Outdated
Show resolved
Hide resolved
pkg/operator/configobservation/node/observe_minimum_kubelet_version.go
Outdated
Show resolved
Hide resolved
pkg/operator/configobservation/node/observe_minimum_kubelet_version.go
Outdated
Show resolved
Hide resolved
if on { | ||
defaultAuthModes = append(defaultAuthModes, ModeMinimumKubeletVersion) | ||
} | ||
sort.Sort(sort.StringSlice(defaultAuthModes)) |
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 list is hardcoded and we always append at the end then maybe we don't have to sort.
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.
it was initially added at the suggestion of @benluddy I'm fine either way
// removes it instead. | ||
// This function assumes MinimumKubeletVersion auth mode isn't present by default, | ||
// and should likely be removed when it is. | ||
func SetAPIServerArgumentsToEnforceMinimumKubeletVersion(defaultAuthModes []string, newConfig map[string]interface{}, on bool) error { |
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.
Could we also rename this method to AddMinimumKubeletVersionAuthorizationMode
or something like that?
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.
went for AddAuthorizationModes as suggested above
BTW: do we want to merge this pr before openshift/kubernetes#2104 ? |
f51e26e
to
3b1fb7d
Compare
I think I'd actually prefer o/k first |
// removes it instead. | ||
// This function assumes MinimumKubeletVersion auth mode isn't present by default, | ||
// and should likely be removed when it is. | ||
func AddAuthorizationModes(observedConfig map[string]interface{}, isMinimumKubeletVersionEnabled bool) error { |
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.
ok, please double-check if we need to call this method on a default configuration from somewhere here.
cluster-kube-apiserver-operator/pkg/operator/targetconfigcontroller/targetconfigcontroller.go
Line 227 in 992114a
defaultConfig := bindata.MustAsset("assets/config/defaultconfig.yaml") |
just in case the observer won't be executed/flags weren't initialised.
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.
Maybe we could split this method into two, one that accepts the value from the FG and another that adds hardcoded/default values.
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.
hm the approach taken for pod security (the other featuregated observer) is to set an invalid config in the default so we know it's overridden. I'll do that instead I think
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.
Do you have a link? I think that most of the time it will work. I just want to ensure it will always work even if something is wrong with the observer ...
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.
enforce: "invalid-to-force-substitution" | |
enforce-version: "invalid-to-force-substitution" | |
audit: "invalid-to-force-substitution" | |
audit-version: "invalid-to-force-substitution" | |
warn: "invalid-to-force-substitution" | |
warn-version: "invalid-to-force-substitution" |
cluster-kube-apiserver-operator/pkg/cmd/render/render.go
Lines 350 to 357 in 992114a
if !featureGates.Enabled(features.FeatureGateOpenShiftPodSecurityAdmission) { | |
if err := auth.SetPodSecurityAdmissionToEnforcePrivileged(defaultConfig); err != nil { | |
return nil, err | |
} | |
} else { | |
if err := auth.SetPodSecurityAdmissionToEnforceRestricted(defaultConfig); err != nil { | |
return nil, err | |
} |
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 think that the render command creates the bootstrap manifest, and the target controller creates a manifest for each revision. We need to ensure that the target controller also applies the default set of the auth methods (just in case). WDYT ?
should we merge the origin tests before the o/k PR? |
I wouldn't expect it to pass without the tests, but if we're okay with a window where techpreview serial jobs fail then I'm open. If I were to choose the order I'd say o/k, o/ckaso, o/origin. Since the feature is gated in both implementation PRs there shouldn't be a risk to merging without a test |
as expected openshift/origin#29353 failed |
3604289
to
d2e41cb
Compare
/retest |
We cannot afford it. Is there a way to test these three PRs to ensure everything works as expected? |
- SystemMasters | ||
- RBAC | ||
- Node | ||
invalidMap: invalidToForceSubstitution |
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 would remove it and add the default set to the target controller
xref: #1754 (comment)
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 ended up doing so in the last commit
pkg/operator/configobservation/node/observe_minimum_kubelet_version.go
Outdated
Show resolved
Hide resolved
pkg/operator/configobservation/node/observe_authorization_mode.go
Outdated
Show resolved
Hide resolved
pkg/operator/configobservation/node/observe_minimum_kubelet_version.go
Outdated
Show resolved
Hide resolved
d2e41cb
to
efcac32
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: haircommander The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
1 similar comment
/retest |
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.
LGTM
not tagging because we want to merge the other PR(s) first.
@@ -228,12 +229,21 @@ func manageKubeAPIServerConfig(ctx context.Context, client coreclientv1.ConfigMa | |||
configOverrides := bindata.MustAsset("assets/config/config-overrides.yaml") | |||
specialMergeRules := map[string]resourcemerge.MergeFunc{} | |||
|
|||
// Guarantee the authorization-mode will be present in the base config, regardless of whether the observer is running | |||
authModeOverride := map[string]interface{}{} |
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.
nit: technically, this is our default configuration, so I would rename it to defaultAuthModes
.
Signed-off-by: Peter Hunt <[email protected]>
Signed-off-by: Peter Hunt <[email protected]>
…ify strictly with observer Signed-off-by: Peter Hunt <[email protected]>
efcac32
to
c0745cb
Compare
…er doesn't run Signed-off-by: Peter Hunt <[email protected]>
c0745cb
to
2d97288
Compare
@haircommander: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
No description provided.