-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Change dry-run behavior #16008
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
Change dry-run behavior #16008
Conversation
Welcome @Alexander-Kita! It looks like this is your first PR to knative/serving 🎉 |
Hi @Alexander-Kita. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
/ok-to-test |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #16008 +/- ##
==========================================
+ Coverage 80.13% 80.17% +0.04%
==========================================
Files 214 214
Lines 16893 16877 -16
==========================================
- Hits 13537 13531 -6
+ Misses 2994 2987 -7
+ Partials 362 359 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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 as part of this change we should drop the feature flag
Removed feature flag, dry run validation now only occurs when dry-run=server is specified. Please let me know if I missed anything. |
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.
some minor feedback
test/v1/service.go
Outdated
func PatchServiceWithDryRun(t testing.TB, clients *test.Clients, service *v1.Service, fopt ...rtesting.ServiceOption) (svc *v1.Service, err error) { | ||
newSvc := service.DeepCopy() | ||
for _, opt := range fopt { | ||
opt(newSvc) | ||
} | ||
LogResourceObject(t, ResourceObjects{Service: newSvc}) | ||
patchBytes, err := duck.CreateBytePatch(service, newSvc) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return svc, reconciler.RetryTestErrors(func(int) (err error) { | ||
svc, err = clients.ServingClient.Services.Patch(context.Background(), service.ObjectMeta.Name, types.JSONPatchType, patchBytes, metav1.PatchOptions{DryRun: []string{metav1.DryRunAll}}) | ||
return 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.
Let's move this to test/e2e/service_validation_test.go
as it's specific to that test
test/e2e/service_validation_test.go
Outdated
} | ||
|
||
_, err = v1test.PatchService(t, clients, service, withInvalidContainer()) | ||
_, err = v1test.PatchServiceWithDryRun(t, clients, service, withInvalidContainer()) |
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 is technically changing the test to use dry-run.
I'd probably suggest having an alternate 'dry-run' e2e test
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 test does not work the same as it used to because we removed the feature flag (it had previously used the annotation). Should the test be renamed or moved instead?
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.
oh then let's rename the test
|
||
func TestSkipUpdate(t *testing.T) { | ||
validService := &v1.Service{ | ||
ObjectMeta: metav1.ObjectMeta{ |
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.
TestSkipUpdate
- would be more apt-ly named TestSkipDryRun
no?
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 believe it is specifically testing the update portion, so maybe it could be TestSkipUpdateDryrun
?
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.
Looking at it more - it's ensuring we skip calling and k8s calls when we perform a dry-run (when the resource hasn't changed).
I say we just remove this behaviour and delete this test. Ideally when a user performs a dry run we ensure we validate everything even if it's the same. The reason is because we wouldn't know if something 'new' is running in the cluster that could influence the podspec dry-run.
I think this will simplify the implementation.
@dprotaso Implemented requested changes in latest commit |
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.
looks great - just two minor things we don't need.
I removed it from my local copy and it didn't have any material effect
pkg/reconciler/route/table_test.go
Outdated
cfg.Domain = v.(*config.Domain) | ||
} | ||
|
||
ctx = apis.WithDryRun(ctx) |
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.
We can drop this
t.Run(tc.name, func(t *testing.T) { | ||
ingress := &netv1alpha1.Ingress{Status: tc.status} | ||
ctx := config.ToContext(context.Background(), testConfig()) | ||
ctx = apis.WithDryRun(ctx) |
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.
we can drop this
Also two more things
|
727161b
to
eec0a1a
Compare
@dprotaso Looks like the passed except for one, which seems unrelated to the code (seems like some kind of missing file issue) |
/retest |
/lgtm thanks @Alexander-Kita 🎉 |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Alexander-Kita, dprotaso The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fixes #8857
Proposed Changes
Release Note