Commit Graph

103444 Commits

Author SHA1 Message Date
Tim Hockin
46d7289655 Svc REST: Remove redundant Create tests
These cases are all covered in storage_test.
2021-09-11 11:00:29 -07:00
Tim Hockin
0dc509a0c8 Svc REST: Test that Headless doesn't set IPs 2021-09-11 11:00:11 -07:00
Tim Hockin
9ca582f3b7 Svc REST: Test that ExternalName doesn't set IPs 2021-09-11 10:59:30 -07:00
Tim Hockin
ca4a95ee49 Svc REST: Dedup tests for defaulting 2021-09-11 10:59:02 -07:00
Tim Hockin
b880d3a149 Svc REST: better test checks in new tests
"Has()" was strengthened in the older rest_test, now in the newer.
2021-09-11 10:58:32 -07:00
Tim Hockin
e338c9db4b Svc REST: Set Cluster IPs during dry-run Create
Dry-run should behave like a real API call and return valid results.
2021-09-11 10:57:01 -07:00
Tim Hockin
52856f3fbe Add dry-run support to the IP allocator subsystem 2021-09-11 10:56:39 -07:00
Tim Hockin
237434bd42 Svc REST: Overhaul Create test wrt dual-stack
This includes a few cases.

1) TestCreateIgnoresIPFamilyForExternalName: Prove that ExternalName is
ignored for dual-stack.  A small set of test cases were chosen to
demonstrate.

2) TestCreateIgnoresIPFamilyWithoutDualStack: Prove that when the
dual-stack gate is off, all services are ignored for dual-stack.  A
small set of test cases were chosen to demonstrate

3) TestCreateInitIPFields: Run over a huge array of test cases for
dual-stack.  This was generated by this program:
https://gist.github.com/thockin/cccc9c9a580b4830ee0946ddd43eeafe and
then updated by hand.
2021-09-11 10:56:03 -07:00
Tim Hockin
e4c6d0837e Svc REST: Rename some tests for clarity 2021-09-11 10:55:51 -07:00
Tim Hockin
bdbf2c6ef4 Svc REST: Allow multi-IP-family in tests 2021-09-11 10:54:24 -07:00
Tim Hockin
6cc9ef3874 Svc REST: Rename a long, hard function name 2021-09-11 10:54:03 -07:00
Tim Hockin
634055bded Svc REST: De-layer Create
Gut the "outer" Create() and move it to the inner BeginCreate().  This
uses a "transaction" type to make cleanup functions easy to read.

Background:

Service has an "outer" and "inner" REST handler.  This is because of how we do IP and port allocations synchronously, but since we don't have API transactions, we need to roll those back in case of a failure.  Both layers use the same `Strategy`, but the outer calls into the inner, which causes a lot of complexity in the code (including an open-coded partial reimplementation of a date-unknown snapshot of the generic REST code) and results in `Prepare` and `Validate` hooks being called twice.

The "normal" REST flow seems to be:

```
mutating webhooks
generic REST store Create {
    cleanup = BeginCreate
    BeforeCreate {
        strategy.PrepareForCreate {
            dropDisabledFields
        }
        strategy.Validate
        strategy.Canonicalize
    }
    createValidation (validating webhooks)
    storage Create
    cleanup
    AfterCreate
    Decorator
}
```

Service (before this commit) does:

```
mutating webhooks
svc custom Create {
    BeforeCreate {
        strategy.PrepareForCreate {
            dropDisabledFields
        }
        strategy.Validate
        strategy.Canonicalize
    }
    Allocations
    inner (generic) Create {
        cleanup = BeginCreate
        BeforeCreate {
            strategy.PrepareForCreate {
                dropDisabledFields
            }
            strategy.Validate
            strategy.Canonicalize
        }
        createValidation (validating webhooks)
        storage Create
        cleanup
        AfterCreate
        Decorator
    }
}
```

After this commit:

```
mutating webhooks
generic REST store Create {
    cleanup = BeginCreate
        Allocations
    BeforeCreate {
        strategy.PrepareForCreate {
            dropDisabledFields
        }
        strategy.Validate
        strategy.Canonicalize
    }
    createValidation (validating webhooks)
    storage Create
    cleanup
    AfterCreate
        Rollback allocations on error
    Decorator
}
```

This same fix pattern will be applied to Delete and Update in subsequent
commits.
2021-09-11 10:51:45 -07:00
Tim Hockin
5e7e35ca45 Svc REST: Add stub begin* hooks
These will be used in the next set of commits to de-0layer service REST.
2021-09-11 10:51:09 -07:00
Tim Hockin
f3c7e846f1 Svc REST: Move allocations in Create into funcs
All the logic remains unchanged, just reorganized.  The functions are
imperfect but emphasize the change being made and can be cleaned up
subsequently.

