-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Set default for DeploymentConfigSpec.RevisionHistoryLimit in apps/v1 #15642
Set default for DeploymentConfigSpec.RevisionHistoryLimit in apps/v1 #15642
Conversation
@openshift/api-review |
5bd21ec
to
d724258
Compare
/approve |
infra failed |
/retest |
2 similar comments
/retest |
/retest |
My email never got delivered it looks like. The defaults can only be applied when creating via the "apps.openshift.io" group, not the default group. There needs to be specific code to check for that just like: https://github.com/openshift/origin/blob/master/pkg/cmd/server/origin/legacy.go#L190 Removing label |
@smarterclayton my bad :( It was already like 9 PM on Friday for me and I was misguided by defaulters located under path I am feeling a bit hesitant to do this at storage layer but I might be wrong. We have defaulters, right? But at this point we register the same ones for legacy and the new group origin/pkg/deploy/apis/apps/v1/register.go Lines 19 to 22 in 7580da2
Shouldn't I better plumb it there? |
The line I pasted is where the storage is customized one way or another.
The strategy is what encapsulates the additional defaulting, so it's
probably better that we keep the registration of the defaulting there.
Creating net new types has a bunch of other impacts that we're probably not
ready for (but which at some point will become necessary). When we do
duplicate the types, we'll change how we register. Too big for the near
term though.
…On Tue, Aug 8, 2017 at 6:16 AM, Tomáš Nožička ***@***.***> wrote:
@smarterclayton <https://github.com/smarterclayton> my bad :( It was
already like 9 PM on Friday for me and I was misguided by defaulters
located under path deploy/apis/apps/v1/defaults.go. Should have tested
creating resources in both API groups though...
I am feeling a bit hesitant to do this at storage layer but I might be
wrong. We have defaulters, right? But at this point we register the same
ones for legacy and the new group https://github.com/openshift/
origin/blob/7580da21a2133f7d3e013b1bfe137db33110f4d3/pkg/deploy/apis/
apps/v1/register.go#L19-L22
Shouldn't I better plumb it there?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#15642 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABG_p1ryEttb5vKHq_lqyXgIfqj8pxVPks5sWDWJgaJpZM4OuDCi>
.
|
d724258
to
1c0c4a3
Compare
@@ -206,7 +207,8 @@ func LegacyStorage(storage map[schema.GroupVersion]map[string]rest.Storage) map[ | |||
case "deploymentConfigs": | |||
restStorage := s.(*deploymentconfigetcd.REST) | |||
store := *restStorage.Store | |||
restStorage.DeleteStrategy = orphanByDefault(store.DeleteStrategy) |
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 have my doubts about if this ever worked - restStorage
should have been store
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.
@smarterclayton @mfojtik This seems to be indeed a bug that we have carried for a long time.
What do we want to do with legacy API cascade deletion? We enabled it for new DCs by
"ownerReferences":[{"apiVersion":"%s","kind":"%s","name":"%s","uid":"%s","controller":true,"blockOwnerDeletion":true}], |
origin/test/extended/deployments/deployments.go
Line 1098 in e98a1a9
err = oc.Client().DeploymentConfigs(namespace).Delete(dcName) |
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 was wrong that the patch would change the propagation policy. (We used to set a finalizer here, but now there is only blockOwnerDeletion which doesn't affect it in that way. So I will rephrase the question:
@smarterclayton @mfojtik I guess we initially wanted DCs created by legacy API not to have cascading deletion but given that we have failed at it due to this bug. Given that it has already been in a release (https://github.com/openshift/origin/blame/master/pkg/cmd/server/origin/legacy.go#L209) do we want to turn it back again? What's the policy for 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.
@mfojtik @smarterclayton bump
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.
@tnozicka that is right, it should be store
and not restStorage
(@deads2k).
I think we should fix this bug and backport to 3.5, @deads2k @smarterclayton thoughts?
daa4e87
to
a78eaf1
Compare
I wanted to wrap the defaulting functions just for group API SchemeBuilder but that didn't work because they get called even for legacy resources (it calls defaulting functions twice for legacy resources) so I ended up modifying it on storage layer. I am not excited to have defaulting scattered between 2 places but this is probably the only option here. And BuildConfigs do the same. I will add an integration test tomorrow but this is mostly done. |
|
||
dc := obj.(*deployapi.DeploymentConfig) | ||
|
||
if dc.Spec.RevisionHistoryLimit == nil { |
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.
Split this into its own method for sanity. func AppsV1DeploymentConfigLayeredDefaults(*deployapi.DeploymentConfig)
and add a good godoc comment.
a78eaf1
to
b5dedb9
Compare
0f626b9
to
a7a5b81
Compare
Looks good to me, go ahead and squash. |
a7a5b81
to
0df2c1c
Compare
yum repo flake |
/retest |
I will need to plumb in the new group client for tests and use that in origin/test/extended/deployments/deployments.go Lines 1093 to 1098 in e98a1a9
instead of the legacy client - that's why the extended_conformance_gce test is failing
|
0df2c1c
to
3aa370c
Compare
|
Looks perfect /lgtm |
3aa370c
to
c30b39f
Compare
Seems like some changes in code generation went into master from last time I run
no other changes |
/retest |
…to 10. Fix tests now that we are really not doing cascade delete for legacy API. (Brings group API into tests.)
c30b39f
to
e74af9d
Compare
Another change in code generation in master - rebased and added new generated files:
|
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kargakis, mfojtik, smarterclayton, tnozicka The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue |
@Kargakis not that I want to complain but submit queue probably shouldn't merge PRs with needs-api-review label |
At this point we don't default DeploymentConfigSpec.RevisionHistoryLimit in apps/v1 which is causing the deployments to have unlimited history which will lead to performance issues at scale and when deploying regularly.
Note that upstream also defaulted RevisionHistoryLimit to 10 for Deployments in kubernetes/kubernetes#49924
Needs to be backported to 3.6.1 as well.
cc: @smarterclayton @mfojtik @Kargakis