Commit Graph

4075 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
b337f048db Merge pull request #127094 from sreeram-venkitesh/4818-allow-zero-for-prestop-hook
KEP-4818: Relaxed validation for allowing zero in PreStop hook sleep action
2024-10-31 20:25:26 +00:00
zhifei92
5c01709387 Fix the apiserver panic caused by adding a container when updating a pod
add unit test

refactor:  Merge the test cases into TestMarkPodProposedForResize.

chore:  Add the comment and fix the test names
2024-10-29 10:52:46 +08:00
AxeZhan
2ffb568540 rename functions 2024-10-25 12:53:24 +08:00
AxeZhan
9fe847482d move functions 2024-10-25 10:45:28 +08:00
Sreeram Venkitesh
f1f9e7b398 Clean kube_features.go
Added tests, info about new feature gate in error message, fixes from review

Added basic e2e test

Added unit tests

Ran hack/update-featuregates.sh

Tolerate updates to existing resources after disabling feature gate

Added feature gate to versioned_kube_features.go

Fixed existing tests

Use PodValidationOptions for validation instead of using feature gate directly

Relaxed validation for allowing zero in prestop hook sleep action
2024-10-18 22:04:42 +05:30
Kubernetes Prow Robot
4812ea8aa5 Merge pull request #125570 from sanchezl/test-additional-types
KEP-4222: Cover aggregator and apiextension types in unstructured roundtrip test.
2024-10-12 03:18:20 +01:00
Luis Sanchez
aaa7364f60 cover additional types in unstructured roundtrip test
Co-authored-by: Ben Luddy <bluddy@redhat.com>
2024-10-11 16:07:39 -04:00
joey
6bce72a794 fix eps named ports does not work in sidecar(initContainer with restartPolicy=Always)
Signed-off-by: joey <zchengjoey@gmail.com>
2024-10-11 17:53:17 +08:00
Stephen Kitt
ff3e9ea79f pkg/api(s): drop pointer wrapper functions
The new k8s.io/utils/ptr package provides generic wrapper functions,
which can be used instead of type-specific pointer wrapper functions.
This replaces the latter with the former, and migrates other uses of
the deprecated pointer package to ptr in affacted files.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2024-09-23 23:00:34 +02:00
Kubernetes Prow Robot
f9a57ba82d Merge pull request #126760 from ncdc/ncdc/emeritus
Move ncdc to emeritus
2024-09-20 21:01:58 +01:00
Kubernetes Prow Robot
767d28dcf0 Merge pull request #126083 from mmorel-35/testifylint/pkg/api
fix: enable testifylint on `pkg/api`
2024-09-20 05:44:52 +01:00
carlory
684fbd6f20 remove AllowImageVolumeSource 2024-09-13 23:45:42 +08:00
carlory
24a50a3ddf If old pod spec has used image volume source, we must allow it 2024-09-13 23:42:21 +08:00
Adrian Moisey
8e3adc4df6 KEP-4427 : AllowRelaxedDNSSearchValidation (#127167)
* KEP-4427 : AllowRelaxedDNSSearchValidation

* Add e2e test with feature gate to test KEP-4427 RelaxedDNSSearchValidation

* Add more validatePodDNSConfig test cases

Also update Regex to match the case we want.

Thanks Tim and Antonio!
2024-09-12 09:41:19 +01:00
Andy Goldstein
0e228be96f Use emeritus_*
Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
2024-08-22 17:48:27 -04:00
Andy Goldstein
3ab816dcab Move ncdc to emeritus
I am moving myself to emeritus as I am now firmly on the end-user side
of things.

Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
2024-08-17 13:06:45 -04:00
Sergey Kanzhelev
62f96d2748 set AllocatedResourcesStatus in the Pod Status 2024-07-24 00:29:35 +00:00
Sergey Kanzhelev
3790ee2fe8 reset fields when the feature gate was not set 2024-07-24 00:29:35 +00:00
Kubernetes Prow Robot
107f621462 Merge pull request #126108 from gnufied/changes-volume-recovery
Reduce state changes when expansion fails and mark certain failures as infeasible
2024-07-23 13:30:56 -07:00
Kubernetes Prow Robot
13d9d7c689 Merge pull request #124819 from carlory/add-warning-MountOptionAnnotation
mark volume.beta.kubernetes.io/mount-options as deprecated
2024-07-23 12:21:11 -07:00
Kubernetes Prow Robot
7590cb7adf Merge pull request #125257 from vinayakankugoyal/armor
KEP-24: Update AppArmor feature gates to GA stage.
2024-07-23 09:20:52 -07:00
Patrick Ohly
91d7882e86 DRA: new API for 1.31
This is a complete revamp of the original API. Some of the key
differences:
- refocused on structured parameters and allocating devices
- support for constraints across devices
- support for allocating "all" or a fixed amount
  of similar devices in a single request
- no class for ResourceClaims, instead individual
  device requests are associated with a mandatory
  DeviceClass

For the sake of simplicity, optional basic types (ints, strings) where the null
value is the default are represented as values in the API types. This makes Go
code simpler because it doesn't have to check for nil (consumers) and values
can be set directly (producers). The effect is that in protobuf, these fields
always get encoded because `opt` only has an effect for pointers.

The roundtrip test data for v1.29.0 and v1.30.0 changes because of the new
"request" field. This is considered acceptable because the entire `claims`
field in the pod spec is still alpha.

The implementation is complete enough to bring up the apiserver.
Adapting other components follows.
2024-07-22 18:09:34 +02:00
Patrick Ohly
62d21589ef api test: update TestDefaulting
Logging and sub-tests were added to help debug this problem:
the test passes for ResourceClaim (same defaulting!) and fails
for the list, but only if run together with the other test cases?!

    $ go test ./pkg/api/testing
    --- FAIL: TestDefaulting (1.76s)
        --- FAIL: TestDefaulting/resource.k8s.io/v1alpha3,_Kind=ResourceClaimList (0.01s)
            defaulting_test.go:238: expected resource.k8s.io/v1alpha3, Kind=ResourceClaimList to trigger defaulting due to fuzzing
    FAIL
    FAIL	k8s.io/kubernetes/pkg/api/testing	17.294s
    FAIL
    $ go test -run=TestDefaulting/resource.k8s.io/v1alpha3,_Kind=ResourceClaimList ./pkg/api/testing
    ok  	k8s.io/kubernetes/pkg/api/testing	0.062s

What fixed that problem was increasing the likelihood of generating the right
test object by iterating more often before giving up.
2024-07-21 17:28:14 +02:00
Patrick Ohly
de5742ae83 DRA: remove immediate allocation
As agreed in https://github.com/kubernetes/enhancements/pull/4709, immediate
allocation is one of those features which can be removed because it makes no
sense for structured parameters and the justification for classic DRA is weak.
2024-07-21 17:28:14 +02:00
Patrick Ohly
b51d68bb87 DRA: bump API v1alpha2 -> v1alpha3
This is in preparation for revamping the resource.k8s.io completely. Because
there will be no support for transitioning from v1alpha2 to v1alpha3, the
roundtrip test data for that API in 1.29 and 1.30 gets removed.

Repeating the version in the import name of the API packages is not really
required. It was done for a while to support simpler grepping for usage of
alpha APIs, but there are better ways for that now. So during this transition,
"resourceapi" gets used instead of "resourcev1alpha3" and the version gets
dropped from informer and lister imports. The advantage is that the next bump
to v1beta1 will affect fewer source code lines.

Only source code where the version really matters (like API registration)
retains the versioned import.
2024-07-21 17:28:13 +02:00
Kubernetes Prow Robot
8527092e02 Merge pull request #119024 from wafuwafu13/deprecated-node-label
chore(node/util): add more labels to `deprecatedNodeLabels`
2024-07-20 11:31:40 -07:00
Matthieu MOREL
2a7b71fe01 fix: enable testifylint on pkg/api 2024-07-19 22:40:33 +00:00
Sascha Grunert
f7ca3131e0 Add ImageVolumeSource API
Adding the required Kubernetes API so that the kubelet can start using
it. This patch also adds the corresponding alpha feature gate as
outlined in KEP 4639.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2024-07-18 17:25:54 +02:00
Vinayak Goyal
bc06071495 Update AppArmor feature gates to GA stage.
Signed-off-by: Vinayak Goyal <vinaygo@google.com>
2024-07-15 23:29:37 +00:00
Hemant Kumar
ad28dfb42e Fix code that uses old values for resize errors 2024-07-12 14:37:35 -04:00
Kubernetes Prow Robot
1080554307 Merge pull request #124969 from RomanBednar/pv-phase-transition-time-ga
graduate PersistentVolumeLastPhaseTransitionTime to GA in 1.31
2024-07-11 15:29:19 -07:00
Ben Luddy
4755e1f859 Automatically transcode RawExtension between unstructured protocols. 2024-07-09 17:02:34 -04:00
Kubernetes Prow Robot
53c8efbe71 Merge pull request #125743 from benluddy/extract-roundtrip-to-unstructured
Extract RoundtripToUnstructured to apimachinery apitesting library.
2024-07-08 08:22:49 -07:00
Michael Fraenkel
cd949bafa4 use MakePodSpec consistently (#125805)
cleaning up some tests after MakePod/MakePodSpec were introduced
2024-06-30 10:28:36 -07:00
Kubernetes Prow Robot
93d56511e6 Merge pull request #125021 from aojea/servicecidrbeta
KEP-1880 Multiple Service CIDRs: Graduate to Beta (2/2)
2024-06-30 08:53:25 -07:00
Antonio Ojea
0e1f9dadd6 modify components to use the networking v1beta1 API 2024-06-30 09:48:46 +00:00
Michael Fraenkel
a7264f95ff pod terminationGracePeriodSeconds is always valid (#124461)
* Pod terminationGracePeriodSeconds is always valid

Validation of a pod spec will always use the pod's
TerminationGracePeriodSeconds value.

A set of pod test-helpers have been created to help construct Pods.

* remove unused func

* reduction

* reduce 2

* simplify test

* report invalid grace period

* update SupplementalGroupPolicy tests
2024-06-29 18:09:29 -07:00
Kubernetes Prow Robot
ac9aec9f9b Merge pull request #125116 from pohly/dra-one-of-source
DRA: remove "source" indirection from v1 Pod API
2024-06-28 12:46:45 -07:00
Patrick Ohly
bde9b64cdf DRA: remove "source" indirection from v1 Pod API
This makes the API nicer:

    resourceClaims:
    - name: with-template
      resourceClaimTemplateName: test-inline-claim-template
    - name: with-claim
      resourceClaimName: test-shared-claim

Previously, this was:

    resourceClaims:
    - name: with-template
      source:
        resourceClaimTemplateName: test-inline-claim-template
    - name: with-claim
      source:
        resourceClaimName: test-shared-claim

A more long-term benefit is that other, future alternatives
might not make sense under the "source" umbrella.

This is a breaking change. It's justified because DRA is still
alpha and will have several other API breaks in 1.31.
2024-06-27 17:53:24 +02:00
Antonio Ojea
b04ca186d8 replace the iptree on the ipallocator
ServiceCIDRs are protected by finalizers and the CIDRs fields are
inmutable once set, only the readiness state impact the allocator
as it can only allocate IPs if any of the ServiceCIDR is ready.

The Add/Update events triggers a reconcilation of the current state
of the ServiceCIDR present in the informers with the existing IP
allocators.

The Delete events are handled directly to update or delete the
corresponing IP allocator.
2024-06-27 11:33:36 +00:00
Antonio Ojea
b5cfccbca7 replace iptree on the servicecidr controller 2024-06-27 11:33:36 +00:00
Antonio Ojea
f06b355daf replace iptree on the repairip controller 2024-06-27 11:33:35 +00:00
Ben Luddy
532471618e Extract RoundtripToUnstructured to apimachinery apitesting library.
This will allow the same scenarios to be exercised on types defined in staging modules, like
apiextensions-apiserver, without importing them all from the root module.
2024-06-26 15:02:58 -04:00
Ben Luddy
38f87df0e3 Enable JSON-compatible base64 encoding of []byte for CBOR.
The encoding/json package marshals []byte to a JSON string containing the base64 encoding of the
input slice's bytes, and unmarshals JSON strings to []byte by assuming the JSON string contains a
valid base64 text.

As a binary format, CBOR is capable of representing arbitrary byte sequences without converting them
to a text encoding, but it also needs to interoperate with the existing JSON serializer. It does
this using the "expected later encoding" tags defined in RFC 8949, which indicate a specific text
encoding to be used when interoperating with text-based protocols. The actual conversion to or from
a text encoding is deferred until necessary, so no conversion is performed during roundtrips of
[]byte to CBOR.
2024-06-25 21:05:26 -04:00
Kubernetes Prow Robot
f30a87d517 Merge pull request #122832 from benluddy/cbor-fuzz-native-to-unstructured-via
KEP-4222: Add roundtrip tests to Unstructured via CBOR and JSON.
2024-05-30 15:00:31 -07:00
Shingo Omura
552fd7e850 KEP-3619: Fine-grained SupplementalGroups control (#117842)
* Add `Linux{Sandbox,Container}SecurityContext.SupplementalGroupsPolicy` and `ContainerStatus.user` in cri-api

* Add `PodSecurityContext.SupplementalGroupsPolicy`, `ContainerStatus.User` and its featuregate

* Implement DropDisabledPodFields for PodSecurityContext.SupplementalGroupsPolicy and ContainerStatus.User fields

* Implement kubelet so to wire between SecurityContext.SupplementalGroupsPolicy/ContainerStatus.User and cri-api in kubelet

* Clarify `SupplementalGroupsPolicy` is an OS depdendent field.

* Make `ContainerStatus.User` is initially attached user identity to the first process in the ContainerStatus

It is because, the process identity can be dynamic if the initially attached identity
has enough privilege calling setuid/setgid/setgroups syscalls in Linux.

* Rewording suggestion applied

* Add TODO comment for updating SupplementalGroupsPolicy default value in v1.34

* Added validations for SupplementalGroupsPolicy and ContainerUser

* No need featuregate check in validation when adding new field with no default value

* fix typo: identitiy -> identity
2024-05-29 15:40:29 -07:00
Ben Luddy
0600269c1a Fuzz roundtrip to Unstructured via both JSON and CBOR. 2024-05-29 17:48:10 -04:00
Roman Bednar
5ea0c7be1e graduate PersistentVolumeLastPhaseTransitionTime to GA in 1.31 2024-05-20 13:46:24 +02:00
carlory
13fd8d8058 mark volume.beta.kubernetes.io/mount-options as deprecated 2024-05-11 18:04:33 +08:00
Marek Siarkowicz
3ee8178768 Cleanup defer from SetFeatureGateDuringTest function call 2024-04-24 20:25:29 +02:00