This makes the following steps easier to comprehend.
2021-09-11 10:50:27 -07:00
Tim Hockin
960b36b124 Svc REST: Add a transaction API
This will be used in upcoming commits, but for easier history and review
it is pretty stand-alone.
2021-09-11 10:49:37 -07:00
Tim Hockin
14d0571a5f Svc REST: Don't call validation directly
The validation is called soon after anyway.
2021-09-11 10:49:13 -07:00
Tim Hockin
b76a8c3c40 Svc REST: move allocator methods -> alloc object
Move all allocator-related methods onto the alloc object so it can be
used in either REST layer.  There's an INORDINATE amount of test code
here and I am skeptical that it is all useful.  That's for later
commits.
2021-09-11 10:48:32 -07:00
Tim Hockin
89587b3c6a Svc REST: Encapsulate IP and Port allocator logic
Encapsulate the allocator logic so it can be shared across REST
layers while we stage a series of commits to get rid of one layer.
2021-09-11 10:46:48 -07:00
Tim Hockin
d13c920606 Svc: Move ETP clearing to dropTypeDependentFields
I  am not sure why ExternalTrafficPolicy was different, but this is more
consistent with other field clearing logic.
2021-09-11 10:45:30 -07:00
Kubernetes Prow Robot
6b21e064be
Merge pull request #104917 from vinayakankugoyal/e2e
Skip externalips service tests if admission controller to deny externalip services is enabled.
2021-09-10 19:08:06 -07:00
Kubernetes Prow Robot
8ac9526475
Merge pull request #101928 from alexanderConstantinescu/drain-workqueue
client-go/workqueue: Drain work queue on shutdown
2021-09-10 18:02:06 -07:00
Kubernetes Prow Robot
b47f8263e1
Merge pull request #104858 from pohly/generic-ephemeral-volume-intree-tests
e2e: enable generic ephemeral inline volume also for in-tree drivers
2021-09-10 14:49:01 -07:00
Vinayak Goyal
b3c23290b4 Skip service external ips tests if admission controller to deny externalip services is enabled. 2021-09-10 12:51:31 -07:00
Kubernetes Prow Robot
1e607a500f
Merge pull request #104880 from dcantah/update-hcsshim-0.8.21
vendor: bump hcsshim to v0.8.22
2021-09-10 11:21:21 -07:00
Kubernetes Prow Robot
528859ef9d
Merge pull request #104901 from soltysh/refactor_printers
Move `YamlPrinter` to its own file
2021-09-10 09:04:00 -07:00
Kubernetes Prow Robot
d6acb7ce01
Merge pull request #104884 from eddiezane/ez/update-kubectl-run-flags
Remove functionality from deprecated kubectl run flags
2021-09-10 07:52:00 -07:00
Kubernetes Prow Robot
cf535b0339
Merge pull request #104866 from zzchun/fix-typo-in-framework-interface
fix typo in framework interface
2021-09-10 06:46:01 -07:00
Maciej Szulik
281231e074
Move YamlPrinter to its own file 2021-09-10 13:23:25 +02:00
Kubernetes Prow Robot
5261433627
Merge pull request #104606 from endocrimes/dani/device-driver-deflake
[Failing Test] Fix GPU Device Driver test in kubelet-serial
2021-09-10 04:20:00 -07:00
Kubernetes Prow Robot
758ad0790c
Merge pull request #104572 from andyzhangx/detach-disk-deleting
fix detach disk issue on deleting vmss node
2021-09-10 01:58:00 -07:00
Daniel Canter
3eef755b3b vendor: bump hcsshim to v0.8.22
This tag of hcsshim brings in a couple welcome features/improvements. One being
exposing a way to query for hns endpoint statistics (Packets received/sent etc.).
This tag also contains some optimizations for querying whether a certain HCN feature
is supported, which is a common workflow in kube-proxy on Windows. The first result
from querying HCN is now cached so further calls can skip the hcn query as well as the
version range parsing that was performed. This also gets rid of some redundant logs
that used to hit everytime the version range parsing occurred.

