Skip to content

Commit

Permalink
Add secret Activation time getter
Browse files Browse the repository at this point in the history
Signed-off-by: raihankhan <[email protected]>
  • Loading branch information
raihankhan committed Dec 9, 2024
1 parent 6e2c75b commit 3d93508
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions apis/kubedb/v1/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package v1
import (
"context"
"fmt"
"time"

"kubedb.dev/apimachinery/apis/kubedb"

Expand Down Expand Up @@ -167,3 +168,14 @@ func GetSelectorForNetworkPolicy() map[string]string {
meta_util.ManagedByLabelKey: kubedb.GroupName,
}
}

func GetActivationTimeFromSecret(secretName *core.Secret) (*metav1.Time, error) {
if val, exists := secretName.Annotations[kubedb.AuthActiveFromAnnotation]; exists {
t, err := time.Parse(time.RFC3339, val)
if err != nil {
return nil, err
}
return &metav1.Time{Time: t}, nil
}
return nil, nil
}

0 comments on commit 3d93508

Please sign in to comment.