When the CLI creates a new stack, it should set the Kabanero owner, like the operator does. The object ownership ensures that when a Kabanero CR instance is deleted, all of its Stack CRs (and their pipelines, tasks, etc) are also deleted.
It's basically taking a bunch of fields from the Kabanero CR instance (UID, group, version, kind) and copying them to the metadata of the new Stack CR instance, in the OwnerReference field.
When the CLI creates a new stack, it should set the Kabanero owner, like the operator does. The object ownership ensures that when a Kabanero CR instance is deleted, all of its Stack CRs (and their pipelines, tasks, etc) are also deleted.
For reference, the operator code that does this is here: https://github.com/kabanero-io/kabanero-operator/blob/cbf1390648075914e26a139c21de629ffc2dea30/pkg/controller/kabaneroplatform/featured_collections.go#L40
It's basically taking a bunch of fields from the Kabanero CR instance (UID, group, version, kind) and copying them to the metadata of the new Stack CR instance, in the OwnerReference field.