Skip to content

Commit

Permalink
Dynamo irsa (#145)
Browse files Browse the repository at this point in the history
* dynamo irsa
  • Loading branch information
candonov authored Sep 11, 2023
1 parent 7a7fc52 commit bfaa48d
Show file tree
Hide file tree
Showing 41 changed files with 600 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
toFieldPath: spec.forProvider.tags
policy:
mergeOptions:
appendSlice: true
keepMapValues: true
- type: FromCompositeFieldPath
fromFieldPath: spec.resourceConfig.name
toFieldPath: metadata.annotations[crossplane.io/external-name]
Expand Down
163 changes: 163 additions & 0 deletions compositions/upbound-aws-provider/dynamo-irsa/definition.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

apiVersion: apiextensions.crossplane.io/v1
kind: CompositeResourceDefinition
metadata:
name: xdynamoirsas.awsblueprints.io
spec:
claimNames:
kind: DynamoIRSA
plural: dynamoirsas
group: awsblueprints.io
names:
kind: XDynamoIRSA
plural: xdynamoirsas
connectionSecretKeys:
- tableName
versions:
- name: v1alpha1
served: true
referenceable: true
schema:
openAPIV3Schema:
type: object
description: DYNAMOIRSA is the Schema for the dynamoirsas API
properties:
spec:
type: object
properties:
policyArns:
items:
type: string
type: array
resourceConfig:
properties:
deletionPolicy:
description: Defaults to Delete
enum:
- Delete
- Orphan
type: string
name:
type: string
providerConfigName:
type: string
default: aws-provider-config
region:
type: string
tags:
additionalProperties:
type: string
description: Key-value map of resource tags.
type: object
required:
- region
type: object
dynamoConfig:
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
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
providerConfigName:
type: string
default: aws-provider-config
region:
type: string
tags:
additionalProperties:
type: string
description: Key-value map of resource tags.
type: object
required:
- attribute
- hashKey
type: object
required:
- resourceConfig
- dynamoConfig
status:
type: object
description: DYNAMOIRSAStatus defines the observed state of DYNAMOIRSA
properties:
roleName:
type: string
tableArn:
type: string
tableName:
type: string
required:
- spec
77 changes: 77 additions & 0 deletions compositions/upbound-aws-provider/dynamo-irsa/dynamo-irsa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0

apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
name: xdynamoirsa.awsblueprints.io
annotations:
argocd.argoproj.io/sync-wave: "-10"
labels:
awsblueprints.io/provider: aws
awsblueprints.io/environment: dev
spec:
writeConnectionSecretsToNamespace: crossplane-system
compositeTypeRef:
apiVersion: awsblueprints.io/v1alpha1
kind: XDynamoIRSA
patchSets:
- name: common-fields-composition
patches:
- type: FromCompositeFieldPath
fromFieldPath: spec.resourceConfig
toFieldPath: spec.resourceConfig
- type: FromCompositeFieldPath
fromFieldPath: spec.dynamoConfig
toFieldPath: spec.dynamoConfig
resources:
- name: dynamodbtable
connectionDetails:
- type: FromFieldPath
name: tableName
fromFieldPath: status.tableName
base:
apiVersion: awsblueprints.io/v1alpha1
kind: XDynamoDBTable
patches:
- type: PatchSet
patchSetName: common-fields-composition
- type: ToCompositeFieldPath
fromFieldPath: status.tableName
toFieldPath: status.tableName
- type: ToCompositeFieldPath
fromFieldPath: status.tableArn
toFieldPath: status.tableArn
- name: irsa
base:
apiVersion: awsblueprints.io/v1alpha1
kind: XIRSA
patches:
- type: PatchSet
patchSetName: common-fields-composition
- type: FromCompositeFieldPath
fromFieldPath: metadata.labels[crossplane.io/claim-name]
toFieldPath: spec.serviceAccountName
- type: ToCompositeFieldPath
fromFieldPath: status.roleName
toFieldPath: status.roleName
- name: irsa-dynamo-policy
base:
apiVersion: awsblueprints.io/v1alpha1
kind: IAMPolicy
spec:
compositionSelector:
matchLabels:
awsblueprints.io/provider: aws
awsblueprints.io/environment: dev
iam.awsblueprints.io/policy-type: write
iam.awsblueprints.io/service: dynamodb
patches:
- type: PatchSet
patchSetName: common-fields-composition
- type: FromCompositeFieldPath
fromFieldPath: status.roleName
toFieldPath: spec.roleName
- type: FromCompositeFieldPath
fromFieldPath: status.tableArn
toFieldPath: spec.resourceArn
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- definition.yaml
- dynamo-irsa.yaml
16 changes: 12 additions & 4 deletions compositions/upbound-aws-provider/dynamodb/definition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ spec:
properties:
resourceConfig:
properties:
deletionPolicy:
description: Defaults to Delete
enum:
- Delete
- Orphan
type: string
name:
type: string
providerConfigName:
type: string
default: aws-provider-config
Expand All @@ -39,6 +47,8 @@ spec:
type: string
description: Key-value map of resource tags.
type: object
required:
- region
type: object
dynamoConfig:
properties:
Expand Down Expand Up @@ -69,8 +79,6 @@ spec:
type: number
writeCapacity:
type: number
name:
type: string
globalSecondaryIndex:
items:
properties:
Expand Down Expand Up @@ -121,8 +129,8 @@ spec:
- nonKeyAttributes
type: array
required:
- hashKey
- attribute
- attribute
- hashKey
type: object
required:
- resourceConfig
Expand Down
5 changes: 5 additions & 0 deletions compositions/upbound-aws-provider/dynamodb/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- definition.yaml
- table.yaml
2 changes: 1 addition & 1 deletion compositions/upbound-aws-provider/dynamodb/table.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
fromFieldPath: spec.resourceConfig.region
toFieldPath: spec.forProvider.region
- type: FromCompositeFieldPath
fromFieldPath: spec.dynamoConfig.name
fromFieldPath: spec.resourceConfig.name
toFieldPath: metadata.annotations[crossplane.io/external-name]
resources:
- name: table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,10 @@ spec:
region:
type: string
tags:
items:
properties:
key:
type: string
value:
type: string
required:
- key
- value
type: object
type: array
additionalProperties:
type: string
description: Key-value map of resource tags.
type: object
required:
- providerConfigName
- region
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spec:
toFieldPath: spec.forProvider.tags
policy:
mergeOptions:
appendSlice: true
keepMapValues: true
- fromFieldPath: "metadata.name"
toFieldPath: "metadata.name"
transforms:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
toFieldPath: spec.forProvider.tags
policy:
mergeOptions:
appendSlice: true
keepMapValues: true
- fromFieldPath: "metadata.name"
toFieldPath: "metadata.name"
transforms:
Expand Down
15 changes: 4 additions & 11 deletions compositions/upbound-aws-provider/iam-policy/definition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,10 @@ spec:
providerConfigName:
type: string
tags:
items:
properties:
key:
type: string
value:
type: string
required:
- key
- value
type: object
type: array
additionalProperties:
type: string
description: Key-value map of resource tags.
type: object
required:
- providerConfigName
type: object
Expand Down
Loading

0 comments on commit bfaa48d

Please sign in to comment.