Skip to content

Commit

Permalink
Review feedback, thanks @matthchr
Browse files Browse the repository at this point in the history
  • Loading branch information
babbageclunk committed Mar 23, 2021
1 parent f2b1705 commit 7bb0c13
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions api/v1alpha1/conversion_stash.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,18 @@ import (

"github.com/pkg/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/conversion"
)

const conversionStashAnnotation = "azure.microsoft.com/convert-stash"

// getStashedAnnotation unmarshals the convert-stash annotation value
// into the target pointer, if the annotation is present. It returns
// whether the annotation was present, and any error from unmarshalling.
func getStashedAnnotation(meta metav1.ObjectMeta, target interface{}) (bool, error) {
if _, err := conversion.EnforcePtr(target); err != nil {
return false, errors.Errorf("getStashedAnnotation target must be a pointer, not %T", target)
}
if meta.Annotations == nil {
return false, nil
}
Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha1/mysqlaaduser_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ func (dst *MySQLAADUser) ConvertFrom(srcRaw conversion.Hub) error {
for dbName := range src.Spec.DatabaseRoles {
dbNames = append(dbNames, dbName)
}
// Sorting the list of names for testing (and so that a client
// gets a consistent value back for a resource).
sort.Strings(dbNames)
var (
dbName string
Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha1/mysqluser_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ func (dst *MySQLUser) ConvertFrom(srcRaw conversion.Hub) error {
for dbName := range src.Spec.DatabaseRoles {
dbNames = append(dbNames, dbName)
}
// Sorting the list of names for testing (and so that a client
// gets a consistent value back for a resource).
sort.Strings(dbNames)
var (
dbName string
Expand Down

0 comments on commit 7bb0c13

Please sign in to comment.