argo/bootstrap/crossplane/example-managed-resources/composite-resources/composition.yaml
2025-03-05 13:02:36 -05:00

118 lines
3.4 KiB
YAML

apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
name: xexamples.aws.k8s.masos.dev
labels:
provider: aws
spec:
writeConnectionSecretsToNamespace: crossplane-system
compositeTypeRef:
apiVersion: k8s.masos.dev/v1alpha1
kind: XExample
patchSets:
- name: example-id
patches:
- type: CombineFromComposite
combine:
variables:
- fromFieldPath: spec.name
- fromFieldPath: spec.tenant
strategy: string
string:
fmt: "%s-%s"
fromFieldPath: spec.id
toFieldPath: metadata.labels[aws.k8s.masos.dev/example-id]
- type: ToCompositeFieldPath
fromFieldPath: metadata.labels[aws.k8s.masos.dev/example-id]
toFieldPath: status.masos.id
- type: ToCompositeFieldPath
fromFieldPath: metadata.labels[aws.k8s.masos.dev/example-id]
toFieldPath: status.masos-id
resources:
- base:
apiVersion: cognitoidp.aws.upbound.io/v1beta2
kind: UserPool
spec:
forProvider:
region: us-east-1
deletionProtection: INACTIVE
name: auth-backend
patches:
- type: PatchSet
patchSetName: example-id
- type: CombineFromComposite
combine:
variables:
- fromFieldPath: spec.name
- fromFieldPath: spec.tenant
strategy: string
string:
fmt: "%s-%s"
fromFieldPath: spec.id
toFieldPath: spec.forProvider.name
- name: group-admin
base:
apiVersion: cognitoidp.aws.upbound.io/v1beta1
kind: UserGroup
spec:
providerConfigRef:
name: cognito
forProvider:
name: admin
precedence: 10
region: us-east-1
# roleArnSelector:
# matchLabels:
# testing.upbound.io/example-name: group_role
userPoolIdSelector:
matchLabels:
aws.k8s.masos.dev/example-id: unset
patches:
- type: PatchSet
patchSetName: example-id
- type: CombineFromComposite
combine:
variables:
- fromFieldPath: spec.name
- fromFieldPath: spec.tenant
strategy: string
string:
fmt: "%s-%s"
fromFieldPath: spec.id
toFieldPath: spec.forProvider.userPoolIdSelector.matchLabels['aws.k8s.masos.dev/example-id']
- name: example-bucket
base:
apiVersion: cognitoidp.aws.upbound.io/v1beta1
kind: UserGroup
spec:
providerConfigRef:
name: s3
forProvider:
name: admin
precedence: 10
region: us-east-1
# roleArnSelector:
# matchLabels:
# testing.upbound.io/example-name: group_role
userPoolIdSelector:
matchLabels:
aws.k8s.masos.dev/example-id: unset
patches:
- type: PatchSet
patchSetName: example-id
- type: CombineFromComposite
combine:
variables:
- fromFieldPath: spec.name
- fromFieldPath: spec.tenant
strategy: string
string:
fmt: "%s-%s"
fromFieldPath: spec.id
toFieldPath: spec.forProvider.userPoolIdSelector.matchLabels['aws.k8s.masos.dev/example-id']