Skip to content

Commit

Permalink
Remove owner for secret
Browse files Browse the repository at this point in the history
  • Loading branch information
isaaguilar committed May 17, 2024
1 parent fba2a73 commit 96646a6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/api/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -1599,6 +1599,13 @@ func NewTaskToken(db *gorm.DB, tfoResourceSpec models.TFOResourceSpec, _tenantID
ObjectMeta: metav1.ObjectMeta{
Name: secretName,
Namespace: tfoResource.Namespace,

// The OwnerReference is not working as expected and the secret is getting removed
// immediately after it's creation. Find out the right way to add ownership
// so the secrets have the same lifetime as the resource that consumes it.

/* ************************************************************
OwnerReferences: []metav1.OwnerReference{
{
APIVersion: string("tf.galleybytes.com/v1beta1"),
Expand All @@ -1609,6 +1616,8 @@ func NewTaskToken(db *gorm.DB, tfoResourceSpec models.TFOResourceSpec, _tenantID
BlockOwnerDeletion: newTrue(),
},
},
************************************************************* */
},

StringData: map[string]string{
Expand All @@ -1634,6 +1643,7 @@ func NewTaskToken(db *gorm.DB, tfoResourceSpec models.TFOResourceSpec, _tenantID
return nil, fmt.Errorf("failed to patch secret: %s", err)
}
}
log.Printf("Patched %s/%s in %s-%s", tfoResource.Namespace, secretName, tenantID, clusterName)

refreshToken := models.RefreshToken{
RefreshToken: hash,
Expand Down

0 comments on commit 96646a6

Please sign in to comment.