@@ -560,6 +560,26 @@ func (s *Service) bucketPolicy(bucketName string) (string, error) {
560560 },
561561 Action : []string {"s3:GetObject" },
562562 Resource : []string {fmt .Sprintf ("arn:%s:s3:::%s/machine-pool/*" , partition , bucketName )},
563+ },
564+ // At GiantSwarm we are creating karpenter node pools to manage the worker nodes.
565+ // These nodes need access to the userdata stored in the folder created by karpenter.
566+ iam.StatementEntry {
567+ Sid : iamInstanceProfile ,
568+ Effect : iam .EffectAllow ,
569+ Principal : map [iam.PrincipalType ]iam.PrincipalID {
570+ iam .PrincipalAWS : []string {fmt .Sprintf ("arn:%s:iam::%s:role/%s" , partition , * accountID .Account , iamInstanceProfile )},
571+ },
572+ Action : []string {"s3:GetObject" },
573+ Resource : []string {fmt .Sprintf ("arn:%s:s3:::%s/karpenter-machine-pool/*" , partition , bucketName )},
574+ },
575+ iam.StatementEntry {
576+ Sid : iamInstanceProfile ,
577+ Effect : iam .EffectAllow ,
578+ Principal : map [iam.PrincipalType ]iam.PrincipalID {
579+ iam .PrincipalAWS : []string {fmt .Sprintf ("arn:%s:iam::%s:role/%s" , partition , * accountID .Account , iamInstanceProfile )},
580+ },
581+ Action : []string {"s3:ListBucket" },
582+ Resource : []string {fmt .Sprintf ("arn:%s:s3:::%s" , partition , bucketName )},
563583 })
564584 }
565585 }
0 commit comments