redradrat / aws-iam-operator

AWS IAM Operator for Kubernetes
Apache License 2.0
32 stars 7 forks source link

Add role.awsRoleName & policy.awsPolicyName #36

Closed jorgeperis closed 1 year ago

jorgeperis commented 1 year ago

Old PR => https://github.com/redradrat/aws-iam-operator/pull/33

In order to create ephemeral environments for each PR we need to update some fields for role and policy.

Each time a microservice creates a PR we link the manifest in the PR branch with a new ArgoCD app made ad-hoc for the PR. The issue is that some aws objects have the same name and we need the ability to change those names.

roles and policies are creating the aws objects with the name defined in "metadata.name", and is causing a conflict with the same objects created from the "main" branch.

So, this PR allows to add a value for "role.spec.awsRoleName" and "policy.spec.awsPolicyName" that takes precedence over "metadata.name".

It has backwards compatibility since "awsRoleName" is not required, is only used when is present.

I've been testing this changes and in both cases the aws resource created have the correct name (awsRoleName or awsPolicyName)