The Go-winio dep bump, and all of the ctrd deps are transitive only. Nothing new is needed/intended
to be used.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2021-09-10 00:54:24 -07:00
Kubernetes Prow Robot
34003c5aee
Merge pull request #104841 from h4ghhh/deltafifo_rv
client-go: para 'resourceVersion' in DeltaFIFO.Replace is not used, so remove it
2021-09-10 00:48:00 -07:00
Kubernetes Prow Robot
1dcea5cb02
Merge pull request #104817 from smarterclayton/pod_status
kubelet: Rejected pods should be filtered from admission
2021-09-09 22:15:59 -07:00
Kubernetes Prow Robot
5724484bda
Merge pull request #104069 from pacoxu/fix-data-race-104057
fix data race in kubelet volume test: add lock for ut
2021-09-09 21:09:59 -07:00
Kubernetes Prow Robot
51ff4bb814
Merge pull request #104881 from MikeSpreitzer/relax-queueset-tests
Widen margins of TestDifferentWidths and TestTooWide
2021-09-09 19:49:59 -07:00
zzchun
3ad158d62c fix typo in framework interface
Signed-off-by: zzchun <zzchun@zju.edu.cn>
2021-09-10 10:14:21 +08:00
Kubernetes Prow Robot
c91287c7b9
Merge pull request #104747 from kinvolk/invidian/typos
Fix typos in files which are used for generating OpenAPI
2021-09-09 18:04:57 -07:00
Kubernetes Prow Robot
a402f1753c
Merge pull request #104756 from tnqn/ipvs-sctp-masquerade
Fix client IP preservation for NodePort service with protocol SCTP
2021-09-09 15:34:56 -07:00
Kubernetes Prow Robot
5b49d125b7
Merge pull request #104103 from pohly/logr-1.0
klog 2.20.0, logr v1.1.0, zapr v1.1.0
2021-09-09 14:28:56 -07:00
Eddie Zaneski
da8f404ae0
Remove functionality from deprecated kubectl run flags
Signed-off-by: Eddie Zaneski <eddiezane@gmail.com>
2021-09-09 15:25:52 -06:00
Mike Spreitzer
59d319ec06 Widen margins of TestDifferentWidths and TestTooWide
These behavioral unit tests of queueset were failing because the
evaluation criteria were too strict.
2021-09-09 17:08:50 -04:00
Kubernetes Prow Robot
73453e473b
Merge pull request #104826 from cici37/UpdateOWNERS
Update CHANGELOG OWNERS
2021-09-09 10:50:11 -07:00
Kubernetes Prow Robot
669de4b957
Merge pull request #104666 from alculquicondor/tracking-beta
Fix Job tracking with finalizers for more than 500 pods
2021-09-09 09:26:11 -07:00
Kubernetes Prow Robot
c0c7039f3a
Merge pull request #103751 from y-tag/approx-float64
fix AsApproximateFloat64() for BinarySI
2021-09-09 08:22:11 -07:00
Patrick Ohly
cb6a653777 klog 2.20.0, logr v1.1.0, zapr v1.1.0
This replaces the experimental logr v0.4 with the stable v1.1.0
release. This is a breaking API change for some users because:
- Comparing logr.Logger against nil is not possible anymore:
  it's now a struct instead of an interface. Code which
  allows a nil logger should switch to *logr.Logger as type.
- Logger implementations must be updated in lockstep.

Instead of updating the forked zapr code in json.go, directly using
the original go-logr/zapr is simpler and avoids duplication of effort.

The updated zapr supports logging of numeric verbosity. Error messages
don't have a verbosity (= always get logged), so "v" is not getting
added to them anymore.

Source code logging for panic messages got fixed so that it references
the code with the invalid log call, not the json.go implementation.

Finally, zapr includes additional information in its panic
messages ("zap field", "ignored key", "invalid key").
2021-09-09 14:43:43 +02:00
Kubernetes Prow Robot
c964fe6001
Merge pull request #104812 from astraw99/fix-sharedInformer-doc
Fix comment of `processorListener.requestedResyncPeriod`
2021-09-09 01:42:11 -07:00
Patrick Ohly
468acb7418 e2e: enable generic ephemeral inline volume also for in-tree drivers
Previously, the ephemeral volume test suite was only enabled for CSI
drivers. By splitting the test patterns into those that work for all drivers
and the one for CSI ephemeral inline volumes it becomes possible to
define the former for all drivers and the latter only for CSI.

This increases test coverage, in particular also for migration to
CSI (https://testgrid.k8s.io/provider-gcp-compute-persistent-disk-csi-driver#Migration%20Kubernetes%20Master%20Driver%20Latest).
2021-09-09 09:59:39 +02:00
Kubernetes Prow Robot
95390e6476
Merge pull request #103023 from tiloso/staticcheck-apiserver-clientgo
Fix staticcheck in k8s.io/{apiserver/pkg/storage,client-go/rest/watch}
2021-09-08 18:50:10 -07:00
Kubernetes Prow Robot
d25a4c40cf
Merge pull request #104849 from Huang-Wei/revert-103515
Revert PR 103515
2021-09-08 17:44:21 -07:00
Kubernetes Prow Robot
9956551b62
Merge pull request #104848 from ehashman/node-api-shadow
Request: Add ehashman as a sig-node API review shadow
2021-09-08 17:44:10 -07:00