Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move all IAM resources to iam group and bump all of them to v1beta1 #996

Merged
merged 15 commits into from
Dec 13, 2021

Conversation

muvaf
Copy link
Member

@muvaf muvaf commented Dec 10, 2021

Description of your changes

The ones already on v1beta1 are kept as is with deprecation notice to not break users. All v1alpha1 ones are moved to iam group from identity and IAM prefix is dropped from their kind name.

User impact of this change will be that users will still have the old CRs in their clusters but there won't be a controller reconciling them. Re-creating the exact same resource with new group and kind will be the migration path.

This PR involves a lot of surgery, I tried my best to keep commits contained to one action for easier review.

Fixes #989

I have:

  • Read and followed Crossplane's contribution process.
  • Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

By following cluster/UPGRADE.md instructions that are added by this PR.

@muvaf muvaf force-pushed the iam-surgery-who-are-you branch 3 times, most recently from d3524b6 to 94ef0d7 Compare December 10, 2021 16:20
@muvaf muvaf marked this pull request as ready for review December 11, 2021 23:04
@muvaf muvaf requested review from AaronME and haarchri December 11, 2021 23:04
@muvaf
Copy link
Member Author

muvaf commented Dec 11, 2021

It's ready to review now. I've tested it with instructions in cluster/UPGRADE.md

@muvaf muvaf mentioned this pull request Dec 11, 2021
2 tasks
@muvaf
Copy link
Member Author

muvaf commented Dec 13, 2021

Tested the composition part of the guide with the following artifacts:

apiVersion: apiextensions.crossplane.io/v1
kind: CompositeResourceDefinition
metadata:
  name: xpostgresqlinstances.database.example.org
spec:
  group: database.example.org
  names:
    kind: XPostgreSQLInstance
    plural: xpostgresqlinstances
  claimNames:
    kind: PostgreSQLInstance
    plural: postgresqlinstances
  versions:
  - name: v1alpha1
    served: true
    referenceable: true
    schema:
      openAPIV3Schema:
        type: object
        properties:
          spec:
            type: object
            properties:
              parameters:
                type: object
                properties:
                  storageGB:
                    type: integer
---
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
  name: xpostgresqlinstances.aws.database.example.org
  labels:
    provider: aws
    guide: quickstart
    vpc: default
spec:
  writeConnectionSecretsToNamespace: crossplane-system
  compositeTypeRef:
    apiVersion: database.example.org/v1alpha1
    kind: XPostgreSQLInstance
  resources:
    - name: user
      base:
        apiVersion: identity.aws.crossplane.io/v1alpha1
        kind: IAMUser
        spec:
          forProvider:
            tags:
              - key: k1
                value: v1
          providerConfigRef:
            name: example
    - name: key
      base:
        apiVersion: identity.aws.crossplane.io/v1alpha1
        kind: IAMAccessKey
        spec:
          forProvider:
            userNameSelector:
              matchControllerRef: true
          providerConfigRef:
            name: example
          writeConnectionSecretToRef:
            name: access-key-secret
            namespace: crossplane-system
    - name: role
      base:
        apiVersion: identity.aws.crossplane.io/v1beta1
        kind: IAMRole
        spec:
          forProvider:
            assumeRolePolicyDocument: |-
              {
                "Version": "2012-10-17",
                "Statement": [
                    {
                        "Effect": "Allow",
                        "Principal": {
                            "Service": [
                                "ec2.amazonaws.com",
                                "eks.amazonaws.com",
                                "eks-fargate-pods.amazonaws.com",
                                "lambda.amazonaws.com",
                                "s3.amazonaws.com"
                            ]
                        },
                        "Action": [
                            "sts:AssumeRole"
                        ]
                    }
                ]
              }
            tags:
              - key: k1
                value: v1
          providerConfigRef:
            name: example

Claim:

apiVersion: database.example.org/v1alpha1
kind: PostgreSQLInstance
metadata:
  name: muvafclaim
  namespace: default
spec: {}

Once all all got ready, I followed the guide and successfully migrated to the new APIs.

muvaf added 15 commits December 13, 2021 19:27
Signed-off-by: Muvaffak Onus <[email protected]>
…d their controllers similar to v1alpha1 ones to reduce the risk of something going wrong during migration

Signed-off-by: Muvaffak Onus <[email protected]>
Copy link
Member

@haarchri haarchri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested all of IAM ressource also via Composition looks great to me - LGTM
thanks for rebase ACM/ACMPCA stuff to get rid of master issues with check-diff ;)

@muvaf
Copy link
Member Author

muvaf commented Dec 13, 2021

Thanks a lot @haarchri !!

@muvaf muvaf merged commit f3c65e5 into crossplane-contrib:master Dec 13, 2021
@muvaf muvaf deleted the iam-surgery-who-are-you branch December 13, 2021 20:59
tektondeploy pushed a commit to gtn3010/provider-aws that referenced this pull request Mar 12, 2024
…e-3.x

Update alpine Docker tag to v3.18.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename of IAM resources
2 participants