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

fix: 81134: fix unsafe json for ReleaseControllerRevision #104049

Merged

Conversation

manugupt1
Copy link
Contributor

@manugupt1 manugupt1 commented Jul 31, 2021

fix: 81134: fix unsafe json for ReleaseControllerRevision

There is a reference of the same

type objectForDeleteOwnerRefStrategicMergePatch struct {
Metadata objectMetaForMergePatch `json:"metadata"`
}
type objectMetaForMergePatch struct {
UID types.UID `json:"uid"`
OwnerReferences []map[string]string `json:"ownerReferences"`
}

but I went with this style of change because I did not want to make a private part of the package public and chose anonymous struct instead. Please let me know if it looks okay or another change is reqd. Thanks

What type of PR is this?

/kind bug

What this PR does / why we need it:

Fixes unsafe json construction in ReleaseControllerRevision

Which issue(s) this PR fixes:

#81134

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:```docs

NONE

Test

ok k8s.io/kubernetes/pkg/controller/history 0.257s

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jul 31, 2021
@k8s-ci-robot k8s-ci-robot added sig/apps Categorizes an issue or PR as relevant to SIG Apps. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jul 31, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @manugupt1. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions 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/test-infra repository.

@manugupt1
Copy link
Contributor Author

/kind bug

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. and removed do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Aug 4, 2021
@manugupt1 manugupt1 changed the title fix: 81134: fix unsafe json for ReleaseControllerRevision [WIP] fix: 81134: fix unsafe json for ReleaseControllerRevision Aug 5, 2021
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 5, 2021
@manugupt1 manugupt1 force-pushed the unsafe-json-controller-history branch from 4a13ddf to a1b64e3 Compare August 8, 2021 23:33
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 8, 2021
@manugupt1 manugupt1 force-pushed the unsafe-json-controller-history branch from a1b64e3 to 94951ee Compare August 8, 2021 23:33
@manugupt1 manugupt1 changed the title [WIP] fix: 81134: fix unsafe json for ReleaseControllerRevision fix: 81134: fix unsafe json for ReleaseControllerRevision Aug 8, 2021
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 8, 2021
@atiratree
Copy link
Member

but I went with this style of change because I did not want to make a private part of the package public and chose anonymous struct instead

using a typed struct would be more conventional IMO and make any future refactorings easier

@manugupt1 manugupt1 force-pushed the unsafe-json-controller-history branch from 94951ee to 6a43e57 Compare August 27, 2021 20:55
@dims
Copy link
Member

dims commented Sep 17, 2021

/assign @deads2k @cheftako

@soltysh
Copy link
Contributor

soltysh commented Sep 20, 2021

/assign @soltysh

@manugupt1
Copy link
Contributor Author

@deads2k @soltysh @cheftako Can I please get a review on this PR? thanks!

Copy link
Contributor

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

One nit and then you're good to go.

pkg/controller/controller_ref_manager.go Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. labels Nov 4, 2021
Manu Gupta added 2 commits November 4, 2021 12:20
1. Ensures that ReleaseControllerRevision returns a proper json by
marshalling an object into bytes. Otherwise, it returns an error.

2. Also, refactors the code to commonize the merge type
   GenerateDeleteOwnerRefStrategicMergeBytes that returns a byte and is
   used across ReleasePod, ReleaseControllerRevison
   ReleaseReplicaSet.
@manugupt1 manugupt1 force-pushed the unsafe-json-controller-history branch from 57bda7e to 518482c Compare November 4, 2021 19:22
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 4, 2021
@fedebongio
Copy link
Contributor

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Nov 4, 2021
@soltysh soltysh added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Nov 5, 2021
Copy link
Contributor

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@soltysh
Copy link
Contributor

soltysh commented Nov 5, 2021

/priority backlog

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/backlog Higher priority than priority/awaiting-more-evidence. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Nov 5, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: atiratree, manugupt1, soltysh

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:

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 5, 2021
@k8s-ci-robot k8s-ci-robot merged commit 79a5109 into kubernetes:master Nov 5, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.23 milestone Nov 5, 2021
@manugupt1 manugupt1 deleted the unsafe-json-controller-history branch November 16, 2021 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/backlog Higher priority than priority/awaiting-more-evidence. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/apps Categorizes an issue or PR as relevant to SIG Apps. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants