Skip to content

Commit

Permalink
Add a check if provided patch data
Browse files Browse the repository at this point in the history
  • Loading branch information
mdanielolsson committed Jul 13, 2020
1 parent 0654c58 commit 61f7cba
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/patch_secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ kubectl tbac patch secret my-secret --remove-data USERNAME --remove-data PASSWOR

// PatchSecret updates an already existing secret with patched content.
func PatchSecret(clientSet kubernetes.Interface, secretName *string, removeData, updateData *[]string) (err error) {
if len(*removeData) == 0 && len(*updateData) == 0 {
return fmt.Errorf("No patch data provided")
}

secretsClient := clientSet.CoreV1().Secrets(Namespace)

originalSecret, err := secretsClient.Get(*secretName, metav1.GetOptions{})
Expand Down

0 comments on commit 61f7cba

Please sign in to comment.