Skip to content

Commit

Permalink
update IAMServiceaccount uses a unique changeset name to allow succes…
Browse files Browse the repository at this point in the history
…sive updates (#3605)
  • Loading branch information
Jake Klein committed Apr 20, 2021
1 parent ec77bdd commit 8bc2500
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ require (
github.com/gofrs/flock v0.8.0
github.com/golangci/golangci-lint v1.39.0
github.com/gomarkdown/markdown v0.0.0-20201113031856-722100d81a8e // indirect
github.com/google/uuid v1.2.0 // indirect
github.com/goreleaser/goreleaser v0.162.0
github.com/instrumenta/kubeval v0.0.0-20190918223246-8d013ec9fc56
github.com/justinbarrick/go-k8s-portforward v1.0.4-0.20200904152830-b575325c1855
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,8 @@ github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs=
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/wire v0.4.0 h1:kXcsA/rIGzJImVqPdhfnr6q0xsS9gU0515q1EPpJ9fE=
github.com/google/wire v0.4.0/go.mod h1:ngWDr9Qvq3yZA10YrxfyGELY/AFWGVpy9c1LTRi1EoU=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
Expand Down
3 changes: 2 additions & 1 deletion pkg/actions/irsa/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package irsa
import (
"fmt"

"github.com/google/uuid"
iamoidc "github.com/weaveworks/eksctl/pkg/iam/oidc"

"github.com/weaveworks/eksctl/pkg/cfn/builder"
Expand Down Expand Up @@ -58,5 +59,5 @@ func (t *updateIAMServiceAccountTask) Do(errorCh chan error) error {
}()

desc := fmt.Sprintf("updating policies for IAMServiceAccount %s/%s", t.sa.Namespace, t.sa.Name)
return t.stackManager.UpdateStack(stackName, "updating-policy", desc, t.templateData, nil)
return t.stackManager.UpdateStack(stackName, fmt.Sprintf("updating-policy-%s", uuid.NewString()), desc, t.templateData, nil)
}
2 changes: 1 addition & 1 deletion pkg/actions/irsa/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ var _ = Describe("Update", func() {
fakeStackManager.UpdateStackArgsForCall(0)
stackName, changeSetName, description, templateData, _ := fakeStackManager.UpdateStackArgsForCall(0)
Expect(stackName).To(Equal("eksctl-my-cluster-addon-iamserviceaccount-default-test-sa"))
Expect(changeSetName).To(Equal("updating-policy"))
Expect(changeSetName).To(ContainSubstring("updating-policy"))
Expect(description).To(Equal("updating policies for IAMServiceAccount default/test-sa"))
Expect(err).NotTo(HaveOccurred())
Expect(string(templateData.(manager.TemplateBody))).To(ContainSubstring("arn-123"))
Expand Down

0 comments on commit 8bc2500

Please sign in to comment.