Skip to content

Add helper function for adding OwnerReferences to metav1.Objects #54

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

Merged
merged 1 commit into from
Jun 20, 2018

Conversation

pwittrock
Copy link
Contributor

No description provided.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 19, 2018
@@ -132,6 +136,26 @@ func (cm *controllerManager) GetRecorder(name string) record.EventRecorder {
return cm.recorderProvider.GetEventRecorderFor(name)
}

func (cm *controllerManager) SetControllerReference(owner, object v1.Object) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

It feels a bit awkward to add a helper method on controllerManager for this. I get the reasoning that this needs access to scheme which is only available at mgr level. Another way would be have this helper as a function which takes scheme as input (not elegant, but isn't too bad either), WDYT ? (thinking along the lines of io and ioutil)

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 20, 2018
Describe("SetControllerReference", func() {
It("should set the OwnerReference if it can find the group version kind", func() {
rs := &appsv1.ReplicaSet{}
dep := &extensionsv1beta1.Deployment{
Copy link
Contributor

Choose a reason for hiding this comment

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

any specific reason we are not using appsv1 instead of extensionsv1beta1 here ?

@droot droot added approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Jun 20, 2018
@k8s-ci-robot k8s-ci-robot merged commit 2a2c581 into kubernetes-sigs:master Jun 20, 2018
justinsb pushed a commit to justinsb/controller-runtime that referenced this pull request Dec 7, 2018
Add helper function for adding OwnerReferences to metav1.Objects
sttts pushed a commit to sttts/controller-runtime that referenced this pull request Apr 29, 2024
…by-default

🐛 Instantiate kube index informers by default
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants