⚠️ Fakeclient: Only set TypeMeta for unstructured#2633
Merged
k8s-ci-robot merged 1 commit intokubernetes-sigs:mainfrom Jan 4, 2024
Merged
⚠️ Fakeclient: Only set TypeMeta for unstructured#2633k8s-ci-robot merged 1 commit intokubernetes-sigs:mainfrom
k8s-ci-robot merged 1 commit intokubernetes-sigs:mainfrom
Conversation
Contributor
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alvaroaleman 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 |
1929682 to
6c89920
Compare
sbueringer
reviewed
Jan 4, 2024
Currently, the fakeclient unconditionally sets metadata for all objects retrieved through it. This causes two problems: * It differs from the behavior of the real client, except for the cached one if `DeepCopy` is enabled and might lead ppl to think that they can rely on `TypeMeta` being populated, which is absolutely not the case * It causes panics for types that have `TypeMeta` defined as pointer, making it impossible to use the client with them This PR changes the behavior to only populate TypeMeta for `unstructured`.
Member
|
Thx! /lgtm /hold |
Member
|
/hold cancel |
ksimon1
added a commit
to ksimon1/ssp-operator
that referenced
this pull request
Jan 19, 2024
there was change in behaviour of kubernetes-sigs/controller-runtime - kubernetes-sigs/controller-runtime#2633. This commit updates test to copy TypeMeta in update CreateOrUpdate function. Signed-off-by: Karel Simon <ksimon@redhat.com>
ksimon1
added a commit
to ksimon1/ssp-operator
that referenced
this pull request
Jan 24, 2024
there was change in behaviour of kubernetes-sigs/controller-runtime - kubernetes-sigs/controller-runtime#2633. This commit updates test to copy TypeMeta in update CreateOrUpdate function. Signed-off-by: Karel Simon <ksimon@redhat.com>
1 task
thbkrkr
added a commit
to elastic/cloud-on-k8s
that referenced
this pull request
Jan 30, 2024
…7468) * fix(deps): update module sigs.k8s.io/controller-runtime to v0.17.0 * make generate * Stop relying on GVK being set on SCP object TestReconcileStackConfigPolicy_Reconcile fails because with kubernetes-sigs/controller-runtime#2633 the fakeClient does not set the TypeMeta of the StackConfigPolicy object, so its typeMeta.Kind becomes empty but CanBeOwnedBy depends on it. The behavior change to not populate TypeMeta for regular object is to be aligned with the behavior of the real client, see kubernetes-sigs/cluster-api#9956: - APIReader does not set GVK on regular typed objects - Cached reader does not set GVK on regular typed objects (if disableDeepCopy = false, which is NOT default). We could just set the Kind of the StackConfigPolicy object in the tests but it's better to stop relying on GVK being set on the StackConfigPolicy object. --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Thibault Richard <thb.krkr@gmail.com>
11 tasks
tiraboschi
added a commit
to tiraboschi/hyperconverged-cluster-operator
that referenced
this pull request
Jan 31, 2024
- Bump controller-runtime to v0.17.0 - Introduce a few minor fixes for new fakeclient behaviour, see: kubernetes-sigs/controller-runtime#2633 Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
kubevirt-bot
pushed a commit
to kubevirt/hyperconverged-cluster-operator
that referenced
this pull request
Feb 1, 2024
- Bump controller-runtime to v0.17.0 - Introduce a few minor fixes for new fakeclient behaviour, see: kubernetes-sigs/controller-runtime#2633 Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
This was referenced Feb 9, 2024
1 task
This was referenced Mar 27, 2024
3 tasks
tomhjp
added a commit
to tailscale/tailscale
that referenced
this pull request
Jun 18, 2024
See kubernetes-sigs/controller-runtime#2633 for details. Updates #12216 Signed-off-by: Tom Proctor <tomhjp@users.noreply.github.com>
tomhjp
added a commit
to tailscale/tailscale
that referenced
this pull request
Jun 18, 2024
…ition for annotated services (#12463) Adds a new TailscaleProxyReady condition type for use in corev1.Service conditions. Also switch our CRDs to use metav1.Condition instead of ConnectorCondition. The Go structs are seralized identically, but it updates some descriptions and validation rules. Update k8s controller-tools and controller-runtime deps to fix the documentation generation for metav1.Condition so that it excludes comments and TODOs. Stop expecting the fake client to populate TypeMeta in tests. See kubernetes-sigs/controller-runtime#2633 for details of the change. Finally, make some minor improvements to validation for service hostnames. Fixes #12216 Co-authored-by: Irbe Krumina <irbe@tailscale.com> Signed-off-by: Tom Proctor <tomhjp@users.noreply.github.com>
chen8945
pushed a commit
to Ckid-Home/tailscale
that referenced
this pull request
Jul 31, 2024
…ition for annotated services (tailscale#12463) Adds a new TailscaleProxyReady condition type for use in corev1.Service conditions. Also switch our CRDs to use metav1.Condition instead of ConnectorCondition. The Go structs are seralized identically, but it updates some descriptions and validation rules. Update k8s controller-tools and controller-runtime deps to fix the documentation generation for metav1.Condition so that it excludes comments and TODOs. Stop expecting the fake client to populate TypeMeta in tests. See kubernetes-sigs/controller-runtime#2633 for details of the change. Finally, make some minor improvements to validation for service hostnames. Fixes tailscale#12216 Co-authored-by: Irbe Krumina <irbe@tailscale.com> Signed-off-by: Tom Proctor <tomhjp@users.noreply.github.com>
Asutorufa
pushed a commit
to Asutorufa/tailscale
that referenced
this pull request
Aug 23, 2024
…ition for annotated services (tailscale#12463) Adds a new TailscaleProxyReady condition type for use in corev1.Service conditions. Also switch our CRDs to use metav1.Condition instead of ConnectorCondition. The Go structs are seralized identically, but it updates some descriptions and validation rules. Update k8s controller-tools and controller-runtime deps to fix the documentation generation for metav1.Condition so that it excludes comments and TODOs. Stop expecting the fake client to populate TypeMeta in tests. See kubernetes-sigs/controller-runtime#2633 for details of the change. Finally, make some minor improvements to validation for service hostnames. Fixes tailscale#12216 Co-authored-by: Irbe Krumina <irbe@tailscale.com> Signed-off-by: Tom Proctor <tomhjp@users.noreply.github.com>
alebedev87
added a commit
to alebedev87/aws-load-balancer-operator
that referenced
this pull request
Dec 11, 2024
- Bumped golang to 1.22:
- Update go.mod
- Update Dockerfiles
- Bumped k8s.io/* modules to 0.30.3 and OpenShift API to 20240812094746-86145edb40cf.
- Bumped controller-runtime to 0.18.5:
- Manager's `Port` option removed, now using dedicated webhook server field (kubernetes-sigs/controller-runtime#2422).
- Manager's `MetricsBindAddress` option removed, now using dedicated metrics server field (kubernetes-sigs/controller-runtime#2407).
- Cache's `Namespaces` option replaced by `DefaultNamespaces` (kubernetes-sigs/controller-runtime#2421).
- Regenerated CRD and bundle manifests using `make bundle` command.
- Bumped `kustomize` to v5 to fix a conflict caused by k8s.io bumps:
- `kyaml` unable to use the bumped `github.com/google/gnostic-models/openapiv2` package.
- Removed `TypeMeta` from expected deployment object when it's compared to
structured one retrieved from fake client (kubernetes-sigs/controller-runtime#2633).
alebedev87
added a commit
to alebedev87/aws-load-balancer-operator
that referenced
this pull request
Dec 16, 2024
- Bumped golang to 1.22:
- Update go.mod
- Update Dockerfiles
- Bumped k8s.io/* modules to 0.30.3 and OpenShift API to 20240812094746-86145edb40cf.
- Bumped controller-runtime to 0.18.5:
- Manager's `Port` option removed, now using dedicated webhook server field (kubernetes-sigs/controller-runtime#2422).
- Manager's `MetricsBindAddress` option removed, now using dedicated metrics server field (kubernetes-sigs/controller-runtime#2407).
- Cache's `Namespaces` option replaced by `DefaultNamespaces` (kubernetes-sigs/controller-runtime#2421).
- Bumped aws-load-balancer-controller to f39ae43121c3 to use latest CRD scheme in e2e tests.
- Regenerated CRD and bundle manifests using `make bundle` command.
- Bumped `kustomize` to v5 to fix a conflict caused by k8s.io bumps:
- `kyaml` unable to use the bumped `github.com/google/gnostic-models/openapiv2` package.
- Removed `TypeMeta` from expected deployment object when it's compared to
structured one retrieved from fake client (kubernetes-sigs/controller-runtime#2633).
alebedev87
added a commit
to alebedev87/aws-load-balancer-operator
that referenced
this pull request
Dec 16, 2024
- Bumped golang to 1.22:
- Update go.mod
- Update Dockerfiles
- Bumped k8s.io/* modules to 0.30.3 and OpenShift API to 20240812094746-86145edb40cf.
- Bumped controller-runtime to 0.18.5:
- Manager's `Port` option removed, now using dedicated webhook server field (kubernetes-sigs/controller-runtime#2422).
- Manager's `MetricsBindAddress` option removed, now using dedicated metrics server field (kubernetes-sigs/controller-runtime#2407).
- Cache's `Namespaces` option replaced by `DefaultNamespaces` (kubernetes-sigs/controller-runtime#2421).
- Bumped aws-load-balancer-controller to f39ae43121c3 to use latest CRD scheme in e2e tests.
- Regenerated CRD and bundle manifests using `make bundle` command.
- Bumped `kustomize` to v5 to fix a conflict caused by k8s.io bumps:
- `kyaml` unable to use the bumped `github.com/google/gnostic-models/openapiv2` package.
- Removed `TypeMeta` from expected deployment object when it's compared to
structured one retrieved from fake client (kubernetes-sigs/controller-runtime#2633).
- Migrated infrastructure CRD retrieval to the new package `zz_generated.crd-manifests`:
- Updated infrastructure CRD for unit tests using `make update-vendored-crds` command.
alebedev87
added a commit
to alebedev87/aws-load-balancer-operator
that referenced
this pull request
Dec 16, 2024
- Bumped golang to 1.22:
- Update go.mod
- Update Dockerfiles
- Bumped k8s.io/* modules to 0.30.3 and OpenShift API to 20240812094746-86145edb40cf.
- Bumped controller-runtime to 0.18.5:
- Manager's `Port` option removed, now using dedicated webhook server field (kubernetes-sigs/controller-runtime#2422).
- Manager's `MetricsBindAddress` option removed, now using dedicated metrics server field (kubernetes-sigs/controller-runtime#2407).
- Cache's `Namespaces` option replaced by `DefaultNamespaces` (kubernetes-sigs/controller-runtime#2421).
- Bumped aws-load-balancer-controller to f39ae43121c3 to use latest CRD scheme in e2e tests.
- Regenerated CRD and bundle manifests using `make bundle` command.
- Bumped `kustomize` to v5 to fix a conflict caused by k8s.io bumps:
- `kyaml` unable to use the bumped `github.com/google/gnostic-models/openapiv2` package.
- Removed `TypeMeta` from expected deployment object when it's compared to
structured one retrieved from fake client (kubernetes-sigs/controller-runtime#2633).
- Migrated infrastructure CRD retrieval to the new package `zz_generated.crd-manifests`:
- Updated infrastructure CRD for unit tests using `make update-vendored-crds` command.
alebedev87
added a commit
to alebedev87/aws-load-balancer-operator
that referenced
this pull request
Dec 17, 2024
- Bumped golang to 1.22:
- Update go.mod
- Update Dockerfiles
- Bumped k8s.io/* modules to 0.30.3 and OpenShift API to 20240812094746-86145edb40cf.
- Bumped controller-runtime to 0.18.5:
- Manager's `Port` option removed, now using dedicated webhook server field (kubernetes-sigs/controller-runtime#2422).
- Manager's `MetricsBindAddress` option removed, now using dedicated metrics server field (kubernetes-sigs/controller-runtime#2407).
- Cache's `Namespaces` option replaced by `DefaultNamespaces` (kubernetes-sigs/controller-runtime#2421).
- Bumped aws-load-balancer-controller to f39ae43121c3 to use latest CRD scheme in e2e tests.
- Regenerated CRD and bundle manifests using `make bundle` command.
- Bumped `kustomize` to v5 to fix a conflict caused by k8s.io bumps:
- `kyaml` unable to use the bumped `github.com/google/gnostic-models/openapiv2` package.
- Removed `TypeMeta` from expected deployment object when it's compared to
structured one retrieved from fake client (kubernetes-sigs/controller-runtime#2633).
- Migrated infrastructure CRD retrieval to the new package `zz_generated.crd-manifests`:
- Updated infrastructure CRD for unit tests using `make update-vendored-crds` command.
- Updated envtest setup to use the downstream index.
- Infrastructure CRD uses CEL functions backported from newer k8s API.
- Upstream `envtest` is not ready to use newer CEL function.
- Bumped `setup-envtest` to be able to use `--index` flag.
alebedev87
added a commit
to alebedev87/aws-load-balancer-operator
that referenced
this pull request
Dec 17, 2024
- Bumped golang to 1.22:
- Update go.mod
- Update Dockerfiles
- Bumped k8s.io/* modules to 0.30.3 and OpenShift API to 20240812094746-86145edb40cf.
- Bumped controller-runtime to 0.18.5:
- Manager's `Port` option removed, now using dedicated webhook server field (kubernetes-sigs/controller-runtime#2422).
- Manager's `MetricsBindAddress` option removed, now using dedicated metrics server field (kubernetes-sigs/controller-runtime#2407).
- Cache's `Namespaces` option replaced by `DefaultNamespaces` (kubernetes-sigs/controller-runtime#2421).
- Bumped aws-load-balancer-controller to f39ae43121c3 to use latest CRD scheme in e2e tests.
- Regenerated CRD and bundle manifests using `make bundle` command.
- Bumped `kustomize` to v5 to fix a conflict caused by k8s.io bumps:
- `kyaml` unable to use the bumped `github.com/google/gnostic-models/openapiv2` package.
- Removed `TypeMeta` from expected deployment object when it's compared to
structured one retrieved from fake client (kubernetes-sigs/controller-runtime#2633).
- Migrated infrastructure CRD retrieval to the new package `zz_generated.crd-manifests`:
- Updated infrastructure CRD for unit tests using `make update-vendored-crds` command.
- Updated envtest setup to use the downstream index.
- Infrastructure CRD uses CEL functions backported from newer k8s API.
- Upstream `envtest` is not ready to use newer CEL function.
- Bumped `setup-envtest` to be able to use `--index` flag.
openshift-merge-bot bot
pushed a commit
to openshift/aws-load-balancer-operator
that referenced
this pull request
Dec 18, 2024
#143) - Bumped golang to 1.22: - Update go.mod - Update Dockerfiles - Bumped k8s.io/* modules to 0.30.3 and OpenShift API to 20240812094746-86145edb40cf. - Bumped controller-runtime to 0.18.5: - Manager's `Port` option removed, now using dedicated webhook server field (kubernetes-sigs/controller-runtime#2422). - Manager's `MetricsBindAddress` option removed, now using dedicated metrics server field (kubernetes-sigs/controller-runtime#2407). - Cache's `Namespaces` option replaced by `DefaultNamespaces` (kubernetes-sigs/controller-runtime#2421). - Bumped aws-load-balancer-controller to f39ae43121c3 to use latest CRD scheme in e2e tests. - Regenerated CRD and bundle manifests using `make bundle` command. - Bumped `kustomize` to v5 to fix a conflict caused by k8s.io bumps: - `kyaml` unable to use the bumped `github.com/google/gnostic-models/openapiv2` package. - Removed `TypeMeta` from expected deployment object when it's compared to structured one retrieved from fake client (kubernetes-sigs/controller-runtime#2633). - Migrated infrastructure CRD retrieval to the new package `zz_generated.crd-manifests`: - Updated infrastructure CRD for unit tests using `make update-vendored-crds` command. - Updated envtest setup to use the downstream index. - Infrastructure CRD uses CEL functions backported from newer k8s API. - Upstream `envtest` is not ready to use newer CEL function. - Bumped `setup-envtest` to be able to use `--index` flag.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, the fakeclient unconditionally sets metadata for all objects retrieved through it. This causes two problems:
DeepCopyis enabled and might lead ppl to think that they can rely onTypeMetabeing populated, which is absolutely not the caseTypeMetadefined as pointer, making it impossible to use the client with themThis PR changes the behavior to only populate TypeMeta for
unstructured.