diff --git a/compositions/upbound-aws-provider/dynamodb/definition.yaml b/compositions/upbound-aws-provider/dynamodb/definition.yaml index 43ac6414..ef990e28 100644 --- a/compositions/upbound-aws-provider/dynamodb/definition.yaml +++ b/compositions/upbound-aws-provider/dynamodb/definition.yaml @@ -29,98 +29,102 @@ spec: spec: type: object properties: - attribute: #required for hashKey and/or rangeKey - items: - properties: - name: #name of the hashKey and/or rangeKey + resourceConfig: + properties: + attribute: #required for hashKey and/or rangeKey + items: + properties: + name: #name of the hashKey and/or rangeKey + type: string + type: + enum: + - B #binary + - N #number + - S #string + type: string + required: + - name + - type + type: object + type: array + hashKey: + type: string + rangeKey: + type: string + billingMode: + type: string + default: PAY_PER_REQUEST + readCapacity: + type: number + writeCapacity: + type: number + name: + type: string + providerConfigName: + type: string + default: aws-provider-config + region: + type: string + tags: + additionalProperties: type: string - type: - enum: - - B #binary - - N #number - - S #string - type: string - required: - - name - - type - type: object - type: array - hashKey: - type: string - rangeKey: - type: string - billingMode: - type: string - default: PAY_PER_REQUEST - readCapacity: - type: number - writeCapacity: - type: number - name: - type: string - providerConfigName: - type: string - default: aws-provider-config - region: - type: string - tags: - additionalProperties: - type: string - description: Key-value map of resource tags. + description: Key-value map of resource tags. + type: object + globalSecondaryIndex: + items: + properties: + hashKey: + type: string + name: + type: string + rangeKey: + type: string + readCapacity: + type: number + writeCapacity: + type: number + projectionType: + type: string + nonKeyAttributes: #required for gsi + items: + type: string + type: array + type: object + required: + - hashKey + - name + - rangeKey + - readCapacity + - writeCapacity + - projectionType + - nonKeyAttributes + type: array + localSecondaryIndex: + items: + properties: + name: + type: string + rangeKey: + type: string + projectionType: + type: string + nonKeyAttributes: #required for lsi + items: + type: string + type: array + type: object + required: + - name + - rangeKey + - projectionType + - nonKeyAttributes + type: array + required: + - hashKey + - attribute type: object - globalSecondaryIndex: - items: - properties: - hashKey: - type: string - name: - type: string - rangeKey: - type: string - readCapacity: - type: number - writeCapacity: - type: number - projectionType: - type: string - nonKeyAttributes: #required for gsi - items: - type: string - type: array - type: object - required: - - hashKey - - name - - rangeKey - - readCapacity - - writeCapacity - - projectionType - - nonKeyAttributes - type: array - localSecondaryIndex: - items: - properties: - name: - type: string - rangeKey: - type: string - projectionType: - type: string - nonKeyAttributes: #required for gsi - items: - type: string - type: array - type: object - required: - - name - - rangeKey - - projectionType - - nonKeyAttributes - type: array required: - - region - - hashKey - - attribute + - resourceConfig status: type: object description: TableStatus defines the observed state of Table diff --git a/compositions/upbound-aws-provider/dynamodb/table.yaml b/compositions/upbound-aws-provider/dynamodb/table.yaml index b3d80bc2..c2a42865 100644 --- a/compositions/upbound-aws-provider/dynamodb/table.yaml +++ b/compositions/upbound-aws-provider/dynamodb/table.yaml @@ -17,13 +17,13 @@ spec: - name: common-fields patches: - type: FromCompositeFieldPath - fromFieldPath: spec.providerConfigName + fromFieldPath: spec.resourceConfig.providerConfigName toFieldPath: spec.providerConfigRef.name - type: FromCompositeFieldPath - fromFieldPath: spec.region + fromFieldPath: spec.resourceConfig.region toFieldPath: spec.forProvider.region - type: FromCompositeFieldPath - fromFieldPath: spec.name + fromFieldPath: spec.resourceConfig.name toFieldPath: metadata.annotations[crossplane.io/external-name] resources: - name: table @@ -34,9 +34,6 @@ spec: - type: FromFieldPath name: tableArn fromFieldPath: status.atProvider.arn - - type: FromFieldPath - name: region - fromFieldPath: metadata.annotations[crossplane.io/region] base: apiVersion: dynamodb.aws.upbound.io/v1beta1 kind: Table @@ -48,41 +45,41 @@ spec: - type: PatchSet patchSetName: common-fields - type: FromCompositeFieldPath - fromFieldPath: spec.attribute + fromFieldPath: spec.resourceConfig.attribute toFieldPath: spec.forProvider.attribute policy: mergeOptions: appendSlice: true keepMapValues: true - type: FromCompositeFieldPath - fromFieldPath: spec.tags + fromFieldPath: spec.resourceConfig.tags toFieldPath: spec.forProvider.tags policy: mergeOptions: keepMapValues: true - type: FromCompositeFieldPath - fromFieldPath: spec.hashKey + fromFieldPath: spec.resourceConfig.hashKey toFieldPath: spec.forProvider.hashKey - type: FromCompositeFieldPath - fromFieldPath: spec.billingMode + fromFieldPath: spec.resourceConfig.billingMode toFieldPath: spec.forProvider.billingMode - type: FromCompositeFieldPath - fromFieldPath: spec.rangeKey + fromFieldPath: spec.resourceConfig.rangeKey toFieldPath: spec.forProvider.rangeKey - type: FromCompositeFieldPath - fromFieldPath: spec.readCapacity + fromFieldPath: spec.resourceConfig.readCapacity toFieldPath: spec.forProvider.readCapacity - type: FromCompositeFieldPath - fromFieldPath: spec.writeCapacity + fromFieldPath: spec.resourceConfig.writeCapacity toFieldPath: spec.forProvider.writeCapacity - type: FromCompositeFieldPath - fromFieldPath: spec.globalSecondaryIndex + fromFieldPath: spec.resourceConfig.globalSecondaryIndex toFieldPath: spec.forProvider.globalSecondaryIndex policy: mergeOptions: keepMapValues: true - type: FromCompositeFieldPath - fromFieldPath: spec.localSecondaryIndex + fromFieldPath: spec.resourceConfig.localSecondaryIndex toFieldPath: spec.forProvider.localSecondaryIndex policy: mergeOptions: @@ -93,9 +90,3 @@ spec: - type: ToCompositeFieldPath fromFieldPath: status.atProvider.arn toFieldPath: status.tableArn - - type: FromCompositeFieldPath - fromFieldPath: spec.region - toFieldPath: metadata.annotations[crossplane.io/region] - - type: ToCompositeFieldPath - fromFieldPath: metadata.annotations[crossplane.io/region] - toFieldPath: status.region diff --git a/examples/upbound-aws-provider/composite-resources/databases/dynamodb/dynamodbtable-ondemand.yaml b/examples/upbound-aws-provider/composite-resources/databases/dynamodb/dynamodbtable-ondemand.yaml new file mode 100644 index 00000000..9972ba06 --- /dev/null +++ b/examples/upbound-aws-provider/composite-resources/databases/dynamodb/dynamodbtable-ondemand.yaml @@ -0,0 +1,17 @@ +apiVersion: awsblueprints.io/v1alpha1 +kind: DynamoDBTable +metadata: + name: test-dynamodb-table + namespace: default +spec: + writeConnectionSecretToRef: + name: dynamo2 + resourceConfig: + attribute: + - name: UserId + type: S + hashKey: UserId + region: us-west-2 + tags: + namespace: team-x + cluster: crossplane diff --git a/examples/upbound-aws-provider/composite-resources/databases/dynamodb/dynamodbtable-provisioned-composite-gsi.yaml b/examples/upbound-aws-provider/composite-resources/databases/dynamodb/dynamodbtable-provisioned-composite-gsi.yaml new file mode 100644 index 00000000..6d6b7ee0 --- /dev/null +++ b/examples/upbound-aws-provider/composite-resources/databases/dynamodb/dynamodbtable-provisioned-composite-gsi.yaml @@ -0,0 +1,34 @@ +apiVersion: awsblueprints.io/v1alpha1 +kind: DynamoDBTable +metadata: + name: test-gsi-dynamodb-table + namespace: default +spec: + writeConnectionSecretToRef: + name: dynamogsi + resourceConfig: + attribute: + - name: UserId + type: S + - name: UserName + type: S + - name: Pass + type: B + billingMode: PROVISIONED + globalSecondaryIndex: + - hashKey: UserName + name: UserNameIndex + nonKeyAttributes: + - UserId + projectionType: INCLUDE + rangeKey: Pass + readCapacity: 10 + writeCapacity: 10 + readCapacity: 20 + writeCapacity: 20 + hashKey: UserId + rangeKey: UserName + region: us-west-2 + tags: + namespace: team-x + cluster: crossplane diff --git a/examples/upbound-aws-provider/composite-resources/databases/dynamodb/dynamodbtable-provisioned-composite-lsi.yaml b/examples/upbound-aws-provider/composite-resources/databases/dynamodb/dynamodbtable-provisioned-composite-lsi.yaml new file mode 100644 index 00000000..4dc808c9 --- /dev/null +++ b/examples/upbound-aws-provider/composite-resources/databases/dynamodb/dynamodbtable-provisioned-composite-lsi.yaml @@ -0,0 +1,31 @@ +apiVersion: awsblueprints.io/v1alpha1 +kind: DynamoDBTable +metadata: + name: test-lsi2-dynamodb-table + namespace: default +spec: + writeConnectionSecretToRef: + name: dynamolsi + resourceConfig: + attribute: + - name: Artist + type: S + - name: SongTitle + type: S + - name: AlbumTitle + type: S + billingMode: PROVISIONED + localSecondaryIndex: + - name: AlbumTitleIndex + nonKeyAttributes: + - Genre + projectionType: INCLUDE + rangeKey: AlbumTitle + readCapacity: 20 + writeCapacity: 20 + hashKey: Artist + rangeKey: SongTitle + region: us-west-2 + tags: + namespace: team-x + cluster: crossplane diff --git a/examples/upbound-aws-provider/composite-resources/databases/dynamodb/dynamodbtable-provisioned-composite.yaml b/examples/upbound-aws-provider/composite-resources/databases/dynamodb/dynamodbtable-provisioned-composite.yaml new file mode 100644 index 00000000..968d7338 --- /dev/null +++ b/examples/upbound-aws-provider/composite-resources/databases/dynamodb/dynamodbtable-provisioned-composite.yaml @@ -0,0 +1,23 @@ +apiVersion: awsblueprints.io/v1alpha1 +kind: DynamoDBTable +metadata: + name: test-pro-dynamodb-table + namespace: default +spec: + writeConnectionSecretToRef: + name: dynamopc + resourceConfig: + attribute: + - name: UserId + type: S + - name: UserName + type: S + billingMode: PROVISIONED + readCapacity: 2 + writeCapacity: 2 + hashKey: UserId + rangeKey: UserName + region: us-west-2 + tags: + namespace: team-x + cluster: crossplane diff --git a/examples/upbound-aws-provider/composite-resources/databases/dynamodb/dynamodbtable-provisioned.yaml b/examples/upbound-aws-provider/composite-resources/databases/dynamodb/dynamodbtable-provisioned.yaml new file mode 100644 index 00000000..d5390139 --- /dev/null +++ b/examples/upbound-aws-provider/composite-resources/databases/dynamodb/dynamodbtable-provisioned.yaml @@ -0,0 +1,20 @@ +apiVersion: awsblueprints.io/v1alpha1 +kind: DynamoDBTable +metadata: + name: test-pro-dynamodb-table + namespace: default +spec: + writeConnectionSecretToRef: + name: dynamo + resourceConfig: + attribute: + - name: UserId + type: S + billingMode: PROVISIONED + readCapacity: 2 + writeCapacity: 2 + hashKey: UserId + region: us-west-2 + tags: + namespace: team-x + cluster: crossplane diff --git a/examples/upbound-aws-provider/composite-resources/dynamodb-provisioned-composite-gsi.yaml b/examples/upbound-aws-provider/composite-resources/dynamodb-provisioned-composite-gsi.yaml deleted file mode 100644 index 7284b3a9..00000000 --- a/examples/upbound-aws-provider/composite-resources/dynamodb-provisioned-composite-gsi.yaml +++ /dev/null @@ -1,33 +0,0 @@ -apiVersion: awsblueprints.io/v1alpha1 -kind: DynamoDBTable -metadata: - name: test-gsi-dynamodb-table - namespace: default -spec: - writeConnectionSecretToRef: - name: dynamogsi - attribute: - - name: UserId - type: S - - name: UserName - type: S - - name: Pass - type: B - billingMode: PROVISIONED - globalSecondaryIndex: - - hashKey: UserName - name: UserNameIndex - nonKeyAttributes: - - UserId - projectionType: INCLUDE - rangeKey: Pass - readCapacity: 10 - writeCapacity: 10 - readCapacity: 20 - writeCapacity: 20 - hashKey: UserId - rangeKey: UserName - region: us-east-1 - tags: - namespace: team-x - cluster: crossplane diff --git a/examples/upbound-aws-provider/composite-resources/dynamodb-provisioned-composite-lsi.yaml b/examples/upbound-aws-provider/composite-resources/dynamodb-provisioned-composite-lsi.yaml deleted file mode 100644 index 400ae37c..00000000 --- a/examples/upbound-aws-provider/composite-resources/dynamodb-provisioned-composite-lsi.yaml +++ /dev/null @@ -1,30 +0,0 @@ -apiVersion: awsblueprints.io/v1alpha1 -kind: DynamoDBTable -metadata: - name: test-lsi2-dynamodb-table - namespace: default -spec: - writeConnectionSecretToRef: - name: dynamolsi2 - attribute: - - name: Artist - type: S - - name: SongTitle - type: S - - name: AlbumTitle - type: S - billingMode: PROVISIONED - localSecondaryIndex: - - name: AlbumTitleIndex - nonKeyAttributes: - - Genre - projectionType: INCLUDE - rangeKey: AlbumTitle - readCapacity: 20 - writeCapacity: 20 - hashKey: Artist - rangeKey: SongTitle - region: us-east-1 - tags: - namespace: team-x - cluster: crossplane diff --git a/examples/upbound-aws-provider/composite-resources/dynamodb-provisioned-composite.yaml b/examples/upbound-aws-provider/composite-resources/dynamodb-provisioned-composite.yaml deleted file mode 100644 index b714856c..00000000 --- a/examples/upbound-aws-provider/composite-resources/dynamodb-provisioned-composite.yaml +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: awsblueprints.io/v1alpha1 -kind: DynamoDBTable -metadata: - name: test-pro-dynamodb-table - namespace: default -spec: - writeConnectionSecretToRef: - name: dynamopc - attribute: - - name: UserId - type: S - - name: UserName - type: S - billingMode: PROVISIONED - readCapacity: 2 - writeCapacity: 2 - hashKey: UserId - rangeKey: UserName - region: us-east-1 - tags: - namespace: team-x - cluster: crossplane diff --git a/examples/upbound-aws-provider/composite-resources/dynamodb-provisioned.yaml b/examples/upbound-aws-provider/composite-resources/dynamodb-provisioned.yaml deleted file mode 100644 index 520fa1a9..00000000 --- a/examples/upbound-aws-provider/composite-resources/dynamodb-provisioned.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: awsblueprints.io/v1alpha1 -kind: DynamoDBTable -metadata: - name: test-pro-dynamodb-table - namespace: default -spec: - writeConnectionSecretToRef: - name: dynamo - attribute: - - name: UserId - type: S - billingMode: PROVISIONED - readCapacity: 2 - writeCapacity: 2 - hashKey: UserId - region: us-east-1 - tags: - namespace: team-x - cluster: crossplane diff --git a/examples/upbound-aws-provider/composite-resources/dynamodbtable.yaml b/examples/upbound-aws-provider/composite-resources/dynamodbtable.yaml deleted file mode 100644 index a536fe7c..00000000 --- a/examples/upbound-aws-provider/composite-resources/dynamodbtable.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: awsblueprints.io/v1alpha1 -kind: DynamoDBTable -metadata: - name: test2-dynamodb-table - namespace: default -spec: - writeConnectionSecretToRef: - name: dynamo2 - attribute: - - name: UserId - type: S - hashKey: UserId - region: us-east-1 - tags: - namespace: team-x - cluster: crossplane