Created
June 29, 2022 14:02
-
-
Save jonashackt/dd3a770e811a82e419f2f0cf6f4800c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: apiextensions.crossplane.io/v1 | |
kind: Composition | |
metadata: | |
name: objectstorage-composition | |
labels: | |
# An optional convention is to include a label of the XRD. This allows | |
# easy discovery of compatible Compositions. | |
crossplane.io/xrd: xobjectstorages.crossplane.jonashackt.io | |
# The following label marks this Composition for AWS. This label can | |
# be used in 'compositionSelector' in an XR or Claim. | |
provider: aws | |
spec: | |
# Each Composition must declare that it is compatible with a particular type | |
# of Composite Resource using its 'compositeTypeRef' field. The referenced | |
# version must be marked 'referenceable' in the XRD that defines the XR. | |
compositeTypeRef: | |
apiVersion: crossplane.jonashackt.io/v1alpha1 | |
kind: XObjectStorage | |
# When an XR is created in response to a claim Crossplane needs to know where | |
# it should create the XR's connection secret. This is configured using the | |
# 'writeConnectionSecretsToNamespace' field. | |
writeConnectionSecretsToNamespace: crossplane-system | |
# Each Composition must specify at least one composed resource template. | |
resources: | |
# Providing a unique name for each entry is good practice. | |
# Only identifies the resources entry within the Composition. Required in future crossplane API versions. | |
- name: bucket | |
base: | |
# see https://doc.crds.dev/github.com/crossplane/provider-aws/s3.aws.crossplane.io/Bucket/[email protected] | |
apiVersion: s3.aws.crossplane.io/v1beta1 | |
kind: Bucket | |
metadata: {} | |
spec: | |
forProvider: | |
# public-read should enable public access for static website hosting | |
# see https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket | |
acl: "public-read" | |
websiteConfiguration: | |
indexDocument: | |
suffix: "index.html" | |
deletionPolicy: Delete | |
# Each resource can optionally specify a set of 'patches' that copy fields | |
# from (or to) the XR. | |
patches: | |
# All those fieldPath refer to XR or Claim spec.parameters | |
- fromFieldPath: "spec.parameters.bucketName" | |
toFieldPath: "metadata.name" | |
- fromFieldPath: "spec.parameters.region" | |
toFieldPath: "spec.forProvider.locationConstraint" | |
# If you find yourself repeating patches a lot you can group them as a named | |
# 'patch set' then use a PatchSet type patch to reference them. | |
#patchSets: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment