Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
pbateman committed Jun 22, 2022
0 parents commit 83fe64d
Show file tree
Hide file tree
Showing 3 changed files with 212 additions and 0 deletions.
125 changes: 125 additions & 0 deletions example_composition.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
name: linkedingress.awsblueprints.io
spec:
compositeTypeRef:
apiVersion: awsblueprints.io/v1alpha1
kind: XLinkedIngress
patchSets:
- name: common-fields
patches:
- type: FromCompositeFieldPath
fromFieldPath: spec.resourceConfig.providerConfigName
toFieldPath: spec.providerConfigRef.name
policy:
mergeOptions:
appendSlice: true
- type: FromCompositeFieldPath
fromFieldPath: spec.resourceConfig.name
toFieldPath: metadata.annotations[crossplane.io/external-name]
- type: FromCompositeFieldPath
fromFieldPath: spec.resourceConfig.namespace
toFieldPath: metadata.namespace
- type: FromCompositeFieldPath
fromFieldPath: spec.resourceConfig.namespace
toFieldPath: spec.forProvider.manifest.metadata.namespace
resources:
- base:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
metadata:
name: django-deployment
spec:
forProvider:
manifest:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: django
spec:
replicas: 1
selector:
matchLabels:
app: django
template:
metadata:
labels:
app: django
spec:
containers:
- name: django
image: strm/helloworld-http
ports:
- containerPort: 8000
patches:
- type: PatchSet
patchSetName: common-fields

- base:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
metadata:
name: django-ingress
spec:
forProvider:
manifest:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
'alb.ingress.kubernetes.io/load-balancer-name': foobar
'alb.ingress.kubernetes.io/scheme': internal
'alb.ingress.kubernetes.io/target-type': ip
'kubernetes.io/ingress.class': alb
patches:
- type: PatchSet
patchSetName: common-fields
- type: FromCompositeFieldPath
fromFieldPath: spec.resourceConfig.serviceName
toFieldPath: spec.forProvider.manifest.spec.defaultBackend.service.name
- type: FromCompositeFieldPath
fromFieldPath: spec.resourceConfig.servicePort
toFieldPath: spec.forProvider.manifest.spec.defaultBackend.service.port.number
- type: ToCompositeFieldPath
fromFieldPath: status.atProvider.manifest.status.loadBalancer.ingress.hostname
toFieldpath: compositeFields.ingress.hostname

- base:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
metadata:
name: django-r53
spec:
references:
- patchesFrom:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Ingress
name: django
namespace: django
fieldPath: status.loadBalancer.ingress.hostname
toFieldPath: spec.forProvider.dnsName
forProvider:
manifest:
apiVersion: route53.aws.crossplane.io/v1alpha1
kind: ResourceRecordSet
metadata:
name: foobar.testingtesting123.com
spec:
forProvider:
aliasTarget:
evaluateTargetHealth: false
type: A
patches:
- type: PatchSet
patchSetName: common-fields
- type: FromCompositeFieldPath
fromFieldPath: spec.resourceConfig.hostedZoneId
toFieldPath: spec.forProvider.manifest.spec.forProvider.aliasTarget.hostedZoneId
- type: FromCompositeFieldPath
fromFieldPath: spec.resourceConfig.zoneId
toFieldPath: spec.forProvider.manifest.spec.forProvider.zoneId
- type: FromCompositeFieldPath
fromFieldPath: compositeFields.ingress.hostname
toFieldPath: spec.forProvider.manifest.spec.forProvider.aliasTarget.dnsName
15 changes: 15 additions & 0 deletions example_composition_claim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: awsblueprints.io/v1alpha1
kind: LinkedIngress
metadata:
name: foorbar-app
namespace: django
spec:
resourceConfig:
providerConfigName: default
region: ap-southeast-2
tags:
- key: foo
value: bar
hostedZoneId: Z1GM3OXH4ZPM65
zoneId: Z00626772CD7OE03KL3L0
fqdn: foobar.testingtesting123.com
72 changes: 72 additions & 0 deletions example_composition_definition.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
apiVersion: apiextensions.crossplane.io/v1
kind: CompositeResourceDefinition
metadata:
name: xlinkedingress.awsblueprints.io
spec:
group: awsblueprints.io
names:
kind: XLinkedIngress
plural: xlinkedingresses
claimNames:
kind: LinkedIngress
plural: linkedingresses
versions:
- name: v1alpha1
served: true
referenceable: true
schema:
openAPIV3Schema:
properties:
spec:
properties:
fqdn:
type: string
hostedZoneId:
type: string
zoneId:
type: string
resourceConfig:
description: ResourceConfig defines general properties of this AWS
resource.
properties:
deletionPolicy:
description: Defaults to Delete
enum:
- Delete
- Orphan
type: string
name:
description: Set the name of this resource in AWS to the value provided by this field.
type: string
namespace:
description: The namespace where all the resources for this composition should live
type: string
providerConfigName:
type: string
region:
description: The aws region to make resources in, eg ap-southeast-2
type: string
tags:
items:
properties:
key:
type: string
value:
type: string
required:
- key
- value
type: object
type: array
required:
- providerConfigName
- region
- tags
type: object
required:
- resourceConfig
- hostedZoneId
- zoneId
- fqdn
type: object
type: object

0 comments on commit 83fe64d

Please sign in to comment.