kind: Composition
apiVersion: apiextensions.crossplane.io/v1
metadata:
name: xreadonly.castai.aws.platform.upbound.io
creationTimestamp: null
labels:
provider: aws
spec:
compositeTypeRef:
apiVersion: castai.aws.platform.upbound.io/v1alpha1
kind: XReadOnly
mode: Pipeline
pipeline:
- step: patch-and-transform
functionRef:
name: crossplane-contrib-function-patch-and-transform
input:
apiVersion: pt.fn.crossplane.io/v1beta1
kind: Resources
patchSets:
- name: common
patches:
- fromFieldPath: spec.parameters.deletionPolicy
toFieldPath: spec.deletionPolicy
type: FromCompositeFieldPath
- fromFieldPath: spec.parameters.providerConfigName
toFieldPath: spec.providerConfigRef.name
type: FromCompositeFieldPath
- name: common-helm
patches:
- fromFieldPath: spec.parameters.deletionPolicy
toFieldPath: spec.deletionPolicy
type: FromCompositeFieldPath
- fromFieldPath: spec.parameters.id
toFieldPath: spec.providerConfigRef.name
type: FromCompositeFieldPath
resources:
- base:
apiVersion: castai.upbound.io/v1alpha1
kind: EksCluster
spec:
writeConnectionSecretToRef:
namespace: upbound-system
name: ekscluster
patches:
- patchSetName: common
type: PatchSet
- fromFieldPath: spec.parameters.clusterName
toFieldPath: metadata.labels[cast-ai-cluster]
type: FromCompositeFieldPath
- fromFieldPath: spec.parameters.clusterName
toFieldPath: spec.writeConnectionSecretToRef.name
transforms:
- string:
fmt: castai-%s
type: Format
type: string
type: FromCompositeFieldPath
- fromFieldPath: spec.parameters.region
toFieldPath: spec.forProvider.region
type: FromCompositeFieldPath
- fromFieldPath: spec.parameters.accountId
toFieldPath: spec.forProvider.accountId
transforms:
- string:
regexp:
group: 1
match: (\d+)
type: Regexp
type: string
type: FromCompositeFieldPath
- fromFieldPath: spec.parameters.clusterName
toFieldPath: spec.forProvider.name
type: FromCompositeFieldPath
- fromFieldPath: spec.parameters.deleteNodesOnDisconnect
toFieldPath: spec.forProvider.deleteNodesOnDisconnect
type: FromCompositeFieldPath
- fromFieldPath: spec.parameters.assumeRoleArn
toFieldPath: spec.forProvider.assumeRoleArn
type: FromCompositeFieldPath
- base:
apiVersion: helm.crossplane.io/v1beta1
kind: Release
spec:
forProvider:
chart:
name: castai-agent
repository: https://castai.github.io/helm-charts/
version: 0.67.0
namespace: castai-agent
set:
- name: apiKey
valueFrom:
secretKeyRef:
key: attribute.cluster_token
namespace: upbound-system
optional: false
values:
createNamespace: false
provider: eks
rollbackLimit: 3
name: agent
patches:
- patchSetName: common-helm
type: PatchSet
- fromFieldPath: spec.parameters.clusterName
toFieldPath: spec.forProvider.set[0].valueFrom.secretKeyRef.name
transforms:
- string:
fmt: castai-%s
type: Format
type: string
type: FromCompositeFieldPath
- fromFieldPath: spec.parameters.clusterName
toFieldPath: metadata.annotations[crossplane.io/external-name]
transforms:
- match:
fallbackValue: null
patterns:
- regexp: .*
result: castai-agent
type: regexp
type: match
type: FromCompositeFieldPath
writeConnectionSecretsToNamespace: upbound-system