Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Distinguish between user-defined and managed resources #2095

Merged

Conversation

carolynvs
Copy link
Contributor

@carolynvs carolynvs commented Jun 5, 2018

This is the first step towards supporting user-defined classes and plans from #1896. Before we can allow users to create them, we need to make sure that our controller doesn't immediately nuke them. 😀

  • Classes and plans that were created by the service catalog controller during a list now have a controller reference set to indicate that they are managed by service catalog.
  • User defined classes and plans will not have a controller reference set, and are left alone during a list.

Closes #2060

@carolynvs carolynvs requested a review from jpeeler June 5, 2018 19:09
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 5, 2018
@carolynvs carolynvs requested a review from pmorie June 5, 2018 19:09
@carolynvs carolynvs changed the title Distinguish between user-defined and managed resources [WIP]Distinguish between user-defined and managed resources Jun 6, 2018
Classes and plans that were created by the service catalog controller
during a list now have a controller reference set to indicate that they
are managed by service catalog.

User defined classes and plans will not
have a controller reference set, and are left alone during a list.
@carolynvs carolynvs force-pushed the mark-managed-classes-plans branch from 589584c to ea17ab9 Compare June 6, 2018 17:56
@carolynvs carolynvs changed the title [WIP]Distinguish between user-defined and managed resources Distinguish between user-defined and managed resources Jun 6, 2018
@carolynvs carolynvs requested a review from arschles June 6, 2018 18:53
obj.SetOwnerReferences(append(obj.GetOwnerReferences(), controllerRef))
}

func isServiceCatalogManagedResource(resource metav1.Object) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure about this one. My reservation is that ClusterServiceClass and ClusterServicePlan already have a field (spec.ClusterServiceBrokerName) that carries information about which ClusterServiceBroker manages the resource.

does some research

Alright, I think I understand this now. I hate to do design in this PR, another option to achieve the same behavior (ignoring user-defined serviceclasses/serviceplans) would be to have an annotation saying that the serviceclass/plan is user-defined. Have you considered that yet? I guess the merit of this approach over the opt-in annotation would be that a user doesn't have to know about the special annotation and will get the right behavior, in the naive path. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

One thing I wonder about is whether setting the owner reference will have some unanticipated effects on garbage collection.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went down this path for a couple reasons:

  • When a user makes a custom plan, ClusterServiceBrokerName will be populated in their custom plan too. That's not enough to tell them apart.
  • Anything that wasn't made by our controller is automatically considered user defined. So that's a nicer UX.
  • We already wanted to add controller references anyway (see Use OwnerReference controller refs for parent/child relationships #1432).
  • As far as I understand owner / controller references, what we are trying to indicate "our controller made this, don't mess with it" fits perfectly into how they are supposed to be used.
  • I am explicitly turning off the garbage collection flag, BlockOwnerDeletion so that we don't affect current delete behavior.

Copy link
Contributor

Choose a reason for hiding this comment

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

Anything that wasn't made by our controller is automatically considered user defined. So that's a nicer UX.

I'm +1 on this approach because of this alone

Copy link
Contributor

@arschles arschles left a comment

Choose a reason for hiding this comment

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

LGTM

obj.SetOwnerReferences(append(obj.GetOwnerReferences(), controllerRef))
}

func isServiceCatalogManagedResource(resource metav1.Object) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Anything that wasn't made by our controller is automatically considered user defined. So that's a nicer UX.

I'm +1 on this approach because of this alone

@arschles arschles added the LGTM1 label Jun 14, 2018
@jeremyrickard
Copy link
Contributor

LGTM

@jboyd01
Copy link
Contributor

jboyd01 commented Jun 21, 2018

I'm still getting caught up on User Defined Plans but from what I understand, this makes sense to me. LGTM.

@jboyd01 jboyd01 added the LGTM2 label Jun 21, 2018
@jboyd01 jboyd01 merged commit c197c8b into kubernetes-retired:master Jun 21, 2018
@carolynvs
Copy link
Contributor Author

@jboyd01 This is part of the first milestone (User Defined Plans). I broke up the full proposal into smaller pieces so that we are shipping useful stuff incrementally.

https://github.com/carolynvs/service-catalog/blob/default-service-plan-proposal/docs/proposals/default-service-plans.md#milestones

The tldr of the feature is to get to the point where cluster operators can specify default params or secrets or key transforms, so that each binding or instance doesn't have to know all those details.

@carolynvs carolynvs deleted the mark-managed-classes-plans branch June 21, 2018 20:51
kikisdeliveryservice pushed a commit to kikisdeliveryservice/service-catalog that referenced this pull request Jun 29, 2018
…tired#2095)

Classes and plans that were created by the service catalog controller
during a list now have a controller reference set to indicate that they
are managed by service catalog.

User defined classes and plans will not
have a controller reference set, and are left alone during a list.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. LGTM1 LGTM2 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.

7 participants