Skip to content

Commit

Permalink
Merge pull request #10940 from hakman/sort-external-policies
Browse files Browse the repository at this point in the history
Sort external policies when checking for changes
  • Loading branch information
k8s-ci-robot authored Feb 27, 2021
2 parents 5c3ce59 + 925350f commit 6e7f635
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/model/iam.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package model

import (
"fmt"
"sort"
"strings"

"k8s.io/klog/v2"
Expand Down Expand Up @@ -254,6 +255,7 @@ func (b *IAMModelBuilder) buildIAMTasks(role iam.Subject, iamName string, c *fi.
p := *(b.Cluster.Spec.ExternalPolicies)
externalPolicies = append(externalPolicies, p[roleKey]...)
}
sort.Strings(externalPolicies)

name := fmt.Sprintf("%s-policyoverride", roleKey)
t := &awstasks.IAMRolePolicy{
Expand Down
2 changes: 2 additions & 0 deletions upup/pkg/fi/cloudup/awstasks/iamrolepolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"
"hash/fnv"
"net/url"
"sort"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
Expand Down Expand Up @@ -76,6 +77,7 @@ func (e *IAMRolePolicy) Find(c *fi.Context) (*IAMRolePolicy, error) {
policies = append(policies, aws.StringValue(policy.PolicyArn))
}
}
sort.Strings(policies)

actual.ID = e.ID
actual.Name = e.Name
Expand Down

0 comments on commit 6e7f635

Please sign in to comment.