func()

in cmd/resource/k8sauth.go [128:156]


func (i IamAuthMap) addCaller(sess *session.Session) (*IamAuthMap, error) {
	arn, err := getCaller(sts.New(sess))
	if err != nil {
		return nil, err
	}
	if isUserArn(arn) {
		i.MapUsers = append(i.MapUsers, userMapping{
			UserArn: *arn,
			Groups: []string{
				"aws-auth-admin",
			},
		})
	} else {
		i.MapRoles = append(i.MapRoles, roleMapping{
			RoleArn: *arn,
			Groups: []string{
				"aws-auth-admin",
			},
		})
	}
	// add role for access of private clusters in VPC
	i.MapRoles = append(i.MapRoles, roleMapping{
		RoleArn: fmt.Sprintf("arn:%s:iam::%s:role/CloudFormation-Kubernetes-VPC", *partitionFromArn(arn), *accountIdFromArn(arn)),
		Groups: []string{
			"aws-auth-admin",
		},
	})
	return &i, nil
}