Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apis/composition-rds-metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
- name: aws-creds
source: Secret
secretRef:
namespace: database-team
namespace: crossplane-system
name: aws-creds
- step: crossplane-contrib-function-auto-ready
functionRef:
Expand Down
12 changes: 12 additions & 0 deletions examples/providerconfig-aws-oidc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
apiVersion: aws.m.upbound.io/v1beta1
kind: ProviderConfig
metadata:
name: default
namespace: database-team
spec:
credentials:
source: Upbound
upbound:
webIdentity:
roleARN: arn:aws:iam::609897127049:role/solutions-e2e-provider-aws
16 changes: 7 additions & 9 deletions operations/rds-intelligent-scaling-cron/operation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ spec:
input:
apiVersion: claude.fn.upbound.io/v1alpha1
kind: Prompt
modelName: claude-haiku-4-5 # haiku brings serious cost savings
systemPrompt: |
You are an intelligent RDS scaling system that analyzes SQLInstance resources
and makes scaling decisions based on CloudWatch performance metrics.

Output only the JSON patch for the SQLInstance resource. Your entire response should be the JSON object, nothing else.
Return a JSON patch for the SQLInstance resource.
userPrompt: |
You are analyzing a SQLInstance resource for potential RDS scaling needs.

Expand All @@ -59,7 +60,7 @@ spec:
- Ensure minimum 5-minute cooldown between scaling events

OUTPUT FORMAT:
Provide your response as a JSON resource patch. The JSON should contain ONLY the fields that need to be updated.
Return a JSON patch containing only the fields that need updating.

If scaling is needed:
{
Expand Down Expand Up @@ -95,13 +96,10 @@ spec:
}

Rules:
- Use the exact resource name and namespace from the input
- Only include fields that need to be updated
- Use current timestamp in ISO8601 format
- Provide brief, clear reasoning in annotations
- IMPORTANT: v2 resources are namespaced, always include namespace in metadata
- Output the JSON on a single line without extra formatting
- no ```json in the output
- Use exact resource name and namespace from input
- Use current timestamp in ISO8601 format (YYYY-MM-DDTHH:MM:SSZ)
- Provide clear, concise reasoning in decision annotation
- Include namespace in metadata (v2 resources are namespaced)

SQLInstance Resource:
{{ .Resources }}
Expand Down
49 changes: 41 additions & 8 deletions tests/e2etest-sqlinstance/main.k
Original file line number Diff line number Diff line change
@@ -1,52 +1,71 @@
import models.io.upbound.awsm.v1beta1 as awsv1beta1
import models.io.upbound.dev.meta.v1alpha1 as metav1alpha1
import models.io.upbound.platform.aws.v1alpha1 as platformawsv1alpha1
import models.io.k8s.api.core.v1 as corev1

_items = [
metav1alpha1.E2ETest{
metadata.name: "sqlinstances"
spec= {
crossplane.autoUpgrade.channel: "Rapid"
crossplane.autoUpgrade.channel: "None"
crossplane.version: "2.1.1-up.1"
defaultConditions: ["Ready"]
manifests: [
# MariaDB instance with AI-powered scaling enabled
platformawsv1alpha1.SQLInstance{
metadata = {
name = "configuration-aws-database-mariadb"
name = "configuration-aws-database-ai-e2e-mariadb"
namespace = "default"
labels = {
"scale" = "me"
}
}
spec = {
crossplane.compositionSelector.matchLabels = {
"type" = "rds-metrics"
}
parameters = {
region = "us-west-2"
engine = "mariadb"
engineVersion = "10.11"
storageGB = 5
instanceClass = "db.t3.micro"
autoGeneratePassword = True
publiclyAccessible = False
passwordSecretRef = {
name = "mariadbsecret"
key = "password"
}
networkRef = {
id = "configuration-aws-database"
id = "configuration-aws-database-ai-e2e"
}
}
}
}
# Postgres instance without AI scaling (baseline test)
platformawsv1alpha1.SQLInstance{
metadata = {
name = "configuration-aws-database-postgres"
name = "configuration-aws-database-ai-e2e-postgres"
namespace = "default"
}
spec = {
crossplane.compositionSelector.matchLabels = {
"type" = "rds-metrics"
}
parameters = {
region = "us-west-2"
engine = "postgres"
engineVersion = "13.18"
storageGB = 5
instanceClass = "db.t3.micro"
autoGeneratePassword = True
publiclyAccessible = False
passwordSecretRef = {
name = "psqlsecret"
key = "password"
}
networkRef = {
id = "configuration-aws-database"
id = "configuration-aws-database-ai-e2e"
}
}
}
Expand All @@ -55,12 +74,12 @@ _items = [
apiVersion = "aws.platform.upbound.io/v1alpha1"
kind = "Network"
metadata = {
name = "configuration-aws-database"
name = "configuration-aws-database-ai-e2e"
namespace = "default"
}
spec = {
parameters = {
id = "configuration-aws-database"
id = "configuration-aws-database-ai-e2e"
region = "us-west-2"
}
}
Expand All @@ -70,7 +89,10 @@ _items = [
extraResources: [
# Define the provider configuration
awsv1beta1.ProviderConfig{
metadata.name = "default"
metadata = {
name = "default"
namespace = "default"
}
spec = {
credentials = {
source = "Upbound"
Expand All @@ -82,6 +104,17 @@ _items = [
}
}
}
# AWS credentials secret for function-rds-metrics (fake credentials for e2e test)
corev1.Secret{
metadata = {
name = "aws-creds"
namespace = "crossplane-system"
}
type = "Opaque"
data = {
credentials = "W2RlZmF1bHRdCmF3c19hY2Nlc3Nfa2V5X2lkID0gQUtJQUlPU0ZPRE5ON0VYQU1QTEUKYXdzX3NlY3JldF9hY2Nlc3Nfa2V5ID0gd0phbHJYVXRuRkVNSS9LN01ERU5HL2JQeFJmaUNZRVhBTVBMRUtFWQ=="
}
}
]
skipDelete: False
timeoutSeconds: 4500
Expand Down
2 changes: 1 addition & 1 deletion tests/test-credentials.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: v1
kind: Secret
metadata:
name: aws-creds
namespace: database-team
namespace: crossplane-system
type: Opaque
data:
credentials: W2RlZmF1bHRdCmF3c19hY2Nlc3Nfa2V5X2lkID0gQUtJQUlPU0ZPRE5ON0VYQU1QTEUKYXdzX3NlY3JldF9hY2Nlc3Nfa2V5ID0gd0phbHJYVXRuRkVNSS9LN01ERU5HL2JQeFJmaUNZRVhBTVBMRUtFWQ==
2 changes: 1 addition & 1 deletion upbound.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
- apiVersion: pkg.crossplane.io/v1
kind: Function
package: xpkg.upbound.io/upbound/function-claude
version: v0.3.0
version: v0.4.0
- apiVersion: pkg.crossplane.io/v1beta1
kind: Function
package: xpkg.upbound.io/upbound/function-rds-metrics
Expand Down
Loading