Skip to content

Commit

Permalink
Merge pull request #9 from Bisnode/fix_time_created_reset
Browse files Browse the repository at this point in the history
Issue #8, time created now survive recreation of secret when deleting…
  • Loading branch information
mdanielolsson authored Jun 4, 2020
2 parents ff612be + cf3e42d commit 4f11ad4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions cmd/create_secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ func CreateSecret(clientSet kubernetes.Interface, secretName, container *string,
},
Annotations: map[string]string{
"tbac.bisnode.com/last-modified": fmt.Sprintf("%v", metav1.Now().Rfc3339Copy()),
"tbac.bisnode.com/time-created": fmt.Sprintf("%v", metav1.Now().Rfc3339Copy()),
},
},
Data: util.AssembleInputData(data),
Expand Down
6 changes: 3 additions & 3 deletions cmd/get_secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
type SecretDescription struct {
Namespace string
Name string
CreationTimestamp metav1.Time
CreationTimestamp string
LastUpdated string
Service string
Container string
Expand Down Expand Up @@ -128,7 +128,7 @@ func GetSecretDescription(clientSet kubernetes.Interface, secretName string) (se
// kubernetes fake-client that is used for testing
// we cannot check for exactly one result
if len(secrets.Items) < 1 {
err := fmt.Errorf("Secret not found: %v/%v\n", Namespace, secretName)
err := fmt.Errorf("Secret not found: %v/%v", Namespace, secretName)
return nil, err
}

Expand All @@ -140,9 +140,9 @@ func GetSecretDescription(clientSet kubernetes.Interface, secretName string) (se
Namespace: Namespace,
Name: secretName,
LastUpdated: secrets.Items[0].Annotations["tbac.bisnode.com/last-modified"],
CreationTimestamp: secrets.Items[0].Annotations["tbac.bisnode.com/time-created"],
Service: secrets.Items[0].Labels["app"],
Container: secrets.Items[0].Labels["tbac.bisnode.com/container"],
CreationTimestamp: secrets.Items[0].CreationTimestamp,
Data: data,
}
return secretDesc, nil
Expand Down

0 comments on commit 4f11ad4

Please sign in to comment.