Skip to content

Commit

Permalink
feat: Added aws-rds promise and operators
Browse files Browse the repository at this point in the history
  • Loading branch information
hgoyal1 committed Jun 11, 2024
1 parent ed8caea commit 29e7e72
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 13 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# aws-rds-kratix-promise
# aws-rds-kratix-promise

30 changes: 18 additions & 12 deletions internal/configure-pipeline/execute-pipeline
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,24 @@ if [ "$KRATIX_WORKFLOW_TYPE" = "promise" ]; then
elif [ "$KRATIX_WORKFLOW_TYPE" = "resource" ]; then

echo "Executing resource workflow"
# base_instance="/tmp/transfer/resources/flink-basic.yaml"
#
# # Read current values from the provided resource request
# name="$(yq eval '.spec.name' /kratix/input/object.yaml)"
# namespace="$(yq eval '.spec.namespace // "default"' /kratix/input/object.yaml)"
#
# # Replace defaults with user provided values
# cat ${base_instance} |
# yq eval "
# .metadata.namespace = \"${namespace}\" |
# .metadata.name = \"${name}\"
# " - > /kratix/output/flink-instance.yaml
base_instance="/tmp/transfer/resources/rds-instance.yaml"

# Read current values from the provided resource request
name="$(yq eval '.spec.name' /kratix/input/object.yaml)"
namespace="$(yq eval '.spec.namespace // "default"' /kratix/input/object.yaml)"
engine="$(yq eval '.spec.engine // "postgres"' /kratix/input/object.yaml)"
engineVersion="$(yq eval '.spec.engineVersion' /kratix/input/object.yaml)"

# Replace defaults with user provided values
cat ${base_instance} |
yq eval "
.metadata.namespace = \"${namespace}\" |
.metadata.name = \"${name}\" |
.spec.dbInstanceIdentifier = ${name} |
.spec.masterUsername = ${name} |
.spec.engine = \"${engine}\" |
.spec.engineVersion = \"${engineVersion}\"
" - > /kratix/output/rds-instance.yaml

else

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: rds.services.k8s.aws/v1alpha1
kind: DBInstance
metadata:
name: "test-postgres-instance"
namespace: default
spec:
allocatedStorage: 20
dbInstanceClass: db.t4g.micro
Expand Down
7 changes: 7 additions & 0 deletions promise.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ spec:
name:
type: string
description: AWS RDS instance name
engine:
default: postgres
type: string
description: Choose aws rds engine(examples aurora, postgres, mysql etc)
engineVersion:
type: string
description: Aws rds engine version
workflows:
promise:
configure:
Expand Down
9 changes: 9 additions & 0 deletions resource-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: example.promise.syntasso.io/v1
kind: AWSRDS
metadata:
name: "PostgresRDSInstance"
spec:
name: "PostgresRDSInstance"
namespace: default
engine: "postgres"
engineVersion: "14"

0 comments on commit 29e7e72

Please sign in to comment.