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. DetailsInstructions 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:
|
dprotaso
left a comment
There was a problem hiding this comment.
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. |
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.
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.
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.
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?
|
|
||
| func TestSkipUpdate(t *testing.T) { | ||
| validService := &v1.Service{ | ||
| ObjectMeta: metav1.ObjectMeta{ |
There was a problem hiding this comment.
TestSkipUpdate - would be more apt-ly named TestSkipDryRun no?
There was a problem hiding this comment.
I believe it is specifically testing the update portion, so maybe it could be TestSkipUpdateDryrun?
There was a problem hiding this comment.
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 |
dprotaso
left a comment
There was a problem hiding this comment.
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) |
| t.Run(tc.name, func(t *testing.T) { | ||
| ingress := &netv1alpha1.Ingress{Status: tc.status} | ||
| ctx := config.ToContext(context.Background(), testConfig()) | ||
| ctx = apis.WithDryRun(ctx) |
|
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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fixes #8857
Proposed Changes
Release Note