Skip to content

Commit

Permalink
Treat ttl <= 0 as infinite
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuildthecloud committed Aug 29, 2020
1 parent b120c41 commit 9e1c071
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/controllers/clusterregistrationtoken/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ func (h *handler) getValuesYAMLSecret(token *fleet.ClusterRegistrationToken, sec

func (h *handler) deleteExpired(token *fleet.ClusterRegistrationToken) (bool, error) {
ttl := token.Spec.TTLSeconds
if ttl <= 0 {
return false, nil
}
expire := token.CreationTimestamp.Add(time.Second * time.Duration(ttl))
if time.Now().After(expire) {
return true, h.clusterRegistrationTokens.Delete(token.Namespace, token.Name, nil)
Expand Down

0 comments on commit 9e1c071

Please sign in to comment.