Skip to content
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

Use resource descriptor GVK for NewSession #120

Merged
merged 2 commits into from Mar 22, 2023

Conversation

RedbackThomson
Copy link
Contributor

@RedbackThomson RedbackThomson commented Mar 21, 2023

Description of changes:
Some version of K8s do not reliably return TypeMeta information when you call apiReader.Get() (see kubernetes/kubernetes#3030 and kubernetes/kubernetes#80609). This is a known bug in controller-runtime that they don't plan on fixing.

Parts of the code, namely around setting up the user agent, currently rely on these fields - and they are currently being given an empty struct (with empty strings for all values). To work around this bug, this PR has introduced a new GroupVersionKind() getter in the ResourceDescriptor (replacing the existing GroupKind), which returns a static description of the GVK. Then, rather than referencing the RuntimeObject TypeMeta properties, we can reference this new GVK getter anywhere in the runtime. It also replaces any existing use of GroupKind to now use GroupVersionKind.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ack-prow ack-prow bot requested review from jaypipes and jljaco March 21, 2023 23:04
@ack-prow ack-prow bot added the approved label Mar 21, 2023
@RedbackThomson RedbackThomson requested review from a-hilaly and removed request for jaypipes March 21, 2023 23:04
@RedbackThomson RedbackThomson changed the title Use resource descriptor GVK for NewSession Use resource descriptor GVK for NewSession Mar 21, 2023
Copy link
Collaborator

@jaypipes jaypipes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is obviously a breaking change so we will need to bump the minor version of the runtime and then code-generator. But I support the change after reading the various supporting GH issues for context.

Copy link
Member

@a-hilaly a-hilaly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat 👍
Small breaking change but impact is huge.
/lgtm

@ack-prow ack-prow bot added the lgtm Indicates that a PR is ready to be merged. label Mar 22, 2023
@ack-prow
Copy link

ack-prow bot commented Mar 22, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: A-Hilaly, jaypipes, RedbackThomson

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:
  • OWNERS [A-Hilaly,RedbackThomson,jaypipes]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ack-prow ack-prow bot merged commit e526d54 into aws-controllers-k8s:main Mar 22, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm Indicates that a PR is ready to be merged.
Projects
None yet
3 participants