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

Filter attachment(s) based on watch #14

Closed
AmitKumarDas opened this issue Sep 14, 2019 · 3 comments
Closed

Filter attachment(s) based on watch #14

AmitKumarDas opened this issue Sep 14, 2019 · 3 comments
Assignees
Labels
enhancement New feature or request select

Comments

@AmitKumarDas
Copy link
Owner

AmitKumarDas commented Sep 14, 2019

Motivation

Metac's GenericController introduces the concept of watch and attachments. One can think of watch as the resource that is observed via Informer and attachments as the resources that should be fetched/listed via Lister based invocations. With this concept in mind, how do we filter out the attachments that belong to the particular watch. Note that GenericController should list the attachments that may or may not be owned by the watch resource. In order to keep the attachments arbitrary and still if required filter them based on watch is what this issue is all about.

Possible Solution

This is the current GenericController that watches kind:Storage and returns the watch object along with all the PVCs and PVs.

spec:
  watch:
    apiVersion: core/v1alpha1
    resource: storages
  attachments:
  - apiVersion: storage/v1
    resource: persistentvolumeclaims
  - apiVersion: storage/v1
    resource: persistentvolumes

This is the suggested GenericController that watches kind:Storage and returns specific PVCs & PVs. In this particular spec, PVCs that are owned by Storage and PVs that have the Storage name as its annotation are selected.

spec:
  watch:
    apiVersion: core/v1alpha1
    resource: storages
  attachments:
  - apiVersion: storage/v1
    resource: persistentvolumeclaims
    matchesWatch:
      expressions:
      - operator: OwnerIsWatch # Does watch own this PVC?
  - apiVersion: storage/v1
    resource: persistentvolumes
    matchesWatch:
      expressions:
      - key: ddp.openebs.io/storage-name # a key in PV's annotations
        operator: AnnotationIsWatchName # Is annotation value the name of Watch
@AmitKumarDas AmitKumarDas added the enhancement New feature or request label Sep 14, 2019
@AmitKumarDas
Copy link
Owner Author

Some of the schema definitions that can be referred to are:

@AmitKumarDas
Copy link
Owner Author

#51

@AmitKumarDas
Copy link
Owner Author

closing this as part of following commits:
https://github.com/AmitKumarDas/metac/issues?q=label%3Aselect+is%3Aclosed

@AmitKumarDas AmitKumarDas self-assigned this Mar 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request select
Projects
None yet
Development

No branches or pull requests

1 participant