cnabio / cnab-go

A Go implementation of CNAB Core 1.0
MIT License
69 stars 35 forks source link

Make owner reference configurable for resources created by the kubernetes driver #300

Open carolynvs opened 1 year ago

carolynvs commented 1 year ago

The k8s driver has CLEANUP_JOBS which controls if the job and secret created by the driver should be immediately deleted after the job completes. I would like to have another setting, OWNER_REFERENCES, which allows me manage resource cleanup via cascading deletes and have more control over when they are deleted, giving me time to troubleshoot failed jobs for example.

Resources created by the driver (jobs, secrets) should include the specified owner references.

The format of the OWNER_REFERENCES environment variable should be a json serialized representation of metav1.OwnerReference. For example,

[]metav1.OwnerReference{
{
    APIVersion:         "getporter.org/v1",
    Kind:               "AgentAction",
    Name:               "install-a-bundle",
    UID:                "someuid",
    Controller:         pointer.Bool(true),
    BlockOwnerDeletion: pointer.Bool(true),
}