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

Prune resources with ownerReferences if they belong to Stack #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pre
Copy link
Contributor

@pre pre commented May 4, 2020

When eg. a controller is the owner of its resources, it also controls
the metadata.ownerReferences field. Stack is not able to prune its
resources correctly if any resources with ownerReferences are kept.

When passing owner_reference: to Stack#apply or Stack#prune, any
owned resources matching to given owner_reference will be deemed
ours and be pruned.

@pre pre force-pushed the feat/prune-with-ownerreference branch from 4eebb7a to b9ea2c4 Compare May 4, 2020 19:03
@matti matti requested review from kke and jakolehm May 4, 2020 19:45
When eg. a controller is the owner of its resources, it also controls
the metadata.ownerReferences field. Stack is not able to prune its
resources correctly if any resources with ownerReferences are kept.

When passing owner_reference: to Stack#apply or Stack#prune, any
owned resources matching to given owner_reference will be deemed
ours and be pruned.
@pre pre force-pushed the feat/prune-with-ownerreference branch from b9ea2c4 to 8321ce5 Compare May 5, 2020 06:09
@@ -94,7 +94,7 @@ def prepare_resource(resource, base_resource: nil)

# @param client [K8s::Client]
# @return [Array<K8s::Resource>]
def apply(client, prune: true, patch: true)
def apply(client, patch: true, prune: true, owner_reference: nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

Not completely happy that we need to add yet-another parameter here but I get why it's needed.

@@ -140,7 +140,7 @@ def keep_resource?(resource)
# @param client [K8s::Client]
# @param keep_resources [NilClass, Boolean]
# @param skip_forbidden [Boolean]
def prune(client, keep_resources:, skip_forbidden: true)
def prune(client, keep_resources:, skip_forbidden: true, owner_reference: nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add owner_reference to yardocs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants